Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
51:56 queued 35:16
created
core/admin/EE_Admin_Page.core.php 4 patches
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @final
481 481
 	 * @access protected
482
-	 * @return void
482
+	 * @return false|null
483 483
 	 */
484 484
 	final protected function _page_setup() {
485 485
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * All this method does is verify the incoming request and make sure that routes exist for it.  We do this early so we know if we need to drop out.
754 754
 	 *
755 755
 	 * @access protected
756
-	 * @return void
756
+	 * @return false|null
757 757
 	 */
758 758
 	protected function _verify_routes() {
759 759
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	/**
816 816
 	 * this method simply verifies a given route and makes sure its an actual route available for the loaded page
817 817
 	 * @param  string $route the route name we're verifying
818
-	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
818
+	 * @return boolean  (bool|Exception)      we'll throw an exception if this isn't a valid route.
819 819
 	 */
820 820
 	protected function _verify_route( $route ) {
821 821
 		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
@@ -3368,7 +3368,7 @@  discard block
 block discarded – undo
3368 3368
 
3369 3369
 
3370 3370
 	/**
3371
-	 * @return mixed
3371
+	 * @return string[]
3372 3372
 	 */
3373 3373
 	public function default_espresso_metaboxes() {
3374 3374
 		return $this->_default_espresso_metaboxes;
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
 
3387 3387
 
3388 3388
 	/**
3389
-	 * @return mixed
3389
+	 * @return string
3390 3390
 	 */
3391 3391
 	public function wp_page_slug() {
3392 3392
 		return $this->_wp_page_slug;
@@ -3399,7 +3399,6 @@  discard block
 block discarded – undo
3399 3399
 	 *
3400 3400
 	 * @access 	protected
3401 3401
 	 * @param string $tab
3402
-	 * @param array $data
3403 3402
 	 * @param string $file	file where error occurred
3404 3403
 	 * @param string $func function  where error occurred
3405 3404
 	 * @param string $line	line no where error occurred
Please login to merge, or discard this patch.
Indentation   +55 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1311,8 +1311,8 @@  discard block
 block discarded – undo
1311 1311
 	 * 		verifies user access for this admin page
1312 1312
 	 * 		@param string $route_to_check if present then the capability for the route matching this string is checked.
1313 1313
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1314
-	*		@return 		BOOL|wp_die()
1315
-	*/
1314
+	 *		@return 		BOOL|wp_die()
1315
+	 */
1316 1316
 	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1317 1317
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1318 1318
 		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
@@ -1698,11 +1698,11 @@  discard block
 block discarded – undo
1698 1698
 
1699 1699
 
1700 1700
 	/**
1701
-	*		admin_footer_scripts_eei18n_js_strings
1702
-	*
1703
-	*		@access 		public
1704
-	*		@return 		void
1705
-	*/
1701
+	 *		admin_footer_scripts_eei18n_js_strings
1702
+	 *
1703
+	 *		@access 		public
1704
+	 *		@return 		void
1705
+	 */
1706 1706
 	public function admin_footer_scripts_eei18n_js_strings() {
1707 1707
 
1708 1708
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
@@ -1758,11 +1758,11 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
 
1760 1760
 	/**
1761
-	*		load enhanced xdebug styles for ppl with failing eyesight
1762
-	*
1763
-	*		@access 		public
1764
-	*		@return 		void
1765
-	*/
1761
+	 *		load enhanced xdebug styles for ppl with failing eyesight
1762
+	 *
1763
+	 *		@access 		public
1764
+	 *		@return 		void
1765
+	 */
1766 1766
 	public function add_xdebug_style() {
1767 1767
 		echo '<style>.xdebug-error { font-size:1.5em; }</style>';
1768 1768
 	}
@@ -1819,9 +1819,9 @@  discard block
 block discarded – undo
1819 1819
 
1820 1820
 	/**
1821 1821
 	 * 		set current view for List Table
1822
-	*		@access public
1823
-	*		@return array
1824
-	*/
1822
+	 *		@access public
1823
+	 *		@return array
1824
+	 */
1825 1825
 	protected function _set_list_table_view() {
1826 1826
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1827 1827
 
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
 	 * @access protected
1911 1911
 	 * @param int $max_entries total number of rows in the table
1912 1912
 	 * @return string
1913
-	*/
1913
+	 */
1914 1914
 	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1915 1915
 
1916 1916
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -1955,9 +1955,9 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
 	/**
1957 1957
 	 * 		_set_search_attributes
1958
-	*		@access 		protected
1959
-	*		@return 		void
1960
-	*/
1958
+	 *		@access 		protected
1959
+	 *		@return 		void
1960
+	 */
1961 1961
 	public function _set_search_attributes() {
1962 1962
 		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1963 1963
 		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 	 * @link http://codex.wordpress.org/Function_Reference/add_meta_box
1978 1978
 	 * @access private
1979 1979
 	 * @return void
1980
-	*/
1980
+	 */
1981 1981
 	private function _add_registered_meta_boxes() {
1982 1982
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1983 1983
 
@@ -2209,7 +2209,6 @@  discard block
 block discarded – undo
2209 2209
 	 * Note: currently there is no validation for this.  However if you want the delete button, the
2210 2210
 	 * save, and save and close buttons to work properly, then you will want to include a
2211 2211
 	 * values for the name and id arguments.
2212
-
2213 2212
 	 *
2214 2213
 *@todo  Add in validation for name/id arguments.
2215 2214
 	 * @param    string  $name                    key used for the action ID (i.e. event_id)
@@ -2268,9 +2267,9 @@  discard block
 block discarded – undo
2268 2267
 
2269 2268
 	/**
2270 2269
 	 * 		displays an error message to ppl who have javascript disabled
2271
-	*		@access 		private
2272
-	*		@return 		string
2273
-	*/
2270
+	 *		@access 		private
2271
+	 *		@return 		string
2272
+	 */
2274 2273
 	private function _display_no_javascript_warning() {
2275 2274
 		?>
2276 2275
 		<noscript>
@@ -2293,9 +2292,9 @@  discard block
 block discarded – undo
2293 2292
 
2294 2293
 	/**
2295 2294
 	 * 		displays espresso success and/or error notices
2296
-	*		@access 		private
2297
-	*		@return 		string
2298
-	*/
2295
+	 *		@access 		private
2296
+	 *		@return 		string
2297
+	 */
2299 2298
 	private function _display_espresso_notices() {
2300 2299
 		$notices = $this->_get_transient( TRUE );
2301 2300
 		echo stripslashes($notices);
@@ -2307,10 +2306,10 @@  discard block
 block discarded – undo
2307 2306
 
2308 2307
 
2309 2308
 	/**
2310
-	*		spinny things pacify the masses
2311
-	*		@access private
2312
-	*		@return string
2313
-	*/
2309
+	 *		spinny things pacify the masses
2310
+	 *		@access private
2311
+	 *		@return string
2312
+	 */
2314 2313
 	protected function _add_admin_page_ajax_loading_img() {
2315 2314
 		?>
2316 2315
 			<div id="espresso-ajax-loading" class="ajax-loading-grey">
@@ -2324,10 +2323,10 @@  discard block
 block discarded – undo
2324 2323
 
2325 2324
 
2326 2325
 	/**
2327
-	*		add admin page overlay for modal boxes
2328
-	*		@access private
2329
-	*		@return string
2330
-	*/
2326
+	 *		add admin page overlay for modal boxes
2327
+	 *		@access private
2328
+	 *		@return string
2329
+	 */
2331 2330
 	protected function _add_admin_page_overlay() {
2332 2331
 		?>
2333 2332
 		<div id="espresso-admin-page-overlay-dv" class=""></div>
@@ -2389,10 +2388,10 @@  discard block
 block discarded – undo
2389 2388
 
2390 2389
 
2391 2390
 	/**
2392
-	*		generates  HTML wrapper for an admin details page
2393
-	*		@access public
2394
-	*		@return void
2395
-	*/
2391
+	 *		generates  HTML wrapper for an admin details page
2392
+	 *		@access public
2393
+	 *		@return void
2394
+	 */
2396 2395
 	public function display_admin_page_with_sidebar() {
2397 2396
 
2398 2397
 		$this->_display_admin_page(TRUE);
@@ -2402,10 +2401,10 @@  discard block
 block discarded – undo
2402 2401
 
2403 2402
 
2404 2403
 	/**
2405
-	*		generates  HTML wrapper for an admin details page (except no sidebar)
2406
-	*		@access public
2407
-	*		@return void
2408
-	*/
2404
+	 *		generates  HTML wrapper for an admin details page (except no sidebar)
2405
+	 *		@access public
2406
+	 *		@return void
2407
+	 */
2409 2408
 	public function display_admin_page_with_no_sidebar() {
2410 2409
 		$this->_display_admin_page();
2411 2410
 	}
@@ -2662,11 +2661,11 @@  discard block
 block discarded – undo
2662 2661
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2663 2662
 		if ( NULL === error_get_last() || ! headers_sent() )
2664 2663
 			header('Content-Type: application/json; charset=UTF-8');
2665
-                if( function_exists( 'wp_json_encode' ) ) {
2666
-                    echo wp_json_encode( $json );
2667
-                } else {
2668
-                    echo json_encode( $json );
2669
-                }
2664
+				if( function_exists( 'wp_json_encode' ) ) {
2665
+					echo wp_json_encode( $json );
2666
+				} else {
2667
+					echo json_encode( $json );
2668
+				}
2670 2669
 		exit();
2671 2670
 	}
2672 2671
 
@@ -2705,11 +2704,11 @@  discard block
 block discarded – undo
2705 2704
 
2706 2705
 
2707 2706
 	/**
2708
-	*		generates  HTML wrapper with Tabbed nav for an admin page
2709
-	*		@access public
2710
-	*		@param  boolean $about whether to use the special about page wrapper or default.
2711
-	*		@return void
2712
-	*/
2707
+	 *		generates  HTML wrapper with Tabbed nav for an admin page
2708
+	 *		@access public
2709
+	 *		@param  boolean $about whether to use the special about page wrapper or default.
2710
+	 *		@return void
2711
+	 */
2713 2712
 	public function admin_page_wrapper($about = FALSE) {
2714 2713
 
2715 2714
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2766,9 +2765,9 @@  discard block
 block discarded – undo
2766 2765
 	 */
2767 2766
 	private function _sort_nav_tabs( $a, $b ) {
2768 2767
 		if ($a['order'] == $b['order']) {
2769
-	        return 0;
2770
-	    }
2771
-	    return ($a['order'] < $b['order']) ? -1 : 1;
2768
+			return 0;
2769
+		}
2770
+		return ($a['order'] < $b['order']) ? -1 : 1;
2772 2771
 	}
2773 2772
 
2774 2773
 
Please login to merge, or discard this patch.
Spacing   +610 added lines, -610 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  * Event Espresso
6 6
  *
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
161 161
 	 * 		@access public
162 162
 	 */
163
-	public function __construct( $routing = TRUE ) {
163
+	public function __construct($routing = TRUE) {
164 164
 
165
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
165
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
166 166
 			$this->_is_caf = TRUE;
167 167
 
168 168
 		$this->_yes_no_values = array(
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 		//set the _req_data property.
176
-		$this->_req_data = array_merge( $_GET, $_POST );
176
+		$this->_req_data = array_merge($_GET, $_POST);
177 177
 
178 178
 
179 179
 		//routing enabled?
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		$this->_do_other_page_hooks();
195 195
 
196 196
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
197
-		if ( method_exists( $this, '_before_page_setup' ) )
197
+		if (method_exists($this, '_before_page_setup'))
198 198
 			$this->_before_page_setup();
199 199
 
200 200
 		//set up page dependencies
@@ -464,16 +464,16 @@  discard block
 block discarded – undo
464 464
 	 */
465 465
 	protected function _global_ajax_hooks() {
466 466
 		//for lazy loading of metabox content
467
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
467
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
468 468
 	}
469 469
 
470 470
 
471 471
 
472 472
 	public function ajax_metabox_content() {
473
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
474
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
473
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
474
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
475 475
 
476
-		self::cached_rss_display( $contentid, $url );
476
+		self::cached_rss_display($contentid, $url);
477 477
 		wp_die();
478 478
 	}
479 479
 
@@ -492,87 +492,87 @@  discard block
 block discarded – undo
492 492
 		//requires?
493 493
 
494 494
 		//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.
495
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
495
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
496 496
 
497 497
 
498 498
 		//next verify if we need to load anything...
499
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : '';
500
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
499
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
500
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
501 501
 
502 502
 		global $ee_menu_slugs;
503 503
 		$ee_menu_slugs = (array) $ee_menu_slugs;
504 504
 
505
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
505
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
506 506
 
507 507
 
508 508
 		// 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
509
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
510
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
509
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
510
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
511 511
 		}
512 512
 		// then set blank or -1 action values to 'default'
513
-		$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';
513
+		$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';
514 514
 
515 515
 		//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.
516
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
516
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
517 517
 
518 518
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
519 519
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
520 520
 
521 521
 		$this->_current_view = $this->_req_action;
522
-		$this->_req_nonce = $this->_req_action . '_nonce';
522
+		$this->_req_nonce = $this->_req_action.'_nonce';
523 523
 		$this->_define_page_props();
524 524
 
525
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
525
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
526 526
 
527 527
 		//default things
528
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
528
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
529 529
 
530 530
 		//set page configs
531 531
 		$this->_set_page_routes();
532 532
 		$this->_set_page_config();
533 533
 
534 534
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
535
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
535
+		if (isset($this->_req_data['wp_referer'])) {
536 536
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
537 537
 		}
538 538
 
539 539
 		//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
540
-		if ( method_exists( $this, '_extend_page_config' ) )
540
+		if (method_exists($this, '_extend_page_config'))
541 541
 			$this->_extend_page_config();
542 542
 
543 543
 		//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.
544
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
544
+		if (method_exists($this, '_extend_page_config_for_cpt'))
545 545
 			$this->_extend_page_config_for_cpt();
546 546
 
547 547
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
548
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
549
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
548
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
549
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
550 550
 
551 551
 
552 552
 		//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
553
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
554
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
553
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
554
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
555 555
 		}
556 556
 
557 557
 
558 558
 		//next route only if routing enabled
559
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
559
+		if ($this->_routing && ! defined('DOING_AJAX')) {
560 560
 
561 561
 			$this->_verify_routes();
562 562
 
563 563
 			//next let's just check user_access and kill if no access
564 564
 			$this->check_user_access();
565 565
 
566
-			if ( $this->_is_UI_request ) {
566
+			if ($this->_is_UI_request) {
567 567
 				//admin_init stuff - global, all views for this page class, specific view
568
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
569
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
570
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
568
+				add_action('admin_init', array($this, 'admin_init'), 10);
569
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
570
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
571 571
 				}
572 572
 
573 573
 			} else {
574 574
 				//hijack regular WP loading and route admin request immediately
575
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
575
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
576 576
 				$this->route_admin_request();
577 577
 			}
578 578
 		}
@@ -589,18 +589,18 @@  discard block
 block discarded – undo
589 589
 	 * @return void
590 590
 	 */
591 591
 	private function _do_other_page_hooks() {
592
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
592
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
593 593
 
594
-		foreach ( $registered_pages as $page ) {
594
+		foreach ($registered_pages as $page) {
595 595
 
596 596
 			//now let's setup the file name and class that should be present
597 597
 			$classname = str_replace('.class.php', '', $page);
598 598
 
599 599
 			//autoloaders should take care of loading file
600
-			if ( !class_exists( $classname ) ) {
601
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
602
-				$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 );
603
-				throw new EE_Error( implode( '||', $error_msg ));
600
+			if ( ! class_exists($classname)) {
601
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
602
+				$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);
603
+				throw new EE_Error(implode('||', $error_msg));
604 604
 			}
605 605
 
606 606
 			$a = new ReflectionClass($classname);
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	public function load_page_dependencies() {
616 616
 		try {
617 617
 			$this->_load_page_dependencies();
618
-		} catch ( EE_Error $e ) {
618
+		} catch (EE_Error $e) {
619 619
 			$e->get_error();
620 620
 		}
621 621
 	}
@@ -633,16 +633,16 @@  discard block
 block discarded – undo
633 633
 		$this->_current_screen = get_current_screen();
634 634
 
635 635
 		//load admin_notices - global, page class, and view specific
636
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
637
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
638
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
639
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
636
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
637
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
638
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
639
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
640 640
 		}
641 641
 
642 642
 		//load network admin_notices - global, page class, and view specific
643
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
644
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
645
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
643
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
644
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
645
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
646 646
 		}
647 647
 
648 648
 		//this will save any per_page screen options if they are present
@@ -658,8 +658,8 @@  discard block
 block discarded – undo
658 658
 		//add screen options - global, page child class, and view specific
659 659
 		$this->_add_global_screen_options();
660 660
 		$this->_add_screen_options();
661
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
662
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
661
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
662
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
663 663
 
664 664
 
665 665
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -670,33 +670,33 @@  discard block
 block discarded – undo
670 670
 		//add feature_pointers - global, page child class, and view specific
671 671
 		$this->_add_feature_pointers();
672 672
 		$this->_add_global_feature_pointers();
673
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
674
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
673
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
674
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
675 675
 
676 676
 		//enqueue scripts/styles - global, page class, and view specific
677
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
678
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
679
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
680
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
677
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
678
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
679
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
680
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
681 681
 
682
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
682
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
683 683
 
684 684
 		//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
685
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
686
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
687
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
688
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
685
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
686
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
687
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
688
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
689 689
 
690 690
 		//admin footer scripts
691
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
692
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
693
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
694
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
691
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
692
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
693
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
694
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
695 695
 
696 696
 
697
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
697
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
698 698
 		//targeted hook
699
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
699
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
700 700
 
701 701
 	}
702 702
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	private function _set_defaults() {
712 712
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
713 713
 
714
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
714
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
715 715
 
716 716
 		$this->default_nav_tab_name = 'overview';
717 717
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	public function route_admin_request() {
739 739
 		try {
740 740
 			$this->_route_admin_request();
741
-		} catch ( EE_Error $e ) {
741
+		} catch (EE_Error $e) {
742 742
 			$e->get_error();
743 743
 		}
744 744
 	}
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		$this->_wp_page_slug = $wp_page_slug;
750 750
 
751 751
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
752
-		if ( is_network_admin() ) {
752
+		if (is_network_admin()) {
753 753
 			$this->_wp_page_slug .= '-network';
754 754
 		}
755 755
 	}
@@ -762,53 +762,53 @@  discard block
 block discarded – undo
762 762
 	 * @return void
763 763
 	 */
764 764
 	protected function _verify_routes() {
765
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
765
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
766 766
 
767
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
767
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
768 768
 
769 769
 		$this->_route = FALSE;
770 770
 		$func = FALSE;
771 771
 		$args = array();
772 772
 
773 773
 		// check that the page_routes array is not empty
774
-		if ( empty( $this->_page_routes )) {
774
+		if (empty($this->_page_routes)) {
775 775
 			// user error msg
776
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
776
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
777 777
 			// developer error msg
778
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
779
-			throw new EE_Error( $error_msg );
778
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
779
+			throw new EE_Error($error_msg);
780 780
 		}
781 781
 
782 782
 		// and that the requested page route exists
783
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
784
-			$this->_route = $this->_page_routes[ $this->_req_action ];
783
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
784
+			$this->_route = $this->_page_routes[$this->_req_action];
785 785
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
786 786
 		} else {
787 787
 			// user error msg
788
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
788
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
789 789
 			// developer error msg
790
-			$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 );
791
-			throw new EE_Error( $error_msg );
790
+			$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);
791
+			throw new EE_Error($error_msg);
792 792
 		}
793 793
 
794 794
 		// and that a default route exists
795
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
795
+		if ( ! array_key_exists('default', $this->_page_routes)) {
796 796
 			// user error msg
797
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
797
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
798 798
 			// developer error msg
799
-			$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' );
800
-			throw new EE_Error( $error_msg );
799
+			$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');
800
+			throw new EE_Error($error_msg);
801 801
 		}
802 802
 
803 803
 
804 804
 		//first lets' catch if the UI request has EVER been set.
805
-		if ( $this->_is_UI_request === NULL ) {
805
+		if ($this->_is_UI_request === NULL) {
806 806
 			//lets set if this is a UI request or not.
807
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
807
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
808 808
 
809 809
 
810 810
 			//wait a minute... we might have a noheader in the route array
811
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
811
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
812 812
 		}
813 813
 
814 814
 		$this->_set_current_labels();
@@ -823,15 +823,15 @@  discard block
 block discarded – undo
823 823
 	 * @param  string $route the route name we're verifying
824 824
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
825 825
 	 */
826
-	protected function _verify_route( $route ) {
827
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
826
+	protected function _verify_route($route) {
827
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
828 828
 			return true;
829 829
 		} else {
830 830
 			// user error msg
831
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
831
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
832 832
 			// developer error msg
833
-			$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 );
834
-			throw new EE_Error( $error_msg );
833
+			$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);
834
+			throw new EE_Error($error_msg);
835 835
 		}
836 836
 	}
837 837
 
@@ -845,18 +845,18 @@  discard block
 block discarded – undo
845 845
 	 * @param  string $nonce_ref The nonce reference string (name0)
846 846
 	 * @return mixed (bool|die)
847 847
 	 */
848
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
848
+	protected function _verify_nonce($nonce, $nonce_ref) {
849 849
 		// verify nonce against expected value
850
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
850
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
851 851
 			// these are not the droids you are looking for !!!
852
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
853
-			if ( WP_DEBUG ) {
854
-				$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__  );
852
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
853
+			if (WP_DEBUG) {
854
+				$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__);
855 855
 			}
856
-			if ( ! defined( 'DOING_AJAX' )) {
857
-				wp_die( $msg );
856
+			if ( ! defined('DOING_AJAX')) {
857
+				wp_die($msg);
858 858
 			} else {
859
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
859
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
860 860
 				$this->_return_json();
861 861
 			}
862 862
 		}
@@ -874,63 +874,63 @@  discard block
 block discarded – undo
874 874
 	 * @return void
875 875
 	 */
876 876
 	protected function _route_admin_request() {
877
-		if (  ! $this->_is_UI_request )
877
+		if ( ! $this->_is_UI_request)
878 878
 			$this->_verify_routes();
879 879
 
880
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
880
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
881 881
 
882
-		if ( $this->_req_action != 'default' && $nonce_check ) {
882
+		if ($this->_req_action != 'default' && $nonce_check) {
883 883
 			// set nonce from post data
884
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
885
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
884
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
885
+			$this->_verify_nonce($nonce, $this->_req_nonce);
886 886
 		}
887 887
 		//set the nav_tabs array but ONLY if this is  UI_request
888
-		if ( $this->_is_UI_request )
888
+		if ($this->_is_UI_request)
889 889
 			$this->_set_nav_tabs();
890 890
 
891 891
 		// grab callback function
892
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
892
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
893 893
 
894 894
 		// check if callback has args
895
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
895
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
896 896
 
897 897
 		$error_msg = '';
898 898
 
899 899
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
900
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
901
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
900
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
901
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
902 902
 		}
903 903
 
904 904
 		//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).
905
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
905
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
906 906
 
907
-		if ( ! empty( $func )) {
907
+		if ( ! empty($func)) {
908 908
 			$base_call = $addon_call = FALSE;
909 909
 			//try to access page route via this class
910
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
910
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
911 911
 				// user error msg
912
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
912
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
913 913
 				// developer error msg
914
-				$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 );
914
+				$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);
915 915
 			}
916 916
 
917 917
 			//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)
918 918
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
919 919
 
920
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
921
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
922
-				$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 );
920
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
921
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
922
+				$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);
923 923
 			}
924 924
 
925 925
 
926
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
927
-				throw new EE_Error( $error_msg );
926
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
927
+				throw new EE_Error($error_msg);
928 928
 		}
929 929
 
930 930
 		//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.
931 931
 		//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.
932
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
933
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
932
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
933
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
934 934
 		}
935 935
 	}
936 936
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 	 * @param  string    $new_route   New (non header) route to redirect to.
947 947
 	 * @return   void
948 948
 	 */
949
-	protected function _reset_routing_properties( $new_route ) {
949
+	protected function _reset_routing_properties($new_route) {
950 950
 		$this->_is_UI_request = TRUE;
951 951
 		//now we set the current route to whatever the headers_sent_route is set at
952 952
 		$this->_req_data['action'] = $new_route;
@@ -992,23 +992,23 @@  discard block
 block discarded – undo
992 992
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
993 993
 	 * 	@return string
994 994
 	 */
995
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
995
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
996 996
 
997 997
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
998
-		if ( $sticky ) {
998
+		if ($sticky) {
999 999
 			$request = $_REQUEST;
1000
-			unset( $request['_wp_http_referer'] );
1001
-			unset( $request['wp_referer'] );
1002
-			foreach ( $request as $key => $value ) {
1000
+			unset($request['_wp_http_referer']);
1001
+			unset($request['wp_referer']);
1002
+			foreach ($request as $key => $value) {
1003 1003
 				//do not add nonces
1004
-				if ( strpos( $key, 'nonce' ) !== false ) {
1004
+				if (strpos($key, 'nonce') !== false) {
1005 1005
 					continue;
1006 1006
 				}
1007
-				$args['wp_referer[' . $key . ']'] = $value;
1007
+				$args['wp_referer['.$key.']'] = $value;
1008 1008
 			}
1009 1009
 		}
1010 1010
 
1011
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1011
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1012 1012
 	}
1013 1013
 
1014 1014
 
@@ -1024,8 +1024,8 @@  discard block
 block discarded – undo
1024 1024
 	 * @uses EEH_Template::get_help_tab_link()
1025 1025
 	 * @return string              generated link
1026 1026
 	 */
1027
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1028
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1027
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1028
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1042,30 +1042,30 @@  discard block
 block discarded – undo
1042 1042
 	 */
1043 1043
 	protected function _add_help_tabs() {
1044 1044
 		$tour_buttons = '';
1045
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1045
+		if (isset($this->_page_config[$this->_req_action])) {
1046 1046
 			$config = $this->_page_config[$this->_req_action];
1047 1047
 
1048 1048
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1049
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1049
+			if (isset($this->_help_tour[$this->_req_action])) {
1050 1050
 				$tb = array();
1051 1051
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1052
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1052
+				foreach ($this->_help_tour['tours'] as $tour) {
1053 1053
 					//if this is the end tour then we don't need to setup a button
1054
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1054
+					if ($tour instanceof EE_Help_Tour_final_stop)
1055 1055
 						continue;
1056
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1056
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1057 1057
 				}
1058 1058
 				$tour_buttons .= implode('<br />', $tb);
1059 1059
 				$tour_buttons .= '</div></div>';
1060 1060
 			}
1061 1061
 
1062 1062
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1063
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1063
+			if (is_array($config) && isset($config['help_sidebar'])) {
1064 1064
 				//check that the callback given is valid
1065
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1066
-					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) ) );
1065
+				if ( ! method_exists($this, $config['help_sidebar']))
1066
+					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)));
1067 1067
 
1068
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1068
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1069 1069
 
1070 1070
 				$content .= $tour_buttons; //add help tour buttons.
1071 1071
 
@@ -1074,49 +1074,49 @@  discard block
 block discarded – undo
1074 1074
 			}
1075 1075
 
1076 1076
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1077
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1077
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1078 1078
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1079 1079
 			}
1080 1080
 
1081 1081
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1082
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1082
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1083 1083
 				$_ht['id'] = $this->page_slug;
1084 1084
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1085
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1085
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1086 1086
 				$this->_current_screen->add_help_tab($_ht);
1087 1087
 				}/**/
1088 1088
 
1089 1089
 
1090
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1090
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1091 1091
 
1092
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1092
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1093 1093
 				//we're here so there ARE help tabs!
1094 1094
 
1095 1095
 				//make sure we've got what we need
1096
-				if ( !isset( $cfg['title'] ) )
1097
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1096
+				if ( ! isset($cfg['title']))
1097
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1098 1098
 
1099 1099
 
1100
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1101
-					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') );
1100
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1101
+					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'));
1102 1102
 
1103 1103
 
1104 1104
 
1105 1105
 				//first priority goes to content.
1106
-				if ( !empty($cfg['content'] ) ) {
1107
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1106
+				if ( ! empty($cfg['content'])) {
1107
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1108 1108
 
1109 1109
 				//second priority goes to filename
1110
-				} else if ( !empty($cfg['filename'] ) ) {
1111
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1110
+				} else if ( ! empty($cfg['filename'])) {
1111
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1112 1112
 
1113 1113
 
1114 1114
 					//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)
1115
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1115
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1116 1116
 
1117 1117
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1118
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1119
-						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__ );
1118
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1119
+						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__);
1120 1120
 						return;
1121 1121
 					}
1122 1122
 					$template_args['admin_page_obj'] = $this;
@@ -1127,21 +1127,21 @@  discard block
 block discarded – undo
1127 1127
 
1128 1128
 
1129 1129
 				//check if callback is valid
1130
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1131
-					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__ );
1130
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1131
+					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__);
1132 1132
 					return;
1133 1133
 				}
1134 1134
 
1135 1135
 				//setup config array for help tab method
1136
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1136
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1137 1137
 				$_ht = array(
1138 1138
 					'id' => $id,
1139 1139
 					'title' => $cfg['title'],
1140
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1140
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1141 1141
 					'content' => $content
1142 1142
 					);
1143 1143
 
1144
-				$this->_current_screen->add_help_tab( $_ht );
1144
+				$this->_current_screen->add_help_tab($_ht);
1145 1145
 			}
1146 1146
 		}
1147 1147
 	}
@@ -1161,49 +1161,49 @@  discard block
 block discarded – undo
1161 1161
 		$this->_help_tour = array();
1162 1162
 
1163 1163
 		//exit early if help tours are turned off globally
1164
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1164
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1165 1165
 			return;
1166 1166
 
1167 1167
 		//loop through _page_config to find any help_tour defined
1168
-		foreach ( $this->_page_config as $route => $config ) {
1168
+		foreach ($this->_page_config as $route => $config) {
1169 1169
 			//we're only going to set things up for this route
1170
-			if ( $route !== $this->_req_action )
1170
+			if ($route !== $this->_req_action)
1171 1171
 				continue;
1172 1172
 
1173
-			if ( isset( $config['help_tour'] ) ) {
1173
+			if (isset($config['help_tour'])) {
1174 1174
 
1175
-				foreach( $config['help_tour'] as $tour ) {
1176
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1175
+				foreach ($config['help_tour'] as $tour) {
1176
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1177 1177
 					//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
1178
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1178
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1179 1179
 
1180 1180
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1181
-					if ( !is_readable($file_path) ) {
1182
-						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__ );
1181
+					if ( ! is_readable($file_path)) {
1182
+						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__);
1183 1183
 						return;
1184 1184
 					}
1185 1185
 
1186 1186
 					require_once $file_path;
1187
-					if ( !class_exists( $tour ) ) {
1188
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1189
-						$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) );
1190
-						throw new EE_Error( implode( '||', $error_msg ));
1187
+					if ( ! class_exists($tour)) {
1188
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1189
+						$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));
1190
+						throw new EE_Error(implode('||', $error_msg));
1191 1191
 					}
1192 1192
 					$a = new ReflectionClass($tour);
1193 1193
 					$tour_obj = $a->newInstance($this->_is_caf);
1194 1194
 
1195 1195
 					$tours[] = $tour_obj;
1196
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1196
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1197 1197
 				}
1198 1198
 
1199 1199
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1200 1200
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1201 1201
 				$tours[] = $end_stop_tour;
1202
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1202
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1203 1203
 			}
1204 1204
 		}
1205 1205
 
1206
-		if ( !empty( $tours ) )
1206
+		if ( ! empty($tours))
1207 1207
 			$this->_help_tour['tours'] = $tours;
1208 1208
 
1209 1209
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1219,12 +1219,12 @@  discard block
 block discarded – undo
1219 1219
 	 * @return void
1220 1220
 	 */
1221 1221
 	protected function _add_qtips() {
1222
-		if ( isset( $this->_route_config['qtips'] ) ) {
1222
+		if (isset($this->_route_config['qtips'])) {
1223 1223
 			$qtips = (array) $this->_route_config['qtips'];
1224 1224
 			//load qtip loader
1225 1225
 			$path = array(
1226
-				$this->_get_dir() . '/qtips/',
1227
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1226
+				$this->_get_dir().'/qtips/',
1227
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1228 1228
 				);
1229 1229
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1230 1230
 		}
@@ -1241,41 +1241,41 @@  discard block
 block discarded – undo
1241 1241
 	 * @return void
1242 1242
 	 */
1243 1243
 	protected function _set_nav_tabs() {
1244
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1244
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1245 1245
 		$i = 0;
1246
-		foreach ( $this->_page_config as $slug => $config ) {
1247
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1246
+		foreach ($this->_page_config as $slug => $config) {
1247
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1248 1248
 				continue; //no nav tab for this config
1249 1249
 
1250 1250
 			//check for persistent flag
1251
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1251
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1252 1252
 				continue; //nav tab is only to appear when route requested.
1253 1253
 
1254
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1254
+			if ( ! $this->check_user_access($slug, TRUE))
1255 1255
 				continue; //no nav tab becasue current user does not have access.
1256 1256
 
1257
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1257
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1258 1258
 			$this->_nav_tabs[$slug] = array(
1259
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1260
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1261
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1262
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1259
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1260
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1261
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1262
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1263 1263
 				);
1264 1264
 			$i++;
1265 1265
 		}
1266 1266
 
1267 1267
 		//if $this->_nav_tabs is empty then lets set the default
1268
-		if ( empty( $this->_nav_tabs ) ) {
1268
+		if (empty($this->_nav_tabs)) {
1269 1269
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1270 1270
 				'url' => $this->admin_base_url,
1271
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1271
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1272 1272
 				'css_class' => 'nav-tab-active',
1273 1273
 				'order' => 10
1274 1274
 				);
1275 1275
 		}
1276 1276
 
1277 1277
 		//now let's sort the tabs according to order
1278
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1278
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1279 1279
 
1280 1280
 	}
1281 1281
 
@@ -1291,10 +1291,10 @@  discard block
 block discarded – undo
1291 1291
 	 * @return void
1292 1292
 	 */
1293 1293
 	private function _set_current_labels() {
1294
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1295
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1296
-				if ( is_array($text) ) {
1297
-					foreach ( $text as $sublabel => $subtext ) {
1294
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1295
+			foreach ($this->_route_config['labels'] as $label => $text) {
1296
+				if (is_array($text)) {
1297
+					foreach ($text as $sublabel => $subtext) {
1298 1298
 						$this->_labels[$label][$sublabel] = $subtext;
1299 1299
 					}
1300 1300
 				} else {
@@ -1315,24 +1315,24 @@  discard block
 block discarded – undo
1315 1315
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1316 1316
 	*		@return 		BOOL|wp_die()
1317 1317
 	*/
1318
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1319
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1320
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1321
-		$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;
1318
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1319
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1320
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1321
+		$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;
1322 1322
 
1323
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1324
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1323
+		if (empty($capability) && empty($route_to_check)) {
1324
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1325 1325
 		} else {
1326
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1326
+			$capability = empty($capability) ? 'manage_options' : $capability;
1327 1327
 		}
1328 1328
 
1329
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1329
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1330 1330
 
1331
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1332
-			if ( $verify_only ) {
1331
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1332
+			if ($verify_only) {
1333 1333
 				return FALSE;
1334 1334
 			} else {
1335
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1335
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1336 1336
 			}
1337 1337
 		}
1338 1338
 		return TRUE;
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		$this->_add_admin_page_overlay();
1410 1410
 
1411 1411
 		//if metaboxes are present we need to add the nonce field
1412
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1412
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1413 1413
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1414 1414
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1415 1415
 		}
@@ -1428,19 +1428,19 @@  discard block
 block discarded – undo
1428 1428
 	 */
1429 1429
 	public function admin_footer_global() {
1430 1430
 		//dialog container for dialog helper
1431
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1431
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1432 1432
 		$d_cont .= '<div class="ee-notices"></div>';
1433 1433
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1434 1434
 		$d_cont .= '</div>';
1435 1435
 		echo $d_cont;
1436 1436
 
1437 1437
 		//help tour stuff?
1438
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1438
+		if (isset($this->_help_tour[$this->_req_action])) {
1439 1439
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1440 1440
 		}
1441 1441
 
1442 1442
 		//current set timezone for timezone js
1443
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1443
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1444 1444
 	}
1445 1445
 
1446 1446
 
@@ -1464,18 +1464,18 @@  discard block
 block discarded – undo
1464 1464
 	 * @access protected
1465 1465
 	 * @return string content
1466 1466
 	 */
1467
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1467
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1468 1468
 		$content = '';
1469 1469
 
1470
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1471
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1470
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1471
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1472 1472
 
1473 1473
 
1474 1474
 		//loop through the array and setup content
1475
-		foreach ( $help_array as $trigger => $help ) {
1475
+		foreach ($help_array as $trigger => $help) {
1476 1476
 			//make sure the array is setup properly
1477
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1478
-				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') );
1477
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1478
+				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'));
1479 1479
 			}
1480 1480
 
1481 1481
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1485,10 +1485,10 @@  discard block
 block discarded – undo
1485 1485
 				'help_popup_content' => $help['content']
1486 1486
 				);
1487 1487
 
1488
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1488
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1489 1489
 		}
1490 1490
 
1491
-		if ( $display )
1491
+		if ($display)
1492 1492
 			echo $content;
1493 1493
 		else
1494 1494
 			return $content;
@@ -1505,18 +1505,18 @@  discard block
 block discarded – undo
1505 1505
 	 */
1506 1506
 	private function _get_help_content() {
1507 1507
 		//what is the method we're looking for?
1508
-		$method_name = '_help_popup_content_' . $this->_req_action;
1508
+		$method_name = '_help_popup_content_'.$this->_req_action;
1509 1509
 
1510 1510
 		//if method doesn't exist let's get out.
1511
-		if ( !method_exists( $this, $method_name ) )
1511
+		if ( ! method_exists($this, $method_name))
1512 1512
 			return array();
1513 1513
 
1514 1514
 		//k we're good to go let's retrieve the help array
1515
-		$help_array = call_user_func( array( $this, $method_name ) );
1515
+		$help_array = call_user_func(array($this, $method_name));
1516 1516
 
1517 1517
 		//make sure we've got an array!
1518
-		if ( !is_array($help_array) ) {
1519
-			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' ) );
1518
+		if ( ! is_array($help_array)) {
1519
+			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'));
1520 1520
 		}
1521 1521
 
1522 1522
 		return $help_array;
@@ -1538,27 +1538,27 @@  discard block
 block discarded – undo
1538 1538
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1539 1539
 	 * @return string
1540 1540
 	 */
1541
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1541
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1542 1542
 
1543
-		if ( defined('DOING_AJAX') ) return;
1543
+		if (defined('DOING_AJAX')) return;
1544 1544
 
1545 1545
 		//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
1546 1546
 		$help_array = $this->_get_help_content();
1547 1547
 		$help_content = '';
1548 1548
 
1549
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1549
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1550 1550
 			$help_array[$trigger_id] = array(
1551 1551
 				'title' => __('Missing Content', 'event_espresso'),
1552 1552
 				'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')
1553 1553
 				);
1554
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1554
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1555 1555
 		}
1556 1556
 
1557 1557
 		//let's setup the trigger
1558
-		$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>';
1559
-		$content = $content . $help_content;
1558
+		$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>';
1559
+		$content = $content.$help_content;
1560 1560
 
1561
-		if ( $display )
1561
+		if ($display)
1562 1562
 			echo $content;
1563 1563
 		else
1564 1564
 			return $content;
@@ -1615,15 +1615,15 @@  discard block
 block discarded – undo
1615 1615
 	public function load_global_scripts_styles() {
1616 1616
 		/** STYLES **/
1617 1617
 		// add debugging styles
1618
-		if ( WP_DEBUG ) {
1619
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1618
+		if (WP_DEBUG) {
1619
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1620 1620
 		}
1621 1621
 
1622 1622
 		//register all styles
1623
-		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 );
1624
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1623
+		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);
1624
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1625 1625
 		//helpers styles
1626
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1626
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1627 1627
 		//enqueue global styles
1628 1628
 		wp_enqueue_style('ee-admin-css');
1629 1629
 
@@ -1631,66 +1631,66 @@  discard block
 block discarded – undo
1631 1631
 		/** SCRIPTS **/
1632 1632
 
1633 1633
 		//register all scripts
1634
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1635
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1636
-		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 );
1634
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1635
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1636
+		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);
1637 1637
 
1638
-		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 );
1638
+		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);
1639 1639
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1640
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1640
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1641 1641
 		add_filter('FHEE_load_joyride', '__return_true');
1642 1642
 
1643 1643
 		//script for sorting tables
1644
-		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);
1644
+		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);
1645 1645
 		//script for parsing uri's
1646
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1646
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1647 1647
 		//and parsing associative serialized form elements
1648
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1648
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1649 1649
 		//helpers scripts
1650
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1651
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1652
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1653
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1650
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1651
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1652
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1653
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1654 1654
 
1655 1655
 		//google charts
1656
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1656
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1657 1657
 
1658 1658
 		//enqueue global scripts
1659 1659
 
1660 1660
 		//taking care of metaboxes
1661
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1661
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1662 1662
 			wp_enqueue_script('dashboard');
1663 1663
 		}
1664 1664
 
1665 1665
 		//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
1666
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1666
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1667 1667
 			wp_enqueue_script('ee_admin_js');
1668 1668
 			wp_enqueue_style('ee-admin-css');
1669 1669
 		}
1670 1670
 
1671 1671
 
1672 1672
 		//localize script for ajax lazy loading
1673
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1674
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1673
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1674
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1675 1675
 
1676 1676
 
1677 1677
 		/**
1678 1678
 		 * help tour stuff
1679 1679
 		 */
1680
-		if ( !empty( $this->_help_tour ) ) {
1680
+		if ( ! empty($this->_help_tour)) {
1681 1681
 
1682 1682
 			//register the js for kicking things off
1683
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1683
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1684 1684
 
1685 1685
 			//setup tours for the js tour object
1686
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1686
+			foreach ($this->_help_tour['tours'] as $tour) {
1687 1687
 				$tours[] = array(
1688 1688
 					'id' => $tour->get_slug(),
1689 1689
 					'options' => $tour->get_options()
1690 1690
 					);
1691 1691
 			}
1692 1692
 
1693
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1693
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1694 1694
 
1695 1695
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1696 1696
 		}
@@ -1708,52 +1708,52 @@  discard block
 block discarded – undo
1708 1708
 	public function admin_footer_scripts_eei18n_js_strings() {
1709 1709
 
1710 1710
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1711
-		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' );
1712
-
1713
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1737
-
1738
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1746
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1747
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1748
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1749
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1750
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1751
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1711
+		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');
1712
+
1713
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1737
+
1738
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1746
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1747
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1748
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1749
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1750
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1751
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1752 1752
 
1753 1753
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1754 1754
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1755 1755
 		//espresso_core is listed as a dependency of ee_admin_js.
1756
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1756
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1757 1757
 
1758 1758
 	}
1759 1759
 
@@ -1787,23 +1787,23 @@  discard block
 block discarded – undo
1787 1787
 	protected function _set_list_table() {
1788 1788
 
1789 1789
 		//first is this a list_table view?
1790
-		if ( !isset($this->_route_config['list_table']) )
1790
+		if ( ! isset($this->_route_config['list_table']))
1791 1791
 			return; //not a list_table view so get out.
1792 1792
 
1793 1793
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1794 1794
 
1795
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1795
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1796 1796
 			//user error msg
1797
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1797
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1798 1798
 			//developer error msg
1799
-			$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 );
1800
-			throw new EE_Error( $error_msg );
1799
+			$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);
1800
+			throw new EE_Error($error_msg);
1801 1801
 		}
1802 1802
 
1803 1803
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1804
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1805
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1806
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1804
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1805
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1806
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1807 1807
 
1808 1808
 		$this->_set_list_table_view();
1809 1809
 		$this->_set_list_table_object();
@@ -1825,14 +1825,14 @@  discard block
 block discarded – undo
1825 1825
 	*		@return array
1826 1826
 	*/
1827 1827
 	protected function _set_list_table_view() {
1828
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1828
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1829 1829
 
1830 1830
 
1831 1831
 		// looking at active items or dumpster diving ?
1832
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1833
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1832
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1833
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1834 1834
 		} else {
1835
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1835
+			$this->_view = sanitize_key($this->_req_data['status']);
1836 1836
 		}
1837 1837
 	}
1838 1838
 
@@ -1845,8 +1845,8 @@  discard block
 block discarded – undo
1845 1845
 	 * @throws \EE_Error
1846 1846
 	 */
1847 1847
 	protected function _set_list_table_object() {
1848
-		if ( isset( $this->_route_config['list_table'] ) ) {
1849
-			if ( ! class_exists( $this->_route_config['list_table'] ) ) {
1848
+		if (isset($this->_route_config['list_table'])) {
1849
+			if ( ! class_exists($this->_route_config['list_table'])) {
1850 1850
 				throw new EE_Error(
1851 1851
 					sprintf(
1852 1852
 						__(
@@ -1854,12 +1854,12 @@  discard block
 block discarded – undo
1854 1854
 							'event_espresso'
1855 1855
 						),
1856 1856
 						$this->_route_config['list_table'],
1857
-						get_class( $this )
1857
+						get_class($this)
1858 1858
 					)
1859 1859
 				);
1860 1860
 			}
1861 1861
 			$list_table = $this->_route_config['list_table'];
1862
-			$this->_list_table_object = new $list_table( $this );
1862
+			$this->_list_table_object = new $list_table($this);
1863 1863
 		}
1864 1864
 	}
1865 1865
 
@@ -1876,27 +1876,27 @@  discard block
 block discarded – undo
1876 1876
 	 *
1877 1877
 	 * @return array
1878 1878
 	 */
1879
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1879
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1880 1880
 
1881
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1881
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1882 1882
 
1883
-		if ( empty( $this->_views )) {
1883
+		if (empty($this->_views)) {
1884 1884
 			$this->_views = array();
1885 1885
 		}
1886 1886
 
1887 1887
 		// cycle thru views
1888
-		foreach ( $this->_views as $key => $view ) {
1888
+		foreach ($this->_views as $key => $view) {
1889 1889
 			$query_args = array();
1890 1890
 			// check for current view
1891
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1891
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1892 1892
 			$query_args['action'] = $this->_req_action;
1893
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1893
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1894 1894
 			$query_args['status'] = $view['slug'];
1895 1895
 			//merge any other arguments sent in.
1896
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1897
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1896
+			if (isset($extra_query_args[$view['slug']])) {
1897
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1898 1898
 			}
1899
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1899
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1900 1900
 		}
1901 1901
 
1902 1902
 		return $this->_views;
@@ -1913,15 +1913,15 @@  discard block
 block discarded – undo
1913 1913
 	 * @param int $max_entries total number of rows in the table
1914 1914
 	 * @return string
1915 1915
 	*/
1916
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1916
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1917 1917
 
1918
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1919
-		$values = array( 10, 25, 50, 100 );
1920
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1918
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1919
+		$values = array(10, 25, 50, 100);
1920
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1921 1921
 
1922
-		if ( $max_entries ) {
1922
+		if ($max_entries) {
1923 1923
 			$values[] = $max_entries;
1924
-			sort( $values );
1924
+			sort($values);
1925 1925
 		}
1926 1926
 
1927 1927
 		$entries_per_page_dropdown = '
@@ -1930,15 +1930,15 @@  discard block
 block discarded – undo
1930 1930
 					Show
1931 1931
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1932 1932
 
1933
-		foreach ( $values as $value ) {
1934
-			if ( $value < $max_entries ) {
1935
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1933
+		foreach ($values as $value) {
1934
+			if ($value < $max_entries) {
1935
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1936 1936
 				$entries_per_page_dropdown .= '
1937 1937
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1938 1938
 			}
1939 1939
 		}
1940 1940
 
1941
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1941
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1942 1942
 		$entries_per_page_dropdown .= '
1943 1943
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1944 1944
 
@@ -1961,8 +1961,8 @@  discard block
 block discarded – undo
1961 1961
 	*		@return 		void
1962 1962
 	*/
1963 1963
 	public function _set_search_attributes() {
1964
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1965
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1964
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1965
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1966 1966
 	}
1967 1967
 
1968 1968
 	/*** END LIST TABLE METHODS **/
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 * @return void
1982 1982
 	*/
1983 1983
 	private function _add_registered_meta_boxes() {
1984
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1984
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1985 1985
 
1986 1986
 		//we only add meta boxes if the page_route calls for it
1987
-		if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] )
1987
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
1988 1988
 			 && is_array(
1989 1989
 			 $this->_route_config['metaboxes']
1990 1990
 			 )
@@ -1992,27 +1992,27 @@  discard block
 block discarded – undo
1992 1992
 			// this simply loops through the callbacks provided
1993 1993
 			// and checks if there is a corresponding callback registered by the child
1994 1994
 			// if there is then we go ahead and process the metabox loader.
1995
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1995
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1996 1996
 				// first check for Closures
1997
-				if ( $metabox_callback instanceof Closure ) {
1997
+				if ($metabox_callback instanceof Closure) {
1998 1998
 					$result = $metabox_callback();
1999
-				} else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) {
2000
-					$result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) );
1999
+				} else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
2000
+					$result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
2001 2001
 				} else {
2002
-					$result = call_user_func( array( $this, &$metabox_callback ) );
2002
+					$result = call_user_func(array($this, &$metabox_callback));
2003 2003
 				}
2004
-				if ( $result === FALSE ) {
2004
+				if ($result === FALSE) {
2005 2005
 					// user error msg
2006
-					$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
2006
+					$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
2007 2007
 					// developer error msg
2008
-					$error_msg .= '||' . sprintf(
2008
+					$error_msg .= '||'.sprintf(
2009 2009
 						__(
2010 2010
 							'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.',
2011 2011
 							'event_espresso'
2012 2012
 						),
2013 2013
 						$metabox_callback
2014 2014
 					);
2015
-					throw new EE_Error( $error_msg );
2015
+					throw new EE_Error($error_msg);
2016 2016
 				}
2017 2017
 			}
2018 2018
 		}
@@ -2029,17 +2029,17 @@  discard block
 block discarded – undo
2029 2029
 	 * @return void
2030 2030
 	 */
2031 2031
 	private function _add_screen_columns() {
2032
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
2032
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
2033 2033
 
2034
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2034
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2035 2035
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2036 2036
 			$screen_id = $this->_current_screen->id;
2037 2037
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2038
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2039
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2038
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2039
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2040 2040
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2041 2041
 			$this->_template_args['screen'] = $this->_current_screen;
2042
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2042
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2043 2043
 
2044 2044
 			//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.
2045 2045
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2056,11 +2056,11 @@  discard block
 block discarded – undo
2056 2056
 	 */
2057 2057
 
2058 2058
 	private function _espresso_news_post_box() {
2059
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2060
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2059
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2060
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2061 2061
 			$this,
2062 2062
 			'espresso_news_post_box'
2063
-		), $this->_wp_page_slug, 'side' );
2063
+		), $this->_wp_page_slug, 'side');
2064 2064
 	}
2065 2065
 
2066 2066
 
@@ -2068,14 +2068,14 @@  discard block
 block discarded – undo
2068 2068
 	 * Code for setting up espresso ratings request metabox.
2069 2069
 	 */
2070 2070
 	protected function _espresso_ratings_request() {
2071
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2071
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2072 2072
 			return '';
2073 2073
 		}
2074
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2075
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2074
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2075
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2076 2076
 			$this,
2077 2077
 			'espresso_ratings_request'
2078
-		), $this->_wp_page_slug, 'side' );
2078
+		), $this->_wp_page_slug, 'side');
2079 2079
 	}
2080 2080
 
2081 2081
 
@@ -2083,34 +2083,34 @@  discard block
 block discarded – undo
2083 2083
 	 * Code for setting up espresso ratings request metabox content.
2084 2084
 	 */
2085 2085
 	public function espresso_ratings_request() {
2086
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2087
-		EEH_Template::display_template( $template_path, array() );
2086
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2087
+		EEH_Template::display_template($template_path, array());
2088 2088
 	}
2089 2089
 
2090 2090
 
2091 2091
 
2092 2092
 
2093
-	public static function cached_rss_display( $rss_id, $url ) {
2094
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2095
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2096
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2097
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2098
-		$post = '</div>' . "\n";
2093
+	public static function cached_rss_display($rss_id, $url) {
2094
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2095
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2096
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2097
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2098
+		$post = '</div>'."\n";
2099 2099
 
2100
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2101
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2102
-			echo $pre . $output . $post;
2100
+		$cache_key = 'ee_rss_'.md5($rss_id);
2101
+		if (FALSE != ($output = get_transient($cache_key))) {
2102
+			echo $pre.$output.$post;
2103 2103
 			return TRUE;
2104 2104
 		}
2105 2105
 
2106
-		if ( ! $doing_ajax ) {
2107
-			echo $pre . $loading . $post;
2106
+		if ( ! $doing_ajax) {
2107
+			echo $pre.$loading.$post;
2108 2108
 			return FALSE;
2109 2109
 		}
2110 2110
 
2111 2111
 		ob_start();
2112
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2113
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2112
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2113
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2114 2114
 		return TRUE;
2115 2115
 
2116 2116
 	}
@@ -2122,13 +2122,13 @@  discard block
 block discarded – undo
2122 2122
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2123 2123
 	  		<?php
2124 2124
 	  		// Get RSS Feed(s)
2125
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2125
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2126 2126
 	  		$url = urlencode($feed_url);
2127
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2127
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2128 2128
 
2129 2129
 	  		?>
2130 2130
 	  	</div>
2131
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2131
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2132 2132
 	  </div>
2133 2133
 		<?php
2134 2134
 	}
@@ -2149,32 +2149,32 @@  discard block
 block discarded – undo
2149 2149
 
2150 2150
 	protected function _espresso_sponsors_post_box() {
2151 2151
 
2152
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2153
-		if ( $show_sponsors )
2154
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2152
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2153
+		if ($show_sponsors)
2154
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2155 2155
 	}
2156 2156
 
2157 2157
 
2158 2158
 	public function espresso_sponsors_post_box() {
2159
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2160
-		EEH_Template::display_template( $templatepath );
2159
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2160
+		EEH_Template::display_template($templatepath);
2161 2161
 	}
2162 2162
 
2163 2163
 
2164 2164
 
2165 2165
 	private function _publish_post_box() {
2166
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2166
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2167 2167
 
2168 2168
 		//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)
2169
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2170
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2169
+		if ( ! empty($this->_labels['publishbox'])) {
2170
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2171 2171
 		} else {
2172 2172
 			$box_label = __('Publish', 'event_espresso');
2173 2173
 		}
2174 2174
 
2175
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2175
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2176 2176
 
2177
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2177
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2178 2178
 
2179 2179
 	}
2180 2180
 
@@ -2182,9 +2182,9 @@  discard block
 block discarded – undo
2182 2182
 
2183 2183
 	public function editor_overview() {
2184 2184
 		//if we have extra content set let's add it in if not make sure its empty
2185
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2186
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2187
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2185
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2186
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2187
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2188 2188
 	}
2189 2189
 
2190 2190
 
@@ -2200,8 +2200,8 @@  discard block
 block discarded – undo
2200 2200
 	 * @see $this->_set_publish_post_box_vars for param details
2201 2201
 	 * @since 4.6.0
2202 2202
 	 */
2203
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2204
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2203
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2204
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2205 2205
 	}
2206 2206
 
2207 2207
 
@@ -2229,17 +2229,17 @@  discard block
 block discarded – undo
2229 2229
 		$both_btns = true
2230 2230
 	) {
2231 2231
 		// if Save & Close, use a custom redirect URL or default to the main page?
2232
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2232
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2233 2233
 		// create the Save & Close and Save buttons
2234
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2234
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2235 2235
 		//if we have extra content set let's add it in if not make sure its empty
2236
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2236
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2237 2237
 
2238 2238
 
2239
-		if ( $delete && ! empty( $id )  ) {
2239
+		if ($delete && ! empty($id)) {
2240 2240
 			//make sure we have a default if just true is sent.
2241 2241
 			$delete = ! empty($delete) ? $delete : 'delete';
2242
-			$delete_link_args = array( $name => $id );
2242
+			$delete_link_args = array($name => $id);
2243 2243
 			$delete = $this->get_action_link_or_button(
2244 2244
 				$delete,
2245 2245
 				$delete,
@@ -2250,8 +2250,8 @@  discard block
 block discarded – undo
2250 2250
 			);
2251 2251
 		}
2252 2252
 
2253
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2254
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2253
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2254
+		if ( ! empty($name) && ! empty($id)) {
2255 2255
 			$hidden_field_arr[$name] = array(
2256 2256
 				'type' => 'hidden',
2257 2257
 				'value' => $id
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
 			$hf = '';
2262 2262
 		}
2263 2263
 		// add hidden field
2264
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2264
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2265 2265
 
2266 2266
 	}
2267 2267
 
@@ -2278,8 +2278,8 @@  discard block
 block discarded – undo
2278 2278
 		<noscript>
2279 2279
 			<div id="no-js-message" class="error">
2280 2280
 				<p style="font-size:1.3em;">
2281
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2282
-					<?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' ); ?>
2281
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2282
+					<?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'); ?>
2283 2283
 				</p>
2284 2284
 			</div>
2285 2285
 		</noscript>
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
 	*		@return 		string
2300 2300
 	*/
2301 2301
 	private function _display_espresso_notices() {
2302
-		$notices = $this->_get_transient( TRUE );
2302
+		$notices = $this->_get_transient(TRUE);
2303 2303
 		echo stripslashes($notices);
2304 2304
 	}
2305 2305
 
@@ -2351,11 +2351,11 @@  discard block
 block discarded – undo
2351 2351
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2352 2352
 	 * @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.
2353 2353
 	 */
2354
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2355
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2354
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2355
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2356 2356
 
2357 2357
 		//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.
2358
-		if ( empty( $callback_args ) && $create_func ) {
2358
+		if (empty($callback_args) && $create_func) {
2359 2359
 			$callback_args = array(
2360 2360
 				'template_path' => $this->_template_path,
2361 2361
 				'template_args' => $this->_template_args,
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
 		//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)
2366 2366
 		$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;
2367 2367
 
2368
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2368
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2369 2369
 	}
2370 2370
 
2371 2371
 
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
 	 */
2379 2379
 	public function display_admin_page_with_metabox_columns() {
2380 2380
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2381
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2381
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2382 2382
 
2383 2383
 		//the final wrapper
2384 2384
 		$this->admin_page_wrapper();
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
 	 * @return void
2422 2422
 	 */
2423 2423
 	public function display_about_admin_page() {
2424
-		$this->_display_admin_page( FALSE, TRUE );
2424
+		$this->_display_admin_page(FALSE, TRUE);
2425 2425
 	}
2426 2426
 
2427 2427
 
@@ -2437,26 +2437,26 @@  discard block
 block discarded – undo
2437 2437
 	 * @return void
2438 2438
 	 */
2439 2439
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2440
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2440
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2441 2441
 
2442 2442
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2443
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2443
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2444 2444
 
2445 2445
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2446 2446
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2447 2447
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2448 2448
 
2449
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2449
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2450 2450
 
2451
-		if ( defined('DOING_AJAX' ) )
2452
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2451
+		if (defined('DOING_AJAX'))
2452
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2453 2453
 
2454
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2454
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2455 2455
 
2456
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2456
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2457 2457
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2458 2458
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2459
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2459
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2460 2460
 
2461 2461
 
2462 2462
 		// the final template wrapper
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 	 * @return void
2475 2475
 	 * @throws \EE_Error
2476 2476
 	 */
2477
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2477
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2478 2478
 		//let's generate a default preview action button if there isn't one already present.
2479 2479
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2480 2480
 		$buy_now_url = add_query_arg(
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
 			),
2488 2488
 		'http://eventespresso.com/pricing/'
2489 2489
 		);
2490
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] )
2490
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2491 2491
 			? $this->get_action_link_or_button(
2492 2492
 				'',
2493 2493
 				'buy_now',
@@ -2497,13 +2497,13 @@  discard block
 block discarded – undo
2497 2497
 				true
2498 2498
 			)
2499 2499
 			: $this->_template_args['preview_action_button'];
2500
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2500
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2501 2501
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2502 2502
 			$template_path,
2503 2503
 			$this->_template_args,
2504 2504
 			true
2505 2505
 		);
2506
-		$this->_display_admin_page( $display_sidebar );
2506
+		$this->_display_admin_page($display_sidebar);
2507 2507
 	}
2508 2508
 
2509 2509
 
@@ -2537,49 +2537,49 @@  discard block
 block discarded – undo
2537 2537
 	 * @param boolean $sidebar whether to display with sidebar or not.
2538 2538
 	 * @return void
2539 2539
 	 */
2540
-	private function _display_admin_list_table_page( $sidebar = false ) {
2540
+	private function _display_admin_list_table_page($sidebar = false) {
2541 2541
 		//setup search attributes
2542 2542
 		$this->_set_search_attributes();
2543 2543
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2544
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2544
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2545 2545
 
2546
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX')
2547
-			? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url )
2548
-			: add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2546
+		$this->_template_args['table_url'] = defined('DOING_AJAX')
2547
+			? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2548
+			: add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2549 2549
 		$this->_template_args['list_table'] = $this->_list_table_object;
2550 2550
 		$this->_template_args['current_route'] = $this->_req_action;
2551
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2551
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2552 2552
 
2553 2553
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2554
-		if( ! empty( $ajax_sorting_callback )) {
2554
+		if ( ! empty($ajax_sorting_callback)) {
2555 2555
 			$sortable_list_table_form_fields = wp_nonce_field(
2556
-				$ajax_sorting_callback . '_nonce',
2557
-				$ajax_sorting_callback . '_nonce',
2556
+				$ajax_sorting_callback.'_nonce',
2557
+				$ajax_sorting_callback.'_nonce',
2558 2558
 				FALSE,
2559 2559
 				FALSE
2560 2560
 			);
2561 2561
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2562 2562
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2563
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2564
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2563
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2564
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2565 2565
 		} else {
2566 2566
 			$sortable_list_table_form_fields = '';
2567 2567
 		}
2568 2568
 
2569 2569
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2570
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2571
-		$nonce_ref = $this->_req_action . '_nonce';
2572
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2570
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2571
+		$nonce_ref = $this->_req_action.'_nonce';
2572
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2573 2573
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2574 2574
 
2575 2575
 		//display message about search results?
2576 2576
 		$this->_template_args['before_list_table'] .= apply_filters(
2577 2577
 			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2578
-			! empty( $this->_req_data['s'] )
2579
-				? '<p class="ee-search-results">' . sprintf(
2580
-					__( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ),
2581
-					trim( $this->_req_data['s'], '%' )
2582
-					) . '</p>'
2578
+			! empty($this->_req_data['s'])
2579
+				? '<p class="ee-search-results">'.sprintf(
2580
+					__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'),
2581
+					trim($this->_req_data['s'], '%')
2582
+					).'</p>'
2583 2583
 				: '',
2584 2584
 			$this->page_slug,
2585 2585
 			$this->_req_data,
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
 			true
2592 2592
 		);
2593 2593
 		// the final template wrapper
2594
-		if ( $sidebar )
2594
+		if ($sidebar)
2595 2595
 			$this->display_admin_page_with_sidebar();
2596 2596
 		else
2597 2597
 			$this->display_admin_page_with_no_sidebar();
@@ -2614,9 +2614,9 @@  discard block
 block discarded – undo
2614 2614
 	 * @param  array $items  see above for format of array
2615 2615
 	 * @return string        html string of legend
2616 2616
 	 */
2617
-	protected function _display_legend( $items ) {
2618
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2619
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2617
+	protected function _display_legend($items) {
2618
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2619
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2620 2620
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2621 2621
 	}
2622 2622
 
@@ -2641,33 +2641,33 @@  discard block
 block discarded – undo
2641 2641
 	 *
2642 2642
 	 * @return void
2643 2643
 	 */
2644
-	protected function _return_json( $sticky_notices = false ) {
2644
+	protected function _return_json($sticky_notices = false) {
2645 2645
 
2646 2646
 		//make sure any EE_Error notices have been handled.
2647
-		$this->_process_notices( array(), true, $sticky_notices );
2647
+		$this->_process_notices(array(), true, $sticky_notices);
2648 2648
 
2649 2649
 
2650
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2650
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2651 2651
 		unset($this->_template_args['data']);
2652 2652
 		$json = array(
2653
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2654
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2655
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2656
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2653
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2654
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2655
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2656
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2657 2657
 			'notices' => EE_Error::get_notices(),
2658
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2659
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2658
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2659
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2660 2660
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2661 2661
 			);
2662 2662
 
2663 2663
 
2664 2664
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2665
-		if ( NULL === error_get_last() || ! headers_sent() )
2665
+		if (NULL === error_get_last() || ! headers_sent())
2666 2666
 			header('Content-Type: application/json; charset=UTF-8');
2667
-                if( function_exists( 'wp_json_encode' ) ) {
2668
-                    echo wp_json_encode( $json );
2667
+                if (function_exists('wp_json_encode')) {
2668
+                    echo wp_json_encode($json);
2669 2669
                 } else {
2670
-                    echo json_encode( $json );
2670
+                    echo json_encode($json);
2671 2671
                 }
2672 2672
 		exit();
2673 2673
 	}
@@ -2681,11 +2681,11 @@  discard block
 block discarded – undo
2681 2681
 	 * @throws EE_Error
2682 2682
 	 */
2683 2683
 	public function return_json() {
2684
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2684
+		if (defined('DOING_AJAX') && DOING_AJAX)
2685 2685
 			$this->_return_json();
2686 2686
 
2687 2687
 		else {
2688
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2688
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2689 2689
 		}
2690 2690
 	}
2691 2691
 
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
 	 *
2699 2699
 	 * @access   public
2700 2700
 	 */
2701
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2701
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2702 2702
 		$this->_hook_obj = $hook_obj;
2703 2703
 	}
2704 2704
 
@@ -2714,33 +2714,33 @@  discard block
 block discarded – undo
2714 2714
 	*/
2715 2715
 	public function admin_page_wrapper($about = FALSE) {
2716 2716
 
2717
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2717
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2718 2718
 
2719 2719
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2720 2720
 
2721 2721
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2722 2722
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2723 2723
 
2724
-		$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'] : '');
2725
-		$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'] : '');
2724
+		$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'] : '');
2725
+		$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'] : '');
2726 2726
 
2727 2727
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2728 2728
 
2729 2729
 
2730 2730
 
2731 2731
 		// load settings page wrapper template
2732
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2732
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2733 2733
 
2734 2734
 		//about page?
2735
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2735
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2736 2736
 
2737 2737
 
2738
-		if ( defined( 'DOING_AJAX' ) ) {
2739
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2738
+		if (defined('DOING_AJAX')) {
2739
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2740 2740
 
2741 2741
 			$this->_return_json();
2742 2742
 		} else {
2743
-			EEH_Template::display_template( $template_path, $this->_template_args );
2743
+			EEH_Template::display_template($template_path, $this->_template_args);
2744 2744
 		}
2745 2745
 
2746 2746
 	}
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
 	 * @param $b
2767 2767
 	 * @return int
2768 2768
 	 */
2769
-	private function _sort_nav_tabs( $a, $b ) {
2769
+	private function _sort_nav_tabs($a, $b) {
2770 2770
 		if ($a['order'] == $b['order']) {
2771 2771
 	        return 0;
2772 2772
 	    }
@@ -2786,7 +2786,7 @@  discard block
 block discarded – undo
2786 2786
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2787 2787
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2788 2788
 	 */
2789
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2789
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2790 2790
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2791 2791
 		return $content;
2792 2792
 	}
@@ -2808,25 +2808,25 @@  discard block
 block discarded – undo
2808 2808
 	 * @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.
2809 2809
 	 * @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).
2810 2810
 	 */
2811
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2811
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2812 2812
 		//make sure $text and $actions are in an array
2813 2813
 		$text = (array) $text;
2814 2814
 		$actions = (array) $actions;
2815 2815
 		$referrer_url = empty($referrer) ? '' : $referrer;
2816
-		$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 .'" />';
2816
+		$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.'" />';
2817 2817
 
2818
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2819
-		$default_names = array( 'save', 'save_and_close' );
2818
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2819
+		$default_names = array('save', 'save_and_close');
2820 2820
 
2821 2821
 		//add in a hidden index for the current page (so save and close redirects properly)
2822 2822
 		$this->_template_args['save_buttons'] = $referrer_url;
2823 2823
 
2824
-		foreach ( $button_text as $key => $button ) {
2824
+		foreach ($button_text as $key => $button) {
2825 2825
 			$ref = $default_names[$key];
2826
-			$id = $this->_current_view . '_' . $ref;
2827
-			$name = !empty($actions) ? $actions[$key] : $ref;
2828
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2829
-			if ( !$both ) break;
2826
+			$id = $this->_current_view.'_'.$ref;
2827
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2828
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2829
+			if ( ! $both) break;
2830 2830
 		}
2831 2831
 
2832 2832
 	}
@@ -2841,8 +2841,8 @@  discard block
 block discarded – undo
2841 2841
 	 * @param string $route
2842 2842
 	 * @param array  $additional_hidden_fields
2843 2843
 	 */
2844
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2845
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2844
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2845
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2846 2846
 	}
2847 2847
 
2848 2848
 
@@ -2855,30 +2855,30 @@  discard block
 block discarded – undo
2855 2855
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2856 2856
 	 * @return void
2857 2857
 	 */
2858
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2858
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2859 2859
 
2860
-		if ( empty( $route )) {
2860
+		if (empty($route)) {
2861 2861
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2862
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2863
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2862
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2863
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2864 2864
 		}
2865 2865
 		// open form
2866
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2866
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2867 2867
 		// add nonce
2868
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2868
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2869 2869
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2870
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2870
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2871 2871
 		// add REQUIRED form action
2872 2872
 		$hidden_fields = array(
2873
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2873
+				'action' => array('type' => 'hidden', 'value' => $route),
2874 2874
 			);
2875 2875
 		// merge arrays
2876
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2876
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2877 2877
 		// generate form fields
2878
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2878
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2879 2879
 		// add fields to form
2880
-		foreach ( (array)$form_fields as $field_name => $form_field ) {
2881
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2880
+		foreach ((array) $form_fields as $field_name => $form_field) {
2881
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2882 2882
 		}
2883 2883
 
2884 2884
 		// close form
@@ -2895,8 +2895,8 @@  discard block
 block discarded – undo
2895 2895
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2896 2896
 	 * @since 4.5.0
2897 2897
 	 */
2898
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2899
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2898
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2899
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2900 2900
 	}
2901 2901
 
2902 2902
 
@@ -2912,38 +2912,38 @@  discard block
 block discarded – undo
2912 2912
 	 *	@access protected
2913 2913
 	 *	@return void
2914 2914
 	 */
2915
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2915
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2916 2916
 
2917
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2917
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2918 2918
 
2919 2919
 		//class name for actions/filters.
2920 2920
 		$classname = get_class($this);
2921 2921
 
2922 2922
 		//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
2923
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2924
-		$notices = EE_Error::get_notices( FALSE );
2923
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2924
+		$notices = EE_Error::get_notices(FALSE);
2925 2925
 
2926 2926
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2927
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2927
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2928 2928
 			EE_Error::overwrite_success();
2929 2929
 		}
2930
-		if ( ! empty( $what ) && ! empty( $action_desc ) ) {
2930
+		if ( ! empty($what) && ! empty($action_desc)) {
2931 2931
 			// how many records affected ? more than one record ? or just one ?
2932
-			if ( $success > 1 && empty( $notices[ 'errors' ] ) ) {
2932
+			if ($success > 1 && empty($notices['errors'])) {
2933 2933
 				// set plural msg
2934 2934
 				EE_Error::add_success(
2935 2935
 					sprintf(
2936
-						__( 'The "%s" have been successfully %s.', 'event_espresso' ),
2936
+						__('The "%s" have been successfully %s.', 'event_espresso'),
2937 2937
 						$what,
2938 2938
 						$action_desc
2939 2939
 					),
2940 2940
 					__FILE__, __FUNCTION__, __LINE__
2941 2941
 				);
2942
-			} else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) {
2942
+			} else if ($success == 1 && empty($notices['errors'])) {
2943 2943
 				// set singular msg
2944 2944
 				EE_Error::add_success(
2945 2945
 					sprintf(
2946
-						__( 'The "%s" has been successfully %s.', 'event_espresso' ),
2946
+						__('The "%s" has been successfully %s.', 'event_espresso'),
2947 2947
 						$what,
2948 2948
 						$action_desc
2949 2949
 					),
@@ -2952,7 +2952,7 @@  discard block
 block discarded – undo
2952 2952
 			}
2953 2953
 		}
2954 2954
 		// check that $query_args isn't something crazy
2955
-		if ( ! is_array( $query_args )) {
2955
+		if ( ! is_array($query_args)) {
2956 2956
 			$query_args = array();
2957 2957
 		}
2958 2958
 
@@ -2965,36 +2965,36 @@  discard block
 block discarded – undo
2965 2965
 		 * @param array $query_args   The original query_args array coming into the
2966 2966
 		 *                          		method.
2967 2967
 		 */
2968
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2968
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2969 2969
 
2970 2970
 		//calculate where we're going (if we have a "save and close" button pushed)
2971
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2971
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2972 2972
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2973
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2973
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2974 2974
 			// regenerate query args array from referrer URL
2975
-			parse_str( $parsed_url['query'], $query_args );
2975
+			parse_str($parsed_url['query'], $query_args);
2976 2976
 			// correct page and action will be in the query args now
2977
-			$redirect_url = admin_url( 'admin.php' );
2977
+			$redirect_url = admin_url('admin.php');
2978 2978
 		}
2979 2979
 
2980 2980
 		//merge any default query_args set in _default_route_query_args property
2981
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2981
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2982 2982
 			$args_to_merge = array();
2983
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2983
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2984 2984
 				//is there a wp_referer array in our _default_route_query_args property?
2985
-				if ( $query_param == 'wp_referer'  ) {
2985
+				if ($query_param == 'wp_referer') {
2986 2986
 					$query_value = (array) $query_value;
2987
-					foreach ( $query_value as $reference => $value ) {
2988
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2987
+					foreach ($query_value as $reference => $value) {
2988
+						if (strpos($reference, 'nonce') !== false) {
2989 2989
 							continue;
2990 2990
 						}
2991 2991
 
2992 2992
 						//finally we will override any arguments in the referer with
2993 2993
 						//what might be set on the _default_route_query_args array.
2994
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2995
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2994
+						if (isset($this->_default_route_query_args[$reference])) {
2995
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2996 2996
 						} else {
2997
-							$args_to_merge[$reference] = urlencode( $value );
2997
+							$args_to_merge[$reference] = urlencode($value);
2998 2998
 						}
2999 2999
 					}
3000 3000
 					continue;
@@ -3005,7 +3005,7 @@  discard block
 block discarded – undo
3005 3005
 
3006 3006
 			//now let's merge these arguments but override with what was specifically sent in to the
3007 3007
 			//redirect.
3008
-			$query_args = array_merge( $args_to_merge, $query_args );
3008
+			$query_args = array_merge($args_to_merge, $query_args);
3009 3009
 		}
3010 3010
 
3011 3011
 		$this->_process_notices($query_args);
@@ -3014,19 +3014,19 @@  discard block
 block discarded – undo
3014 3014
 		// generate redirect url
3015 3015
 
3016 3016
 		// if redirecting to anything other than the main page, add a nonce
3017
-		if ( isset( $query_args['action'] )) {
3017
+		if (isset($query_args['action'])) {
3018 3018
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
3019
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
3019
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3020 3020
 		}
3021 3021
 
3022 3022
 		//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).
3023
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
3023
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3024 3024
 
3025
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
3025
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
3026 3026
 
3027 3027
 
3028 3028
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3029
-		if ( defined('DOING_AJAX' ) ) {
3029
+		if (defined('DOING_AJAX')) {
3030 3030
 			$default_data = array(
3031 3031
 				'close' => TRUE,
3032 3032
 				'redirect_url' => $redirect_url,
@@ -3035,11 +3035,11 @@  discard block
 block discarded – undo
3035 3035
 				);
3036 3036
 
3037 3037
 			$this->_template_args['success'] = $success;
3038
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
3038
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
3039 3039
 			$this->_return_json();
3040 3040
 		}
3041 3041
 
3042
-		wp_safe_redirect( $redirect_url );
3042
+		wp_safe_redirect($redirect_url);
3043 3043
 		exit();
3044 3044
 	}
3045 3045
 
@@ -3055,30 +3055,30 @@  discard block
 block discarded – undo
3055 3055
 	 * @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.
3056 3056
 	 * @return void
3057 3057
 	 */
3058
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
3058
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
3059 3059
 
3060 3060
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
3061
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3062
-			$notices = EE_Error::get_notices( false );
3063
-			if ( empty( $this->_template_args['success'] ) ) {
3064
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
3061
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3062
+			$notices = EE_Error::get_notices(false);
3063
+			if (empty($this->_template_args['success'])) {
3064
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3065 3065
 			}
3066 3066
 
3067
-			if ( empty( $this->_template_args['errors'] ) ) {
3068
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
3067
+			if (empty($this->_template_args['errors'])) {
3068
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3069 3069
 			}
3070 3070
 
3071
-			if ( empty( $this->_template_args['attention'] ) ) {
3072
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
3071
+			if (empty($this->_template_args['attention'])) {
3072
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3073 3073
 			}
3074 3074
 		}
3075 3075
 
3076 3076
 		$this->_template_args['notices'] = EE_Error::get_notices();
3077 3077
 
3078 3078
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3079
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
3080
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
3081
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
3079
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
3080
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3081
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
3082 3082
 		}
3083 3083
 	}
3084 3084
 
@@ -3108,7 +3108,7 @@  discard block
 block discarded – undo
3108 3108
 		$exclude_nonce = false
3109 3109
 	) {
3110 3110
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3111
-		if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) {
3111
+		if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3112 3112
 			throw new EE_Error(
3113 3113
 				sprintf(
3114 3114
 					__(
@@ -3119,7 +3119,7 @@  discard block
 block discarded – undo
3119 3119
 				)
3120 3120
 			);
3121 3121
 		}
3122
-		if ( ! isset( $this->_labels['buttons'][ $type ] ) ) {
3122
+		if ( ! isset($this->_labels['buttons'][$type])) {
3123 3123
 			throw new EE_Error(
3124 3124
 				sprintf(
3125 3125
 					__(
@@ -3131,8 +3131,8 @@  discard block
 block discarded – undo
3131 3131
 			);
3132 3132
 		}
3133 3133
 		//finally check user access for this button.
3134
-		$has_access = $this->check_user_access( $action, true );
3135
-		if ( ! $has_access ) {
3134
+		$has_access = $this->check_user_access($action, true);
3135
+		if ( ! $has_access) {
3136 3136
 			return '';
3137 3137
 		}
3138 3138
 		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3140,11 +3140,11 @@  discard block
 block discarded – undo
3140 3140
 			'action' => $action
3141 3141
 		);
3142 3142
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3143
-		if ( ! empty( $extra_request ) ) {
3144
-			$query_args = array_merge( $extra_request, $query_args );
3143
+		if ( ! empty($extra_request)) {
3144
+			$query_args = array_merge($extra_request, $query_args);
3145 3145
 		}
3146
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3147
-		return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class );
3146
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3147
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3148 3148
 	}
3149 3149
 
3150 3150
 
@@ -3159,11 +3159,11 @@  discard block
 block discarded – undo
3159 3159
 		$args = array(
3160 3160
 			'label' => $this->_admin_page_title,
3161 3161
 			'default' => 10,
3162
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3162
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3163 3163
 			);
3164 3164
 		//ONLY add the screen option if the user has access to it.
3165
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3166
-			add_screen_option( $option, $args );
3165
+		if ($this->check_user_access($this->_current_view, true)) {
3166
+			add_screen_option($option, $args);
3167 3167
 		}
3168 3168
 	}
3169 3169
 
@@ -3179,36 +3179,36 @@  discard block
 block discarded – undo
3179 3179
 	 * @return void
3180 3180
 	 */
3181 3181
 	private function _set_per_page_screen_options() {
3182
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3183
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3182
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3183
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3184 3184
 
3185
-			if ( !$user = wp_get_current_user() )
3185
+			if ( ! $user = wp_get_current_user())
3186 3186
 			return;
3187 3187
 			$option = $_POST['wp_screen_options']['option'];
3188 3188
 			$value = $_POST['wp_screen_options']['value'];
3189 3189
 
3190
-			if ( $option != sanitize_key( $option ) )
3190
+			if ($option != sanitize_key($option))
3191 3191
 				return;
3192 3192
 
3193 3193
 			$map_option = $option;
3194 3194
 
3195 3195
 			$option = str_replace('-', '_', $option);
3196 3196
 
3197
-			switch ( $map_option ) {
3198
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3197
+			switch ($map_option) {
3198
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3199 3199
 					$value = (int) $value;
3200
-					if ( $value < 1 || $value > 999 )
3200
+					if ($value < 1 || $value > 999)
3201 3201
 						return;
3202 3202
 					break;
3203 3203
 				default:
3204
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3205
-					if ( false === $value )
3204
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3205
+					if (false === $value)
3206 3206
 						return;
3207 3207
 					break;
3208 3208
 			}
3209 3209
 
3210 3210
 			update_user_meta($user->ID, $option, $value);
3211
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3211
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3212 3212
 			exit;
3213 3213
 		}
3214 3214
 	}
@@ -3219,8 +3219,8 @@  discard block
 block discarded – undo
3219 3219
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3220 3220
 	 * @param array $data array that will be assigned to template args.
3221 3221
 	 */
3222
-	public function set_template_args( $data ) {
3223
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3222
+	public function set_template_args($data) {
3223
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3224 3224
 	}
3225 3225
 
3226 3226
 
@@ -3236,26 +3236,26 @@  discard block
 block discarded – undo
3236 3236
 	 * @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.
3237 3237
 	 * @return void
3238 3238
 	 */
3239
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3239
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3240 3240
 		$user_id = get_current_user_id();
3241 3241
 
3242
-		if ( !$skip_route_verify )
3242
+		if ( ! $skip_route_verify)
3243 3243
 			$this->_verify_route($route);
3244 3244
 
3245 3245
 
3246 3246
 		//now let's set the string for what kind of transient we're setting
3247
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3248
-		$data = $notices ? array( 'notices' => $data ) : $data;
3247
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3248
+		$data = $notices ? array('notices' => $data) : $data;
3249 3249
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3250
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3251
-		if ( $existing ) {
3252
-			$data = array_merge( (array) $data, (array) $existing );
3250
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3251
+		if ($existing) {
3252
+			$data = array_merge((array) $data, (array) $existing);
3253 3253
 		}
3254 3254
 
3255
-		if ( is_multisite() && is_network_admin() ) {
3256
-			set_site_transient( $transient, $data, 8 );
3255
+		if (is_multisite() && is_network_admin()) {
3256
+			set_site_transient($transient, $data, 8);
3257 3257
 		} else {
3258
-			set_transient( $transient, $data, 8 );
3258
+			set_transient($transient, $data, 8);
3259 3259
 		}
3260 3260
 	}
3261 3261
 
@@ -3267,18 +3267,18 @@  discard block
 block discarded – undo
3267 3267
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3268 3268
 	 * @return mixed data
3269 3269
 	 */
3270
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3270
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3271 3271
 		$user_id = get_current_user_id();
3272
-		$route = !$route ? $this->_req_action : $route;
3273
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3274
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3272
+		$route = ! $route ? $this->_req_action : $route;
3273
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3274
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3275 3275
 		//delete transient after retrieval (just in case it hasn't expired);
3276
-		if ( is_multisite() && is_network_admin() ) {
3277
-			delete_site_transient( $transient );
3276
+		if (is_multisite() && is_network_admin()) {
3277
+			delete_site_transient($transient);
3278 3278
 		} else {
3279
-			delete_transient( $transient );
3279
+			delete_transient($transient);
3280 3280
 		}
3281
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3281
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3282 3282
 	}
3283 3283
 
3284 3284
 
@@ -3295,12 +3295,12 @@  discard block
 block discarded – undo
3295 3295
 
3296 3296
 		//retrieve all existing transients
3297 3297
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3298
-		if ( $results = $wpdb->get_results( $query ) ) {
3299
-			foreach ( $results as $result ) {
3300
-				$transient = str_replace( '_transient_', '', $result->option_name );
3301
-				get_transient( $transient );
3302
-				if ( is_multisite() && is_network_admin() ) {
3303
-					get_site_transient( $transient );
3298
+		if ($results = $wpdb->get_results($query)) {
3299
+			foreach ($results as $result) {
3300
+				$transient = str_replace('_transient_', '', $result->option_name);
3301
+				get_transient($transient);
3302
+				if (is_multisite() && is_network_admin()) {
3303
+					get_site_transient($transient);
3304 3304
 				}
3305 3305
 			}
3306 3306
 		}
@@ -3450,23 +3450,23 @@  discard block
 block discarded – undo
3450 3450
 	 * @param string $line	line no where error occurred
3451 3451
 	 * @return boolean
3452 3452
 	 */
3453
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3453
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3454 3454
 
3455 3455
 		//remove any options that are NOT going to be saved with the config settings.
3456
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3456
+		if (isset($config->core->ee_ueip_optin)) {
3457 3457
 			$config->core->ee_ueip_has_notified = TRUE;
3458 3458
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3459
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3460
-			update_option( 'ee_ueip_has_notified', TRUE );
3459
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3460
+			update_option('ee_ueip_has_notified', TRUE);
3461 3461
 		}
3462 3462
 		// and save it (note we're also doing the network save here)
3463
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3464
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3465
-		if ( $config_saved && $net_saved ) {
3466
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3463
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3464
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3465
+		if ($config_saved && $net_saved) {
3466
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3467 3467
 			return TRUE;
3468 3468
 		} else {
3469
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3469
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3470 3470
 			return FALSE;
3471 3471
 		}
3472 3472
 	}
@@ -3479,7 +3479,7 @@  discard block
 block discarded – undo
3479 3479
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3480 3480
 	 * @return array
3481 3481
 	 */
3482
-	public function get_yes_no_values(){
3482
+	public function get_yes_no_values() {
3483 3483
 		return $this->_yes_no_values;
3484 3484
 	}
3485 3485
 
@@ -3501,8 +3501,8 @@  discard block
 block discarded – undo
3501 3501
 	 *
3502 3502
 	 * @return string
3503 3503
 	 */
3504
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3505
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3504
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3505
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3506 3506
 	}
3507 3507
 
3508 3508
 
@@ -3516,8 +3516,8 @@  discard block
 block discarded – undo
3516 3516
 	 *
3517 3517
 	 * @return string
3518 3518
 	 */
3519
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3520
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3519
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3520
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3521 3521
 	}
3522 3522
 
3523 3523
 
@@ -3536,8 +3536,8 @@  discard block
 block discarded – undo
3536 3536
 	 * @return bool success/fail
3537 3537
 	 */
3538 3538
 	protected function _process_resend_registration() {
3539
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3540
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3539
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3540
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3541 3541
 		return $this->_template_args['success'];
3542 3542
 	}
3543 3543
 
@@ -3550,11 +3550,11 @@  discard block
 block discarded – undo
3550 3550
 	 * @param \EE_Payment $payment
3551 3551
 	 * @return bool success/fail
3552 3552
 	 */
3553
-	protected function _process_payment_notification( EE_Payment $payment ) {
3554
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3555
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3556
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3557
-		return $this->_template_args[ 'success' ];
3553
+	protected function _process_payment_notification(EE_Payment $payment) {
3554
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3555
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3556
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3557
+		return $this->_template_args['success'];
3558 3558
 	}
3559 3559
 
3560 3560
 
Please login to merge, or discard this patch.
Braces   +137 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * Event Espresso
6 8
  *
@@ -162,8 +164,9 @@  discard block
 block discarded – undo
162 164
 	 */
163 165
 	public function __construct( $routing = TRUE ) {
164 166
 
165
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
166
-			$this->_is_caf = TRUE;
167
+		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) {
168
+					$this->_is_caf = TRUE;
169
+		}
167 170
 
168 171
 		$this->_yes_no_values = array(
169 172
 			array('id' => TRUE, 'text' => __('Yes', 'event_espresso')),
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
 		$this->_do_other_page_hooks();
195 198
 
196 199
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
197
-		if ( method_exists( $this, '_before_page_setup' ) )
198
-			$this->_before_page_setup();
200
+		if ( method_exists( $this, '_before_page_setup' ) ) {
201
+					$this->_before_page_setup();
202
+		}
199 203
 
200 204
 		//set up page dependencies
201 205
 		$this->_page_setup();
@@ -502,7 +506,9 @@  discard block
 block discarded – undo
502 506
 		global $ee_menu_slugs;
503 507
 		$ee_menu_slugs = (array) $ee_menu_slugs;
504 508
 
505
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
509
+		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) {
510
+			return FALSE;
511
+		}
506 512
 
507 513
 
508 514
 		// 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
@@ -537,12 +543,14 @@  discard block
 block discarded – undo
537 543
 		}
538 544
 
539 545
 		//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
540
-		if ( method_exists( $this, '_extend_page_config' ) )
541
-			$this->_extend_page_config();
546
+		if ( method_exists( $this, '_extend_page_config' ) ) {
547
+					$this->_extend_page_config();
548
+		}
542 549
 
543 550
 		//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.
544
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
545
-			$this->_extend_page_config_for_cpt();
551
+		if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) {
552
+					$this->_extend_page_config_for_cpt();
553
+		}
546 554
 
547 555
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
548 556
 		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
@@ -658,8 +666,9 @@  discard block
 block discarded – undo
658 666
 		//add screen options - global, page child class, and view specific
659 667
 		$this->_add_global_screen_options();
660 668
 		$this->_add_screen_options();
661
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
662
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
669
+		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) {
670
+					call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
671
+		}
663 672
 
664 673
 
665 674
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -670,28 +679,32 @@  discard block
 block discarded – undo
670 679
 		//add feature_pointers - global, page child class, and view specific
671 680
 		$this->_add_feature_pointers();
672 681
 		$this->_add_global_feature_pointers();
673
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
674
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
682
+		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) {
683
+					call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
684
+		}
675 685
 
676 686
 		//enqueue scripts/styles - global, page class, and view specific
677 687
 		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
678 688
 		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
679
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
680
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
689
+		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) {
690
+					add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
691
+		}
681 692
 
682 693
 		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
683 694
 
684 695
 		//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
685 696
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
686 697
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
687
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
688
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
698
+		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) {
699
+					add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
700
+		}
689 701
 
690 702
 		//admin footer scripts
691 703
 		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
692 704
 		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
693
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
694
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
705
+		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) {
706
+					add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
707
+		}
695 708
 
696 709
 
697 710
 		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
@@ -764,7 +777,9 @@  discard block
 block discarded – undo
764 777
 	protected function _verify_routes() {
765 778
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
766 779
 
767
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
780
+		if ( !$this->_current_page && !defined( 'DOING_AJAX')) {
781
+			return FALSE;
782
+		}
768 783
 
769 784
 		$this->_route = FALSE;
770 785
 		$func = FALSE;
@@ -874,8 +889,9 @@  discard block
 block discarded – undo
874 889
 	 * @return void
875 890
 	 */
876 891
 	protected function _route_admin_request() {
877
-		if (  ! $this->_is_UI_request )
878
-			$this->_verify_routes();
892
+		if (  ! $this->_is_UI_request ) {
893
+					$this->_verify_routes();
894
+		}
879 895
 
880 896
 		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
881 897
 
@@ -885,8 +901,9 @@  discard block
 block discarded – undo
885 901
 			$this->_verify_nonce( $nonce, $this->_req_nonce );
886 902
 		}
887 903
 		//set the nav_tabs array but ONLY if this is  UI_request
888
-		if ( $this->_is_UI_request )
889
-			$this->_set_nav_tabs();
904
+		if ( $this->_is_UI_request ) {
905
+					$this->_set_nav_tabs();
906
+		}
890 907
 
891 908
 		// grab callback function
892 909
 		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
@@ -923,8 +940,9 @@  discard block
 block discarded – undo
923 940
 			}
924 941
 
925 942
 
926
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
927
-				throw new EE_Error( $error_msg );
943
+			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) {
944
+							throw new EE_Error( $error_msg );
945
+			}
928 946
 		}
929 947
 
930 948
 		//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.
@@ -1051,8 +1069,9 @@  discard block
 block discarded – undo
1051 1069
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1052 1070
 				foreach ( $this->_help_tour['tours'] as $tour ) {
1053 1071
 					//if this is the end tour then we don't need to setup a button
1054
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1055
-						continue;
1072
+					if ( $tour instanceof EE_Help_Tour_final_stop ) {
1073
+											continue;
1074
+					}
1056 1075
 					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1057 1076
 				}
1058 1077
 				$tour_buttons .= implode('<br />', $tb);
@@ -1062,8 +1081,9 @@  discard block
 block discarded – undo
1062 1081
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1063 1082
 			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1064 1083
 				//check that the callback given is valid
1065
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1066
-					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) ) );
1084
+				if ( !method_exists($this, $config['help_sidebar'] ) ) {
1085
+									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) ) );
1086
+				}
1067 1087
 
1068 1088
 				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1069 1089
 
@@ -1087,18 +1107,23 @@  discard block
 block discarded – undo
1087 1107
 				}/**/
1088 1108
 
1089 1109
 
1090
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1110
+			if ( !isset( $config['help_tabs'] ) ) {
1111
+				return;
1112
+			}
1113
+			//no help tabs for this route
1091 1114
 
1092 1115
 			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1093 1116
 				//we're here so there ARE help tabs!
1094 1117
 
1095 1118
 				//make sure we've got what we need
1096
-				if ( !isset( $cfg['title'] ) )
1097
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1119
+				if ( !isset( $cfg['title'] ) ) {
1120
+									throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1121
+				}
1098 1122
 
1099 1123
 
1100
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1101
-					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') );
1124
+				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) {
1125
+									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') );
1126
+				}
1102 1127
 
1103 1128
 
1104 1129
 
@@ -1161,14 +1186,16 @@  discard block
 block discarded – undo
1161 1186
 		$this->_help_tour = array();
1162 1187
 
1163 1188
 		//exit early if help tours are turned off globally
1164
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1165
-			return;
1189
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) {
1190
+					return;
1191
+		}
1166 1192
 
1167 1193
 		//loop through _page_config to find any help_tour defined
1168 1194
 		foreach ( $this->_page_config as $route => $config ) {
1169 1195
 			//we're only going to set things up for this route
1170
-			if ( $route !== $this->_req_action )
1171
-				continue;
1196
+			if ( $route !== $this->_req_action ) {
1197
+							continue;
1198
+			}
1172 1199
 
1173 1200
 			if ( isset( $config['help_tour'] ) ) {
1174 1201
 
@@ -1203,8 +1230,9 @@  discard block
 block discarded – undo
1203 1230
 			}
1204 1231
 		}
1205 1232
 
1206
-		if ( !empty( $tours ) )
1207
-			$this->_help_tour['tours'] = $tours;
1233
+		if ( !empty( $tours ) ) {
1234
+					$this->_help_tour['tours'] = $tours;
1235
+		}
1208 1236
 
1209 1237
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
1210 1238
 	}
@@ -1244,15 +1272,21 @@  discard block
 block discarded – undo
1244 1272
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1245 1273
 		$i = 0;
1246 1274
 		foreach ( $this->_page_config as $slug => $config ) {
1247
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1248
-				continue; //no nav tab for this config
1275
+			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) {
1276
+							continue;
1277
+			}
1278
+			//no nav tab for this config
1249 1279
 
1250 1280
 			//check for persistent flag
1251
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1252
-				continue; //nav tab is only to appear when route requested.
1281
+			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) {
1282
+							continue;
1283
+			}
1284
+			//nav tab is only to appear when route requested.
1253 1285
 
1254
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1255
-				continue; //no nav tab becasue current user does not have access.
1286
+			if ( ! $this->check_user_access( $slug, TRUE ) ) {
1287
+							continue;
1288
+			}
1289
+			//no nav tab becasue current user does not have access.
1256 1290
 
1257 1291
 			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1258 1292
 			$this->_nav_tabs[$slug] = array(
@@ -1488,10 +1522,11 @@  discard block
 block discarded – undo
1488 1522
 			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1489 1523
 		}
1490 1524
 
1491
-		if ( $display )
1492
-			echo $content;
1493
-		else
1494
-			return $content;
1525
+		if ( $display ) {
1526
+					echo $content;
1527
+		} else {
1528
+					return $content;
1529
+		}
1495 1530
 	}
1496 1531
 
1497 1532
 
@@ -1508,8 +1543,9 @@  discard block
 block discarded – undo
1508 1543
 		$method_name = '_help_popup_content_' . $this->_req_action;
1509 1544
 
1510 1545
 		//if method doesn't exist let's get out.
1511
-		if ( !method_exists( $this, $method_name ) )
1512
-			return array();
1546
+		if ( !method_exists( $this, $method_name ) ) {
1547
+					return array();
1548
+		}
1513 1549
 
1514 1550
 		//k we're good to go let's retrieve the help array
1515 1551
 		$help_array = call_user_func( array( $this, $method_name ) );
@@ -1540,7 +1576,9 @@  discard block
 block discarded – undo
1540 1576
 	 */
1541 1577
 	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1542 1578
 
1543
-		if ( defined('DOING_AJAX') ) return;
1579
+		if ( defined('DOING_AJAX') ) {
1580
+			return;
1581
+		}
1544 1582
 
1545 1583
 		//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
1546 1584
 		$help_array = $this->_get_help_content();
@@ -1558,10 +1596,11 @@  discard block
 block discarded – undo
1558 1596
 		$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>';
1559 1597
 		$content = $content . $help_content;
1560 1598
 
1561
-		if ( $display )
1562
-			echo $content;
1563
-		else
1564
-			return $content;
1599
+		if ( $display ) {
1600
+					echo $content;
1601
+		} else {
1602
+					return $content;
1603
+		}
1565 1604
 	}
1566 1605
 
1567 1606
 
@@ -1787,8 +1826,10 @@  discard block
 block discarded – undo
1787 1826
 	protected function _set_list_table() {
1788 1827
 
1789 1828
 		//first is this a list_table view?
1790
-		if ( !isset($this->_route_config['list_table']) )
1791
-			return; //not a list_table view so get out.
1829
+		if ( !isset($this->_route_config['list_table']) ) {
1830
+					return;
1831
+		}
1832
+		//not a list_table view so get out.
1792 1833
 
1793 1834
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1794 1835
 
@@ -2150,8 +2191,9 @@  discard block
 block discarded – undo
2150 2191
 	protected function _espresso_sponsors_post_box() {
2151 2192
 
2152 2193
 		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2153
-		if ( $show_sponsors )
2154
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2194
+		if ( $show_sponsors ) {
2195
+					add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2196
+		}
2155 2197
 	}
2156 2198
 
2157 2199
 
@@ -2448,8 +2490,9 @@  discard block
 block discarded – undo
2448 2490
 
2449 2491
 		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2450 2492
 
2451
-		if ( defined('DOING_AJAX' ) )
2452
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2493
+		if ( defined('DOING_AJAX' ) ) {
2494
+					$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2495
+		}
2453 2496
 
2454 2497
 		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2455 2498
 
@@ -2591,10 +2634,11 @@  discard block
 block discarded – undo
2591 2634
 			true
2592 2635
 		);
2593 2636
 		// the final template wrapper
2594
-		if ( $sidebar )
2595
-			$this->display_admin_page_with_sidebar();
2596
-		else
2597
-			$this->display_admin_page_with_no_sidebar();
2637
+		if ( $sidebar ) {
2638
+					$this->display_admin_page_with_sidebar();
2639
+		} else {
2640
+					$this->display_admin_page_with_no_sidebar();
2641
+		}
2598 2642
 	}
2599 2643
 
2600 2644
 
@@ -2662,8 +2706,9 @@  discard block
 block discarded – undo
2662 2706
 
2663 2707
 
2664 2708
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2665
-		if ( NULL === error_get_last() || ! headers_sent() )
2666
-			header('Content-Type: application/json; charset=UTF-8');
2709
+		if ( NULL === error_get_last() || ! headers_sent() ) {
2710
+					header('Content-Type: application/json; charset=UTF-8');
2711
+		}
2667 2712
                 if( function_exists( 'wp_json_encode' ) ) {
2668 2713
                     echo wp_json_encode( $json );
2669 2714
                 } else {
@@ -2681,10 +2726,9 @@  discard block
 block discarded – undo
2681 2726
 	 * @throws EE_Error
2682 2727
 	 */
2683 2728
 	public function return_json() {
2684
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2685
-			$this->_return_json();
2686
-
2687
-		else {
2729
+		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2730
+					$this->_return_json();
2731
+		} else {
2688 2732
 			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2689 2733
 		}
2690 2734
 	}
@@ -2826,7 +2870,9 @@  discard block
 block discarded – undo
2826 2870
 			$id = $this->_current_view . '_' . $ref;
2827 2871
 			$name = !empty($actions) ? $actions[$key] : $ref;
2828 2872
 			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2829
-			if ( !$both ) break;
2873
+			if ( !$both ) {
2874
+				break;
2875
+			}
2830 2876
 		}
2831 2877
 
2832 2878
 	}
@@ -3182,13 +3228,15 @@  discard block
 block discarded – undo
3182 3228
 		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3183 3229
 			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3184 3230
 
3185
-			if ( !$user = wp_get_current_user() )
3186
-			return;
3231
+			if ( !$user = wp_get_current_user() ) {
3232
+						return;
3233
+			}
3187 3234
 			$option = $_POST['wp_screen_options']['option'];
3188 3235
 			$value = $_POST['wp_screen_options']['value'];
3189 3236
 
3190
-			if ( $option != sanitize_key( $option ) )
3191
-				return;
3237
+			if ( $option != sanitize_key( $option ) ) {
3238
+							return;
3239
+			}
3192 3240
 
3193 3241
 			$map_option = $option;
3194 3242
 
@@ -3197,13 +3245,15 @@  discard block
 block discarded – undo
3197 3245
 			switch ( $map_option ) {
3198 3246
 				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3199 3247
 					$value = (int) $value;
3200
-					if ( $value < 1 || $value > 999 )
3201
-						return;
3248
+					if ( $value < 1 || $value > 999 ) {
3249
+											return;
3250
+					}
3202 3251
 					break;
3203 3252
 				default:
3204 3253
 					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3205
-					if ( false === $value )
3206
-						return;
3254
+					if ( false === $value ) {
3255
+											return;
3256
+					}
3207 3257
 					break;
3208 3258
 			}
3209 3259
 
@@ -3239,8 +3289,9 @@  discard block
 block discarded – undo
3239 3289
 	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3240 3290
 		$user_id = get_current_user_id();
3241 3291
 
3242
-		if ( !$skip_route_verify )
3243
-			$this->_verify_route($route);
3292
+		if ( !$skip_route_verify ) {
3293
+					$this->_verify_route($route);
3294
+		}
3244 3295
 
3245 3296
 
3246 3297
 		//now let's set the string for what kind of transient we're setting
Please login to merge, or discard this patch.
core/business/EE_Transaction_Payments.class.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @access private
117 117
 	 * @param EE_Transaction $transaction
118 118
 	 * @param bool           $update_txn
119
-	 * @return bool true if TXN total was updated, false if not
119
+	 * @return boolean|null true if TXN total was updated, false if not
120 120
 	 * @throws \EE_Error
121 121
 	 */
122 122
 	public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @param EE_Transaction $transaction
189 189
 	 * @param string         $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved).
190 190
 	 *                                       By default, searches for approved payments
191
-	 * @return float|false   float on success, false on fail
191
+	 * @return double   float on success, false on fail
192 192
 	 * @throws \EE_Error
193 193
 	 */
194 194
 	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Payments
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public static function instance() {
46 46
 		// check if class object is instantiated
47
-		if ( ! self::$_instance instanceof EE_Transaction_Payments ) {
47
+		if ( ! self::$_instance instanceof EE_Transaction_Payments) {
48 48
 			self::$_instance = new self();
49 49
 		}
50 50
 		return self::$_instance;
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	/**
73 73
 	 * @param string $old_txn_status
74 74
 	 */
75
-	public function set_old_txn_status( $old_txn_status ) {
75
+	public function set_old_txn_status($old_txn_status) {
76 76
 		// only set the first time
77
-		if ( $this->_old_txn_status === null ) {
77
+		if ($this->_old_txn_status === null) {
78 78
 			$this->_old_txn_status = $old_txn_status;
79 79
 		}
80 80
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	/**
94 94
 	 * @param string $new_txn_status
95 95
 	 */
96
-	public function set_new_txn_status( $new_txn_status ) {
96
+	public function set_new_txn_status($new_txn_status) {
97 97
 		$this->_new_txn_status = $new_txn_status;
98 98
 	}
99 99
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return bool
106 106
 	 */
107 107
 	public function txn_status_updated() {
108
-		return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null  ? true : false;
108
+		return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false;
109 109
 	}
110 110
 
111 111
 
@@ -119,18 +119,18 @@  discard block
 block discarded – undo
119 119
 	 * @return bool true if TXN total was updated, false if not
120 120
 	 * @throws \EE_Error
121 121
 	 */
122
-	public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) {
122
+	public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) {
123 123
 		$total_line_item = $transaction->total_line_item();
124
-		if ( ! $total_line_item instanceof EE_Line_Item ) {
124
+		if ( ! $total_line_item instanceof EE_Line_Item) {
125 125
 			EE_Error::add_error(
126
-				sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ),
126
+				sprintf(__('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), $transaction->ID()),
127 127
 				__FILE__, __FUNCTION__, __LINE__
128 128
 			);
129 129
 			return false;
130 130
 		}
131 131
 		$new_total = $total_line_item->recalculate_total_including_taxes();
132
-		$transaction->set_total( $new_total );
133
-		if ( $update_txn ) {
132
+		$transaction->set_total($new_total);
133
+		if ($update_txn) {
134 134
 			return $transaction->save() ? true : false;
135 135
 		}
136 136
 	}
@@ -152,22 +152,22 @@  discard block
 block discarded – undo
152 152
 	 * @return    boolean        whether the TXN was saved
153 153
 	 * @throws \EE_Error
154 154
 	 */
155
-	public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){
155
+	public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) {
156 156
 		// verify transaction
157
-		if ( ! $transaction instanceof EE_Transaction ) {
158
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
157
+		if ( ! $transaction instanceof EE_Transaction) {
158
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
159 159
 			return false;
160 160
 		}
161 161
 		// set incoming TXN_Status
162
-		$this->set_old_txn_status( $transaction->status_ID() );
162
+		$this->set_old_txn_status($transaction->status_ID());
163 163
 		// calculate total paid
164
-		$total_paid = $this->recalculate_total_payments_for_transaction( $transaction );
164
+		$total_paid = $this->recalculate_total_payments_for_transaction($transaction);
165 165
 		// if total paid has changed
166
-		if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) {
167
-			$transaction->set_paid( $total_paid );
166
+		if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) {
167
+			$transaction->set_paid($total_paid);
168 168
 			// maybe update status, and make sure to save transaction if not done already
169
-			if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) {
170
-				if ( $update_txn ) {
169
+			if ( ! $transaction->update_status_based_on_total_paid($update_txn)) {
170
+				if ($update_txn) {
171 171
 					return $transaction->save() ? true : false;
172 172
 				}
173 173
 			} else {
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 	 * @return float|false   float on success, false on fail
192 192
 	 * @throws \EE_Error
193 193
 	 */
194
-	public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) {
194
+	public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) {
195 195
 		// verify transaction
196
-		if ( ! $transaction instanceof EE_Transaction ) {
197
-			EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
196
+		if ( ! $transaction instanceof EE_Transaction) {
197
+			EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
198 198
 			return false;
199 199
 		}
200 200
 		// ensure Payment model is loaded
201
-		EE_Registry::instance()->load_model( 'Payment' );
201
+		EE_Registry::instance()->load_model('Payment');
202 202
 		// calls EEM_Base::sum()
203 203
 		return EEM_Payment::instance()->sum(
204 204
 			// query params
205
-			array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )),
205
+			array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)),
206 206
 			// field to sum
207 207
 			'PAY_amount'
208 208
 		);
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 	 * @return boolean
221 221
 	 * @throws \EE_Error
222 222
 	 */
223
-	public function delete_payment_and_update_transaction( EE_Payment $payment ) {
223
+	public function delete_payment_and_update_transaction(EE_Payment $payment) {
224 224
 		// verify payment
225
-		if ( ! $payment instanceof EE_Payment ) {
226
-			EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
225
+		if ( ! $payment instanceof EE_Payment) {
226
+			EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
227 227
 			return false;
228 228
 		}
229
-		if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) {
229
+		if ( ! $this->delete_registration_payments_and_update_registrations($payment)) {
230 230
 			return false;
231 231
 		}
232
-		if ( ! $payment->delete() ) {
233
-			EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
232
+		if ( ! $payment->delete()) {
233
+			EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
234 234
 			return false;
235 235
 		}
236 236
 
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 			|| $TXN_status === EEM_Transaction::failed_status_code
242 242
 			|| $payment->amount() === 0
243 243
 		) {
244
-			EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) );
244
+			EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso'));
245 245
 			return true;
246 246
 		}
247 247
 
248 248
 
249 249
 		//if this fails, that just means that the transaction didn't get its status changed and/or updated.
250 250
 		//however the payment was still deleted.
251
-		if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) {
251
+		if ( ! $this->calculate_total_payments_and_update_status($transaction)) {
252 252
 
253 253
 			EE_Error::add_attention(
254 254
 				__(
@@ -282,28 +282,28 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 * @throws \EE_Error
284 284
 	 */
285
-	public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) {
285
+	public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) {
286 286
 		$save_payment = false;
287
-		$reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) );
288
-		$registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params );
289
-		if ( ! empty( $registration_payments )) {
290
-			foreach ( $registration_payments as $registration_payment ) {
291
-				if ( $registration_payment instanceof EE_Registration_Payment ) {
287
+		$reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID()));
288
+		$registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params);
289
+		if ( ! empty($registration_payments)) {
290
+			foreach ($registration_payments as $registration_payment) {
291
+				if ($registration_payment instanceof EE_Registration_Payment) {
292 292
 					$amount_paid = $registration_payment->amount();
293 293
 					$registration = $registration_payment->registration();
294
-					if ( $registration instanceof EE_Registration ) {
295
-						$registration->set_paid( $registration->paid() - $amount_paid );
296
-						if ( $registration->save() ) {
297
-							if ( $registration_payment->delete() ) {
298
-								$registration->_remove_relation_to( $payment, 'Payment' );
299
-								$payment->_remove_relation_to( $registration, 'Registration' );
294
+					if ($registration instanceof EE_Registration) {
295
+						$registration->set_paid($registration->paid() - $amount_paid);
296
+						if ($registration->save()) {
297
+							if ($registration_payment->delete()) {
298
+								$registration->_remove_relation_to($payment, 'Payment');
299
+								$payment->_remove_relation_to($registration, 'Registration');
300 300
 							}
301 301
 							$save_payment = true;
302 302
 						}
303 303
 					} else {
304 304
 						EE_Error::add_error(
305 305
 							sprintf(
306
-								__( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ),
306
+								__('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'),
307 307
 								$registration_payment->ID()
308 308
 							),
309 309
 							__FILE__, __FUNCTION__, __LINE__
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				} else {
314 314
 					EE_Error::add_error(
315 315
 						sprintf(
316
-							__( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ),
316
+							__('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'),
317 317
 							$payment->ID()
318 318
 						),
319 319
 						__FILE__, __FUNCTION__, __LINE__
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 				}
323 323
 			}
324 324
 		}
325
-		if ( $save_payment ) {
325
+		if ($save_payment) {
326 326
 			$payment->save();
327 327
 		}
328 328
 		return true;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true)
343 343
 	{
344 344
 		EE_Error::doing_it_wrong(
345
-			__CLASS__ . '::' . __FUNCTION__,
345
+			__CLASS__.'::'.__FUNCTION__,
346 346
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
347 347
 				'EE_Transaction::update_status_based_on_total_paid()'),
348 348
 			'4.9.1',
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 
164 164
 	/**
165 165
 	 * 		grab url requests and route them
166
-	*		@access private
167
-	*		@return void
168
-	*/
166
+	 *		@access private
167
+	 *		@return void
168
+	 */
169 169
 	public function _set_page_routes() {
170 170
 
171 171
 		$this->_get_registration_status_array();
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 						'title' => __('Registrations Other', 'event_espresso'),
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440
-                ),
440
+				),
441 441
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 						: $this->_admin_base_url,
457 457
 					'persistent' => FALSE
458 458
 				),
459
-                'help_tabs' => array(
459
+				'help_tabs' => array(
460 460
 					'registrations_details_help_tab' => array(
461 461
 						'title' => __('Registration Details', 'event_espresso'),
462 462
 						'filename' => 'registrations_details'
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 					'order' => 20
521 521
 				),
522 522
 				'list_table' => 'EE_Attendee_Contact_List_Table',
523
-                'help_tabs' => array(
523
+				'help_tabs' => array(
524 524
 					'registrations_contact_list_help_tab' => array(
525 525
 						'title' => __('Registrations Contact List', 'event_espresso'),
526 526
 						'filename' => 'registrations_contact_list'
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 						'title' => __('Contact List Other', 'event_espresso'),
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540
-                ),
540
+				),
541 541
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
 
572 572
 	/**
573 573
 	 * 		get list of registration statuses
574
-	*		@access private
575
-	*		@return void
576
-	*/
574
+	 *		@access private
575
+	 *		@return void
576
+	 */
577 577
 	private function _get_registration_status_array() {
578 578
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
579 579
 	}
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
 
866 866
 
867 867
 	 /**
868
-	 * @throws \EE_Error
869
-	 */
868
+	  * @throws \EE_Error
869
+	  */
870 870
 	protected function _registrations_overview_list_table() {
871 871
 		$this->_template_args['admin_page_header'] = '';
872 872
 		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			return TRUE;
927 927
 		}
928 928
 
929
-	    $REG = EEM_Registration::instance();
929
+		$REG = EEM_Registration::instance();
930 930
 
931 931
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
932 932
 
@@ -1150,9 +1150,9 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
 	/**
1152 1152
 	 * 		generates HTML for the View Registration Details Admin page
1153
-	*		@access protected
1154
-	*		@return void
1155
-	*/
1153
+	 *		@access protected
1154
+	 *		@return void
1155
+	 */
1156 1156
 	protected function _registration_details() {
1157 1157
 
1158 1158
 		$this->_template_args = array();
@@ -1325,16 +1325,16 @@  discard block
 block discarded – undo
1325 1325
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
1326 1326
 		//);
1327 1327
 		//Approved
1328
-    //An approved registration allows payments and may have a transaction status of incomplete or complete . The registration is marked as active and a space is reserved for the registrant .
1328
+	//An approved registration allows payments and may have a transaction status of incomplete or complete . The registration is marked as active and a space is reserved for the registrant .
1329 1329
 		//Cancelled
1330 1330
 		//	A {
1331 1331
 		//	cancelled} registration is performed by the registrant . Payments are not allowed, the registration is inactive, and no space is reserved .
1332 1332
 		//Declined
1333
-    //A declined registration is performed by the event admin . Payments are not allowed, the registration is inactive, and not space is reserved .
1333
+	//A declined registration is performed by the event admin . Payments are not allowed, the registration is inactive, and not space is reserved .
1334 1334
 		//Not Approved
1335
-    //A not approved registration is performed by the event admin . Payments are not allowed, the registration is active, and no space is reserved .
1335
+	//A not approved registration is performed by the event admin . Payments are not allowed, the registration is active, and no space is reserved .
1336 1336
 		//Pending Payment
1337
-    //A pending registration allows payments . The status will be automatically toggled to approved if the {
1337
+	//A pending registration allows payments . The status will be automatically toggled to approved if the {
1338 1338
 		//	payment} is made in full by registrant .
1339 1339
 
1340 1340
 	}
@@ -1441,8 +1441,8 @@  discard block
 block discarded – undo
1441 1441
 	 */
1442 1442
 	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1443 1443
 		$result = ! empty( $STS_ID )
1444
-            ? $this->_set_registration_status_from_request( $STS_ID, $notify )
1445
-            : array( 'success' => false );
1444
+			? $this->_set_registration_status_from_request( $STS_ID, $notify )
1445
+			: array( 'success' => false );
1446 1446
 		$success = isset( $result['success'] ) && $result['success'];
1447 1447
 		//setup success message
1448 1448
 		if ( $success ) {
@@ -1624,9 +1624,9 @@  discard block
 block discarded – undo
1624 1624
 
1625 1625
 	/**
1626 1626
 	 * 		generates HTML for the Registration main meta box
1627
-	*		@access public
1628
-	*		@return void
1629
-	*/
1627
+	 *		@access public
1628
+	 *		@return void
1629
+	 */
1630 1630
 	public function _reg_details_meta_box() {
1631 1631
 		EEH_Autoloader::register_line_item_display_autoloaders();
1632 1632
 		EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 	 *
1761 1761
 	 * @access public
1762 1762
 	 * @return void
1763
-	*/
1763
+	 */
1764 1764
 	public function _reg_questions_meta_box() {
1765 1765
 		//allow someone to override this method entirely
1766 1766
 		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
@@ -1962,12 +1962,12 @@  discard block
 block discarded – undo
1962 1962
 
1963 1963
 	/**
1964 1964
 	 * 		generates HTML for the Registration main meta box
1965
-	*		@access public
1966
-	*		@return void
1967
-	*/
1965
+	 *		@access public
1966
+	 *		@return void
1967
+	 */
1968 1968
 	public function _reg_attendees_meta_box() {
1969 1969
 
1970
-	    $REG = EEM_Registration::instance();
1970
+		$REG = EEM_Registration::instance();
1971 1971
 		//get all other registrations on this transaction, and cache
1972 1972
 		//the attendees for them so we don't have to run another query using force_join
1973 1973
 		$registrations = $REG->get_all(array(
@@ -2019,9 +2019,9 @@  discard block
 block discarded – undo
2019 2019
 
2020 2020
 	/**
2021 2021
 	 * 		generates HTML for the Edit Registration side meta box
2022
-	*		@access public
2023
-	*		@return void
2024
-	*/
2022
+	 *		@access public
2023
+	 *		@return void
2024
+	 */
2025 2025
 	public function _reg_registrant_side_meta_box() {
2026 2026
 
2027 2027
 		/*@var $attendee EE_Attendee */
@@ -2402,9 +2402,9 @@  discard block
 block discarded – undo
2402 2402
 
2403 2403
 	/**
2404 2404
 	 * 		set_reg_event
2405
-	*		@access private
2406
-	*		@return boolean
2407
-	*/
2405
+	 *		@access private
2406
+	 *		@return boolean
2407
+	 */
2408 2408
 	private function _set_reg_event() {
2409 2409
 		if ( is_object( $this->_reg_event )) {
2410 2410
 			return TRUE;
@@ -2544,9 +2544,9 @@  discard block
 block discarded – undo
2544 2544
 
2545 2545
 	/**
2546 2546
 	 * 		generates HTML for the Attendee Contact List
2547
-	*		@access protected
2548
-	*		@return void
2549
-	*/
2547
+	 *		@access protected
2548
+	 *		@return void
2549
+	 */
2550 2550
 	protected function _attendee_contact_list_table() {
2551 2551
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2552 2552
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2560,9 +2560,9 @@  discard block
 block discarded – undo
2560 2560
 	/**
2561 2561
 	 * 		get_attendees
2562 2562
 	 * 		@param bool $count whether to return count or data.
2563
-	*		@access public
2564
-	*		@return array
2565
-	*/
2563
+	 *		@access public
2564
+	 *		@return array
2565
+	 */
2566 2566
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2567 2567
 
2568 2568
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2894,9 +2894,9 @@  discard block
 block discarded – undo
2894 2894
 
2895 2895
 	/**
2896 2896
 	 * 		_attendee_details
2897
-	*		@access protected
2898
-	*		@return void
2899
-	*/
2897
+	 *		@access protected
2898
+	 *		@return void
2899
+	 */
2900 2900
 	public function attendee_registrations_meta_box( $post ) {
2901 2901
 
2902 2902
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2929,10 +2929,10 @@  discard block
 block discarded – undo
2929 2929
 
2930 2930
 	/**
2931 2931
 	 * 		_trash_or_restore_attendee
2932
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2933
-	*		@access protected
2934
-	*		@return void
2935
-	*/
2932
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2933
+	 *		@access protected
2934
+	 *		@return void
2935
+	 */
2936 2936
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2937 2937
 
2938 2938
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +581 added lines, -581 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
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					'order' => 15,
451 451
 					'url' => isset($this->_req_data['_REG_ID'])
452 452
 						? add_query_arg(
453
-							array('_REG_ID' => $this->_req_data['_REG_ID'] ),
453
+							array('_REG_ID' => $this->_req_data['_REG_ID']),
454 454
 							$this->_current_page_view_url
455 455
 						)
456 456
 						: $this->_admin_base_url,
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 						'filename' => 'registrations_details_registrant_details'
475 475
 					)
476 476
 				),
477
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
478
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
477
+				'help_tour' => array('Registration_Details_Help_Tour'),
478
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
479 479
 				'require_nonce' => FALSE
480 480
 			),
481 481
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 					'order' => 15,
500 500
 					'persistent' => FALSE
501 501
 				),
502
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
502
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
503 503
 				'require_nonce' => FALSE
504 504
 			),
505 505
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 					'label' => __('Edit Contact', 'event_espresso'),
509 509
 					'order' => 15,
510 510
 					'persistent' => FALSE,
511
-					'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
511
+					'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
512 512
 				),
513 513
 				'metaboxes' => array('attendee_editor_metaboxes'),
514 514
 				'require_nonce' => FALSE
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540 540
                 ),
541
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
541
+				'help_tour' => array('Contact_List_Help_Tour'),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
544 544
 			),
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	protected function _add_screen_options() {}
558 558
 	protected function _add_feature_pointers() {}
559 559
 	public function admin_init() {
560
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
560
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
561 561
 	}
562 562
 	public function admin_notices() {}
563 563
 	public function admin_footer_scripts() {}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	*		@return void
576 576
 	*/
577 577
 	private function _get_registration_status_array() {
578
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
578
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 	public function load_scripts_styles() {
599 599
 		//style
600 600
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
601
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
601
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
602 602
 		wp_enqueue_style('espresso_reg');
603 603
 
604 604
 		//script
605
-		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);
605
+		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);
606 606
 		wp_enqueue_script('espresso_reg');
607 607
 	}
608 608
 
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	public function load_scripts_styles_edit_attendee() {
612 612
 		//stuff to only show up on our attendee edit details page.
613 613
 		$attendee_details_translations = array(
614
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
614
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
615 615
 			);
616
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
616
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
617 617
 		wp_enqueue_script('jquery-validate');
618 618
 	}
619 619
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 		//styles
623 623
 		wp_enqueue_style('espresso-ui-theme');
624 624
 		//scripts
625
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
626
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
625
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
626
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 	public function load_scripts_styles_contact_list() {
635 635
 		wp_deregister_style('espresso_reg');
636
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
636
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
637 637
 		wp_enqueue_style('espresso_att');
638 638
 	}
639 639
 
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 
643 643
 
644 644
 	public function load_scripts_styles_new_registration() {
645
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
645
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
646 646
 		wp_enqueue_script('ee-spco-for-admin');
647
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
647
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
648 648
 		EE_Form_Section_Proper::wp_enqueue_scripts();
649 649
 		EED_Ticket_Selector::load_tckt_slctr_assets();
650 650
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		//for notification related bulk actions we need to make sure only active messengers have an option.
672 672
 		EED_Messages::set_autoloaders();
673 673
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
674
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
674
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
675 675
 		$active_mts = $message_resource_manager->list_of_active_message_types();
676 676
 		//key= bulk_action_slug, value= message type.
677 677
 		$match_array = array(
@@ -684,23 +684,23 @@  discard block
 block discarded – undo
684 684
 
685 685
 		/** setup reg status bulk actions **/
686 686
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
687
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
687
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
688 688
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
689 689
 		}
690 690
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
691
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
691
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
692 692
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
693 693
 		}
694 694
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
695
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
695
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
696 696
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
697 697
 		}
698 698
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
699
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
699
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
700 700
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
701 701
 		}
702 702
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
703
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
703
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
704 704
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
705 705
 		}
706 706
 
@@ -709,29 +709,29 @@  discard block
 block discarded – undo
709 709
 				'slug' => 'all',
710 710
 				'label' => __('View All Registrations', 'event_espresso'),
711 711
 				'count' => 0,
712
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
712
+				'bulk_action' => array_merge($def_reg_status_actions, array(
713 713
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
714
-					) )
714
+					))
715 715
 				),
716 716
 			'month' => array(
717 717
 				'slug' => 'month',
718 718
 				'label' => __('This Month', 'event_espresso'),
719 719
 				'count' => 0,
720
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
720
+				'bulk_action' => array_merge($def_reg_status_actions, array(
721 721
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
722 722
 					))
723 723
 				),
724 724
 			'today' => array(
725 725
 				'slug' => 'today',
726
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
726
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
727 727
 				'count' => 0,
728
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
728
+				'bulk_action' => array_merge($def_reg_status_actions, array(
729 729
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
730 730
 					))
731 731
 				)
732 732
 			);
733 733
 
734
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
734
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
735 735
 			$this->_views['incomplete'] = array(
736 736
 				'slug' => 'incomplete',
737 737
 				'label' => __('Incomplete', 'event_espresso'),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				)
768 768
 			);
769 769
 
770
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
770
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
771 771
 			$this->_views['trash'] = array(
772 772
 				'slug' => 'trash',
773 773
 				'label' => __('Trash', 'event_espresso'),
@@ -806,18 +806,18 @@  discard block
 block discarded – undo
806 806
 				'desc' => __('View Transaction Invoice', 'event_espresso')
807 807
 				),
808 808
  			);
809
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
809
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
810 810
 			$fc_items['resend_registration'] = array(
811 811
 				'class' => 'dashicons dashicons-email-alt',
812 812
 				'desc' => __('Resend Registration Details', 'event_espresso')
813 813
 				);
814 814
 		} else {
815
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
815
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
816 816
 		}
817 817
 
818
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
819
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
820
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
818
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
819
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
820
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
821 821
 				$fc_items['view_related_messages'] = array(
822 822
 					'class' => $related_for_icon['css_class'],
823 823
 					'desc' => $related_for_icon['label'],
@@ -827,35 +827,35 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$sc_items = array(
829 829
 			'approved_status' => array(
830
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
831
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
830
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
831
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
832 832
 				),
833 833
 			'pending_status' => array(
834
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
835
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
834
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
835
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
836 836
 				),
837 837
 			'wait_list' => array(
838
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
839
-				'desc'  => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' )
838
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
839
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence')
840 840
 			),
841 841
 			'incomplete_status' => array(
842
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
843
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
842
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
843
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
844 844
 			),
845 845
 			'not_approved' => array(
846
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
847
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
846
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
847
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
848 848
 				),
849 849
 			'declined_status' => array(
850
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
851
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
850
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
851
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
852 852
 				),
853 853
 			'cancelled_status' => array(
854
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
855
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
854
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
855
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
856 856
 				)
857 857
 			);
858
-		return array_merge( $fc_items, $sc_items );
858
+		return array_merge($fc_items, $sc_items);
859 859
 	}
860 860
 
861 861
 
@@ -869,45 +869,45 @@  discard block
 block discarded – undo
869 869
 	 */
870 870
 	protected function _registrations_overview_list_table() {
871 871
 		$this->_template_args['admin_page_header'] = '';
872
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
873
-		if ( $EVT_ID ) {
874
-			if ( EE_Registry::instance()->CAP->current_user_can(
872
+		$EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0;
873
+		if ($EVT_ID) {
874
+			if (EE_Registry::instance()->CAP->current_user_can(
875 875
 				'ee_edit_registrations',
876 876
 				'espresso_registrations_new_registration',
877 877
 				$EVT_ID
878 878
 				)
879 879
 			) {
880
-				$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
880
+				$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
881 881
 					'new_registration',
882 882
 					'add-registrant',
883
-					array( 'event_id' => $EVT_ID ),
883
+					array('event_id' => $EVT_ID),
884 884
 					'add-new-h2'
885 885
 				);
886 886
 			}
887
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
888
-			if ( $event instanceof EE_Event ) {
887
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
888
+			if ($event instanceof EE_Event) {
889 889
 				$this->_template_args['admin_page_header'] = sprintf(
890
-					__( '%s Viewing registrations for the event: %s%s', 'event_espresso' ),
890
+					__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
891 891
 					'<h3 style="line-height:1.5em;">',
892
-					'<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce(
893
-						array( 'action' => 'edit', 'post' => $event->ID() ),
892
+					'<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce(
893
+						array('action' => 'edit', 'post' => $event->ID()),
894 894
 						EVENTS_ADMIN_URL
895
-					) . '">&nbsp;' . $event->get( 'EVT_name' ) . '&nbsp;</a>&nbsp;',
895
+					).'">&nbsp;'.$event->get('EVT_name').'&nbsp;</a>&nbsp;',
896 896
 					'</h3>'
897 897
 				);
898 898
 			}
899
-			$DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0;
900
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID );
901
-			if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) {
902
-				$this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 );
899
+			$DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0;
900
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
901
+			if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') {
902
+				$this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5);
903 903
 				$this->_template_args['admin_page_header'] .= ' &nbsp;<span class="drk-grey-text">';
904 904
 				$this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>';
905 905
 				$this->_template_args['admin_page_header'] .= $datetime->name();
906
-				$this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )';
906
+				$this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )';
907 907
 				$this->_template_args['admin_page_header'] .= '</span></h3>';
908 908
 			}
909 909
 		}
910
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
910
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
911 911
 		$this->display_admin_list_table_page_with_no_sidebar();
912 912
 	}
913 913
 
@@ -922,19 +922,19 @@  discard block
 block discarded – undo
922 922
 	 */
923 923
 	private function _set_registration_object() {
924 924
 		//get out if we've already set the object
925
-		if ( is_object( $this->_registration )) {
925
+		if (is_object($this->_registration)) {
926 926
 			return TRUE;
927 927
 		}
928 928
 
929 929
 	    $REG = EEM_Registration::instance();
930 930
 
931
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
931
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
932 932
 
933
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
933
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
934 934
 			return TRUE;
935 935
 		else {
936
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
937
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
936
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
937
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
938 938
 			$this->_registration = NULL;
939 939
 			return FALSE;
940 940
 		}
@@ -952,25 +952,25 @@  discard block
 block discarded – undo
952 952
 	 * @throws \EE_Error
953 953
 	 * @return mixed (int|array)  int = count || array of registration objects
954 954
 	 */
955
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
956
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
957
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
958
-		$DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null;
959
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
960
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
961
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
955
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
956
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
957
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
958
+		$DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null;
959
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
960
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
961
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
962
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
963 963
 		$start_date = FALSE;
964 964
 		$end_date = FALSE;
965 965
 		$_where = array();
966
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
966
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
967
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
968 968
 
969 969
 		//set orderby
970 970
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
971 971
 
972 972
 
973
-		switch ( $this->_req_data['orderby'] ) {
973
+		switch ($this->_req_data['orderby']) {
974 974
 			case '_REG_ID':
975 975
 				$orderby = 'REG_ID';
976 976
 				break;
@@ -990,30 +990,30 @@  discard block
 block discarded – undo
990 990
 				$orderby = 'REG_date';
991 991
 		}
992 992
 
993
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
994
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
995
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
993
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
994
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
995
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
996 996
 
997 997
 
998
-		$offset = ($current_page-1)*$per_page;
999
-		$limit = $count  ? NULL : array( $offset, $per_page );
998
+		$offset = ($current_page - 1) * $per_page;
999
+		$limit = $count ? NULL : array($offset, $per_page);
1000 1000
 
1001
-		if($EVT_ID){
1002
-			$_where['EVT_ID']=$EVT_ID;
1001
+		if ($EVT_ID) {
1002
+			$_where['EVT_ID'] = $EVT_ID;
1003 1003
 		}
1004
-		if($CAT_ID){
1004
+		if ($CAT_ID) {
1005 1005
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
1006 1006
 		}
1007 1007
 		//if DTT is included we filter by that datetime.
1008
-		if ( $DTT_ID ) {
1008
+		if ($DTT_ID) {
1009 1009
 			$_where['Ticket.Datetime.DTT_ID'] = $DTT_ID;
1010 1010
 		}
1011
-		if ( $incomplete ) {
1011
+		if ($incomplete) {
1012 1012
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
1013 1013
 		} else if ( ! $trash) {
1014
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
1014
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
1015 1015
 		}
1016
-		if($reg_status){
1016
+		if ($reg_status) {
1017 1017
 			$_where['STS_ID'] = $reg_status;
1018 1018
 		}
1019 1019
 
@@ -1025,103 +1025,103 @@  discard block
 block discarded – undo
1025 1025
 		$time_start = ' 00:00:00';
1026 1026
 		$time_end = ' 23:59:59';
1027 1027
 
1028
-		if($today_a || $today ){
1028
+		if ($today_a || $today) {
1029 1029
 			$curdate = date('Y-m-d', current_time('timestamp'));
1030
-			$_where['REG_date']= array('BETWEEN',
1030
+			$_where['REG_date'] = array('BETWEEN',
1031 1031
 				array(
1032
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
1033
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
1032
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
1033
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
1034 1034
 			));
1035
-		}elseif($this_month_a || $this_month){
1035
+		}elseif ($this_month_a || $this_month) {
1036 1036
 			$this_month_r = date('m', current_time('timestamp'));
1037
-			$days_this_month = date( 't', current_time('timestamp') );
1038
-			$_where['REG_date']= array('BETWEEN',
1037
+			$days_this_month = date('t', current_time('timestamp'));
1038
+			$_where['REG_date'] = array('BETWEEN',
1039 1039
 				array(
1040
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1041
-					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' )
1040
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1041
+					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')
1042 1042
 			));
1043
-		}elseif($month_range){
1043
+		}elseif ($month_range) {
1044 1044
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1045
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1046
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1047
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1048
-			$_where['REG_date']= array('BETWEEN',
1049
-				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' ) ) );
1050
-		}elseif($start_date && $end_date){
1045
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1046
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1047
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1048
+			$_where['REG_date'] = array('BETWEEN',
1049
+				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')));
1050
+		}elseif ($start_date && $end_date) {
1051 1051
 			throw new EE_Error("not yet supported");
1052
-		}elseif($start_date){
1052
+		}elseif ($start_date) {
1053 1053
 			throw new EE_Error("not yet supported");
1054
-		}elseif($end_date){
1054
+		}elseif ($end_date) {
1055 1055
 			throw new EE_Error("not yet supported");
1056 1056
 		}
1057 1057
 
1058
-		if ( ! empty( $this->_req_data['s'] ) ) {
1059
-			$sstr = '%' . $this->_req_data['s'] . '%';
1058
+		if ( ! empty($this->_req_data['s'])) {
1059
+			$sstr = '%'.$this->_req_data['s'].'%';
1060 1060
 			$_where['OR'] = array(
1061
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1062
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1063
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1064
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1065
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1066
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1067
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1068
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1069
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1070
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1071
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1072
-				'REG_final_price' => array( 'LIKE', $sstr ),
1073
-				'REG_code' => array( 'LIKE', $sstr ),
1074
-				'REG_count' => array( 'LIKE' , $sstr ),
1075
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1076
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1077
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1078
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1061
+				'Event.EVT_name' => array('LIKE', $sstr),
1062
+				'Event.EVT_desc' => array('LIKE', $sstr),
1063
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1064
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1065
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1066
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1067
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1068
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1069
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1070
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1071
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1072
+				'REG_final_price' => array('LIKE', $sstr),
1073
+				'REG_code' => array('LIKE', $sstr),
1074
+				'REG_count' => array('LIKE', $sstr),
1075
+				'REG_group_size' => array('LIKE', $sstr),
1076
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1077
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1078
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1079 1079
 			);
1080 1080
 		}
1081 1081
 
1082 1082
 		//capability checks
1083
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1083
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1084 1084
 			$_where['AND'] = array(
1085 1085
 				'Event.EVT_wp_user' => get_current_user_id()
1086 1086
 				);
1087 1087
 		}
1088 1088
 
1089
-		if( $count ){
1090
-			if ( $trash ) {
1091
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1092
-			} else if ( $incomplete ) {
1093
-				return EEM_Registration::instance()->count( array( $_where ));
1089
+		if ($count) {
1090
+			if ($trash) {
1091
+				return EEM_Registration::instance()->count_deleted(array($_where));
1092
+			} else if ($incomplete) {
1093
+				return EEM_Registration::instance()->count(array($_where));
1094 1094
 			} else {
1095
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1095
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1096 1096
 			}
1097 1097
 		} else {
1098 1098
 			//make sure we remove default where conditions cause all registrations matching query are returned
1099
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1100
-			if ( $per_page !== -1 ) {
1099
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1100
+			if ($per_page !== -1) {
1101 1101
 				$query_params['limit'] = $limit;
1102 1102
 			}
1103
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1103
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1104 1104
 
1105
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1105
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1106 1106
 				$first_registration = $registrations[0];
1107 1107
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1108 1108
 				$event_name = $first_registration->event_obj()->name();
1109
-				$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 ) : '';
1109
+				$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 ) : '';
1110 1110
 				// edit event link
1111
-				if ( $event_name != '' ) {
1112
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1113
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1114
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1111
+				if ($event_name != '') {
1112
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1113
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1114
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1115 1115
 				}
1116 1116
 
1117
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1118
-				$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>';
1117
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1118
+				$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>';
1119 1119
 
1120 1120
 				$this->_template_args['before_admin_page_content'] = '
1121 1121
 			<div id="admin-page-header">
1122
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1123
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1124
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1122
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1123
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1124
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1125 1125
 			</div>
1126 1126
 			';
1127 1127
 
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		$this->_set_registration_object();
1161 1161
 
1162
-		if ( is_object( $this->_registration )) {
1162
+		if (is_object($this->_registration)) {
1163 1163
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1164 1164
 			$this->_session = $transaction->session_data();
1165 1165
 
@@ -1167,10 +1167,10 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 
1169 1169
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1170
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1170
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1171 1171
 
1172
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1173
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1172
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1173
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1174 1174
 
1175 1175
 			$this->_template_args['grand_total'] = $transaction->total();
1176 1176
 
@@ -1178,19 +1178,19 @@  discard block
 block discarded – undo
1178 1178
 			// link back to overview
1179 1179
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1180 1180
 			$this->_template_args['registration'] = $this->_registration;
1181
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1182
-			$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' ) );
1183
-			$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' ) );
1181
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1182
+			$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'));
1183
+			$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'));
1184 1184
 
1185 1185
 			//next and previous links
1186
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1187
-			$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' ) : '';
1188
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1189
-			$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' ) : '';
1186
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1187
+			$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') : '';
1188
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1189
+			$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') : '';
1190 1190
 
1191 1191
 			// grab header
1192
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1193
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1192
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1193
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1194 1194
 
1195 1195
 		} else {
1196 1196
 
@@ -1209,17 +1209,17 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 
1211 1211
 	protected function _registration_details_metaboxes() {
1212
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1212
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1213 1213
 		$this->_set_registration_object();
1214 1214
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1215
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1216
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1217
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1218
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1215
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1216
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1217
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1218
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1219 1219
 		}
1220
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1221
-		if ( $this->_registration->group_size() > 1 ) {
1222
-			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' );
1220
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1221
+		if ($this->_registration->group_size() > 1) {
1222
+			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');
1223 1223
 		}
1224 1224
 	}
1225 1225
 
@@ -1261,25 +1261,25 @@  discard block
 block discarded – undo
1261 1261
 				'html_id'         => 'reg-status-change-form',
1262 1262
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1263 1263
 				'subsections'     => array(
1264
-					'return' => new EE_Hidden_Input( array(
1264
+					'return' => new EE_Hidden_Input(array(
1265 1265
 						'name'    => 'return',
1266 1266
 						'default' => 'view_registration'
1267
-					) ),
1268
-					'REG_ID' => new EE_Hidden_Input( array(
1267
+					)),
1268
+					'REG_ID' => new EE_Hidden_Input(array(
1269 1269
 						'name'    => 'REG_ID',
1270 1270
 						'default' => $this->_registration->ID()
1271
-					) ),
1271
+					)),
1272 1272
 					'current_status' => new EE_Form_Section_HTML(
1273 1273
 						EEH_HTML::tr(
1274 1274
 							EEH_HTML::th(
1275 1275
 								EEH_HTML::label(
1276
-									EEH_HTML::strong( __( 'Current Registration Status', 'event_espresso' ) )
1276
+									EEH_HTML::strong(__('Current Registration Status', 'event_espresso'))
1277 1277
 								)
1278
-							) .
1278
+							).
1279 1279
 							EEH_HTML::td(
1280 1280
 								EEH_HTML::strong(
1281 1281
 									$this->_registration->pretty_status(),
1282
-									'', 'status-' . $this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1282
+									'', 'status-'.$this->_registration->status_ID(), 'line-height: 1em; font-size: 1.5em; font-weight: bold;'
1283 1283
 								)
1284 1284
 							)
1285 1285
 						)
@@ -1287,22 +1287,22 @@  discard block
 block discarded – undo
1287 1287
 					'reg_status' => new EE_Select_Input(
1288 1288
 						$this->_get_reg_statuses(),
1289 1289
 						array(
1290
-							'html_label_text' => __( 'Change Registration Status to', 'event_espresso' ),
1290
+							'html_label_text' => __('Change Registration Status to', 'event_espresso'),
1291 1291
 							'default'         => $this->_registration->status_ID(),
1292 1292
 						)
1293 1293
 					),
1294 1294
 					'send_notifications' => new EE_Yes_No_Input(
1295 1295
 						array(
1296
-							'html_label_text' => __( 'Send Related Messages', 'event_espresso' ),
1296
+							'html_label_text' => __('Send Related Messages', 'event_espresso'),
1297 1297
 							'default'         => false,
1298
-							'html_help_text'  => __( 'If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso' ),
1298
+							'html_help_text'  => __('If set to "Yes", then the related messages will be sent to the registrant.', 'event_espresso'),
1299 1299
 						)
1300 1300
 					),
1301
-					'submit' => new EE_Submit_Input( array(
1301
+					'submit' => new EE_Submit_Input(array(
1302 1302
 						'html_class'      => 'button-primary',
1303 1303
 						'html_label_text' => '&nbsp;',
1304
-						'default'         => __( 'Update Registration Status', 'event_espresso' )
1305
-					) ),
1304
+						'default'         => __('Update Registration Status', 'event_espresso')
1305
+					)),
1306 1306
 				),
1307 1307
 			)
1308 1308
 		);
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
 	 * Returns an array of all the buttons for the various statuses and switch status actions
1316 1316
 	 * @return string
1317 1317
 	 */
1318
-	protected function _get_current_reg_status_help_text( $STS_ID = '' ) {
1318
+	protected function _get_current_reg_status_help_text($STS_ID = '') {
1319 1319
 		//$reg_status_help_text = array(
1320 1320
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
1321 1321
 		//	'RAP' => __( 'XXXXXXXXXXX', 'event_espresso' ),
@@ -1348,14 +1348,14 @@  discard block
 block discarded – undo
1348 1348
 	 */
1349 1349
 	protected function _get_reg_statuses() {
1350 1350
 		$reg_status_array = EEM_Registration::instance()->reg_status_array();
1351
-		unset ( $reg_status_array[ EEM_Registration::status_id_incomplete ] );
1351
+		unset ($reg_status_array[EEM_Registration::status_id_incomplete]);
1352 1352
 		// get current reg status
1353 1353
 		$current_status = $this->_registration->status_ID();
1354 1354
 		// is registration for free event? This will determine whether to display the pending payment option
1355
-		if ( $current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free() ) {
1356
-			unset( $reg_status_array[ EEM_Registration::status_id_pending_payment ] );
1355
+		if ($current_status != EEM_Registration::status_id_pending_payment && $this->_registration->transaction()->is_free()) {
1356
+			unset($reg_status_array[EEM_Registration::status_id_pending_payment]);
1357 1357
 		}
1358
-		return EEM_Status::instance()->localized_status( $reg_status_array, false, 'sentence' );
1358
+		return EEM_Status::instance()->localized_status($reg_status_array, false, 'sentence');
1359 1359
 	}
1360 1360
 
1361 1361
 
@@ -1368,15 +1368,15 @@  discard block
 block discarded – undo
1368 1368
 	 *
1369 1369
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1370 1370
 	 */
1371
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1372
-		if ( isset( $this->_req_data[ 'reg_status_change_form' ] ) ) {
1373
-			$REG_IDs = isset( $this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ] )
1374
-				? (array)$this->_req_data[ 'reg_status_change_form' ][ 'REG_ID' ]
1371
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1372
+		if (isset($this->_req_data['reg_status_change_form'])) {
1373
+			$REG_IDs = isset($this->_req_data['reg_status_change_form']['REG_ID'])
1374
+				? (array) $this->_req_data['reg_status_change_form']['REG_ID']
1375 1375
 				: array();
1376 1376
 		} else {
1377
-			$REG_IDs = isset( $this->_req_data[ '_REG_ID' ] ) ? (array)$this->_req_data[ '_REG_ID' ] : array();
1377
+			$REG_IDs = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1378 1378
 		}
1379
-		$success = $this->_set_registration_status( $REG_IDs, $status );
1379
+		$success = $this->_set_registration_status($REG_IDs, $status);
1380 1380
 		//notify?
1381 1381
 		if (
1382 1382
 			$success
@@ -1403,21 +1403,21 @@  discard block
 block discarded – undo
1403 1403
 	 * @param bool $status
1404 1404
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1405 1405
 	 */
1406
-	protected function _set_registration_status( $REG_IDs = array(), $status = false ) {
1406
+	protected function _set_registration_status($REG_IDs = array(), $status = false) {
1407 1407
 		$success = false;
1408 1408
 		// typecast $REG_IDs
1409
-		$REG_IDs = (array)$REG_IDs;
1410
-		if ( ! empty( $REG_IDs ) ) {
1409
+		$REG_IDs = (array) $REG_IDs;
1410
+		if ( ! empty($REG_IDs)) {
1411 1411
 			$success = true;
1412 1412
 			// set default status if none is passed
1413 1413
 			$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1414 1414
 			// sanitize $REG_IDs
1415
-			$REG_IDs = array_filter( $REG_IDs, 'absint' );
1415
+			$REG_IDs = array_filter($REG_IDs, 'absint');
1416 1416
 			//loop through REG_ID's and change status
1417
-			foreach ( $REG_IDs as $REG_ID ) {
1418
-				$registration = EEM_Registration::instance()->get_one_by_ID( $REG_ID );
1419
-				if ( $registration instanceof EE_Registration ) {
1420
-					$registration->set_status( $status );
1417
+			foreach ($REG_IDs as $REG_ID) {
1418
+				$registration = EEM_Registration::instance()->get_one_by_ID($REG_ID);
1419
+				if ($registration instanceof EE_Registration) {
1420
+					$registration->set_status($status);
1421 1421
 					$result = $registration->save();
1422 1422
 					// verifying explicit fails because update *may* just return 0 for 0 rows affected
1423 1423
 					$success = $result !== false ? $success : false;
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
 		//reset _req_data['_REG_ID'] for any potential future messages notifications
1428 1428
 		$this->_req_data['_REG_ID'] = $REG_IDs;
1429 1429
 		//return $success and processed registrations
1430
-		return array( 'REG_ID' => $REG_IDs, 'success' => $success );
1430
+		return array('REG_ID' => $REG_IDs, 'success' => $success);
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1439,49 +1439,49 @@  discard block
 block discarded – undo
1439 1439
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1440 1440
 	 * @return void
1441 1441
 	 */
1442
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1443
-		$result = ! empty( $STS_ID )
1444
-            ? $this->_set_registration_status_from_request( $STS_ID, $notify )
1445
-            : array( 'success' => false );
1446
-		$success = isset( $result['success'] ) && $result['success'];
1442
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1443
+		$result = ! empty($STS_ID)
1444
+            ? $this->_set_registration_status_from_request($STS_ID, $notify)
1445
+            : array('success' => false);
1446
+		$success = isset($result['success']) && $result['success'];
1447 1447
 		//setup success message
1448
-		if ( $success ) {
1449
-			if ( is_array( $result[ 'REG_ID' ] ) && count( $result[ 'REG_ID' ] ) === 1 ) {
1448
+		if ($success) {
1449
+			if (is_array($result['REG_ID']) && count($result['REG_ID']) === 1) {
1450 1450
 				$msg = sprintf(
1451
-					__( 'Registration status has been set to %s', 'event_espresso' ),
1452
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1451
+					__('Registration status has been set to %s', 'event_espresso'),
1452
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1453 1453
 				);
1454 1454
 			} else {
1455 1455
 				$msg = sprintf(
1456
-					__( 'Registrations have been set to %s.', 'event_espresso' ),
1457
-					EEH_Template::pretty_status( $STS_ID, false, 'lower' )
1456
+					__('Registrations have been set to %s.', 'event_espresso'),
1457
+					EEH_Template::pretty_status($STS_ID, false, 'lower')
1458 1458
 				);
1459 1459
 			}
1460
-			EE_Error::add_success( $msg );
1460
+			EE_Error::add_success($msg);
1461 1461
 		} else {
1462 1462
 			EE_Error::add_error(
1463
-				__( 'Something went wrong, and the status was not changed', 'event_espresso' ),
1463
+				__('Something went wrong, and the status was not changed', 'event_espresso'),
1464 1464
 				__FILE__, __LINE__, __FUNCTION__
1465 1465
 			);
1466 1466
 		}
1467
-		if ( isset( $this->_req_data[ 'return' ] ) && $this->_req_data[ 'return' ] == 'view_registration' ) {
1468
-			$route = array( 'action' => 'view_registration', '_REG_ID' => reset( $result[ 'REG_ID' ] ) );
1467
+		if (isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration') {
1468
+			$route = array('action' => 'view_registration', '_REG_ID' => reset($result['REG_ID']));
1469 1469
 		} else {
1470
-			$route = array( 'action' => 'default' );
1470
+			$route = array('action' => 'default');
1471 1471
 		}
1472 1472
 		//unset nonces
1473
-		foreach ( $this->_req_data as $ref => $value ) {
1474
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1475
-				unset( $this->_req_data[$ref] );
1473
+		foreach ($this->_req_data as $ref => $value) {
1474
+			if (strpos($ref, 'nonce') !== false) {
1475
+				unset($this->_req_data[$ref]);
1476 1476
 				continue;
1477 1477
 			}
1478 1478
 
1479
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1479
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1480 1480
 			$this->_req_data[$ref] = $value;
1481 1481
 		}
1482 1482
 		//merge request vars so that the reloaded list table contains any existing filter query params
1483
-		$route = array_merge( $this->_req_data, $route );
1484
-		$this->_redirect_after_action( $success, '', '', $route, true );
1483
+		$route = array_merge($this->_req_data, $route);
1484
+		$this->_redirect_after_action($success, '', '', $route, true);
1485 1485
 	}
1486 1486
 
1487 1487
 
@@ -1492,51 +1492,51 @@  discard block
 block discarded – undo
1492 1492
 	protected function _change_reg_status() {
1493 1493
 		$this->_req_data['return'] = 'view_registration';
1494 1494
 		//set notify based on whether the send notifications toggle is set or not
1495
-		$notify = ! empty( $this->_req_data['reg_status_change_form']['send_notifications'] );
1495
+		$notify = ! empty($this->_req_data['reg_status_change_form']['send_notifications']);
1496 1496
 		//$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1497
-		$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ] = isset(
1498
-			$this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1497
+		$this->_req_data['reg_status_change_form']['reg_status'] = isset(
1498
+			$this->_req_data['reg_status_change_form']['reg_status']
1499 1499
 		)
1500
-			? $this->_req_data[ 'reg_status_change_form' ][ 'reg_status' ]
1500
+			? $this->_req_data['reg_status_change_form']['reg_status']
1501 1501
 			: '';
1502 1502
 
1503
-		switch ( $this->_req_data[ 'reg_status_change_form' ]['reg_status'] ) {
1503
+		switch ($this->_req_data['reg_status_change_form']['reg_status']) {
1504 1504
 
1505 1505
 			case EEM_Registration::status_id_approved :
1506
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1507
-				$this->approve_registration( $notify );
1506
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1507
+				$this->approve_registration($notify);
1508 1508
 				break;
1509 1509
 
1510 1510
 			case EEM_Registration::status_id_pending_payment :
1511
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1512
-				$this->pending_registration( $notify );
1511
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1512
+				$this->pending_registration($notify);
1513 1513
 				break;
1514 1514
 
1515 1515
 			case EEM_Registration::status_id_not_approved :
1516
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1517
-				$this->not_approve_registration( $notify );
1516
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1517
+				$this->not_approve_registration($notify);
1518 1518
 				break;
1519 1519
 
1520 1520
 			case EEM_Registration::status_id_declined :
1521
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1522
-				$this->decline_registration( $notify );
1521
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1522
+				$this->decline_registration($notify);
1523 1523
 				break;
1524 1524
 
1525 1525
 			case EEM_Registration::status_id_cancelled :
1526
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1527
-				$this->cancel_registration( $notify );
1526
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1527
+				$this->cancel_registration($notify);
1528 1528
 				break;
1529 1529
 
1530 1530
 			case EEM_Registration::status_id_wait_list :
1531
-			case EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) :
1532
-				$this->waitlist_registration( $notify );
1531
+			case EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') :
1532
+				$this->waitlist_registration($notify);
1533 1533
 				break;
1534 1534
 
1535 1535
 			case EEM_Registration::status_id_incomplete :
1536 1536
 			default :
1537 1537
 				$result['success'] = false;
1538
-				unset( $this->_req_data['return'] );
1539
-				$this->_reg_status_change_return( '', false );
1538
+				unset($this->_req_data['return']);
1539
+				$this->_reg_status_change_return('', false);
1540 1540
 				break;
1541 1541
 		}
1542 1542
 	}
@@ -1550,8 +1550,8 @@  discard block
 block discarded – undo
1550 1550
 	 * @param bool $notify whether or not to notify the registrant about their approval.
1551 1551
 	 * @return void
1552 1552
 	 */
1553
-	protected function approve_registration( $notify = false ) {
1554
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1553
+	protected function approve_registration($notify = false) {
1554
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1555 1555
 	}
1556 1556
 
1557 1557
 
@@ -1563,8 +1563,8 @@  discard block
 block discarded – undo
1563 1563
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1564 1564
 	 * @return void
1565 1565
 	 */
1566
-	protected function decline_registration( $notify = false ) {
1567
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1566
+	protected function decline_registration($notify = false) {
1567
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1568 1568
 	}
1569 1569
 
1570 1570
 
@@ -1576,8 +1576,8 @@  discard block
 block discarded – undo
1576 1576
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1577 1577
 	 * @return void
1578 1578
 	 */
1579
-	protected function cancel_registration( $notify = false ) {
1580
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1579
+	protected function cancel_registration($notify = false) {
1580
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1581 1581
 	}
1582 1582
 
1583 1583
 
@@ -1589,8 +1589,8 @@  discard block
 block discarded – undo
1589 1589
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1590 1590
 	 * @return void
1591 1591
 	 */
1592
-	protected function not_approve_registration( $notify = false ) {
1593
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1592
+	protected function not_approve_registration($notify = false) {
1593
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1594 1594
 	}
1595 1595
 
1596 1596
 
@@ -1602,8 +1602,8 @@  discard block
 block discarded – undo
1602 1602
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1603 1603
 	 * @return void
1604 1604
 	 */
1605
-	protected function pending_registration( $notify = false ) {
1606
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1605
+	protected function pending_registration($notify = false) {
1606
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1607 1607
 	}
1608 1608
 
1609 1609
 
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
 	 * @param bool $notify whether or not to notify the registrant about their status change.
1616 1616
 	 * @return void
1617 1617
 	 */
1618
-	protected function waitlist_registration( $notify = false ) {
1619
-		$this->_reg_status_change_return( EEM_Registration::status_id_wait_list, $notify );
1618
+	protected function waitlist_registration($notify = false) {
1619
+		$this->_reg_status_change_return(EEM_Registration::status_id_wait_list, $notify);
1620 1620
 	}
1621 1621
 
1622 1622
 
@@ -1630,14 +1630,14 @@  discard block
 block discarded – undo
1630 1630
 	public function _reg_details_meta_box() {
1631 1631
 		EEH_Autoloader::register_line_item_display_autoloaders();
1632 1632
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1633
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1633
+		EE_Registry::instance()->load_helper('Line_Item');
1634 1634
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1635 1635
 		$this->_session = $transaction->session_data();
1636 1636
 
1637 1637
 		$filters = new EE_Line_Item_Filter_Collection();
1638 1638
 		//$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1639
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1640
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1639
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1640
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1641 1641
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1642 1642
 		$line_item_display = new EE_Line_Item_Display(
1643 1643
 			'reg_admin_table',
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
 		);
1646 1646
 		$this->_template_args['line_item_table'] = $line_item_display->display_line_item(
1647 1647
 			$filtered_line_item_tree,
1648
-			array( 'EE_Registration' => $this->_registration )
1648
+			array('EE_Registration' => $this->_registration)
1649 1649
 		);
1650 1650
 		$attendee = $this->_registration->attendee();
1651 1651
 
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 				'espresso_transactions_view_transaction'
1656 1656
 			)
1657 1657
 		) {
1658
-			$this->_template_args[ 'view_transaction_button' ] =  EEH_Template::get_button_or_link(
1658
+			$this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(
1659 1659
 				EE_Admin_Page::add_query_args_and_nonce(
1660 1660
 					array(
1661 1661
 						'action' => 'view_transaction',
@@ -1663,12 +1663,12 @@  discard block
 block discarded – undo
1663 1663
 					),
1664 1664
 					TXN_ADMIN_URL
1665 1665
 				),
1666
-				esc_html__( ' View Transaction' ),
1666
+				esc_html__(' View Transaction'),
1667 1667
 				'button secondary-button right',
1668 1668
 				'dashicons dashicons-cart'
1669 1669
 			);
1670 1670
 		} else {
1671
-			$this->_template_args[ 'view_transaction_button' ] = '';
1671
+			$this->_template_args['view_transaction_button'] = '';
1672 1672
 		}
1673 1673
 
1674 1674
 		if (
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 				'espresso_registrations_resend_registration'
1679 1679
 			)
1680 1680
 		) {
1681
-			$this->_template_args[ 'resend_registration_button' ] = EEH_Template::get_button_or_link(
1681
+			$this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(
1682 1682
 				EE_Admin_Page::add_query_args_and_nonce(
1683 1683
 					array(
1684 1684
 						'action' 		=> 'resend_registration',
@@ -1687,55 +1687,55 @@  discard block
 block discarded – undo
1687 1687
 					),
1688 1688
 					REG_ADMIN_URL
1689 1689
 				),
1690
-				esc_html__( ' Resend Registration' ),
1690
+				esc_html__(' Resend Registration'),
1691 1691
 				'button secondary-button right',
1692 1692
 				'dashicons dashicons-email-alt'
1693 1693
 			);
1694 1694
 		} else {
1695
-			$this->_template_args[ 'resend_registration_button' ] = '';
1695
+			$this->_template_args['resend_registration_button'] = '';
1696 1696
 		}
1697 1697
 
1698 1698
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1699
-		$payment = $transaction->get_first_related( 'Payment' );
1699
+		$payment = $transaction->get_first_related('Payment');
1700 1700
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1701
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1701
+		$payment_method = $payment->get_first_related('Payment_Method');
1702 1702
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1703 1703
 
1704 1704
 		$reg_details = array(
1705 1705
 			'payment_method' => $payment_method->name(),
1706 1706
 			'response_msg' => $payment->gateway_response(),
1707
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1707
+			'registration_id' => $this->_registration->get('REG_code'),
1708 1708
 			'registration_session' => $this->_registration->session_ID(),
1709
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1710
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1709
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1710
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1711 1711
 		);
1712 1712
 
1713 1713
 
1714
-		if ( isset( $reg_details['registration_id'] )) {
1714
+		if (isset($reg_details['registration_id'])) {
1715 1715
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1716
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1716
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1717 1717
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1718 1718
 		}
1719 1719
 
1720
-		if ( isset( $reg_details['payment_method'] ) ) {
1720
+		if (isset($reg_details['payment_method'])) {
1721 1721
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1722
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1722
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1723 1723
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1724 1724
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1725
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1725
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1726 1726
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1727 1727
 		}
1728 1728
 
1729 1729
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1730
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1730
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1731 1731
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1732 1732
 
1733 1733
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1734
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1734
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1735 1735
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1736 1736
 
1737 1737
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1738
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1738
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1739 1739
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1740 1740
 
1741 1741
 		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(
@@ -1748,8 +1748,8 @@  discard block
 block discarded – undo
1748 1748
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1749 1749
 		$this->_template_args['event_id'] = $this->_registration->event_ID();
1750 1750
 
1751
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1752
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1751
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1752
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1753 1753
 
1754 1754
 	}
1755 1755
 
@@ -1763,14 +1763,14 @@  discard block
 block discarded – undo
1763 1763
 	*/
1764 1764
 	public function _reg_questions_meta_box() {
1765 1765
 		//allow someone to override this method entirely
1766
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1767
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1768
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1766
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1767
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1768
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1769 1769
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1770 1770
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1771 1771
 
1772
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1773
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1772
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1773
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1774 1774
 		}
1775 1775
 	}
1776 1776
 
@@ -1784,12 +1784,12 @@  discard block
 block discarded – undo
1784 1784
 	 * @param        string $output
1785 1785
 	 * @return        string
1786 1786
 	 */
1787
-	public function form_before_question_group( $output ) {
1787
+	public function form_before_question_group($output) {
1788 1788
 		EE_Error::doing_it_wrong(
1789
-			__CLASS__ . '::' . __FUNCTION__,
1790
-			__( 'This method would have been protected but was used on a filter callback'
1789
+			__CLASS__.'::'.__FUNCTION__,
1790
+			__('This method would have been protected but was used on a filter callback'
1791 1791
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1792
-				'event_espresso' ),
1792
+				'event_espresso'),
1793 1793
 			'4.8.32.rc.000'
1794 1794
 		);
1795 1795
 		return '
@@ -1808,20 +1808,20 @@  discard block
 block discarded – undo
1808 1808
 	 * @param        string $output
1809 1809
 	 * @return        string
1810 1810
 	 */
1811
-	public function form_after_question_group( $output ) {
1811
+	public function form_after_question_group($output) {
1812 1812
 		EE_Error::doing_it_wrong(
1813
-			__CLASS__ . '::' . __FUNCTION__,
1814
-			__( 'This method would have been protected but was used on a filter callback'
1813
+			__CLASS__.'::'.__FUNCTION__,
1814
+			__('This method would have been protected but was used on a filter callback'
1815 1815
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1816
-				'event_espresso' ),
1816
+				'event_espresso'),
1817 1817
 			'4.8.32.rc.000'
1818 1818
 		);
1819 1819
 		return  '
1820 1820
 			<tr class="hide-if-no-js">
1821 1821
 				<th> </th>
1822 1822
 				<td class="reg-admin-edit-attendee-question-td">
1823
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1824
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1823
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1824
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1825 1825
 						<div class="dashicons dashicons-edit"></div>
1826 1826
 					</a>
1827 1827
 				</td>
@@ -1841,18 +1841,18 @@  discard block
 block discarded – undo
1841 1841
 	 * @param        string $label
1842 1842
 	 * @return        string
1843 1843
 	 */
1844
-	public function form_form_field_label_wrap( $label ) {
1844
+	public function form_form_field_label_wrap($label) {
1845 1845
 		EE_Error::doing_it_wrong(
1846
-			__CLASS__ . '::' . __FUNCTION__,
1847
-			__( 'This method would have been protected but was used on a filter callback'
1846
+			__CLASS__.'::'.__FUNCTION__,
1847
+			__('This method would have been protected but was used on a filter callback'
1848 1848
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1849
-				'event_espresso' ),
1849
+				'event_espresso'),
1850 1850
 			'4.8.32.rc.000'
1851 1851
 		);
1852 1852
 		return '
1853 1853
 			<tr>
1854 1854
 				<th>
1855
-					' . $label  . '
1855
+					' . $label.'
1856 1856
 				</th>';
1857 1857
 	}
1858 1858
 
@@ -1866,17 +1866,17 @@  discard block
 block discarded – undo
1866 1866
 	 * @param        string $input
1867 1867
 	 * @return        string
1868 1868
 	 */
1869
-	public function form_form_field_input__wrap( $input ) {
1869
+	public function form_form_field_input__wrap($input) {
1870 1870
 		EE_Error::doing_it_wrong(
1871
-			__CLASS__ . '::' . __FUNCTION__,
1872
-			__( 'This method would have been protected but was used on a filter callback'
1871
+			__CLASS__.'::'.__FUNCTION__,
1872
+			__('This method would have been protected but was used on a filter callback'
1873 1873
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1874
-				'event_espresso' ),
1874
+				'event_espresso'),
1875 1875
 			'4.8.32.rc.000'
1876 1876
 		);
1877 1877
 		return '
1878 1878
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1879
-					' . $input . '
1879
+					' . $input.'
1880 1880
 				</td>
1881 1881
 			</tr>';
1882 1882
 	}
@@ -1890,14 +1890,14 @@  discard block
 block discarded – undo
1890 1890
 	 * @return void
1891 1891
 	 */
1892 1892
 	protected function _update_attendee_registration_form() {
1893
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1894
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1895
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1896
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1897
-			if( $success ) {
1893
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1894
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1895
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1896
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1897
+			if ($success) {
1898 1898
 				$what = __('Registration Form', 'event_espresso');
1899
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1900
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1899
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1900
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1901 1901
 			}
1902 1902
 		}
1903 1903
 	}
@@ -1908,11 +1908,11 @@  discard block
 block discarded – undo
1908 1908
 	 * @param int $REG_ID
1909 1909
 	 * @return EE_Registration_Custom_Questions_Form
1910 1910
 	 */
1911
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1912
-		if( ! $this->_reg_custom_questions_form ) {
1913
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1914
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1915
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1911
+	protected function _get_reg_custom_questions_form($REG_ID) {
1912
+		if ( ! $this->_reg_custom_questions_form) {
1913
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1914
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1915
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1916 1916
 		}
1917 1917
 		return $this->_reg_custom_questions_form;
1918 1918
 	}
@@ -1925,17 +1925,17 @@  discard block
 block discarded – undo
1925 1925
 	 * @param bool $REG_ID
1926 1926
 	 * @return bool
1927 1927
 	 */
1928
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1928
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1929 1929
 
1930 1930
 		if ( ! $REG_ID) {
1931
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1931
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1932 1932
 		}
1933
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1934
-		$form->receive_form_submission( $this->_req_data );
1933
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1934
+		$form->receive_form_submission($this->_req_data);
1935 1935
 		$success = false;
1936
-		if( $form->is_valid() ) {
1937
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1938
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1936
+		if ($form->is_valid()) {
1937
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1938
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1939 1939
 					$where_conditions = array(
1940 1940
 							'QST_ID' => $question_id,
1941 1941
 							'REG_ID' => $REG_ID
@@ -1943,19 +1943,19 @@  discard block
 block discarded – undo
1943 1943
 					$possibly_new_values = array(
1944 1944
 							'ANS_value' => $input->normalized_value()
1945 1945
 						);
1946
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1947
-					if( $answer instanceof EE_Answer ) {
1948
-						$success = $answer->save( $possibly_new_values );
1946
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1947
+					if ($answer instanceof EE_Answer) {
1948
+						$success = $answer->save($possibly_new_values);
1949 1949
 					} else {
1950 1950
 						//insert it then
1951
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1952
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1951
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1952
+						$answer = EE_Answer::new_instance($cols_n_vals);
1953 1953
 						$success = $answer->save();
1954 1954
 					}
1955 1955
 				}
1956 1956
 			}
1957 1957
 		} else {
1958
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1958
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1959 1959
 		}
1960 1960
 		return $success;
1961 1961
 	}
@@ -1973,31 +1973,31 @@  discard block
 block discarded – undo
1973 1973
 		$registrations = $REG->get_all(array(
1974 1974
 			array(
1975 1975
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1976
-				'REG_ID'=>array('!=',$this->_registration->ID())
1976
+				'REG_ID'=>array('!=', $this->_registration->ID())
1977 1977
 			),
1978 1978
 			'force_join'=>array('Attendee')));
1979 1979
 
1980 1980
 		$this->_template_args['attendees'] = array();
1981 1981
 		$this->_template_args['attendee_notice'] = '';
1982
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1983
-			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__ );
1982
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1983
+			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__);
1984 1984
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1985 1985
 		} else {
1986 1986
 
1987 1987
 			$att_nmbr = 1;
1988
-			foreach ( $registrations as $registration ) {
1988
+			foreach ($registrations as $registration) {
1989 1989
 				/* @var $registration EE_Registration */
1990 1990
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1991
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1992
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1993
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1994
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1995
-				$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 : '';
1991
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1992
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1993
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1994
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1995
+				$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 : '';
1996 1996
 
1997
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1997
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1998 1998
 
1999
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2000
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
1999
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2000
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
2001 2001
 
2002 2002
 				$att_nmbr++;
2003 2003
 			}
@@ -2007,8 +2007,8 @@  discard block
 block discarded – undo
2007 2007
 
2008 2008
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
2009 2009
 		}
2010
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
2011
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2010
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
2011
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2012 2012
 
2013 2013
 	}
2014 2014
 
@@ -2029,14 +2029,14 @@  discard block
 block discarded – undo
2029 2029
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
2030 2030
 
2031 2031
 		//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 create button or not)
2032
-		if ( ! $this->_registration->is_primary_registrant() ) {
2032
+		if ( ! $this->_registration->is_primary_registrant()) {
2033 2033
 
2034 2034
 			$primary_registration = $this->_registration->get_primary_registration();
2035 2035
 			$primary_attendee = $primary_registration instanceof EE_Registration
2036 2036
 				? $primary_registration->attendee()
2037 2037
 				: null;
2038 2038
 
2039
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
2039
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
2040 2040
 				//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.
2041 2041
 				$primary_registration = NULL;
2042 2042
 			}
@@ -2045,27 +2045,27 @@  discard block
 block discarded – undo
2045 2045
 		}
2046 2046
 
2047 2047
 		$this->_template_args['ATT_ID'] = $attendee->ID();
2048
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
2049
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
2050
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
2048
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
2049
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
2050
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
2051 2051
 		$this->_template_args['phone'] = $attendee->phone();
2052 2052
 
2053
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
2053
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
2054 2054
 
2055 2055
 
2056 2056
 		//edit link
2057
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
2057
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
2058 2058
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
2059 2059
 
2060 2060
 		//create link
2061
-		$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 ): '';
2061
+		$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) : '';
2062 2062
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
2063 2063
 
2064 2064
 		$this->_template_args['att_check'] = $att_check;
2065 2065
 
2066 2066
 
2067
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
2068
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2067
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
2068
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2069 2069
 	}
2070 2070
 
2071 2071
 
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
 	 * @access protected
2079 2079
 	 * @return void
2080 2080
 	 */
2081
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
2081
+	protected function _trash_or_restore_registrations($trash = TRUE) {
2082 2082
 		$REGM = EEM_Registration::instance();
2083 2083
 
2084 2084
 		$success = 1;
@@ -2088,26 +2088,26 @@  discard block
 block discarded – undo
2088 2088
 		$dtts = array();
2089 2089
 
2090 2090
 		//if empty _REG_ID then get out because there's nothing to do
2091
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
2091
+		if (empty($this->_req_data['_REG_ID'])) {
2092 2092
 			$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');
2093
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
2094
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
2093
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
2094
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
2095 2095
 		}
2096 2096
 
2097 2097
 		//Checkboxes
2098
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2098
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2099 2099
 			// if array has more than one element than success message should be plural
2100
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2100
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2101 2101
 			// cycle thru checkboxes
2102
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2102
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2103 2103
 				/** @var EE_Registration $REG */
2104
-				$REG = $REGM->get_one_by_ID( $REG_ID);
2104
+				$REG = $REGM->get_one_by_ID($REG_ID);
2105 2105
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
2106
-				if ( $payment_count > 0 ) {
2107
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
2106
+				if ($payment_count > 0) {
2107
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
2108 2108
 					$error = 1;
2109 2109
 					$success = 0;
2110
-					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__ );
2110
+					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__);
2111 2111
 					continue; //can't trash this registration because it has payments.
2112 2112
 				}
2113 2113
 				$ticket = $REG->get_first_related('Ticket');
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
 				$dtts = array_merge($dtts, $dtt);
2117 2117
 
2118 2118
 				$updated = $trash ? $REG->delete() : $REG->restore();
2119
-				if ( !$updated ) {
2119
+				if ( ! $updated) {
2120 2120
 					$success = 0;
2121 2121
 				} else {
2122 2122
 					$success = 2;
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 			$tickets[$ticket->ID()] = $ticket;
2132 2132
 			$dtts = $ticket->get_many_related('Datetime');
2133 2133
 			$updated = $trash ? $REG->delete() : $REG->restore();
2134
-			if ( ! $updated ) {
2134
+			if ( ! $updated) {
2135 2135
 				$success = 0;
2136 2136
 			}
2137 2137
 
@@ -2141,10 +2141,10 @@  discard block
 block discarded – undo
2141 2141
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
2142 2142
 		EEM_Datetime::instance()->update_sold($dtts);
2143 2143
 
2144
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2145
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2144
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2145
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2146 2146
 		$overwrite_msgs = $error ? TRUE : FALSE;
2147
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
2147
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
2148 2148
 	}
2149 2149
 
2150 2150
 
@@ -2168,16 +2168,16 @@  discard block
 block discarded – undo
2168 2168
 		$success = 1;
2169 2169
 
2170 2170
 		//Checkboxes
2171
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2171
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2172 2172
 			// if array has more than one element than success message should be plural
2173
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2173
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2174 2174
 			// cycle thru checkboxes
2175
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2175
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2176 2176
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2177
-				if ( ! $REG instanceof EE_Registration )
2177
+				if ( ! $REG instanceof EE_Registration)
2178 2178
 					continue;
2179 2179
 				$deleted = $this->_delete_registration($REG);
2180
-				if ( !$deleted ) {
2180
+				if ( ! $deleted) {
2181 2181
 					$success = 0;
2182 2182
 				}
2183 2183
 			}
@@ -2187,15 +2187,15 @@  discard block
 block discarded – undo
2187 2187
 			$REG_ID = $this->_req_data['_REG_ID'];
2188 2188
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2189 2189
 			$deleted = $this->_delete_registration($REG);
2190
-			if ( ! $deleted ) {
2190
+			if ( ! $deleted) {
2191 2191
 				$success = 0;
2192 2192
 			}
2193 2193
 
2194 2194
 		}
2195 2195
 
2196
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2197
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2198
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2196
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2197
+		$action_desc = __('permanently deleted.', 'event_espresso');
2198
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2199 2199
 	}
2200 2200
 
2201 2201
 
@@ -2207,31 +2207,31 @@  discard block
 block discarded – undo
2207 2207
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2208 2208
 	 * @return boolean              true = successful deletion, false = fail.
2209 2209
 	 */
2210
-	protected function _delete_registration( EE_Registration $REG ) {
2210
+	protected function _delete_registration(EE_Registration $REG) {
2211 2211
 		//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.
2212 2212
 		$TXN = $REG->get_first_related('Transaction');
2213 2213
 		$REGS = $TXN->get_many_related('Registration');
2214 2214
 
2215 2215
 		$all_trashed = TRUE;
2216
-		foreach ( $REGS as $registration ) {
2217
-			if ( ! $registration->get('REG_deleted') )
2216
+		foreach ($REGS as $registration) {
2217
+			if ( ! $registration->get('REG_deleted'))
2218 2218
 				$all_trashed = FALSE;
2219 2219
 		}
2220 2220
 
2221
-		if ( ! $all_trashed ) {
2222
-			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__ );
2221
+		if ( ! $all_trashed) {
2222
+			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__);
2223 2223
 			return false;
2224 2224
 		}
2225 2225
 
2226 2226
 		//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).
2227
-		foreach ( $REGS as $registration ) {
2227
+		foreach ($REGS as $registration) {
2228 2228
 
2229 2229
 			//delete related answers
2230 2230
 			$registration->delete_related_permanently('Answer');
2231 2231
 
2232 2232
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2233 2233
 			$attendee = $registration->get_first_related('Attendee');
2234
-			if ( $attendee instanceof EE_Attendee ) {
2234
+			if ($attendee instanceof EE_Attendee) {
2235 2235
 				$registration->_remove_relation_to($attendee, 'Attendee');
2236 2236
 			}
2237 2237
 
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 			//now delete permanently the checkins related to this registration.
2242 2242
 			$registration->delete_related_permanently('Checkin');
2243 2243
 
2244
-			if ( $registration->ID() === $REG->ID() )
2244
+			if ($registration->ID() === $REG->ID())
2245 2245
 				continue; //we don't want to delete permanently the existing registration just yet.
2246 2246
 
2247 2247
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2278,35 +2278,35 @@  discard block
 block discarded – undo
2278 2278
 	 * @return void
2279 2279
 	 */
2280 2280
 	public function new_registration() {
2281
-		if ( ! $this->_set_reg_event() ) {
2282
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2281
+		if ( ! $this->_set_reg_event()) {
2282
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2283 2283
 		}
2284
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2284
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2285 2285
 		// gotta start with a clean slate if we're not coming here via ajax
2286 2286
 		if (
2287
-			! defined('DOING_AJAX' )
2288
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2287
+			! defined('DOING_AJAX')
2288
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2289 2289
 		) {
2290
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2290
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2291 2291
 		}
2292 2292
 
2293
-		$this->_template_args['event_name'] = '' ;
2293
+		$this->_template_args['event_name'] = '';
2294 2294
 		// event name
2295
-		if ( $this->_reg_event ) {
2295
+		if ($this->_reg_event) {
2296 2296
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2297
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2298
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2299
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2297
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2298
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2299
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2300 2300
 		}
2301 2301
 
2302 2302
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2303 2303
 
2304
-		if ( defined('DOING_AJAX' ) ) {
2304
+		if (defined('DOING_AJAX')) {
2305 2305
 			$this->_return_json();
2306 2306
 		}
2307 2307
 		// grab header
2308
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2309
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2308
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2309
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2310 2310
 
2311 2311
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2312 2312
 		// the details template wrapper
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
 	 * @return string html
2324 2324
 	 */
2325 2325
 	protected function _get_registration_step_content() {
2326
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2326
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2327 2327
 			$warning_msg = sprintf(
2328 2328
 				__(
2329 2329
 					'%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',
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
 				'</b>'
2340 2340
 			);
2341 2341
 			return '
2342
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2342
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2343 2343
 	<script >
2344 2344
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2345 2345
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2374,16 +2374,16 @@  discard block
 block discarded – undo
2374 2374
 		$cart = EE_Registry::instance()->SSN->cart();
2375 2375
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2376 2376
 
2377
-		switch ( $step ) {
2377
+		switch ($step) {
2378 2378
 			case 'ticket' :
2379 2379
 				$hidden_fields['processing_registration']['value'] = 1;
2380 2380
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2381
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2381
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2382 2382
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2383 2383
 				$template_args['show_notification_toggle'] = FALSE;
2384 2384
 				break;
2385 2385
 			case 'questions' :
2386
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2386
+				$hidden_fields['processing_registration']['value'] = 2;
2387 2387
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2388 2388
 				//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.
2389 2389
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2392,10 +2392,10 @@  discard block
 block discarded – undo
2392 2392
 				break;
2393 2393
 		}
2394 2394
 
2395
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2395
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2396 2396
 
2397 2397
 		return EEH_Template::display_template(
2398
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2398
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2399 2399
 		);
2400 2400
 	}
2401 2401
 
@@ -2410,11 +2410,11 @@  discard block
 block discarded – undo
2410 2410
 	*		@return boolean
2411 2411
 	*/
2412 2412
 	private function _set_reg_event() {
2413
-		if ( is_object( $this->_reg_event )) {
2413
+		if (is_object($this->_reg_event)) {
2414 2414
 			return TRUE;
2415 2415
 		}
2416
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2417
-		if ( ! $EVT_ID ) {
2416
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2417
+		if ( ! $EVT_ID) {
2418 2418
 			return FALSE;
2419 2419
 		}
2420 2420
 
@@ -2435,82 +2435,82 @@  discard block
 block discarded – undo
2435 2435
 	public function process_reg_step() {
2436 2436
 		EE_System::do_not_cache();
2437 2437
 		$this->_set_reg_event();
2438
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2438
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2439 2439
 
2440 2440
 		//what step are we on?
2441 2441
 		$cart = EE_Registry::instance()->SSN->cart();
2442 2442
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2443 2443
 
2444 2444
 		//if doing ajax then we need to verify the nonce
2445
-		if ( defined( 'DOING_AJAX' ) ) {
2446
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2447
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2445
+		if (defined('DOING_AJAX')) {
2446
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2447
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2448 2448
 		}
2449 2449
 
2450
-		switch ( $step ) {
2450
+		switch ($step) {
2451 2451
 
2452 2452
 			case 'ticket' :
2453 2453
 				//process ticket selection
2454 2454
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2455
-				if ( $success ) {
2456
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2455
+				if ($success) {
2456
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2457 2457
 				} else {
2458 2458
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2459 2459
 				}
2460
-				if ( defined('DOING_AJAX') ) {
2460
+				if (defined('DOING_AJAX')) {
2461 2461
 					$this->new_registration(); //display next step
2462 2462
 				} else {
2463 2463
 					$query_args['action'] = 'new_registration';
2464 2464
 					$query_args['processing_registration'] = 1;
2465 2465
 					$query_args['event_id'] = $this->_reg_event->ID();
2466
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2466
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2467 2467
 				}
2468 2468
 				break;
2469 2469
 
2470 2470
 			case 'questions' :
2471
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2472
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2471
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2472
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2473 2473
 				}
2474 2474
 				//process registration
2475 2475
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2476
-				if ( $cart instanceof EE_Cart ) {
2476
+				if ($cart instanceof EE_Cart) {
2477 2477
 					$grand_total = $cart->get_cart_grand_total();
2478
-					if ( $grand_total instanceof EE_Line_Item ) {
2478
+					if ($grand_total instanceof EE_Line_Item) {
2479 2479
 						$grand_total->save_this_and_descendants_to_txn();
2480 2480
 					}
2481 2481
 				}
2482
-				if ( ! $transaction instanceof EE_Transaction ) {
2482
+				if ( ! $transaction instanceof EE_Transaction) {
2483 2483
 					$query_args = array(
2484 2484
 						'action' => 'new_registration',
2485 2485
 						'processing_registration' => 2,
2486 2486
 						'event_id' => $this->_reg_event->ID()
2487 2487
 					);
2488 2488
 
2489
-					if ( defined('DOING_AJAX' )) {
2489
+					if (defined('DOING_AJAX')) {
2490 2490
 						//display registration form again because there are errors (maybe validation?)
2491 2491
 						$this->new_registration();
2492 2492
 						return;
2493 2493
 					} else {
2494
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2494
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2495 2495
 						return;
2496 2496
 					}
2497 2497
 				}
2498 2498
 				/** @type EE_Transaction_Payments $transaction_payments */
2499
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2499
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2500 2500
 				// maybe update status, and make sure to save transaction if not done already
2501
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2501
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2502 2502
 					$transaction->save();
2503 2503
 				}
2504
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2504
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2505 2505
 				$this->_req_data = array();
2506 2506
 				$query_args = array(
2507 2507
 					'action'        => 'redirect_to_txn',
2508 2508
 					'TXN_ID'        => $transaction->ID(),
2509 2509
 					'EVT_ID'        => $this->_reg_event->ID(),
2510
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2510
+					'event_name'    => urlencode($this->_reg_event->name()),
2511 2511
 					'redirect_from' => 'new_registration'
2512 2512
 				);
2513
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2513
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2514 2514
 				break;
2515 2515
 		}
2516 2516
 
@@ -2527,21 +2527,21 @@  discard block
 block discarded – undo
2527 2527
 	 */
2528 2528
 	public function redirect_to_txn() {
2529 2529
 		EE_System::do_not_cache();
2530
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2530
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2531 2531
 		$query_args = array(
2532 2532
 			'action' => 'view_transaction',
2533
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2533
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2534 2534
 			'page'   => 'espresso_transactions'
2535 2535
 		);
2536
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2537
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2538
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2539
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2536
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2537
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2538
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2539
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2540 2540
 		}
2541 2541
 		EE_Error::add_success(
2542
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2542
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2543 2543
 		);
2544
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2544
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2545 2545
 	}
2546 2546
 
2547 2547
 
@@ -2552,7 +2552,7 @@  discard block
 block discarded – undo
2552 2552
 	*		@return void
2553 2553
 	*/
2554 2554
 	protected function _attendee_contact_list_table() {
2555
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2555
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2556 2556
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2557 2557
 		$this->display_admin_list_table_page_with_no_sidebar();
2558 2558
 	}
@@ -2567,10 +2567,10 @@  discard block
 block discarded – undo
2567 2567
 	*		@access public
2568 2568
 	*		@return array
2569 2569
 	*/
2570
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2570
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2571 2571
 
2572
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2573
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2572
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2573
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2574 2574
 		$ATT_MDL = EEM_Attendee::instance();
2575 2575
 
2576 2576
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2598,47 +2598,47 @@  discard block
 block discarded – undo
2598 2598
 				$orderby = 'ATT_lname';
2599 2599
 		}
2600 2600
 
2601
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2601
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2602 2602
 
2603
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2604
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2605
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2603
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2604
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2605
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2606 2606
 
2607 2607
 		$_where = array();
2608 2608
 
2609
-		if ( ! empty( $this->_req_data['s'] ) ) {
2610
-			$sstr = '%' . $this->_req_data['s'] . '%';
2609
+		if ( ! empty($this->_req_data['s'])) {
2610
+			$sstr = '%'.$this->_req_data['s'].'%';
2611 2611
 			$_where['OR'] = array(
2612
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2613
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2614
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2615
-				'ATT_fname' => array( 'LIKE', $sstr ),
2616
-				'ATT_lname' => array( 'LIKE', $sstr ),
2617
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2618
-				'ATT_email' => array('LIKE', $sstr ),
2619
-				'ATT_address' => array( 'LIKE', $sstr ),
2620
-				'ATT_address2' => array( 'LIKE', $sstr ),
2621
-				'ATT_city' => array( 'LIKE', $sstr ),
2622
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2623
-				'State.STA_name' => array('LIKE', $sstr ),
2624
-				'ATT_phone' => array( 'LIKE', $sstr ),
2625
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2626
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2627
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2628
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2612
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2613
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2614
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2615
+				'ATT_fname' => array('LIKE', $sstr),
2616
+				'ATT_lname' => array('LIKE', $sstr),
2617
+				'ATT_short_bio' => array('LIKE', $sstr),
2618
+				'ATT_email' => array('LIKE', $sstr),
2619
+				'ATT_address' => array('LIKE', $sstr),
2620
+				'ATT_address2' => array('LIKE', $sstr),
2621
+				'ATT_city' => array('LIKE', $sstr),
2622
+				'Country.CNT_name' => array('LIKE', $sstr),
2623
+				'State.STA_name' => array('LIKE', $sstr),
2624
+				'ATT_phone' => array('LIKE', $sstr),
2625
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2626
+				'Registration.REG_code' => array('LIKE', $sstr),
2627
+				'Registration.REG_count' => array('LIKE', $sstr),
2628
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2629 2629
 				);
2630 2630
 		}
2631 2631
 
2632 2632
 
2633
-		$offset = ($current_page-1)*$per_page;
2634
-		$limit = $count ? NULL : array( $offset, $per_page );
2633
+		$offset = ($current_page - 1) * $per_page;
2634
+		$limit = $count ? NULL : array($offset, $per_page);
2635 2635
 
2636
-		if ( $trash ) {
2637
-			$_where['status'] = array( '!=', 'publish' );
2638
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true ): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2636
+		if ($trash) {
2637
+			$_where['status'] = array('!=', 'publish');
2638
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2639 2639
 		} else {
2640
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2641
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit ), 'ATT_ID' , true ) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2640
+			$_where['status'] = array('IN', array('publish'));
2641
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit), 'ATT_ID', true) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2642 2642
 		}
2643 2643
 
2644 2644
 		return $all_attendees;
@@ -2655,10 +2655,10 @@  discard block
 block discarded – undo
2655 2655
 	 */
2656 2656
 	protected function _resend_registration() {
2657 2657
 		$this->_process_resend_registration();
2658
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2658
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2659 2659
 			'action' => 'default'
2660 2660
 		);
2661
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2661
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2662 2662
 	}
2663 2663
 
2664 2664
 
@@ -2666,26 +2666,26 @@  discard block
 block discarded – undo
2666 2666
 
2667 2667
 
2668 2668
 
2669
-	public function _registrations_report(){
2670
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2671
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2669
+	public function _registrations_report() {
2670
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2671
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2672 2672
 				array(
2673 2673
 					'page' => 'espresso_batch',
2674 2674
 					'batch' => 'file',
2675
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2676
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2677
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2678
-				)) );
2675
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2676
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2677
+					'return_url' => urlencode($this->_req_data['return_url']),
2678
+				)));
2679 2679
 		} else {
2680 2680
 			$new_request_args = array(
2681 2681
 				'export' => 'report',
2682 2682
 				'action' => 'registrations_report_for_event',
2683
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2683
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2684 2684
 			);
2685 2685
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2686 2686
 
2687
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2688
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2687
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2688
+				require_once(EE_CLASSES.'EE_Export.class.php');
2689 2689
 				$EE_Export = EE_Export::instance($this->_req_data);
2690 2690
 				$EE_Export->export();
2691 2691
 			}
@@ -2694,26 +2694,26 @@  discard block
 block discarded – undo
2694 2694
 
2695 2695
 
2696 2696
 
2697
-	public function _contact_list_export(){
2698
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2699
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2697
+	public function _contact_list_export() {
2698
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2699
+			require_once(EE_CLASSES.'EE_Export.class.php');
2700 2700
 			$EE_Export = EE_Export::instance($this->_req_data);
2701 2701
 			$EE_Export->export_attendees();
2702 2702
 		}
2703 2703
 	}
2704 2704
 
2705
-	public function _contact_list_report(){
2706
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2707
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2705
+	public function _contact_list_report() {
2706
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2707
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2708 2708
 				array(
2709 2709
 					'page' => 'espresso_batch',
2710 2710
 					'batch' => 'file',
2711
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2712
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2713
-				)) );
2711
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2712
+					'return_url' => urlencode($this->_req_data['return_url']),
2713
+				)));
2714 2714
 		} else {
2715
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2716
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2715
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2716
+				require_once(EE_CLASSES.'EE_Export.class.php');
2717 2717
 				$EE_Export = EE_Export::instance($this->_req_data);
2718 2718
 				$EE_Export->report_attendees();
2719 2719
 			}
@@ -2732,73 +2732,73 @@  discard block
 block discarded – undo
2732 2732
 	 * @return void
2733 2733
 	 */
2734 2734
 	protected function _duplicate_attendee() {
2735
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2735
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2736 2736
 		//verify we have necessary info
2737
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2738
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2739
-			$query_args = array( 'action' => $action );
2737
+		if (empty($this->_req_data['_REG_ID'])) {
2738
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2739
+			$query_args = array('action' => $action);
2740 2740
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2741 2741
 		}
2742 2742
 
2743 2743
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2744
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2744
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2745 2745
 		$attendee = $registration->attendee();
2746 2746
 
2747 2747
 		//remove relation of existing attendee on registration
2748
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2748
+		$registration->_remove_relation_to($attendee, 'Attendee');
2749 2749
 		//new attendee
2750 2750
 		$new_attendee = clone $attendee;
2751
-		$new_attendee->set( 'ATT_ID', 0 );
2751
+		$new_attendee->set('ATT_ID', 0);
2752 2752
 		$new_attendee->save();
2753 2753
 
2754 2754
 		//add new attendee to reg
2755
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2755
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2756 2756
 
2757
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2757
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2758 2758
 
2759 2759
 		//redirect to edit page for attendee
2760
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2760
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2761 2761
 
2762
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2762
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2763 2763
 	}
2764 2764
 
2765 2765
 
2766 2766
 	//related to cpt routes
2767 2767
 	protected function _insert_update_cpt_item($post_id, $post) {
2768 2768
 		$success = true;
2769
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2769
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2770 2770
 		//for attendee updates
2771
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2771
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2772 2772
 			//note we should only be UPDATING attendees at this point.
2773 2773
 			$updated_fields = array(
2774 2774
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2775 2775
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2776
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2776
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2777 2777
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2778 2778
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2779
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2780
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2781
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2782
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2783
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2784
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2779
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2780
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2781
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2782
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2783
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2784
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2785 2785
 				);
2786
-			foreach ( $updated_fields as $field => $value ) {
2786
+			foreach ($updated_fields as $field => $value) {
2787 2787
 				$attendee->set($field, $value);
2788 2788
 			}
2789 2789
 
2790 2790
 			$success = $attendee->save();
2791 2791
 
2792
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2793
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2794
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2795
-					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 ) );
2792
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2793
+			foreach ($attendee_update_callbacks as $a_callback) {
2794
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2795
+					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));
2796 2796
 				}
2797 2797
 			}
2798 2798
 		}
2799 2799
 
2800
-		if ( $success === FALSE )
2801
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2800
+		if ($success === FALSE)
2801
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2802 2802
 
2803 2803
 	}
2804 2804
 
@@ -2818,17 +2818,17 @@  discard block
 block discarded – undo
2818 2818
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2819 2819
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2820 2820
 
2821
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2822
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2821
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2822
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2823 2823
 		}
2824 2824
 
2825
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2825
+		if (post_type_supports('espresso_attendees', 'comments')) {
2826 2826
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2827 2827
 		}
2828 2828
 
2829
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2830
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2831
-		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');
2829
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2830
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2831
+		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');
2832 2832
 	}
2833 2833
 
2834 2834
 
@@ -2837,10 +2837,10 @@  discard block
 block discarded – undo
2837 2837
 	 * @param  WP_Post $post wp post object
2838 2838
 	 * @return string        attendee contact info ( and form )
2839 2839
 	 */
2840
-	public function attendee_contact_info( $post ) {
2840
+	public function attendee_contact_info($post) {
2841 2841
 		//get attendee object ( should already have it )
2842 2842
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2843
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2843
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2844 2844
 		EEH_Template::display_template($template, $this->_template_args);
2845 2845
 	}
2846 2846
 
@@ -2856,12 +2856,12 @@  discard block
 block discarded – undo
2856 2856
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2857 2857
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2858 2858
 				new EE_Question_Form_Input(
2859
-				EE_Question::new_instance( array(
2859
+				EE_Question::new_instance(array(
2860 2860
 					'QST_ID' => 0,
2861 2861
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2862 2862
 					'QST_system' => 'admin-state'
2863 2863
 					)),
2864
-				EE_Answer::new_instance( array(
2864
+				EE_Answer::new_instance(array(
2865 2865
 					'ANS_ID' => 0,
2866 2866
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2867 2867
 					)),
@@ -2874,12 +2874,12 @@  discard block
 block discarded – undo
2874 2874
 			));
2875 2875
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2876 2876
 				new EE_Question_Form_Input(
2877
-				EE_Question::new_instance( array(
2877
+				EE_Question::new_instance(array(
2878 2878
 					'QST_ID' => 0,
2879 2879
 					'QST_display_text' => __('Country', 'event_espresso'),
2880 2880
 					'QST_system' => 'admin-country'
2881 2881
 					)),
2882
-				EE_Answer::new_instance( array(
2882
+				EE_Answer::new_instance(array(
2883 2883
 					'ANS_ID' => 0,
2884 2884
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2885 2885
 					)),
@@ -2890,8 +2890,8 @@  discard block
 block discarded – undo
2890 2890
 					'append_qstn_id' => FALSE
2891 2891
 					)
2892 2892
 				));
2893
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2894
-		EEH_Template::display_template($template, $this->_template_args );
2893
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2894
+		EEH_Template::display_template($template, $this->_template_args);
2895 2895
 
2896 2896
 	}
2897 2897
 
@@ -2901,11 +2901,11 @@  discard block
 block discarded – undo
2901 2901
 	*		@access protected
2902 2902
 	*		@return void
2903 2903
 	*/
2904
-	public function attendee_registrations_meta_box( $post ) {
2904
+	public function attendee_registrations_meta_box($post) {
2905 2905
 
2906 2906
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2907 2907
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2908
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2908
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2909 2909
 		EEH_Template::display_template($template, $this->_template_args);
2910 2910
 
2911 2911
 	}
@@ -2919,8 +2919,8 @@  discard block
 block discarded – undo
2919 2919
 	 * @return string        html for new form.
2920 2920
 	 */
2921 2921
 	public function after_title_form_fields($post) {
2922
-		if ( $post->post_type == 'espresso_attendees' ) {
2923
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2922
+		if ($post->post_type == 'espresso_attendees') {
2923
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2924 2924
 			$template_args['attendee'] = $this->_cpt_model_obj;
2925 2925
 			EEH_Template::display_template($template, $template_args);
2926 2926
 		}
@@ -2937,21 +2937,21 @@  discard block
 block discarded – undo
2937 2937
 	*		@access protected
2938 2938
 	*		@return void
2939 2939
 	*/
2940
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2940
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2941 2941
 
2942
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2942
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2943 2943
 
2944 2944
 		$ATT_MDL = EEM_Attendee::instance();
2945 2945
 
2946 2946
 		$success = 1;
2947 2947
 		//Checkboxes
2948
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2948
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2949 2949
 			// if array has more than one element than success message should be plural
2950
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2950
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2951 2951
 			// cycle thru checkboxes
2952
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2953
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2954
-				if ( !$updated ) {
2952
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2953
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2954
+				if ( ! $updated) {
2955 2955
 					$success = 0;
2956 2956
 				}
2957 2957
 			}
@@ -2960,18 +2960,18 @@  discard block
 block discarded – undo
2960 2960
 			// grab single id and delete
2961 2961
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2962 2962
 			//get attendee
2963
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2963
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2964 2964
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2965 2965
 			$updated = $att->save();
2966
-			if ( ! $updated ) {
2966
+			if ( ! $updated) {
2967 2967
 				$success = 0;
2968 2968
 			}
2969 2969
 
2970 2970
 		}
2971 2971
 
2972
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2973
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2974
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2972
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2973
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2974
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2975 2975
 
2976 2976
 	}
2977 2977
 
Please login to merge, or discard this patch.
core/business/EE_Transaction_Processor.class.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 
4 4
 /**
5 5
  * Class EE_Transaction_Processor
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 * @param array $registration_query_params
53 53
 	 *@return EE_Transaction_Processor instance
54 54
 	 */
55
-	public static function instance( $registration_query_params = array() ) {
55
+	public static function instance($registration_query_params = array()) {
56 56
 		// check if class object is instantiated
57
-		if ( ! self::$_instance instanceof EE_Transaction_Processor ) {
58
-			self::$_instance = new self( $registration_query_params );
57
+		if ( ! self::$_instance instanceof EE_Transaction_Processor) {
58
+			self::$_instance = new self($registration_query_params);
59 59
 		}
60 60
 		return self::$_instance;
61 61
 	}
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param array $registration_query_params
67 67
 	 * @return EE_Transaction_Processor
68 68
 	 */
69
-	private function __construct( $registration_query_params = array() ) {
69
+	private function __construct($registration_query_params = array()) {
70 70
 		// make sure some query params are set for retrieving registrations
71
-		$this->_set_registration_query_params( $registration_query_params );
71
+		$this->_set_registration_query_params($registration_query_params);
72 72
 	}
73 73
 
74 74
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @access private
78 78
 	 * @param array $registration_query_params
79 79
 	 */
80
-	private function _set_registration_query_params( $registration_query_params ) {
81
-		$this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' ));
80
+	private function _set_registration_query_params($registration_query_params) {
81
+		$this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC'));
82 82
 	}
83 83
 
84 84
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	/**
96 96
 	 * @param string $old_txn_status
97 97
 	 */
98
-	public function set_old_txn_status( $old_txn_status ) {
98
+	public function set_old_txn_status($old_txn_status) {
99 99
 		// only set the first time
100
-		if ( $this->_old_txn_status === null ) {
100
+		if ($this->_old_txn_status === null) {
101 101
 			$this->_old_txn_status = $old_txn_status;
102 102
 		}
103 103
 	}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	/**
117 117
 	 * @param string $new_txn_status
118 118
 	 */
119
-	public function set_new_txn_status( $new_txn_status ) {
119
+	public function set_new_txn_status($new_txn_status) {
120 120
 		$this->_new_txn_status = $new_txn_status;
121 121
 	}
122 122
 
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
 	 * @param bool   $check_all
148 148
 	 * @return boolean | int
149 149
 	 */
150
-	private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) {
150
+	private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) {
151 151
 		$reg_steps = $transaction->reg_steps();
152
-		if ( ! is_array( $reg_steps ) || empty( $reg_steps )) {
152
+		if ( ! is_array($reg_steps) || empty($reg_steps)) {
153 153
 			return false;
154 154
 		}
155 155
 		// loop thru reg steps array)
156
-		foreach ( $reg_steps as $slug => $reg_step_completed ) {
156
+		foreach ($reg_steps as $slug => $reg_step_completed) {
157 157
 			// if NOT checking ALL steps (only checking one step)
158
-			if ( ! $check_all ) {
158
+			if ( ! $check_all) {
159 159
 				// and this is the one
160
-				if ( $slug === $reg_step_slug ) {
160
+				if ($slug === $reg_step_slug) {
161 161
 					return $reg_step_completed;
162 162
 				} else {
163 163
 					// skip to next reg step in loop
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 				}
166 166
 			}
167 167
 			// $check_all must be true, else we would never have gotten to this point
168
-			if ( $slug === $reg_step_slug ) {
168
+			if ($slug === $reg_step_slug) {
169 169
 				// if we reach this point, then we are testing either:
170 170
 				// all_reg_steps_completed_except() or
171 171
 				// all_reg_steps_completed_except_final_step(),
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				// ie: "is everything completed except the final step?"
175 175
 				// "that is correct... the final step is not completed, but all others are."
176 176
 				return $reg_step_completed !== true ? true : false;
177
-			} else if ( $reg_step_completed !== true ) {
177
+			} else if ($reg_step_completed !== true) {
178 178
 				// if any reg step is NOT completed, then ALL steps are not completed
179 179
 				return false;
180 180
 			}
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 * @param EE_Transaction $transaction
196 196
 	 * @return boolean
197 197
 	 */
198
-	public function all_reg_steps_completed( EE_Transaction $transaction ) {
199
-		return $this->_reg_steps_completed( $transaction );
198
+	public function all_reg_steps_completed(EE_Transaction $transaction) {
199
+		return $this->_reg_steps_completed($transaction);
200 200
 	}
201 201
 
202 202
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @param string $exception
214 214
 	 * @return boolean
215 215
 	 */
216
-	public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) {
217
-		return $this->_reg_steps_completed( $transaction, $exception );
216
+	public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') {
217
+		return $this->_reg_steps_completed($transaction, $exception);
218 218
 	}
219 219
 
220 220
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 * @param EE_Transaction $transaction
231 231
 	 * @return boolean
232 232
 	 */
233
-	public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) {
234
-		return $this->_reg_steps_completed( $transaction, 'finalize_registration' );
233
+	public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) {
234
+		return $this->_reg_steps_completed($transaction, 'finalize_registration');
235 235
 	}
236 236
 
237 237
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param string $reg_step_slug
249 249
 	 * @return boolean | int
250 250
 	 */
251
-	public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
252
-		return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE );
251
+	public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
252
+		return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE);
253 253
 	}
254 254
 
255 255
 
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 * @param EE_Transaction $transaction
266 266
 	 * @return boolean | int
267 267
 	 */
268
-	public function final_reg_step_completed( EE_Transaction $transaction ) {
269
-		return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE );
268
+	public function final_reg_step_completed(EE_Transaction $transaction) {
269
+		return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE);
270 270
 	}
271 271
 
272 272
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @return boolean
282 282
 	 * @throws \EE_Error
283 283
 	 */
284
-	public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) {
285
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, time() );
284
+	public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) {
285
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, time());
286 286
 	}
287 287
 
288 288
 
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @return boolean
298 298
 	 * @throws \EE_Error
299 299
 	 */
300
-	public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) {
301
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, true );
300
+	public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) {
301
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, true);
302 302
 	}
303 303
 
304 304
 
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 * @return boolean
314 314
 	 * @throws \EE_Error
315 315
 	 */
316
-	public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) {
317
-		return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, false );
316
+	public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) {
317
+		return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, false);
318 318
 	}
319 319
 
320 320
 
@@ -330,37 +330,37 @@  discard block
 block discarded – undo
330 330
 	 * @return boolean
331 331
 	 * @throws \EE_Error
332 332
 	 */
333
-	private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) {
333
+	private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) {
334 334
 		// validate status
335
-		$status = is_bool( $status ) || is_int( $status ) ? $status : false;
335
+		$status = is_bool($status) || is_int($status) ? $status : false;
336 336
 		// get reg steps array
337 337
 		$txn_reg_steps = $transaction->reg_steps();
338 338
 		// if reg step does NOT exist
339
-		if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) {
339
+		if ( ! isset($txn_reg_steps[$reg_step_slug])) {
340 340
 			return false;
341 341
 		}
342 342
 		// if  we're trying to complete a step that is already completed
343
-		if ( $txn_reg_steps[ $reg_step_slug ] === true ) {
343
+		if ($txn_reg_steps[$reg_step_slug] === true) {
344 344
 			return true;
345 345
 		}
346 346
 		// if  we're trying to complete a step that hasn't even started
347
-		if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) {
347
+		if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
348 348
 			return false;
349 349
 		}
350 350
 		// if current status value matches the incoming value (no change)
351 351
 		// type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890
352
-		if ( (int)$txn_reg_steps[ $reg_step_slug ] === (int)$status ) {
352
+		if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) {
353 353
 			// this will happen in cases where multiple AJAX requests occur during the same step
354 354
 			return true;
355 355
 		}
356 356
 		// if we're trying to set a start time, but it has already been set...
357
-		if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) {
357
+		if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
358 358
 			// skip the update below, but don't return FALSE so that errors won't be displayed
359 359
 			return true;
360 360
 		}
361 361
 		// update completed status
362
-		$txn_reg_steps[ $reg_step_slug ] = $status;
363
-		$transaction->set_reg_steps( $txn_reg_steps );
362
+		$txn_reg_steps[$reg_step_slug] = $status;
363
+		$transaction->set_reg_steps($txn_reg_steps);
364 364
 		$transaction->save();
365 365
 		// DEBUG LOG
366 366
 		//$this->log(
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 	 * @param string $reg_step_slug
387 387
 	 * @return void
388 388
 	 */
389
-	public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) {
389
+	public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) {
390 390
 		// get reg steps array
391 391
 		$txn_reg_steps = $transaction->reg_steps();
392
-		unset( $txn_reg_steps[ $reg_step_slug ] );
393
-		$transaction->set_reg_steps( $txn_reg_steps );
392
+		unset($txn_reg_steps[$reg_step_slug]);
393
+		$transaction->set_reg_steps($txn_reg_steps);
394 394
 	}
395 395
 
396 396
 
@@ -405,15 +405,15 @@  discard block
 block discarded – undo
405 405
 	 * @return    boolean
406 406
 	 * @throws \EE_Error
407 407
 	 */
408
-	public function toggle_failed_transaction_status( EE_Transaction $transaction ) {
408
+	public function toggle_failed_transaction_status(EE_Transaction $transaction) {
409 409
 		$existing_txn_status = $transaction->status_ID();
410 410
 		// set incoming TXN_Status
411
-		$this->set_old_txn_status( $existing_txn_status );
411
+		$this->set_old_txn_status($existing_txn_status);
412 412
 		// if TXN status is still set as "failed"...
413
-		if ( $existing_txn_status === EEM_Transaction::failed_status_code ) {
413
+		if ($existing_txn_status === EEM_Transaction::failed_status_code) {
414 414
 			// set incoming TXN_Status
415
-			$this->set_new_txn_status( EEM_Transaction::abandoned_status_code );
416
-			$transaction->set_status( EEM_Transaction::abandoned_status_code );
415
+			$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
416
+			$transaction->set_status(EEM_Transaction::abandoned_status_code);
417 417
 			$transaction->save();
418 418
 			return TRUE;
419 419
 		}
@@ -430,27 +430,27 @@  discard block
 block discarded – undo
430 430
 	 * @param  EE_Transaction $transaction
431 431
 	 * @return boolean
432 432
 	 */
433
-	public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) {
433
+	public function toggle_abandoned_transaction_status(EE_Transaction $transaction) {
434 434
 		// set incoming TXN_Status
435
-		$this->set_old_txn_status( $transaction->status_ID() );
435
+		$this->set_old_txn_status($transaction->status_ID());
436 436
 		// if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"...
437 437
 		$txn_status = $transaction->status_ID();
438 438
 		if (
439 439
 			$txn_status === EEM_Transaction::failed_status_code
440 440
 			|| $txn_status === EEM_Transaction::abandoned_status_code
441 441
 		) {
442
-			$this->set_new_txn_status( EEM_Transaction::incomplete_status_code );
442
+			$this->set_new_txn_status(EEM_Transaction::incomplete_status_code);
443 443
 			// if a contact record for the primary registrant has been created
444 444
 			if (
445 445
 				$transaction->primary_registration() instanceof EE_Registration
446 446
 				&& $transaction->primary_registration()->attendee() instanceof EE_Attendee
447 447
 			) {
448
-				$transaction->set_status( EEM_Transaction::incomplete_status_code );
449
-				$this->set_new_txn_status( EEM_Transaction::incomplete_status_code );
448
+				$transaction->set_status(EEM_Transaction::incomplete_status_code);
449
+				$this->set_new_txn_status(EEM_Transaction::incomplete_status_code);
450 450
 			} else {
451 451
 				// no contact record? yer abandoned!
452
-				$transaction->set_status( EEM_Transaction::abandoned_status_code );
453
-				$this->set_new_txn_status( EEM_Transaction::abandoned_status_code );
452
+				$transaction->set_status(EEM_Transaction::abandoned_status_code);
453
+				$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
454 454
 			}
455 455
 			return TRUE;
456 456
 		}
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
 		);
484 484
 		// send messages
485 485
 		/** @type EE_Registration_Processor $registration_processor */
486
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
486
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
487 487
 		$registration_processor->trigger_registration_update_notifications(
488 488
 			$transaction->primary_registration(),
489
-			array( 'manually_updated' 	=> true )
489
+			array('manually_updated' 	=> true)
490 490
 		);
491 491
 		do_action(
492 492
 			'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
@@ -573,15 +573,15 @@  discard block
 block discarded – undo
573 573
 		$registration_query_params = array()
574 574
 	) {
575 575
 		// set incoming TXN_Status, and consider it new since old status should have been set
576
-		$this->set_new_txn_status( $transaction->status_ID() );
576
+		$this->set_new_txn_status($transaction->status_ID());
577 577
 		// make sure some query params are set for retrieving registrations
578
-		$this->_set_registration_query_params( $registration_query_params );
578
+		$this->_set_registration_query_params($registration_query_params);
579 579
 		// get final reg step status
580
-		$finalized = $this->final_reg_step_completed( $transaction );
580
+		$finalized = $this->final_reg_step_completed($transaction);
581 581
 		// if the 'finalize_registration' step has been initiated (has a timestamp)
582 582
 		// but has not yet been fully completed (TRUE)
583
-		if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) {
584
-			$this->set_reg_step_completed( $transaction, 'finalize_registration' );
583
+		if (is_int($finalized) && $finalized !== false && $finalized !== true) {
584
+			$this->set_reg_step_completed($transaction, 'finalize_registration');
585 585
 			$finalized = true;
586 586
 		}
587 587
 		$transaction->save();
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 
605 605
 		// send messages
606 606
 		/** @type EE_Registration_Processor $registration_processor */
607
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
607
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
608 608
 		$registration_processor->trigger_registration_update_notifications(
609 609
 			$transaction->primary_registration(),
610 610
 			$update_params
@@ -635,22 +635,22 @@  discard block
 block discarded – undo
635 635
 		$update_txn = true
636 636
 	) {
637 637
 		// these reg statuses should not be considered in any calculations involving monies owing
638
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
639
-		if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
638
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
639
+		if (in_array($registration->status_ID(), $closed_reg_statuses)) {
640 640
 			return false;
641 641
 		}
642 642
 		try {
643
-			$transaction = $this->get_transaction_for_registration( $registration );
643
+			$transaction = $this->get_transaction_for_registration($registration);
644 644
 			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration(
645 645
 				$transaction,
646 646
 				$registration
647 647
 			);
648 648
 			// un-cancel the ticket
649
-			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item( $ticket_line_item );
650
-		} catch ( EE_Error $e ) {
649
+			$success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item);
650
+		} catch (EE_Error $e) {
651 651
 			EE_Error::add_error(
652 652
 				sprintf(
653
-					__( 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso' ),
653
+					__('The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', 'event_espresso'),
654 654
 					$registration->ID(),
655 655
 					'<br />',
656 656
 					$e->getMessage()
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 			);
660 660
 			return false;
661 661
 		}
662
-		if ( $update_txn ) {
662
+		if ($update_txn) {
663 663
 			return $transaction->save() ? $success : false;
664 664
 		}
665 665
 		return $success;
@@ -683,18 +683,18 @@  discard block
 block discarded – undo
683 683
 		$update_txn = true
684 684
 	) {
685 685
 		// these reg statuses should not be considered in any calculations involving monies owing
686
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
687
-		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
686
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
687
+		if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) {
688 688
 			return false;
689 689
 		}
690 690
 		try {
691
-			$transaction = $this->get_transaction_for_registration( $registration );
692
-			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( $transaction, $registration );
693
-			EEH_Line_Item::cancel_ticket_line_item( $ticket_line_item );
694
-		} catch ( EE_Error $e ) {
691
+			$transaction = $this->get_transaction_for_registration($registration);
692
+			$ticket_line_item = $this->get_ticket_line_item_for_transaction_registration($transaction, $registration);
693
+			EEH_Line_Item::cancel_ticket_line_item($ticket_line_item);
694
+		} catch (EE_Error $e) {
695 695
 			EE_Error::add_error(
696 696
 				sprintf(
697
-					__( 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso' ),
697
+					__('The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', 'event_espresso'),
698 698
 					$registration->ID(),
699 699
 					'<br />',
700 700
 					$e->getMessage()
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 			);
704 704
 			return false;
705 705
 		}
706
-		if ( $update_txn ) {
706
+		if ($update_txn) {
707 707
 			return $transaction->save() ? true : false;
708 708
 		}
709 709
 		return true;
@@ -719,12 +719,12 @@  discard block
 block discarded – undo
719 719
 	 * @return 	EE_Transaction
720 720
 	 * @throws 	EE_Error
721 721
 	 */
722
-	public function get_transaction_for_registration( EE_Registration $registration ) {
722
+	public function get_transaction_for_registration(EE_Registration $registration) {
723 723
 		$transaction = $registration->transaction();
724
-		if ( ! $transaction instanceof EE_Transaction ) {
724
+		if ( ! $transaction instanceof EE_Transaction) {
725 725
 			throw new EE_Error(
726 726
 				sprintf(
727
-					__( 'The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso' ),
727
+					__('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'),
728 728
 					$registration->ID()
729 729
 				)
730 730
 			);
@@ -747,16 +747,16 @@  discard block
 block discarded – undo
747 747
 		EE_Transaction $transaction,
748 748
 		EE_Registration $registration
749 749
 	) {
750
-		EE_Registry::instance()->load_helper( 'Line_Item' );
750
+		EE_Registry::instance()->load_helper('Line_Item');
751 751
 		$ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction(
752 752
 			$transaction->ID(),
753 753
 			$registration->ticket_ID()
754 754
 		);
755
-		if ( ! $ticket_line_item instanceof EE_Line_Item ) {
755
+		if ( ! $ticket_line_item instanceof EE_Line_Item) {
756 756
 			throw new EE_Error(
757 757
 				sprintf(
758
-					__( 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
759
-						'event_espresso' ),
758
+					__('The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.',
759
+						'event_espresso'),
760 760
 					$transaction->ID(),
761 761
 					$registration->ticket_ID()
762 762
 				)
@@ -789,26 +789,26 @@  discard block
 block discarded – undo
789 789
 		$update_txn = true
790 790
 	) {
791 791
 		// make sure some query params are set for retrieving registrations
792
-		$this->_set_registration_query_params( $registration_query_params );
792
+		$this->_set_registration_query_params($registration_query_params);
793 793
 		// these reg statuses should not be considered in any calculations involving monies owing
794
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
794
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses : EEM_Registration::closed_reg_statuses();
795 795
 		// loop through cached registrations
796
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
796
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
797 797
 			if (
798 798
 				$registration instanceof EE_Registration
799
-				&& ! in_array( $registration->status_ID(), $closed_reg_statuses )
799
+				&& ! in_array($registration->status_ID(), $closed_reg_statuses)
800 800
 			) {
801 801
 				return false;
802 802
 			}
803 803
 		}
804
-		if ( in_array( $new_TXN_status, EEM_Transaction::txn_status_array() ) ) {
804
+		if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) {
805 805
 			// set incoming TXN_Status
806
-			$this->set_old_txn_status( $transaction->status_ID() );
807
-			$transaction->set_status( $new_TXN_status );
806
+			$this->set_old_txn_status($transaction->status_ID());
807
+			$transaction->set_status($new_TXN_status);
808 808
 			// set new TXN_Status
809
-			$this->set_new_txn_status( $new_TXN_status );
809
+			$this->set_new_txn_status($new_TXN_status);
810 810
 		}
811
-		if ( $update_txn ) {
811
+		if ($update_txn) {
812 812
 			return $transaction->save() ? true : false;
813 813
 		}
814 814
 		return true;
@@ -837,22 +837,22 @@  discard block
 block discarded – undo
837 837
 	) {
838 838
 		$response = false;
839 839
 		/** @type EE_Registration_Processor $registration_processor */
840
-		$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
840
+		$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
841 841
 		// check that method exists
842
-		if ( ! method_exists( $registration_processor, $method_name )) {
843
-			throw new EE_Error( __( 'Method does not exist.', 'event_espresso' ));
842
+		if ( ! method_exists($registration_processor, $method_name)) {
843
+			throw new EE_Error(__('Method does not exist.', 'event_espresso'));
844 844
 		}
845 845
 		// make sure some query params are set for retrieving registrations
846
-		$this->_set_registration_query_params( $registration_query_params );
846
+		$this->_set_registration_query_params($registration_query_params);
847 847
 		// loop through cached registrations
848
-		foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) {
849
-			if ( $registration instanceof EE_Registration ) {
850
-				if ( $additional_param ) {
851
-					$response = $registration_processor->{$method_name}( $registration, $additional_param )
848
+		foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
849
+			if ($registration instanceof EE_Registration) {
850
+				if ($additional_param) {
851
+					$response = $registration_processor->{$method_name}($registration, $additional_param)
852 852
 						? true
853 853
 						: $response;
854 854
 				} else {
855
-					$response = $registration_processor->{$method_name}( $registration )
855
+					$response = $registration_processor->{$method_name}($registration)
856 856
 						? true
857 857
 						: $response;
858 858
 				}
@@ -879,28 +879,28 @@  discard block
 block discarded – undo
879 879
 	public function set_transaction_payment_method_based_on_registration_statuses(
880 880
 		EE_Registration $edited_registration
881 881
 	) {
882
-		if ( $edited_registration instanceof EE_Registration ) {
882
+		if ($edited_registration instanceof EE_Registration) {
883 883
 			$transaction = $edited_registration->transaction();
884
-			if ( $transaction instanceof EE_Transaction ) {
884
+			if ($transaction instanceof EE_Transaction) {
885 885
 				$all_not_approved = true;
886
-				foreach ( $transaction->registrations() as $registration ) {
887
-					if ( $registration instanceof EE_Registration ) {
886
+				foreach ($transaction->registrations() as $registration) {
887
+					if ($registration instanceof EE_Registration) {
888 888
 						// if any REG != "Not Approved" then toggle to false
889 889
 						$all_not_approved = $registration->is_not_approved() ? $all_not_approved : false;
890 890
 					}
891 891
 				}
892 892
 				// if ALL Registrations are "Not Approved"
893
-				if ( $all_not_approved ) {
894
-					$transaction->set_payment_method_ID( null );
893
+				if ($all_not_approved) {
894
+					$transaction->set_payment_method_ID(null);
895 895
 					$transaction->save();
896 896
 				} else {
897 897
 					$available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction(
898 898
 						$transaction,
899 899
 						EEM_Payment_Method::scope_cart
900 900
 					);
901
-					if ( ! empty( $available_payment_methods ) ) {
901
+					if ( ! empty($available_payment_methods)) {
902 902
 						$PMD_ID = 0;
903
-						foreach ( $available_payment_methods as $available_payment_method ) {
903
+						foreach ($available_payment_methods as $available_payment_method) {
904 904
 							if (
905 905
 								$available_payment_method instanceof EE_Payment_Method
906 906
 							    && $available_payment_method->open_by_default()
@@ -909,22 +909,22 @@  discard block
 block discarded – undo
909 909
 								break;
910 910
 							}
911 911
 						}
912
-						if ( ! $PMD_ID ) {
913
-							$first_payment_method = reset( $available_payment_methods );
914
-							if ( $first_payment_method instanceof EE_Payment_Method ) {
912
+						if ( ! $PMD_ID) {
913
+							$first_payment_method = reset($available_payment_methods);
914
+							if ($first_payment_method instanceof EE_Payment_Method) {
915 915
 								$PMD_ID = $first_payment_method->ID();
916 916
 							} else {
917 917
 								EE_Error::add_error(
918
-									__( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ),
918
+									__('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'),
919 919
 									__FILE__, __LINE__, __FUNCTION__
920 920
 								);
921 921
 							}
922 922
 						}
923
-						$transaction->set_payment_method_ID( $PMD_ID );
923
+						$transaction->set_payment_method_ID($PMD_ID);
924 924
 						$transaction->save();
925 925
 					} else {
926 926
 						EE_Error::add_error(
927
-							__( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ),
927
+							__('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'),
928 928
 							__FILE__, __LINE__, __FUNCTION__
929 929
 						);
930 930
 					}
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Transaction class
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 	 * @return EE_Transaction
26 26
 	 * @throws \EE_Error
27 27
 	 */
28
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
29
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
28
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
29
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30 30
 		return $has_object
31 31
 			? $has_object
32
-			: new self( $props_n_values, false, $timezone, $date_formats );
32
+			: new self($props_n_values, false, $timezone, $date_formats);
33 33
 	}
34 34
 
35 35
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @return EE_Transaction
42 42
 	 * @throws \EE_Error
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
45
-		return new self( $props_n_values, TRUE, $timezone );
44
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
45
+		return new self($props_n_values, TRUE, $timezone);
46 46
 	}
47 47
 
48 48
 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function lock() {
60 60
 		// attempt to set lock, but if that fails...
61
-		if ( ! $this->add_extra_meta( 'lock', time(), true )  ) {
61
+		if ( ! $this->add_extra_meta('lock', time(), true)) {
62 62
 			// then attempt to remove the lock in case it is expired
63
-			if ( $this->_remove_expired_lock() ) {
63
+			if ($this->_remove_expired_lock()) {
64 64
 				// if removal was successful, then try setting lock again
65 65
 				$this->lock();
66 66
 			} else {
67 67
 				// but if the lock can not be removed, then throw an exception
68 68
 				throw new EE_Error(
69 69
 					sprintf(
70
-						__( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ),
70
+						__('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'),
71 71
 						$this->ID()
72 72
 					)
73 73
 				);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @throws \EE_Error
87 87
 	 */
88 88
 	public function unlock() {
89
-		return $this->delete_extra_meta( 'lock' );
89
+		return $this->delete_extra_meta('lock');
90 90
 	}
91 91
 
92 92
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function is_locked() {
109 109
 		// if TXN is not locked, then return false immediately
110
-		if ( ! $this->_get_lock() ) {
110
+		if ( ! $this->_get_lock()) {
111 111
 			return false;
112 112
 		}
113 113
 		// if not, then let's try and remove the lock in case it's expired...
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @throws \EE_Error
129 129
 	 */
130 130
 	protected function _get_lock() {
131
-		return (int)$this->get_extra_meta( 'lock', true, 0 );
131
+		return (int) $this->get_extra_meta('lock', true, 0);
132 132
 	}
133 133
 
134 134
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	protected function _remove_expired_lock() {
145 145
 		$locked = $this->_get_lock();
146
-		if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) {
146
+		if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) {
147 147
 			return $this->unlock();
148 148
 		}
149 149
 		return 0;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param        float $total total value of transaction
159 159
 	 * @throws \EE_Error
160 160
 	 */
161
-	public function set_total( $total = 0.00 ) {
162
-		$this->set( 'TXN_total', (float)$total );
161
+	public function set_total($total = 0.00) {
162
+		$this->set('TXN_total', (float) $total);
163 163
 	}
164 164
 
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
172 172
 	 * @throws \EE_Error
173 173
 	 */
174
-	public function set_paid( $total_paid = 0.00 ) {
175
-		$this->set( 'TXN_paid', (float)$total_paid );
174
+	public function set_paid($total_paid = 0.00) {
175
+		$this->set('TXN_paid', (float) $total_paid);
176 176
 	}
177 177
 
178 178
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
185 185
 	 * @throws \EE_Error
186 186
 	 */
187
-	public function set_status( $status = '' ) {
188
-		$this->set( 'STS_ID', $status );
187
+	public function set_status($status = '') {
188
+		$this->set('STS_ID', $status);
189 189
 	}
190 190
 
191 191
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param        string $hash_salt required for some payment gateways
198 198
 	 * @throws \EE_Error
199 199
 	 */
200
-	public function set_hash_salt( $hash_salt = '' ) {
201
-		$this->set( 'TXN_hash_salt', $hash_salt );
200
+	public function set_hash_salt($hash_salt = '') {
201
+		$this->set('TXN_hash_salt', $hash_salt);
202 202
 	}
203 203
 
204 204
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 * @param array $txn_reg_steps
210 210
 	 * @throws \EE_Error
211 211
 	 */
212
-	public function set_reg_steps( array $txn_reg_steps ) {
213
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
212
+	public function set_reg_steps(array $txn_reg_steps) {
213
+		$this->set('TXN_reg_steps', $txn_reg_steps);
214 214
 	}
215 215
 
216 216
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	 * @throws \EE_Error
223 223
 	 */
224 224
 	public function reg_steps() {
225
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
226
-		return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array();
225
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
226
+		return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array();
227 227
 	}
228 228
 
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @throws \EE_Error
234 234
 	 */
235 235
 	public function pretty_total() {
236
-		return $this->get_pretty( 'TXN_total' );
236
+		return $this->get_pretty('TXN_total');
237 237
 	}
238 238
 
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @throws \EE_Error
246 246
 	 */
247 247
 	public function pretty_paid() {
248
-		return $this->get_pretty( 'TXN_paid' );
248
+		return $this->get_pretty('TXN_paid');
249 249
 	}
250 250
 
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @throws \EE_Error
259 259
 	 */
260 260
 	public function remaining() {
261
-		return (float)( $this->total() - $this->paid() );
261
+		return (float) ($this->total() - $this->paid());
262 262
 	}
263 263
 
264 264
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @throws \EE_Error
272 272
 	 */
273 273
 	public function total() {
274
-		return (float)$this->get( 'TXN_total' );
274
+		return (float) $this->get('TXN_total');
275 275
 	}
276 276
 
277 277
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * @throws \EE_Error
285 285
 	 */
286 286
 	public function paid() {
287
-		return (float)$this->get( 'TXN_paid' );
287
+		return (float) $this->get('TXN_paid');
288 288
 	}
289 289
 
290 290
 
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 	 * @throws \EE_Error
297 297
 	 */
298 298
 	public function get_cart_session() {
299
-		$session_data = (array)$this->get( 'TXN_session_data' );
300
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart
301
-			? $session_data[ 'cart' ]
299
+		$session_data = (array) $this->get('TXN_session_data');
300
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart
301
+			? $session_data['cart']
302 302
 			: null;
303 303
 	}
304 304
 
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @throws \EE_Error
312 312
 	 */
313 313
 	public function session_data() {
314
-		$session_data = $this->get( 'TXN_session_data' );
315
-		if ( empty( $session_data ) ) {
314
+		$session_data = $this->get('TXN_session_data');
315
+		if (empty($session_data)) {
316 316
 			$session_data = array(
317 317
 				'id'            => null,
318 318
 				'user_id'       => null,
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	 * @param        EE_Session|array $session_data
336 336
 	 * @throws \EE_Error
337 337
 	 */
338
-	public function set_txn_session_data( $session_data ) {
339
-		if ( $session_data instanceof EE_Session ) {
340
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
338
+	public function set_txn_session_data($session_data) {
339
+		if ($session_data instanceof EE_Session) {
340
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
341 341
 		} else {
342
-			$this->set( 'TXN_session_data', $session_data );
342
+			$this->set('TXN_session_data', $session_data);
343 343
 		}
344 344
 	}
345 345
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 * @throws \EE_Error
353 353
 	 */
354 354
 	public function hash_salt_() {
355
-		return $this->get( 'TXN_hash_salt' );
355
+		return $this->get('TXN_hash_salt');
356 356
 	}
357 357
 
358 358
 
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 	 * @return    string | int
373 373
 	 * @throws \EE_Error
374 374
 	 */
375
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
376
-		if ( $format ) {
377
-			return $this->get_pretty( 'TXN_timestamp' );
378
-		} else if ( $gmt ) {
379
-			return $this->get_raw( 'TXN_timestamp' );
375
+	public function datetime($format = FALSE, $gmt = FALSE) {
376
+		if ($format) {
377
+			return $this->get_pretty('TXN_timestamp');
378
+		} else if ($gmt) {
379
+			return $this->get_raw('TXN_timestamp');
380 380
 		} else {
381
-			return $this->get( 'TXN_timestamp' );
381
+			return $this->get('TXN_timestamp');
382 382
 		}
383 383
 	}
384 384
 
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @return EE_Registration[]
393 393
 	 * @throws \EE_Error
394 394
 	 */
395
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
396
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) )
395
+	public function registrations($query_params = array(), $get_cached = FALSE) {
396
+		$query_params = (empty($query_params) || ! is_array($query_params))
397 397
 			? array(
398 398
 				'order_by' => array(
399 399
 					'Event.EVT_name' => 'ASC',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			)
404 404
 			: $query_params;
405 405
 		$query_params = $get_cached ? array() : $query_params;
406
-		return $this->get_many_related( 'Registration', $query_params );
406
+		return $this->get_many_related('Registration', $query_params);
407 407
 	}
408 408
 
409 409
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function attendees() {
419
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
419
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
420 420
 	}
421 421
 
422 422
 
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @return EE_Payment[]
429 429
 	 * @throws \EE_Error
430 430
 	 */
431
-	public function payments( $query_params = array() ) {
432
-		return $this->get_many_related( 'Payment', $query_params );
431
+	public function payments($query_params = array()) {
432
+		return $this->get_many_related('Payment', $query_params);
433 433
 	}
434 434
 
435 435
 
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 * @throws \EE_Error
442 442
 	 */
443 443
 	public function approved_payments() {
444
-		EE_Registry::instance()->load_model( 'Payment' );
445
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
444
+		EE_Registry::instance()->load_model('Payment');
445
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
446 446
 	}
447 447
 
448 448
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @return string
455 455
 	 * @throws \EE_Error
456 456
 	 */
457
-	public function e_pretty_status( $show_icons = FALSE ) {
458
-		echo $this->pretty_status( $show_icons );
457
+	public function e_pretty_status($show_icons = FALSE) {
458
+		echo $this->pretty_status($show_icons);
459 459
 	}
460 460
 
461 461
 
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 	 * @return string
468 468
 	 * @throws \EE_Error
469 469
 	 */
470
-	public function pretty_status( $show_icons = FALSE ) {
471
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
470
+	public function pretty_status($show_icons = FALSE) {
471
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
472 472
 		$icon = '';
473
-		switch ( $this->status_ID() ) {
473
+		switch ($this->status_ID()) {
474 474
 			case EEM_Transaction::complete_status_code:
475 475
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
476 476
 				break;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
488 488
 				break;
489 489
 		}
490
-		return $icon . $status[ $this->status_ID() ];
490
+		return $icon.$status[$this->status_ID()];
491 491
 	}
492 492
 
493 493
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @throws \EE_Error
500 500
 	 */
501 501
 	public function status_ID() {
502
-		return $this->get( 'STS_ID' );
502
+		return $this->get('STS_ID');
503 503
 	}
504 504
 
505 505
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * @throws \EE_Error
512 512
 	 */
513 513
 	public function is_free() {
514
-		return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' );
514
+		return EEH_Money::compare_floats($this->get('TXN_total'), 0, '==');
515 515
 	}
516 516
 
517 517
 
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
 	 * @return string
592 592
 	 * @throws \EE_Error
593 593
 	 */
594
-	public function invoice_url( $type = 'html' ) {
594
+	public function invoice_url($type = 'html') {
595 595
 		$REG = $this->primary_registration();
596
-		if ( ! $REG instanceof EE_Registration ) {
596
+		if ( ! $REG instanceof EE_Registration) {
597 597
 			return '';
598 598
 		}
599
-		return $REG->invoice_url( $type );
599
+		return $REG->invoice_url($type);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * @throws \EE_Error
609 609
 	 */
610 610
 	public function primary_registration() {
611
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
611
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
612 612
 	}
613 613
 
614 614
 
@@ -620,12 +620,12 @@  discard block
 block discarded – undo
620 620
 	 * @return string
621 621
 	 * @throws \EE_Error
622 622
 	 */
623
-	public function receipt_url( $type = 'html' ) {
623
+	public function receipt_url($type = 'html') {
624 624
 		$REG = $this->primary_registration();
625
-		if ( ! $REG instanceof EE_Registration ) {
625
+		if ( ! $REG instanceof EE_Registration) {
626 626
 			return '';
627 627
 		}
628
-		return $REG->receipt_url( $type );
628
+		return $REG->receipt_url($type);
629 629
 	}
630 630
 
631 631
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @throws \EE_Error
651 651
 	 */
652 652
 	public function gateway_response_on_transaction() {
653
-		$payment = $this->get_first_related( 'Payment' );
653
+		$payment = $this->get_first_related('Payment');
654 654
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
655 655
 	}
656 656
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 * @throws \EE_Error
664 664
 	 */
665 665
 	public function status_obj() {
666
-		return $this->get_first_related( 'Status' );
666
+		return $this->get_first_related('Status');
667 667
 	}
668 668
 
669 669
 
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
 	 * @return EE_Extra_Meta
676 676
 	 * @throws \EE_Error
677 677
 	 */
678
-	public function extra_meta( $query_params = array() ) {
679
-		return $this->get_many_related( 'Extra_Meta', $query_params );
678
+	public function extra_meta($query_params = array()) {
679
+		return $this->get_many_related('Extra_Meta', $query_params);
680 680
 	}
681 681
 
682 682
 
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
 	 * @return EE_Base_Class the relation was added to
689 689
 	 * @throws \EE_Error
690 690
 	 */
691
-	public function add_registration( EE_Registration $registration ) {
692
-		return $this->_add_relation_to( $registration, 'Registration' );
691
+	public function add_registration(EE_Registration $registration) {
692
+		return $this->_add_relation_to($registration, 'Registration');
693 693
 	}
694 694
 
695 695
 
@@ -702,8 +702,8 @@  discard block
 block discarded – undo
702 702
 	 * @return EE_Base_Class that was removed from being related
703 703
 	 * @throws \EE_Error
704 704
 	 */
705
-	public function remove_registration_with_id( $registration_or_id ) {
706
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
705
+	public function remove_registration_with_id($registration_or_id) {
706
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
707 707
 	}
708 708
 
709 709
 
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 	 * @throws \EE_Error
716 716
 	 */
717 717
 	public function items_purchased() {
718
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
718
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
719 719
 	}
720 720
 
721 721
 
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 	 * @return EE_Base_Class the relation was added to
728 728
 	 * @throws \EE_Error
729 729
 	 */
730
-	public function add_line_item( EE_Line_Item $line_item ) {
731
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
730
+	public function add_line_item(EE_Line_Item $line_item) {
731
+		return $this->_add_relation_to($line_item, 'Line_Item');
732 732
 	}
733 733
 
734 734
 
@@ -740,8 +740,8 @@  discard block
 block discarded – undo
740 740
 	 * @return EE_Line_Item[]
741 741
 	 * @throws \EE_Error
742 742
 	 */
743
-	public function line_items( $query_params = array() ) {
744
-		return $this->get_many_related( 'Line_Item', $query_params );
743
+	public function line_items($query_params = array()) {
744
+		return $this->get_many_related('Line_Item', $query_params);
745 745
 	}
746 746
 
747 747
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 * @throws \EE_Error
754 754
 	 */
755 755
 	public function tax_items() {
756
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
756
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
757 757
 	}
758 758
 
759 759
 
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
 	 * @return \EE_Line_Item
767 767
 	 * @throws \EE_Error
768 768
 	 */
769
-	public function total_line_item( $create_if_not_found = true ) {
770
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
771
-		if( ! $item && $create_if_not_found ){
772
-			$item = EEH_Line_Item::create_total_line_item( $this );
769
+	public function total_line_item($create_if_not_found = true) {
770
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
771
+		if ( ! $item && $create_if_not_found) {
772
+			$item = EEH_Line_Item::create_total_line_item($this);
773 773
 		}
774 774
 		return $item;
775 775
 	}
@@ -785,10 +785,10 @@  discard block
 block discarded – undo
785 785
 	 */
786 786
 	public function tax_total() {
787 787
 		$tax_line_item = $this->tax_total_line_item();
788
-		if ( $tax_line_item ) {
789
-			return (float)$tax_line_item->total();
788
+		if ($tax_line_item) {
789
+			return (float) $tax_line_item->total();
790 790
 		} else {
791
-			return (float)0;
791
+			return (float) 0;
792 792
 		}
793 793
 	}
794 794
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 * @throws \EE_Error
802 802
 	 */
803 803
 	public function tax_total_line_item() {
804
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
804
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
805 805
 	}
806 806
 
807 807
 
@@ -812,20 +812,20 @@  discard block
 block discarded – undo
812 812
 	 * @return EE_Form_Section_Proper
813 813
 	 * @throws \EE_Error
814 814
 	 */
815
-	public function billing_info(){
815
+	public function billing_info() {
816 816
 		$payment_method = $this->payment_method();
817
-		if ( !$payment_method){
817
+		if ( ! $payment_method) {
818 818
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
819 819
 			return false;
820 820
 		}
821 821
 		$primary_reg = $this->primary_registration();
822
-		if ( ! $primary_reg ) {
823
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
822
+		if ( ! $primary_reg) {
823
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
824 824
 			return FALSE;
825 825
 		}
826 826
 		$attendee = $primary_reg->attendee();
827
-		if ( ! $attendee ) {
828
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
827
+		if ( ! $attendee) {
828
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
829 829
 			return FALSE;
830 830
 		}
831 831
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -866,15 +866,15 @@  discard block
 block discarded – undo
866 866
 	 * @return EE_Payment_Method
867 867
 	 * @throws \EE_Error
868 868
 	 */
869
-	public function payment_method(){
869
+	public function payment_method() {
870 870
 		$pm = $this->get_first_related('Payment_Method');
871
-		if( $pm instanceof EE_Payment_Method ){
871
+		if ($pm instanceof EE_Payment_Method) {
872 872
 			return $pm;
873
-		}else{
873
+		} else {
874 874
 			$last_payment = $this->last_payment();
875
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
875
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
876 876
 				return $last_payment->payment_method();
877
-			}else{
877
+			} else {
878 878
 				return NULL;
879 879
 			}
880 880
 		}
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 	 * @throws \EE_Error
890 890
 	 */
891 891
 	public function last_payment() {
892
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
892
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
893 893
 	}
894 894
 
895 895
 
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 	 * @return EE_Line_Item[]
901 901
 	 * @throws \EE_Error
902 902
 	 */
903
-	public function non_ticket_line_items(){
904
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
903
+	public function non_ticket_line_items() {
904
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
905 905
 	}
906 906
 
907 907
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 	public function update_based_on_payments()
950 950
 	{
951 951
 		EE_Error::doing_it_wrong(
952
-			__CLASS__ . '::' . __FUNCTION__,
952
+			__CLASS__.'::'.__FUNCTION__,
953 953
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
954 954
 				'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
955 955
 			'4.6.0'
Please login to merge, or discard this patch.
core/db_models/fields/EE_Datetime_Field.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * This prepares the datetime for internal usage as a PHP DateTime object OR null (if nullable is
503 503
 	 * allowed)
504 504
 	 * @param string $datetime_string mysql timestamp in UTC
505
-	 * @return  mixed null | DateTime
505
+	 * @return  null|DateTime null | DateTime
506 506
 	 */
507 507
 	public function prepare_for_set_from_db( $datetime_string ) {
508 508
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	 *
620 620
 	 * @param \DateTimeZone $DateTimeZone
621 621
 	 * @param null          $time
622
-	 * @return mixed
622
+	 * @return string
623 623
 	 */
624 624
 	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
625 625
 		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Datetime_Field
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 * @param string 	$pretty_date_format
119 119
 	 * @param string 	$pretty_time_format
120 120
 	 */
121
-	public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '' ){
121
+	public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '') {
122 122
 
123
-		$this->_date_format = ! empty( $date_format ) ? $date_format : get_option('date_format');
124
-		$this->_time_format = ! empty( $time_format ) ? $time_format : get_option('time_format');
125
-		$this->_pretty_date_format = ! empty( $pretty_date_format ) ? $pretty_date_format : get_option('date_format');
126
-		$this->_pretty_time_format = ! empty( $pretty_time_format ) ? $pretty_time_format : get_option('time_format');
123
+		$this->_date_format = ! empty($date_format) ? $date_format : get_option('date_format');
124
+		$this->_time_format = ! empty($time_format) ? $time_format : get_option('time_format');
125
+		$this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
126
+		$this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
127 127
 
128
-		parent::__construct( $table_column, $nice_name, $nullable, $default_value );
129
-		$this->set_timezone( $timezone_string );
128
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
129
+		$this->set_timezone($timezone_string);
130 130
 
131 131
 	}
132 132
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return DateTimeZone
146 146
 	 */
147 147
 	public function get_UTC_DateTimeZone() {
148
-		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string( 'UTC' );
148
+		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string('UTC');
149 149
 	}
150 150
 
151 151
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return DateTimeZone
155 155
 	 */
156 156
 	public function get_blog_DateTimeZone() {
157
-		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string( '' );
157
+		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string('');
158 158
 	}
159 159
 
160 160
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp
165 165
 	 * @return DateTime
166 166
 	 */
167
-	public function prepare_for_set( $value_inputted_for_field_on_model_object ) {
168
-		return $this->_get_date_object( $value_inputted_for_field_on_model_object );
167
+	public function prepare_for_set($value_inputted_for_field_on_model_object) {
168
+		return $this->_get_date_object($value_inputted_for_field_on_model_object);
169 169
 	}
170 170
 
171 171
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 * @param bool $pretty If we're returning the pretty formats or standard format string.
182 182
 	 * @return string    The final assembled format string.
183 183
 	 */
184
-	protected function _get_date_time_output( $pretty = FALSE ) {
184
+	protected function _get_date_time_output($pretty = FALSE) {
185 185
 
186
-		switch ( $this->_date_time_output ) {
186
+		switch ($this->_date_time_output) {
187 187
 			case 'time' :
188 188
 				return $pretty ? $this->_pretty_time_format : $this->_time_format;
189 189
 				break;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				break;
194 194
 
195 195
 			default :
196
-				return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format;
196
+				return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format;
197 197
 		}
198 198
 	}
199 199
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param string $what acceptable values are 'time' or 'date'.  Any other value will be set but will always result in both 'date' and 'time' being returned.
208 208
 	 * @return void
209 209
 	 */
210
-	public function set_date_time_output( $what = NULL ) {
210
+	public function set_date_time_output($what = NULL) {
211 211
 		$this->_date_time_output = $what;
212 212
 	}
213 213
 
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 	 * @param string $timezone_string A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php
224 224
 	 * @return void
225 225
 	 */
226
-	public function set_timezone( $timezone_string ) {
227
-		if( empty( $timezone_string ) && $this->_timezone_string != NULL ){
226
+	public function set_timezone($timezone_string) {
227
+		if (empty($timezone_string) && $this->_timezone_string != NULL) {
228 228
 			// leave the timezone AS-IS if we already have one and
229 229
 			// the function arg didn't provide one
230 230
 			return;
231 231
 		}
232
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
233
-		$this->_timezone_string = ! empty( $timezone_string ) ? $timezone_string : 'UTC';
234
-		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string( $this->_timezone_string );
232
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
233
+		$this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
234
+		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
235 235
 	}
236 236
 
237 237
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param string $timezone_string
244 244
 	 * @return \DateTimeZone
245 245
 	 */
246
-	protected function _create_timezone_object_from_timezone_string( $timezone_string = '' ) {
247
-		return new DateTimeZone( EEH_DTT_Helper::get_valid_timezone_string( $timezone_string ) );
246
+	protected function _create_timezone_object_from_timezone_string($timezone_string = '') {
247
+		return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
248 248
 	}
249 249
 
250 250
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	 * @param bool   $pretty Whether to set pretty format or not.
270 270
 	 * @return void
271 271
 	 */
272
-	public function set_date_format( $format, $pretty = false ) {
273
-		if ( $pretty ) {
272
+	public function set_date_format($format, $pretty = false) {
273
+		if ($pretty) {
274 274
 			$this->_pretty_date_format = $format;
275 275
 		} else {
276 276
 			$this->_date_format = $format;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @param bool   $pretty Whether to get pretty format or not.
286 286
 	 * @return string
287 287
 	 */
288
-	public function get_date_format( $pretty = false ) {
288
+	public function get_date_format($pretty = false) {
289 289
 		return $pretty ? $this->_pretty_date_format : $this->_date_format;
290 290
 	}
291 291
 
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 	 * @param bool   $pretty Whether to set pretty format or not.
301 301
 	 * @return void
302 302
 	 */
303
-	public function set_time_format( $format, $pretty = false ) {
304
-		if ( $pretty ) {
303
+	public function set_time_format($format, $pretty = false) {
304
+		if ($pretty) {
305 305
 			$this->_pretty_time_format = $format;
306 306
 		} else {
307 307
 			$this->_time_format = $format;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * @param bool   $pretty Whether to get pretty format or not.
317 317
 	 * @return string
318 318
 	 */
319
-	public function get_time_format( $pretty = false ) {
319
+	public function get_time_format($pretty = false) {
320 320
 		return $pretty ? $this->_pretty_time_format : $this->_time_format;
321 321
 	}
322 322
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
332 332
 	 * @return void
333 333
 	 */
334
-	public function set_pretty_date_format( $format ) {
334
+	public function set_pretty_date_format($format) {
335 335
 		$this->_pretty_date_format = $format;
336 336
 	}
337 337
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
349 349
 	 * @return void
350 350
 	 */
351
-	public function set_pretty_time_format( $format ) {
351
+	public function set_pretty_time_format($format) {
352 352
 		$this->_pretty_time_format = $format;
353 353
 	}
354 354
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * @param DateTime    $current current DateTime object for the datetime field
361 361
 	 * @return DateTime
362 362
 	 */
363
-	public function prepare_for_set_with_new_time( $time_to_set_string, DateTime $current ){
363
+	public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current) {
364 364
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
365
-		if ( $time_to_set_string instanceof DateTime ) {
365
+		if ($time_to_set_string instanceof DateTime) {
366 366
 			$parsed = array(
367 367
 				'hour' => $time_to_set_string->format('H'),
368 368
 				'minute' => $time_to_set_string->format('i'),
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
 				);
371 371
 		} else {
372 372
 			//parse incoming string
373
-			$parsed = date_parse_from_format( $this->_time_format, $time_to_set_string );
373
+			$parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
374 374
 		}
375 375
 
376 376
 		//make sure $current is in the correct timezone.
377
-		$current->setTimezone( $this->_DateTimeZone );
378
-		return $current->setTime( $parsed['hour'], $parsed['minute'], $parsed['second'] );
377
+		$current->setTimezone($this->_DateTimeZone);
378
+		return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
379 379
 	}
380 380
 
381 381
 
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 	 * @param DateTime    $current current DateTime object for the datetime field
387 387
 	 * @return DateTime
388 388
 	 */
389
-	public function prepare_for_set_with_new_date( $date_to_set_string, DateTime $current ){
389
+	public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current) {
390 390
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
391
-		if ( $date_to_set_string instanceof DateTime ) {
391
+		if ($date_to_set_string instanceof DateTime) {
392 392
 			$parsed = array(
393 393
 				'year' => $date_to_set_string->format('Y'),
394 394
 				'month' => $date_to_set_string->format('m'),
@@ -396,12 +396,12 @@  discard block
 block discarded – undo
396 396
 				);
397 397
 		} else {
398 398
 			//parse incoming string
399
-			$parsed = date_parse_from_format( $this->_date_format, $date_to_set_string );
399
+			$parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
400 400
 		}
401 401
 
402 402
 		//make sure $current is in the correct timezone
403
-		$current->setTimezone( $this->_DateTimeZone );
404
-		return $current->setDate( $parsed['year'], $parsed['month'], $parsed['day'] );
403
+		$current->setTimezone($this->_DateTimeZone);
404
+		return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
405 405
 	}
406 406
 
407 407
 
@@ -413,8 +413,8 @@  discard block
 block discarded – undo
413 413
 	 * @param  DateTime $DateTime
414 414
 	 * @return string formatted date time for given timezone
415 415
 	 */
416
-	public function prepare_for_get( $DateTime ) {
417
-		return $this->_prepare_for_display( $DateTime  );
416
+	public function prepare_for_get($DateTime) {
417
+		return $this->_prepare_for_display($DateTime);
418 418
 	}
419 419
 
420 420
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @param null     $schema
430 430
 	 * @return string
431 431
 	 */
432
-	public function prepare_for_pretty_echoing( $DateTime, $schema = null ) {
433
-		return $this->_prepare_for_display( $DateTime, $schema ? $schema : true );
432
+	public function prepare_for_pretty_echoing($DateTime, $schema = null) {
433
+		return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
434 434
 	}
435 435
 
436 436
 
@@ -444,36 +444,36 @@  discard block
 block discarded – undo
444 444
 	 * @return string
445 445
 	 * @throws \EE_Error
446 446
 	 */
447
-	protected function _prepare_for_display( $DateTime, $schema = false ) {
448
-		if ( ! $DateTime instanceof DateTime  ) {
449
-			if ( $this->_nullable ) {
447
+	protected function _prepare_for_display($DateTime, $schema = false) {
448
+		if ( ! $DateTime instanceof DateTime) {
449
+			if ($this->_nullable) {
450 450
 				return '';
451 451
 			} else {
452
-				if ( WP_DEBUG ) {
453
-					throw new EE_Error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso' ), $this->_nicename ) );
452
+				if (WP_DEBUG) {
453
+					throw new EE_Error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso'), $this->_nicename));
454 454
 				} else {
455
-					$DateTime = new DateTime( "now" );
456
-					EE_Error::add_error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso' ), $this->_nicename ) );
455
+					$DateTime = new DateTime("now");
456
+					EE_Error::add_error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso'), $this->_nicename));
457 457
 				}
458 458
 			}
459 459
 		}
460
-		$format_string = $this->_get_date_time_output( $schema );
460
+		$format_string = $this->_get_date_time_output($schema);
461 461
 		//make sure datetime_value is in the correct timezone (in case that's been updated).
462
-		$DateTime->setTimezone( $this->_DateTimeZone );
463
-		if ( $schema ) {
464
-			if( $this->_display_timezone() ) {
462
+		$DateTime->setTimezone($this->_DateTimeZone);
463
+		if ($schema) {
464
+			if ($this->_display_timezone()) {
465 465
 				//must be explicit because schema could equal true.
466
-				if( $schema === 'no_html' ){
467
-					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
468
-				}else{
469
-					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
466
+				if ($schema === 'no_html') {
467
+					$timezone_string = ' ('.$DateTime->format('T').')';
468
+				} else {
469
+					$timezone_string = ' <span class="ee_dtt_timezone_string">('.$DateTime->format('T').')</span>';
470 470
 				}
471 471
 			} else {
472 472
 				$timezone_string = '';
473 473
 			}
474
-			return $DateTime->format( $format_string ) . $timezone_string;
474
+			return $DateTime->format($format_string).$timezone_string;
475 475
 		} else {
476
-			return $DateTime->format( $format_string );
476
+			return $DateTime->format($format_string);
477 477
 		}
478 478
 	}
479 479
 
@@ -487,18 +487,18 @@  discard block
 block discarded – undo
487 487
 	 * @return string mysql timestamp in UTC
488 488
 	 * @throws \EE_Error
489 489
 	 */
490
-	public function prepare_for_use_in_db( $datetime_value ) {
490
+	public function prepare_for_use_in_db($datetime_value) {
491 491
 		//we allow an empty value or DateTime object, but nothing else.
492
-		if ( ! empty( $datetime_value ) && ! $datetime_value instanceof DateTime ) {
493
-			throw new EE_Error( __('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso' ) );
492
+		if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
493
+			throw new EE_Error(__('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso'));
494 494
 		}
495 495
 
496
-		if ( $datetime_value instanceof DateTime ) {
497
-			return $datetime_value->setTimezone( $this->get_UTC_DateTimeZone() )->format( EE_Datetime_Field::mysql_timestamp_format );
496
+		if ($datetime_value instanceof DateTime) {
497
+			return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(EE_Datetime_Field::mysql_timestamp_format);
498 498
 		}
499 499
 
500 500
 		// if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
501
-		return ! $this->_nullable && empty( $datetime_value ) ? current_time( 'mysql', true ) : null;
501
+		return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
502 502
 	}
503 503
 
504 504
 
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 	 * @param string $datetime_string mysql timestamp in UTC
512 512
 	 * @return  mixed null | DateTime
513 513
 	 */
514
-	public function prepare_for_set_from_db( $datetime_string ) {
514
+	public function prepare_for_set_from_db($datetime_string) {
515 515
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
516
-		if ( empty( $datetime_string) && $this->_nullable ) {
516
+		if (empty($datetime_string) && $this->_nullable) {
517 517
 			return null;
518 518
 		}
519 519
 		// datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
520
-		$DateTime = empty( $datetime_string ) ? new DateTime( 'now', $this->get_UTC_DateTimeZone() ) : DateTime::createFromFormat( EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone() );
520
+		$DateTime = empty($datetime_string) ? new DateTime('now', $this->get_UTC_DateTimeZone()) : DateTime::createFromFormat(EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone());
521 521
 
522
-		if ( ! $DateTime instanceof DateTime ) {
522
+		if ( ! $DateTime instanceof DateTime) {
523 523
 			//if still no datetime object, then let's just use now
524
-			$DateTime = new DateTime( 'now', $this->get_UTC_DateTimeZone() );
524
+			$DateTime = new DateTime('now', $this->get_UTC_DateTimeZone());
525 525
 		}
526 526
 		// THEN apply the field's set DateTimeZone
527
-		$DateTime->setTimezone( $this->_DateTimeZone );
527
+		$DateTime->setTimezone($this->_DateTimeZone);
528 528
 		return $DateTime;
529 529
 	}
530 530
 
@@ -541,15 +541,15 @@  discard block
 block discarded – undo
541 541
 	protected function _display_timezone() {
542 542
 
543 543
 		// first let's do a comparison of timezone strings.  If they match then we can get out without any further calculations
544
-		$blog_string = get_option( 'timezone_string' );
545
-		if ( $blog_string == $this->_timezone_string ) {
544
+		$blog_string = get_option('timezone_string');
545
+		if ($blog_string == $this->_timezone_string) {
546 546
 			return FALSE;
547 547
 		}
548 548
 		// now we need to calc the offset for the timezone string so we can compare with the blog offset.
549
-		$this_offset = $this->get_timezone_offset( $this->_DateTimeZone );
550
-		$blog_offset = $this->get_timezone_offset( $this->get_blog_DateTimeZone() );
549
+		$this_offset = $this->get_timezone_offset($this->_DateTimeZone);
550
+		$blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
551 551
 		// now compare
552
-		if ( $blog_offset === $this_offset ) {
552
+		if ($blog_offset === $this_offset) {
553 553
 			return FALSE;
554 554
 		}
555 555
 		return TRUE;
@@ -567,24 +567,24 @@  discard block
 block discarded – undo
567 567
 	 *
568 568
 	 * @return DateTime
569 569
 	 */
570
-	protected function _get_date_object( $date_string ) {
570
+	protected function _get_date_object($date_string) {
571 571
 		//first if this is an empty date_string and nullable is allowed, just return null.
572
-		if ( $this->_nullable && empty( $date_string ) ) {
572
+		if ($this->_nullable && empty($date_string)) {
573 573
 			return null;
574 574
 		}
575 575
 
576 576
 		// if incoming date
577
-		if ( $date_string instanceof DateTime ) {
578
-			$date_string->setTimezone( $this->_DateTimeZone );
577
+		if ($date_string instanceof DateTime) {
578
+			$date_string->setTimezone($this->_DateTimeZone);
579 579
 			return $date_string;
580 580
 		}
581 581
 		// if empty date_string and made it here.
582 582
 		// Return a datetime object for now in the given timezone.
583
-		if ( empty( $date_string ) ) {
584
-			return new DateTime( "now", $this->_DateTimeZone );
583
+		if (empty($date_string)) {
584
+			return new DateTime("now", $this->_DateTimeZone);
585 585
 		}
586 586
 		// if $date_string is matches something that looks like a Unix timestamp let's just use it.
587
-		if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $date_string ) ) {
587
+		if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
588 588
 			try {
589 589
 				/**
590 590
 				 * This is operating under the assumption that the incoming Unix timestamp is
@@ -592,29 +592,29 @@  discard block
 block discarded – undo
592 592
 				 * current_time('timestamp');
593 593
 				 *
594 594
 				 */
595
-				$DateTime = new DateTime( "now", $this->_DateTimeZone );
596
-				return $DateTime->setTimestamp( $date_string );
597
-			 } catch ( Exception $e )  {
595
+				$DateTime = new DateTime("now", $this->_DateTimeZone);
596
+				return $DateTime->setTimestamp($date_string);
597
+			 } catch (Exception $e) {
598 598
 			 	// should be rare, but if things got fooled then let's just continue
599 599
 			 }
600 600
 		}
601 601
 		//not a unix timestamp.  So we will use the set format on this object and set timezone to
602 602
 		//create the DateTime object.
603
-		$format = $this->_date_format . ' ' . $this->_time_format;
603
+		$format = $this->_date_format.' '.$this->_time_format;
604 604
 		try {
605
-			$DateTime = DateTime::createFromFormat( $format, $date_string, $this->_DateTimeZone );
606
-			if ( ! $DateTime instanceof DateTime ) {
605
+			$DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
606
+			if ( ! $DateTime instanceof DateTime) {
607 607
 				throw new EE_Error(
608 608
 					sprintf(
609
-						__( '"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso' ),
609
+						__('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
610 610
 						$date_string,
611 611
 						$format
612 612
 					)
613 613
 				);
614 614
 			}
615
-		} catch ( Exception $e ) {
615
+		} catch (Exception $e) {
616 616
 			// if we made it here then likely then something went really wrong.  Instead of throwing an exception, let's just return a DateTime object for now, in the set timezone.
617
-			$DateTime = new DateTime( "now", $this->_DateTimeZone );
617
+			$DateTime = new DateTime("now", $this->_DateTimeZone);
618 618
 		}
619 619
 		return $DateTime;
620 620
 	}
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 	 * @param null          $time
629 629
 	 * @return mixed
630 630
 	 */
631
-	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
632
-		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
633
-		$transitions = $DateTimeZone->getTransitions( $time );
631
+	public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null) {
632
+		$time = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
633
+		$transitions = $DateTimeZone->getTransitions($time);
634 634
 		return $transitions[0]['offset'];
635 635
 	}
636 636
 
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
 	 * @param  string $timezone_string
643 643
 	 * @return string           abbreviation
644 644
 	 */
645
-	public function get_timezone_abbrev( $timezone_string ) {
646
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
647
-		$dateTime = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
648
-		return $dateTime->format( 'T' );
645
+	public function get_timezone_abbrev($timezone_string) {
646
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
647
+		$dateTime = new DateTime('now', new DateTimeZone($timezone_string));
648
+		return $dateTime->format('T');
649 649
 	}
650 650
 
651 651
 	/**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return 
654 654
 	 */
655 655
 	public function get_default_value() {
656
-		if( $this->_default_value === EE_Datetime_Field::now ) {
656
+		if ($this->_default_value === EE_Datetime_Field::now) {
657 657
 			return time();
658 658
 		} else {
659 659
 			return parent::get_default_value();
Please login to merge, or discard this patch.
core/db_models/EEM_Base.model.php 3 patches
Doc Comments   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	 * Returns the name of the field's name that points to the WP_User table
803 803
 	 *  on this model (or follows the _model_chain_to_wp_user and uses that model's
804 804
 	 * foreign key to the WP_User table)
805
-	 * @return string|boolean string on success, boolean false when there is no
805
+	 * @return string|false string on success, boolean false when there is no
806 806
 	 * foreign key to the WP_User table
807 807
 	 */
808 808
 	public function wp_user_field_name() {
@@ -897,6 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * If you would like to use these custom selections in WHERE, GROUP_BY, or HAVING clauses, you must instead provide an array.
898 898
 	 * Array keys are the aliases used to refer to this selection, and values are to be numerically-indexed arrays, where 0 is the selection
899 899
 	 * and 1 is the data type. Eg, array('count'=>array('COUNT(REG_ID)','%d'))
900
+	 * @param string $columns_to_select
900 901
 	 * @return array|stdClass[] like results of $wpdb->get_results($sql,OBJECT), (ie, output type is OBJECT)
901 902
 	 * @throws \EE_Error
902 903
 	 */
@@ -1242,7 +1243,7 @@  discard block
 block discarded – undo
1242 1243
 	 * @param bool   $pretty          Whether to return the pretty formats (true) or not (false).
1243 1244
 	 * @throws EE_Error   If the given field_name is not of the EE_Datetime_Field type.
1244 1245
 	 *
1245
-	 * @return array formats in an array with the date format first, and the time format last.
1246
+	 * @return string[] formats in an array with the date format first, and the time format last.
1246 1247
 	 */
1247 1248
 	public function get_formats_for( $field_name, $pretty = false ) {
1248 1249
 		$field_settings = $this->field_settings_for( $field_name );
@@ -1277,7 +1278,7 @@  discard block
 block discarded – undo
1277 1278
 	 *
1278 1279
 	 * @throws EE_Error   	If the given field_name is not of the EE_Datetime_Field type.
1279 1280
 	 *
1280
-	 * @return int|string  If the given field_name is not of the EE_Datetime_Field type, then an EE_Error
1281
+	 * @return string|null  If the given field_name is not of the EE_Datetime_Field type, then an EE_Error
1281 1282
 	 *                    	     exception is triggered.
1282 1283
 	 */
1283 1284
 	public function current_time_for_query( $field_name, $timestamp = false, $what = 'both' ) {
@@ -1588,7 +1589,7 @@  discard block
 block discarded – undo
1588 1589
 	 * Wrapper for EEM_Base::delete_permanently()
1589 1590
 	 *
1590 1591
 	 * @param mixed $id
1591
-	 * @return boolean whether the row got deleted or not
1592
+	 * @return integer whether the row got deleted or not
1592 1593
 	 * @throws \EE_Error
1593 1594
 	 */
1594 1595
 	public function delete_permanently_by_ID( $id ) {
@@ -1607,7 +1608,7 @@  discard block
 block discarded – undo
1607 1608
 	 * Wrapper for EEM_Base::delete()
1608 1609
 	 *
1609 1610
 	 * @param mixed $id
1610
-	 * @return boolean whether the row got deleted or not
1611
+	 * @return integer whether the row got deleted or not
1611 1612
 	 * @throws \EE_Error
1612 1613
 	 */
1613 1614
 	public function delete_by_ID( $id ){
@@ -2017,7 +2018,7 @@  discard block
 block discarded – undo
2017 2018
 	/**
2018 2019
 	 * Verifies the EE addons' database is up-to-date and records that we've done it on
2019 2020
 	 * EEM_Base::$_db_verification_level
2020
-	 * @param $wpdb_method
2021
+	 * @param string $wpdb_method
2021 2022
 	 * @param $arguments_to_provide
2022 2023
 	 * @return string
2023 2024
 	 */
@@ -2112,6 +2113,7 @@  discard block
 block discarded – undo
2112 2113
 	 * @return boolean of success
2113 2114
 	 * @throws \EE_Error
2114 2115
 	 * @param array  $where_query  This allows you to enter further query params for the relation to for relation to methods that allow you to further specify extra columns to join by (such as HABTM).  Keep in mind that the only acceptable query_params is strict "col" => "value" pairs because these will be inserted in any new rows created as well.
2116
+	 * @param EE_Base_Class $id_or_obj
2115 2117
 	 */
2116 2118
 	public function remove_relationship_to($id_or_obj,  $other_model_id_or_obj, $relationName, $where_query= array() ){
2117 2119
 		$relation_obj = $this->related_settings_for($relationName);
@@ -2121,7 +2123,7 @@  discard block
 block discarded – undo
2121 2123
 
2122 2124
 
2123 2125
 	/**
2124
-	 * @param mixed           $id_or_obj
2126
+	 * @param EE_Base_Class           $id_or_obj
2125 2127
 	 * @param string          $relationName
2126 2128
 	 * @param array           $where_query_params
2127 2129
 	 * @param EE_Base_Class[] objects to which relations were removed
@@ -2160,7 +2162,7 @@  discard block
 block discarded – undo
2160 2162
 	 * However, if the model objects can't be deleted because of blocking related model objects, then
2161 2163
 	 * they aren't deleted. (Unless the thing that would have been deleted can be soft-deleted, that still happens).
2162 2164
 	 *
2163
-	 * @param EE_Base_Class|int|string $id_or_obj
2165
+	 * @param EE_Base_Class $id_or_obj
2164 2166
 	 * @param string                   $model_name
2165 2167
 	 * @param array                    $query_params
2166 2168
 	 * @return int how many deleted
@@ -2180,7 +2182,7 @@  discard block
 block discarded – undo
2180 2182
 	 * the model objects can't be hard deleted because of blocking related model objects,
2181 2183
 	 * just does a soft-delete on them instead.
2182 2184
 	 *
2183
-	 * @param EE_Base_Class|int|string $id_or_obj
2185
+	 * @param EE_Base_Class $id_or_obj
2184 2186
 	 * @param string                   $model_name
2185 2187
 	 * @param array                    $query_params
2186 2188
 	 * @return int how many deleted
@@ -2229,6 +2231,7 @@  discard block
 block discarded – undo
2229 2231
 	 * @param string $model_name   like 'Event', or 'Registration'
2230 2232
 	 * @param array  $query_params like EEM_Base::get_all's
2231 2233
 	 * @param string $field_to_sum name of field to count by. By default, uses primary key
2234
+	 * @param EE_Base_Class $id_or_obj
2232 2235
 	 * @return float
2233 2236
 	 * @throws \EE_Error
2234 2237
 	 */
@@ -2638,7 +2641,7 @@  discard block
 block discarded – undo
2638 2641
 	/**
2639 2642
 	 * Finds all the fields that correspond to the given table
2640 2643
 	 * @param string $table_alias, array key in EEM_Base::_tables
2641
-	 * @return EE_Model_Field_Base[]
2644
+	 * @return EE_Model_Field_Base
2642 2645
 	 */
2643 2646
 	public function _get_fields_for_table($table_alias){
2644 2647
 		return $this->_fields[$table_alias];
@@ -3901,7 +3904,7 @@  discard block
 block discarded – undo
3901 3904
 	/**
3902 3905
 	 * gets the field object of type 'primary_key' from the fieldsSettings attribute.
3903 3906
 	 * Eg, on EE_Answer that would be ANS_ID field object
3904
-	 * @param $field_obj
3907
+	 * @param EE_Model_Field_Base $field_obj
3905 3908
 	 * @return boolean
3906 3909
 	 */
3907 3910
 	public function is_primary_key_field( $field_obj ){
@@ -3997,7 +4000,7 @@  discard block
 block discarded – undo
3997 4000
 	 * Gets the actual table for the table alias
3998 4001
 	 * @param string $table_alias eg Event, Event_Meta, Registration, Transaction, but maybe
3999 4002
 	 * a table alias with a model chain prefix, like 'Venue__Event_Venue___Event_Meta'. Either one works
4000
-	 * @return EE_Table_Base
4003
+	 * @return string
4001 4004
 	 */
4002 4005
 	public function get_table_for_alias($table_alias){
4003 4006
 		$table_alias_sans_model_relation_chain_prefix = EE_Model_Parser::remove_table_alias_model_relation_chain_prefix($table_alias);
@@ -4543,7 +4546,7 @@  discard block
 block discarded – undo
4543 4546
 	}
4544 4547
 	/**
4545 4548
 	 * Read comments for assume_values_already_prepared_by_model_object()
4546
-	 * @return int
4549
+	 * @return boolean
4547 4550
 	 */
4548 4551
 	public function get_assumption_concerning_values_already_prepared_by_model_object(){
4549 4552
 		return $this->_values_already_prepared_by_model_object;
Please login to merge, or discard this patch.
Indentation   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 	 * Gets all the EE_Base_Class objects which match the $query_params, by querying the DB.
654 654
 	 *
655 655
 	 * @param array $query_params {
656
-     *	@var array $0 (where) array {
656
+	 *	@var array $0 (where) array {
657 657
 	 *		eg: array('QST_display_text'=>'Are you bob?','QST_admin_text'=>'Determine if user is bob')
658
-			* becomes
658
+	 * becomes
659 659
 	 *		SQL >> "...WHERE QST_display_text = 'Are you bob?' AND QST_admin_text = 'Determine if user is bob'...")
660
-     *		To add WHERE conditions based on related models (and even models-related-to-related-models) prepend the model's name
660
+	 *		To add WHERE conditions based on related models (and even models-related-to-related-models) prepend the model's name
661 661
 	 *		onto the field name. Eg, EEM_Event::instance()->get_all(array(array('Venue.VNU_ID'=>12)));
662 662
 	 *		becomes
663 663
 	 *		SQL >> "SELECT * FROM wp_posts AS Event_CPT
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 *		SQL >> "...WHERE QST_display_text LIKE '%bob%' AND QST_ID < 34 AND QST_wp_user IN (1,2,7,23)...".
678 678
 	 *        Valid operators so far: =, !=, <, <=, >, >=, LIKE, NOT LIKE, IN (followed by numeric-indexed array),
679 679
 	 *          NOT IN (dido), BETWEEN (followed by an array with exactly 2 date strings), IS NULL, and IS NOT NULL
680
-     *		Values can be a string, int, or float. They can also be arrays IFF the operator is IN.
680
+	 *		Values can be a string, int, or float. They can also be arrays IFF the operator is IN.
681 681
 	 *        Also, values can actually be field names. To indicate the value is a field,
682 682
 	 *          simply provide a third array item (true) to the operator-value array like so:
683 683
 	 *		eg: array( 'DTT_reg_limit' => array('>', 'DTT_sold', TRUE) )
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 *		Note: you can also use related model field names like you would any other field name.
687 687
 	 *		eg: array('Datetime.DTT_reg_limit'=>array('=','Datetime.DTT_sold',TRUE)
688 688
 	 *		could be used if you were querying EEM_Tickets (because Datetime is directly related to tickets)
689
-     *		Also, by default all the where conditions are AND'd together.
689
+	 *		Also, by default all the where conditions are AND'd together.
690 690
 	 *		To override this, add an array key 'OR' (or 'AND') and the array to be OR'd together
691 691
 	 *		eg: array('OR'=>array('TXN_ID' => 23 , 'TXN_timestamp__>' => 345678912))
692 692
 	 *		becomes
@@ -701,17 +701,17 @@  discard block
 block discarded – undo
701 701
 	 *		eg array('OR'=>array('NOT'=>array('TXN_total' => 50, 'TXN_paid'=>23)),AND=>array('TXN_ID'=>1,'STS_ID'=>'TIN')
702 702
 	 *		becomes
703 703
 	 *		SQL >> "...where ! (TXN_total =50 OR TXN_paid =23) AND TXN_ID=1 AND STS_ID='TIN'"
704
-     *		They can be nested indefinitely.
704
+	 *		They can be nested indefinitely.
705 705
 	 *		eg: array('OR'=>array('TXN_total' => 23, 'NOT'=> array( 'TXN_timestamp'=> 345678912, 'AND'=>array('TXN_paid' => 53, 'STS_ID' => 'TIN'))))
706 706
 	 *		becomes
707 707
 	 *		SQL >> "...WHERE TXN_total = 23 OR ! (TXN_timestamp = 345678912 OR (TXN_paid = 53 AND STS_ID = 'TIN'))..."
708
-     *		GOTCHA:
708
+	 *		GOTCHA:
709 709
 	 *		because this is an array, array keys must be unique, making it impossible to place two or more where conditions applying to the same field.
710 710
 	 *		eg: array('PAY_timestamp'=>array('>',$start_date),'PAY_timestamp'=>array('<',$end_date),'PAY_timestamp'=>array('!=',$special_date)),
711 711
 	 *		as PHP enforces that the array keys must be unique, thus removing the first two array entries with key 'PAY_timestamp'.
712 712
 	 *		becomes
713 713
 	 *		SQL >> "PAY_timestamp !=  4234232", ignoring the first two PAY_timestamp conditions).
714
-     *		To overcome this, you can add a '*' character to the end of the field's name, followed by anything.
714
+	 *		To overcome this, you can add a '*' character to the end of the field's name, followed by anything.
715 715
 	 *		These will be removed when generating the SQL string, but allow for the array keys to be unique.
716 716
 	 *		eg: you could rewrite the previous query as:
717 717
 	 *		array('PAY_timestamp'=>array('>',$start_date),'PAY_timestamp*1st'=>array('<',$end_date),'PAY_timestamp*2nd'=>array('!=',$special_date))
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 *		You will probably only want to do this in hopes of increasing efficiency, as related models which belongs to the current model
745 745
 	 *		(ie, the current model has a foreign key to them, like how Registration belongs to Attendee) can be cached in order
746 746
 	 *		to avoid future queries
747
-     *	@var string $default_where_conditions can be set to 'none', 'this_model_only', 'other_models_only', or 'all'. set this to 'none' to disable all default where conditions. Eg, usually soft-deleted objects are filtered-out
747
+	 *	@var string $default_where_conditions can be set to 'none', 'this_model_only', 'other_models_only', or 'all'. set this to 'none' to disable all default where conditions. Eg, usually soft-deleted objects are filtered-out
748 748
 	 *		if you want to include them, set this query param to 'none'. If you want to ONLY disable THIS model's default where conditions
749 749
 	 *		set it to 'other_models_only'. If you only want this model's default where conditions added to the query, use 'this_model_only'.
750 750
 	 *		If you want to use all default where conditions (default), set to 'all'.
@@ -1014,7 +1014,6 @@  discard block
 block discarded – undo
1014 1014
 	/**
1015 1015
 	 * Gets a single item for this model from the DB, given the $query_params. Only returns a single class, not an array. If no item is found,
1016 1016
 	 * null is returned.
1017
-
1018 1017
 	 *
1019 1018
 *@param array $query_params like EEM_Base's $query_params variable.
1020 1019
 	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL
@@ -1117,7 +1116,7 @@  discard block
 block discarded – undo
1117 1116
 	 *                                      can indicate just the columns you
1118 1117
 	 *                                      want and a single array indexed by
1119 1118
 	 *                                      the columns will be returned.
1120
- * @return EE_Base_Class|null|array()
1119
+	 * @return EE_Base_Class|null|array()
1121 1120
 	 * @throws EE_Error
1122 1121
 	 */
1123 1122
 	public function previous( $current_field_value, $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
@@ -1765,7 +1764,7 @@  discard block
 block discarded – undo
1765 1764
 				//make sure there's no related objects blocking its deletion (if we're checking)
1766 1765
 				if (
1767 1766
 					$allow_blocking
1768
-				    && $this->delete_is_blocked_by_related_models(
1767
+					&& $this->delete_is_blocked_by_related_models(
1769 1768
 						$delete_object[ $primary_table->get_fully_qualified_pk_column() ]
1770 1769
 					)
1771 1770
 				) {
@@ -1813,8 +1812,8 @@  discard block
 block discarded – undo
1813 1812
 				foreach($fields as $cpk_field){
1814 1813
 					if ( $cpk_field instanceof EE_Model_Field_Base ){
1815 1814
 						$values_for_each_cpk_for_a_row[] = $cpk_field->get_qualified_column()
1816
-						                                   . "="
1817
-						                                   . $delete_object[ $cpk_field->get_qualified_column() ];
1815
+														   . "="
1816
+														   . $delete_object[ $cpk_field->get_qualified_column() ];
1818 1817
 					}
1819 1818
 				}
1820 1819
 				$ways_to_identify_a_row[] = "(".implode(" AND ",$values_for_each_cpk_for_a_row).")";
@@ -2930,8 +2929,8 @@  discard block
 block discarded – undo
2930 2929
 		}
2931 2930
 		//if 'order_by' wasn't set, maybe they are just using 'order' on its own?
2932 2931
 		if ( ! array_key_exists( 'order_by', $query_params )
2933
-		     && array_key_exists( 'order', $query_params )
2934
-		     && ! empty( $query_params['order'] )
2932
+			 && array_key_exists( 'order', $query_params )
2933
+			 && ! empty( $query_params['order'] )
2935 2934
 		) {
2936 2935
 			$pk_field = $this->get_primary_key_field();
2937 2936
 			$order = $this->_extract_order( $query_params['order'] );
@@ -4469,7 +4468,7 @@  discard block
 block discarded – undo
4469 4468
 				$model_object = $this->get_one_by_ID( $base_class_obj_or_id );
4470 4469
 			} else if (
4471 4470
 				$primary_key_field instanceof EE_Primary_Key_String_Field
4472
-			    && is_string( $base_class_obj_or_id )
4471
+				&& is_string( $base_class_obj_or_id )
4473 4472
 			) {
4474 4473
 				// assume its a string representation of the object
4475 4474
 				$model_object = $this->get_one_by_ID( $base_class_obj_or_id );
Please login to merge, or discard this patch.
Spacing   +976 added lines, -976 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * Flag indicating whether this model has a primary key or not
246 246
 	 * @var boolean
247 247
 	 */
248
-	protected $_has_primary_key_field=null;
248
+	protected $_has_primary_key_field = null;
249 249
 
250 250
 	/**
251 251
 	 * Whether or not this model is based off a table in WP core only (CPTs should set
@@ -307,19 +307,19 @@  discard block
 block discarded – undo
307 307
 	 * operators that work like 'BETWEEN'.  Typically used for datetime calculations, i.e. "BETWEEN '12-1-2011' AND '12-31-2012'"
308 308
 	 * @var array
309 309
 	 */
310
-	protected $_between_style_operators = array( 'BETWEEN' );
310
+	protected $_between_style_operators = array('BETWEEN');
311 311
 
312 312
 	/**
313 313
 	 * operators that are used for handling NUll and !NULL queries.  Typically used for when checking if a row exists on a join table.
314 314
 	 * @var array
315 315
 	 */
316
-	protected $_null_style_operators = array( 'IS NOT NULL', 'IS NULL');
316
+	protected $_null_style_operators = array('IS NOT NULL', 'IS NULL');
317 317
 
318 318
 	/**
319 319
 	 * Allowed values for $query_params['order'] for ordering in queries
320 320
 	 * @var array
321 321
 	 */
322
-	protected $_allowed_order_values = array('asc','desc','ASC','DESC');
322
+	protected $_allowed_order_values = array('asc', 'desc', 'ASC', 'DESC');
323 323
 
324 324
 	/**
325 325
 	 * When these are keys in a WHERE or HAVING clause, they are handled much differently
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
 	 * 'where', but 'where' clauses are so common that we thought we'd omit it
334 334
 	 * @var array
335 335
 	 */
336
-	private $_allowed_query_params = array(0, 'limit','order_by','group_by','having','force_join','order','on_join_limit','default_where_conditions', 'caps');
336
+	private $_allowed_query_params = array(0, 'limit', 'order_by', 'group_by', 'having', 'force_join', 'order', 'on_join_limit', 'default_where_conditions', 'caps');
337 337
 
338 338
 	/**
339 339
 	 * All the data types that can be used in $wpdb->prepare statements.
340 340
 	 * @var array
341 341
 	 */
342
-	private $_valid_wpdb_data_types = array('%d','%s','%f');
342
+	private $_valid_wpdb_data_types = array('%d', '%s', '%f');
343 343
 
344 344
 	/**
345 345
 	 * 	EE_Registry Object
@@ -372,17 +372,17 @@  discard block
 block discarded – undo
372 372
 	/**
373 373
 	 * constant used to show EEM_Base has not yet verified the db on this http request
374 374
 	 */
375
-	const db_verified_none 		= 0;
375
+	const db_verified_none = 0;
376 376
 	/**
377 377
 	 * constant used to show EEM_Base has verified the EE core db on this http request,
378 378
 	 * but not the addons' dbs
379 379
 	 */
380
-	const db_verified_core 		= 1;
380
+	const db_verified_core = 1;
381 381
 	/**
382 382
 	 * constant used to show EEM_Base has verified the addons' dbs (and implicitly
383 383
 	 * the EE core db too)
384 384
 	 */
385
-	const db_verified_addons 	= 2;
385
+	const db_verified_addons = 2;
386 386
 
387 387
 	/**
388 388
 	 * indicates whether an EEM_Base child has already re-verified the DB
@@ -413,13 +413,13 @@  discard block
 block discarded – undo
413 413
 	 * @param null $timezone
414 414
 	 * @throws \EE_Error
415 415
 	 */
416
-	protected function __construct( $timezone = NULL ){
416
+	protected function __construct($timezone = NULL) {
417 417
 		// check that the model has not been loaded too soon
418
-		if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' )) {
419
-			throw new EE_Error (
418
+		if ( ! did_action('AHEE__EE_System__load_espresso_addons')) {
419
+			throw new EE_Error(
420 420
 				sprintf(
421
-					__( 'The %1$s model can not be loaded before the "AHEE__EE_System__load_espresso_addons" hook has been called. This gives other addons a chance to extend this model.', 'event_espresso' ),
422
-					get_class( $this )
421
+					__('The %1$s model can not be loaded before the "AHEE__EE_System__load_espresso_addons" hook has been called. This gives other addons a chance to extend this model.', 'event_espresso'),
422
+					get_class($this)
423 423
 				)
424 424
 			);
425 425
 		}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		/**
428 428
 		 * Set blogid for models to current blog. However we ONLY do this if $_model_query_blog_id is not already set.
429 429
 		 */
430
-		if ( empty( EEM_Base::$_model_query_blog_id ) ) {
430
+		if (empty(EEM_Base::$_model_query_blog_id)) {
431 431
 			EEM_Base::set_model_query_blog_id();
432 432
 		}
433 433
 
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 		 * just use EE_Register_Model_Extension
437 437
 		 * @var EE_Table_Base[] $_tables
438 438
 		 */
439
-		$this->_tables = apply_filters( 'FHEE__'.get_class($this).'__construct__tables', $this->_tables );
440
-		foreach($this->_tables as $table_alias => $table_obj){
439
+		$this->_tables = apply_filters('FHEE__'.get_class($this).'__construct__tables', $this->_tables);
440
+		foreach ($this->_tables as $table_alias => $table_obj) {
441 441
 			/** @var $table_obj EE_Table_Base */
442 442
 			$table_obj->_construct_finalize_with_alias($table_alias);
443
-			if( $table_obj instanceof EE_Secondary_Table ){
443
+			if ($table_obj instanceof EE_Secondary_Table) {
444 444
 				/** @var $table_obj EE_Secondary_Table */
445 445
 				$table_obj->_construct_finalize_set_table_to_join_with($this->_get_main_table());
446 446
 			}
@@ -450,54 +450,54 @@  discard block
 block discarded – undo
450 450
 		 * EE_Register_Model_Extension
451 451
 		 * @param EE_Model_Field_Base[] $_fields
452 452
 		 */
453
-		$this->_fields = apply_filters('FHEE__'.get_class($this).'__construct__fields',$this->_fields);
453
+		$this->_fields = apply_filters('FHEE__'.get_class($this).'__construct__fields', $this->_fields);
454 454
 		$this->_invalidate_field_caches();
455
-		foreach($this->_fields as $table_alias => $fields_for_table){
456
-			if ( ! array_key_exists( $table_alias, $this->_tables )){
457
-				throw new EE_Error(sprintf(__("Table alias %s does not exist in EEM_Base child's _tables array. Only tables defined are %s",'event_espresso'),$table_alias,implode(",",$this->_fields)));
455
+		foreach ($this->_fields as $table_alias => $fields_for_table) {
456
+			if ( ! array_key_exists($table_alias, $this->_tables)) {
457
+				throw new EE_Error(sprintf(__("Table alias %s does not exist in EEM_Base child's _tables array. Only tables defined are %s", 'event_espresso'), $table_alias, implode(",", $this->_fields)));
458 458
 			}
459
-			foreach($fields_for_table as $field_name => $field_obj){
459
+			foreach ($fields_for_table as $field_name => $field_obj) {
460 460
 				/** @var $field_obj EE_Model_Field_Base | EE_Primary_Key_Field_Base */
461 461
 				//primary key field base has a slightly different _construct_finalize
462 462
 				/** @var $field_obj EE_Model_Field_Base */
463
-				$field_obj->_construct_finalize( $table_alias, $field_name, $this->get_this_model_name() );
463
+				$field_obj->_construct_finalize($table_alias, $field_name, $this->get_this_model_name());
464 464
 			}
465 465
 		}
466 466
 
467 467
 		// everything is related to Extra_Meta
468
-		if( get_class($this) !== 'EEM_Extra_Meta'){
468
+		if (get_class($this) !== 'EEM_Extra_Meta') {
469 469
 			//make extra meta related to everything, but don't block deleting things just
470 470
 			//because they have related extra meta info. For now just orphan those extra meta
471 471
 			//in the future we should automatically delete them
472
-			$this->_model_relations['Extra_Meta'] = new EE_Has_Many_Any_Relation( FALSE );
472
+			$this->_model_relations['Extra_Meta'] = new EE_Has_Many_Any_Relation(FALSE);
473 473
 		}
474 474
 		//and change logs
475
-		if( get_class( $this) !==  'EEM_Change_Log' ) {
476
-			$this->_model_relations[ 'Change_Log' ] = new EE_Has_Many_Any_Relation( FALSE );
475
+		if (get_class($this) !== 'EEM_Change_Log') {
476
+			$this->_model_relations['Change_Log'] = new EE_Has_Many_Any_Relation(FALSE);
477 477
 		}
478 478
 		/**
479 479
 		 * Filters the list of relations on a model. It is best to NOT use this directly and instead just use
480 480
 		 * EE_Register_Model_Extension
481 481
 		 * @param EE_Model_Relation_Base[] $_model_relations
482 482
 		 */
483
-		$this->_model_relations = apply_filters('FHEE__'.get_class($this).'__construct__model_relations',$this->_model_relations);
484
-		foreach($this->_model_relations as $model_name => $relation_obj){
483
+		$this->_model_relations = apply_filters('FHEE__'.get_class($this).'__construct__model_relations', $this->_model_relations);
484
+		foreach ($this->_model_relations as $model_name => $relation_obj) {
485 485
 			/** @var $relation_obj EE_Model_Relation_Base */
486 486
 			$relation_obj->_construct_finalize_set_models($this->get_this_model_name(), $model_name);
487 487
 		}
488
-		foreach($this->_indexes as $index_name => $index_obj){
488
+		foreach ($this->_indexes as $index_name => $index_obj) {
489 489
 			/** @var $index_obj EE_Index */
490 490
 			$index_obj->_construct_finalize($index_name, $this->get_this_model_name());
491 491
 		}
492 492
 
493 493
 		$this->set_timezone($timezone);
494 494
 		//finalize default where condition strategy, or set default
495
-		if( ! $this->_default_where_conditions_strategy){
495
+		if ( ! $this->_default_where_conditions_strategy) {
496 496
 			//nothing was set during child constructor, so set default
497 497
 			$this->_default_where_conditions_strategy = new EE_Default_Where_Conditions();
498 498
 		}
499 499
 		$this->_default_where_conditions_strategy->_finalize_construct($this);
500
-		if( ! $this->_minimum_where_conditions_strategy){
500
+		if ( ! $this->_minimum_where_conditions_strategy) {
501 501
 			//nothing was set during child constructor, so set default
502 502
 			$this->_minimum_where_conditions_strategy = new EE_Default_Where_Conditions();
503 503
 		}
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 		//if the cap slug hasn't been set, and we haven't set it to false on purpose
507 507
 		//to indicate to NOT set it, set it to the logical default
508
-		if( $this->_caps_slug === null ) {
509
-			$this->_caps_slug = EEH_Inflector::pluralize_and_lower( $this->get_this_model_name() );
508
+		if ($this->_caps_slug === null) {
509
+			$this->_caps_slug = EEH_Inflector::pluralize_and_lower($this->get_this_model_name());
510 510
 		}
511 511
 		//initialize the standard cap restriction generators if none were specified by the child constructor
512
-		if( $this->_cap_restriction_generators !== false ){
513
-			foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ){
514
-				if( ! isset( $this->_cap_restriction_generators[ $cap_context ] ) ) {
515
-					$this->_cap_restriction_generators[ $cap_context ] = apply_filters(
512
+		if ($this->_cap_restriction_generators !== false) {
513
+			foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
514
+				if ( ! isset($this->_cap_restriction_generators[$cap_context])) {
515
+					$this->_cap_restriction_generators[$cap_context] = apply_filters(
516 516
 						'FHEE__EEM_Base___construct__standard_cap_restriction_generator',
517 517
 						new EE_Restriction_Generator_Protected(),
518 518
 						$cap_context,
@@ -522,23 +522,23 @@  discard block
 block discarded – undo
522 522
 			}
523 523
 		}
524 524
 		//if there are cap restriction generators, use them to make the default cap restrictions
525
-		if( $this->_cap_restriction_generators !== false ){
526
-			foreach( $this->_cap_restriction_generators as $context => $generator_object ) {
527
-				if( ! $generator_object ){
525
+		if ($this->_cap_restriction_generators !== false) {
526
+			foreach ($this->_cap_restriction_generators as $context => $generator_object) {
527
+				if ( ! $generator_object) {
528 528
 					continue;
529 529
 				}
530
-				if( ! $generator_object instanceof EE_Restriction_Generator_Base ){
530
+				if ( ! $generator_object instanceof EE_Restriction_Generator_Base) {
531 531
 					throw new EE_Error(
532 532
 						sprintf(
533
-							__( 'Index "%1$s" in the model %2$s\'s _cap_restriction_generators is not a child of EE_Restriction_Generator_Base. It should be that or NULL.', 'event_espresso' ),
533
+							__('Index "%1$s" in the model %2$s\'s _cap_restriction_generators is not a child of EE_Restriction_Generator_Base. It should be that or NULL.', 'event_espresso'),
534 534
 							$context,
535 535
 							$this->get_this_model_name()
536 536
 						)
537 537
 					);
538 538
 				}
539
-				$action = $this->cap_action_for_context( $context );
540
-				if( ! $generator_object->construction_finalized() ){
541
-					$generator_object->_construct_finalize( $this, $action );
539
+				$action = $this->cap_action_for_context($context);
540
+				if ( ! $generator_object->construction_finalized()) {
541
+					$generator_object->_construct_finalize($this, $action);
542 542
 				}
543 543
 
544 544
 			}
@@ -552,11 +552,11 @@  discard block
 block discarded – undo
552 552
 	 * @param string $context one of EEM_Base::valid_cap_contexts()
553 553
 	 * @return EE_Default_Where_Conditions[]
554 554
 	 */
555
-	protected function _generate_cap_restrictions( $context ){
556
-		if( isset( $this->_cap_restriction_generators[ $context ] ) &&
557
-				$this->_cap_restriction_generators[ $context ] instanceof EE_Restriction_Generator_Base ) {
558
-			return $this->_cap_restriction_generators[ $context ]->generate_restrictions();
559
-		}else{
555
+	protected function _generate_cap_restrictions($context) {
556
+		if (isset($this->_cap_restriction_generators[$context]) &&
557
+				$this->_cap_restriction_generators[$context] instanceof EE_Restriction_Generator_Base) {
558
+			return $this->_cap_restriction_generators[$context]->generate_restrictions();
559
+		} else {
560 560
 			return array();
561 561
 		}
562 562
 	}
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	 * @param int $blog_id  If provided then will set the blog_id for the models to this id.  If not provided then the
569 569
 	 *                      value for get_current_blog_id() will be used.
570 570
 	 */
571
-	public static function set_model_query_blog_id( $blog_id = 0 ) {
571
+	public static function set_model_query_blog_id($blog_id = 0) {
572 572
 		EEM_Base::$_model_query_blog_id = $blog_id > 0 ? (int) $blog_id : get_current_blog_id();
573 573
 	}
574 574
 
@@ -593,16 +593,16 @@  discard block
 block discarded – undo
593 593
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
594 594
 	 *		@return static (as in the concrete child class)
595 595
 	 */
596
-	public static function instance( $timezone = NULL ){
596
+	public static function instance($timezone = NULL) {
597 597
 
598 598
 		// check if instance of Espresso_model already exists
599 599
 		if ( ! static::$_instance instanceof static) {
600 600
 			// instantiate Espresso_model
601
-			static::$_instance = new static( $timezone );
601
+			static::$_instance = new static($timezone);
602 602
 		}
603 603
 
604 604
 		//we might have a timezone set, let set_timezone decide what to do with it
605
-		static::$_instance->set_timezone( $timezone );
605
+		static::$_instance->set_timezone($timezone);
606 606
 
607 607
 		// Espresso_model object
608 608
 		return static::$_instance;
@@ -615,14 +615,14 @@  discard block
 block discarded – undo
615 615
 	 * @param null | string $timezone
616 616
 	 * @return static
617 617
 	 */
618
-	public static function reset(  $timezone = NULL ){
619
-		if ( ! is_null( static::$_instance ) ) {
620
-			$model = 'EEM_' . self::instance()->get_this_model_name();
621
-			if ( isset( EE_Registry::instance()->LIB->{$model} ) ) {
618
+	public static function reset($timezone = NULL) {
619
+		if ( ! is_null(static::$_instance)) {
620
+			$model = 'EEM_'.self::instance()->get_this_model_name();
621
+			if (isset(EE_Registry::instance()->LIB->{$model} )) {
622 622
 				EE_Registry::instance()->LIB->{$model} = null;
623 623
 			}
624 624
 			static::$_instance = null;
625
-			return self::instance( $timezone );
625
+			return self::instance($timezone);
626 626
 		}
627 627
 		return null;
628 628
 	}
@@ -636,19 +636,19 @@  discard block
 block discarded – undo
636 636
 	 * @return array
637 637
 	 * @throws \EE_Error
638 638
 	 */
639
-	 public function status_array( $translated = FALSE ) {
640
-		 if ( ! array_key_exists( 'Status', $this->_model_relations ) ) {
639
+	 public function status_array($translated = FALSE) {
640
+		 if ( ! array_key_exists('Status', $this->_model_relations)) {
641 641
 			 return array();
642 642
 		 }
643 643
 		 $model_name = $this->get_this_model_name();
644
-		 $status_type = str_replace( ' ', '_', strtolower( str_replace( '_', ' ', $model_name ) ) );
645
-		 $stati = EEM_Status::instance()->get_all( array( array( 'STS_type' => $status_type ) ) );
644
+		 $status_type = str_replace(' ', '_', strtolower(str_replace('_', ' ', $model_name)));
645
+		 $stati = EEM_Status::instance()->get_all(array(array('STS_type' => $status_type)));
646 646
 		 $status_array = array();
647
-		 foreach ( $stati as $status ) {
648
-			 $status_array[ $status->ID() ] = $status->get( 'STS_code' );
647
+		 foreach ($stati as $status) {
648
+			 $status_array[$status->ID()] = $status->get('STS_code');
649 649
 		 }
650 650
 		 return $translated
651
-			 ? EEM_Status::instance()->localized_status( $status_array, false, 'sentence' )
651
+			 ? EEM_Status::instance()->localized_status($status_array, false, 'sentence')
652 652
 			 : $status_array;
653 653
 	 }
654 654
 
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
 	 *		));
782 782
 	 * @throws \EE_Error
783 783
 	 */
784
-	public function get_all($query_params = array()){
785
-		if( isset( $query_params[ 'limit' ] )
786
-			&& ! isset( $query_params[ 'group_by' ] ) ) {
787
-			$query_params[ 'group_by' ] = array_keys( $this->get_combined_primary_key_fields() );
784
+	public function get_all($query_params = array()) {
785
+		if (isset($query_params['limit'])
786
+			&& ! isset($query_params['group_by'])) {
787
+			$query_params['group_by'] = array_keys($this->get_combined_primary_key_fields());
788 788
 		}
789 789
 		return $this->_create_objects($this->_get_all_wpdb_results($query_params, ARRAY_A, NULL));
790 790
 	}
@@ -795,10 +795,10 @@  discard block
 block discarded – undo
795 795
 	 * @param array $query_params @see EEM_Base::get_all()
796 796
 	 * @return array like EEM_Base::get_all
797 797
 	 */
798
-	public function alter_query_params_to_only_include_mine( $query_params = array() ) {
798
+	public function alter_query_params_to_only_include_mine($query_params = array()) {
799 799
 		$wp_user_field_name = $this->wp_user_field_name();
800
-		if( $wp_user_field_name ){
801
-			$query_params[0][ $wp_user_field_name ] = get_current_user_id();
800
+		if ($wp_user_field_name) {
801
+			$query_params[0][$wp_user_field_name] = get_current_user_id();
802 802
 		}
803 803
 		return $query_params;
804 804
 	}
@@ -811,19 +811,19 @@  discard block
 block discarded – undo
811 811
 	 * foreign key to the WP_User table
812 812
 	 */
813 813
 	public function wp_user_field_name() {
814
-		try{
815
-			if( ! empty( $this->_model_chain_to_wp_user ) ) {
816
-				$models_to_follow_to_wp_users = explode( '.', $this->_model_chain_to_wp_user );
817
-				$last_model_name = end( $models_to_follow_to_wp_users );
818
-				$model_with_fk_to_wp_users = EE_Registry::instance()->load_model( $last_model_name );
819
-				$model_chain_to_wp_user = $this->_model_chain_to_wp_user . '.';
820
-			}else{
814
+		try {
815
+			if ( ! empty($this->_model_chain_to_wp_user)) {
816
+				$models_to_follow_to_wp_users = explode('.', $this->_model_chain_to_wp_user);
817
+				$last_model_name = end($models_to_follow_to_wp_users);
818
+				$model_with_fk_to_wp_users = EE_Registry::instance()->load_model($last_model_name);
819
+				$model_chain_to_wp_user = $this->_model_chain_to_wp_user.'.';
820
+			} else {
821 821
 				$model_with_fk_to_wp_users = $this;
822 822
 				$model_chain_to_wp_user = '';
823 823
 			}
824
-			$wp_user_field = $model_with_fk_to_wp_users->get_foreign_key_to( 'WP_User' );
825
-			return $model_chain_to_wp_user . $wp_user_field->get_name();
826
-		}catch( EE_Error $e ) {
824
+			$wp_user_field = $model_with_fk_to_wp_users->get_foreign_key_to('WP_User');
825
+			return $model_chain_to_wp_user.$wp_user_field->get_name();
826
+		} catch (EE_Error $e) {
827 827
 			return false;
828 828
 		}
829 829
 	}
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 * (or transiently-related model)
838 838
 	 * @return string
839 839
 	 */
840
-	public function model_chain_to_wp_user(){
840
+	public function model_chain_to_wp_user() {
841 841
 		return $this->_model_chain_to_wp_user;
842 842
 	}
843 843
 
@@ -849,13 +849,13 @@  discard block
 block discarded – undo
849 849
 	 * @return boolean
850 850
 	 */
851 851
 	public function is_owned() {
852
-		if( $this->model_chain_to_wp_user() ){
852
+		if ($this->model_chain_to_wp_user()) {
853 853
 			return true;
854
-		}else{
855
-			try{
856
-				$this->get_foreign_key_to( 'WP_User' );
854
+		} else {
855
+			try {
856
+				$this->get_foreign_key_to('WP_User');
857 857
 				return true;
858
-			}catch( EE_Error $e ){
858
+			} catch (EE_Error $e) {
859 859
 				return false;
860 860
 			}
861 861
 		}
@@ -877,17 +877,17 @@  discard block
 block discarded – undo
877 877
 	 * @return array | stdClass[] like results of $wpdb->get_results($sql,OBJECT), (ie, output type is OBJECT)
878 878
 	 * @throws \EE_Error
879 879
 	 */
880
-	protected function  _get_all_wpdb_results($query_params = array(), $output = ARRAY_A, $columns_to_select = null){
880
+	protected function  _get_all_wpdb_results($query_params = array(), $output = ARRAY_A, $columns_to_select = null) {
881 881
 		// remember the custom selections, if any, and type cast as array
882 882
 		// (unless $columns_to_select is an object, then just set as an empty array)
883 883
 		// Note: (array) 'some string' === array( 'some string' )
884
-		$this->_custom_selections = ! is_object( $columns_to_select ) ? (array) $columns_to_select : array();
885
-		$model_query_info = $this->_create_model_query_info_carrier( $query_params );
884
+		$this->_custom_selections = ! is_object($columns_to_select) ? (array) $columns_to_select : array();
885
+		$model_query_info = $this->_create_model_query_info_carrier($query_params);
886 886
 		$select_expressions = $columns_to_select !== null
887
-			? $this->_construct_select_from_input( $columns_to_select )
888
-			: $this->_construct_default_select_sql( $model_query_info );
889
-		$SQL = "SELECT $select_expressions " . $this->_construct_2nd_half_of_select_query( $model_query_info );
890
-		return $this->_do_wpdb_query( 'get_results', array( $SQL, $output ) );
887
+			? $this->_construct_select_from_input($columns_to_select)
888
+			: $this->_construct_default_select_sql($model_query_info);
889
+		$SQL = "SELECT $select_expressions ".$this->_construct_2nd_half_of_select_query($model_query_info);
890
+		return $this->_do_wpdb_query('get_results', array($SQL, $output));
891 891
 	}
892 892
 
893 893
 	/**
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 	 * @return array|stdClass[] like results of $wpdb->get_results($sql,OBJECT), (ie, output type is OBJECT)
906 906
 	 * @throws \EE_Error
907 907
 	 */
908
-	public function  get_all_wpdb_results($query_params = array(), $output = ARRAY_A, $columns_to_select = null){
908
+	public function  get_all_wpdb_results($query_params = array(), $output = ARRAY_A, $columns_to_select = null) {
909 909
 		return $this->_get_all_wpdb_results($query_params, $output, $columns_to_select);
910 910
 	}
911 911
 
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
 	 * @throws EE_Error
918 918
 	 * @return string
919 919
 	 */
920
-	private function _construct_select_from_input($columns_to_select){
921
-		if(is_array($columns_to_select)){
920
+	private function _construct_select_from_input($columns_to_select) {
921
+		if (is_array($columns_to_select)) {
922 922
 			$select_sql_array = array();
923 923
 
924
-			foreach($columns_to_select as $alias => $selection_and_datatype){
925
-				if( ! is_array($selection_and_datatype) || ! isset($selection_and_datatype[1])){
924
+			foreach ($columns_to_select as $alias => $selection_and_datatype) {
925
+				if ( ! is_array($selection_and_datatype) || ! isset($selection_and_datatype[1])) {
926 926
 					throw new EE_Error(
927 927
 						sprintf(
928 928
 							__(
@@ -934,24 +934,24 @@  discard block
 block discarded – undo
934 934
 						)
935 935
 					);
936 936
 				}
937
-				if( ! in_array( $selection_and_datatype[1],$this->_valid_wpdb_data_types)){
937
+				if ( ! in_array($selection_and_datatype[1], $this->_valid_wpdb_data_types)) {
938 938
 					throw new EE_Error(
939 939
 						sprintf(
940 940
 							__(
941 941
 								"Datatype %s (for selection '%s' and alias '%s') is not a valid wpdb datatype (eg %%s)",
942 942
 								"event_espresso"
943 943
 							),
944
-							$selection_and_datatype[ 1 ],
945
-							$selection_and_datatype[ 0 ],
944
+							$selection_and_datatype[1],
945
+							$selection_and_datatype[0],
946 946
 							$alias,
947
-							implode( ",", $this->_valid_wpdb_data_types )
947
+							implode(",", $this->_valid_wpdb_data_types)
948 948
 						)
949 949
 					);
950 950
 				}
951 951
 				$select_sql_array[] = "{$selection_and_datatype[0]} AS $alias";
952 952
 			}
953
-			$columns_to_select_string = implode(", ",$select_sql_array);
954
-		}else{
953
+			$columns_to_select_string = implode(", ", $select_sql_array);
954
+		} else {
955 955
 			$columns_to_select_string = $columns_to_select;
956 956
 		}
957 957
 		return $columns_to_select_string;
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 	 * @return string
967 967
 	 * @throws \EE_Error
968 968
 	 */
969
-	public function primary_key_name(){
969
+	public function primary_key_name() {
970 970
 		return $this->get_primary_key_field()->get_name();
971 971
 	}
972 972
 
@@ -978,14 +978,14 @@  discard block
 block discarded – undo
978 978
 	 * @param mixed $id int or string, depending on the type of the model's primary key
979 979
 	 * @return EE_Base_Class
980 980
 	 */
981
-	public function get_one_by_ID($id){
982
-		if( $this->get_from_entity_map( $id ) ){
983
-			return $this->get_from_entity_map( $id );
981
+	public function get_one_by_ID($id) {
982
+		if ($this->get_from_entity_map($id)) {
983
+			return $this->get_from_entity_map($id);
984 984
 		}
985 985
 		return $this->get_one(
986 986
 			$this->alter_query_params_to_restrict_by_ID(
987 987
 				$id,
988
-				array( 'default_where_conditions' => 'minimum' )
988
+				array('default_where_conditions' => 'minimum')
989 989
 			)
990 990
 		);
991 991
 	}
@@ -1001,15 +1001,15 @@  discard block
 block discarded – undo
1001 1001
 	 * @return array of normal query params, @see EEM_Base::get_all
1002 1002
 	 * @throws \EE_Error
1003 1003
 	 */
1004
-	public function alter_query_params_to_restrict_by_ID( $id, $query_params = array() ) {
1005
-		if( ! isset( $query_params[ 0 ] ) ) {
1006
-			$query_params[ 0 ] = array();
1004
+	public function alter_query_params_to_restrict_by_ID($id, $query_params = array()) {
1005
+		if ( ! isset($query_params[0])) {
1006
+			$query_params[0] = array();
1007 1007
 		}
1008
-		if( $this->has_primary_key_field ( ) ) {
1009
-			$query_params[ 0 ][ $this->primary_key_name() ] = $id ;
1010
-		}else{
1008
+		if ($this->has_primary_key_field( )) {
1009
+			$query_params[0][$this->primary_key_name()] = $id;
1010
+		} else {
1011 1011
 			//no primary key, so the $id must be from the get_index_primary_key_string()
1012
-			$query_params[0] = array_replace_recursive( $query_params[ 0 ], $this->parse_index_primary_key_string( $id ) );
1012
+			$query_params[0] = array_replace_recursive($query_params[0], $this->parse_index_primary_key_string($id));
1013 1013
 		}
1014 1014
 		return $query_params;
1015 1015
 	}
@@ -1025,16 +1025,16 @@  discard block
 block discarded – undo
1025 1025
 	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL
1026 1026
 	 * @throws \EE_Error
1027 1027
 	 */
1028
-	public function get_one($query_params = array()){
1029
-		if( ! is_array( $query_params ) ){
1030
-			EE_Error::doing_it_wrong('EEM_Base::get_one', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
1028
+	public function get_one($query_params = array()) {
1029
+		if ( ! is_array($query_params)) {
1030
+			EE_Error::doing_it_wrong('EEM_Base::get_one', sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), gettype($query_params)), '4.6.0');
1031 1031
 			$query_params = array();
1032 1032
 		}
1033 1033
 		$query_params['limit'] = 1;
1034 1034
 		$items = $this->get_all($query_params);
1035
-		if(empty($items)){
1035
+		if (empty($items)) {
1036 1036
 			return null;
1037
-		}else{
1037
+		} else {
1038 1038
 			return array_shift($items);
1039 1039
 		}
1040 1040
 	}
@@ -1057,8 +1057,8 @@  discard block
 block discarded – undo
1057 1057
 	 * @return EE_Base_Class[]|array
1058 1058
 	 * @throws \EE_Error
1059 1059
 	 */
1060
-	public function next_x( $current_field_value, $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
1061
-		return $this->_get_consecutive( $current_field_value, '>', $field_to_order_by, $limit, $query_params, $columns_to_select );
1060
+	public function next_x($current_field_value, $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) {
1061
+		return $this->_get_consecutive($current_field_value, '>', $field_to_order_by, $limit, $query_params, $columns_to_select);
1062 1062
 	}
1063 1063
 
1064 1064
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 	 * @return EE_Base_Class[]|array
1080 1080
 	 * @throws \EE_Error
1081 1081
 	 */
1082
-	public function previous_x( $current_field_value, $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
1083
-		return $this->_get_consecutive( $current_field_value, '<', $field_to_order_by, $limit, $query_params, $columns_to_select );
1082
+	public function previous_x($current_field_value, $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) {
1083
+		return $this->_get_consecutive($current_field_value, '<', $field_to_order_by, $limit, $query_params, $columns_to_select);
1084 1084
 	}
1085 1085
 
1086 1086
 
@@ -1101,9 +1101,9 @@  discard block
 block discarded – undo
1101 1101
 	 * @return EE_Base_Class|null|array()
1102 1102
 	 * @throws \EE_Error
1103 1103
 	 */
1104
-	public function next( $current_field_value, $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
1105
-		$results = $this->_get_consecutive( $current_field_value, '>', $field_to_order_by, 1, $query_params, $columns_to_select );
1106
-		return empty( $results ) ? null : reset( $results );
1104
+	public function next($current_field_value, $field_to_order_by = null, $query_params = array(), $columns_to_select = null) {
1105
+		$results = $this->_get_consecutive($current_field_value, '>', $field_to_order_by, 1, $query_params, $columns_to_select);
1106
+		return empty($results) ? null : reset($results);
1107 1107
 	}
1108 1108
 
1109 1109
 
@@ -1125,9 +1125,9 @@  discard block
 block discarded – undo
1125 1125
  * @return EE_Base_Class|null|array()
1126 1126
 	 * @throws EE_Error
1127 1127
 	 */
1128
-	public function previous( $current_field_value, $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
1129
-		$results = $this->_get_consecutive( $current_field_value, '<', $field_to_order_by, 1, $query_params, $columns_to_select );
1130
-		return empty( $results ) ? null : reset( $results );
1128
+	public function previous($current_field_value, $field_to_order_by = null, $query_params = array(), $columns_to_select = null) {
1129
+		$results = $this->_get_consecutive($current_field_value, '<', $field_to_order_by, 1, $query_params, $columns_to_select);
1130
+		return empty($results) ? null : reset($results);
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1148,42 +1148,42 @@  discard block
 block discarded – undo
1148 1148
 	 * @return EE_Base_Class[]|array
1149 1149
 	 * @throws EE_Error
1150 1150
 	 */
1151
-	protected function _get_consecutive( $current_field_value, $operand = '>', $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
1151
+	protected function _get_consecutive($current_field_value, $operand = '>', $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) {
1152 1152
 		//if $field_to_order_by is empty then let's assume we're ordering by the primary key.
1153
-		if ( empty( $field_to_order_by ) ) {
1154
-			if ( $this->has_primary_key_field() ) {
1153
+		if (empty($field_to_order_by)) {
1154
+			if ($this->has_primary_key_field()) {
1155 1155
 				$field_to_order_by = $this->get_primary_key_field()->get_name();
1156 1156
 			} else {
1157 1157
 
1158
-				if ( WP_DEBUG ) {
1159
-					throw new EE_Error( __( 'EEM_Base::_get_consecutive() has been called with no $field_to_order_by argument and there is no primary key on the field.  Please provide the field you would like to use as the base for retrieving the next item(s).', 'event_espresso' ) );
1158
+				if (WP_DEBUG) {
1159
+					throw new EE_Error(__('EEM_Base::_get_consecutive() has been called with no $field_to_order_by argument and there is no primary key on the field.  Please provide the field you would like to use as the base for retrieving the next item(s).', 'event_espresso'));
1160 1160
 				}
1161
-				EE_Error::add_error( __('There was an error with the query.', 'event_espresso') );
1161
+				EE_Error::add_error(__('There was an error with the query.', 'event_espresso'));
1162 1162
 				return array();
1163 1163
 			}
1164 1164
 		}
1165 1165
 
1166
-		if( ! is_array( $query_params ) ){
1167
-			EE_Error::doing_it_wrong('EEM_Base::_get_consecutive', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
1166
+		if ( ! is_array($query_params)) {
1167
+			EE_Error::doing_it_wrong('EEM_Base::_get_consecutive', sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), gettype($query_params)), '4.6.0');
1168 1168
 			$query_params = array();
1169 1169
 		}
1170 1170
 
1171 1171
 		//let's add the where query param for consecutive look up.
1172
-		$query_params[0][ $field_to_order_by ] = array( $operand, $current_field_value );
1172
+		$query_params[0][$field_to_order_by] = array($operand, $current_field_value);
1173 1173
 		$query_params['limit'] = $limit;
1174 1174
 
1175 1175
 		//set direction
1176
-		$incoming_orderby = isset( $query_params['order_by'] ) ? (array)$query_params['order_by'] : array();
1176
+		$incoming_orderby = isset($query_params['order_by']) ? (array) $query_params['order_by'] : array();
1177 1177
 		$query_params['order_by'] = $operand === '>'
1178
-			? array( $field_to_order_by => 'ASC' ) + $incoming_orderby
1179
-			: array( $field_to_order_by => 'DESC') + $incoming_orderby;
1178
+			? array($field_to_order_by => 'ASC') + $incoming_orderby
1179
+			: array($field_to_order_by => 'DESC') + $incoming_orderby;
1180 1180
 
1181 1181
 		//if $columns_to_select is empty then that means we're returning EE_Base_Class objects
1182
-		if ( empty( $columns_to_select ) ) {
1183
-			return $this->get_all( $query_params );
1182
+		if (empty($columns_to_select)) {
1183
+			return $this->get_all($query_params);
1184 1184
 		} else {
1185 1185
 			//getting just the fields
1186
-			return $this->_get_all_wpdb_results( $query_params, ARRAY_A, $columns_to_select );
1186
+			return $this->_get_all_wpdb_results($query_params, ARRAY_A, $columns_to_select);
1187 1187
 		}
1188 1188
 	}
1189 1189
 
@@ -1194,18 +1194,18 @@  discard block
 block discarded – undo
1194 1194
 	 * This sets the _timezone property after model object has been instantiated.
1195 1195
 	 * @param null | string $timezone valid PHP DateTimeZone timezone string
1196 1196
 	 */
1197
-	public function set_timezone( $timezone ) {
1198
-		if ( $timezone !== null ) {
1197
+	public function set_timezone($timezone) {
1198
+		if ($timezone !== null) {
1199 1199
 			$this->_timezone = $timezone;
1200 1200
 		}
1201 1201
 		//note we need to loop through relations and set the timezone on those objects as well.
1202
-		foreach ( $this->_model_relations as $relation ) {
1203
-			$relation->set_timezone( $timezone );
1202
+		foreach ($this->_model_relations as $relation) {
1203
+			$relation->set_timezone($timezone);
1204 1204
 		}
1205 1205
 		//and finally we do the same for any datetime fields
1206
-		foreach ( $this->_fields as $field ) {
1207
-			if ( $field instanceof EE_Datetime_Field ) {
1208
-				$field->set_timezone( $timezone );
1206
+		foreach ($this->_fields as $field) {
1207
+			if ($field instanceof EE_Datetime_Field) {
1208
+				$field->set_timezone($timezone);
1209 1209
 			}
1210 1210
 		}
1211 1211
 	}
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
 	 */
1221 1221
 	public function get_timezone() {
1222 1222
 		//first validate if timezone is set.  If not, then let's set it be whatever is set on the model fields.
1223
-		if ( empty( $this->_timezone ) ) {
1224
-			foreach( $this->_fields as $field ) {
1225
-				if ( $field instanceof EE_Datetime_Field ) {
1223
+		if (empty($this->_timezone)) {
1224
+			foreach ($this->_fields as $field) {
1225
+				if ($field instanceof EE_Datetime_Field) {
1226 1226
 					$this->set_timezone($field->get_timezone());
1227 1227
 					break;
1228 1228
 				}
@@ -1230,8 +1230,8 @@  discard block
 block discarded – undo
1230 1230
 		}
1231 1231
 
1232 1232
 		//if timezone STILL empty then return the default timezone for the site.
1233
-		if ( empty( $this->_timezone ) ) {
1234
-			$this->set_timezone( EEH_DTT_Helper::get_timezone() );
1233
+		if (empty($this->_timezone)) {
1234
+			$this->set_timezone(EEH_DTT_Helper::get_timezone());
1235 1235
 		}
1236 1236
 		return $this->_timezone;
1237 1237
 	}
@@ -1249,19 +1249,19 @@  discard block
 block discarded – undo
1249 1249
 	 *
1250 1250
 	 * @return array formats in an array with the date format first, and the time format last.
1251 1251
 	 */
1252
-	public function get_formats_for( $field_name, $pretty = false ) {
1253
-		$field_settings = $this->field_settings_for( $field_name );
1252
+	public function get_formats_for($field_name, $pretty = false) {
1253
+		$field_settings = $this->field_settings_for($field_name);
1254 1254
 
1255 1255
 		//if not a valid EE_Datetime_Field then throw error
1256
-		if ( ! $field_settings instanceof EE_Datetime_Field ) {
1257
-			throw new EE_Error( sprintf( __('The field sent into EEM_Base::get_formats_for (%s) is not registered as a EE_Datetime_Field. Please check the spelling and make sure you are submitting the right field name to retrieve date_formats for.', 'event_espresso' ), $field_name ) );
1256
+		if ( ! $field_settings instanceof EE_Datetime_Field) {
1257
+			throw new EE_Error(sprintf(__('The field sent into EEM_Base::get_formats_for (%s) is not registered as a EE_Datetime_Field. Please check the spelling and make sure you are submitting the right field name to retrieve date_formats for.', 'event_espresso'), $field_name));
1258 1258
 		}
1259 1259
 
1260 1260
 		//while we are here, let's make sure the timezone internally in EEM_Base matches what is stored on
1261 1261
 		//the field.
1262 1262
 		$this->_timezone = $field_settings->get_timezone();
1263 1263
 
1264
-		return array( $field_settings->get_date_format( $pretty ), $field_settings->get_time_format( $pretty ) );
1264
+		return array($field_settings->get_date_format($pretty), $field_settings->get_time_format($pretty));
1265 1265
 	}
1266 1266
 
1267 1267
 
@@ -1285,25 +1285,25 @@  discard block
 block discarded – undo
1285 1285
 	 * @return int|string  If the given field_name is not of the EE_Datetime_Field type, then an EE_Error
1286 1286
 	 *                    	     exception is triggered.
1287 1287
 	 */
1288
-	public function current_time_for_query( $field_name, $timestamp = false, $what = 'both' ) {
1289
-		$formats = $this->get_formats_for( $field_name );
1288
+	public function current_time_for_query($field_name, $timestamp = false, $what = 'both') {
1289
+		$formats = $this->get_formats_for($field_name);
1290 1290
 
1291
-		$DateTime = new DateTime( "now", new DateTimeZone( $this->_timezone ) );
1291
+		$DateTime = new DateTime("now", new DateTimeZone($this->_timezone));
1292 1292
 
1293
-		if ( $timestamp ) {
1294
-			return $DateTime->format( 'U' );
1293
+		if ($timestamp) {
1294
+			return $DateTime->format('U');
1295 1295
 		}
1296 1296
 
1297 1297
 		//not returning timestamp, so return formatted string in timezone.
1298
-		switch( $what ) {
1298
+		switch ($what) {
1299 1299
 			case 'time' :
1300
-				return $DateTime->format( $formats[1] );
1300
+				return $DateTime->format($formats[1]);
1301 1301
 				break;
1302 1302
 			case 'date' :
1303
-				return $DateTime->format( $formats[0] );
1303
+				return $DateTime->format($formats[0]);
1304 1304
 				break;
1305 1305
 			default :
1306
-				return $DateTime->format( implode( ' ', $formats ) );
1306
+				return $DateTime->format(implode(' ', $formats));
1307 1307
 				break;
1308 1308
 		}
1309 1309
 	}
@@ -1325,17 +1325,17 @@  discard block
 block discarded – undo
1325 1325
 	 * @return DateTime
1326 1326
 	 * @throws \EE_Error
1327 1327
 	 */
1328
-	public function convert_datetime_for_query( $field_name, $timestring, $incoming_format, $timezone = '' ) {
1328
+	public function convert_datetime_for_query($field_name, $timestring, $incoming_format, $timezone = '') {
1329 1329
 
1330 1330
 		//just using this to ensure the timezone is set correctly internally
1331
-		$this->get_formats_for( $field_name );
1331
+		$this->get_formats_for($field_name);
1332 1332
 
1333 1333
 		//load EEH_DTT_Helper
1334
-		$set_timezone = empty( $timezone ) ? EEH_DTT_Helper::get_timezone() : $timezone;
1334
+		$set_timezone = empty($timezone) ? EEH_DTT_Helper::get_timezone() : $timezone;
1335 1335
 
1336
-		$incomingDateTime = date_create_from_format( $incoming_format, $timestring, new DateTimeZone( $set_timezone ) );
1336
+		$incomingDateTime = date_create_from_format($incoming_format, $timestring, new DateTimeZone($set_timezone));
1337 1337
 
1338
-		return $incomingDateTime->setTimezone( new DateTimeZone( $this->_timezone ) );
1338
+		return $incomingDateTime->setTimezone(new DateTimeZone($this->_timezone));
1339 1339
 	}
1340 1340
 
1341 1341
 
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 	 * Gets all the tables comprising this model. Array keys are the table aliases, and values are EE_Table objects
1346 1346
 	 * @return EE_Table_Base[]
1347 1347
 	 */
1348
-	public function get_tables(){
1348
+	public function get_tables() {
1349 1349
 		return $this->_tables;
1350 1350
 	}
1351 1351
 
@@ -1381,9 +1381,9 @@  discard block
 block discarded – undo
1381 1381
 	 * @return int how many rows got updated or FALSE if something went wrong with the query (wp returns FALSE or num rows affected which *could* include 0 which DOES NOT mean the query was bad)
1382 1382
 	 * @throws \EE_Error
1383 1383
 	 */
1384
-	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE){
1385
-		if( ! is_array( $query_params ) ){
1386
-			EE_Error::doing_it_wrong('EEM_Base::update', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
1384
+	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
1385
+		if ( ! is_array($query_params)) {
1386
+			EE_Error::doing_it_wrong('EEM_Base::update', sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), gettype($query_params)), '4.6.0');
1387 1387
 			$query_params = array();
1388 1388
 		}
1389 1389
 		/**
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 		 * @param array $fields_n_values the updated fields and their new values
1394 1394
 		 * @param array $query_params @see EEM_Base::get_all()
1395 1395
 		 */
1396
-		do_action( 'AHEE__EEM_Base__update__begin',$this, $fields_n_values, $query_params );
1396
+		do_action('AHEE__EEM_Base__update__begin', $this, $fields_n_values, $query_params);
1397 1397
 		/**
1398 1398
 		 * Filters the fields about to be updated given the query parameters. You can provide the
1399 1399
 		 * $query_params to $this->get_all() to find exactly which records will be updated
@@ -1401,10 +1401,10 @@  discard block
 block discarded – undo
1401 1401
 		 * @param EEM_Base $model the model being queried
1402 1402
 		 * @param array $query_params see EEM_Base::get_all()
1403 1403
 		 */
1404
-		$fields_n_values = (array)apply_filters( 'FHEE__EEM_Base__update__fields_n_values', $fields_n_values, $this, $query_params );
1404
+		$fields_n_values = (array) apply_filters('FHEE__EEM_Base__update__fields_n_values', $fields_n_values, $this, $query_params);
1405 1405
 		//need to verify that, for any entry we want to update, there are entries in each secondary table.
1406 1406
 		//to do that, for each table, verify that it's PK isn't null.
1407
-		$tables= $this->get_tables();
1407
+		$tables = $this->get_tables();
1408 1408
 
1409 1409
 		//and if the other tables don't have a row for each table-to-be-updated, we'll insert one with whatever values available in the current update query
1410 1410
 		//NOTE: we should make this code more efficient by NOT querying twice
@@ -1414,29 +1414,29 @@  discard block
 block discarded – undo
1414 1414
 			//we want to make sure the default_where strategy is ignored
1415 1415
 			$this->_ignore_where_strategy = TRUE;
1416 1416
 			$wpdb_select_results = $this->_get_all_wpdb_results($query_params);
1417
-			foreach( $wpdb_select_results as $wpdb_result ){
1417
+			foreach ($wpdb_select_results as $wpdb_result) {
1418 1418
 				// type cast stdClass as array
1419
-				$wpdb_result = (array)$wpdb_result;
1419
+				$wpdb_result = (array) $wpdb_result;
1420 1420
 				//get the model object's PK, as we'll want this if we need to insert a row into secondary tables
1421
-				if( $this->has_primary_key_field() ){
1422
-					$main_table_pk_value = $wpdb_result[ $this->get_primary_key_field()->get_qualified_column() ];
1423
-				}else{
1421
+				if ($this->has_primary_key_field()) {
1422
+					$main_table_pk_value = $wpdb_result[$this->get_primary_key_field()->get_qualified_column()];
1423
+				} else {
1424 1424
 					//if there's no primary key, we basically can't support having a 2nd table on the model (we could but it would be lots of work)
1425 1425
 					$main_table_pk_value = null;
1426 1426
 				}
1427 1427
 				//if there are more than 1 tables, we'll want to verify that each table for this model has an entry in the other tables
1428 1428
 				//and if the other tables don't have a row for each table-to-be-updated, we'll insert one with whatever values available in the current update query
1429
-				if(count($tables) > 1){
1429
+				if (count($tables) > 1) {
1430 1430
 					//foreach matching row in the DB, ensure that each table's PK isn't null. If so, there must not be an entry
1431 1431
 					//in that table, and so we'll want to insert one
1432
-					foreach($tables as $table_obj){
1432
+					foreach ($tables as $table_obj) {
1433 1433
 						$this_table_pk_column = $table_obj->get_fully_qualified_pk_column();
1434 1434
 						//if there is no private key for this table on the results, it means there's no entry
1435 1435
 						//in this table, right? so insert a row in the current table, using any fields available
1436
-						if( ! ( array_key_exists( $this_table_pk_column, $wpdb_result) && $wpdb_result[ $this_table_pk_column ] )){
1436
+						if ( ! (array_key_exists($this_table_pk_column, $wpdb_result) && $wpdb_result[$this_table_pk_column])) {
1437 1437
 							$success = $this->_insert_into_specific_table($table_obj, $fields_n_values, $main_table_pk_value);
1438 1438
 							//if we died here, report the error
1439
-							if( ! $success ) {
1439
+							if ( ! $success) {
1440 1440
 								return false;
1441 1441
 							}
1442 1442
 						}
@@ -1456,44 +1456,44 @@  discard block
 block discarded – undo
1456 1456
 		//if this wasn't called from a model object (to update itself)
1457 1457
 		//then we want to make sure we keep all the existing
1458 1458
 		//model objects in sync with the db
1459
-		if( $keep_model_objs_in_sync && ! $this->_values_already_prepared_by_model_object ){
1460
-			if( $this->has_primary_key_field() ){
1461
-				$model_objs_affected_ids = $this->get_col( $query_params );
1462
-			}else{
1459
+		if ($keep_model_objs_in_sync && ! $this->_values_already_prepared_by_model_object) {
1460
+			if ($this->has_primary_key_field()) {
1461
+				$model_objs_affected_ids = $this->get_col($query_params);
1462
+			} else {
1463 1463
 				//we need to select a bunch of columns and then combine them into the the "index primary key string"s
1464
-				$models_affected_key_columns = $this->_get_all_wpdb_results($query_params, ARRAY_A );
1464
+				$models_affected_key_columns = $this->_get_all_wpdb_results($query_params, ARRAY_A);
1465 1465
 				$model_objs_affected_ids = array();
1466
-				foreach( $models_affected_key_columns as $row ){
1467
-					$combined_index_key = $this->get_index_primary_key_string( $row );
1468
-					$model_objs_affected_ids[ $combined_index_key ] = $combined_index_key;
1466
+				foreach ($models_affected_key_columns as $row) {
1467
+					$combined_index_key = $this->get_index_primary_key_string($row);
1468
+					$model_objs_affected_ids[$combined_index_key] = $combined_index_key;
1469 1469
 				}
1470 1470
 
1471 1471
 			}
1472 1472
 
1473
-			if( ! $model_objs_affected_ids ){
1473
+			if ( ! $model_objs_affected_ids) {
1474 1474
 				//wait wait wait- if nothing was affected let's stop here
1475 1475
 				return 0;
1476 1476
 			}
1477
-			foreach( $model_objs_affected_ids as $id ){
1478
-				$model_obj_in_entity_map = $this->get_from_entity_map( $id );
1479
-				if( $model_obj_in_entity_map ){
1480
-					foreach( $fields_n_values as $field => $new_value ){
1481
-						$model_obj_in_entity_map->set( $field, $new_value );
1477
+			foreach ($model_objs_affected_ids as $id) {
1478
+				$model_obj_in_entity_map = $this->get_from_entity_map($id);
1479
+				if ($model_obj_in_entity_map) {
1480
+					foreach ($fields_n_values as $field => $new_value) {
1481
+						$model_obj_in_entity_map->set($field, $new_value);
1482 1482
 					}
1483 1483
 				}
1484 1484
 			}
1485 1485
 			//if there is a primary key on this model, we can now do a slight optimization
1486
-			if( $this->has_primary_key_field() ){
1486
+			if ($this->has_primary_key_field()) {
1487 1487
 				//we already know what we want to update. So let's make the query simpler so it's a little more efficient
1488 1488
 				$query_params = array(
1489
-					array( $this->primary_key_name() => array( 'IN', $model_objs_affected_ids ) ),
1490
-					'limit' => count( $model_objs_affected_ids ), 'default_where_conditions' => 'none' );
1489
+					array($this->primary_key_name() => array('IN', $model_objs_affected_ids)),
1490
+					'limit' => count($model_objs_affected_ids), 'default_where_conditions' => 'none' );
1491 1491
 			}
1492 1492
 		}
1493 1493
 
1494
-		$model_query_info = $this->_create_model_query_info_carrier( $query_params );
1495
-		$SQL = "UPDATE ".$model_query_info->get_full_join_sql()." SET ".$this->_construct_update_sql($fields_n_values).$model_query_info->get_where_sql();//note: doesn't use _construct_2nd_half_of_select_query() because doesn't accept LIMIT, ORDER BY, etc.
1496
-		$rows_affected = $this->_do_wpdb_query('query', array( $SQL ) );
1494
+		$model_query_info = $this->_create_model_query_info_carrier($query_params);
1495
+		$SQL = "UPDATE ".$model_query_info->get_full_join_sql()." SET ".$this->_construct_update_sql($fields_n_values).$model_query_info->get_where_sql(); //note: doesn't use _construct_2nd_half_of_select_query() because doesn't accept LIMIT, ORDER BY, etc.
1496
+		$rows_affected = $this->_do_wpdb_query('query', array($SQL));
1497 1497
 		/**
1498 1498
 		 * Action called after a model update call has been made.
1499 1499
 		 *
@@ -1502,8 +1502,8 @@  discard block
 block discarded – undo
1502 1502
 		 * @param array $query_params @see EEM_Base::get_all()
1503 1503
 		 * @param int $rows_affected
1504 1504
 		 */
1505
-		do_action( 'AHEE__EEM_Base__update__end',$this, $fields_n_values, $query_params, $rows_affected );
1506
-		return $rows_affected;//how many supposedly got updated
1505
+		do_action('AHEE__EEM_Base__update__end', $this, $fields_n_values, $query_params, $rows_affected);
1506
+		return $rows_affected; //how many supposedly got updated
1507 1507
 	}
1508 1508
 
1509 1509
 
@@ -1519,22 +1519,22 @@  discard block
 block discarded – undo
1519 1519
 	 * @return array just like $wpdb->get_col()
1520 1520
 	 * @throws \EE_Error
1521 1521
 	 */
1522
-	public function get_col( $query_params  = array(), $field_to_select = NULL ){
1522
+	public function get_col($query_params = array(), $field_to_select = NULL) {
1523 1523
 
1524
-		if( $field_to_select ){
1525
-			$field = $this->field_settings_for( $field_to_select );
1526
-		}elseif( $this->has_primary_key_field ( ) ){
1524
+		if ($field_to_select) {
1525
+			$field = $this->field_settings_for($field_to_select);
1526
+		}elseif ($this->has_primary_key_field( )) {
1527 1527
 			$field = $this->get_primary_key_field();
1528
-		}else{
1528
+		} else {
1529 1529
 			//no primary key, just grab the first column
1530
-			$field = reset( $this->field_settings());
1530
+			$field = reset($this->field_settings());
1531 1531
 		}
1532 1532
 
1533 1533
 
1534 1534
 		$model_query_info = $this->_create_model_query_info_carrier($query_params);
1535 1535
 		$select_expressions = $field->get_qualified_column();
1536
-		$SQL ="SELECT $select_expressions ".$this->_construct_2nd_half_of_select_query($model_query_info);
1537
-		return $this->_do_wpdb_query('get_col', array( $SQL ) );
1536
+		$SQL = "SELECT $select_expressions ".$this->_construct_2nd_half_of_select_query($model_query_info);
1537
+		return $this->_do_wpdb_query('get_col', array($SQL));
1538 1538
 	}
1539 1539
 
1540 1540
 
@@ -1547,12 +1547,12 @@  discard block
 block discarded – undo
1547 1547
 	 * @return string
1548 1548
 	 * @throws \EE_Error
1549 1549
 	 */
1550
-	public function get_var( $query_params = array(), $field_to_select = NULL ) {
1551
-		$query_params[ 'limit' ] = 1;
1552
-		$col = $this->get_col( $query_params, $field_to_select );
1553
-		if( ! empty( $col ) ) {
1554
-			return reset( $col );
1555
-		}else{
1550
+	public function get_var($query_params = array(), $field_to_select = NULL) {
1551
+		$query_params['limit'] = 1;
1552
+		$col = $this->get_col($query_params, $field_to_select);
1553
+		if ( ! empty($col)) {
1554
+			return reset($col);
1555
+		} else {
1556 1556
 			return NULL;
1557 1557
 		}
1558 1558
 	}
@@ -1568,19 +1568,19 @@  discard block
 block discarded – undo
1568 1568
 	 * @return string of SQL
1569 1569
 	 * @throws \EE_Error
1570 1570
 	 */
1571
-	public function _construct_update_sql($fields_n_values){
1571
+	public function _construct_update_sql($fields_n_values) {
1572 1572
 		/** @type WPDB $wpdb */
1573 1573
 		global $wpdb;
1574 1574
 		$cols_n_values = array();
1575
-		foreach($fields_n_values as $field_name => $value){
1575
+		foreach ($fields_n_values as $field_name => $value) {
1576 1576
 			$field_obj = $this->field_settings_for($field_name);
1577 1577
 			//if the value is NULL, we want to assign the value to that.
1578 1578
 			//wpdb->prepare doesn't really handle that properly
1579
-			$prepared_value = $this->_prepare_value_or_use_default( $field_obj, $fields_n_values );
1580
-			$value_sql = $prepared_value===NULL ? 'NULL' : $wpdb->prepare( $field_obj->get_wpdb_data_type(), $prepared_value );
1579
+			$prepared_value = $this->_prepare_value_or_use_default($field_obj, $fields_n_values);
1580
+			$value_sql = $prepared_value === NULL ? 'NULL' : $wpdb->prepare($field_obj->get_wpdb_data_type(), $prepared_value);
1581 1581
 			$cols_n_values[] = $field_obj->get_qualified_column()."=".$value_sql;
1582 1582
 		}
1583
-		return implode(",",$cols_n_values);
1583
+		return implode(",", $cols_n_values);
1584 1584
 
1585 1585
 	}
1586 1586
 
@@ -1596,10 +1596,10 @@  discard block
 block discarded – undo
1596 1596
 	 * @return boolean whether the row got deleted or not
1597 1597
 	 * @throws \EE_Error
1598 1598
 	 */
1599
-	public function delete_permanently_by_ID( $id ) {
1599
+	public function delete_permanently_by_ID($id) {
1600 1600
 		return $this->delete_permanently(
1601 1601
 			array(
1602
-				array( $this->get_primary_key_field()->get_name() => $id ),
1602
+				array($this->get_primary_key_field()->get_name() => $id),
1603 1603
 				'limit' 	=> 1
1604 1604
 			)
1605 1605
 		);
@@ -1615,10 +1615,10 @@  discard block
 block discarded – undo
1615 1615
 	 * @return boolean whether the row got deleted or not
1616 1616
 	 * @throws \EE_Error
1617 1617
 	 */
1618
-	public function delete_by_ID( $id ){
1618
+	public function delete_by_ID($id) {
1619 1619
 		return $this->delete(
1620 1620
 			array(
1621
-				array( $this->get_primary_key_field()->get_name() => $id ),
1621
+				array($this->get_primary_key_field()->get_name() => $id),
1622 1622
 				'limit' 	=> 1
1623 1623
 			)
1624 1624
 		);
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
 	 * @return int how many rows got deleted
1638 1638
 	 * @throws \EE_Error
1639 1639
 	 */
1640
-	public function delete($query_params,$allow_blocking = true){
1640
+	public function delete($query_params, $allow_blocking = true) {
1641 1641
 		return $this->delete_permanently($query_params, $allow_blocking);
1642 1642
 	}
1643 1643
 
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 	 * @return int how many rows got deleted
1656 1656
 	 * @throws \EE_Error
1657 1657
 	 */
1658
-	public function delete_permanently($query_params,$allow_blocking = true){
1658
+	public function delete_permanently($query_params, $allow_blocking = true) {
1659 1659
 		/**
1660 1660
 		 * Action called just before performing a real deletion query. You can use the
1661 1661
 		 * model and its $query_params to find exactly which items will be deleted
@@ -1664,31 +1664,31 @@  discard block
 block discarded – undo
1664 1664
 		 * @param boolean $allow_blocking whether or not to allow related model objects
1665 1665
 		 * to block (prevent) this deletion
1666 1666
 		 */
1667
-		do_action( 'AHEE__EEM_Base__delete__begin', $this, $query_params, $allow_blocking );
1667
+		do_action('AHEE__EEM_Base__delete__begin', $this, $query_params, $allow_blocking);
1668 1668
 		//some MySQL databases may be running safe mode, which may restrict
1669 1669
 		//deletion if there is no KEY column used in the WHERE statement of a deletion.
1670 1670
 		//to get around this, we first do a SELECT, get all the IDs, and then run another query
1671 1671
 		//to delete them
1672 1672
 		$items_for_deletion = $this->_get_all_wpdb_results($query_params);
1673
-		$deletion_where = $this->_setup_ids_for_delete( $items_for_deletion, $allow_blocking);
1674
-		if($deletion_where){
1673
+		$deletion_where = $this->_setup_ids_for_delete($items_for_deletion, $allow_blocking);
1674
+		if ($deletion_where) {
1675 1675
 			//echo "objects for deletion:";var_dump($objects_for_deletion);
1676 1676
 			$model_query_info = $this->_create_model_query_info_carrier($query_params);
1677
-			$table_aliases = array_keys( $this->_tables );
1678
-			$SQL = "DELETE ".implode(", ",$table_aliases)." FROM ".$model_query_info->get_full_join_sql()." WHERE ".$deletion_where;
1677
+			$table_aliases = array_keys($this->_tables);
1678
+			$SQL = "DELETE ".implode(", ", $table_aliases)." FROM ".$model_query_info->get_full_join_sql()." WHERE ".$deletion_where;
1679 1679
 
1680 1680
 			//		/echo "delete sql:$SQL";
1681
-			$rows_deleted = $this->_do_wpdb_query( 'query', array( $SQL ) );
1682
-		}else{
1681
+			$rows_deleted = $this->_do_wpdb_query('query', array($SQL));
1682
+		} else {
1683 1683
 			$rows_deleted = 0;
1684 1684
 		}
1685 1685
 
1686 1686
 		//and lastly make sure those items are removed from the entity map; if they could be put into it at all
1687
-		if( $this->has_primary_key_field() ){
1688
-			foreach($items_for_deletion as $item_for_deletion_row ){
1689
-				$pk_value = $item_for_deletion_row[ $this->get_primary_key_field()->get_qualified_column() ];
1690
-				if( isset( $this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $pk_value ] ) ){
1691
-					unset( $this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $pk_value ] );
1687
+		if ($this->has_primary_key_field()) {
1688
+			foreach ($items_for_deletion as $item_for_deletion_row) {
1689
+				$pk_value = $item_for_deletion_row[$this->get_primary_key_field()->get_qualified_column()];
1690
+				if (isset($this->_entity_map[EEM_Base::$_model_query_blog_id][$pk_value])) {
1691
+					unset($this->_entity_map[EEM_Base::$_model_query_blog_id][$pk_value]);
1692 1692
 				}
1693 1693
 			}
1694 1694
 		}
@@ -1700,8 +1700,8 @@  discard block
 block discarded – undo
1700 1700
 		 * @param array $query_params @see EEM_Base::get_all()
1701 1701
 		 * @param int $rows_deleted
1702 1702
 		 */
1703
-		do_action( 'AHEE__EEM_Base__delete__end', $this, $query_params, $rows_deleted );
1704
-		return $rows_deleted;//how many supposedly got deleted
1703
+		do_action('AHEE__EEM_Base__delete__end', $this, $query_params, $rows_deleted);
1704
+		return $rows_deleted; //how many supposedly got deleted
1705 1705
 	}
1706 1706
 
1707 1707
 
@@ -1719,28 +1719,28 @@  discard block
 block discarded – undo
1719 1719
 	 * @return boolean
1720 1720
 	 * @throws \EE_Error
1721 1721
 	 */
1722
-	public function delete_is_blocked_by_related_models($this_model_obj_or_id, $ignore_this_model_obj = null){
1722
+	public function delete_is_blocked_by_related_models($this_model_obj_or_id, $ignore_this_model_obj = null) {
1723 1723
 		//first, if $ignore_this_model_obj was supplied, get its model
1724
-		if($ignore_this_model_obj && $ignore_this_model_obj instanceof EE_Base_Class){
1724
+		if ($ignore_this_model_obj && $ignore_this_model_obj instanceof EE_Base_Class) {
1725 1725
 			$ignored_model = $ignore_this_model_obj->get_model();
1726
-		}else{
1726
+		} else {
1727 1727
 			$ignored_model = null;
1728 1728
 		}
1729 1729
 		//now check all the relations of $this_model_obj_or_id and see if there
1730 1730
 		//are any related model objects blocking it?
1731 1731
 		$is_blocked = false;
1732
-		foreach($this->_model_relations as $relation_name => $relation_obj){
1733
-			if( $relation_obj->block_delete_if_related_models_exist()){
1732
+		foreach ($this->_model_relations as $relation_name => $relation_obj) {
1733
+			if ($relation_obj->block_delete_if_related_models_exist()) {
1734 1734
 				//if $ignore_this_model_obj was supplied, then for the query
1735 1735
 				//on that model needs to be told to ignore $ignore_this_model_obj
1736
-				if($ignored_model && $relation_name === $ignored_model->get_this_model_name()){
1737
-					$related_model_objects = $relation_obj->get_all_related($this_model_obj_or_id,array(
1738
-					array($ignored_model->get_primary_key_field()->get_name() => array('!=',$ignore_this_model_obj->ID()))));
1739
-				}else{
1736
+				if ($ignored_model && $relation_name === $ignored_model->get_this_model_name()) {
1737
+					$related_model_objects = $relation_obj->get_all_related($this_model_obj_or_id, array(
1738
+					array($ignored_model->get_primary_key_field()->get_name() => array('!=', $ignore_this_model_obj->ID()))));
1739
+				} else {
1740 1740
 					$related_model_objects = $relation_obj->get_all_related($this_model_obj_or_id);
1741 1741
 				}
1742 1742
 
1743
-				if($related_model_objects){
1743
+				if ($related_model_objects) {
1744 1744
 					EE_Error::add_error($relation_obj->get_deletion_error_message(), __FILE__, __FUNCTION__, __LINE__);
1745 1745
 					$is_blocked = true;
1746 1746
 				}
@@ -1760,75 +1760,75 @@  discard block
 block discarded – undo
1760 1760
 	 * @throws EE_Error
1761 1761
 	 * @return string    everything that comes after the WHERE statement.
1762 1762
 	 */
1763
-	protected function _setup_ids_for_delete( $objects_for_deletion, $allow_blocking = true) {
1764
-		if($this->has_primary_key_field()){
1763
+	protected function _setup_ids_for_delete($objects_for_deletion, $allow_blocking = true) {
1764
+		if ($this->has_primary_key_field()) {
1765 1765
 			$primary_table = $this->_get_main_table();
1766 1766
 			$other_tables = $this->_get_other_tables();
1767 1767
 			$deletes = $query = array();
1768
-			foreach ( $objects_for_deletion as $delete_object ) {
1768
+			foreach ($objects_for_deletion as $delete_object) {
1769 1769
 				//before we mark this object for deletion,
1770 1770
 				//make sure there's no related objects blocking its deletion (if we're checking)
1771 1771
 				if (
1772 1772
 					$allow_blocking
1773 1773
 				    && $this->delete_is_blocked_by_related_models(
1774
-						$delete_object[ $primary_table->get_fully_qualified_pk_column() ]
1774
+						$delete_object[$primary_table->get_fully_qualified_pk_column()]
1775 1775
 					)
1776 1776
 				) {
1777 1777
 					continue;
1778 1778
 				}
1779 1779
 				//primary table deletes
1780
-				if ( isset( $delete_object[ $primary_table->get_fully_qualified_pk_column() ] ) ) {
1781
-					$deletes[ $primary_table->get_fully_qualified_pk_column() ][] = $delete_object[ $primary_table->get_fully_qualified_pk_column() ];
1780
+				if (isset($delete_object[$primary_table->get_fully_qualified_pk_column()])) {
1781
+					$deletes[$primary_table->get_fully_qualified_pk_column()][] = $delete_object[$primary_table->get_fully_qualified_pk_column()];
1782 1782
 				}
1783 1783
 				//other tables
1784
-				if ( ! empty( $other_tables ) ) {
1785
-					foreach ( $other_tables as $ot ) {
1784
+				if ( ! empty($other_tables)) {
1785
+					foreach ($other_tables as $ot) {
1786 1786
 						//first check if we've got the foreign key column here.
1787
-						if ( isset( $delete_object[ $ot->get_fully_qualified_fk_column() ] ) ) {
1788
-							$deletes[ $ot->get_fully_qualified_pk_column() ][] = $delete_object[ $ot->get_fully_qualified_fk_column() ];
1787
+						if (isset($delete_object[$ot->get_fully_qualified_fk_column()])) {
1788
+							$deletes[$ot->get_fully_qualified_pk_column()][] = $delete_object[$ot->get_fully_qualified_fk_column()];
1789 1789
 						}
1790 1790
 						// wait! it's entirely possible that we'll have a the primary key
1791 1791
 						// for this table in here, if it's a foreign key for one of the other secondary tables
1792
-						if ( isset( $delete_object[ $ot->get_fully_qualified_pk_column() ] ) ) {
1793
-							$deletes[ $ot->get_fully_qualified_pk_column() ][] = $delete_object[ $ot->get_fully_qualified_pk_column() ];
1792
+						if (isset($delete_object[$ot->get_fully_qualified_pk_column()])) {
1793
+							$deletes[$ot->get_fully_qualified_pk_column()][] = $delete_object[$ot->get_fully_qualified_pk_column()];
1794 1794
 						}
1795 1795
 						// finally, it is possible that the fk for this table is found
1796 1796
 						// in the fully qualified pk column for the fk table, so let's see if that's there!
1797
-						if ( isset( $delete_object[ $ot->get_fully_qualified_pk_on_fk_table() ] ) ) {
1798
-							$deletes[ $ot->get_fully_qualified_pk_column() ][] = $delete_object[ $ot->get_fully_qualified_pk_column() ];
1797
+						if (isset($delete_object[$ot->get_fully_qualified_pk_on_fk_table()])) {
1798
+							$deletes[$ot->get_fully_qualified_pk_column()][] = $delete_object[$ot->get_fully_qualified_pk_column()];
1799 1799
 						}
1800 1800
 					}
1801 1801
 				}
1802 1802
 			}
1803 1803
 
1804 1804
 			//we should have deletes now, so let's just go through and setup the where statement
1805
-			foreach ( $deletes as $column => $values ) {
1805
+			foreach ($deletes as $column => $values) {
1806 1806
 				//make sure we have unique $values;
1807 1807
 				$values = array_unique($values);
1808
-				$query[] = $column . ' IN(' . implode(",",$values) . ')';
1808
+				$query[] = $column.' IN('.implode(",", $values).')';
1809 1809
 			}
1810 1810
 
1811
-			return !empty($query) ? implode(' AND ', $query ) : '';
1812
-		}elseif(count($this->get_combined_primary_key_fields()) > 1){
1811
+			return ! empty($query) ? implode(' AND ', $query) : '';
1812
+		}elseif (count($this->get_combined_primary_key_fields()) > 1) {
1813 1813
 			$ways_to_identify_a_row = array();
1814 1814
 			$fields = $this->get_combined_primary_key_fields();
1815 1815
 			//note: because there' sno primary key, that means nothing else  can be pointing to this model, right?
1816
-			foreach($objects_for_deletion as  $delete_object){
1816
+			foreach ($objects_for_deletion as  $delete_object) {
1817 1817
 				$values_for_each_cpk_for_a_row = array();
1818
-				foreach($fields as $cpk_field){
1819
-					if ( $cpk_field instanceof EE_Model_Field_Base ){
1818
+				foreach ($fields as $cpk_field) {
1819
+					if ($cpk_field instanceof EE_Model_Field_Base) {
1820 1820
 						$values_for_each_cpk_for_a_row[] = $cpk_field->get_qualified_column()
1821 1821
 						                                   . "="
1822
-						                                   . $delete_object[ $cpk_field->get_qualified_column() ];
1822
+						                                   . $delete_object[$cpk_field->get_qualified_column()];
1823 1823
 					}
1824 1824
 				}
1825
-				$ways_to_identify_a_row[] = "(".implode(" AND ",$values_for_each_cpk_for_a_row).")";
1825
+				$ways_to_identify_a_row[] = "(".implode(" AND ", $values_for_each_cpk_for_a_row).")";
1826 1826
 			}
1827
-			return implode(" OR ",$ways_to_identify_a_row);
1828
-		}else{
1827
+			return implode(" OR ", $ways_to_identify_a_row);
1828
+		} else {
1829 1829
 			//so there's no primary key and no combined key...
1830 1830
 			//sorry, can't help you
1831
-			throw new EE_Error(sprintf(__("Cannot delete objects of type %s because there is no primary key NOR combined key", "event_espresso"),get_class($this)));
1831
+			throw new EE_Error(sprintf(__("Cannot delete objects of type %s because there is no primary key NOR combined key", "event_espresso"), get_class($this)));
1832 1832
 		}
1833 1833
 	}
1834 1834
 
@@ -1844,21 +1844,21 @@  discard block
 block discarded – undo
1844 1844
 	 * @return int
1845 1845
 	 * @throws \EE_Error
1846 1846
 	 */
1847
-	public function count($query_params =array(),$field_to_count = NULL, $distinct = FALSE){
1847
+	public function count($query_params = array(), $field_to_count = NULL, $distinct = FALSE) {
1848 1848
 		$model_query_info = $this->_create_model_query_info_carrier($query_params);
1849
-		if($field_to_count){
1849
+		if ($field_to_count) {
1850 1850
 			$field_obj = $this->field_settings_for($field_to_count);
1851 1851
 			$column_to_count = $field_obj->get_qualified_column();
1852
-		}elseif($this->has_primary_key_field ()){
1852
+		}elseif ($this->has_primary_key_field()) {
1853 1853
 			$pk_field_obj = $this->get_primary_key_field();
1854 1854
 			$column_to_count = $pk_field_obj->get_qualified_column();
1855
-		}else{//there's no primary key
1855
+		} else {//there's no primary key
1856 1856
 			$column_to_count = '*';
1857 1857
 		}
1858 1858
 
1859
-		$column_to_count = $distinct ? "DISTINCT (" . $column_to_count . " )" : $column_to_count;
1860
-		$SQL ="SELECT COUNT(".$column_to_count.")" . $this->_construct_2nd_half_of_select_query($model_query_info);
1861
-		return (int)$this->_do_wpdb_query( 'get_var', array( $SQL) );
1859
+		$column_to_count = $distinct ? "DISTINCT (".$column_to_count." )" : $column_to_count;
1860
+		$SQL = "SELECT COUNT(".$column_to_count.")".$this->_construct_2nd_half_of_select_query($model_query_info);
1861
+		return (int) $this->_do_wpdb_query('get_var', array($SQL));
1862 1862
 	}
1863 1863
 
1864 1864
 
@@ -1871,24 +1871,24 @@  discard block
 block discarded – undo
1871 1871
 	 * @return float
1872 1872
 	 * @throws \EE_Error
1873 1873
 	 */
1874
-	public function sum($query_params, $field_to_sum = NULL){
1874
+	public function sum($query_params, $field_to_sum = NULL) {
1875 1875
 		$model_query_info = $this->_create_model_query_info_carrier($query_params);
1876 1876
 
1877
-		if($field_to_sum){
1877
+		if ($field_to_sum) {
1878 1878
 			$field_obj = $this->field_settings_for($field_to_sum);
1879 1879
 
1880
-		}else{
1880
+		} else {
1881 1881
 			$field_obj = $this->get_primary_key_field();
1882 1882
 		}
1883 1883
 		$column_to_count = $field_obj->get_qualified_column();
1884 1884
 
1885
-		$SQL ="SELECT SUM(".$column_to_count.")" . $this->_construct_2nd_half_of_select_query($model_query_info);
1886
-		$return_value = $this->_do_wpdb_query('get_var',array( $SQL ) );
1885
+		$SQL = "SELECT SUM(".$column_to_count.")".$this->_construct_2nd_half_of_select_query($model_query_info);
1886
+		$return_value = $this->_do_wpdb_query('get_var', array($SQL));
1887 1887
 		$data_type = $field_obj->get_wpdb_data_type();
1888
-		if( $data_type === '%d' || $data_type === '%s' ){
1889
-			return (float)$return_value;
1890
-		}else{//must be %f
1891
-			return (float)$return_value;
1888
+		if ($data_type === '%d' || $data_type === '%s') {
1889
+			return (float) $return_value;
1890
+		} else {//must be %f
1891
+			return (float) $return_value;
1892 1892
 		}
1893 1893
 	}
1894 1894
 
@@ -1903,37 +1903,37 @@  discard block
 block discarded – undo
1903 1903
 	 * @global wpdb $wpdb
1904 1904
 	 * @return mixed
1905 1905
 	 */
1906
-	protected function _do_wpdb_query( $wpdb_method, $arguments_to_provide ){
1906
+	protected function _do_wpdb_query($wpdb_method, $arguments_to_provide) {
1907 1907
 		//if we're in maintenance mode level 2, DON'T run any queries
1908 1908
 		//because level 2 indicates the database needs updating and
1909 1909
 		//is probably out of sync with the code
1910
-		if( ! EE_Maintenance_Mode::instance()->models_can_query()){
1910
+		if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
1911 1911
 			throw new EE_Error(sprintf(__("Event Espresso Level 2 Maintenance mode is active. That means EE can not run ANY database queries until the necessary migration scripts have run which will take EE out of maintenance mode level 2. Please inform support of this error.", "event_espresso")));
1912 1912
 		}
1913 1913
 		/** @type WPDB $wpdb */
1914 1914
 		global $wpdb;
1915
-		if( ! method_exists( $wpdb, $wpdb_method ) ){
1916
-			throw new EE_Error( sprintf( __( 'There is no method named "%s" on Wordpress\' $wpdb object','event_espresso' ), $wpdb_method ) );
1915
+		if ( ! method_exists($wpdb, $wpdb_method)) {
1916
+			throw new EE_Error(sprintf(__('There is no method named "%s" on Wordpress\' $wpdb object', 'event_espresso'), $wpdb_method));
1917 1917
 		}
1918
-		if( WP_DEBUG ){
1918
+		if (WP_DEBUG) {
1919 1919
 			$old_show_errors_value = $wpdb->show_errors;
1920
-			$wpdb->show_errors( FALSE );
1921
-		}
1922
-		$result = $this->_process_wpdb_query( $wpdb_method, $arguments_to_provide );
1923
-		$this->show_db_query_if_previously_requested( $wpdb->last_query );
1924
-		if( WP_DEBUG ){
1925
-			$wpdb->show_errors( $old_show_errors_value );
1926
-			if( ! empty( $wpdb->last_error ) ){
1927
-				throw new EE_Error( sprintf( __( 'WPDB Error: "%s"', 'event_espresso' ), $wpdb->last_error ) );
1928
-			}elseif( $result === false ){
1929
-				throw new EE_Error( sprintf( __( 'WPDB Error occurred, but no error message was logged by wpdb! The wpdb method called was "%1$s" and the arguments were "%2$s"', 'event_espresso' ), $wpdb_method, var_export( $arguments_to_provide, true ) ) );
1920
+			$wpdb->show_errors(FALSE);
1921
+		}
1922
+		$result = $this->_process_wpdb_query($wpdb_method, $arguments_to_provide);
1923
+		$this->show_db_query_if_previously_requested($wpdb->last_query);
1924
+		if (WP_DEBUG) {
1925
+			$wpdb->show_errors($old_show_errors_value);
1926
+			if ( ! empty($wpdb->last_error)) {
1927
+				throw new EE_Error(sprintf(__('WPDB Error: "%s"', 'event_espresso'), $wpdb->last_error));
1928
+			}elseif ($result === false) {
1929
+				throw new EE_Error(sprintf(__('WPDB Error occurred, but no error message was logged by wpdb! The wpdb method called was "%1$s" and the arguments were "%2$s"', 'event_espresso'), $wpdb_method, var_export($arguments_to_provide, true)));
1930 1930
 			}
1931
-		}elseif( $result === false ) {
1931
+		}elseif ($result === false) {
1932 1932
 			EE_Error::add_error(
1933 1933
 				sprintf(
1934
-					__( 'A database error has occurred. Turn on WP_DEBUG for more information.||A database error occurred doing wpdb method "%1$s", with arguments "%2$s". The error was "%3$s"', 'event_espresso' ),
1934
+					__('A database error has occurred. Turn on WP_DEBUG for more information.||A database error occurred doing wpdb method "%1$s", with arguments "%2$s". The error was "%3$s"', 'event_espresso'),
1935 1935
 					$wpdb_method,
1936
-					var_export( $arguments_to_provide, true ),
1936
+					var_export($arguments_to_provide, true),
1937 1937
 					$wpdb->last_error
1938 1938
 				),
1939 1939
 				__FILE__,
@@ -1955,26 +1955,26 @@  discard block
 block discarded – undo
1955 1955
 	 * @param array $arguments_to_provide
1956 1956
 	 * @return mixed
1957 1957
 	 */
1958
-	private function _process_wpdb_query( $wpdb_method, $arguments_to_provide ) {
1958
+	private function _process_wpdb_query($wpdb_method, $arguments_to_provide) {
1959 1959
 		/** @type WPDB $wpdb */
1960 1960
 		global $wpdb;
1961 1961
 		$wpdb->last_error = null;
1962
-		$result = call_user_func_array( array( $wpdb, $wpdb_method ), $arguments_to_provide );
1962
+		$result = call_user_func_array(array($wpdb, $wpdb_method), $arguments_to_provide);
1963 1963
 		// was there an error running the query? but we don't care on new activations
1964 1964
 		// (we're going to setup the DB anyway on new activations)
1965
-		if ( ( $result === false || ! empty( $wpdb->last_error ) )
1965
+		if (($result === false || ! empty($wpdb->last_error))
1966 1966
 			&& EE_System::instance()->detect_req_type() !== EE_System::req_type_new_activation
1967 1967
 		) {
1968
-			switch ( EEM_Base::$_db_verification_level ) {
1968
+			switch (EEM_Base::$_db_verification_level) {
1969 1969
 
1970 1970
 				case EEM_Base::db_verified_none :
1971 1971
 					// let's double-check core's DB
1972
-					$error_message = $this->_verify_core_db( $wpdb_method, $arguments_to_provide );
1972
+					$error_message = $this->_verify_core_db($wpdb_method, $arguments_to_provide);
1973 1973
 					break;
1974 1974
 
1975 1975
 				case EEM_Base::db_verified_core :
1976 1976
 					// STILL NO LOVE?? verify all the addons too. Maybe they need to be fixed
1977
-					$error_message = $this->_verify_addons_db( $wpdb_method, $arguments_to_provide );
1977
+					$error_message = $this->_verify_addons_db($wpdb_method, $arguments_to_provide);
1978 1978
 					break;
1979 1979
 
1980 1980
 				case EEM_Base::db_verified_addons :
@@ -1982,11 +1982,11 @@  discard block
 block discarded – undo
1982 1982
 					return $result;
1983 1983
 					break;
1984 1984
 			}
1985
-			if ( ! empty( $error_message ) ) {
1986
-				EE_Log::instance()->log( __FILE__, __FUNCTION__, $error_message, 'error' );
1987
-				trigger_error( $error_message );
1985
+			if ( ! empty($error_message)) {
1986
+				EE_Log::instance()->log(__FILE__, __FUNCTION__, $error_message, 'error');
1987
+				trigger_error($error_message);
1988 1988
 			}
1989
-			return $this->_process_wpdb_query( $wpdb_method, $arguments_to_provide );
1989
+			return $this->_process_wpdb_query($wpdb_method, $arguments_to_provide);
1990 1990
 
1991 1991
 		}
1992 1992
 
@@ -2002,18 +2002,18 @@  discard block
 block discarded – undo
2002 2002
 	 * @param array $arguments_to_provide
2003 2003
 	 * @return string
2004 2004
 	 */
2005
-	private function _verify_core_db( $wpdb_method, $arguments_to_provide ){
2005
+	private function _verify_core_db($wpdb_method, $arguments_to_provide) {
2006 2006
 		/** @type WPDB $wpdb */
2007 2007
 		global $wpdb;
2008 2008
 		//ok remember that we've already attempted fixing the core db, in case the problem persists
2009 2009
 		EEM_Base::$_db_verification_level = EEM_Base::db_verified_core;
2010 2010
 		$error_message = sprintf(
2011
-			__( 'WPDB Error "%1$s" while running wpdb method "%2$s" with arguments %3$s. Automatically attempting to fix EE Core DB', 'event_espresso' ),
2011
+			__('WPDB Error "%1$s" while running wpdb method "%2$s" with arguments %3$s. Automatically attempting to fix EE Core DB', 'event_espresso'),
2012 2012
 			$wpdb->last_error,
2013 2013
 			$wpdb_method,
2014
-			json_encode( $arguments_to_provide )
2014
+			json_encode($arguments_to_provide)
2015 2015
 		);
2016
-		EE_System::instance()->initialize_db_if_no_migrations_required( false, true );
2016
+		EE_System::instance()->initialize_db_if_no_migrations_required(false, true);
2017 2017
 		return $error_message;
2018 2018
 	}
2019 2019
 
@@ -2026,16 +2026,16 @@  discard block
 block discarded – undo
2026 2026
 	 * @param $arguments_to_provide
2027 2027
 	 * @return string
2028 2028
 	 */
2029
-	private function _verify_addons_db( $wpdb_method, $arguments_to_provide ) {
2029
+	private function _verify_addons_db($wpdb_method, $arguments_to_provide) {
2030 2030
 		/** @type WPDB $wpdb */
2031 2031
 		global $wpdb;
2032 2032
 		//ok remember that we've already attempted fixing the addons dbs, in case the problem persists
2033 2033
 		EEM_Base::$_db_verification_level = EEM_Base::db_verified_addons;
2034 2034
 		$error_message = sprintf(
2035
-			__( 'WPDB AGAIN: Error "%1$s" while running the same method and arguments as before. Automatically attempting to fix EE Addons DB', 'event_espresso' ),
2035
+			__('WPDB AGAIN: Error "%1$s" while running the same method and arguments as before. Automatically attempting to fix EE Addons DB', 'event_espresso'),
2036 2036
 			$wpdb->last_error,
2037 2037
 			$wpdb_method,
2038
-			json_encode( $arguments_to_provide )
2038
+			json_encode($arguments_to_provide)
2039 2039
 		);
2040 2040
 		EE_System::instance()->initialize_addons();
2041 2041
 		return $error_message;
@@ -2050,7 +2050,7 @@  discard block
 block discarded – undo
2050 2050
 	 * @param EE_Model_Query_Info_Carrier $model_query_info
2051 2051
 	 * @return string
2052 2052
 	 */
2053
-	private function _construct_2nd_half_of_select_query(EE_Model_Query_Info_Carrier $model_query_info){
2053
+	private function _construct_2nd_half_of_select_query(EE_Model_Query_Info_Carrier $model_query_info) {
2054 2054
 		return " FROM ".$model_query_info->get_full_join_sql().
2055 2055
 				$model_query_info->get_where_sql().
2056 2056
 				$model_query_info->get_group_by_sql().
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
 	 * Set to easily debug the next X queries ran from this model.
2064 2064
 	 * @param int $count
2065 2065
 	 */
2066
-	public function show_next_x_db_queries($count = 1){
2066
+	public function show_next_x_db_queries($count = 1) {
2067 2067
 		$this->_show_next_x_db_queries = $count;
2068 2068
 	}
2069 2069
 
@@ -2072,8 +2072,8 @@  discard block
 block discarded – undo
2072 2072
 	/**
2073 2073
 	 * @param $sql_query
2074 2074
 	 */
2075
-	public function show_db_query_if_previously_requested($sql_query){
2076
-		if($this->_show_next_x_db_queries > 0){
2075
+	public function show_db_query_if_previously_requested($sql_query) {
2076
+		if ($this->_show_next_x_db_queries > 0) {
2077 2077
 			echo $sql_query;
2078 2078
 			$this->_show_next_x_db_queries--;
2079 2079
 		}
@@ -2097,9 +2097,9 @@  discard block
 block discarded – undo
2097 2097
 	 * @return EE_Base_Class which was added as a relation. Object referred to by $other_model_id_or_obj
2098 2098
 	 * @throws \EE_Error
2099 2099
 	 */
2100
-	public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $extra_join_model_fields_n_values = array()){
2100
+	public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $extra_join_model_fields_n_values = array()) {
2101 2101
 		$relation_obj = $this->related_settings_for($relationName);
2102
-		return $relation_obj->add_relation_to( $id_or_obj, $other_model_id_or_obj, $extra_join_model_fields_n_values);
2102
+		return $relation_obj->add_relation_to($id_or_obj, $other_model_id_or_obj, $extra_join_model_fields_n_values);
2103 2103
 	}
2104 2104
 
2105 2105
 
@@ -2118,9 +2118,9 @@  discard block
 block discarded – undo
2118 2118
 	 * @throws \EE_Error
2119 2119
 	 * @param array  $where_query  This allows you to enter further query params for the relation to for relation to methods that allow you to further specify extra columns to join by (such as HABTM).  Keep in mind that the only acceptable query_params is strict "col" => "value" pairs because these will be inserted in any new rows created as well.
2120 2120
 	 */
2121
-	public function remove_relationship_to($id_or_obj,  $other_model_id_or_obj, $relationName, $where_query= array() ){
2121
+	public function remove_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) {
2122 2122
 		$relation_obj = $this->related_settings_for($relationName);
2123
-		return $relation_obj->remove_relation_to($id_or_obj, $other_model_id_or_obj, $where_query );
2123
+		return $relation_obj->remove_relation_to($id_or_obj, $other_model_id_or_obj, $where_query);
2124 2124
 	}
2125 2125
 
2126 2126
 
@@ -2133,9 +2133,9 @@  discard block
 block discarded – undo
2133 2133
 	 * @return \EE_Base_Class[]
2134 2134
 	 * @throws \EE_Error
2135 2135
 	 */
2136
-	public function remove_relations($id_or_obj,$relationName,$where_query_params = array()){
2136
+	public function remove_relations($id_or_obj, $relationName, $where_query_params = array()) {
2137 2137
 		$relation_obj = $this->related_settings_for($relationName);
2138
-		return $relation_obj->remove_relations($id_or_obj, $where_query_params );
2138
+		return $relation_obj->remove_relations($id_or_obj, $where_query_params);
2139 2139
 	}
2140 2140
 
2141 2141
 
@@ -2151,10 +2151,10 @@  discard block
 block discarded – undo
2151 2151
 	 * @return EE_Base_Class[]
2152 2152
 	 * @throws \EE_Error
2153 2153
 	 */
2154
-	public function get_all_related($id_or_obj, $model_name, $query_params = null){
2154
+	public function get_all_related($id_or_obj, $model_name, $query_params = null) {
2155 2155
 		$model_obj = $this->ensure_is_obj($id_or_obj);
2156 2156
 		$relation_settings = $this->related_settings_for($model_name);
2157
-		return $relation_settings->get_all_related($model_obj,$query_params);
2157
+		return $relation_settings->get_all_related($model_obj, $query_params);
2158 2158
 	}
2159 2159
 
2160 2160
 
@@ -2171,10 +2171,10 @@  discard block
 block discarded – undo
2171 2171
 	 * @return int how many deleted
2172 2172
 	 * @throws \EE_Error
2173 2173
 	 */
2174
-	public function delete_related($id_or_obj,$model_name, $query_params = array()){
2174
+	public function delete_related($id_or_obj, $model_name, $query_params = array()) {
2175 2175
 		$model_obj = $this->ensure_is_obj($id_or_obj);
2176 2176
 		$relation_settings = $this->related_settings_for($model_name);
2177
-		return $relation_settings->delete_all_related($model_obj,$query_params);
2177
+		return $relation_settings->delete_all_related($model_obj, $query_params);
2178 2178
 	}
2179 2179
 
2180 2180
 
@@ -2191,10 +2191,10 @@  discard block
 block discarded – undo
2191 2191
 	 * @return int how many deleted
2192 2192
 	 * @throws \EE_Error
2193 2193
 	 */
2194
-	public function delete_related_permanently($id_or_obj,$model_name, $query_params = array()){
2194
+	public function delete_related_permanently($id_or_obj, $model_name, $query_params = array()) {
2195 2195
 		$model_obj = $this->ensure_is_obj($id_or_obj);
2196 2196
 		$relation_settings = $this->related_settings_for($model_name);
2197
-		return $relation_settings->delete_related_permanently($model_obj,$query_params);
2197
+		return $relation_settings->delete_related_permanently($model_obj, $query_params);
2198 2198
 	}
2199 2199
 
2200 2200
 
@@ -2211,17 +2211,17 @@  discard block
 block discarded – undo
2211 2211
 	 * @return int
2212 2212
 	 * @throws \EE_Error
2213 2213
 	 */
2214
-	public function count_related($id_or_obj,$model_name,$query_params = array(),$field_to_count = null, $distinct = FALSE){
2214
+	public function count_related($id_or_obj, $model_name, $query_params = array(), $field_to_count = null, $distinct = FALSE) {
2215 2215
 		$related_model = $this->get_related_model_obj($model_name);
2216 2216
 		//we're just going to use the query params on the related model's normal get_all query,
2217 2217
 		//except add a condition to say to match the current mod
2218
-		if( ! isset($query_params['default_where_conditions'])){
2219
-			$query_params['default_where_conditions']='none';
2218
+		if ( ! isset($query_params['default_where_conditions'])) {
2219
+			$query_params['default_where_conditions'] = 'none';
2220 2220
 		}
2221 2221
 		$this_model_name = $this->get_this_model_name();
2222 2222
 		$this_pk_field_name = $this->get_primary_key_field()->get_name();
2223
-		$query_params[0][$this_model_name.".".$this_pk_field_name]=$id_or_obj;
2224
-		return $related_model->count($query_params,$field_to_count,$distinct);
2223
+		$query_params[0][$this_model_name.".".$this_pk_field_name] = $id_or_obj;
2224
+		return $related_model->count($query_params, $field_to_count, $distinct);
2225 2225
 	}
2226 2226
 
2227 2227
 
@@ -2237,21 +2237,21 @@  discard block
 block discarded – undo
2237 2237
 	 * @return float
2238 2238
 	 * @throws \EE_Error
2239 2239
 	 */
2240
-	public function sum_related($id_or_obj,$model_name,$query_params,$field_to_sum = null){
2240
+	public function sum_related($id_or_obj, $model_name, $query_params, $field_to_sum = null) {
2241 2241
 		$related_model = $this->get_related_model_obj($model_name);
2242
-		if( ! is_array( $query_params ) ){
2243
-			EE_Error::doing_it_wrong('EEM_Base::sum_related', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
2242
+		if ( ! is_array($query_params)) {
2243
+			EE_Error::doing_it_wrong('EEM_Base::sum_related', sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), gettype($query_params)), '4.6.0');
2244 2244
 			$query_params = array();
2245 2245
 		}
2246 2246
 		//we're just going to use the query params on the related model's normal get_all query,
2247 2247
 		//except add a condition to say to match the current mod
2248
-		if( ! isset($query_params['default_where_conditions'])){
2249
-			$query_params['default_where_conditions']='none';
2248
+		if ( ! isset($query_params['default_where_conditions'])) {
2249
+			$query_params['default_where_conditions'] = 'none';
2250 2250
 		}
2251 2251
 		$this_model_name = $this->get_this_model_name();
2252 2252
 		$this_pk_field_name = $this->get_primary_key_field()->get_name();
2253
-		$query_params[0][$this_model_name.".".$this_pk_field_name]=$id_or_obj;
2254
-		return $related_model->sum($query_params,$field_to_sum);
2253
+		$query_params[0][$this_model_name.".".$this_pk_field_name] = $id_or_obj;
2254
+		return $related_model->sum($query_params, $field_to_sum);
2255 2255
 	}
2256 2256
 
2257 2257
 
@@ -2265,12 +2265,12 @@  discard block
 block discarded – undo
2265 2265
 	 * @return EE_Base_Class
2266 2266
 	 * @throws \EE_Error
2267 2267
 	 */
2268
-	public function get_first_related( EE_Base_Class $id_or_obj, $other_model_name, $query_params ){
2269
-		$query_params['limit']=1;
2270
-		$results = $this->get_all_related($id_or_obj,$other_model_name,$query_params);
2271
-		if( $results ){
2268
+	public function get_first_related(EE_Base_Class $id_or_obj, $other_model_name, $query_params) {
2269
+		$query_params['limit'] = 1;
2270
+		$results = $this->get_all_related($id_or_obj, $other_model_name, $query_params);
2271
+		if ($results) {
2272 2272
 			return array_shift($results);
2273
-		}else{
2273
+		} else {
2274 2274
 			return null;
2275 2275
 		}
2276 2276
 
@@ -2280,8 +2280,8 @@  discard block
 block discarded – undo
2280 2280
 	 * Gets the model's name as it's expected in queries. For example, if this is EEM_Event model, that would be Event
2281 2281
 	 * @return string
2282 2282
 	 */
2283
-	public function get_this_model_name(){
2284
-		return str_replace("EEM_","",get_class($this));
2283
+	public function get_this_model_name() {
2284
+		return str_replace("EEM_", "", get_class($this));
2285 2285
 	}
2286 2286
 
2287 2287
 	/**
@@ -2289,14 +2289,14 @@  discard block
 block discarded – undo
2289 2289
 	 * @return EE_Any_Foreign_Model_Name_Field
2290 2290
 	 * @throws EE_Error
2291 2291
 	 */
2292
-	public function get_field_containing_related_model_name(){
2293
-		foreach($this->field_settings(true) as $field){
2294
-			if($field instanceof EE_Any_Foreign_Model_Name_Field){
2292
+	public function get_field_containing_related_model_name() {
2293
+		foreach ($this->field_settings(true) as $field) {
2294
+			if ($field instanceof EE_Any_Foreign_Model_Name_Field) {
2295 2295
 				$field_with_model_name = $field;
2296 2296
 			}
2297 2297
 		}
2298
-		if( !isset($field_with_model_name) || !$field_with_model_name ){
2299
-			throw new EE_Error(sprintf(__("There is no EE_Any_Foreign_Model_Name field on model %s", "event_espresso"), $this->get_this_model_name() ));
2298
+		if ( ! isset($field_with_model_name) || ! $field_with_model_name) {
2299
+			throw new EE_Error(sprintf(__("There is no EE_Any_Foreign_Model_Name field on model %s", "event_espresso"), $this->get_this_model_name()));
2300 2300
 		}
2301 2301
 		return $field_with_model_name;
2302 2302
 	}
@@ -2317,19 +2317,19 @@  discard block
 block discarded – undo
2317 2317
 	 * @return int new primary key on main table that got inserted
2318 2318
 	 * @throws EE_Error
2319 2319
 	 */
2320
-	public function insert($field_n_values){
2320
+	public function insert($field_n_values) {
2321 2321
 		/**
2322 2322
 		 * Filters the fields and their values before inserting an item using the models
2323 2323
 		 * @param array $fields_n_values keys are the fields and values are their new values
2324 2324
 		 * @param EEM_Base $model the model used
2325 2325
 		 */
2326
-		$field_n_values = (array)apply_filters( 'FHEE__EEM_Base__insert__fields_n_values', $field_n_values, $this );
2327
-		if($this->_satisfies_unique_indexes($field_n_values)){
2326
+		$field_n_values = (array) apply_filters('FHEE__EEM_Base__insert__fields_n_values', $field_n_values, $this);
2327
+		if ($this->_satisfies_unique_indexes($field_n_values)) {
2328 2328
 			$main_table = $this->_get_main_table();
2329 2329
 			$new_id = $this->_insert_into_specific_table($main_table, $field_n_values, false);
2330
-			if( $new_id !== false ) {
2331
-				foreach($this->_get_other_tables() as $other_table){
2332
-					$this->_insert_into_specific_table($other_table, $field_n_values,$new_id);
2330
+			if ($new_id !== false) {
2331
+				foreach ($this->_get_other_tables() as $other_table) {
2332
+					$this->_insert_into_specific_table($other_table, $field_n_values, $new_id);
2333 2333
 				}
2334 2334
 			}
2335 2335
 			/**
@@ -2339,9 +2339,9 @@  discard block
 block discarded – undo
2339 2339
 			 * @param array $fields_n_values fields and their values
2340 2340
 			 * @param int|string the ID of the newly-inserted model object
2341 2341
 			 */
2342
-			do_action( 'AHEE__EEM_Base__insert__end', $this, $field_n_values, $new_id );
2342
+			do_action('AHEE__EEM_Base__insert__end', $this, $field_n_values, $new_id);
2343 2343
 			return $new_id;
2344
-		}else{
2344
+		} else {
2345 2345
 			return FALSE;
2346 2346
 		}
2347 2347
 	}
@@ -2356,10 +2356,10 @@  discard block
 block discarded – undo
2356 2356
 	 * @return boolean
2357 2357
 	 * @throws \EE_Error
2358 2358
 	 */
2359
-	protected function _satisfies_unique_indexes($field_n_values,$action = 'insert'){
2360
-		foreach($this->unique_indexes() as $index_name => $index){
2359
+	protected function _satisfies_unique_indexes($field_n_values, $action = 'insert') {
2360
+		foreach ($this->unique_indexes() as $index_name => $index) {
2361 2361
 			$uniqueness_where_params = array_intersect_key($field_n_values, $index->fields());
2362
-			if($this->exists(array($uniqueness_where_params))){
2362
+			if ($this->exists(array($uniqueness_where_params))) {
2363 2363
 				EE_Error::add_error(
2364 2364
 					sprintf(
2365 2365
 						__(
@@ -2369,8 +2369,8 @@  discard block
 block discarded – undo
2369 2369
 						$action,
2370 2370
 						$this->_get_class_name(),
2371 2371
 						$index_name,
2372
-						implode( ",", $index->field_names() ),
2373
-						http_build_query( $uniqueness_where_params )
2372
+						implode(",", $index->field_names()),
2373
+						http_build_query($uniqueness_where_params)
2374 2374
 					),
2375 2375
 					__FILE__,
2376 2376
 					__FUNCTION__,
@@ -2400,37 +2400,37 @@  discard block
 block discarded – undo
2400 2400
 	 * @throws EE_Error
2401 2401
 	 * @return EE_Base_Class|array
2402 2402
 	 */
2403
-	public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true ){
2404
-		if($obj_or_fields_array instanceof EE_Base_Class){
2403
+	public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true) {
2404
+		if ($obj_or_fields_array instanceof EE_Base_Class) {
2405 2405
 			$fields_n_values = $obj_or_fields_array->model_field_array();
2406
-		}elseif( is_array($obj_or_fields_array)){
2406
+		}elseif (is_array($obj_or_fields_array)) {
2407 2407
 			$fields_n_values = $obj_or_fields_array;
2408
-		}else{
2408
+		} else {
2409 2409
 			throw new EE_Error(
2410 2410
 				sprintf(
2411 2411
 					__(
2412 2412
 						"%s get_all_conflicting should be called with a model object or an array of field names and values, you provided %d",
2413 2413
 						"event_espresso"
2414 2414
 					),
2415
-					get_class( $this ),
2415
+					get_class($this),
2416 2416
 					$obj_or_fields_array
2417 2417
 				)
2418 2418
 			);
2419 2419
 		}
2420 2420
 		$query_params = array();
2421
-		if( $this->has_primary_key_field() &&
2422
-				( $include_primary_key || $this->get_primary_key_field() instanceof EE_Primary_Key_String_Field) &&
2423
-				isset($fields_n_values[$this->primary_key_name()])){
2421
+		if ($this->has_primary_key_field() &&
2422
+				($include_primary_key || $this->get_primary_key_field() instanceof EE_Primary_Key_String_Field) &&
2423
+				isset($fields_n_values[$this->primary_key_name()])) {
2424 2424
 			$query_params[0]['OR'][$this->primary_key_name()] = $fields_n_values[$this->primary_key_name()];
2425 2425
 		}
2426
-		foreach($this->unique_indexes() as $unique_index_name=>$unique_index){
2426
+		foreach ($this->unique_indexes() as $unique_index_name=>$unique_index) {
2427 2427
 			$uniqueness_where_params = array_intersect_key($fields_n_values, $unique_index->fields());
2428 2428
 			$query_params[0]['OR']['AND*'.$unique_index_name] = $uniqueness_where_params;
2429 2429
 		}
2430 2430
 		//if there is nothing to base this search on, then we shouldn't find anything
2431
-		if( empty( $query_params ) ){
2431
+		if (empty($query_params)) {
2432 2432
 			return array();
2433
-		}else{
2433
+		} else {
2434 2434
 			return $this->get_one($query_params);
2435 2435
 		}
2436 2436
 	}
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 	 * @return boolean
2445 2445
 	 * @throws \EE_Error
2446 2446
 	 */
2447
-	public function exists($query_params){
2447
+	public function exists($query_params) {
2448 2448
 		$query_params['limit'] = 1;
2449 2449
 		return $this->count($query_params) > 0;
2450 2450
 	}
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
 	 * @return boolean
2459 2459
 	 * @throws \EE_Error
2460 2460
 	 */
2461
-	public function exists_by_ID($id){
2461
+	public function exists_by_ID($id) {
2462 2462
 		return $this->exists(array('default_where_conditions'=>'none', array($this->primary_key_name() => $id)));
2463 2463
 	}
2464 2464
 
@@ -2478,45 +2478,45 @@  discard block
 block discarded – undo
2478 2478
 	 * @global WPDB $wpdb only used to get the $wpdb->insert_id after performing an insert
2479 2479
 	 * @return int ID of new row inserted, or FALSE on failure
2480 2480
 	 */
2481
-	protected function _insert_into_specific_table(EE_Table_Base $table, $fields_n_values, $new_id = 0 ){
2481
+	protected function _insert_into_specific_table(EE_Table_Base $table, $fields_n_values, $new_id = 0) {
2482 2482
 		global $wpdb;
2483 2483
 		$insertion_col_n_values = array();
2484 2484
 		$format_for_insertion = array();
2485 2485
 		$fields_on_table = $this->_get_fields_for_table($table->get_table_alias());
2486
-		foreach($fields_on_table as $field_name => $field_obj){
2486
+		foreach ($fields_on_table as $field_name => $field_obj) {
2487 2487
 			//check if its an auto-incrementing column, in which case we should just leave it to do its autoincrement thing
2488
-			if($field_obj->is_auto_increment()){
2488
+			if ($field_obj->is_auto_increment()) {
2489 2489
 				continue;
2490 2490
 			}
2491 2491
 			$prepared_value = $this->_prepare_value_or_use_default($field_obj, $fields_n_values);
2492 2492
 			//if the value we want to assign it to is NULL, just don't mention it for the insertion
2493
-			if( $prepared_value !== NULL ){
2494
-				$insertion_col_n_values[ $field_obj->get_table_column() ] = $prepared_value;
2493
+			if ($prepared_value !== NULL) {
2494
+				$insertion_col_n_values[$field_obj->get_table_column()] = $prepared_value;
2495 2495
 				$format_for_insertion[] = $field_obj->get_wpdb_data_type();
2496 2496
 			}
2497 2497
 		}
2498 2498
 
2499
-		if($table instanceof EE_Secondary_Table && $new_id){
2499
+		if ($table instanceof EE_Secondary_Table && $new_id) {
2500 2500
 			//its not the main table, so we should have already saved the main table's PK which we just inserted
2501 2501
 			//so add the fk to the main table as a column
2502 2502
 			$insertion_col_n_values[$table->get_fk_on_table()] = $new_id;
2503
-			$format_for_insertion[]='%d';//yes right now we're only allowing these foreign keys to be INTs
2503
+			$format_for_insertion[] = '%d'; //yes right now we're only allowing these foreign keys to be INTs
2504 2504
 		}
2505 2505
 		//insert the new entry
2506
-		$result = $this->_do_wpdb_query( 'insert', array( $table->get_table_name(), $insertion_col_n_values, $format_for_insertion ) );
2507
-		if( $result === false ) {
2506
+		$result = $this->_do_wpdb_query('insert', array($table->get_table_name(), $insertion_col_n_values, $format_for_insertion));
2507
+		if ($result === false) {
2508 2508
 			return false;
2509 2509
 		}
2510 2510
 		//ok, now what do we return for the ID of the newly-inserted thing?
2511
-		if($this->has_primary_key_field()){
2512
-			if($this->get_primary_key_field()->is_auto_increment()){
2511
+		if ($this->has_primary_key_field()) {
2512
+			if ($this->get_primary_key_field()->is_auto_increment()) {
2513 2513
 				return $wpdb->insert_id;
2514
-			}else{
2514
+			} else {
2515 2515
 				//it's not an auto-increment primary key, so
2516 2516
 				//it must have been supplied
2517 2517
 				return $fields_n_values[$this->get_primary_key_field()->get_name()];
2518 2518
 			}
2519
-		}else{
2519
+		} else {
2520 2520
 			//we can't return a  primary key because there is none. instead return
2521 2521
 			//a unique string indicating this model
2522 2522
 			return $this->get_index_primary_key_string($fields_n_values);
@@ -2535,15 +2535,15 @@  discard block
 block discarded – undo
2535 2535
 	 * @return mixed string|int|float depending on what the table column will be expecting
2536 2536
 	 * @throws \EE_Error
2537 2537
 	 */
2538
-	protected function _prepare_value_or_use_default( $field_obj, $fields_n_values ){
2538
+	protected function _prepare_value_or_use_default($field_obj, $fields_n_values) {
2539 2539
 		//if this field doesn't allow nullable, don't allow it
2540
-		if( ! $field_obj->is_nullable() && (
2541
-				! isset( $fields_n_values[ $field_obj->get_name() ] ) ||
2542
-				$fields_n_values[ $field_obj->get_name() ] === NULL ) ){
2543
-			$fields_n_values[ $field_obj->get_name() ] = $field_obj->get_default_value();
2540
+		if ( ! $field_obj->is_nullable() && (
2541
+				! isset($fields_n_values[$field_obj->get_name()]) ||
2542
+				$fields_n_values[$field_obj->get_name()] === NULL )) {
2543
+			$fields_n_values[$field_obj->get_name()] = $field_obj->get_default_value();
2544 2544
 		}
2545
-		$unprepared_value = isset( $fields_n_values[ $field_obj->get_name() ] ) ? $fields_n_values[ $field_obj->get_name() ] : NULL;
2546
-		return $this->_prepare_value_for_use_in_db( $unprepared_value, $field_obj);
2545
+		$unprepared_value = isset($fields_n_values[$field_obj->get_name()]) ? $fields_n_values[$field_obj->get_name()] : NULL;
2546
+		return $this->_prepare_value_for_use_in_db($unprepared_value, $field_obj);
2547 2547
 	}
2548 2548
 
2549 2549
 
@@ -2555,9 +2555,9 @@  discard block
 block discarded – undo
2555 2555
 	 * @param EE_Model_Field_Base $field field which will be doing the preparing of the value. If null, we assume $value is a custom selection
2556 2556
 	 * @return mixed a value ready for use in the database for insertions, updating, or in a where clause
2557 2557
 	 */
2558
-	private function _prepare_value_for_use_in_db($value, $field){
2559
-		if($field && $field instanceof EE_Model_Field_Base){
2560
-			switch( $this->_values_already_prepared_by_model_object ){
2558
+	private function _prepare_value_for_use_in_db($value, $field) {
2559
+		if ($field && $field instanceof EE_Model_Field_Base) {
2560
+			switch ($this->_values_already_prepared_by_model_object) {
2561 2561
 				/** @noinspection PhpMissingBreakStatementInspection */
2562 2562
 				case self::not_prepared_by_model_object:
2563 2563
 					$value = $field->prepare_for_set($value);
@@ -2568,7 +2568,7 @@  discard block
 block discarded – undo
2568 2568
 					//leave the value alone
2569 2569
 			}
2570 2570
 			return $value;
2571
-		}else{
2571
+		} else {
2572 2572
 			return $value;
2573 2573
 		}
2574 2574
 	}
@@ -2578,13 +2578,13 @@  discard block
 block discarded – undo
2578 2578
 	 * @return EE_Primary_Table
2579 2579
 	 * @throws EE_Error
2580 2580
 	 */
2581
-	protected function _get_main_table(){
2582
-		foreach($this->_tables as $table){
2583
-			if($table instanceof EE_Primary_Table){
2581
+	protected function _get_main_table() {
2582
+		foreach ($this->_tables as $table) {
2583
+			if ($table instanceof EE_Primary_Table) {
2584 2584
 				return $table;
2585 2585
 			}
2586 2586
 		}
2587
-		throw new EE_Error(sprintf(__('There are no main tables on %s. They should be added to _tables array in the constructor','event_espresso'),get_class($this)));
2587
+		throw new EE_Error(sprintf(__('There are no main tables on %s. They should be added to _tables array in the constructor', 'event_espresso'), get_class($this)));
2588 2588
 	}
2589 2589
 
2590 2590
 
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
 	 */
2608 2608
 	public function second_table() {
2609 2609
 		// grab second table from tables array
2610
-		$second_table = end( $this->_tables );
2610
+		$second_table = end($this->_tables);
2611 2611
 		return $second_table instanceof EE_Secondary_Table ? $second_table->get_table_name() : NULL;
2612 2612
 	}
2613 2613
 
@@ -2620,8 +2620,8 @@  discard block
 block discarded – undo
2620 2620
 	 * @param string $table_alias
2621 2621
 	 * @return EE_Primary_Table | EE_Secondary_Table
2622 2622
 	 */
2623
-	public function get_table_obj_by_alias( $table_alias = '' ) {
2624
-		return isset( $this->_tables[ $table_alias ] ) ? $this->_tables[ $table_alias ] : NULL;
2623
+	public function get_table_obj_by_alias($table_alias = '') {
2624
+		return isset($this->_tables[$table_alias]) ? $this->_tables[$table_alias] : NULL;
2625 2625
 	}
2626 2626
 
2627 2627
 
@@ -2630,10 +2630,10 @@  discard block
 block discarded – undo
2630 2630
 	 * Gets all the tables of type EE_Other_Table from EEM_CPT_Basel_Model::_tables
2631 2631
 	 * @return EE_Secondary_Table[]
2632 2632
 	 */
2633
-	protected function _get_other_tables(){
2634
-		$other_tables =array();
2635
-		foreach($this->_tables as $table_alias => $table){
2636
-			if($table instanceof EE_Secondary_Table){
2633
+	protected function _get_other_tables() {
2634
+		$other_tables = array();
2635
+		foreach ($this->_tables as $table_alias => $table) {
2636
+			if ($table instanceof EE_Secondary_Table) {
2637 2637
 				$other_tables[$table_alias] = $table;
2638 2638
 			}
2639 2639
 		}
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
 	 * @param string $table_alias, array key in EEM_Base::_tables
2646 2646
 	 * @return EE_Model_Field_Base[]
2647 2647
 	 */
2648
-	public function _get_fields_for_table($table_alias){
2648
+	public function _get_fields_for_table($table_alias) {
2649 2649
 		return $this->_fields[$table_alias];
2650 2650
 	}
2651 2651
 
@@ -2661,19 +2661,19 @@  discard block
 block discarded – undo
2661 2661
 	 * @return EE_Model_Query_Info_Carrier
2662 2662
 	 * @throws \EE_Error
2663 2663
 	 */
2664
-	public function _extract_related_models_from_query($query_params){
2664
+	public function _extract_related_models_from_query($query_params) {
2665 2665
 		$query_info_carrier = new EE_Model_Query_Info_Carrier();
2666
-		if ( array_key_exists( 0, $query_params ) ) {
2667
-			$this->_extract_related_models_from_sub_params_array_keys( $query_params[0], $query_info_carrier, 0 );
2666
+		if (array_key_exists(0, $query_params)) {
2667
+			$this->_extract_related_models_from_sub_params_array_keys($query_params[0], $query_info_carrier, 0);
2668 2668
 		}
2669
-		if ( array_key_exists( 'group_by', $query_params ) ) {
2670
-			if ( is_array( $query_params['group_by'] ) ) {
2669
+		if (array_key_exists('group_by', $query_params)) {
2670
+			if (is_array($query_params['group_by'])) {
2671 2671
 				$this->_extract_related_models_from_sub_params_array_values(
2672 2672
 					$query_params['group_by'],
2673 2673
 					$query_info_carrier,
2674 2674
 					'group_by'
2675 2675
 				);
2676
-			} elseif ( ! empty ( $query_params['group_by'] ) ) {
2676
+			} elseif ( ! empty ($query_params['group_by'])) {
2677 2677
 				$this->_extract_related_model_info_from_query_param(
2678 2678
 					$query_params['group_by'],
2679 2679
 					$query_info_carrier,
@@ -2681,21 +2681,21 @@  discard block
 block discarded – undo
2681 2681
 				);
2682 2682
 			}
2683 2683
 		}
2684
-		if ( array_key_exists( 'having', $query_params ) ) {
2684
+		if (array_key_exists('having', $query_params)) {
2685 2685
 			$this->_extract_related_models_from_sub_params_array_keys(
2686 2686
 				$query_params[0],
2687 2687
 				$query_info_carrier,
2688 2688
 				'having'
2689 2689
 			);
2690 2690
 		}
2691
-		if ( array_key_exists( 'order_by', $query_params ) ) {
2692
-			if ( is_array( $query_params['order_by'] ) ) {
2691
+		if (array_key_exists('order_by', $query_params)) {
2692
+			if (is_array($query_params['order_by'])) {
2693 2693
 				$this->_extract_related_models_from_sub_params_array_keys(
2694 2694
 					$query_params['order_by'],
2695 2695
 					$query_info_carrier,
2696 2696
 					'order_by'
2697 2697
 				);
2698
-			} elseif ( ! empty( $query_params['order_by'] ) ) {
2698
+			} elseif ( ! empty($query_params['order_by'])) {
2699 2699
 				$this->_extract_related_model_info_from_query_param(
2700 2700
 					$query_params['order_by'],
2701 2701
 					$query_info_carrier,
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
 				);
2704 2704
 			}
2705 2705
 		}
2706
-		if ( array_key_exists( 'force_join', $query_params ) ) {
2706
+		if (array_key_exists('force_join', $query_params)) {
2707 2707
 			$this->_extract_related_models_from_sub_params_array_values(
2708 2708
 				$query_params['force_join'],
2709 2709
 				$query_info_carrier,
@@ -2721,34 +2721,34 @@  discard block
 block discarded – undo
2721 2721
 	 * @throws EE_Error
2722 2722
 	 * @return \EE_Model_Query_Info_Carrier
2723 2723
 	 */
2724
-	private function _extract_related_models_from_sub_params_array_keys($sub_query_params, EE_Model_Query_Info_Carrier $model_query_info_carrier,$query_param_type){
2725
-		if (!empty($sub_query_params)){
2724
+	private function _extract_related_models_from_sub_params_array_keys($sub_query_params, EE_Model_Query_Info_Carrier $model_query_info_carrier, $query_param_type) {
2725
+		if ( ! empty($sub_query_params)) {
2726 2726
 			$sub_query_params = (array) $sub_query_params;
2727
-			foreach($sub_query_params as $param => $possibly_array_of_params){
2727
+			foreach ($sub_query_params as $param => $possibly_array_of_params) {
2728 2728
 				//$param could be simply 'EVT_ID', or it could be 'Registrations.REG_ID', or even 'Registrations.Transactions.Payments.PAY_amount'
2729
-				$this->_extract_related_model_info_from_query_param( $param, $model_query_info_carrier,$query_param_type);
2729
+				$this->_extract_related_model_info_from_query_param($param, $model_query_info_carrier, $query_param_type);
2730 2730
 
2731 2731
 				//if $possibly_array_of_params is an array, try recursing into it, searching for keys which
2732 2732
 				//indicate needed joins. Eg, array('NOT'=>array('Registration.TXN_ID'=>23)). In this case, we tried
2733 2733
 				//extracting models out of the 'NOT', which obviously wasn't successful, and then we recurse into the value
2734 2734
 				//of array('Registration.TXN_ID'=>23)
2735 2735
 				$query_param_sans_stars = $this->_remove_stars_and_anything_after_from_condition_query_param_key($param);
2736
-				if(in_array($query_param_sans_stars, $this->_logic_query_param_keys,true)){
2737
-					if (! is_array($possibly_array_of_params)){
2736
+				if (in_array($query_param_sans_stars, $this->_logic_query_param_keys, true)) {
2737
+					if ( ! is_array($possibly_array_of_params)) {
2738 2738
 						throw new EE_Error(sprintf(__("You used a special where query param %s, but the value isn't an array of where query params, it's just %s'. It should be an array, eg array('EVT_ID'=>23,'OR'=>array('Venue.VNU_ID'=>32,'Venue.VNU_name'=>'monkey_land'))", "event_espresso"),
2739
-							$param,$possibly_array_of_params));
2740
-					}else{
2741
-						$this->_extract_related_models_from_sub_params_array_keys($possibly_array_of_params, $model_query_info_carrier,$query_param_type);
2739
+							$param, $possibly_array_of_params));
2740
+					} else {
2741
+						$this->_extract_related_models_from_sub_params_array_keys($possibly_array_of_params, $model_query_info_carrier, $query_param_type);
2742 2742
 					}
2743
-				}elseif($query_param_type === 0 //ie WHERE
2743
+				}elseif ($query_param_type === 0 //ie WHERE
2744 2744
 						&& is_array($possibly_array_of_params)
2745 2745
 						&& isset($possibly_array_of_params[2])
2746
-						&& $possibly_array_of_params[2] == true){
2746
+						&& $possibly_array_of_params[2] == true) {
2747 2747
 					//then $possible_array_of_params looks something like array('<','DTT_sold',true)
2748 2748
 					//indicating that $possible_array_of_params[1] is actually a field name,
2749 2749
 					//from which we should extract query parameters!
2750
-					if( ! isset($possibly_array_of_params[0], $possibly_array_of_params[1] ) ) {
2751
-						throw new EE_Error(sprintf(__("Improperly formed query parameter %s. It should be numerically indexed like array('<','DTT_sold',true); but you provided %s", "event_espresso"),$query_param_type,implode(",",$possibly_array_of_params)));
2750
+					if ( ! isset($possibly_array_of_params[0], $possibly_array_of_params[1])) {
2751
+						throw new EE_Error(sprintf(__("Improperly formed query parameter %s. It should be numerically indexed like array('<','DTT_sold',true); but you provided %s", "event_espresso"), $query_param_type, implode(",", $possibly_array_of_params)));
2752 2752
 					}
2753 2753
 					$this->_extract_related_model_info_from_query_param($possibly_array_of_params[1], $model_query_info_carrier, $query_param_type);
2754 2754
 				}
@@ -2767,14 +2767,14 @@  discard block
 block discarded – undo
2767 2767
 	 * @throws EE_Error
2768 2768
 	 * @return \EE_Model_Query_Info_Carrier
2769 2769
 	 */
2770
-	private function _extract_related_models_from_sub_params_array_values($sub_query_params, EE_Model_Query_Info_Carrier $model_query_info_carrier,$query_param_type){
2771
-		if (!empty($sub_query_params)){
2772
-			if(!is_array($sub_query_params)){
2773
-				throw new EE_Error(sprintf(__("Query parameter %s should be an array, but it isn't.", "event_espresso"),$sub_query_params));
2770
+	private function _extract_related_models_from_sub_params_array_values($sub_query_params, EE_Model_Query_Info_Carrier $model_query_info_carrier, $query_param_type) {
2771
+		if ( ! empty($sub_query_params)) {
2772
+			if ( ! is_array($sub_query_params)) {
2773
+				throw new EE_Error(sprintf(__("Query parameter %s should be an array, but it isn't.", "event_espresso"), $sub_query_params));
2774 2774
 			}
2775
-			foreach($sub_query_params as $param){
2775
+			foreach ($sub_query_params as $param) {
2776 2776
 				//$param could be simply 'EVT_ID', or it could be 'Registrations.REG_ID', or even 'Registrations.Transactions.Payments.PAY_amount'
2777
-				$this->_extract_related_model_info_from_query_param( $param, $model_query_info_carrier, $query_param_type);
2777
+				$this->_extract_related_model_info_from_query_param($param, $model_query_info_carrier, $query_param_type);
2778 2778
 			}
2779 2779
 		}
2780 2780
 		return $model_query_info_carrier;
@@ -2793,8 +2793,8 @@  discard block
 block discarded – undo
2793 2793
 	 * @throws EE_Error
2794 2794
 	 * @return EE_Model_Query_Info_Carrier
2795 2795
 	 */
2796
-	public function _create_model_query_info_carrier($query_params){
2797
-		if ( ! is_array( $query_params ) ) {
2796
+	public function _create_model_query_info_carrier($query_params) {
2797
+		if ( ! is_array($query_params)) {
2798 2798
 			EE_Error::doing_it_wrong(
2799 2799
 				'EEM_Base::_create_model_query_info_carrier',
2800 2800
 				sprintf(
@@ -2802,16 +2802,16 @@  discard block
 block discarded – undo
2802 2802
 						'$query_params should be an array, you passed a variable of type %s',
2803 2803
 						'event_espresso'
2804 2804
 					),
2805
-					gettype( $query_params )
2805
+					gettype($query_params)
2806 2806
 				),
2807 2807
 				'4.6.0'
2808 2808
 			);
2809 2809
 			$query_params = array();
2810 2810
 		}
2811
-		$where_query_params = isset( $query_params[0] ) ? $query_params[0] : array();
2811
+		$where_query_params = isset($query_params[0]) ? $query_params[0] : array();
2812 2812
 		//first check if we should alter the query to account for caps or not
2813 2813
 		//because the caps might require us to do extra joins
2814
-		if ( isset( $query_params['caps'] ) && $query_params['caps'] !== 'none' ) {
2814
+		if (isset($query_params['caps']) && $query_params['caps'] !== 'none') {
2815 2815
 			$query_params[0] = $where_query_params = array_replace_recursive(
2816 2816
 				$where_query_params,
2817 2817
 				$this->caps_where_conditions(
@@ -2819,10 +2819,10 @@  discard block
 block discarded – undo
2819 2819
 				)
2820 2820
 			);
2821 2821
 		}
2822
-		$query_object = $this->_extract_related_models_from_query( $query_params );
2822
+		$query_object = $this->_extract_related_models_from_query($query_params);
2823 2823
 		//verify where_query_params has NO numeric indexes.... that's simply not how you use it!
2824
-		foreach ( $where_query_params as $key => $value ) {
2825
-			if ( is_int( $key ) ) {
2824
+		foreach ($where_query_params as $key => $value) {
2825
+			if (is_int($key)) {
2826 2826
 				throw new EE_Error(
2827 2827
 					sprintf(
2828 2828
 						__(
@@ -2830,16 +2830,16 @@  discard block
 block discarded – undo
2830 2830
 							"event_espresso"
2831 2831
 						),
2832 2832
 						$key,
2833
-						var_export( $value, true ),
2834
-						var_export( $query_params, true ),
2835
-						get_class( $this )
2833
+						var_export($value, true),
2834
+						var_export($query_params, true),
2835
+						get_class($this)
2836 2836
 					)
2837 2837
 				);
2838 2838
 			}
2839 2839
 		}
2840 2840
 		if (
2841
-			array_key_exists( 'default_where_conditions', $query_params )
2842
-			&& ! empty( $query_params['default_where_conditions'] )
2841
+			array_key_exists('default_where_conditions', $query_params)
2842
+			&& ! empty($query_params['default_where_conditions'])
2843 2843
 		) {
2844 2844
 			$use_default_where_conditions = $query_params['default_where_conditions'];
2845 2845
 		} else {
@@ -2853,13 +2853,13 @@  discard block
 block discarded – undo
2853 2853
 			),
2854 2854
 			$where_query_params
2855 2855
 		);
2856
-		$query_object->set_where_sql( $this->_construct_where_clause( $where_query_params ) );
2856
+		$query_object->set_where_sql($this->_construct_where_clause($where_query_params));
2857 2857
 		// if this is a "on_join_limit" then we are limiting on on a specific table in a multi_table join.
2858 2858
 		// So we need to setup a subquery and use that for the main join.
2859 2859
 		// Note for now this only works on the primary table for the model.
2860 2860
 		// So for instance, you could set the limit array like this:
2861 2861
 		// array( 'on_join_limit' => array('Primary_Table_Alias', array(1,10) ) )
2862
-		if ( array_key_exists( 'on_join_limit', $query_params ) && ! empty( $query_params['on_join_limit'] ) ) {
2862
+		if (array_key_exists('on_join_limit', $query_params) && ! empty($query_params['on_join_limit'])) {
2863 2863
 			$query_object->set_main_model_join_sql(
2864 2864
 				$this->_construct_limit_join_select(
2865 2865
 					$query_params['on_join_limit'][0],
@@ -2868,40 +2868,40 @@  discard block
 block discarded – undo
2868 2868
 			);
2869 2869
 		}
2870 2870
 		//set limit
2871
-		if ( array_key_exists( 'limit', $query_params ) ) {
2872
-			if ( is_array( $query_params['limit'] ) ) {
2873
-				if ( ! isset( $query_params['limit'][0], $query_params['limit'][1] ) ) {
2871
+		if (array_key_exists('limit', $query_params)) {
2872
+			if (is_array($query_params['limit'])) {
2873
+				if ( ! isset($query_params['limit'][0], $query_params['limit'][1])) {
2874 2874
 					$e = sprintf(
2875 2875
 						__(
2876 2876
 							"Invalid DB query. You passed '%s' for the LIMIT, but only the following are valid: an integer, string representing an integer, a string like 'int,int', or an array like array(int,int)",
2877 2877
 							"event_espresso"
2878 2878
 						),
2879
-						http_build_query( $query_params['limit'] )
2879
+						http_build_query($query_params['limit'])
2880 2880
 					);
2881
-					throw new EE_Error( $e . "|" . $e );
2881
+					throw new EE_Error($e."|".$e);
2882 2882
 				}
2883 2883
 				//they passed us an array for the limit. Assume it's like array(50,25), meaning offset by 50, and get 25
2884
-				$query_object->set_limit_sql( " LIMIT " . $query_params['limit'][0] . "," . $query_params['limit'][1] );
2885
-			} elseif ( ! empty ( $query_params['limit'] ) ) {
2886
-				$query_object->set_limit_sql( " LIMIT " . $query_params['limit'] );
2884
+				$query_object->set_limit_sql(" LIMIT ".$query_params['limit'][0].",".$query_params['limit'][1]);
2885
+			} elseif ( ! empty ($query_params['limit'])) {
2886
+				$query_object->set_limit_sql(" LIMIT ".$query_params['limit']);
2887 2887
 			}
2888 2888
 		}
2889 2889
 		//set order by
2890
-		if ( array_key_exists( 'order_by', $query_params ) ) {
2891
-			if ( is_array( $query_params['order_by'] ) ) {
2890
+		if (array_key_exists('order_by', $query_params)) {
2891
+			if (is_array($query_params['order_by'])) {
2892 2892
 				//if they're using 'order_by' as an array, they can't use 'order' (because 'order_by' must
2893 2893
 				//specify whether to ascend or descend on each field. Eg 'order_by'=>array('EVT_ID'=>'ASC'). So
2894 2894
 				//including 'order' wouldn't make any sense if 'order_by' has already specified which way to order!
2895
-				if ( array_key_exists( 'order', $query_params ) ) {
2895
+				if (array_key_exists('order', $query_params)) {
2896 2896
 					throw new EE_Error(
2897 2897
 						sprintf(
2898 2898
 							__(
2899 2899
 								"In querying %s, we are using query parameter 'order_by' as an array (keys:%s,values:%s), and so we can't use query parameter 'order' (value %s). You should just use the 'order_by' parameter ",
2900 2900
 								"event_espresso"
2901 2901
 							),
2902
-							get_class( $this ),
2903
-							implode( ", ", array_keys( $query_params['order_by'] ) ),
2904
-							implode( ", ", $query_params['order_by'] ),
2902
+							get_class($this),
2903
+							implode(", ", array_keys($query_params['order_by'])),
2904
+							implode(", ", $query_params['order_by']),
2905 2905
 							$query_params['order']
2906 2906
 						)
2907 2907
 					);
@@ -2913,57 +2913,57 @@  discard block
 block discarded – undo
2913 2913
 				);
2914 2914
 				//assume it's an array of fields to order by
2915 2915
 				$order_array = array();
2916
-				foreach ( $query_params['order_by'] as $field_name_to_order_by => $order ) {
2917
-					$order = $this->_extract_order( $order );
2918
-					$order_array[] = $this->_deduce_column_name_from_query_param( $field_name_to_order_by ) . SP . $order;
2916
+				foreach ($query_params['order_by'] as $field_name_to_order_by => $order) {
2917
+					$order = $this->_extract_order($order);
2918
+					$order_array[] = $this->_deduce_column_name_from_query_param($field_name_to_order_by).SP.$order;
2919 2919
 				}
2920
-				$query_object->set_order_by_sql( " ORDER BY " . implode( ",", $order_array ) );
2921
-			} elseif ( ! empty ( $query_params['order_by'] ) ) {
2920
+				$query_object->set_order_by_sql(" ORDER BY ".implode(",", $order_array));
2921
+			} elseif ( ! empty ($query_params['order_by'])) {
2922 2922
 				$this->_extract_related_model_info_from_query_param(
2923 2923
 					$query_params['order_by'],
2924 2924
 					$query_object,
2925 2925
 					'order',
2926 2926
 					$query_params['order_by']
2927 2927
 				);
2928
-				$order = isset( $query_params['order'] )
2929
-					? $this->_extract_order( $query_params['order'] )
2928
+				$order = isset($query_params['order'])
2929
+					? $this->_extract_order($query_params['order'])
2930 2930
 					: 'DESC';
2931 2931
 				$query_object->set_order_by_sql(
2932
-					" ORDER BY " . $this->_deduce_column_name_from_query_param( $query_params['order_by'] ) . SP . $order
2932
+					" ORDER BY ".$this->_deduce_column_name_from_query_param($query_params['order_by']).SP.$order
2933 2933
 				);
2934 2934
 			}
2935 2935
 		}
2936 2936
 		//if 'order_by' wasn't set, maybe they are just using 'order' on its own?
2937
-		if ( ! array_key_exists( 'order_by', $query_params )
2938
-		     && array_key_exists( 'order', $query_params )
2939
-		     && ! empty( $query_params['order'] )
2937
+		if ( ! array_key_exists('order_by', $query_params)
2938
+		     && array_key_exists('order', $query_params)
2939
+		     && ! empty($query_params['order'])
2940 2940
 		) {
2941 2941
 			$pk_field = $this->get_primary_key_field();
2942
-			$order = $this->_extract_order( $query_params['order'] );
2943
-			$query_object->set_order_by_sql( " ORDER BY " . $pk_field->get_qualified_column() . SP . $order );
2942
+			$order = $this->_extract_order($query_params['order']);
2943
+			$query_object->set_order_by_sql(" ORDER BY ".$pk_field->get_qualified_column().SP.$order);
2944 2944
 		}
2945 2945
 		//set group by
2946
-		if ( array_key_exists( 'group_by', $query_params ) ) {
2947
-			if ( is_array( $query_params['group_by'] ) ) {
2946
+		if (array_key_exists('group_by', $query_params)) {
2947
+			if (is_array($query_params['group_by'])) {
2948 2948
 				//it's an array, so assume we'll be grouping by a bunch of stuff
2949 2949
 				$group_by_array = array();
2950
-				foreach ( $query_params['group_by'] as $field_name_to_group_by ) {
2951
-					$group_by_array[] = $this->_deduce_column_name_from_query_param( $field_name_to_group_by );
2950
+				foreach ($query_params['group_by'] as $field_name_to_group_by) {
2951
+					$group_by_array[] = $this->_deduce_column_name_from_query_param($field_name_to_group_by);
2952 2952
 				}
2953
-				$query_object->set_group_by_sql( " GROUP BY " . implode( ", ", $group_by_array ) );
2954
-			} elseif ( ! empty ( $query_params['group_by'] ) ) {
2953
+				$query_object->set_group_by_sql(" GROUP BY ".implode(", ", $group_by_array));
2954
+			} elseif ( ! empty ($query_params['group_by'])) {
2955 2955
 				$query_object->set_group_by_sql(
2956
-					" GROUP BY " . $this->_deduce_column_name_from_query_param( $query_params['group_by'] )
2956
+					" GROUP BY ".$this->_deduce_column_name_from_query_param($query_params['group_by'])
2957 2957
 				);
2958 2958
 			}
2959 2959
 		}
2960 2960
 		//set having
2961
-		if ( array_key_exists( 'having', $query_params ) && $query_params['having'] ) {
2962
-			$query_object->set_having_sql( $this->_construct_having_clause( $query_params['having'] ) );
2961
+		if (array_key_exists('having', $query_params) && $query_params['having']) {
2962
+			$query_object->set_having_sql($this->_construct_having_clause($query_params['having']));
2963 2963
 		}
2964 2964
 		//now, just verify they didn't pass anything wack
2965
-		foreach ( $query_params as $query_key => $query_value ) {
2966
-			if ( ! in_array( $query_key, $this->_allowed_query_params, true ) ) {
2965
+		foreach ($query_params as $query_key => $query_value) {
2966
+			if ( ! in_array($query_key, $this->_allowed_query_params, true)) {
2967 2967
 				throw new EE_Error(
2968 2968
 					sprintf(
2969 2969
 						__(
@@ -2971,16 +2971,16 @@  discard block
 block discarded – undo
2971 2971
 							'event_espresso'
2972 2972
 						),
2973 2973
 						$query_key,
2974
-						get_class( $this ),
2974
+						get_class($this),
2975 2975
 //						print_r( $this->_allowed_query_params, TRUE )
2976
-						implode( ',', $this->_allowed_query_params )
2976
+						implode(',', $this->_allowed_query_params)
2977 2977
 					)
2978 2978
 				);
2979 2979
 			}
2980 2980
 		}
2981 2981
 		$main_model_join_sql = $query_object->get_main_model_join_sql();
2982
-		if ( empty( $main_model_join_sql ) ) {
2983
-			$query_object->set_main_model_join_sql( $this->_construct_internal_join() );
2982
+		if (empty($main_model_join_sql)) {
2983
+			$query_object->set_main_model_join_sql($this->_construct_internal_join());
2984 2984
 		}
2985 2985
 		return $query_object;
2986 2986
 	}
@@ -2995,17 +2995,17 @@  discard block
 block discarded – undo
2995 2995
 	 * @return array like EEM_Base::get_all() 's $query_params[0]
2996 2996
 	 * @throws \EE_Error
2997 2997
 	 */
2998
-	public function caps_where_conditions( $context = self::caps_read ) {
2999
-		EEM_Base::verify_is_valid_cap_context( $context );
2998
+	public function caps_where_conditions($context = self::caps_read) {
2999
+		EEM_Base::verify_is_valid_cap_context($context);
3000 3000
 		$cap_where_conditions = array();
3001
-		$cap_restrictions = $this->caps_missing( $context );
3001
+		$cap_restrictions = $this->caps_missing($context);
3002 3002
 		/**
3003 3003
 		 * @var $cap_restrictions EE_Default_Where_Conditions[]
3004 3004
 		 */
3005
-		foreach( $cap_restrictions as $cap => $restriction_if_no_cap ) {
3006
-				$cap_where_conditions = array_replace_recursive( $cap_where_conditions, $restriction_if_no_cap->get_default_where_conditions() );
3005
+		foreach ($cap_restrictions as $cap => $restriction_if_no_cap) {
3006
+				$cap_where_conditions = array_replace_recursive($cap_where_conditions, $restriction_if_no_cap->get_default_where_conditions());
3007 3007
 		}
3008
-		return apply_filters( 'FHEE__EEM_Base__caps_where_conditions__return', $cap_where_conditions, $this, $context, $cap_restrictions );
3008
+		return apply_filters('FHEE__EEM_Base__caps_where_conditions__return', $cap_where_conditions, $this, $context, $cap_restrictions);
3009 3009
 	}
3010 3010
 
3011 3011
 	/**
@@ -3015,11 +3015,11 @@  discard block
 block discarded – undo
3015 3015
 	 * @return string either ASC, asc, DESC or desc
3016 3016
 	 * @throws EE_Error
3017 3017
 	 */
3018
-	private function _extract_order($should_be_order_string){
3019
-		if(in_array($should_be_order_string, $this->_allowed_order_values)){
3018
+	private function _extract_order($should_be_order_string) {
3019
+		if (in_array($should_be_order_string, $this->_allowed_order_values)) {
3020 3020
 			return $should_be_order_string;
3021
-		}else{
3022
-			throw new EE_Error(sprintf(__("While performing a query on '%s', tried to use '%s' as an order parameter. ", "event_espresso"),get_class($this),$should_be_order_string));
3021
+		} else {
3022
+			throw new EE_Error(sprintf(__("While performing a query on '%s', tried to use '%s' as an order parameter. ", "event_espresso"), get_class($this), $should_be_order_string));
3023 3023
 		}
3024 3024
 	}
3025 3025
 
@@ -3037,7 +3037,7 @@  discard block
 block discarded – undo
3037 3037
 	 * @throws EE_Error
3038 3038
 	 * @return array like $query_params[0], see EEM_Base::get_all for documentation
3039 3039
 	 */
3040
-	private function _get_default_where_conditions_for_models_in_query(EE_Model_Query_Info_Carrier $query_info_carrier,$use_default_where_conditions = 'all',$where_query_params = array()){
3040
+	private function _get_default_where_conditions_for_models_in_query(EE_Model_Query_Info_Carrier $query_info_carrier, $use_default_where_conditions = 'all', $where_query_params = array()) {
3041 3041
 		$allowed_used_default_where_conditions_values = array(
3042 3042
 				'all',
3043 3043
 				'this_model_only',
@@ -3045,17 +3045,17 @@  discard block
 block discarded – undo
3045 3045
 				'minimum',
3046 3046
 				'none'
3047 3047
 			);
3048
-		if( ! in_array($use_default_where_conditions,$allowed_used_default_where_conditions_values)){
3049
-			throw new EE_Error(sprintf(__("You passed an invalid value to the query parameter 'default_where_conditions' of '%s'. Allowed values are %s", "event_espresso"),$use_default_where_conditions,implode(", ",$allowed_used_default_where_conditions_values)));
3048
+		if ( ! in_array($use_default_where_conditions, $allowed_used_default_where_conditions_values)) {
3049
+			throw new EE_Error(sprintf(__("You passed an invalid value to the query parameter 'default_where_conditions' of '%s'. Allowed values are %s", "event_espresso"), $use_default_where_conditions, implode(", ", $allowed_used_default_where_conditions_values)));
3050 3050
 		}
3051 3051
 		$universal_query_params = array();
3052
-		if( $use_default_where_conditions === 'all' || $use_default_where_conditions === 'this_model_only' ){
3052
+		if ($use_default_where_conditions === 'all' || $use_default_where_conditions === 'this_model_only') {
3053 3053
 			$universal_query_params = $this->_get_default_where_conditions();
3054
-		} else if( $use_default_where_conditions === 'minimum' ) {
3054
+		} else if ($use_default_where_conditions === 'minimum') {
3055 3055
 			$universal_query_params = $this->_get_minimum_where_conditions();
3056 3056
 		}
3057
-		if(in_array($use_default_where_conditions,array('all','other_models_only'))){
3058
-			foreach($query_info_carrier->get_model_names_included() as $model_relation_path => $model_name){
3057
+		if (in_array($use_default_where_conditions, array('all', 'other_models_only'))) {
3058
+			foreach ($query_info_carrier->get_model_names_included() as $model_relation_path => $model_name) {
3059 3059
 				$related_model = $this->get_related_model_obj($model_name);
3060 3060
 				$related_model_universal_where_params = $related_model->_get_default_where_conditions($model_relation_path);
3061 3061
 				$overrides = $this->_override_defaults_or_make_null_friendly(
@@ -3088,20 +3088,20 @@  discard block
 block discarded – undo
3088 3088
 	 * @return array like EEM_Base::get_all's $query_params[0]
3089 3089
 	 * @throws \EE_Error
3090 3090
 	 */
3091
-	private function _override_defaults_or_make_null_friendly($default_where_conditions,$provided_where_conditions,$model,$model_relation_path){
3091
+	private function _override_defaults_or_make_null_friendly($default_where_conditions, $provided_where_conditions, $model, $model_relation_path) {
3092 3092
 		$null_friendly_where_conditions = array();
3093 3093
 		$none_overridden = true;
3094 3094
 		$or_condition_key_for_defaults = 'OR*'.get_class($model);
3095 3095
 
3096
-		foreach($default_where_conditions as $key => $val){
3097
-			if( isset($provided_where_conditions[$key])){
3096
+		foreach ($default_where_conditions as $key => $val) {
3097
+			if (isset($provided_where_conditions[$key])) {
3098 3098
 				$none_overridden = false;
3099
-			}else{
3099
+			} else {
3100 3100
 				$null_friendly_where_conditions[$or_condition_key_for_defaults]['AND'][$key] = $val;
3101 3101
 			}
3102 3102
 		}
3103
-		if( $none_overridden && $default_where_conditions){
3104
-			if($model->has_primary_key_field()){
3103
+		if ($none_overridden && $default_where_conditions) {
3104
+			if ($model->has_primary_key_field()) {
3105 3105
 				$null_friendly_where_conditions[$or_condition_key_for_defaults][$model_relation_path.".".$model->primary_key_name()] = array('IS NULL');
3106 3106
 			}/*else{
3107 3107
 				//@todo NO PK, use other defaults
@@ -3118,8 +3118,8 @@  discard block
 block discarded – undo
3118 3118
 	 * @param string $model_relation_path eg, path from Event to Payment is "Registration.Transaction.Payment."
3119 3119
 	 * @return array like EEM_Base::get_all's $query_params[0] (where conditions)
3120 3120
 	 */
3121
-	private function _get_default_where_conditions($model_relation_path = null){
3122
-		if ( $this->_ignore_where_strategy ){
3121
+	private function _get_default_where_conditions($model_relation_path = null) {
3122
+		if ($this->_ignore_where_strategy) {
3123 3123
 			return array();
3124 3124
 		}
3125 3125
 		return $this->_default_where_conditions_strategy->get_default_where_conditions($model_relation_path);
@@ -3133,8 +3133,8 @@  discard block
 block discarded – undo
3133 3133
 	 * @param string $model_relation_path eg, path from Event to Payment is "Registration.Transaction.Payment."
3134 3134
 	 * @return array like EEM_Base::get_all's $query_params[0] (where conditions)
3135 3135
 	 */
3136
-	protected function _get_minimum_where_conditions($model_relation_path = null){
3137
-		if ( $this->_ignore_where_strategy ){
3136
+	protected function _get_minimum_where_conditions($model_relation_path = null) {
3137
+		if ($this->_ignore_where_strategy) {
3138 3138
 			return array();
3139 3139
 		}
3140 3140
 		return $this->_minimum_where_conditions_strategy->get_default_where_conditions($model_relation_path);
@@ -3150,16 +3150,16 @@  discard block
 block discarded – undo
3150 3150
 	 * @return string
3151 3151
 	 * @throws \EE_Error
3152 3152
 	 */
3153
-	private function _construct_default_select_sql(EE_Model_Query_Info_Carrier $model_query_info){
3153
+	private function _construct_default_select_sql(EE_Model_Query_Info_Carrier $model_query_info) {
3154 3154
 		$selects = $this->_get_columns_to_select_for_this_model();
3155
-		foreach($model_query_info->get_model_names_included() as $model_relation_chain => $name_of_other_model_included){
3155
+		foreach ($model_query_info->get_model_names_included() as $model_relation_chain => $name_of_other_model_included) {
3156 3156
 			$other_model_included = $this->get_related_model_obj($name_of_other_model_included);
3157
-			$other_model_selects = $other_model_included->_get_columns_to_select_for_this_model( $model_relation_chain );
3158
-			foreach ( $other_model_selects as $key => $value ) {
3157
+			$other_model_selects = $other_model_included->_get_columns_to_select_for_this_model($model_relation_chain);
3158
+			foreach ($other_model_selects as $key => $value) {
3159 3159
 				$selects[] = $value;
3160 3160
 			}
3161 3161
 		}
3162
-		return implode(", ",$selects);
3162
+		return implode(", ", $selects);
3163 3163
 	}
3164 3164
 
3165 3165
 	/**
@@ -3168,19 +3168,19 @@  discard block
 block discarded – undo
3168 3168
 	 * @param string $model_relation_chain like 'Question.Question_Group.Event'
3169 3169
 	 * @return array numerically indexed, values are columns to select and rename, eg "Event.ID AS 'Event.ID'"
3170 3170
 	 */
3171
-	public function _get_columns_to_select_for_this_model($model_relation_chain = ''){
3171
+	public function _get_columns_to_select_for_this_model($model_relation_chain = '') {
3172 3172
 		$fields = $this->field_settings();
3173 3173
 		$selects = array();
3174 3174
 		$table_alias_with_model_relation_chain_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model_name());
3175
-		foreach($fields as $field_obj){
3176
-			$selects[] = $table_alias_with_model_relation_chain_prefix . $field_obj->get_table_alias().".".$field_obj->get_table_column()." AS '".$table_alias_with_model_relation_chain_prefix.$field_obj->get_table_alias().".".$field_obj->get_table_column()."'";
3175
+		foreach ($fields as $field_obj) {
3176
+			$selects[] = $table_alias_with_model_relation_chain_prefix.$field_obj->get_table_alias().".".$field_obj->get_table_column()." AS '".$table_alias_with_model_relation_chain_prefix.$field_obj->get_table_alias().".".$field_obj->get_table_column()."'";
3177 3177
 		}
3178 3178
 		//make sure we are also getting the PKs of each table
3179 3179
 		$tables = $this->get_tables();
3180
-		if(count($tables) > 1){
3181
-			foreach($tables as $table_obj){
3182
-				$qualified_pk_column = $table_alias_with_model_relation_chain_prefix . $table_obj->get_fully_qualified_pk_column();
3183
-				if( ! in_array($qualified_pk_column,$selects)){
3180
+		if (count($tables) > 1) {
3181
+			foreach ($tables as $table_obj) {
3182
+				$qualified_pk_column = $table_alias_with_model_relation_chain_prefix.$table_obj->get_fully_qualified_pk_column();
3183
+				if ( ! in_array($qualified_pk_column, $selects)) {
3184 3184
 					$selects[] = "$qualified_pk_column AS '$qualified_pk_column'";
3185 3185
 				}
3186 3186
 			}
@@ -3210,65 +3210,65 @@  discard block
 block discarded – undo
3210 3210
 		$query_param_type,
3211 3211
 		$original_query_param = null
3212 3212
 	) {
3213
-		if( $original_query_param === null ){
3213
+		if ($original_query_param === null) {
3214 3214
 			$original_query_param = $query_param;
3215 3215
 		}
3216 3216
 		$query_param = $this->_remove_stars_and_anything_after_from_condition_query_param_key($query_param);
3217 3217
 		/** @var $allow_logic_query_params bool whether or not to allow logic_query_params like 'NOT','OR', or 'AND' */
3218
-		$allow_logic_query_params = in_array($query_param_type,array('where','having'));
3219
-		$allow_fields = in_array($query_param_type,array('where','having','order_by','group_by','order'));
3218
+		$allow_logic_query_params = in_array($query_param_type, array('where', 'having'));
3219
+		$allow_fields = in_array($query_param_type, array('where', 'having', 'order_by', 'group_by', 'order'));
3220 3220
 		//check to see if we have a field on this model
3221 3221
 		$this_model_fields = $this->field_settings(true);
3222
-		if(array_key_exists($query_param,$this_model_fields)){
3223
-			if($allow_fields){
3222
+		if (array_key_exists($query_param, $this_model_fields)) {
3223
+			if ($allow_fields) {
3224 3224
 				return;
3225
-			}else{
3225
+			} else {
3226 3226
 				throw new EE_Error(sprintf(__("Using a field name (%s) on model %s is not allowed on this query param type '%s'. Original query param was %s", "event_espresso"),
3227
-						$query_param,get_class($this),$query_param_type,$original_query_param));
3227
+						$query_param, get_class($this), $query_param_type, $original_query_param));
3228 3228
 			}
3229 3229
 		}
3230 3230
 		//check if this is a special logic query param
3231
-		elseif(in_array($query_param, $this->_logic_query_param_keys, TRUE)){
3232
-			if($allow_logic_query_params){
3231
+		elseif (in_array($query_param, $this->_logic_query_param_keys, TRUE)) {
3232
+			if ($allow_logic_query_params) {
3233 3233
 				return;
3234
-			}else{
3234
+			} else {
3235 3235
 				throw new EE_Error(
3236 3236
 					sprintf(
3237
-						__( 'Logic query params ("%1$s") are being used incorrectly with the following query param ("%2$s") on model %3$s. %4$sAdditional Info:%4$s%5$s', 'event_espresso' ),
3238
-						implode( '", "', $this->_logic_query_param_keys ),
3239
-						$query_param ,
3240
-						get_class( $this ),
3237
+						__('Logic query params ("%1$s") are being used incorrectly with the following query param ("%2$s") on model %3$s. %4$sAdditional Info:%4$s%5$s', 'event_espresso'),
3238
+						implode('", "', $this->_logic_query_param_keys),
3239
+						$query_param,
3240
+						get_class($this),
3241 3241
 						'<br />',
3242
-						"\t" . ' $passed_in_query_info = <pre>' . print_r( $passed_in_query_info, TRUE ) . '</pre>' . "\n\t" . ' $query_param_type = ' . $query_param_type . "\n\t" . ' $original_query_param = ' . $original_query_param
3242
+						"\t".' $passed_in_query_info = <pre>'.print_r($passed_in_query_info, TRUE).'</pre>'."\n\t".' $query_param_type = '.$query_param_type."\n\t".' $original_query_param = '.$original_query_param
3243 3243
 					)
3244 3244
 				);
3245 3245
 			}
3246 3246
 		}
3247 3247
 
3248 3248
 		//check if it's a custom selection
3249
-		elseif(array_key_exists($query_param,$this->_custom_selections)){
3249
+		elseif (array_key_exists($query_param, $this->_custom_selections)) {
3250 3250
 			return;
3251 3251
 		}
3252 3252
 
3253 3253
 		//check if has a model name at the beginning
3254 3254
 		//and
3255 3255
 		//check if it's a field on a related model
3256
-		foreach($this->_model_relations as $valid_related_model_name=>$relation_obj){
3257
-			if(strpos($query_param, $valid_related_model_name.".") === 0){
3258
-				$this->_add_join_to_model($valid_related_model_name, $passed_in_query_info,$original_query_param);
3256
+		foreach ($this->_model_relations as $valid_related_model_name=>$relation_obj) {
3257
+			if (strpos($query_param, $valid_related_model_name.".") === 0) {
3258
+				$this->_add_join_to_model($valid_related_model_name, $passed_in_query_info, $original_query_param);
3259 3259
 				$query_param = substr($query_param, strlen($valid_related_model_name."."));
3260
-				if($query_param === ''){
3260
+				if ($query_param === '') {
3261 3261
 					//nothing left to $query_param
3262 3262
 					//we should actually end in a field name, not a model like this!
3263 3263
 					throw new EE_Error(sprintf(__("Query param '%s' (of type %s on model %s) shouldn't end on a period (.) ", "event_espresso"),
3264
-					$query_param,$query_param_type,get_class($this),$valid_related_model_name));
3265
-				}else{
3264
+					$query_param, $query_param_type, get_class($this), $valid_related_model_name));
3265
+				} else {
3266 3266
 					$related_model_obj = $this->get_related_model_obj($valid_related_model_name);
3267 3267
 					$related_model_obj->_extract_related_model_info_from_query_param($query_param, $passed_in_query_info, $query_param_type, $original_query_param);
3268 3268
 					return;
3269 3269
 				}
3270
-			}elseif($query_param === $valid_related_model_name){
3271
-				$this->_add_join_to_model($valid_related_model_name, $passed_in_query_info,$original_query_param);
3270
+			}elseif ($query_param === $valid_related_model_name) {
3271
+				$this->_add_join_to_model($valid_related_model_name, $passed_in_query_info, $original_query_param);
3272 3272
 				return;
3273 3273
 			}
3274 3274
 		}
@@ -3278,7 +3278,7 @@  discard block
 block discarded – undo
3278 3278
 		//and we previously confirmed it wasn't a logic query param or field on the current model
3279 3279
 		//it's wack, that's what it is
3280 3280
 		throw new EE_Error(sprintf(__("There is no model named '%s' related to %s. Query param type is %s and original query param is %s", "event_espresso"),
3281
-				$query_param,get_class($this),$query_param_type,$original_query_param));
3281
+				$query_param, get_class($this), $query_param_type, $original_query_param));
3282 3282
 
3283 3283
 	}
3284 3284
 
@@ -3297,26 +3297,26 @@  discard block
 block discarded – undo
3297 3297
 	 * @return void
3298 3298
 	 * @throws \EE_Error
3299 3299
 	 */
3300
-	private function _add_join_to_model($model_name, EE_Model_Query_Info_Carrier $passed_in_query_info,$original_query_param){
3300
+	private function _add_join_to_model($model_name, EE_Model_Query_Info_Carrier $passed_in_query_info, $original_query_param) {
3301 3301
 		$relation_obj = $this->related_settings_for($model_name);
3302 3302
 
3303 3303
 		$model_relation_chain = EE_Model_Parser::extract_model_relation_chain($model_name, $original_query_param);
3304 3304
 		//check if the relation is HABTM, because then we're essentially doing two joins
3305 3305
 		//If so, join first to the JOIN table, and add its data types, and then continue as normal
3306
-		if($relation_obj instanceof EE_HABTM_Relation){
3306
+		if ($relation_obj instanceof EE_HABTM_Relation) {
3307 3307
 			$join_model_obj = $relation_obj->get_join_model();
3308 3308
 			//replace the model specified with the join model for this relation chain, whi
3309 3309
 			$relation_chain_to_join_model = EE_Model_Parser::replace_model_name_with_join_model_name_in_model_relation_chain($model_name, $join_model_obj->get_this_model_name(), $model_relation_chain);
3310 3310
 			$new_query_info = new EE_Model_Query_Info_Carrier(
3311 3311
 					array($relation_chain_to_join_model => $join_model_obj->get_this_model_name()),
3312 3312
 					$relation_obj->get_join_to_intermediate_model_statement($relation_chain_to_join_model));
3313
-			$passed_in_query_info->merge( $new_query_info  );
3313
+			$passed_in_query_info->merge($new_query_info);
3314 3314
 		}
3315 3315
 		//now just join to the other table pointed to by the relation object, and add its data types
3316 3316
 		$new_query_info = new EE_Model_Query_Info_Carrier(
3317 3317
 				array($model_relation_chain=>$model_name),
3318 3318
 				$relation_obj->get_join_statement($model_relation_chain));
3319
-		$passed_in_query_info->merge( $new_query_info  );
3319
+		$passed_in_query_info->merge($new_query_info);
3320 3320
 	}
3321 3321
 
3322 3322
 
@@ -3328,11 +3328,11 @@  discard block
 block discarded – undo
3328 3328
 	 * @return string of SQL
3329 3329
 	 * @throws \EE_Error
3330 3330
 	 */
3331
-	private function _construct_where_clause($where_params){
3331
+	private function _construct_where_clause($where_params) {
3332 3332
 		$SQL = $this->_construct_condition_clause_recursive($where_params, ' AND ');
3333
-		if($SQL){
3334
-			return " WHERE ". $SQL;
3335
-		}else{
3333
+		if ($SQL) {
3334
+			return " WHERE ".$SQL;
3335
+		} else {
3336 3336
 			return '';
3337 3337
 		}
3338 3338
 	}
@@ -3347,11 +3347,11 @@  discard block
 block discarded – undo
3347 3347
 	 * @return string
3348 3348
 	 * @throws \EE_Error
3349 3349
 	 */
3350
-	private function _construct_having_clause($having_params){
3350
+	private function _construct_having_clause($having_params) {
3351 3351
 		$SQL = $this->_construct_condition_clause_recursive($having_params, ' AND ');
3352
-		if($SQL){
3353
-			return " HAVING ". $SQL;
3354
-		}else{
3352
+		if ($SQL) {
3353
+			return " HAVING ".$SQL;
3354
+		} else {
3355 3355
 			return '';
3356 3356
 		}
3357 3357
 
@@ -3365,16 +3365,16 @@  discard block
 block discarded – undo
3365 3365
 	 * @return EE_Model_Field_Base
3366 3366
 	 * @throws EE_Error
3367 3367
 	 */
3368
-	protected function _get_field_on_model($field_name,$model_name){
3368
+	protected function _get_field_on_model($field_name, $model_name) {
3369 3369
 		$model_class = 'EEM_'.$model_name;
3370 3370
 		$model_filepath = $model_class.".model.php";
3371
-		if ( is_readable($model_filepath)){
3371
+		if (is_readable($model_filepath)) {
3372 3372
 			require_once($model_filepath);
3373
-			$model_instance=call_user_func($model_name."::instance");
3373
+			$model_instance = call_user_func($model_name."::instance");
3374 3374
 			/* @var $model_instance EEM_Base */
3375 3375
 			return $model_instance->field_settings_for($field_name);
3376
-		}else{
3377
-			throw new EE_Error(sprintf(__('No model named %s exists, with classname %s and filepath %s','event_espresso'),$model_name,$model_class,$model_filepath));
3376
+		} else {
3377
+			throw new EE_Error(sprintf(__('No model named %s exists, with classname %s and filepath %s', 'event_espresso'), $model_name, $model_class, $model_filepath));
3378 3378
 		}
3379 3379
 	}
3380 3380
 
@@ -3387,41 +3387,41 @@  discard block
 block discarded – undo
3387 3387
 	 * @throws EE_Error
3388 3388
 	 * @return string of SQL
3389 3389
 	 */
3390
-	private function _construct_condition_clause_recursive($where_params, $glue = ' AND'){
3391
-		$where_clauses=array();
3392
-		foreach($where_params as $query_param => $op_and_value_or_sub_condition){
3393
-			$query_param = $this->_remove_stars_and_anything_after_from_condition_query_param_key($query_param);//str_replace("*",'',$query_param);
3394
-			if(in_array($query_param,$this->_logic_query_param_keys)){
3395
-				switch($query_param){
3390
+	private function _construct_condition_clause_recursive($where_params, $glue = ' AND') {
3391
+		$where_clauses = array();
3392
+		foreach ($where_params as $query_param => $op_and_value_or_sub_condition) {
3393
+			$query_param = $this->_remove_stars_and_anything_after_from_condition_query_param_key($query_param); //str_replace("*",'',$query_param);
3394
+			if (in_array($query_param, $this->_logic_query_param_keys)) {
3395
+				switch ($query_param) {
3396 3396
 					case 'not':
3397 3397
 					case 'NOT':
3398
-						$where_clauses[] = "! (". $this->_construct_condition_clause_recursive($op_and_value_or_sub_condition, $glue).")";
3398
+						$where_clauses[] = "! (".$this->_construct_condition_clause_recursive($op_and_value_or_sub_condition, $glue).")";
3399 3399
 						break;
3400 3400
 					case 'and':
3401 3401
 					case 'AND':
3402
-						$where_clauses[] = " (". $this->_construct_condition_clause_recursive($op_and_value_or_sub_condition, ' AND ') .")";
3402
+						$where_clauses[] = " (".$this->_construct_condition_clause_recursive($op_and_value_or_sub_condition, ' AND ').")";
3403 3403
 						break;
3404 3404
 					case 'or':
3405 3405
 					case 'OR':
3406
-						$where_clauses[] = " (". $this->_construct_condition_clause_recursive($op_and_value_or_sub_condition, ' OR ') .")";
3406
+						$where_clauses[] = " (".$this->_construct_condition_clause_recursive($op_and_value_or_sub_condition, ' OR ').")";
3407 3407
 						break;
3408 3408
 				}
3409
-			}else{
3409
+			} else {
3410 3410
 				$field_obj = $this->_deduce_field_from_query_param($query_param);
3411 3411
 
3412 3412
 				//if it's not a normal field, maybe it's a custom selection?
3413
-				if( ! $field_obj){
3414
-					if(isset( $this->_custom_selections[$query_param][1])){
3413
+				if ( ! $field_obj) {
3414
+					if (isset($this->_custom_selections[$query_param][1])) {
3415 3415
 						$field_obj = $this->_custom_selections[$query_param][1];
3416
-					}else{
3417
-						throw new EE_Error(sprintf(__("%s is neither a valid model field name, nor a custom selection", "event_espresso"),$query_param));
3416
+					} else {
3417
+						throw new EE_Error(sprintf(__("%s is neither a valid model field name, nor a custom selection", "event_espresso"), $query_param));
3418 3418
 					}
3419 3419
 				}
3420 3420
 				$op_and_value_sql = $this->_construct_op_and_value($op_and_value_or_sub_condition, $field_obj);
3421
-				$where_clauses[]=$this->_deduce_column_name_from_query_param($query_param).SP.$op_and_value_sql;
3421
+				$where_clauses[] = $this->_deduce_column_name_from_query_param($query_param).SP.$op_and_value_sql;
3422 3422
 			}
3423 3423
 		}
3424
-		return $where_clauses ? implode( $glue, $where_clauses ) : '';
3424
+		return $where_clauses ? implode($glue, $where_clauses) : '';
3425 3425
 	}
3426 3426
 
3427 3427
 
@@ -3432,18 +3432,18 @@  discard block
 block discarded – undo
3432 3432
 	 * @throws EE_Error
3433 3433
 	 * @return string table alias and column name for SQL, eg "Transaction.TXN_ID"
3434 3434
 	 */
3435
-	private function _deduce_column_name_from_query_param($query_param){
3435
+	private function _deduce_column_name_from_query_param($query_param) {
3436 3436
 		$field = $this->_deduce_field_from_query_param($query_param);
3437 3437
 
3438
-		if( $field ){
3439
-			$table_alias_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_from_query_param( $field->get_model_name(), $query_param );
3440
-			return $table_alias_prefix . $field->get_qualified_column();
3441
-		}elseif(array_key_exists($query_param,$this->_custom_selections)){
3438
+		if ($field) {
3439
+			$table_alias_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_from_query_param($field->get_model_name(), $query_param);
3440
+			return $table_alias_prefix.$field->get_qualified_column();
3441
+		}elseif (array_key_exists($query_param, $this->_custom_selections)) {
3442 3442
 			//maybe it's custom selection item?
3443 3443
 			//if so, just use it as the "column name"
3444 3444
 			return $query_param;
3445
-		}else{
3446
-			throw new EE_Error(sprintf(__("%s is not a valid field on this model, nor a custom selection (%s)", "event_espresso"),$query_param,implode(",",$this->_custom_selections)));
3445
+		} else {
3446
+			throw new EE_Error(sprintf(__("%s is not a valid field on this model, nor a custom selection (%s)", "event_espresso"), $query_param, implode(",", $this->_custom_selections)));
3447 3447
 		}
3448 3448
 	}
3449 3449
 
@@ -3455,11 +3455,11 @@  discard block
 block discarded – undo
3455 3455
 	 * @param string $condition_query_param_key
3456 3456
 	 * @return string
3457 3457
 	 */
3458
-	private function _remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key){
3458
+	private function _remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key) {
3459 3459
 		$pos_of_star = strpos($condition_query_param_key, '*');
3460
-		if($pos_of_star === FALSE){
3460
+		if ($pos_of_star === FALSE) {
3461 3461
 			return $condition_query_param_key;
3462
-		}else{
3462
+		} else {
3463 3463
 			$condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star);
3464 3464
 			return $condition_query_param_sans_star;
3465 3465
 		}
@@ -3474,12 +3474,12 @@  discard block
 block discarded – undo
3474 3474
 	 * @throws EE_Error
3475 3475
 	 * @return string
3476 3476
 	 */
3477
-	private function _construct_op_and_value($op_and_value, $field_obj){
3478
-		if ( is_array( $op_and_value ) ) {
3479
-			$operator = isset( $op_and_value[0] ) ? $this->_prepare_operator_for_sql( $op_and_value[0] ) : null;
3480
-			if ( ! $operator ) {
3477
+	private function _construct_op_and_value($op_and_value, $field_obj) {
3478
+		if (is_array($op_and_value)) {
3479
+			$operator = isset($op_and_value[0]) ? $this->_prepare_operator_for_sql($op_and_value[0]) : null;
3480
+			if ( ! $operator) {
3481 3481
 				$php_array_like_string = array();
3482
-				foreach ( $op_and_value as $key => $value ) {
3482
+				foreach ($op_and_value as $key => $value) {
3483 3483
 					$php_array_like_string[] = "$key=>$value";
3484 3484
 				}
3485 3485
 				throw new EE_Error(
@@ -3488,27 +3488,27 @@  discard block
 block discarded – undo
3488 3488
 							"You setup a query parameter like you were going to specify an operator, but didn't. You provided '(%s)', but the operator should be at array key index 0 (eg array('>',32))",
3489 3489
 							"event_espresso"
3490 3490
 						),
3491
-						implode( ",", $php_array_like_string )
3491
+						implode(",", $php_array_like_string)
3492 3492
 					)
3493 3493
 				);
3494 3494
 			}
3495
-			$value = isset( $op_and_value[1] ) ? $op_and_value[1] : null;
3495
+			$value = isset($op_and_value[1]) ? $op_and_value[1] : null;
3496 3496
 		} else {
3497 3497
 			$operator = '=';
3498 3498
 			$value = $op_and_value;
3499 3499
 		}
3500 3500
 		//check to see if the value is actually another field
3501
-		if ( is_array( $op_and_value ) && isset( $op_and_value[2] ) && $op_and_value[2] == true ) {
3502
-			return $operator . SP . $this->_deduce_column_name_from_query_param( $value );
3503
-		} elseif ( in_array( $operator, $this->_in_style_operators ) && is_array( $value ) ) {
3501
+		if (is_array($op_and_value) && isset($op_and_value[2]) && $op_and_value[2] == true) {
3502
+			return $operator.SP.$this->_deduce_column_name_from_query_param($value);
3503
+		} elseif (in_array($operator, $this->_in_style_operators) && is_array($value)) {
3504 3504
 			//in this case, the value should be an array, or at least a comma-separated list
3505 3505
 			//it will need to handle a little differently
3506
-			$cleaned_value = $this->_construct_in_value( $value, $field_obj );
3506
+			$cleaned_value = $this->_construct_in_value($value, $field_obj);
3507 3507
 			//note: $cleaned_value has already been run through $wpdb->prepare()
3508
-			return $operator . SP . $cleaned_value;
3509
-		} elseif ( in_array( $operator, $this->_between_style_operators ) && is_array( $value ) ) {
3508
+			return $operator.SP.$cleaned_value;
3509
+		} elseif (in_array($operator, $this->_between_style_operators) && is_array($value)) {
3510 3510
 			//the value should be an array with count of two.
3511
-			if ( count( $value ) !== 2 ) {
3511
+			if (count($value) !== 2) {
3512 3512
 				throw new EE_Error(
3513 3513
 					sprintf(
3514 3514
 						__(
@@ -3519,10 +3519,10 @@  discard block
 block discarded – undo
3519 3519
 					)
3520 3520
 				);
3521 3521
 			}
3522
-			$cleaned_value = $this->_construct_between_value( $value, $field_obj );
3523
-			return $operator . SP . $cleaned_value;
3524
-		} elseif ( in_array( $operator, $this->_null_style_operators ) ) {
3525
-			if ( $value !== null ) {
3522
+			$cleaned_value = $this->_construct_between_value($value, $field_obj);
3523
+			return $operator.SP.$cleaned_value;
3524
+		} elseif (in_array($operator, $this->_null_style_operators)) {
3525
+			if ($value !== null) {
3526 3526
 				throw new EE_Error(
3527 3527
 					sprintf(
3528 3528
 						__(
@@ -3535,13 +3535,13 @@  discard block
 block discarded – undo
3535 3535
 				);
3536 3536
 			}
3537 3537
 			return $operator;
3538
-		} elseif ( $operator === 'LIKE' && ! is_array( $value ) ) {
3538
+		} elseif ($operator === 'LIKE' && ! is_array($value)) {
3539 3539
 			//if the operator is 'LIKE', we want to allow percent signs (%) and not
3540 3540
 			//remove other junk. So just treat it as a string.
3541
-			return $operator . SP . $this->_wpdb_prepare_using_field( $value, '%s' );
3542
-		} elseif ( ! in_array( $operator, $this->_in_style_operators ) && ! is_array( $value ) ) {
3543
-			return $operator . SP . $this->_wpdb_prepare_using_field( $value, $field_obj );
3544
-		} elseif ( in_array( $operator, $this->_in_style_operators ) && ! is_array( $value ) ) {
3541
+			return $operator.SP.$this->_wpdb_prepare_using_field($value, '%s');
3542
+		} elseif ( ! in_array($operator, $this->_in_style_operators) && ! is_array($value)) {
3543
+			return $operator.SP.$this->_wpdb_prepare_using_field($value, $field_obj);
3544
+		} elseif (in_array($operator, $this->_in_style_operators) && ! is_array($value)) {
3545 3545
 			throw new EE_Error(
3546 3546
 				sprintf(
3547 3547
 					__(
@@ -3552,7 +3552,7 @@  discard block
 block discarded – undo
3552 3552
 					$operator
3553 3553
 				)
3554 3554
 			);
3555
-		} elseif ( ! in_array( $operator, $this->_in_style_operators ) && is_array( $value ) ) {
3555
+		} elseif ( ! in_array($operator, $this->_in_style_operators) && is_array($value)) {
3556 3556
 			throw new EE_Error(
3557 3557
 				sprintf(
3558 3558
 					__(
@@ -3570,7 +3570,7 @@  discard block
 block discarded – undo
3570 3570
 						"It appears you've provided some totally invalid query parameters. Operator and value were:'%s', which isn't right at all",
3571 3571
 						"event_espresso"
3572 3572
 					),
3573
-					http_build_query( $op_and_value )
3573
+					http_build_query($op_and_value)
3574 3574
 				)
3575 3575
 			);
3576 3576
 		}
@@ -3586,12 +3586,12 @@  discard block
 block discarded – undo
3586 3586
 	 * @return string
3587 3587
 	 * @throws \EE_Error
3588 3588
 	 */
3589
-	public function _construct_between_value( $values, $field_obj ) {
3589
+	public function _construct_between_value($values, $field_obj) {
3590 3590
 		$cleaned_values = array();
3591
-		foreach ( $values as $value ) {
3592
-			$cleaned_values[] = $this->_wpdb_prepare_using_field($value,$field_obj);
3591
+		foreach ($values as $value) {
3592
+			$cleaned_values[] = $this->_wpdb_prepare_using_field($value, $field_obj);
3593 3593
 		}
3594
-		return  $cleaned_values[0] . " AND " . $cleaned_values[1];
3594
+		return  $cleaned_values[0]." AND ".$cleaned_values[1];
3595 3595
 	}
3596 3596
 
3597 3597
 
@@ -3608,26 +3608,26 @@  discard block
 block discarded – undo
3608 3608
 	 * @return string of SQL to follow an 'IN' or 'NOT IN' operator
3609 3609
 	 * @throws \EE_Error
3610 3610
 	 */
3611
-	public function _construct_in_value($values,  $field_obj){
3611
+	public function _construct_in_value($values, $field_obj) {
3612 3612
 		//check if the value is a CSV list
3613
-		if(is_string($values)){
3613
+		if (is_string($values)) {
3614 3614
 			//in which case, turn it into an array
3615
-			$values = explode(",",$values);
3615
+			$values = explode(",", $values);
3616 3616
 		}
3617 3617
 		$cleaned_values = array();
3618
-		foreach($values as $value){
3619
-			$cleaned_values[] = $this->_wpdb_prepare_using_field($value,$field_obj);
3618
+		foreach ($values as $value) {
3619
+			$cleaned_values[] = $this->_wpdb_prepare_using_field($value, $field_obj);
3620 3620
 		}
3621 3621
 		//we would just LOVE to leave $cleaned_values as an empty array, and return the value as "()",
3622 3622
 		//but unfortunately that's invalid SQL. So instead we return a string which we KNOW will evaluate to be the empty set
3623 3623
 		//which is effectively equivalent to returning "()". We don't return "(0)" because that only works for auto-incrementing columns
3624
-		if(empty($cleaned_values)){
3624
+		if (empty($cleaned_values)) {
3625 3625
 			$all_fields = $this->field_settings();
3626 3626
 			$a_field = array_shift($all_fields);
3627 3627
 			$main_table = $this->_get_main_table();
3628 3628
 			$cleaned_values[] = "SELECT ".$a_field->get_table_column()." FROM ".$main_table->get_table_name()." WHERE FALSE";
3629 3629
 		}
3630
-		return "(".implode(",",$cleaned_values).")";
3630
+		return "(".implode(",", $cleaned_values).")";
3631 3631
 	}
3632 3632
 
3633 3633
 
@@ -3639,16 +3639,16 @@  discard block
 block discarded – undo
3639 3639
 	 * @throws EE_Error
3640 3640
 	 * @return false|null|string
3641 3641
 	 */
3642
-	private function _wpdb_prepare_using_field($value,$field_obj){
3642
+	private function _wpdb_prepare_using_field($value, $field_obj) {
3643 3643
 		/** @type WPDB $wpdb */
3644 3644
 		global $wpdb;
3645
-		if($field_obj instanceof EE_Model_Field_Base){
3646
-			return $wpdb->prepare($field_obj->get_wpdb_data_type(),$this->_prepare_value_for_use_in_db($value, $field_obj));
3647
-		}else{//$field_obj should really just be a data type
3648
-			if( ! in_array($field_obj,$this->_valid_wpdb_data_types)){
3649
-				throw new EE_Error(sprintf(__("%s is not a valid wpdb datatype. Valid ones are %s", "event_espresso"),$field_obj,implode(",",$this->_valid_wpdb_data_types)));
3645
+		if ($field_obj instanceof EE_Model_Field_Base) {
3646
+			return $wpdb->prepare($field_obj->get_wpdb_data_type(), $this->_prepare_value_for_use_in_db($value, $field_obj));
3647
+		} else {//$field_obj should really just be a data type
3648
+			if ( ! in_array($field_obj, $this->_valid_wpdb_data_types)) {
3649
+				throw new EE_Error(sprintf(__("%s is not a valid wpdb datatype. Valid ones are %s", "event_espresso"), $field_obj, implode(",", $this->_valid_wpdb_data_types)));
3650 3650
 			}
3651
-			return $wpdb->prepare($field_obj,$value);
3651
+			return $wpdb->prepare($field_obj, $value);
3652 3652
 		}
3653 3653
 	}
3654 3654
 
@@ -3660,27 +3660,27 @@  discard block
 block discarded – undo
3660 3660
 	 * @throws EE_Error
3661 3661
 	 * @return EE_Model_Field_Base
3662 3662
 	 */
3663
-	protected function _deduce_field_from_query_param($query_param_name){
3663
+	protected function _deduce_field_from_query_param($query_param_name) {
3664 3664
 		//ok, now proceed with deducing which part is the model's name, and which is the field's name
3665 3665
 		//which will help us find the database table and column
3666 3666
 
3667
-		$query_param_parts = explode(".",$query_param_name);
3668
-		if(empty($query_param_parts)){
3669
-			throw new EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s",'event_espresso'),$query_param_name));
3667
+		$query_param_parts = explode(".", $query_param_name);
3668
+		if (empty($query_param_parts)) {
3669
+			throw new EE_Error(sprintf(__("_extract_column_name is empty when trying to extract column and table name from %s", 'event_espresso'), $query_param_name));
3670 3670
 		}
3671 3671
 		$number_of_parts = count($query_param_parts);
3672
-		$last_query_param_part = $query_param_parts[ count($query_param_parts) - 1 ];
3673
-		if($number_of_parts === 1){
3672
+		$last_query_param_part = $query_param_parts[count($query_param_parts) - 1];
3673
+		if ($number_of_parts === 1) {
3674 3674
 			$field_name = $last_query_param_part;
3675 3675
 			$model_obj = $this;
3676
-		}else{// $number_of_parts >= 2
3676
+		} else {// $number_of_parts >= 2
3677 3677
 			//the last part is the column name, and there are only 2parts. therefore...
3678 3678
 			$field_name = $last_query_param_part;
3679
-			$model_obj = $this->get_related_model_obj( $query_param_parts[ $number_of_parts - 2 ]);
3679
+			$model_obj = $this->get_related_model_obj($query_param_parts[$number_of_parts - 2]);
3680 3680
 		}
3681
-		try{
3681
+		try {
3682 3682
 			return $model_obj->field_settings_for($field_name);
3683
-		}catch(EE_Error $e){
3683
+		} catch (EE_Error $e) {
3684 3684
 			return null;
3685 3685
 		}
3686 3686
 	}
@@ -3694,13 +3694,13 @@  discard block
 block discarded – undo
3694 3694
 	 * @throws EE_Error
3695 3695
 	 * @return string
3696 3696
 	 */
3697
-	public function _get_qualified_column_for_field($field_name){
3697
+	public function _get_qualified_column_for_field($field_name) {
3698 3698
 		$all_fields = $this->field_settings();
3699 3699
 		$field = isset($all_fields[$field_name]) ? $all_fields[$field_name] : FALSE;
3700
-		if($field){
3700
+		if ($field) {
3701 3701
 			return $field->get_qualified_column();
3702
-		}else{
3703
-			throw new EE_Error(sprintf(__("There is no field titled %s on model %s. Either the query trying to use it is bad, or you need to add it to the list of fields on the model.",'event_espresso'),$field_name,get_class($this)));
3702
+		} else {
3703
+			throw new EE_Error(sprintf(__("There is no field titled %s on model %s. Either the query trying to use it is bad, or you need to add it to the list of fields on the model.", 'event_espresso'), $field_name, get_class($this)));
3704 3704
 		}
3705 3705
 	}
3706 3706
 
@@ -3714,17 +3714,17 @@  discard block
 block discarded – undo
3714 3714
 	 * @param  mixed|string $limit The limit for this select
3715 3715
 	 * @return string                The final select join element for the query.
3716 3716
 	 */
3717
-	public function _construct_limit_join_select( $table_alias, $limit ) {
3717
+	public function _construct_limit_join_select($table_alias, $limit) {
3718 3718
 		$SQL = '';
3719
-		foreach ( $this->_tables as $table_obj ) {
3720
-			if ( $table_obj instanceof EE_Primary_Table ) {
3719
+		foreach ($this->_tables as $table_obj) {
3720
+			if ($table_obj instanceof EE_Primary_Table) {
3721 3721
 				$SQL .= $table_alias === $table_obj->get_table_alias()
3722
-					? $table_obj->get_select_join_limit( $limit )
3723
-					: SP . $table_obj->get_table_name() . " AS " . $table_obj->get_table_alias() . SP;
3724
-			} elseif ( $table_obj instanceof EE_Secondary_Table ) {
3722
+					? $table_obj->get_select_join_limit($limit)
3723
+					: SP.$table_obj->get_table_name()." AS ".$table_obj->get_table_alias().SP;
3724
+			} elseif ($table_obj instanceof EE_Secondary_Table) {
3725 3725
 				$SQL .= $table_alias === $table_obj->get_table_alias()
3726
-					? $table_obj->get_select_join_limit_join( $limit )
3727
-					: SP . $table_obj->get_join_sql( $table_alias ) . SP;
3726
+					? $table_obj->get_select_join_limit_join($limit)
3727
+					: SP.$table_obj->get_join_sql($table_alias).SP;
3728 3728
 			}
3729 3729
 		}
3730 3730
 		return $SQL;
@@ -3739,7 +3739,7 @@  discard block
 block discarded – undo
3739 3739
 	 * @return string SQL
3740 3740
 	 * @throws \EE_Error
3741 3741
 	 */
3742
-	public function _construct_internal_join(){
3742
+	public function _construct_internal_join() {
3743 3743
 		$SQL = $this->_get_main_table()->get_table_sql();
3744 3744
 		$SQL .= $this->_construct_internal_join_to_table_with_alias($this->_get_main_table()->get_table_alias());
3745 3745
 		return $SQL;
@@ -3760,17 +3760,17 @@  discard block
 block discarded – undo
3760 3760
 	 * @param string $alias_prefixed table alias to join to (this table should already be in the FROM SQL clause)
3761 3761
 	 * @return string
3762 3762
 	 */
3763
-	public function _construct_internal_join_to_table_with_alias($alias_prefixed){
3763
+	public function _construct_internal_join_to_table_with_alias($alias_prefixed) {
3764 3764
 		$SQL = '';
3765 3765
 		$alias_sans_prefix = EE_Model_Parser::remove_table_alias_model_relation_chain_prefix($alias_prefixed);
3766
-		foreach($this->_tables as $table_obj){
3767
-			if($table_obj instanceof EE_Secondary_Table){//table is secondary table
3768
-				if($alias_sans_prefix === $table_obj->get_table_alias()){
3766
+		foreach ($this->_tables as $table_obj) {
3767
+			if ($table_obj instanceof EE_Secondary_Table) {//table is secondary table
3768
+				if ($alias_sans_prefix === $table_obj->get_table_alias()) {
3769 3769
 					//so we're joining to this table, meaning the table is already in
3770 3770
 					//the FROM statement, BUT the primary table isn't. So we want
3771 3771
 					//to add the inverse join sql
3772 3772
 					$SQL .= $table_obj->get_inverse_join_sql($alias_prefixed);
3773
-				}else{
3773
+				} else {
3774 3774
 					//just add a regular JOIN to this table from the primary table
3775 3775
 					$SQL .= $table_obj->get_join_sql($alias_prefixed);
3776 3776
 				}
@@ -3784,9 +3784,9 @@  discard block
 block discarded – undo
3784 3784
 	 * This should be a growing array of keys being table-columns (eg 'EVT_ID' and 'Event.EVT_ID'), and values being their data type (eg, '%s', '%d', etc)
3785 3785
 	 * @return array
3786 3786
 	 */
3787
-	public function _get_data_types(){
3787
+	public function _get_data_types() {
3788 3788
 		$data_types = array();
3789
-		foreach( $this->field_settings() as $field_obj){
3789
+		foreach ($this->field_settings() as $field_obj) {
3790 3790
 			//$data_types[$field_obj->get_table_column()] = $field_obj->get_wpdb_data_type();
3791 3791
 			/** @var $field_obj EE_Model_Field_Base */
3792 3792
 			$data_types[$field_obj->get_qualified_column()] = $field_obj->get_wpdb_data_type();
@@ -3802,10 +3802,10 @@  discard block
 block discarded – undo
3802 3802
 	 * @throws EE_Error
3803 3803
 	 * @return EEM_Base
3804 3804
 	 */
3805
-	public function get_related_model_obj($model_name){
3805
+	public function get_related_model_obj($model_name) {
3806 3806
 		$model_classname = "EEM_".$model_name;
3807
-		if(!class_exists($model_classname)){
3808
-			throw new EE_Error(sprintf(__("You specified a related model named %s in your query. No such model exists, if it did, it would have the classname %s",'event_espresso'),$model_name,$model_classname));
3807
+		if ( ! class_exists($model_classname)) {
3808
+			throw new EE_Error(sprintf(__("You specified a related model named %s in your query. No such model exists, if it did, it would have the classname %s", 'event_espresso'), $model_name, $model_classname));
3809 3809
 		}
3810 3810
 		return call_user_func($model_classname."::instance");
3811 3811
 	}
@@ -3815,7 +3815,7 @@  discard block
 block discarded – undo
3815 3815
 	 * Returns the array of EE_ModelRelations for this model.
3816 3816
 	 * @return EE_Model_Relation_Base[]
3817 3817
 	 */
3818
-	public function relation_settings(){
3818
+	public function relation_settings() {
3819 3819
 		return $this->_model_relations;
3820 3820
 	}
3821 3821
 
@@ -3825,10 +3825,10 @@  discard block
 block discarded – undo
3825 3825
 	 * (Eg, without an event, datetimes have little purpose.)
3826 3826
 	 * @return EE_Belongs_To_Relation[]
3827 3827
 	 */
3828
-	public function belongs_to_relations(){
3828
+	public function belongs_to_relations() {
3829 3829
 		$belongs_to_relations = array();
3830
-		foreach($this->relation_settings() as $model_name => $relation_obj){
3831
-			if($relation_obj instanceof EE_Belongs_To_Relation){
3830
+		foreach ($this->relation_settings() as $model_name => $relation_obj) {
3831
+			if ($relation_obj instanceof EE_Belongs_To_Relation) {
3832 3832
 				$belongs_to_relations[$model_name] = $relation_obj;
3833 3833
 			}
3834 3834
 		}
@@ -3843,15 +3843,15 @@  discard block
 block discarded – undo
3843 3843
 	 * @throws EE_Error
3844 3844
 	 * @return EE_Model_Relation_Base
3845 3845
 	 */
3846
-	public function related_settings_for($relation_name){
3847
-		$relatedModels=$this->relation_settings();
3848
-		if(!array_key_exists($relation_name,$relatedModels)){
3846
+	public function related_settings_for($relation_name) {
3847
+		$relatedModels = $this->relation_settings();
3848
+		if ( ! array_key_exists($relation_name, $relatedModels)) {
3849 3849
 			throw new EE_Error(
3850 3850
 				sprintf(
3851
-					__('Cannot get %s related to %s. There is no model relation of that type. There is, however, %s...','event_espresso'),
3851
+					__('Cannot get %s related to %s. There is no model relation of that type. There is, however, %s...', 'event_espresso'),
3852 3852
 					$relation_name,
3853 3853
 					$this->_get_class_name(),
3854
-					implode( ', ', array_keys( $relatedModels ))
3854
+					implode(', ', array_keys($relatedModels))
3855 3855
 				)
3856 3856
 			);
3857 3857
 		}
@@ -3866,10 +3866,10 @@  discard block
 block discarded – undo
3866 3866
 	 * @throws EE_Error
3867 3867
 	 * @return EE_Model_Field_Base
3868 3868
 	 */
3869
-	public function field_settings_for($fieldName){
3870
-		$fieldSettings=$this->field_settings(true);
3871
-		if( ! array_key_exists($fieldName,$fieldSettings)){
3872
-			throw new EE_Error(sprintf(__("There is no field/column '%s' on '%s'",'event_espresso'),$fieldName,get_class($this)));
3869
+	public function field_settings_for($fieldName) {
3870
+		$fieldSettings = $this->field_settings(true);
3871
+		if ( ! array_key_exists($fieldName, $fieldSettings)) {
3872
+			throw new EE_Error(sprintf(__("There is no field/column '%s' on '%s'", 'event_espresso'), $fieldName, get_class($this)));
3873 3873
 		}
3874 3874
 		return $fieldSettings[$fieldName];
3875 3875
 	}
@@ -3879,11 +3879,11 @@  discard block
 block discarded – undo
3879 3879
 	 * @param string $fieldName a key in the model's _field_settings array
3880 3880
 	 * @return boolean
3881 3881
 	 */
3882
-	public function has_field($fieldName){
3882
+	public function has_field($fieldName) {
3883 3883
 		$fieldSettings = $this->field_settings(true);
3884
-		if( isset($fieldSettings[$fieldName])){
3884
+		if (isset($fieldSettings[$fieldName])) {
3885 3885
 			return true;
3886
-		}else{
3886
+		} else {
3887 3887
 			return false;
3888 3888
 		}
3889 3889
 	}
@@ -3893,11 +3893,11 @@  discard block
 block discarded – undo
3893 3893
 	 * @param string $relation_name possibly one of the keys in the relation_settings array
3894 3894
 	 * @return boolean
3895 3895
 	 */
3896
-	public function has_relation($relation_name){
3896
+	public function has_relation($relation_name) {
3897 3897
 		$relations = $this->relation_settings();
3898
-		if(isset($relations[$relation_name])){
3898
+		if (isset($relations[$relation_name])) {
3899 3899
 			return true;
3900
-		}else{
3900
+		} else {
3901 3901
 			return false;
3902 3902
 		}
3903 3903
 	}
@@ -3909,7 +3909,7 @@  discard block
 block discarded – undo
3909 3909
 	 * @param $field_obj
3910 3910
 	 * @return boolean
3911 3911
 	 */
3912
-	public function is_primary_key_field( $field_obj ){
3912
+	public function is_primary_key_field($field_obj) {
3913 3913
 		return $field_obj instanceof EE_Primary_Key_Field_Base ? TRUE : FALSE;
3914 3914
 	}
3915 3915
 
@@ -3921,16 +3921,16 @@  discard block
 block discarded – undo
3921 3921
 	 * @return EE_Model_Field_Base
3922 3922
 	 * @throws EE_Error
3923 3923
 	 */
3924
-	public function get_primary_key_field(){
3925
-		if( $this->_primary_key_field === NULL ){
3926
-			foreach( $this->field_settings( TRUE ) as $field_obj ){
3927
-				if( $this->is_primary_key_field( $field_obj )){
3924
+	public function get_primary_key_field() {
3925
+		if ($this->_primary_key_field === NULL) {
3926
+			foreach ($this->field_settings(TRUE) as $field_obj) {
3927
+				if ($this->is_primary_key_field($field_obj)) {
3928 3928
 					$this->_primary_key_field = $field_obj;
3929 3929
 					break;
3930 3930
 				}
3931 3931
 			}
3932
-			if( ! $this->_primary_key_field instanceof EE_Primary_Key_Field_Base ){
3933
-				throw new EE_Error(sprintf(__("There is no Primary Key defined on model %s",'event_espresso'),get_class($this)));
3932
+			if ( ! $this->_primary_key_field instanceof EE_Primary_Key_Field_Base) {
3933
+				throw new EE_Error(sprintf(__("There is no Primary Key defined on model %s", 'event_espresso'), get_class($this)));
3934 3934
 			}
3935 3935
 		}
3936 3936
 		return $this->_primary_key_field;
@@ -3943,12 +3943,12 @@  discard block
 block discarded – undo
3943 3943
 	 * Internally does some caching.
3944 3944
 	 * @return boolean
3945 3945
 	 */
3946
-	public function has_primary_key_field(){
3947
-		if($this->_has_primary_key_field === null){
3948
-			try{
3946
+	public function has_primary_key_field() {
3947
+		if ($this->_has_primary_key_field === null) {
3948
+			try {
3949 3949
 				$this->get_primary_key_field();
3950 3950
 				$this->_has_primary_key_field = true;
3951
-			}catch(EE_Error $e){
3951
+			} catch (EE_Error $e) {
3952 3952
 				$this->_has_primary_key_field = false;
3953 3953
 			}
3954 3954
 		}
@@ -3962,9 +3962,9 @@  discard block
 block discarded – undo
3962 3962
 	 * @param string $field_class_name class name of field that you want to find. Eg, EE_Datetime_Field, EE_Foreign_Key_Field, etc
3963 3963
 	 * @return EE_Model_Field_Base or null if none is found
3964 3964
 	 */
3965
-	public function get_a_field_of_type($field_class_name){
3966
-		foreach($this->field_settings() as $field){
3967
-			if( $field instanceof $field_class_name ){
3965
+	public function get_a_field_of_type($field_class_name) {
3966
+		foreach ($this->field_settings() as $field) {
3967
+			if ($field instanceof $field_class_name) {
3968 3968
 				return $field;
3969 3969
 			}
3970 3970
 		}
@@ -3978,22 +3978,22 @@  discard block
 block discarded – undo
3978 3978
 	 * @return EE_Foreign_Key_Field_Base
3979 3979
 	 * @throws EE_Error
3980 3980
 	 */
3981
-	public function get_foreign_key_to($model_name){
3982
-		if( ! isset( $this->_cache_foreign_key_to_fields[ $model_name ] ) ){
3983
-			foreach($this->field_settings() as $field){
3984
-				if(
3981
+	public function get_foreign_key_to($model_name) {
3982
+		if ( ! isset($this->_cache_foreign_key_to_fields[$model_name])) {
3983
+			foreach ($this->field_settings() as $field) {
3984
+				if (
3985 3985
 					$field instanceof EE_Foreign_Key_Field_Base
3986
-					&& in_array($model_name,$field->get_model_names_pointed_to() )
3986
+					&& in_array($model_name, $field->get_model_names_pointed_to())
3987 3987
 				) {
3988
-					$this->_cache_foreign_key_to_fields[ $model_name ] = $field;
3988
+					$this->_cache_foreign_key_to_fields[$model_name] = $field;
3989 3989
 					break;
3990 3990
 				}
3991 3991
 			}
3992
-			if( ! isset( $this->_cache_foreign_key_to_fields[ $model_name ] ) ){
3993
-				throw new EE_Error(sprintf(__("There is no foreign key field pointing to model %s on model %s",'event_espresso'),$model_name,get_class($this)));
3992
+			if ( ! isset($this->_cache_foreign_key_to_fields[$model_name])) {
3993
+				throw new EE_Error(sprintf(__("There is no foreign key field pointing to model %s on model %s", 'event_espresso'), $model_name, get_class($this)));
3994 3994
 			}
3995 3995
 		}
3996
-		return $this->_cache_foreign_key_to_fields[ $model_name ];
3996
+		return $this->_cache_foreign_key_to_fields[$model_name];
3997 3997
 	}
3998 3998
 
3999 3999
 
@@ -4004,7 +4004,7 @@  discard block
 block discarded – undo
4004 4004
 	 * a table alias with a model chain prefix, like 'Venue__Event_Venue___Event_Meta'. Either one works
4005 4005
 	 * @return EE_Table_Base
4006 4006
 	 */
4007
-	public function get_table_for_alias($table_alias){
4007
+	public function get_table_for_alias($table_alias) {
4008 4008
 		$table_alias_sans_model_relation_chain_prefix = EE_Model_Parser::remove_table_alias_model_relation_chain_prefix($table_alias);
4009 4009
 		return $this->_tables[$table_alias_sans_model_relation_chain_prefix]->get_table_name();
4010 4010
 	}
@@ -4017,25 +4017,25 @@  discard block
 block discarded – undo
4017 4017
 	 * @param bool $include_db_only_fields flag indicating whether or not to include the db-only fields
4018 4018
 	 * @return EE_Model_Field_Base[] where the keys are the field's name
4019 4019
 	 */
4020
-	public function field_settings($include_db_only_fields = false){
4021
-		if( $include_db_only_fields ){
4022
-			if( $this->_cached_fields === NULL ){
4020
+	public function field_settings($include_db_only_fields = false) {
4021
+		if ($include_db_only_fields) {
4022
+			if ($this->_cached_fields === NULL) {
4023 4023
 				$this->_cached_fields = array();
4024
-				foreach($this->_fields as $fields_corresponding_to_table){
4025
-					foreach($fields_corresponding_to_table as $field_name => $field_obj){
4026
-						$this->_cached_fields[$field_name]=$field_obj;
4024
+				foreach ($this->_fields as $fields_corresponding_to_table) {
4025
+					foreach ($fields_corresponding_to_table as $field_name => $field_obj) {
4026
+						$this->_cached_fields[$field_name] = $field_obj;
4027 4027
 					}
4028 4028
 				}
4029 4029
 			}
4030 4030
 			return $this->_cached_fields;
4031
-		}else{
4032
-			if( $this->_cached_fields_non_db_only === NULL ){
4031
+		} else {
4032
+			if ($this->_cached_fields_non_db_only === NULL) {
4033 4033
 				$this->_cached_fields_non_db_only = array();
4034
-				foreach($this->_fields as $fields_corresponding_to_table){
4035
-					foreach($fields_corresponding_to_table as $field_name => $field_obj){
4034
+				foreach ($this->_fields as $fields_corresponding_to_table) {
4035
+					foreach ($fields_corresponding_to_table as $field_name => $field_obj) {
4036 4036
 						/** @var $field_obj EE_Model_Field_Base */
4037
-						if( ! $field_obj->is_db_only_field() ){
4038
-							$this->_cached_fields_non_db_only[$field_name]=$field_obj;
4037
+						if ( ! $field_obj->is_db_only_field()) {
4038
+							$this->_cached_fields_non_db_only[$field_name] = $field_obj;
4039 4039
 						}
4040 4040
 					}
4041 4041
 				}
@@ -4054,60 +4054,60 @@  discard block
 block discarded – undo
4054 4054
 	 * @return \EE_Base_Class[] array keys are primary keys (if there is a primary key on the model. if not, numerically indexed)
4055 4055
 	 * @throws \EE_Error
4056 4056
 	 */
4057
-	protected function _create_objects( $rows = array() ) {
4058
-		$array_of_objects=array();
4059
-		if(empty($rows)){
4057
+	protected function _create_objects($rows = array()) {
4058
+		$array_of_objects = array();
4059
+		if (empty($rows)) {
4060 4060
 			return array();
4061 4061
 		}
4062 4062
 		$count_if_model_has_no_primary_key = 0;
4063 4063
 		$has_primary_key = $this->has_primary_key_field();
4064 4064
 		$primary_key_field = $has_primary_key ? $this->get_primary_key_field() : null;
4065
-		foreach ( (array)$rows as $row ) {
4066
-			if(empty($row)){
4065
+		foreach ((array) $rows as $row) {
4066
+			if (empty($row)) {
4067 4067
 				//wp did its weird thing where it returns an array like array(0=>null), which is totally not helpful...
4068 4068
 				return array();
4069 4069
 			}
4070 4070
 			//check if we've already set this object in the results array,
4071 4071
 			//in which case there's no need to process it further (again)
4072
-			if( $has_primary_key ) {
4072
+			if ($has_primary_key) {
4073 4073
 				$table_pk_value = $this->_get_column_value_with_table_alias_or_not(
4074 4074
 					$row,
4075 4075
 					$primary_key_field->get_qualified_column(),
4076 4076
 					$primary_key_field->get_table_column()
4077 4077
 				);
4078
-				if( $table_pk_value && isset( $array_of_objects[ $table_pk_value ] ) ) {
4078
+				if ($table_pk_value && isset($array_of_objects[$table_pk_value])) {
4079 4079
 					continue;
4080 4080
 				}
4081 4081
 			}
4082 4082
 			$classInstance = $this->instantiate_class_from_array_or_object($row);
4083
-			if( ! $classInstance ) {
4083
+			if ( ! $classInstance) {
4084 4084
 				throw new EE_Error(
4085 4085
 					sprintf(
4086
-						__( 'Could not create instance of class %s from row %s', 'event_espresso' ),
4086
+						__('Could not create instance of class %s from row %s', 'event_espresso'),
4087 4087
 						$this->get_this_model_name(),
4088
-						http_build_query( $row )
4088
+						http_build_query($row)
4089 4089
 					)
4090 4090
 				);
4091 4091
 			}
4092 4092
 			//set the timezone on the instantiated objects
4093
-			$classInstance->set_timezone( $this->_timezone );
4093
+			$classInstance->set_timezone($this->_timezone);
4094 4094
 			//make sure if there is any timezone setting present that we set the timezone for the object
4095 4095
 			$key = $has_primary_key ? $classInstance->ID() : $count_if_model_has_no_primary_key++;
4096
-			$array_of_objects[ $key ] = $classInstance;
4096
+			$array_of_objects[$key] = $classInstance;
4097 4097
 			//also, for all the relations of type BelongsTo, see if we can cache
4098 4098
 			//those related models
4099 4099
 			//(we could do this for other relations too, but if there are conditions
4100 4100
 			//that filtered out some fo the results, then we'd be caching an incomplete set
4101 4101
 			//so it requires a little more thought than just caching them immediately...)
4102
-			foreach($this->_model_relations as $modelName => $relation_obj){
4103
-				if( $relation_obj instanceof EE_Belongs_To_Relation){
4102
+			foreach ($this->_model_relations as $modelName => $relation_obj) {
4103
+				if ($relation_obj instanceof EE_Belongs_To_Relation) {
4104 4104
 					//check if this model's INFO is present. If so, cache it on the model
4105 4105
 					$other_model = $relation_obj->get_other_model();
4106 4106
 					$other_model_obj_maybe = $other_model->instantiate_class_from_array_or_object($row);
4107 4107
 					//if we managed to make a model object from the results, cache it on the main model object
4108
-					if( $other_model_obj_maybe ){
4108
+					if ($other_model_obj_maybe) {
4109 4109
 						//set timezone on these other model objects if they are present
4110
-						$other_model_obj_maybe->set_timezone( $this->_timezone );
4110
+						$other_model_obj_maybe->set_timezone($this->_timezone);
4111 4111
 						$classInstance->cache($modelName, $other_model_obj_maybe);
4112 4112
 					}
4113 4113
 				}
@@ -4128,12 +4128,12 @@  discard block
 block discarded – undo
4128 4128
 
4129 4129
 		$this_model_fields_and_values = array();
4130 4130
 		//setup the row using default values;
4131
-		foreach ( $this->field_settings() as $field_name => $field_obj ) {
4131
+		foreach ($this->field_settings() as $field_name => $field_obj) {
4132 4132
 			$this_model_fields_and_values[$field_name] = $field_obj->get_default_value();
4133 4133
 		}
4134 4134
 
4135 4135
 		$className = $this->_get_class_name();
4136
-		$classInstance = EE_Registry::instance()->load_class( $className, array( $this_model_fields_and_values ), FALSE, FALSE );
4136
+		$classInstance = EE_Registry::instance()->load_class($className, array($this_model_fields_and_values), FALSE, FALSE);
4137 4137
 
4138 4138
 		return $classInstance;
4139 4139
 	}
@@ -4146,45 +4146,45 @@  discard block
 block discarded – undo
4146 4146
 	 * @return EE_Base_Class
4147 4147
 	 * @throws \EE_Error
4148 4148
 	 */
4149
-	public function instantiate_class_from_array_or_object($cols_n_values){
4150
-		if( ! is_array( $cols_n_values ) && is_object( $cols_n_values )) {
4151
-			$cols_n_values = get_object_vars( $cols_n_values );
4149
+	public function instantiate_class_from_array_or_object($cols_n_values) {
4150
+		if ( ! is_array($cols_n_values) && is_object($cols_n_values)) {
4151
+			$cols_n_values = get_object_vars($cols_n_values);
4152 4152
 		}
4153 4153
 		$primary_key = NULL;
4154 4154
 		//make sure the array only has keys that are fields/columns on this model
4155
-		$this_model_fields_n_values = $this->_deduce_fields_n_values_from_cols_n_values( $cols_n_values );
4156
-		if( $this->has_primary_key_field() && isset( $this_model_fields_n_values[ $this->primary_key_name() ] ) ){
4157
-			$primary_key = $this_model_fields_n_values[ $this->primary_key_name() ];
4155
+		$this_model_fields_n_values = $this->_deduce_fields_n_values_from_cols_n_values($cols_n_values);
4156
+		if ($this->has_primary_key_field() && isset($this_model_fields_n_values[$this->primary_key_name()])) {
4157
+			$primary_key = $this_model_fields_n_values[$this->primary_key_name()];
4158 4158
 		}
4159
-		$className=$this->_get_class_name();
4159
+		$className = $this->_get_class_name();
4160 4160
 
4161 4161
 		//check we actually found results that we can use to build our model object
4162 4162
 		//if not, return null
4163
-		if( $this->has_primary_key_field()){
4164
-			if(empty( $this_model_fields_n_values[$this->primary_key_name()] )){
4163
+		if ($this->has_primary_key_field()) {
4164
+			if (empty($this_model_fields_n_values[$this->primary_key_name()])) {
4165 4165
 				return NULL;
4166 4166
 			}
4167
-		}else if($this->unique_indexes()){
4167
+		} else if ($this->unique_indexes()) {
4168 4168
 			$first_column = reset($this_model_fields_n_values);
4169
-			if(empty($first_column)){
4169
+			if (empty($first_column)) {
4170 4170
 				return NULL;
4171 4171
 			}
4172 4172
 		}
4173 4173
 
4174 4174
 		// if there is no primary key or the object doesn't already exist in the entity map, then create a new instance
4175
-		if ( $primary_key){
4176
-			$classInstance = $this->get_from_entity_map( $primary_key );
4177
-			if( ! $classInstance) {
4178
-				$classInstance = EE_Registry::instance()->load_class( $className, array( $this_model_fields_n_values, $this->_timezone ), TRUE, FALSE );
4175
+		if ($primary_key) {
4176
+			$classInstance = $this->get_from_entity_map($primary_key);
4177
+			if ( ! $classInstance) {
4178
+				$classInstance = EE_Registry::instance()->load_class($className, array($this_model_fields_n_values, $this->_timezone), TRUE, FALSE);
4179 4179
 				// add this new object to the entity map
4180
-				$classInstance = $this->add_to_entity_map( $classInstance );
4180
+				$classInstance = $this->add_to_entity_map($classInstance);
4181 4181
 			}
4182
-		}else{
4183
-			$classInstance = EE_Registry::instance()->load_class( $className, array( $this_model_fields_n_values, $this->_timezone ), TRUE, FALSE );
4182
+		} else {
4183
+			$classInstance = EE_Registry::instance()->load_class($className, array($this_model_fields_n_values, $this->_timezone), TRUE, FALSE);
4184 4184
 		}
4185 4185
 
4186 4186
 			//it is entirely possible that the instantiated class object has a set timezone_string db field and has set it's internal _timezone property accordingly (see new_instance_from_db in model objects particularly EE_Event for example).  In this case, we want to make sure the model object doesn't have its timezone string overwritten by any timezone property currently set here on the model so, we intentionally override the model _timezone property with the model_object timezone property.
4187
-		$this->set_timezone( $classInstance->get_timezone() );
4187
+		$this->set_timezone($classInstance->get_timezone());
4188 4188
 		return $classInstance;
4189 4189
 	}
4190 4190
 	/**
@@ -4192,8 +4192,8 @@  discard block
 block discarded – undo
4192 4192
 	 * @param int|string $id the ID of the model object
4193 4193
 	 * @return EE_Base_Class
4194 4194
 	 */
4195
-	public function get_from_entity_map( $id ){
4196
-		return isset( $this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $id ] ) ? $this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $id ] : NULL;
4195
+	public function get_from_entity_map($id) {
4196
+		return isset($this->_entity_map[EEM_Base::$_model_query_blog_id][$id]) ? $this->_entity_map[EEM_Base::$_model_query_blog_id][$id] : NULL;
4197 4197
 	}
4198 4198
 
4199 4199
 
@@ -4215,21 +4215,21 @@  discard block
 block discarded – undo
4215 4215
 	 * @throws EE_Error
4216 4216
 	 * @return \EE_Base_Class
4217 4217
 	 */
4218
-	public function add_to_entity_map( EE_Base_Class $object) {
4218
+	public function add_to_entity_map(EE_Base_Class $object) {
4219 4219
 		$className = $this->_get_class_name();
4220
-		if( ! $object instanceof $className ){
4221
-			throw new EE_Error(sprintf(__("You tried adding a %s to a mapping of %ss", "event_espresso"),is_object( $object ) ? get_class( $object ) : $object, $className ) );
4220
+		if ( ! $object instanceof $className) {
4221
+			throw new EE_Error(sprintf(__("You tried adding a %s to a mapping of %ss", "event_espresso"), is_object($object) ? get_class($object) : $object, $className));
4222 4222
 		}
4223 4223
 		/** @var $object EE_Base_Class */
4224
-		if ( ! $object->ID() ){
4225
-			throw new EE_Error(sprintf(__("You tried storing a model object with NO ID in the %s entity mapper.", "event_espresso"),get_class($this)));
4224
+		if ( ! $object->ID()) {
4225
+			throw new EE_Error(sprintf(__("You tried storing a model object with NO ID in the %s entity mapper.", "event_espresso"), get_class($this)));
4226 4226
 		}
4227 4227
 		// double check it's not already there
4228
-		$classInstance = $this->get_from_entity_map( $object->ID() );
4229
-		if ( $classInstance ) {
4228
+		$classInstance = $this->get_from_entity_map($object->ID());
4229
+		if ($classInstance) {
4230 4230
 			return $classInstance;
4231 4231
 		} else {
4232
-			$this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $object->ID() ] = $object;
4232
+			$this->_entity_map[EEM_Base::$_model_query_blog_id][$object->ID()] = $object;
4233 4233
 			return $object;
4234 4234
 		}
4235 4235
 	}
@@ -4243,13 +4243,13 @@  discard block
 block discarded – undo
4243 4243
 	 * @param int|string $id the ID of the model object
4244 4244
 	 * @return boolean
4245 4245
 	 */
4246
-	public function clear_entity_map( $id = null ) {
4247
-		if ( empty( $id ) ) {
4248
-			$this->_entity_map[ EEM_Base::$_model_query_blog_id ] = array();
4246
+	public function clear_entity_map($id = null) {
4247
+		if (empty($id)) {
4248
+			$this->_entity_map[EEM_Base::$_model_query_blog_id] = array();
4249 4249
 			return true;
4250 4250
 		}
4251
-		if ( isset( $this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $id ] ) ) {
4252
-			unset( $this->_entity_map[ EEM_Base::$_model_query_blog_id ][ $id ] );
4251
+		if (isset($this->_entity_map[EEM_Base::$_model_query_blog_id][$id])) {
4252
+			unset($this->_entity_map[EEM_Base::$_model_query_blog_id][$id]);
4253 4253
 			return true;
4254 4254
 		}
4255 4255
 		return false;
@@ -4265,8 +4265,8 @@  discard block
 block discarded – undo
4265 4265
 	 * @param array $cols_n_values
4266 4266
 	 * @return array
4267 4267
 	 */
4268
-	public function deduce_fields_n_values_from_cols_n_values( $cols_n_values ) {
4269
-		return $this->_deduce_fields_n_values_from_cols_n_values( $cols_n_values );
4268
+	public function deduce_fields_n_values_from_cols_n_values($cols_n_values) {
4269
+		return $this->_deduce_fields_n_values_from_cols_n_values($cols_n_values);
4270 4270
 	}
4271 4271
 
4272 4272
 
@@ -4279,23 +4279,23 @@  discard block
 block discarded – undo
4279 4279
 	 * @param string $cols_n_values
4280 4280
 	 * @return array
4281 4281
 	 */
4282
-	protected function _deduce_fields_n_values_from_cols_n_values( $cols_n_values ){
4282
+	protected function _deduce_fields_n_values_from_cols_n_values($cols_n_values) {
4283 4283
 		$this_model_fields_n_values = array();
4284
-		foreach( $this->get_tables() as $table_alias => $table_obj ) {
4285
-			$table_pk_value = $this->_get_column_value_with_table_alias_or_not($cols_n_values, $table_obj->get_fully_qualified_pk_column(), $table_obj->get_pk_column() );
4284
+		foreach ($this->get_tables() as $table_alias => $table_obj) {
4285
+			$table_pk_value = $this->_get_column_value_with_table_alias_or_not($cols_n_values, $table_obj->get_fully_qualified_pk_column(), $table_obj->get_pk_column());
4286 4286
 			//there is a primary key on this table and its not set. Use defaults for all its columns
4287
-			if( $table_pk_value === null && $table_obj->get_pk_column() ){
4288
-				foreach( $this->_get_fields_for_table( $table_alias ) as $field_name => $field_obj ) {
4289
-					if( ! $field_obj->is_db_only_field() ){
4287
+			if ($table_pk_value === null && $table_obj->get_pk_column()) {
4288
+				foreach ($this->_get_fields_for_table($table_alias) as $field_name => $field_obj) {
4289
+					if ( ! $field_obj->is_db_only_field()) {
4290 4290
 						//prepare field as if its coming from db
4291
-						$prepared_value = $field_obj->prepare_for_set( $field_obj->get_default_value() );
4292
-						$this_model_fields_n_values[$field_name] = $field_obj->prepare_for_use_in_db( $prepared_value );
4291
+						$prepared_value = $field_obj->prepare_for_set($field_obj->get_default_value());
4292
+						$this_model_fields_n_values[$field_name] = $field_obj->prepare_for_use_in_db($prepared_value);
4293 4293
 					}
4294 4294
 				}
4295
-			}else{
4295
+			} else {
4296 4296
 				//the table's rows existed. Use their values
4297
-				foreach( $this->_get_fields_for_table( $table_alias ) as $field_name => $field_obj ) {
4298
-					if( ! $field_obj->is_db_only_field() ){
4297
+				foreach ($this->_get_fields_for_table($table_alias) as $field_name => $field_obj) {
4298
+					if ( ! $field_obj->is_db_only_field()) {
4299 4299
 						$this_model_fields_n_values[$field_name] = $this->_get_column_value_with_table_alias_or_not(
4300 4300
 							$cols_n_values, $field_obj->get_qualified_column(),
4301 4301
 							$field_obj->get_table_column()
@@ -4315,15 +4315,15 @@  discard block
 block discarded – undo
4315 4315
 	 * @param $regular_column
4316 4316
 	 * @return null
4317 4317
 	 */
4318
-	protected function _get_column_value_with_table_alias_or_not( $cols_n_values, $qualified_column, $regular_column ){
4318
+	protected function _get_column_value_with_table_alias_or_not($cols_n_values, $qualified_column, $regular_column) {
4319 4319
 		$value = null;
4320 4320
 		//ask the field what it think it's table_name.column_name should be, and call it the "qualified column"
4321 4321
 		//does the field on the model relate to this column retrieved from the db?
4322 4322
 		//or is it a db-only field? (not relating to the model)
4323
-		if( isset( $cols_n_values[ $qualified_column ] ) ){
4324
-			$value = $cols_n_values[ $qualified_column ];
4325
-		}elseif( isset( $cols_n_values[ $regular_column ] ) ){
4326
-			$value = $cols_n_values[ $regular_column ];
4323
+		if (isset($cols_n_values[$qualified_column])) {
4324
+			$value = $cols_n_values[$qualified_column];
4325
+		}elseif (isset($cols_n_values[$regular_column])) {
4326
+			$value = $cols_n_values[$regular_column];
4327 4327
 		}
4328 4328
 		return $value;
4329 4329
 	}
@@ -4339,25 +4339,25 @@  discard block
 block discarded – undo
4339 4339
 	 * @return EE_Base_Class
4340 4340
 	 * @throws \EE_Error
4341 4341
 	 */
4342
-	public function refresh_entity_map_from_db( $id ){
4343
-		$obj_in_map = $this->get_from_entity_map( $id );
4344
-		if( $obj_in_map ){
4342
+	public function refresh_entity_map_from_db($id) {
4343
+		$obj_in_map = $this->get_from_entity_map($id);
4344
+		if ($obj_in_map) {
4345 4345
 			$wpdb_results = $this->_get_all_wpdb_results(
4346
-				array( array( $this->get_primary_key_field()->get_name() => $id ), 'limit' => 1 )
4346
+				array(array($this->get_primary_key_field()->get_name() => $id), 'limit' => 1)
4347 4347
 			);
4348
-			if( $wpdb_results && is_array( $wpdb_results ) ){
4349
-				$one_row = reset( $wpdb_results );
4350
-				foreach( $this->_deduce_fields_n_values_from_cols_n_values($one_row ) as $field_name => $db_value ) {
4351
-					$obj_in_map->set_from_db( $field_name, $db_value );
4348
+			if ($wpdb_results && is_array($wpdb_results)) {
4349
+				$one_row = reset($wpdb_results);
4350
+				foreach ($this->_deduce_fields_n_values_from_cols_n_values($one_row) as $field_name => $db_value) {
4351
+					$obj_in_map->set_from_db($field_name, $db_value);
4352 4352
 				}
4353 4353
 				//clear the cache of related model objects
4354
-				foreach ( $this->relation_settings() as $relation_name => $relation_obj ){
4355
-					$obj_in_map->clear_cache($relation_name, NULL, TRUE );
4354
+				foreach ($this->relation_settings() as $relation_name => $relation_obj) {
4355
+					$obj_in_map->clear_cache($relation_name, NULL, TRUE);
4356 4356
 				}
4357 4357
 			}
4358 4358
 			return $obj_in_map;
4359
-		}else{
4360
-			return $this->get_one_by_ID( $id );
4359
+		} else {
4360
+			return $this->get_one_by_ID($id);
4361 4361
 		}
4362 4362
 	}
4363 4363
 
@@ -4375,24 +4375,24 @@  discard block
 block discarded – undo
4375 4375
 	 * @return \EE_Base_Class
4376 4376
 	 * @throws \EE_Error
4377 4377
 	 */
4378
-	public function refresh_entity_map_with( $id, $replacing_model_obj ) {
4379
-		$obj_in_map = $this->get_from_entity_map( $id );
4380
-		if( $obj_in_map ){
4381
-			if( $replacing_model_obj instanceof EE_Base_Class ){
4382
-				foreach( $replacing_model_obj->model_field_array() as $field_name => $value ) {
4383
-					$obj_in_map->set( $field_name, $value );
4378
+	public function refresh_entity_map_with($id, $replacing_model_obj) {
4379
+		$obj_in_map = $this->get_from_entity_map($id);
4380
+		if ($obj_in_map) {
4381
+			if ($replacing_model_obj instanceof EE_Base_Class) {
4382
+				foreach ($replacing_model_obj->model_field_array() as $field_name => $value) {
4383
+					$obj_in_map->set($field_name, $value);
4384 4384
 				}
4385 4385
 				//make the model object in the entity map's cache match the $replacing_model_obj
4386
-				foreach ( $this->relation_settings() as $relation_name => $relation_obj ){
4387
-					$obj_in_map->clear_cache($relation_name, NULL, TRUE );
4388
-					foreach( $replacing_model_obj->get_all_from_cache( $relation_name ) as $cache_id => $cached_obj ) {
4389
-						$obj_in_map->cache( $relation_name, $cached_obj, $cache_id );
4386
+				foreach ($this->relation_settings() as $relation_name => $relation_obj) {
4387
+					$obj_in_map->clear_cache($relation_name, NULL, TRUE);
4388
+					foreach ($replacing_model_obj->get_all_from_cache($relation_name) as $cache_id => $cached_obj) {
4389
+						$obj_in_map->cache($relation_name, $cached_obj, $cache_id);
4390 4390
 					}
4391 4391
 				}
4392 4392
 			}
4393 4393
 			return $obj_in_map;
4394
-		}else{
4395
-			$this->add_to_entity_map( $replacing_model_obj );
4394
+		} else {
4395
+			$this->add_to_entity_map($replacing_model_obj);
4396 4396
 			return $replacing_model_obj;
4397 4397
 		}
4398 4398
 	}
@@ -4405,7 +4405,7 @@  discard block
 block discarded – undo
4405 4405
 	 * require_once($this->_getClassName().".class.php");
4406 4406
 	 * @return string
4407 4407
 	 */
4408
-	private function _get_class_name(){
4408
+	private function _get_class_name() {
4409 4409
 		return "EE_".$this->get_this_model_name();
4410 4410
 	}
4411 4411
 
@@ -4418,8 +4418,8 @@  discard block
 block discarded – undo
4418 4418
 	 * @param int $quantity
4419 4419
 	 * @return string
4420 4420
 	 */
4421
-	public function item_name($quantity = 1){
4422
-		return (int)$quantity === 1 ? $this->singular_item : $this->plural_item;
4421
+	public function item_name($quantity = 1) {
4422
+		return (int) $quantity === 1 ? $this->singular_item : $this->plural_item;
4423 4423
 	}
4424 4424
 
4425 4425
 
@@ -4446,13 +4446,13 @@  discard block
 block discarded – undo
4446 4446
 	 * @throws EE_Error
4447 4447
 	 * @return mixed whatever the plugin which calls add_filter decides
4448 4448
 	 */
4449
-	public function __call($methodName,$args){
4450
-		$className=get_class($this);
4451
-		$tagName="FHEE__{$className}__{$methodName}";
4452
-		if(!has_filter($tagName)){
4449
+	public function __call($methodName, $args) {
4450
+		$className = get_class($this);
4451
+		$tagName = "FHEE__{$className}__{$methodName}";
4452
+		if ( ! has_filter($tagName)) {
4453 4453
 			throw new EE_Error(
4454 4454
 				sprintf(
4455
-					__( 'Method %1$s on model %2$s does not exist! You can create one with the following code in functions.php or in a plugin: %4$s function my_callback(%4$s \$previousReturnValue, EEM_Base \$object\ $argsArray=NULL ){%4$s     /*function body*/%4$s      return \$whatever;%4$s }%4$s add_filter( \'%3$s\', \'my_callback\', 10, 3 );', 'event_espresso' ),
4455
+					__('Method %1$s on model %2$s does not exist! You can create one with the following code in functions.php or in a plugin: %4$s function my_callback(%4$s \$previousReturnValue, EEM_Base \$object\ $argsArray=NULL ){%4$s     /*function body*/%4$s      return \$whatever;%4$s }%4$s add_filter( \'%3$s\', \'my_callback\', 10, 3 );', 'event_espresso'),
4456 4456
 					$methodName,
4457 4457
 					$className,
4458 4458
 					$tagName,
@@ -4461,7 +4461,7 @@  discard block
 block discarded – undo
4461 4461
 			);
4462 4462
 		}
4463 4463
 
4464
-		return apply_filters($tagName,null,$this,$args);
4464
+		return apply_filters($tagName, null, $this, $args);
4465 4465
 	}
4466 4466
 
4467 4467
 
@@ -4479,28 +4479,28 @@  discard block
 block discarded – undo
4479 4479
 	 * @throws EE_Error
4480 4480
 	 * @return EE_Base_Class
4481 4481
 	 */
4482
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ){
4482
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
4483 4483
 		$className = $this->_get_class_name();
4484
-		if ( $base_class_obj_or_id instanceof $className ) {
4484
+		if ($base_class_obj_or_id instanceof $className) {
4485 4485
 			$model_object = $base_class_obj_or_id;
4486 4486
 		} else {
4487 4487
 			$primary_key_field = $this->get_primary_key_field();
4488 4488
 			if (
4489 4489
 				$primary_key_field instanceof EE_Primary_Key_Int_Field
4490 4490
 				&& (
4491
-					is_int( $base_class_obj_or_id )
4492
-					|| is_string( $base_class_obj_or_id )
4491
+					is_int($base_class_obj_or_id)
4492
+					|| is_string($base_class_obj_or_id)
4493 4493
 				)
4494 4494
 			) {
4495 4495
 				// assume it's an ID.
4496 4496
 				// either a proper integer or a string representing an integer (eg "101" instead of 101)
4497
-				$model_object = $this->get_one_by_ID( $base_class_obj_or_id );
4497
+				$model_object = $this->get_one_by_ID($base_class_obj_or_id);
4498 4498
 			} else if (
4499 4499
 				$primary_key_field instanceof EE_Primary_Key_String_Field
4500
-			    && is_string( $base_class_obj_or_id )
4500
+			    && is_string($base_class_obj_or_id)
4501 4501
 			) {
4502 4502
 				// assume its a string representation of the object
4503
-				$model_object = $this->get_one_by_ID( $base_class_obj_or_id );
4503
+				$model_object = $this->get_one_by_ID($base_class_obj_or_id);
4504 4504
 			} else {
4505 4505
 				throw new EE_Error(
4506 4506
 					sprintf(
@@ -4510,12 +4510,12 @@  discard block
 block discarded – undo
4510 4510
 						),
4511 4511
 						$base_class_obj_or_id,
4512 4512
 						$this->_get_class_name(),
4513
-						print_r( $base_class_obj_or_id, true )
4513
+						print_r($base_class_obj_or_id, true)
4514 4514
 					)
4515 4515
 				);
4516 4516
 			}
4517 4517
 		}
4518
-		if ( $ensure_is_in_db && $model_object->ID() !== null ) {
4518
+		if ($ensure_is_in_db && $model_object->ID() !== null) {
4519 4519
 			$model_object->save();
4520 4520
 		}
4521 4521
 		return $model_object;
@@ -4531,19 +4531,19 @@  discard block
 block discarded – undo
4531 4531
 	 * @return int|string depending on the type of this model object's ID
4532 4532
 	 * @throws EE_Error
4533 4533
 	 */
4534
-	public function ensure_is_ID($base_class_obj_or_id){
4534
+	public function ensure_is_ID($base_class_obj_or_id) {
4535 4535
 		$className = $this->_get_class_name();
4536
-		if( $base_class_obj_or_id instanceof $className ){
4536
+		if ($base_class_obj_or_id instanceof $className) {
4537 4537
 			/** @var $base_class_obj_or_id EE_Base_Class */
4538 4538
 			$id = $base_class_obj_or_id->ID();
4539
-		}elseif(is_int($base_class_obj_or_id)){
4539
+		}elseif (is_int($base_class_obj_or_id)) {
4540 4540
 			//assume it's an ID
4541 4541
 			$id = $base_class_obj_or_id;
4542
-		}elseif(is_string($base_class_obj_or_id)){
4542
+		}elseif (is_string($base_class_obj_or_id)) {
4543 4543
 			//assume its a string representation of the object
4544 4544
 			$id = $base_class_obj_or_id;
4545
-		}else{
4546
-			throw new EE_Error(sprintf(__("'%s' is neither an object of type %s, nor an ID! Its full value is '%s'",'event_espresso'),$base_class_obj_or_id,$this->_get_class_name(),print_r($base_class_obj_or_id,true)));
4545
+		} else {
4546
+			throw new EE_Error(sprintf(__("'%s' is neither an object of type %s, nor an ID! Its full value is '%s'", 'event_espresso'), $base_class_obj_or_id, $this->_get_class_name(), print_r($base_class_obj_or_id, true)));
4547 4547
 		}
4548 4548
 		return $id;
4549 4549
 	}
@@ -4566,14 +4566,14 @@  discard block
 block discarded – undo
4566 4566
 	 * @param int $values_already_prepared like one of the constants on EEM_Base
4567 4567
 	 * @return void
4568 4568
 	 */
4569
-	public function assume_values_already_prepared_by_model_object($values_already_prepared = self::not_prepared_by_model_object){
4569
+	public function assume_values_already_prepared_by_model_object($values_already_prepared = self::not_prepared_by_model_object) {
4570 4570
 		$this->_values_already_prepared_by_model_object = $values_already_prepared;
4571 4571
 	}
4572 4572
 	/**
4573 4573
 	 * Read comments for assume_values_already_prepared_by_model_object()
4574 4574
 	 * @return int
4575 4575
 	 */
4576
-	public function get_assumption_concerning_values_already_prepared_by_model_object(){
4576
+	public function get_assumption_concerning_values_already_prepared_by_model_object() {
4577 4577
 		return $this->_values_already_prepared_by_model_object;
4578 4578
 	}
4579 4579
 
@@ -4581,17 +4581,17 @@  discard block
 block discarded – undo
4581 4581
 	 * Gets all the indexes on this model
4582 4582
 	 * @return EE_Index[]
4583 4583
 	 */
4584
-	public function indexes(){
4584
+	public function indexes() {
4585 4585
 		return $this->_indexes;
4586 4586
 	}
4587 4587
 	/**
4588 4588
 	 * Gets all the Unique Indexes on this model
4589 4589
 	 * @return EE_Unique_Index[]
4590 4590
 	 */
4591
-	public function unique_indexes(){
4591
+	public function unique_indexes() {
4592 4592
 		$unique_indexes = array();
4593
-		foreach($this->_indexes as $name => $index){
4594
-			if($index instanceof EE_Unique_Index){
4593
+		foreach ($this->_indexes as $name => $index) {
4594
+			if ($index instanceof EE_Unique_Index) {
4595 4595
 				$unique_indexes [$name] = $index;
4596 4596
 			}
4597 4597
 		}
@@ -4609,13 +4609,13 @@  discard block
 block discarded – undo
4609 4609
 	 * @return EE_Model_Field_Base[] indexed by the field's name
4610 4610
 	 * @throws \EE_Error
4611 4611
 	 */
4612
-	public function get_combined_primary_key_fields(){
4613
-		foreach($this->indexes() as $index){
4614
-			if($index instanceof EE_Primary_Key_Index){
4612
+	public function get_combined_primary_key_fields() {
4613
+		foreach ($this->indexes() as $index) {
4614
+			if ($index instanceof EE_Primary_Key_Index) {
4615 4615
 				return $index->fields();
4616 4616
 			}
4617 4617
 		}
4618
-		return array( $this->primary_key_name() => $this->get_primary_key_field());
4618
+		return array($this->primary_key_name() => $this->get_primary_key_field());
4619 4619
 	}
4620 4620
 
4621 4621
 
@@ -4629,7 +4629,7 @@  discard block
 block discarded – undo
4629 4629
 	 * @return string
4630 4630
 	 * @throws \EE_Error
4631 4631
 	 */
4632
-	public function get_index_primary_key_string($cols_n_values){
4632
+	public function get_index_primary_key_string($cols_n_values) {
4633 4633
 		$cols_n_values_for_primary_key_index = array_intersect_key($cols_n_values, $this->get_combined_primary_key_fields());
4634 4634
 		return http_build_query($cols_n_values_for_primary_key_index);
4635 4635
 	}
@@ -4644,13 +4644,13 @@  discard block
 block discarded – undo
4644 4644
 	 * @return null|array
4645 4645
 	 * @throws \EE_Error
4646 4646
 	 */
4647
-	public function parse_index_primary_key_string( $index_primary_key_string) {
4647
+	public function parse_index_primary_key_string($index_primary_key_string) {
4648 4648
 		$key_fields = $this->get_combined_primary_key_fields();
4649 4649
 		//check all of them are in the $id
4650 4650
 		$key_vals_in_combined_pk = array();
4651
-		parse_str( $index_primary_key_string, $key_vals_in_combined_pk );
4652
-		foreach( $key_fields as $key_field_name => $field_obj ) {
4653
-			if( ! isset( $key_vals_in_combined_pk[ $key_field_name ] ) ){
4651
+		parse_str($index_primary_key_string, $key_vals_in_combined_pk);
4652
+		foreach ($key_fields as $key_field_name => $field_obj) {
4653
+			if ( ! isset($key_vals_in_combined_pk[$key_field_name])) {
4654 4654
 				return NULL;
4655 4655
 			}
4656 4656
 		}
@@ -4667,10 +4667,10 @@  discard block
 block discarded – undo
4667 4667
 	 * @return boolean
4668 4668
 	 * @throws \EE_Error
4669 4669
 	 */
4670
-	public function has_all_combined_primary_key_fields( $key_vals ) {
4671
-		$keys_it_should_have = array_keys( $this->get_combined_primary_key_fields() );
4672
-		foreach( $keys_it_should_have as $key ){
4673
-			if( ! isset( $key_vals[ $key ] ) ){
4670
+	public function has_all_combined_primary_key_fields($key_vals) {
4671
+		$keys_it_should_have = array_keys($this->get_combined_primary_key_fields());
4672
+		foreach ($keys_it_should_have as $key) {
4673
+			if ( ! isset($key_vals[$key])) {
4674 4674
 				return false;
4675 4675
 			}
4676 4676
 		}
@@ -4686,23 +4686,23 @@  discard block
 block discarded – undo
4686 4686
 	 * @throws EE_Error
4687 4687
 	 * @return \EE_Base_Class[] Array keys are object IDs (if there is a primary key on the model. if not, numerically indexed)
4688 4688
 	 */
4689
-	public function get_all_copies($model_object_or_attributes_array, $query_params = array()){
4689
+	public function get_all_copies($model_object_or_attributes_array, $query_params = array()) {
4690 4690
 
4691
-		if($model_object_or_attributes_array instanceof EE_Base_Class){
4691
+		if ($model_object_or_attributes_array instanceof EE_Base_Class) {
4692 4692
 			$attributes_array = $model_object_or_attributes_array->model_field_array();
4693
-		}elseif(is_array($model_object_or_attributes_array)){
4693
+		}elseif (is_array($model_object_or_attributes_array)) {
4694 4694
 			$attributes_array = $model_object_or_attributes_array;
4695
-		}else{
4696
-			throw new EE_Error(sprintf(__("get_all_copies should be provided with either a model object or an array of field-value-pairs, but was given %s", "event_espresso"),$model_object_or_attributes_array));
4695
+		} else {
4696
+			throw new EE_Error(sprintf(__("get_all_copies should be provided with either a model object or an array of field-value-pairs, but was given %s", "event_espresso"), $model_object_or_attributes_array));
4697 4697
 		}
4698 4698
 		//even copies obviously won't have the same ID, so remove the primary key
4699 4699
 		//from the WHERE conditions for finding copies (if there is a primary key, of course)
4700
-		if($this->has_primary_key_field() && isset($attributes_array[$this->primary_key_name()])){
4700
+		if ($this->has_primary_key_field() && isset($attributes_array[$this->primary_key_name()])) {
4701 4701
 			unset($attributes_array[$this->primary_key_name()]);
4702 4702
 		}
4703
-		if(isset($query_params[0])){
4704
-			$query_params[0] = array_merge($attributes_array,$query_params);
4705
-		}else{
4703
+		if (isset($query_params[0])) {
4704
+			$query_params[0] = array_merge($attributes_array, $query_params);
4705
+		} else {
4706 4706
 			$query_params[0] = $attributes_array;
4707 4707
 		}
4708 4708
 		return $this->get_all($query_params);
@@ -4718,16 +4718,16 @@  discard block
 block discarded – undo
4718 4718
 	 * @return EE_Base_Class
4719 4719
 	 * @throws \EE_Error
4720 4720
 	 */
4721
-	public function get_one_copy($model_object_or_attributes_array,$query_params = array()){
4722
-		if( ! is_array( $query_params ) ){
4723
-			EE_Error::doing_it_wrong('EEM_Base::get_one_copy', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
4721
+	public function get_one_copy($model_object_or_attributes_array, $query_params = array()) {
4722
+		if ( ! is_array($query_params)) {
4723
+			EE_Error::doing_it_wrong('EEM_Base::get_one_copy', sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), gettype($query_params)), '4.6.0');
4724 4724
 			$query_params = array();
4725 4725
 		}
4726 4726
 		$query_params['limit'] = 1;
4727
-		$copies = $this->get_all_copies($model_object_or_attributes_array,$query_params);
4728
-		if(is_array($copies)){
4727
+		$copies = $this->get_all_copies($model_object_or_attributes_array, $query_params);
4728
+		if (is_array($copies)) {
4729 4729
 			return array_shift($copies);
4730
-		}else{
4730
+		} else {
4731 4731
 			return null;
4732 4732
 		}
4733 4733
 	}
@@ -4743,10 +4743,10 @@  discard block
 block discarded – undo
4743 4743
 	 * @return int number of rows updated
4744 4744
 	 * @throws \EE_Error
4745 4745
 	 */
4746
-	public function update_by_ID($fields_n_values,$id){
4746
+	public function update_by_ID($fields_n_values, $id) {
4747 4747
 		$query_params = array(0=>array($this->get_primary_key_field()->get_name() => $id),
4748 4748
 			'default_where_conditions'=>'other_models_only',);
4749
-		return $this->update($fields_n_values,$query_params);
4749
+		return $this->update($fields_n_values, $query_params);
4750 4750
 	}
4751 4751
 
4752 4752
 
@@ -4757,12 +4757,12 @@  discard block
 block discarded – undo
4757 4757
 	 * @return string an operator which can be used in SQL
4758 4758
 	 * @throws EE_Error
4759 4759
 	 */
4760
-	private function _prepare_operator_for_sql($operator_supplied){
4760
+	private function _prepare_operator_for_sql($operator_supplied) {
4761 4761
 		$sql_operator = isset($this->_valid_operators[$operator_supplied]) ? $this->_valid_operators[$operator_supplied] : null;
4762
-		if($sql_operator){
4762
+		if ($sql_operator) {
4763 4763
 			return $sql_operator;
4764
-		}else{
4765
-			throw new EE_Error(sprintf(__("The operator '%s' is not in the list of valid operators: %s", "event_espresso"),$operator_supplied,implode(",",array_keys($this->_valid_operators))));
4764
+		} else {
4765
+			throw new EE_Error(sprintf(__("The operator '%s' is not in the list of valid operators: %s", "event_espresso"), $operator_supplied, implode(",", array_keys($this->_valid_operators))));
4766 4766
 		}
4767 4767
 	}
4768 4768
 
@@ -4776,10 +4776,10 @@  discard block
 block discarded – undo
4776 4776
 	 * @return string[]
4777 4777
 	 * @throws \EE_Error
4778 4778
 	 */
4779
-	public function get_all_names($query_params = array()){
4779
+	public function get_all_names($query_params = array()) {
4780 4780
 		$objs = $this->get_all($query_params);
4781 4781
 		$names = array();
4782
-		foreach($objs as $obj){
4782
+		foreach ($objs as $obj) {
4783 4783
 			$names[$obj->ID()] = $obj->name();
4784 4784
 		}
4785 4785
 		return $names;
@@ -4798,11 +4798,11 @@  discard block
 block discarded – undo
4798 4798
 	 * @return array
4799 4799
 	 * @throws \EE_Error
4800 4800
 	 */
4801
-	public function get_IDs( $model_objects, $filter_out_empty_ids = false) {
4802
-		if( ! $this->has_primary_key_field() ) {
4803
-			if( WP_DEBUG ) {
4801
+	public function get_IDs($model_objects, $filter_out_empty_ids = false) {
4802
+		if ( ! $this->has_primary_key_field()) {
4803
+			if (WP_DEBUG) {
4804 4804
 				EE_Error::add_error(
4805
-					__( 'Trying to get IDs from a model than has no primary key', 'event_espresso' ),
4805
+					__('Trying to get IDs from a model than has no primary key', 'event_espresso'),
4806 4806
 					__FILE__,
4807 4807
 					__FUNCTION__,
4808 4808
 					__LINE__
@@ -4810,13 +4810,13 @@  discard block
 block discarded – undo
4810 4810
 			}
4811 4811
 		}
4812 4812
 		$IDs = array();
4813
-		foreach( $model_objects as $model_object ) {
4813
+		foreach ($model_objects as $model_object) {
4814 4814
 			$id = $model_object->ID();
4815
-			if( ! $id ) {
4816
-				if( $filter_out_empty_ids ) {
4815
+			if ( ! $id) {
4816
+				if ($filter_out_empty_ids) {
4817 4817
 					continue;
4818 4818
 				}
4819
-				if ( WP_DEBUG ) {
4819
+				if (WP_DEBUG) {
4820 4820
 					EE_Error::add_error(
4821 4821
 						__(
4822 4822
 							'Called %1$s on a model object that has no ID and so probably hasn\'t been saved to the database',
@@ -4838,8 +4838,8 @@  discard block
 block discarded – undo
4838 4838
 	 * are no capabilities that relate to this model returns false
4839 4839
 	 * @return string|false
4840 4840
 	 */
4841
-	public function cap_slug(){
4842
-		return apply_filters( 'FHEE__EEM_Base__cap_slug', $this->_caps_slug, $this);
4841
+	public function cap_slug() {
4842
+		return apply_filters('FHEE__EEM_Base__cap_slug', $this->_caps_slug, $this);
4843 4843
 	}
4844 4844
 
4845 4845
 
@@ -4854,34 +4854,34 @@  discard block
 block discarded – undo
4854 4854
 	 * @return EE_Default_Where_Conditions[] indexed by associated capability
4855 4855
 	 * @throws \EE_Error
4856 4856
 	 */
4857
-	public function cap_restrictions( $context = EEM_Base::caps_read ) {
4858
-		EEM_Base::verify_is_valid_cap_context( $context );
4857
+	public function cap_restrictions($context = EEM_Base::caps_read) {
4858
+		EEM_Base::verify_is_valid_cap_context($context);
4859 4859
 		//check if we ought to run the restriction generator first
4860
-		if(
4861
-			isset( $this->_cap_restriction_generators[ $context ] )
4862
-			&& $this->_cap_restriction_generators[ $context ] instanceof EE_Restriction_Generator_Base
4863
-			&& ! $this->_cap_restriction_generators[ $context ]->has_generated_cap_restrictions()
4860
+		if (
4861
+			isset($this->_cap_restriction_generators[$context])
4862
+			&& $this->_cap_restriction_generators[$context] instanceof EE_Restriction_Generator_Base
4863
+			&& ! $this->_cap_restriction_generators[$context]->has_generated_cap_restrictions()
4864 4864
 		) {
4865
-			$this->_cap_restrictions[ $context ] = array_merge(
4866
-				$this->_cap_restrictions[ $context ],
4867
-				$this->_cap_restriction_generators[ $context ]->generate_restrictions()
4865
+			$this->_cap_restrictions[$context] = array_merge(
4866
+				$this->_cap_restrictions[$context],
4867
+				$this->_cap_restriction_generators[$context]->generate_restrictions()
4868 4868
 			);
4869 4869
 		}
4870 4870
 		//and make sure we've finalized the construction of each restriction
4871
-		foreach( $this->_cap_restrictions[ $context ] as $where_conditions_obj ) {
4872
-			if ( $where_conditions_obj instanceof EE_Default_Where_Conditions ) {
4873
-				$where_conditions_obj->_finalize_construct( $this );
4871
+		foreach ($this->_cap_restrictions[$context] as $where_conditions_obj) {
4872
+			if ($where_conditions_obj instanceof EE_Default_Where_Conditions) {
4873
+				$where_conditions_obj->_finalize_construct($this);
4874 4874
 			}
4875 4875
 		}
4876 4876
 
4877
-		return $this->_cap_restrictions[ $context ];
4877
+		return $this->_cap_restrictions[$context];
4878 4878
 	}
4879 4879
 
4880 4880
 	/**
4881 4881
 	 * Indicating whether or not this model thinks its a wp core model
4882 4882
 	 * @return boolean
4883 4883
 	 */
4884
-	public function is_wp_core_model(){
4884
+	public function is_wp_core_model() {
4885 4885
 		return $this->_wp_core_model;
4886 4886
 	}
4887 4887
 
@@ -4895,12 +4895,12 @@  discard block
 block discarded – undo
4895 4895
 	 * @return EE_Default_Where_Conditions[] indexed by capability name
4896 4896
 	 * @throws \EE_Error
4897 4897
 	 */
4898
-	public function caps_missing( $context = EEM_Base::caps_read ) {
4898
+	public function caps_missing($context = EEM_Base::caps_read) {
4899 4899
 		$missing_caps = array();
4900
-		$cap_restrictions = $this->cap_restrictions( $context );
4901
-		foreach( $cap_restrictions as $cap => $restriction_if_no_cap ) {
4902
-			if( ! EE_Capabilities::instance()->current_user_can( $cap, $this->get_this_model_name() . '_model_applying_caps') ) {
4903
-				$missing_caps[ $cap ] = $restriction_if_no_cap;
4900
+		$cap_restrictions = $this->cap_restrictions($context);
4901
+		foreach ($cap_restrictions as $cap => $restriction_if_no_cap) {
4902
+			if ( ! EE_Capabilities::instance()->current_user_can($cap, $this->get_this_model_name().'_model_applying_caps')) {
4903
+				$missing_caps[$cap] = $restriction_if_no_cap;
4904 4904
 			}
4905 4905
 		}
4906 4906
 		return $missing_caps;
@@ -4912,7 +4912,7 @@  discard block
 block discarded – undo
4912 4912
 	 * one of 'read', 'edit', or 'delete'
4913 4913
 	 */
4914 4914
 	public function cap_contexts_to_cap_action_map() {
4915
-		return apply_filters( 'FHEE__EEM_Base__cap_contexts_to_cap_action_map', $this->_cap_contexts_to_cap_action_map, $this );
4915
+		return apply_filters('FHEE__EEM_Base__cap_contexts_to_cap_action_map', $this->_cap_contexts_to_cap_action_map, $this);
4916 4916
 	}
4917 4917
 
4918 4918
 
@@ -4923,19 +4923,19 @@  discard block
 block discarded – undo
4923 4923
 	 * @return string one of EEM_Base::cap_contexts_to_cap_action_map() values
4924 4924
 	 * @throws \EE_Error
4925 4925
 	 */
4926
-	public function cap_action_for_context( $context ) {
4926
+	public function cap_action_for_context($context) {
4927 4927
 		$mapping = $this->cap_contexts_to_cap_action_map();
4928
-		if( isset( $mapping[ $context ] ) ) {
4929
-			return $mapping[ $context ];
4928
+		if (isset($mapping[$context])) {
4929
+			return $mapping[$context];
4930 4930
 		}
4931
-		if( $action = apply_filters( 'FHEE__EEM_Base__cap_action_for_context', null, $this, $mapping, $context ) ) {
4931
+		if ($action = apply_filters('FHEE__EEM_Base__cap_action_for_context', null, $this, $mapping, $context)) {
4932 4932
 			return $action;
4933 4933
 		}
4934 4934
 		throw new EE_Error(
4935 4935
 			sprintf(
4936
-				__( 'Cannot find capability restrictions for context "%1$s", allowed values are:%2$s', 'event_espresso' ),
4936
+				__('Cannot find capability restrictions for context "%1$s", allowed values are:%2$s', 'event_espresso'),
4937 4937
 				$context,
4938
-				implode(',', array_keys( $this->cap_contexts_to_cap_action_map() ) )
4938
+				implode(',', array_keys($this->cap_contexts_to_cap_action_map()))
4939 4939
 			)
4940 4940
 		);
4941 4941
 
@@ -4946,7 +4946,7 @@  discard block
 block discarded – undo
4946 4946
 	 * @return array
4947 4947
 	 */
4948 4948
 	static public function valid_cap_contexts() {
4949
-		return apply_filters( 'FHEE__EEM_Base__valid_cap_contexts', array(
4949
+		return apply_filters('FHEE__EEM_Base__valid_cap_contexts', array(
4950 4950
 			self::caps_read,
4951 4951
 			self::caps_read_admin,
4952 4952
 			self::caps_edit,
@@ -4962,17 +4962,17 @@  discard block
 block discarded – undo
4962 4962
 	 * @return bool
4963 4963
 	 * @throws \EE_Error
4964 4964
 	 */
4965
-	static public function verify_is_valid_cap_context( $context ) {
4965
+	static public function verify_is_valid_cap_context($context) {
4966 4966
 		$valid_cap_contexts = EEM_Base::valid_cap_contexts();
4967
-		if( in_array( $context, $valid_cap_contexts ) ) {
4967
+		if (in_array($context, $valid_cap_contexts)) {
4968 4968
 			return true;
4969
-		}else{
4969
+		} else {
4970 4970
 			throw new EE_Error(
4971 4971
 				sprintf(
4972
-					__( 'Context "%1$s" passed into model "%2$s" is not a valid context. They are: %3$s', 'event_espresso' ),
4972
+					__('Context "%1$s" passed into model "%2$s" is not a valid context. They are: %3$s', 'event_espresso'),
4973 4973
 					$context,
4974
-					'EEM_Base' ,
4975
-					implode(',', $valid_cap_contexts )
4974
+					'EEM_Base',
4975
+					implode(',', $valid_cap_contexts)
4976 4976
 				)
4977 4977
 			);
4978 4978
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Registration.model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -328,7 +328,7 @@
 block discarded – undo
328 328
 	* 		@param	int	$TXN_ID
329 329
 	* 		@param    int		$ATT_ID
330 330
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
331
-	*		@return 		mixed		array on success, FALSE on fail
331
+	*		@return 		null|EE_Base_Class		array on success, FALSE on fail
332 332
 	*/
333 333
 	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
334 334
 		return $this->get_one(array(
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
3
-require_once ( EE_CLASSES . 'EE_Registration.class.php' );
2
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
3
+require_once (EE_CLASSES.'EE_Registration.class.php');
4 4
 /**
5 5
  *
6 6
  * Registration Model
@@ -101,31 +101,31 @@  discard block
 block discarded – undo
101 101
 	 *    Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
102 102
 	 * @return \EEM_Registration
103 103
 	 */
104
-	protected function __construct( $timezone = null ) {
105
-		$this->singular_item = __('Registration','event_espresso');
106
-		$this->plural_item = __('Registrations','event_espresso');
104
+	protected function __construct($timezone = null) {
105
+		$this->singular_item = __('Registration', 'event_espresso');
106
+		$this->plural_item = __('Registrations', 'event_espresso');
107 107
 
108 108
 		$this->_tables = array(
109
-			'Registration'=>new EE_Primary_Table('esp_registration','REG_ID')
109
+			'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID')
110 110
 		);
111 111
 		$this->_fields = array(
112 112
 			'Registration'=>array(
113
-				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')),
114
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
115
-				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'),
116
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
117
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'),
118
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
119
-				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
120
-				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0),
121
-				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0),
122
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
123
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
124
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
125
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
126
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
127
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
128
-				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false )
113
+				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')),
114
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
115
+				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'),
116
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
117
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'),
118
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
119
+				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
120
+				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0),
121
+				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0),
122
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
123
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
124
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
125
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
126
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
127
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
128
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
129 129
 			)
130 130
 		);
131 131
 		$this->_model_relations = array(
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 			'Answer'=>new EE_Has_Many_Relation(),
138 138
 			'Checkin'=>new EE_Has_Many_Relation(),
139 139
 			'Registration_Payment' => new EE_Has_Many_Relation(),
140
-			'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ),
141
-			'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletes even if there are messages in the queue related
140
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
141
+			'Message' => new EE_Has_Many_Any_Relation(false) //allow deletes even if there are messages in the queue related
142 142
 		);
143 143
 		$this->_model_chain_to_wp_user = 'Event';
144 144
 
145
-		parent::__construct( $timezone );
145
+		parent::__construct($timezone);
146 146
 	}
147 147
 
148 148
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 *		@param bool  $translated If true will return the values as singular localized strings
218 218
 	 *		@return array
219 219
 	 */
220
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
221
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
222
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
220
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
221
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
222
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
223 223
 	}
224 224
 
225 225
 
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
 	 * @param array $exclude
231 231
 	 * @return array
232 232
 	 */
233
-	private function _get_registration_status_array( $exclude = array() ) {
233
+	private function _get_registration_status_array($exclude = array()) {
234 234
 		//in the very rare circumstance that we are deleting a model's table's data
235 235
 		//and the table hasn't actually been created, this could have an error
236 236
 		/** @type WPDB $wpdb */
237 237
 		global $wpdb;
238
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
239
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
240
-			$results = $wpdb->get_results( $SQL );
238
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
239
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
240
+			$results = $wpdb->get_results($SQL);
241 241
 			self::$_reg_status = array();
242
-			foreach ( $results as $status ) {
243
-				if ( ! in_array( $status->STS_ID, $exclude )) {
244
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
242
+			foreach ($results as $status) {
243
+				if ( ! in_array($status->STS_ID, $exclude)) {
244
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
245 245
 				}
246 246
 			}
247 247
 		}
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
257 257
 	 * @return wpdb results array
258 258
 	 */
259
-	public function get_reg_months_and_years( $where_params ) {
259
+	public function get_reg_months_and_years($where_params) {
260 260
 		$query_params[0] = $where_params;
261 261
 		$query_params['group_by'] = array('reg_year', 'reg_month');
262
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
262
+		$query_params['order_by'] = array('REG_date' => 'DESC');
263 263
 		$columns_to_select = array(
264 264
 			'reg_year' => array('YEAR(REG_date)', '%s'),
265 265
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
266 266
 			);
267
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
267
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
268 268
 	}
269 269
 
270 270
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	* 		@param		int		$ATT_ID
277 277
 	*		@return 	EE_Registration[]
278 278
 	*/
279
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
280
-		if ( ! $ATT_ID ) {
279
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
280
+		if ( ! $ATT_ID) {
281 281
 			return FALSE;
282 282
 		}
283
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
283
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
284 284
 	}
285 285
 
286 286
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param string $REG_url_link
292 292
 	 * @return EE_Registration
293 293
 	 */
294
-	public function get_registration_for_reg_url_link($REG_url_link){
295
-		if(!$REG_url_link){
294
+	public function get_registration_for_reg_url_link($REG_url_link) {
295
+		if ( ! $REG_url_link) {
296 296
 			return false;
297 297
 		}
298 298
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
311 311
 	*		@return 		mixed		array on success, FALSE on fail
312 312
 	*/
313
-	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
313
+	public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) {
314 314
 		return $this->get_one(array(
315 315
 			array(
316 316
 				'TXN_ID'=>$TXN_ID,
317 317
 				'ATT_ID'=>$ATT_ID
318 318
 			),
319
-			'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 )
319
+			'limit'=>array(min(($att_nmbr - 1), 0), 1)
320 320
 		));
321 321
 	}
322 322
 
@@ -328,16 +328,16 @@  discard block
 block discarded – undo
328 328
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
329 329
 	 *		@return stdClass[] with properties regDate and total
330 330
 	*/
331
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
331
+	public function get_registrations_per_day_report($period = '-1 month') {
332 332
 
333
-		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
334
-		$where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
333
+		$sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
334
+		$where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
335 335
 
336
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
336
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
337 337
 			$where['Event.EVT_wp_user'] = get_current_user_id();
338 338
 		}
339 339
 
340
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' );
340
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date');
341 341
 
342 342
 		$results = $this->_get_all_wpdb_results(
343 343
 				array(
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 				),
348 348
 				OBJECT,
349 349
 				array(
350
-					'regDate'=>array( 'DATE(' . $query_interval . ')','%s'),
351
-					'total'=>array('count(REG_ID)','%d')
350
+					'regDate'=>array('DATE('.$query_interval.')', '%s'),
351
+					'total'=>array('count(REG_ID)', '%d')
352 352
 				));
353 353
 		return $results;
354 354
 	}
@@ -363,22 +363,22 @@  discard block
 block discarded – undo
363 363
 	 * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID
364 364
 	 *                    (i.e. RAP)
365 365
 	 */
366
-	public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) {
366
+	public function get_registrations_per_day_and_per_status_report($period = '-1 month') {
367 367
 		global $wpdb;
368
-		$registration_table = $wpdb->prefix . 'esp_registration';
368
+		$registration_table = $wpdb->prefix.'esp_registration';
369 369
 		$event_table = $wpdb->posts;
370
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
370
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
371 371
 
372 372
 		//prepare the query interval for displaying offset
373
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' );
373
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date');
374 374
 
375 375
 		//inner date query
376 376
 		$inner_date_query = "SELECT DISTINCT REG_date from $registration_table ";
377 377
 		$inner_where = " WHERE";
378 378
 		//exclude events not authored by user if permissions in effect
379
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
379
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
380 380
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
381
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
381
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
382 382
 		}
383 383
 		$inner_where .= " REG_date >= '$sql_date'";
384 384
 		$inner_date_query .= $inner_where;
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 		$select_parts = array();
391 391
 
392 392
 		//loop through registration stati to do parts for each status.
393
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
394
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
393
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
394
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
395 395
 				continue;
396 396
 			}
397 397
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 		}
400 400
 
401 401
 		//setup the selects
402
-		$select .= implode(', ', $select_parts );
402
+		$select .= implode(', ', $select_parts);
403 403
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN ";
404 404
 
405 405
 		//setup the joins
406
-		$join .= implode( " LEFT JOIN ", $join_parts );
406
+		$join .= implode(" LEFT JOIN ", $join_parts);
407 407
 
408 408
 		//now let's put it all together
409
-		$query = $select . $join . ' GROUP BY Registration_REG_date';
409
+		$query = $select.$join.' GROUP BY Registration_REG_date';
410 410
 
411 411
 		//and execute it
412 412
 		$results = $wpdb->get_results(
@@ -427,23 +427,23 @@  discard block
 block discarded – undo
427 427
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
428 428
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
429 429
 	*/
430
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
430
+	public function get_registrations_per_event_report($period = '-1 month') {
431 431
 
432
-		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
433
-		$where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
432
+		$date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
433
+		$where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
434 434
 
435
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
435
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
436 436
 			$where['Event.EVT_wp_user'] = get_current_user_id();
437 437
 		}
438 438
 		$results = $this->_get_all_wpdb_results(array(
439 439
 			$where,
440 440
 			'group_by'=>'Event.EVT_name',
441 441
 			'order_by'=>'Event.EVT_name',
442
-			'limit'=>array(0,24)),
442
+			'limit'=>array(0, 24)),
443 443
 			OBJECT,
444 444
 			array(
445
-				'event_name'=>array('Event_CPT.post_title','%s'),
446
-				'total'=>array('COUNT(REG_ID)','%s')
445
+				'event_name'=>array('Event_CPT.post_title', '%s'),
446
+				'total'=>array('COUNT(REG_ID)', '%s')
447 447
 			)
448 448
 		);
449 449
 
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 	 * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID
462 462
 	 *                    (i.e. RAP)
463 463
 	 */
464
-	public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) {
464
+	public function get_registrations_per_event_and_per_status_report($period = '-1 month') {
465 465
 		global $wpdb;
466
-		$registration_table = $wpdb->prefix . 'esp_registration';
466
+		$registration_table = $wpdb->prefix.'esp_registration';
467 467
 		$event_table = $wpdb->posts;
468
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
468
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
469 469
 
470 470
 		//inner date query
471 471
 		$inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table ";
472 472
 		$inner_where = " WHERE";
473 473
 		//exclude events not authored by user if permissions in effect
474
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
474
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
475 475
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
476
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
476
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
477 477
 		}
478 478
 		$inner_where .= " REG_date >= '$sql_date'";
479 479
 		$inner_date_query .= $inner_where;
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 		$select_parts = array();
486 486
 
487 487
 		//loop through registration stati to do parts for each status.
488
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
489
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
488
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
489
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
490 490
 				continue;
491 491
 			}
492 492
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -494,14 +494,14 @@  discard block
 block discarded – undo
494 494
 		}
495 495
 
496 496
 		//setup the selects
497
-		$select .= implode( ', ', $select_parts );
497
+		$select .= implode(', ', $select_parts);
498 498
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN ";
499 499
 
500 500
 		//setup remaining joins
501
-		$join .= implode( " LEFT JOIN ", $join_parts );
501
+		$join .= implode(" LEFT JOIN ", $join_parts);
502 502
 
503 503
 		//now put it all together
504
-		$query = $select . $join . ' GROUP BY Registration_Event';
504
+		$query = $select.$join.' GROUP BY Registration_Event';
505 505
 
506 506
 		//and execute
507 507
 		$results = $wpdb->get_results(
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
 	 * @param int $TXN_ID
518 518
 	 * @return EE_Registration
519 519
 	 */
520
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
521
-		if( ! $TXN_ID ){
520
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
521
+		if ( ! $TXN_ID) {
522 522
 			return false;
523 523
 		}
524
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
524
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
525 525
 	}
526 526
 
527 527
 
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	 *		@param boolean $for_incomplete_payments
534 534
 	 *		@return int
535 535
 	 */
536
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
536
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
537 537
 		// we only count approved registrations towards registration limits
538
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
539
-		if( $for_incomplete_payments ){
540
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
538
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
539
+		if ($for_incomplete_payments) {
540
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
541 541
 		}
542 542
 
543 543
 		return $this->count($query_params);
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 		/** @type WPDB $wpdb */
554 554
 		global $wpdb;
555 555
 		return $wpdb->query(
556
-				'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
556
+				'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
557 557
 	}
558 558
 
559 559
 	/**
@@ -563,17 +563,17 @@  discard block
 block discarded – undo
563 563
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
564 564
 	 * @return int
565 565
 	 */
566
-	public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) {
566
+	public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) {
567 567
 		global $wpdb;
568 568
 		//subquery to get latest checkin
569 569
 		$query = $wpdb->prepare(
570 570
 			'SELECT '
571 571
 				. 'COUNT( DISTINCT checkins.REG_ID ) '
572
-			. 'FROM ' . EEM_Checkin::instance()->table() . ' AS checkins INNER JOIN'
572
+			. 'FROM '.EEM_Checkin::instance()->table().' AS checkins INNER JOIN'
573 573
 				. '( SELECT '
574 574
 					. 'max( CHK_timestamp ) AS latest_checkin, '
575 575
 					. 'REG_ID AS REG_ID '
576
-				. 'FROM ' . EEM_Checkin::instance()->table() . ' '
576
+				. 'FROM '.EEM_Checkin::instance()->table().' '
577 577
 				. 'WHERE DTT_ID=%d '
578 578
 				. 'GROUP BY REG_ID'
579 579
 			. ') AS most_recent_checkin_per_reg '
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 			$DTT_ID,
585 585
 			$checked_in
586 586
 		);
587
-		return (int)$wpdb->get_var( $query );
587
+		return (int) $wpdb->get_var($query);
588 588
 	}
589 589
 
590 590
 	/**
@@ -594,18 +594,18 @@  discard block
 block discarded – undo
594 594
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
595 595
 	 * @return int
596 596
 	 */
597
-	public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) {
597
+	public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) {
598 598
 		global $wpdb;
599 599
 		//subquery to get latest checkin
600 600
 		$query = $wpdb->prepare(
601 601
 			'SELECT '
602 602
 				. 'COUNT( DISTINCT checkins.REG_ID ) '
603
-			. 'FROM ' . EEM_Checkin::instance()->table() . ' AS checkins INNER JOIN'
603
+			. 'FROM '.EEM_Checkin::instance()->table().' AS checkins INNER JOIN'
604 604
 				. '( SELECT '
605 605
 					. 'max( CHK_timestamp ) AS latest_checkin, '
606 606
 					. 'REG_ID AS REG_ID '
607
-				. 'FROM ' . EEM_Checkin::instance()->table() . ' AS c '
608
-				. 'INNER JOIN ' . EEM_Datetime::instance()->table() . ' AS d '
607
+				. 'FROM '.EEM_Checkin::instance()->table().' AS c '
608
+				. 'INNER JOIN '.EEM_Datetime::instance()->table().' AS d '
609 609
 				. 'ON c.DTT_ID=d.DTT_ID '
610 610
 				. 'WHERE d.EVT_ID=%d '
611 611
 				. 'GROUP BY REG_ID'
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 			$EVT_ID,
618 618
 			$checked_in
619 619
 		);
620
-		return (int)$wpdb->get_var( $query );
620
+		return (int) $wpdb->get_var($query);
621 621
 	}
622 622
 
623 623
 
@@ -632,15 +632,15 @@  discard block
 block discarded – undo
632 632
 	 * @param array $attendee_ids
633 633
 	 * @return EE_Registration[]
634 634
 	 */
635
-	public function get_latest_registration_for_each_of_given_contacts( $attendee_ids = array() ) {
635
+	public function get_latest_registration_for_each_of_given_contacts($attendee_ids = array()) {
636 636
 		//first do a native wp_query to get the latest REG_ID's matching these attendees.
637 637
 		global $wpdb;
638
-		$registration_table = $wpdb->prefix . 'esp_registration';
638
+		$registration_table = $wpdb->prefix.'esp_registration';
639 639
 		$attendee_table = $wpdb->posts;
640
-		$attendee_ids = is_array( $attendee_ids )
641
-			? array_map( 'absint', $attendee_ids )
642
-			: array( (int) $attendee_ids );
643
-		$attendee_ids = implode( ',', $attendee_ids );
640
+		$attendee_ids = is_array($attendee_ids)
641
+			? array_map('absint', $attendee_ids)
642
+			: array((int) $attendee_ids);
643
+		$attendee_ids = implode(',', $attendee_ids);
644 644
 
645 645
 
646 646
 		//first we do a query to get the registration ids
@@ -665,24 +665,24 @@  discard block
 block discarded – undo
665 665
 			ARRAY_A
666 666
 		);
667 667
 
668
-		if ( empty( $registration_ids ) ) {
668
+		if (empty($registration_ids)) {
669 669
 			return array();
670 670
 		}
671 671
 
672 672
 		$ids_for_model_query = array();
673 673
 		//let's flatten the ids so they can be used in the model query.
674
-		foreach ( $registration_ids as $registration_id ) {
675
-			if ( isset( $registration_id['registration_id'] ) ) {
674
+		foreach ($registration_ids as $registration_id) {
675
+			if (isset($registration_id['registration_id'])) {
676 676
 				$ids_for_model_query[] = $registration_id['registration_id'];
677 677
 			}
678 678
 		}
679 679
 
680 680
 		//construct query
681 681
 		$_where = array(
682
-			'REG_ID' => array( 'IN', $ids_for_model_query )
682
+			'REG_ID' => array('IN', $ids_for_model_query)
683 683
 		);
684 684
 
685
-		return $this->get_all( array( $_where ) );
685
+		return $this->get_all(array($_where));
686 686
 	}
687 687
 
688 688
 
Please login to merge, or discard this patch.
core/db_models/EEM_Soft_Delete_Base.model.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * Sum all the deleted items.
147 147
 	 * @param array $query_params like EEM_Base::get_all
148 148
 	 * @param string $field_to_sum
149
-	 * @return int
149
+	 * @return double
150 150
 	 */
151 151
 	public function sum_deleted($query_params = null, $field_to_sum = null){
152 152
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
196 196
 	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
197 197
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
198
-	 * @return boolean success
198
+	 * @return integer success
199 199
 	 */
200 200
 	public function delete_permanently($query_params = array(), $allow_blocking = true){
201 201
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_Base.model.php');
2
+require_once(EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  * EEM_Soft_Delete_Base
5 5
  *
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  * @subpackage		includes/models/
26 26
  * @author				Michael Nelson
27 27
  */
28
-abstract class EEM_Soft_Delete_Base extends EEM_Base{
28
+abstract class EEM_Soft_Delete_Base extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param null $timezone
32 32
 	 */
33 33
 	protected function __construct($timezone = NULL) {
34
-		if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ){
34
+		if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) {
35 35
 			$this->_default_where_conditions_strategy = new EE_Soft_Delete_Where_Conditions();
36 36
 		}
37 37
 		parent::__construct($timezone);
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 	 * @return string
43 43
 	 * @throws EE_Error
44 44
 	 */
45
-	public function deleted_field_name(){
45
+	public function deleted_field_name() {
46 46
 		$field = $this->get_a_field_of_type('EE_Trashed_Flag_Field');
47
-		if($field){
47
+		if ($field) {
48 48
 			return $field->get_name();
49
-		}else{
50
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
49
+		} else {
50
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
51 51
 		}
52 52
 	}
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param array $query_params like EEM_Base::get_all's $query_params
58 58
 	 * @return EE_Soft_Delete_Base_Class
59 59
 	 */
60
-	public function get_one_deleted($query_params = array()){
60
+	public function get_one_deleted($query_params = array()) {
61 61
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
62 62
 		return parent::get_one($query_params);
63 63
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param array $query_params like EEM_base::get_all's $query_params
68 68
 	 * @return EE_Soft_Delete_Base_Class
69 69
 	 */
70
-	public function get_one_deleted_or_undeleted($query_params = array()){
70
+	public function get_one_deleted_or_undeleted($query_params = array()) {
71 71
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
72 72
 		return parent::get_one($query_params);
73 73
 	}
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	 * @param int|string $id
78 78
 	 * @return EE_Soft_Delete_Base_Class
79 79
 	 */
80
-	public function get_one_by_ID_but_ignore_deleted($id){
80
+	public function get_one_by_ID_but_ignore_deleted($id) {
81 81
 		return $this->get_one(
82 82
 			$this->alter_query_params_to_restrict_by_ID(
83 83
 				$id,
84
-				array( 'default_where_conditions' => 'default' )
84
+				array('default_where_conditions' => 'default')
85 85
 			)
86 86
 		);
87 87
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
94 94
 	 * @return int
95 95
 	 */
96
-	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE){
96
+	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
97 97
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
98 98
 		return parent::count($query_params, $field_to_count, $distinct);
99 99
 	}
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param array $query_params like EEM_Base::get_all's $query_params
104 104
 	 * @return array like EEM_Base::get_all's $query_params
105 105
 	 */
106
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
107
-		$deletedFlagFieldName=$this->deleted_field_name();
108
-		$query_params[0][$deletedFlagFieldName]=true;
106
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
107
+		$deletedFlagFieldName = $this->deleted_field_name();
108
+		$query_params[0][$deletedFlagFieldName] = true;
109 109
 		return $query_params;
110 110
 	}
111 111
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param array $query_params
115 115
 	 * @return array
116 116
 	 */
117
-	public function alter_query_params_so_deleted_and_undeleted_items_included( $query_params = array() ){
117
+	public function alter_query_params_so_deleted_and_undeleted_items_included($query_params = array()) {
118 118
 		return $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
119 119
 	}
120 120
 
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * @param array $query_params
124 124
 	 * @return array
125 125
 	 */
126
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
127
-		if( ! isset( $query_params[ 'default_where_conditions' ] ) ) {
126
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
127
+		if ( ! isset($query_params['default_where_conditions'])) {
128 128
 			$query_params['default_where_conditions'] = 'minimum';
129 129
 		}
130 130
 		return $query_params;
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
138 138
 	 * @return int
139 139
 	 */
140
-	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE){
140
+	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
141 141
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
142
-		return parent::count($query_params,$field_to_count, $distinct);
142
+		return parent::count($query_params, $field_to_count, $distinct);
143 143
 	}
144 144
 
145 145
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param string $field_to_sum
149 149
 	 * @return int
150 150
 	 */
151
-	public function sum_deleted($query_params = null, $field_to_sum = null){
151
+	public function sum_deleted($query_params = null, $field_to_sum = null) {
152 152
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
153 153
 		return parent::sum($query_params, $field_to_sum);
154 154
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string $field_to_sum
160 160
 	 * @return int
161 161
 	 */
162
-	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null){
162
+	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null) {
163 163
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
164 164
 		parent::sum($query_params, $field_to_sum);
165 165
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @param array $query_params like EEM_Base::get_all
170 170
 	 * @return EE_Soft_Delete_Base_Class[]
171 171
 	 */
172
-	public function get_all_deleted_and_undeleted($query_params = array()){
172
+	public function get_all_deleted_and_undeleted($query_params = array()) {
173 173
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
174 174
 		return parent::get_all($query_params);
175 175
 	}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param array $query_params like EEM_Base::get_all
180 180
 	 * @return EE_Soft_Delete_Base_Class[]
181 181
 	 */
182
-	public function get_all_deleted($query_params = array()){
182
+	public function get_all_deleted($query_params = array()) {
183 183
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
184 184
 		return parent::get_all($query_params);
185 185
 	}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
198 198
 	 * @return boolean success
199 199
 	 */
200
-	public function delete_permanently($query_params = array(), $allow_blocking = true){
200
+	public function delete_permanently($query_params = array(), $allow_blocking = true) {
201 201
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
202 202
 		return parent::delete_permanently($query_params, $allow_blocking);
203 203
 	}
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 	 * @param mixed $ID int if primary key is an int, string otherwise
209 209
 	 * @return boolean success
210 210
 	 */
211
-	public function restore_by_ID($ID=FALSE){
212
-		return $this->delete_or_restore_by_ID(false,$ID);
211
+	public function restore_by_ID($ID = FALSE) {
212
+		return $this->delete_or_restore_by_ID(false, $ID);
213 213
 	}
214 214
 	/**
215 215
 	 * For deleting or restoring a particular item. Note that this model is a SOFT-DELETABLE model! However,
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 	 * @param mixed $ID int if primary key is an int, string otherwise
219 219
 	 * @return boolean
220 220
 	 */
221
-	public function delete_or_restore_by_ID($delete=true,$ID=FALSE){
222
-		if ( ! $ID ) {
221
+	public function delete_or_restore_by_ID($delete = true, $ID = FALSE) {
222
+		if ( ! $ID) {
223 223
 			return FALSE;
224 224
 		}
225 225
 		if (
226 226
 			$this->delete_or_restore(
227 227
 				$delete,
228
-				$this->alter_query_params_to_restrict_by_ID( $ID )
228
+				$this->alter_query_params_to_restrict_by_ID($ID)
229 229
 			)
230 230
 		) {
231 231
 			return TRUE;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @param bool  $block_deletes
246 246
 	 * @return boolean
247 247
 	 */
248
-	public function delete($query_params = array(), $block_deletes = false){
248
+	public function delete($query_params = array(), $block_deletes = false) {
249 249
 		//no matter what, we WON'T block soft deletes.
250 250
 		return $this->delete_or_restore(true, $query_params);
251 251
 	}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param array $query_params like EEM_Base::get_all
257 257
 	 * @return boolean
258 258
 	 */
259
-	public function restore($query_params = array()){
259
+	public function restore($query_params = array()) {
260 260
 		return $this->delete_or_restore(false, $query_params);
261 261
 	}
262 262
 	/**
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 * @param array $query_params like EEM_Base::get_all
266 266
 	 * @return boolean
267 267
 	 */
268
-	function delete_or_restore($delete=true,$query_params = array()){
269
-		$deletedFlagFieldName=$this->deleted_field_name();
268
+	function delete_or_restore($delete = true, $query_params = array()) {
269
+		$deletedFlagFieldName = $this->deleted_field_name();
270 270
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
271
-		if ( $this->update (array($deletedFlagFieldName=>$delete), $query_params )) {
271
+		if ($this->update(array($deletedFlagFieldName=>$delete), $query_params)) {
272 272
 			return TRUE;
273 273
 		} else {
274 274
 			return FALSE;
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 * be aware that model objects being used could get out-of-sync with the database
287 287
 	 * @return int number of items updated
288 288
 	 */
289
-	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE ){
289
+	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
290 290
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
291
-		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync );
291
+		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync);
292 292
 	}
293 293
 }
Please login to merge, or discard this patch.