Completed
Branch BUG-9622-fix-broken-cpt-crud (e3e588)
by
unknown
574:45 queued 558:10
created
core/admin/EE_Admin.core.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
 
185 185
 	/**
186
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
187
-	*
188
-	* @access public
189
-	* @return void
190
-	*/
186
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
187
+	 *
188
+	 * @access public
189
+	 * @return void
190
+	 */
191 191
 	public function init() {
192 192
 		EE_Admin::debug_log( __METHOD__ );
193 193
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 
475 475
 
476 476
 	/**
477
-	* admin_init
478
-	*
479
-	* @access public
480
-	* @return void
481
-	*/
477
+	 * admin_init
478
+	 *
479
+	 * @access public
480
+	 * @return void
481
+	 */
482 482
 	public function admin_init() {
483 483
 
484 484
 		/**
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
 
632 632
 
633 633
 	/**
634
-	* 	dismiss_persistent_admin_notice
635
-	*
636
-	*	@access 	public
637
-	* 	@return 		void
638
-	*/
634
+	 * 	dismiss_persistent_admin_notice
635
+	 *
636
+	 *	@access 	public
637
+	 * 	@return 		void
638
+	 */
639 639
 	public function dismiss_ee_nag_notice_callback() {
640 640
 		EE_Error::dismiss_persistent_admin_notice();
641 641
 	}
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public static function instance() {
56 56
 		// check if class object is instantiated
57
-		if (  ! self::$_instance instanceof EE_Admin ) {
57
+		if ( ! self::$_instance instanceof EE_Admin) {
58 58
 			self::$_instance = new self();
59 59
 			EE_Admin::$debug_on = false; // true false
60 60
 		}
@@ -69,34 +69,34 @@  discard block
 block discarded – undo
69 69
 	 * @throws \EE_Error
70 70
 	 */
71 71
 	protected function __construct() {
72
-		EE_Admin::debug_log( __METHOD__ );
72
+		EE_Admin::debug_log(__METHOD__);
73 73
 		// define global EE_Admin constants
74 74
 		$this->_define_all_constants();
75 75
 		// set autoloaders for our admin page classes based on included path information
76
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
76
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
77 77
 		// admin hooks
78
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
78
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
79 79
 		// load EE_Request_Handler early
80
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
81
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
80
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
81
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
82 82
 		// post shortcode tracking
83 83
 		add_action(
84 84
 			'AHEE__EE_System__initialize_last',
85
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
85
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
86 86
 		);
87
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
88
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
89
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
90
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
91
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
92
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
93
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
94
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
87
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
88
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
89
+		add_action('admin_init', array($this, 'admin_init'), 100);
90
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
91
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
92
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
93
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
94
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
95 95
 
96 96
 		//reset Environment config (we only do this on admin page loads);
97 97
 		EE_Registry::instance()->CFG->environment->recheck_values();
98 98
 
99
-		do_action( 'AHEE__EE_Admin__loaded' );
99
+		do_action('AHEE__EE_Admin__loaded');
100 100
 	}
101 101
 
102 102
 
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	 * @return void
112 112
 	 */
113 113
 	private function _define_all_constants() {
114
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
115
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
116
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
117
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
118
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
114
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
115
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
116
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
117
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
118
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
119 119
 	}
120 120
 
121 121
 
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
 	 * @param 	string 	$plugin
129 129
 	 * @return 	array
130 130
 	 */
131
-	public function filter_plugin_actions( $links, $plugin ) {
131
+	public function filter_plugin_actions($links, $plugin) {
132 132
 		// set $main_file in stone
133 133
 		static $main_file;
134 134
 		// if $main_file is not set yet
135
-		if ( ! $main_file ) {
136
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
135
+		if ( ! $main_file) {
136
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
137 137
 		}
138
-		 if ( $plugin === $main_file ) {
138
+		 if ($plugin === $main_file) {
139 139
 		 	// compare current plugin to this one
140
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
141
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
142
-				array_unshift( $links, $maintenance_link );
140
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
141
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
142
+				array_unshift($links, $maintenance_link);
143 143
 			} else {
144
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
145
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
144
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
145
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
146 146
 				// add before other links
147
-				array_unshift( $links, $org_settings_link, $events_link );
147
+				array_unshift($links, $org_settings_link, $events_link);
148 148
 			}
149 149
 		}
150 150
 		return $links;
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 *	@return void
160 160
 	 */
161 161
 	public function get_request() {
162
-		EE_Registry::instance()->load_core( 'Request_Handler' );
163
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
162
+		EE_Registry::instance()->load_core('Request_Handler');
163
+		EE_Registry::instance()->load_core('CPT_Strategy');
164 164
 	}
165 165
 
166 166
 
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 * @param array $admin_page_folder_names
173 173
 	 * @return array
174 174
 	 */
175
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
175
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
176 176
 		return array(
177
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
178
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
179
-			'support' => EE_ADMIN_PAGES . 'support' . DS
177
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
178
+			'about' => EE_ADMIN_PAGES.'about'.DS,
179
+			'support' => EE_ADMIN_PAGES.'support'.DS
180 180
 		);
181 181
 	}
182 182
 
@@ -189,33 +189,33 @@  discard block
 block discarded – undo
189 189
 	* @return void
190 190
 	*/
191 191
 	public function init() {
192
-		EE_Admin::debug_log( __METHOD__ );
192
+		EE_Admin::debug_log(__METHOD__);
193 193
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
194
-		if ( EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance ){
194
+		if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
195 195
 			//ok so we want to enable the entire admin
196
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
197
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
198
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
196
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
197
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
198
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
199 199
 			//at a glance dashboard widget
200
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
200
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
201 201
 			//filter for get_edit_post_link used on comments for custom post types
202
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
202
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
203 203
 		}
204 204
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
205
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
205
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
206 206
 			try {
207 207
 				//this loads the controller for the admin pages which will setup routing etc
208
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
209
-			} catch ( EE_Error $e ) {
208
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
209
+			} catch (EE_Error $e) {
210 210
 				$e->get_error();
211 211
 			}
212 212
 		}
213
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
213
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
214 214
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
215
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
216
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
215
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
216
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
217 217
 		//exclude EE critical pages from all nav menus and wp_list_pages
218
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
218
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
219 219
 	}
220 220
 
221 221
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 	 * @param  object $post_type WP post type object
229 229
 	 * @return object            WP post type object
230 230
 	 */
231
-	public function remove_pages_from_nav_menu( $post_type ) {
231
+	public function remove_pages_from_nav_menu($post_type) {
232 232
 		//if this isn't the "pages" post type let's get out
233
-		if ( $post_type->name !== 'page' ) {
233
+		if ($post_type->name !== 'page') {
234 234
 			return $post_type;
235 235
 		}
236 236
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -250,28 +250,28 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function enable_hidden_ee_nav_menu_metaboxes() {
252 252
 		global $wp_meta_boxes, $pagenow;
253
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
253
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
254 254
 			return;
255 255
 		}
256 256
 		$user = wp_get_current_user();
257 257
 		//has this been done yet?
258
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
258
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
259 259
 			return;
260 260
 		}
261 261
 
262
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
263
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
262
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
263
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
264 264
 
265
-		if ( is_array( $hidden_meta_boxes ) ) {
266
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
267
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
268
-					unset( $hidden_meta_boxes[ $key ] );
265
+		if (is_array($hidden_meta_boxes)) {
266
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
267
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
268
+					unset($hidden_meta_boxes[$key]);
269 269
 				}
270 270
 			}
271 271
 		}
272 272
 
273
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
274
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
273
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
274
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
275 275
 	}
276 276
 
277 277
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @return void
291 291
 	 */
292 292
 	public function register_custom_nav_menu_boxes() {
293
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
293
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
294 294
 	}
295 295
 
296 296
 
@@ -306,17 +306,17 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @return string  the (maybe) modified link
308 308
 	 */
309
-	public function modify_edit_post_link( $link, $id ) {
310
-		if ( ! $post = get_post( $id ) ){
309
+	public function modify_edit_post_link($link, $id) {
310
+		if ( ! $post = get_post($id)) {
311 311
 			return $link;
312 312
 		}
313
-		if ( $post->post_type === 'espresso_attendees' ) {
313
+		if ($post->post_type === 'espresso_attendees') {
314 314
 			$query_args = array(
315 315
 				'action' => 'edit_attendee',
316 316
 				'post' => $id
317 317
 			);
318 318
 			EE_Registry::instance()->load_helper('URL');
319
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
319
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
320 320
 		}
321 321
 		return $link;
322 322
 	}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		global $nav_menu_selected_id;
329 329
 
330 330
 		$db_fields = false;
331
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
331
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
332 332
 		$current_tab = 'event-archives';
333 333
 
334 334
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
 		?>
348 348
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
349 349
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
350
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
351
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
352
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
350
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
351
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
352
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
353 353
 					</a>
354 354
 				</li>
355 355
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -367,13 +367,13 @@  discard block
 block discarded – undo
367 367
  			<?php */ ?>
368 368
 
369 369
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
370
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
370
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
371 371
 			?>">
372 372
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
373 373
 					<?php
374 374
 					$pages = $this->_get_extra_nav_menu_pages_items();
375 375
 					$args['walker'] = $walker;
376
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
376
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
377 377
 					?>
378 378
 				</ul>
379 379
 			</div><!-- /.tabs-panel -->
@@ -381,18 +381,18 @@  discard block
 block discarded – undo
381 381
 			<p class="button-controls">
382 382
 				<span class="list-controls">
383 383
 					<a href="<?php
384
-						echo esc_url( add_query_arg(
384
+						echo esc_url(add_query_arg(
385 385
 							array(
386 386
 								'extra-nav-menu-pages-tab' => 'event-archives',
387 387
 								'selectall' => 1,
388 388
 							),
389
-							remove_query_arg( $removed_args )
389
+							remove_query_arg($removed_args)
390 390
 						));
391 391
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
392 392
 				</span>
393 393
 
394 394
 				<span class="add-to-menu">
395
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
395
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
396 396
 					<span class="spinner"></span>
397 397
 				</span>
398 398
 			</p>
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
 	private function _get_extra_nav_menu_pages_items() {
414 414
 		$menuitems[] = array(
415 415
 			'title' => __('Event List', 'event_espresso'),
416
-			'url' => get_post_type_archive_link( 'espresso_events' ),
416
+			'url' => get_post_type_archive_link('espresso_events'),
417 417
 			'description' => __('Archive page for all events.', 'event_espresso')
418 418
 		);
419
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
419
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
420 420
 	}
421 421
 
422 422
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * @param $menu_item_values
429 429
 	 * @return stdClass
430 430
 	 */
431
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
431
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
432 432
 		$menu_item = new stdClass();
433 433
 		$keys = array(
434 434
 			'ID' => 0,
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 			'xfn' => ''
449 449
 		);
450 450
 
451
-		foreach ( $keys as $key => $value) {
452
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
451
+		foreach ($keys as $key => $value) {
452
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
453 453
 		}
454 454
 		return $menu_item;
455 455
 	}
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 		 * - check if doing post processing of one of EE CPTs
489 489
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
490 490
 		 */
491
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
492
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
493
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
491
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
492
+			EE_Registry::instance()->load_core('Register_CPTs');
493
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
494 494
 		}
495 495
 
496 496
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
500 500
 		 */
501 501
 		global $pagenow;
502
-		if ( $pagenow === 'options-reading.php' ) {
503
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
502
+		if ($pagenow === 'options-reading.php') {
503
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
504 504
 		}
505 505
 
506 506
 	}
@@ -512,25 +512,25 @@  discard block
 block discarded – undo
512 512
 	 * @param string $output  Current output.
513 513
 	 * @return string
514 514
 	 */
515
-	public function modify_dropdown_pages( $output ) {
515
+	public function modify_dropdown_pages($output) {
516 516
 		//get critical pages
517 517
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
518 518
 
519 519
 		//split current output by line break for easier parsing.
520
-		$split_output = explode( "\n", $output );
520
+		$split_output = explode("\n", $output);
521 521
 
522 522
 		//loop through to remove any critical pages from the array.
523
-		foreach ( $critical_pages as $page_id ) {
524
-			$needle = 'value="' . $page_id . '"';
525
-			foreach( $split_output as $key => $haystack ) {
526
-				if( strpos( $haystack, $needle ) !== false ) {
527
-					unset( $split_output[$key] );
523
+		foreach ($critical_pages as $page_id) {
524
+			$needle = 'value="'.$page_id.'"';
525
+			foreach ($split_output as $key => $haystack) {
526
+				if (strpos($haystack, $needle) !== false) {
527
+					unset($split_output[$key]);
528 528
 				}
529 529
 			}
530 530
 		}
531 531
 
532 532
 		//replace output with the new contents
533
-		return implode( "\n", $split_output );
533
+		return implode("\n", $split_output);
534 534
 	}
535 535
 
536 536
 
@@ -544,37 +544,37 @@  discard block
 block discarded – undo
544 544
 	public function enqueue_admin_scripts() {
545 545
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
546 546
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
547
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
547
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
548 548
 		// register cookie script for future dependencies
549
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
549
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
550 550
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
551
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
551
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
552 552
 			// register jQuery Validate
553
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
553
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
554 554
 		}
555 555
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
556
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
556
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
557 557
 			//joyride style
558
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
559
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
560
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
558
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
559
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
560
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
561 561
 			//joyride JS
562
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
562
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
563 563
 			// wanna go for a joyride?
564 564
 			wp_enqueue_style('ee-joyride-css');
565 565
 			wp_enqueue_script('jquery-joyride');
566 566
 		}
567 567
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
568
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
568
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
569 569
 			EE_Registry::instance()->load_helper('Qtip_Loader');
570 570
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
571 571
 		}
572 572
 		//accounting.js library
573 573
 		// @link http://josscrowcroft.github.io/accounting.js/
574
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
575
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
576
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
577
-			wp_enqueue_script( 'ee-accounting' );
574
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
575
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
576
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
577
+			wp_enqueue_script('ee-accounting');
578 578
 			// array of settings to get converted to JSON array via wp_localize_script
579 579
 			$currency_config = array(
580 580
 				'currency' => array(
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
 	public function get_persistent_admin_notices() {
622 622
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
623 623
 		$args = array(
624
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
625
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
624
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
625
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
626 626
 		);
627
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
628
-		echo EE_Error::get_persistent_admin_notices( $return_url );
627
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
628
+		echo EE_Error::get_persistent_admin_notices($return_url);
629 629
 	}
630 630
 
631 631
 
@@ -646,26 +646,26 @@  discard block
 block discarded – undo
646 646
 	 * @param $elements
647 647
 	 * @return array
648 648
 	 */
649
-	public function dashboard_glance_items( $elements ) {
649
+	public function dashboard_glance_items($elements) {
650 650
 		$events = EEM_Event::instance()->count();
651
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
652
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
651
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
652
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
653 653
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
654 654
 		$registrations = EEM_Registration::instance()->count(
655 655
 			array(
656 656
 				array(
657
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
657
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
658 658
 				)
659 659
 			)
660 660
 		);
661
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
662
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
661
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
662
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
663 663
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
664 664
 
665
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
665
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
666 666
 
667
-		foreach ( $items as $type => $item_properties ) {
668
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
667
+		foreach ($items as $type => $item_properties) {
668
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
669 669
 		}
670 670
 		return $elements;
671 671
 	}
@@ -682,32 +682,32 @@  discard block
 block discarded – undo
682 682
 	 * @throws EE_Error
683 683
 	 * @return    string
684 684
 	 */
685
-	public function check_for_invalid_datetime_formats( $value, $option ) {
686
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
685
+	public function check_for_invalid_datetime_formats($value, $option) {
686
+		EE_Registry::instance()->load_helper('DTT_Helper');
687 687
 		// check for date_format or time_format
688
-		switch ( $option ) {
688
+		switch ($option) {
689 689
 			case 'date_format' :
690
-				$date_time_format = $value . ' ' . get_option('time_format');
690
+				$date_time_format = $value.' '.get_option('time_format');
691 691
 				break;
692 692
 			case 'time_format' :
693
-				$date_time_format = get_option('date_format') . ' ' . $value;
693
+				$date_time_format = get_option('date_format').' '.$value;
694 694
 				break;
695 695
 			default :
696 696
 				$date_time_format = FALSE;
697 697
 		}
698 698
 		// do we have a date_time format to check ?
699
-		if ( $date_time_format ) {
700
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
699
+		if ($date_time_format) {
700
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
701 701
 
702
-			if ( is_array( $error_msg ) ) {
703
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
702
+			if (is_array($error_msg)) {
703
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
704 704
 
705 705
 
706
-				foreach ( $error_msg as $error ) {
707
-					$msg .= '<li>' . $error . '</li>';
706
+				foreach ($error_msg as $error) {
707
+					$msg .= '<li>'.$error.'</li>';
708 708
 				}
709 709
 
710
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
710
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
711 711
 
712 712
 				// trigger WP settings error
713 713
 				add_settings_error(
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 				);
718 718
 
719 719
 				// set format to something valid
720
-				switch ( $option ) {
720
+				switch ($option) {
721 721
 					case 'date_format' :
722 722
 						$value = 'F j, Y';
723 723
 						break;
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 	 * @param $content
740 740
 	 * @return    string
741 741
 	 */
742
-	public function its_eSpresso( $content ) {
743
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
742
+	public function its_eSpresso($content) {
743
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
744 744
 	}
745 745
 
746 746
 
@@ -753,9 +753,9 @@  discard block
 block discarded – undo
753 753
 	 */
754 754
 	public function espresso_admin_footer() {
755 755
 		return sprintf(
756
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
756
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
757 757
 			'<a href="https://eventespresso.com/" title="',
758
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
758
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
759 759
 		);
760 760
 	}
761 761
 
@@ -775,12 +775,12 @@  discard block
 block discarded – undo
775 775
 	 * @param array $config
776 776
 	 * @return void
777 777
 	 */
778
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
779
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
780
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
778
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
779
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
780
+		if (class_exists('EE_Register_Admin_Page')) {
781 781
 			$config['page_path'] = $page_path;
782 782
 		}
783
-		EE_Register_Admin_Page::register( $page_basename, $config );
783
+		EE_Register_Admin_Page::register($page_basename, $config);
784 784
 
785 785
 	}
786 786
 
@@ -793,16 +793,16 @@  discard block
 block discarded – undo
793 793
 	 * @param array  $debug_data
794 794
 	 * @param bool   $update
795 795
 	 */
796
-	public static function debug_log( $method = '', $debug_data = array(), $update = true ) {
797
-		if ( ! WP_DEBUG || ! EE_Admin::$debug_on ) {
796
+	public static function debug_log($method = '', $debug_data = array(), $update = true) {
797
+		if ( ! WP_DEBUG || ! EE_Admin::$debug_on) {
798 798
 			EE_Admin::update_debug_log();
799 799
 			return;
800 800
 		}
801
-		if ( empty( EE_Admin::$debug_data ) ) {
802
-			EE_Admin::$debug_data = get_option( 'debug_edit_event_warning', array() );
801
+		if (empty(EE_Admin::$debug_data)) {
802
+			EE_Admin::$debug_data = get_option('debug_edit_event_warning', array());
803 803
 		}
804
-		EE_Admin::$debug_data[ microtime() . ' : ' . $method . '()' ] = $debug_data;
805
-		if ( $update ) {
804
+		EE_Admin::$debug_data[microtime().' : '.$method.'()'] = $debug_data;
805
+		if ($update) {
806 806
 			EE_Admin::update_debug_log();
807 807
 		}
808 808
 	}
@@ -812,11 +812,11 @@  discard block
 block discarded – undo
812 812
 	/**
813 813
 	 */
814 814
 	public static function update_debug_log() {
815
-		if ( ! WP_DEBUG || ! EE_Admin::$debug_on ) {
816
-			delete_option( 'debug_edit_event_warning' );
815
+		if ( ! WP_DEBUG || ! EE_Admin::$debug_on) {
816
+			delete_option('debug_edit_event_warning');
817 817
 			return;
818 818
 		}
819
-		update_option( 'debug_edit_event_warning', EE_Admin::$debug_data );
819
+		update_option('debug_edit_event_warning', EE_Admin::$debug_data);
820 820
 	}
821 821
 
822 822
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 1 patch
Spacing   +597 added lines, -597 removed lines patch added patch discarded remove patch
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
155 155
 	 * 		@access public
156 156
 	 */
157
-	public function __construct( $routing = TRUE ) {
157
+	public function __construct($routing = TRUE) {
158 158
 		EE_Admin::debug_log(
159 159
 			__METHOD__,
160 160
 			array(
161
-				'class_name' => get_class( $this ),
162
-				'spl_object_hash' => spl_object_hash( $this )
161
+				'class_name' => get_class($this),
162
+				'spl_object_hash' => spl_object_hash($this)
163 163
 			)
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 classes 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
 
@@ -494,87 +494,87 @@  discard block
 block discarded – undo
494 494
 
495 495
 
496 496
 		//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.
497
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
497
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
498 498
 
499 499
 
500 500
 		//next verify if we need to load anything...
501
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE;
502
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
501
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE;
502
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
503 503
 
504 504
 		global $ee_menu_slugs;
505 505
 		$ee_menu_slugs = (array) $ee_menu_slugs;
506 506
 
507
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
507
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
508 508
 
509 509
 
510 510
 		// 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
511
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
512
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
511
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
512
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
513 513
 		}
514 514
 		// then set blank or -1 action values to 'default'
515
-		$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';
515
+		$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';
516 516
 
517 517
 		//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.
518
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
518
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
519 519
 
520 520
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
521 521
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
522 522
 
523 523
 		$this->_current_view = $this->_req_action;
524
-		$this->_req_nonce = $this->_req_action . '_nonce';
524
+		$this->_req_nonce = $this->_req_action.'_nonce';
525 525
 		$this->_define_page_props();
526 526
 
527
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
527
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
528 528
 
529 529
 		//default things
530
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
530
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
531 531
 
532 532
 		//set page configs
533 533
 		$this->_set_page_routes();
534 534
 		$this->_set_page_config();
535 535
 
536 536
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
537
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
537
+		if (isset($this->_req_data['wp_referer'])) {
538 538
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
539 539
 		}
540 540
 
541 541
 		//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
542
-		if ( method_exists( $this, '_extend_page_config' ) )
542
+		if (method_exists($this, '_extend_page_config'))
543 543
 			$this->_extend_page_config();
544 544
 
545 545
 		//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.
546
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
546
+		if (method_exists($this, '_extend_page_config_for_cpt'))
547 547
 			$this->_extend_page_config_for_cpt();
548 548
 
549 549
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
550
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
551
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
550
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
551
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
552 552
 
553 553
 
554 554
 		//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
555
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
556
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
555
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
556
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
557 557
 		}
558 558
 
559 559
 
560 560
 		//next route only if routing enabled
561
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
561
+		if ($this->_routing && ! defined('DOING_AJAX')) {
562 562
 
563 563
 			$this->_verify_routes();
564 564
 
565 565
 			//next let's just check user_access and kill if no access
566 566
 			$this->check_user_access();
567 567
 
568
-			if ( $this->_is_UI_request ) {
568
+			if ($this->_is_UI_request) {
569 569
 				//admin_init stuff - global, all views for this page class, specific view
570
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
571
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
572
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
570
+				add_action('admin_init', array($this, 'admin_init'), 10);
571
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
572
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
573 573
 				}
574 574
 
575 575
 			} else {
576 576
 				//hijack regular WP loading and route admin request immediately
577
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
577
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
578 578
 				$this->route_admin_request();
579 579
 			}
580 580
 		}
@@ -591,18 +591,18 @@  discard block
 block discarded – undo
591 591
 	 * @return void
592 592
 	 */
593 593
 	private function _do_other_page_hooks() {
594
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
594
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
595 595
 
596
-		foreach ( $registered_pages as $page ) {
596
+		foreach ($registered_pages as $page) {
597 597
 
598 598
 			//now let's setup the file name and class that should be present
599 599
 			$classname = str_replace('.class.php', '', $page);
600 600
 
601 601
 			//autoloaders should take care of loading file
602
-			if ( !class_exists( $classname ) ) {
603
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
604
-				$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 );
605
-				throw new EE_Error( implode( '||', $error_msg ));
602
+			if ( ! class_exists($classname)) {
603
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
604
+				$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);
605
+				throw new EE_Error(implode('||', $error_msg));
606 606
 			}
607 607
 
608 608
 			$a = new ReflectionClass($classname);
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	public function load_page_dependencies() {
618 618
 		try {
619 619
 			$this->_load_page_dependencies();
620
-		} catch ( EE_Error $e ) {
620
+		} catch (EE_Error $e) {
621 621
 			$e->get_error();
622 622
 		}
623 623
 	}
@@ -635,16 +635,16 @@  discard block
 block discarded – undo
635 635
 		$this->_current_screen = get_current_screen();
636 636
 
637 637
 		//load admin_notices - global, page class, and view specific
638
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
639
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
640
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
641
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
638
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
639
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
640
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
641
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
642 642
 		}
643 643
 
644 644
 		//load network admin_notices - global, page class, and view specific
645
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
646
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
647
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
645
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
646
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
647
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
648 648
 		}
649 649
 
650 650
 		//this will save any per_page screen options if they are present
@@ -660,8 +660,8 @@  discard block
 block discarded – undo
660 660
 		//add screen options - global, page child class, and view specific
661 661
 		$this->_add_global_screen_options();
662 662
 		$this->_add_screen_options();
663
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
664
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
663
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
664
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
665 665
 
666 666
 
667 667
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -672,33 +672,33 @@  discard block
 block discarded – undo
672 672
 		//add feature_pointers - global, page child class, and view specific
673 673
 		$this->_add_feature_pointers();
674 674
 		$this->_add_global_feature_pointers();
675
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
676
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
675
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
676
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
677 677
 
678 678
 		//enqueue scripts/styles - global, page class, and view specific
679
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
680
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
681
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
682
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
679
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
680
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
681
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
682
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
683 683
 
684
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
684
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
685 685
 
686 686
 		//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
687
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
688
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
689
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
690
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
687
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
688
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
689
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
690
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
691 691
 
692 692
 		//admin footer scripts
693
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
694
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
695
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
696
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
693
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
694
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
695
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
696
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
697 697
 
698 698
 
699
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
699
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
700 700
 		//targeted hook
701
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
701
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
702 702
 
703 703
 	}
704 704
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	private function _set_defaults() {
714 714
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
715 715
 
716
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
716
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
717 717
 
718 718
 		$this->default_nav_tab_name = 'overview';
719 719
 
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 	public function route_admin_request() {
741 741
 		try {
742 742
 			$this->_route_admin_request();
743
-		} catch ( EE_Error $e ) {
743
+		} catch (EE_Error $e) {
744 744
 			$e->get_error();
745 745
 		}
746 746
 	}
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 		$this->_wp_page_slug = $wp_page_slug;
752 752
 
753 753
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
754
-		if ( is_network_admin() ) {
754
+		if (is_network_admin()) {
755 755
 			$this->_wp_page_slug .= '-network';
756 756
 		}
757 757
 	}
@@ -764,53 +764,53 @@  discard block
 block discarded – undo
764 764
 	 * @return void
765 765
 	 */
766 766
 	protected function _verify_routes() {
767
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
767
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
768 768
 
769
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
769
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
770 770
 
771 771
 		$this->_route = FALSE;
772 772
 		$func = FALSE;
773 773
 		$args = array();
774 774
 
775 775
 		// check that the page_routes array is not empty
776
-		if ( empty( $this->_page_routes )) {
776
+		if (empty($this->_page_routes)) {
777 777
 			// user error msg
778
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
778
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
779 779
 			// developer error msg
780
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
781
-			throw new EE_Error( $error_msg );
780
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
781
+			throw new EE_Error($error_msg);
782 782
 		}
783 783
 
784 784
 		// and that the requested page route exists
785
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
786
-			$this->_route = $this->_page_routes[ $this->_req_action ];
785
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
786
+			$this->_route = $this->_page_routes[$this->_req_action];
787 787
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
788 788
 		} else {
789 789
 			// user error msg
790
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
790
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
791 791
 			// developer error msg
792
-			$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 );
793
-			throw new EE_Error( $error_msg );
792
+			$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);
793
+			throw new EE_Error($error_msg);
794 794
 		}
795 795
 
796 796
 		// and that a default route exists
797
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
797
+		if ( ! array_key_exists('default', $this->_page_routes)) {
798 798
 			// user error msg
799
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
799
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
800 800
 			// developer error msg
801
-			$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' );
802
-			throw new EE_Error( $error_msg );
801
+			$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');
802
+			throw new EE_Error($error_msg);
803 803
 		}
804 804
 
805 805
 
806 806
 		//first lets' catch if the UI request has EVER been set.
807
-		if ( $this->_is_UI_request === NULL ) {
807
+		if ($this->_is_UI_request === NULL) {
808 808
 			//lets set if this is a UI request or not.
809
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
809
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
810 810
 
811 811
 
812 812
 			//wait a minute... we might have a noheader in the route array
813
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
813
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
814 814
 		}
815 815
 
816 816
 		$this->_set_current_labels();
@@ -825,15 +825,15 @@  discard block
 block discarded – undo
825 825
 	 * @param  string $route the route name we're verifying
826 826
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
827 827
 	 */
828
-	protected function _verify_route( $route ) {
829
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
828
+	protected function _verify_route($route) {
829
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
830 830
 			return true;
831 831
 		} else {
832 832
 			// user error msg
833
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
833
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
834 834
 			// developer error msg
835
-			$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 );
836
-			throw new EE_Error( $error_msg );
835
+			$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);
836
+			throw new EE_Error($error_msg);
837 837
 		}
838 838
 	}
839 839
 
@@ -847,18 +847,18 @@  discard block
 block discarded – undo
847 847
 	 * @param  string $nonce_ref The nonce reference string (name0)
848 848
 	 * @return mixed (bool|die)
849 849
 	 */
850
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
850
+	protected function _verify_nonce($nonce, $nonce_ref) {
851 851
 		// verify nonce against expected value
852
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
852
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
853 853
 			// these are not the droids you are looking for !!!
854
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
855
-			if ( WP_DEBUG ) {
856
-				$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__  );
854
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
855
+			if (WP_DEBUG) {
856
+				$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__);
857 857
 			}
858
-			if ( ! defined( 'DOING_AJAX' )) {
859
-				wp_die( $msg );
858
+			if ( ! defined('DOING_AJAX')) {
859
+				wp_die($msg);
860 860
 			} else {
861
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
861
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
862 862
 				$this->_return_json();
863 863
 			}
864 864
 		}
@@ -876,63 +876,63 @@  discard block
 block discarded – undo
876 876
 	 * @return void
877 877
 	 */
878 878
 	protected function _route_admin_request() {
879
-		if (  ! $this->_is_UI_request )
879
+		if ( ! $this->_is_UI_request)
880 880
 			$this->_verify_routes();
881 881
 
882
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
882
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
883 883
 
884
-		if ( $this->_req_action != 'default' && $nonce_check ) {
884
+		if ($this->_req_action != 'default' && $nonce_check) {
885 885
 			// set nonce from post data
886
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
887
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
886
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
887
+			$this->_verify_nonce($nonce, $this->_req_nonce);
888 888
 		}
889 889
 		//set the nav_tabs array but ONLY if this is  UI_request
890
-		if ( $this->_is_UI_request )
890
+		if ($this->_is_UI_request)
891 891
 			$this->_set_nav_tabs();
892 892
 
893 893
 		// grab callback function
894
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
894
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
895 895
 
896 896
 		// check if callback has args
897
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
897
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
898 898
 
899 899
 		$error_msg = '';
900 900
 
901 901
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
902
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
903
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
902
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
903
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
904 904
 		}
905 905
 
906 906
 		//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).
907
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
907
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
908 908
 
909
-		if ( ! empty( $func )) {
909
+		if ( ! empty($func)) {
910 910
 			$base_call = $addon_call = FALSE;
911 911
 			//try to access page route via this class
912
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
912
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
913 913
 				// user error msg
914
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
914
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
915 915
 				// developer error msg
916
-				$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 );
916
+				$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);
917 917
 			}
918 918
 
919 919
 			//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)
920 920
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
921 921
 
922
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
923
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
924
-				$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 );
922
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
923
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
924
+				$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);
925 925
 			}
926 926
 
927 927
 
928
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
929
-				throw new EE_Error( $error_msg );
928
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
929
+				throw new EE_Error($error_msg);
930 930
 		}
931 931
 
932 932
 		//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.
933 933
 		//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.
934
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
935
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
934
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
935
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
936 936
 		}
937 937
 	}
938 938
 
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 	 * @param  string    $new_route   New (non header) route to redirect to.
949 949
 	 * @return   void
950 950
 	 */
951
-	protected function _reset_routing_properties( $new_route ) {
951
+	protected function _reset_routing_properties($new_route) {
952 952
 		$this->_is_UI_request = TRUE;
953 953
 		//now we set the current route to whatever the headers_sent_route is set at
954 954
 		$this->_req_data['action'] = $new_route;
@@ -994,24 +994,24 @@  discard block
 block discarded – undo
994 994
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
995 995
 	 * 	@return string
996 996
 	 */
997
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
997
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
998 998
 		EE_Registry::instance()->load_helper('URL');
999 999
 
1000 1000
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
1001
-		if ( $sticky ) {
1001
+		if ($sticky) {
1002 1002
 			$request = $_REQUEST;
1003
-			unset( $request['_wp_http_referer'] );
1004
-			unset( $request['wp_referer'] );
1005
-			foreach ( $request as $key => $value ) {
1003
+			unset($request['_wp_http_referer']);
1004
+			unset($request['wp_referer']);
1005
+			foreach ($request as $key => $value) {
1006 1006
 				//do not add nonces
1007
-				if ( strpos( $key, 'nonce' ) !== false ) {
1007
+				if (strpos($key, 'nonce') !== false) {
1008 1008
 					continue;
1009 1009
 				}
1010
-				$args['wp_referer[' . $key . ']'] = $value;
1010
+				$args['wp_referer['.$key.']'] = $value;
1011 1011
 			}
1012 1012
 		}
1013 1013
 
1014
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1014
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1015 1015
 	}
1016 1016
 
1017 1017
 
@@ -1027,8 +1027,8 @@  discard block
 block discarded – undo
1027 1027
 	 * @uses EEH_Template::get_help_tab_link()
1028 1028
 	 * @return string              generated link
1029 1029
 	 */
1030
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1031
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1030
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1031
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1032 1032
 	}
1033 1033
 
1034 1034
 
@@ -1045,30 +1045,30 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	protected function _add_help_tabs() {
1047 1047
 		$tour_buttons = '';
1048
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1048
+		if (isset($this->_page_config[$this->_req_action])) {
1049 1049
 			$config = $this->_page_config[$this->_req_action];
1050 1050
 
1051 1051
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1052
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1052
+			if (isset($this->_help_tour[$this->_req_action])) {
1053 1053
 				$tb = array();
1054 1054
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1055
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1055
+				foreach ($this->_help_tour['tours'] as $tour) {
1056 1056
 					//if this is the end tour then we don't need to setup a button
1057
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1057
+					if ($tour instanceof EE_Help_Tour_final_stop)
1058 1058
 						continue;
1059
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1059
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1060 1060
 				}
1061 1061
 				$tour_buttons .= implode('<br />', $tb);
1062 1062
 				$tour_buttons .= '</div></div>';
1063 1063
 			}
1064 1064
 
1065 1065
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1066
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1066
+			if (is_array($config) && isset($config['help_sidebar'])) {
1067 1067
 				//check that the callback given is valid
1068
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1069
-					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) ) );
1068
+				if ( ! method_exists($this, $config['help_sidebar']))
1069
+					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)));
1070 1070
 
1071
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1071
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1072 1072
 
1073 1073
 				$content .= $tour_buttons; //add help tour buttons.
1074 1074
 
@@ -1077,49 +1077,49 @@  discard block
 block discarded – undo
1077 1077
 			}
1078 1078
 
1079 1079
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1080
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1080
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1081 1081
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1082 1082
 			}
1083 1083
 
1084 1084
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1085
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1085
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1086 1086
 				$_ht['id'] = $this->page_slug;
1087 1087
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1088
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1088
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1089 1089
 				$this->_current_screen->add_help_tab($_ht);
1090 1090
 				}/**/
1091 1091
 
1092 1092
 
1093
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1093
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1094 1094
 
1095
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1095
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1096 1096
 				//we're here so there ARE help tabs!
1097 1097
 
1098 1098
 				//make sure we've got what we need
1099
-				if ( !isset( $cfg['title'] ) )
1100
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1099
+				if ( ! isset($cfg['title']))
1100
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1101 1101
 
1102 1102
 
1103
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1104
-					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') );
1103
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1104
+					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'));
1105 1105
 
1106 1106
 
1107 1107
 
1108 1108
 				//first priority goes to content.
1109
-				if ( !empty($cfg['content'] ) ) {
1110
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1109
+				if ( ! empty($cfg['content'])) {
1110
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1111 1111
 
1112 1112
 				//second priority goes to filename
1113
-				} else if ( !empty($cfg['filename'] ) ) {
1114
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1113
+				} else if ( ! empty($cfg['filename'])) {
1114
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1115 1115
 
1116 1116
 
1117 1117
 					//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)
1118
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1118
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1119 1119
 
1120 1120
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1121
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1122
-						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__ );
1121
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1122
+						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__);
1123 1123
 						return;
1124 1124
 					}
1125 1125
 					$template_args['admin_page_obj'] = $this;
@@ -1130,21 +1130,21 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 
1132 1132
 				//check if callback is valid
1133
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1134
-					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__ );
1133
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1134
+					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__);
1135 1135
 					return;
1136 1136
 				}
1137 1137
 
1138 1138
 				//setup config array for help tab method
1139
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1139
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1140 1140
 				$_ht = array(
1141 1141
 					'id' => $id,
1142 1142
 					'title' => $cfg['title'],
1143
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1143
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1144 1144
 					'content' => $content
1145 1145
 					);
1146 1146
 
1147
-				$this->_current_screen->add_help_tab( $_ht );
1147
+				$this->_current_screen->add_help_tab($_ht);
1148 1148
 			}
1149 1149
 		}
1150 1150
 	}
@@ -1164,49 +1164,49 @@  discard block
 block discarded – undo
1164 1164
 		$this->_help_tour = array();
1165 1165
 
1166 1166
 		//exit early if help tours are turned off globally
1167
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1167
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1168 1168
 			return;
1169 1169
 
1170 1170
 		//loop through _page_config to find any help_tour defined
1171
-		foreach ( $this->_page_config as $route => $config ) {
1171
+		foreach ($this->_page_config as $route => $config) {
1172 1172
 			//we're only going to set things up for this route
1173
-			if ( $route !== $this->_req_action )
1173
+			if ($route !== $this->_req_action)
1174 1174
 				continue;
1175 1175
 
1176
-			if ( isset( $config['help_tour'] ) ) {
1176
+			if (isset($config['help_tour'])) {
1177 1177
 
1178
-				foreach( $config['help_tour'] as $tour ) {
1179
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1178
+				foreach ($config['help_tour'] as $tour) {
1179
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1180 1180
 					//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
1181
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1181
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1182 1182
 
1183 1183
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1184
-					if ( !is_readable($file_path) ) {
1185
-						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__ );
1184
+					if ( ! is_readable($file_path)) {
1185
+						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__);
1186 1186
 						return;
1187 1187
 					}
1188 1188
 
1189 1189
 					require_once $file_path;
1190
-					if ( !class_exists( $tour ) ) {
1191
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1192
-						$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) );
1193
-						throw new EE_Error( implode( '||', $error_msg ));
1190
+					if ( ! class_exists($tour)) {
1191
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1192
+						$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));
1193
+						throw new EE_Error(implode('||', $error_msg));
1194 1194
 					}
1195 1195
 					$a = new ReflectionClass($tour);
1196 1196
 					$tour_obj = $a->newInstance($this->_is_caf);
1197 1197
 
1198 1198
 					$tours[] = $tour_obj;
1199
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1199
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1200 1200
 				}
1201 1201
 
1202 1202
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1203 1203
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1204 1204
 				$tours[] = $end_stop_tour;
1205
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1205
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1206 1206
 			}
1207 1207
 		}
1208 1208
 
1209
-		if ( !empty( $tours ) )
1209
+		if ( ! empty($tours))
1210 1210
 			$this->_help_tour['tours'] = $tours;
1211 1211
 
1212 1212
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1222,13 +1222,13 @@  discard block
 block discarded – undo
1222 1222
 	 * @return void
1223 1223
 	 */
1224 1224
 	protected function _add_qtips() {
1225
-		if ( isset( $this->_route_config['qtips'] ) ) {
1225
+		if (isset($this->_route_config['qtips'])) {
1226 1226
 			$qtips = (array) $this->_route_config['qtips'];
1227 1227
 			//load qtip loader
1228 1228
 			EE_Registry::instance()->load_helper('Qtip_Loader', array(), TRUE);
1229 1229
 			$path = array(
1230
-				$this->_get_dir() . '/qtips/',
1231
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1230
+				$this->_get_dir().'/qtips/',
1231
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1232 1232
 				);
1233 1233
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1234 1234
 		}
@@ -1245,41 +1245,41 @@  discard block
 block discarded – undo
1245 1245
 	 * @return void
1246 1246
 	 */
1247 1247
 	protected function _set_nav_tabs() {
1248
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1248
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1249 1249
 		$i = 0;
1250
-		foreach ( $this->_page_config as $slug => $config ) {
1251
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1250
+		foreach ($this->_page_config as $slug => $config) {
1251
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1252 1252
 				continue; //no nav tab for this config
1253 1253
 
1254 1254
 			//check for persistent flag
1255
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1255
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1256 1256
 				continue; //nav tab is only to appear when route requested.
1257 1257
 
1258
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1258
+			if ( ! $this->check_user_access($slug, TRUE))
1259 1259
 				continue; //no nav tab becasue current user does not have access.
1260 1260
 
1261
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1261
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1262 1262
 			$this->_nav_tabs[$slug] = array(
1263
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1264
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1265
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1266
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1263
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1264
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1265
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1266
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1267 1267
 				);
1268 1268
 			$i++;
1269 1269
 		}
1270 1270
 
1271 1271
 		//if $this->_nav_tabs is empty then lets set the default
1272
-		if ( empty( $this->_nav_tabs ) ) {
1272
+		if (empty($this->_nav_tabs)) {
1273 1273
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1274 1274
 				'url' => $this->admin_base_url,
1275
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1275
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1276 1276
 				'css_class' => 'nav-tab-active',
1277 1277
 				'order' => 10
1278 1278
 				);
1279 1279
 		}
1280 1280
 
1281 1281
 		//now let's sort the tabs according to order
1282
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1282
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1283 1283
 
1284 1284
 	}
1285 1285
 
@@ -1295,10 +1295,10 @@  discard block
 block discarded – undo
1295 1295
 	 * @return void
1296 1296
 	 */
1297 1297
 	private function _set_current_labels() {
1298
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1299
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1300
-				if ( is_array($text) ) {
1301
-					foreach ( $text as $sublabel => $subtext ) {
1298
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1299
+			foreach ($this->_route_config['labels'] as $label => $text) {
1300
+				if (is_array($text)) {
1301
+					foreach ($text as $sublabel => $subtext) {
1302 1302
 						$this->_labels[$label][$sublabel] = $subtext;
1303 1303
 					}
1304 1304
 				} else {
@@ -1319,24 +1319,24 @@  discard block
 block discarded – undo
1319 1319
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1320 1320
 	*		@return 		BOOL|wp_die()
1321 1321
 	*/
1322
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1323
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1324
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1325
-		$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
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1323
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1324
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1325
+		$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;
1326 1326
 
1327
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1328
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1327
+		if (empty($capability) && empty($route_to_check)) {
1328
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1329 1329
 		} else {
1330
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1330
+			$capability = empty($capability) ? 'manage_options' : $capability;
1331 1331
 		}
1332 1332
 
1333
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1333
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1334 1334
 
1335
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1336
-			if ( $verify_only ) {
1335
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1336
+			if ($verify_only) {
1337 1337
 				return FALSE;
1338 1338
 			} else {
1339
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1339
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1340 1340
 			}
1341 1341
 		}
1342 1342
 		return TRUE;
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 		$this->_add_admin_page_overlay();
1414 1414
 
1415 1415
 		//if metaboxes are present we need to add the nonce field
1416
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1416
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1417 1417
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1418 1418
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1419 1419
 		}
@@ -1432,20 +1432,20 @@  discard block
 block discarded – undo
1432 1432
 	 */
1433 1433
 	public function admin_footer_global() {
1434 1434
 		//dialog container for dialog helper
1435
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1435
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1436 1436
 		$d_cont .= '<div class="ee-notices"></div>';
1437 1437
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1438 1438
 		$d_cont .= '</div>';
1439 1439
 		echo $d_cont;
1440 1440
 
1441 1441
 		//help tour stuff?
1442
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1442
+		if (isset($this->_help_tour[$this->_req_action])) {
1443 1443
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1444 1444
 		}
1445 1445
 
1446 1446
 		//current set timezone for timezone js
1447 1447
 		EE_Registry::instance()->load_helper('DTT_Helper');
1448
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1448
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1449 1449
 	}
1450 1450
 
1451 1451
 
@@ -1469,18 +1469,18 @@  discard block
 block discarded – undo
1469 1469
 	 * @access protected
1470 1470
 	 * @return string content
1471 1471
 	 */
1472
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1472
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1473 1473
 		$content = '';
1474 1474
 
1475
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1476
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1475
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1476
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1477 1477
 
1478 1478
 
1479 1479
 		//loop through the array and setup content
1480
-		foreach ( $help_array as $trigger => $help ) {
1480
+		foreach ($help_array as $trigger => $help) {
1481 1481
 			//make sure the array is setup properly
1482
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1483
-				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') );
1482
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1483
+				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'));
1484 1484
 			}
1485 1485
 
1486 1486
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1490,10 +1490,10 @@  discard block
 block discarded – undo
1490 1490
 				'help_popup_content' => $help['content']
1491 1491
 				);
1492 1492
 
1493
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1493
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1494 1494
 		}
1495 1495
 
1496
-		if ( $display )
1496
+		if ($display)
1497 1497
 			echo $content;
1498 1498
 		else
1499 1499
 			return $content;
@@ -1510,18 +1510,18 @@  discard block
 block discarded – undo
1510 1510
 	 */
1511 1511
 	private function _get_help_content() {
1512 1512
 		//what is the method we're looking for?
1513
-		$method_name = '_help_popup_content_' . $this->_req_action;
1513
+		$method_name = '_help_popup_content_'.$this->_req_action;
1514 1514
 
1515 1515
 		//if method doesn't exist let's get out.
1516
-		if ( !method_exists( $this, $method_name ) )
1516
+		if ( ! method_exists($this, $method_name))
1517 1517
 			return array();
1518 1518
 
1519 1519
 		//k we're good to go let's retrieve the help array
1520
-		$help_array = call_user_func( array( $this, $method_name ) );
1520
+		$help_array = call_user_func(array($this, $method_name));
1521 1521
 
1522 1522
 		//make sure we've got an array!
1523
-		if ( !is_array($help_array) ) {
1524
-			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' ) );
1523
+		if ( ! is_array($help_array)) {
1524
+			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'));
1525 1525
 		}
1526 1526
 
1527 1527
 		return $help_array;
@@ -1543,27 +1543,27 @@  discard block
 block discarded – undo
1543 1543
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1544 1544
 	 * @return string
1545 1545
 	 */
1546
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1546
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1547 1547
 
1548
-		if ( defined('DOING_AJAX') ) return;
1548
+		if (defined('DOING_AJAX')) return;
1549 1549
 
1550 1550
 		//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
1551 1551
 		$help_array = $this->_get_help_content();
1552 1552
 		$help_content = '';
1553 1553
 
1554
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1554
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1555 1555
 			$help_array[$trigger_id] = array(
1556 1556
 				'title' => __('Missing Content', 'event_espresso'),
1557 1557
 				'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')
1558 1558
 				);
1559
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1559
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1560 1560
 		}
1561 1561
 
1562 1562
 		//let's setup the trigger
1563
-		$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>';
1564
-		$content = $content . $help_content;
1563
+		$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>';
1564
+		$content = $content.$help_content;
1565 1565
 
1566
-		if ( $display )
1566
+		if ($display)
1567 1567
 			echo $content;
1568 1568
 		else
1569 1569
 			return $content;
@@ -1620,15 +1620,15 @@  discard block
 block discarded – undo
1620 1620
 	public function load_global_scripts_styles() {
1621 1621
 		/** STYLES **/
1622 1622
 		// add debugging styles
1623
-		if ( WP_DEBUG ) {
1624
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1623
+		if (WP_DEBUG) {
1624
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1625 1625
 		}
1626 1626
 
1627 1627
 		//register all styles
1628
-		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 );
1629
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1628
+		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);
1629
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1630 1630
 		//helpers styles
1631
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1631
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1632 1632
 		//enqueue global styles
1633 1633
 		wp_enqueue_style('ee-admin-css');
1634 1634
 
@@ -1636,66 +1636,66 @@  discard block
 block discarded – undo
1636 1636
 		/** SCRIPTS **/
1637 1637
 
1638 1638
 		//register all scripts
1639
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1640
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1641
-		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 );
1639
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1640
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1641
+		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);
1642 1642
 
1643
-		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 );
1643
+		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);
1644 1644
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1645
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1645
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1646 1646
 		add_filter('FHEE_load_joyride', '__return_true');
1647 1647
 
1648 1648
 		//script for sorting tables
1649
-		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);
1649
+		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);
1650 1650
 		//script for parsing uri's
1651
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1651
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1652 1652
 		//and parsing associative serialized form elements
1653
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1653
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1654 1654
 		//helpers scripts
1655
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1656
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1657
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1658
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1655
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1656
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1657
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1658
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1659 1659
 
1660 1660
 		//google charts
1661
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1661
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1662 1662
 
1663 1663
 		//enqueue global scripts
1664 1664
 
1665 1665
 		//taking care of metaboxes
1666
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1666
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1667 1667
 			wp_enqueue_script('dashboard');
1668 1668
 		}
1669 1669
 
1670 1670
 		//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
1671
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1671
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1672 1672
 			wp_enqueue_script('ee_admin_js');
1673 1673
 			wp_enqueue_style('ee-admin-css');
1674 1674
 		}
1675 1675
 
1676 1676
 
1677 1677
 		//localize script for ajax lazy loading
1678
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1679
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1678
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1679
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1680 1680
 
1681 1681
 
1682 1682
 		/**
1683 1683
 		 * help tour stuff
1684 1684
 		 */
1685
-		if ( !empty( $this->_help_tour ) ) {
1685
+		if ( ! empty($this->_help_tour)) {
1686 1686
 
1687 1687
 			//register the js for kicking things off
1688
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1688
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1689 1689
 
1690 1690
 			//setup tours for the js tour object
1691
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1691
+			foreach ($this->_help_tour['tours'] as $tour) {
1692 1692
 				$tours[] = array(
1693 1693
 					'id' => $tour->get_slug(),
1694 1694
 					'options' => $tour->get_options()
1695 1695
 					);
1696 1696
 			}
1697 1697
 
1698
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1698
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1699 1699
 
1700 1700
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1701 1701
 		}
@@ -1713,52 +1713,52 @@  discard block
 block discarded – undo
1713 1713
 	public function admin_footer_scripts_eei18n_js_strings() {
1714 1714
 
1715 1715
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1716
-		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' );
1717
-
1718
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1742
-
1743
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1746
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1747
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1748
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1749
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1750
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1751
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1752
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1753
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1754
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1755
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1756
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1716
+		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');
1717
+
1718
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1742
+
1743
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1746
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1747
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1748
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1749
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1750
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1751
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1752
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1753
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1754
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1755
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1756
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1757 1757
 
1758 1758
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1759 1759
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1760 1760
 		//espresso_core is listed as a dependency of ee_admin_js.
1761
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1761
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1762 1762
 
1763 1763
 	}
1764 1764
 
@@ -1792,23 +1792,23 @@  discard block
 block discarded – undo
1792 1792
 	protected function _set_list_table() {
1793 1793
 
1794 1794
 		//first is this a list_table view?
1795
-		if ( !isset($this->_route_config['list_table']) )
1795
+		if ( ! isset($this->_route_config['list_table']))
1796 1796
 			return; //not a list_table view so get out.
1797 1797
 
1798 1798
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1799 1799
 
1800
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1800
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1801 1801
 			//user error msg
1802
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1802
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1803 1803
 			//developer error msg
1804
-			$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 );
1805
-			throw new EE_Error( $error_msg );
1804
+			$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);
1805
+			throw new EE_Error($error_msg);
1806 1806
 		}
1807 1807
 
1808 1808
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1809
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1810
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1811
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1809
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1810
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1811
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1812 1812
 
1813 1813
 		$this->_set_list_table_view();
1814 1814
 		$this->_set_list_table_object();
@@ -1830,14 +1830,14 @@  discard block
 block discarded – undo
1830 1830
 	*		@return array
1831 1831
 	*/
1832 1832
 	protected function _set_list_table_view() {
1833
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1833
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1834 1834
 
1835 1835
 
1836 1836
 		// looking at active items or dumpster diving ?
1837
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1838
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1837
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1838
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1839 1839
 		} else {
1840
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1840
+			$this->_view = sanitize_key($this->_req_data['status']);
1841 1841
 		}
1842 1842
 	}
1843 1843
 
@@ -1848,9 +1848,9 @@  discard block
 block discarded – undo
1848 1848
 	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1849 1849
 	 */
1850 1850
 	protected function _set_list_table_object() {
1851
-		if ( isset($this->_route_config['list_table'] ) ) {
1852
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1853
-				throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) );
1851
+		if (isset($this->_route_config['list_table'])) {
1852
+			if ( ! class_exists($this->_route_config['list_table']))
1853
+				throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this)));
1854 1854
 			$a = new ReflectionClass($this->_route_config['list_table']);
1855 1855
 			$this->_list_table_object = $a->newInstance($this);
1856 1856
 		}
@@ -1869,27 +1869,27 @@  discard block
 block discarded – undo
1869 1869
 	 *
1870 1870
 	 * @return array
1871 1871
 	 */
1872
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1872
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1873 1873
 
1874
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1874
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1875 1875
 
1876
-		if ( empty( $this->_views )) {
1876
+		if (empty($this->_views)) {
1877 1877
 			$this->_views = array();
1878 1878
 		}
1879 1879
 
1880 1880
 		// cycle thru views
1881
-		foreach ( $this->_views as $key => $view ) {
1881
+		foreach ($this->_views as $key => $view) {
1882 1882
 			$query_args = array();
1883 1883
 			// check for current view
1884
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1884
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1885 1885
 			$query_args['action'] = $this->_req_action;
1886
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1886
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1887 1887
 			$query_args['status'] = $view['slug'];
1888 1888
 			//merge any other arguments sent in.
1889
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1890
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1889
+			if (isset($extra_query_args[$view['slug']])) {
1890
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1891 1891
 			}
1892
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1892
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1893 1893
 		}
1894 1894
 
1895 1895
 		return $this->_views;
@@ -1906,15 +1906,15 @@  discard block
 block discarded – undo
1906 1906
 	 * @param int $max_entries total number of rows in the table
1907 1907
 	 * @return string
1908 1908
 	*/
1909
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1909
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1910 1910
 
1911
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1912
-		$values = array( 10, 25, 50, 100 );
1913
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1911
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1912
+		$values = array(10, 25, 50, 100);
1913
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1914 1914
 
1915
-		if ( $max_entries ) {
1915
+		if ($max_entries) {
1916 1916
 			$values[] = $max_entries;
1917
-			sort( $values );
1917
+			sort($values);
1918 1918
 		}
1919 1919
 
1920 1920
 		$entries_per_page_dropdown = '
@@ -1923,15 +1923,15 @@  discard block
 block discarded – undo
1923 1923
 					Show
1924 1924
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1925 1925
 
1926
-		foreach ( $values as $value ) {
1927
-			if ( $value < $max_entries ) {
1928
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1926
+		foreach ($values as $value) {
1927
+			if ($value < $max_entries) {
1928
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1929 1929
 				$entries_per_page_dropdown .= '
1930 1930
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1931 1931
 			}
1932 1932
 		}
1933 1933
 
1934
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1934
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1935 1935
 		$entries_per_page_dropdown .= '
1936 1936
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1937 1937
 
@@ -1954,8 +1954,8 @@  discard block
 block discarded – undo
1954 1954
 	*		@return 		void
1955 1955
 	*/
1956 1956
 	public function _set_search_attributes() {
1957
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1958
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1957
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1958
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1959 1959
 	}
1960 1960
 
1961 1961
 	/*** END LIST TABLE METHODS **/
@@ -1974,20 +1974,20 @@  discard block
 block discarded – undo
1974 1974
 	 * @return void
1975 1975
 	*/
1976 1976
 	private function _add_registered_meta_boxes() {
1977
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1977
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1978 1978
 
1979 1979
 		//we only add meta boxes if the page_route calls for it
1980
-		if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) {
1980
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) {
1981 1981
 
1982 1982
 
1983 1983
 			//this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader.
1984
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1985
-				if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) {
1984
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1985
+				if (call_user_func(array($this, &$metabox_callback)) === FALSE) {
1986 1986
 					// user error msg
1987
-				$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
1987
+				$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
1988 1988
 				// developer error msg
1989
-				$error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback );
1990
-				throw new EE_Error( $error_msg );
1989
+				$error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback);
1990
+				throw new EE_Error($error_msg);
1991 1991
 				}
1992 1992
 			}
1993 1993
 		}
@@ -2004,17 +2004,17 @@  discard block
 block discarded – undo
2004 2004
 	 * @return void
2005 2005
 	 */
2006 2006
 	private function _add_screen_columns() {
2007
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
2007
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
2008 2008
 
2009
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2009
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2010 2010
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2011 2011
 			$screen_id = $this->_current_screen->id;
2012 2012
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2013
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2014
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2013
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2014
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2015 2015
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2016 2016
 			$this->_template_args['screen'] = $this->_current_screen;
2017
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2017
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2018 2018
 
2019 2019
 			//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.
2020 2020
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 	 */
2032 2032
 
2033 2033
 	private function _espresso_news_post_box() {
2034
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2035
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2034
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2035
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2036 2036
 			$this,
2037 2037
 			'espresso_news_post_box'
2038
-		), $this->_wp_page_slug, 'side' );
2038
+		), $this->_wp_page_slug, 'side');
2039 2039
 	}
2040 2040
 
2041 2041
 
@@ -2043,14 +2043,14 @@  discard block
 block discarded – undo
2043 2043
 	 * Code for setting up espresso ratings request metabox.
2044 2044
 	 */
2045 2045
 	protected function _espresso_ratings_request() {
2046
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2046
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2047 2047
 			return '';
2048 2048
 		}
2049
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2050
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2049
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2050
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2051 2051
 			$this,
2052 2052
 			'espresso_ratings_request'
2053
-		), $this->_wp_page_slug, 'side' );
2053
+		), $this->_wp_page_slug, 'side');
2054 2054
 	}
2055 2055
 
2056 2056
 
@@ -2058,35 +2058,35 @@  discard block
 block discarded – undo
2058 2058
 	 * Code for setting up espresso ratings request metabox content.
2059 2059
 	 */
2060 2060
 	public function espresso_ratings_request() {
2061
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2062
-		EE_Registry::instance()->load_helper( 'Template' );
2063
-		EEH_Template::display_template( $template_path, array() );
2061
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2062
+		EE_Registry::instance()->load_helper('Template');
2063
+		EEH_Template::display_template($template_path, array());
2064 2064
 	}
2065 2065
 
2066 2066
 
2067 2067
 
2068 2068
 
2069
-	public static function cached_rss_display( $rss_id, $url ) {
2070
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2071
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2072
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2073
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2074
-		$post = '</div>' . "\n";
2069
+	public static function cached_rss_display($rss_id, $url) {
2070
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2071
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2072
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2073
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2074
+		$post = '</div>'."\n";
2075 2075
 
2076
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2077
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2078
-			echo $pre . $output . $post;
2076
+		$cache_key = 'ee_rss_'.md5($rss_id);
2077
+		if (FALSE != ($output = get_transient($cache_key))) {
2078
+			echo $pre.$output.$post;
2079 2079
 			return TRUE;
2080 2080
 		}
2081 2081
 
2082
-		if ( ! $doing_ajax ) {
2083
-			echo $pre . $loading . $post;
2082
+		if ( ! $doing_ajax) {
2083
+			echo $pre.$loading.$post;
2084 2084
 			return FALSE;
2085 2085
 		}
2086 2086
 
2087 2087
 		ob_start();
2088
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2089
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2088
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2089
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2090 2090
 		return TRUE;
2091 2091
 
2092 2092
 	}
@@ -2098,13 +2098,13 @@  discard block
 block discarded – undo
2098 2098
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2099 2099
 	  		<?php
2100 2100
 	  		// Get RSS Feed(s)
2101
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2101
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2102 2102
 	  		$url = urlencode($feed_url);
2103
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2103
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2104 2104
 
2105 2105
 	  		?>
2106 2106
 	  	</div>
2107
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2107
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2108 2108
 	  </div>
2109 2109
 		<?php
2110 2110
 	}
@@ -2125,32 +2125,32 @@  discard block
 block discarded – undo
2125 2125
 
2126 2126
 	protected function _espresso_sponsors_post_box() {
2127 2127
 
2128
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2129
-		if ( $show_sponsors )
2130
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2128
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2129
+		if ($show_sponsors)
2130
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2131 2131
 	}
2132 2132
 
2133 2133
 
2134 2134
 	public function espresso_sponsors_post_box() {
2135
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2136
-		EEH_Template::display_template( $templatepath );
2135
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2136
+		EEH_Template::display_template($templatepath);
2137 2137
 	}
2138 2138
 
2139 2139
 
2140 2140
 
2141 2141
 	private function _publish_post_box() {
2142
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2142
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2143 2143
 
2144 2144
 		//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)
2145
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2146
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2145
+		if ( ! empty($this->_labels['publishbox'])) {
2146
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2147 2147
 		} else {
2148 2148
 			$box_label = __('Publish', 'event_espresso');
2149 2149
 		}
2150 2150
 
2151
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2151
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2152 2152
 
2153
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2153
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2154 2154
 
2155 2155
 	}
2156 2156
 
@@ -2158,9 +2158,9 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 	public function editor_overview() {
2160 2160
 		//if we have extra content set let's add it in if not make sure its empty
2161
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2162
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2163
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2161
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2162
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2163
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2164 2164
 	}
2165 2165
 
2166 2166
 
@@ -2176,8 +2176,8 @@  discard block
 block discarded – undo
2176 2176
 	 * @see $this->_set_publish_post_box_vars for param details
2177 2177
 	 * @since 4.6.0
2178 2178
 	 */
2179
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2180
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2179
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2180
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2181 2181
 	}
2182 2182
 
2183 2183
 
@@ -2196,24 +2196,24 @@  discard block
 block discarded – undo
2196 2196
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2197 2197
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2198 2198
 	 */
2199
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2199
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2200 2200
 
2201 2201
 		// if Save & Close, use a custom redirect URL or default to the main page?
2202
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2202
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2203 2203
 		// create the Save & Close and Save buttons
2204
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2204
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2205 2205
 		//if we have extra content set let's add it in if not make sure its empty
2206
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2206
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2207 2207
 
2208 2208
 
2209
-		if ( $delete && ! empty( $id )  ) {
2209
+		if ($delete && ! empty($id)) {
2210 2210
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2211
-			$delete_link_args = array( $name => $id );
2212
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2211
+			$delete_link_args = array($name => $id);
2212
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2213 2213
 		}
2214 2214
 
2215
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2216
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2215
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2216
+		if ( ! empty($name) && ! empty($id)) {
2217 2217
 			$hidden_field_arr[$name] = array(
2218 2218
 				'type' => 'hidden',
2219 2219
 				'value' => $id
@@ -2223,7 +2223,7 @@  discard block
 block discarded – undo
2223 2223
 			$hf = '';
2224 2224
 		}
2225 2225
 		// add hidden field
2226
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2226
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2227 2227
 
2228 2228
 	}
2229 2229
 
@@ -2240,8 +2240,8 @@  discard block
 block discarded – undo
2240 2240
 		<noscript>
2241 2241
 			<div id="no-js-message" class="error">
2242 2242
 				<p style="font-size:1.3em;">
2243
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2244
-					<?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' ); ?>
2243
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2244
+					<?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'); ?>
2245 2245
 				</p>
2246 2246
 			</div>
2247 2247
 		</noscript>
@@ -2261,7 +2261,7 @@  discard block
 block discarded – undo
2261 2261
 	*		@return 		string
2262 2262
 	*/
2263 2263
 	private function _display_espresso_notices() {
2264
-		$notices = $this->_get_transient( TRUE );
2264
+		$notices = $this->_get_transient(TRUE);
2265 2265
 		echo stripslashes($notices);
2266 2266
 	}
2267 2267
 
@@ -2313,11 +2313,11 @@  discard block
 block discarded – undo
2313 2313
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2314 2314
 	 * @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.
2315 2315
 	 */
2316
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2317
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2316
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2317
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2318 2318
 
2319 2319
 		//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.
2320
-		if ( empty( $callback_args ) && $create_func ) {
2320
+		if (empty($callback_args) && $create_func) {
2321 2321
 			$callback_args = array(
2322 2322
 				'template_path' => $this->_template_path,
2323 2323
 				'template_args' => $this->_template_args,
@@ -2327,7 +2327,7 @@  discard block
 block discarded – undo
2327 2327
 		//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)
2328 2328
 		$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;
2329 2329
 
2330
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2330
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2331 2331
 	}
2332 2332
 
2333 2333
 
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 	 */
2341 2341
 	public function display_admin_page_with_metabox_columns() {
2342 2342
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2343
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2343
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2344 2344
 
2345 2345
 		//the final wrapper
2346 2346
 		$this->admin_page_wrapper();
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 	 * @return void
2384 2384
 	 */
2385 2385
 	public function display_about_admin_page() {
2386
-		$this->_display_admin_page( FALSE, TRUE );
2386
+		$this->_display_admin_page(FALSE, TRUE);
2387 2387
 	}
2388 2388
 
2389 2389
 
@@ -2399,26 +2399,26 @@  discard block
 block discarded – undo
2399 2399
 	 * @return html           admin_page
2400 2400
 	 */
2401 2401
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2402
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2402
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2403 2403
 
2404 2404
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2405
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2405
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2406 2406
 
2407 2407
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2408 2408
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2409 2409
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2410 2410
 
2411
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2411
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2412 2412
 
2413
-		if ( defined('DOING_AJAX' ) )
2414
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2413
+		if (defined('DOING_AJAX'))
2414
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2415 2415
 
2416
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2416
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2417 2417
 
2418
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2418
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2419 2419
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2420 2420
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2421
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2421
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2422 2422
 
2423 2423
 
2424 2424
 		// the final template wrapper
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 	 * @param bool   $display_sidebar whether to use the sidebar template or the full template for the page.  TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2439 2439
 	 * @return void
2440 2440
 	 */
2441
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2441
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2442 2442
 		//let's generate a default preview action button if there isn't one already present.
2443 2443
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2444 2444
 		$buy_now_url = add_query_arg(
@@ -2451,10 +2451,10 @@  discard block
 block discarded – undo
2451 2451
 			),
2452 2452
 		'http://eventespresso.com/pricing/'
2453 2453
 		);
2454
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button'];
2455
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2456
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2457
-		$this->_display_admin_page( $display_sidebar );
2454
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button'];
2455
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2456
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2457
+		$this->_display_admin_page($display_sidebar);
2458 2458
 	}
2459 2459
 
2460 2460
 
@@ -2488,41 +2488,41 @@  discard block
 block discarded – undo
2488 2488
 	 * @param boolean $sidebar whether to display with sidebar or not.
2489 2489
 	 * @return html
2490 2490
 	 */
2491
-	private function _display_admin_list_table_page( $sidebar = false ) {
2491
+	private function _display_admin_list_table_page($sidebar = false) {
2492 2492
 		//setup search attributes
2493 2493
 		$this->_set_search_attributes();
2494 2494
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2495
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2495
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2496 2496
 
2497
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2497
+		$this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2498 2498
 		$this->_template_args['list_table'] = $this->_list_table_object;
2499 2499
 		$this->_template_args['current_route'] = $this->_req_action;
2500
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2500
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2501 2501
 
2502 2502
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2503
-		if( ! empty( $ajax_sorting_callback )) {
2504
-			$sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE );
2503
+		if ( ! empty($ajax_sorting_callback)) {
2504
+			$sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE);
2505 2505
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2506 2506
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2507
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2508
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2507
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2508
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2509 2509
 		} else {
2510 2510
 			$sortable_list_table_form_fields = '';
2511 2511
 		}
2512 2512
 
2513 2513
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2514
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2515
-		$nonce_ref = $this->_req_action . '_nonce';
2516
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2514
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2515
+		$nonce_ref = $this->_req_action.'_nonce';
2516
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2517 2517
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2518 2518
 
2519 2519
 		//display message about search results?
2520
-		$this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action );
2520
+		$this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action);
2521 2521
 
2522
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2522
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2523 2523
 
2524 2524
 		// the final template wrapper
2525
-		if ( $sidebar )
2525
+		if ($sidebar)
2526 2526
 			$this->display_admin_page_with_sidebar();
2527 2527
 		else
2528 2528
 			$this->display_admin_page_with_no_sidebar();
@@ -2545,9 +2545,9 @@  discard block
 block discarded – undo
2545 2545
 	 * @param  array $items  see above for format of array
2546 2546
 	 * @return string        html string of legend
2547 2547
 	 */
2548
-	protected function _display_legend( $items ) {
2549
-		$template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2550
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2548
+	protected function _display_legend($items) {
2549
+		$template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2550
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2551 2551
 		return EEH_Template::display_template($legend_template, $template_args, TRUE);
2552 2552
 	}
2553 2553
 
@@ -2572,31 +2572,31 @@  discard block
 block discarded – undo
2572 2572
 	 *
2573 2573
 	 * @return json object
2574 2574
 	 */
2575
-	protected function _return_json( $sticky_notices = FALSE ) {
2575
+	protected function _return_json($sticky_notices = FALSE) {
2576 2576
 
2577 2577
 		//make sure any EE_Error notices have been handled.
2578
-		$this->_process_notices( array(), true, $sticky_notices );
2578
+		$this->_process_notices(array(), true, $sticky_notices);
2579 2579
 
2580 2580
 
2581
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2581
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2582 2582
 		unset($this->_template_args['data']);
2583 2583
 		$json = array(
2584
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : FALSE,
2585
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : FALSE,
2584
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : FALSE,
2585
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : FALSE,
2586 2586
 			'notices' => EE_Error::get_notices(),
2587
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2588
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2587
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2588
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2589 2589
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2590 2590
 			);
2591 2591
 
2592 2592
 
2593 2593
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2594
-		if ( NULL === error_get_last() || ! headers_sent() )
2594
+		if (NULL === error_get_last() || ! headers_sent())
2595 2595
 			header('Content-Type: application/json; charset=UTF-8');
2596
-                if( function_exists( 'wp_json_encode' ) ) {
2597
-                    echo wp_json_encode( $json );
2596
+                if (function_exists('wp_json_encode')) {
2597
+                    echo wp_json_encode($json);
2598 2598
                 } else {
2599
-                    echo json_encode( $json );
2599
+                    echo json_encode($json);
2600 2600
                 }
2601 2601
 		exit();
2602 2602
 	}
@@ -2608,11 +2608,11 @@  discard block
 block discarded – undo
2608 2608
 	 * @return json_obj|EE_Error
2609 2609
 	 */
2610 2610
 	public function return_json() {
2611
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2611
+		if (defined('DOING_AJAX') && DOING_AJAX)
2612 2612
 			$this->_return_json();
2613 2613
 
2614 2614
 		else {
2615
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2615
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2616 2616
 		}
2617 2617
 	}
2618 2618
 
@@ -2627,7 +2627,7 @@  discard block
 block discarded – undo
2627 2627
 	 * @access public
2628 2628
 	 * @return void
2629 2629
 	 */
2630
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2630
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2631 2631
 		$this->_hook_obj = $hook_obj;
2632 2632
 	}
2633 2633
 
@@ -2643,33 +2643,33 @@  discard block
 block discarded – undo
2643 2643
 	*/
2644 2644
 	public function admin_page_wrapper($about = FALSE) {
2645 2645
 
2646
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2646
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2647 2647
 
2648 2648
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2649 2649
 
2650 2650
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2651 2651
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2652 2652
 
2653
-		$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'] : '');
2654
-		$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'] : '');
2653
+		$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'] : '');
2654
+		$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'] : '');
2655 2655
 
2656 2656
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2657 2657
 
2658 2658
 
2659 2659
 
2660 2660
 		// load settings page wrapper template
2661
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2661
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2662 2662
 
2663 2663
 		//about page?
2664
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2664
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2665 2665
 
2666 2666
 
2667
-		if ( defined( 'DOING_AJAX' ) ) {
2668
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2667
+		if (defined('DOING_AJAX')) {
2668
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2669 2669
 
2670 2670
 			$this->_return_json();
2671 2671
 		} else {
2672
-			EEH_Template::display_template( $template_path, $this->_template_args );
2672
+			EEH_Template::display_template($template_path, $this->_template_args);
2673 2673
 		}
2674 2674
 
2675 2675
 	}
@@ -2682,7 +2682,7 @@  discard block
 block discarded – undo
2682 2682
 	 */
2683 2683
 	protected function _get_main_nav_tabs() {
2684 2684
 		//let's generate the html using the EEH_Tabbed_Content helper.  We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute (rather than setting in the page_routes array)
2685
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2685
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2686 2686
 		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
2687 2687
 	}
2688 2688
 
@@ -2698,7 +2698,7 @@  discard block
 block discarded – undo
2698 2698
 	*		@access public
2699 2699
 	*		@return void
2700 2700
 	*/
2701
-	private function _sort_nav_tabs( $a, $b ) {
2701
+	private function _sort_nav_tabs($a, $b) {
2702 2702
 		if ($a['order'] == $b['order']) {
2703 2703
 	        return 0;
2704 2704
 	    }
@@ -2719,8 +2719,8 @@  discard block
 block discarded – undo
2719 2719
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2720 2720
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2721 2721
 	 */
2722
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2723
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2722
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2723
+		EE_Registry::instance()->load_helper('Form_Fields');
2724 2724
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2725 2725
 		return $content;
2726 2726
 	}
@@ -2742,25 +2742,25 @@  discard block
 block discarded – undo
2742 2742
 	 * @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.
2743 2743
 	 * @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).
2744 2744
 	 */
2745
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2745
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2746 2746
 		//make sure $text and $actions are in an array
2747 2747
 		$text = (array) $text;
2748 2748
 		$actions = (array) $actions;
2749 2749
 		$referrer_url = empty($referrer) ? '' : $referrer;
2750
-		$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 .'" />';
2750
+		$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.'" />';
2751 2751
 
2752
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2753
-		$default_names = array( 'save', 'save_and_close' );
2752
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2753
+		$default_names = array('save', 'save_and_close');
2754 2754
 
2755 2755
 		//add in a hidden index for the current page (so save and close redirects properly)
2756 2756
 		$this->_template_args['save_buttons'] = $referrer_url;
2757 2757
 
2758
-		foreach ( $button_text as $key => $button ) {
2758
+		foreach ($button_text as $key => $button) {
2759 2759
 			$ref = $default_names[$key];
2760
-			$id = $this->_current_view . '_' . $ref;
2761
-			$name = !empty($actions) ? $actions[$key] : $ref;
2762
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2763
-			if ( !$both ) break;
2760
+			$id = $this->_current_view.'_'.$ref;
2761
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2762
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2763
+			if ( ! $both) break;
2764 2764
 		}
2765 2765
 
2766 2766
 	}
@@ -2773,8 +2773,8 @@  discard block
 block discarded – undo
2773 2773
 	 * @since 4.6.0
2774 2774
 	 *
2775 2775
 	 */
2776
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2777
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2776
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2777
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2778 2778
 	}
2779 2779
 
2780 2780
 
@@ -2787,30 +2787,30 @@  discard block
 block discarded – undo
2787 2787
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2788 2788
 	 * @return void
2789 2789
 	 */
2790
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2790
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2791 2791
 
2792
-		if ( empty( $route )) {
2792
+		if (empty($route)) {
2793 2793
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2794
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2795
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2794
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2795
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2796 2796
 		}
2797 2797
 		// open form
2798
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2798
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2799 2799
 		// add nonce
2800
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2800
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2801 2801
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2802
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2802
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2803 2803
 		// add REQUIRED form action
2804 2804
 		$hidden_fields = array(
2805
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2805
+				'action' => array('type' => 'hidden', 'value' => $route),
2806 2806
 			);
2807 2807
 		// merge arrays
2808
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2808
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2809 2809
 		// generate form fields
2810
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2810
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2811 2811
 		// add fields to form
2812
-		foreach ( $form_fields as $field_name => $form_field ) {
2813
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2812
+		foreach ($form_fields as $field_name => $form_field) {
2813
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2814 2814
 		}
2815 2815
 
2816 2816
 		// close form
@@ -2827,8 +2827,8 @@  discard block
 block discarded – undo
2827 2827
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2828 2828
 	 * @since 4.5.0
2829 2829
 	 */
2830
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2831
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2830
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2831
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2832 2832
 	}
2833 2833
 
2834 2834
 
@@ -2844,32 +2844,32 @@  discard block
 block discarded – undo
2844 2844
 	 *	@access protected
2845 2845
 	 *	@return void
2846 2846
 	 */
2847
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2847
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2848 2848
 
2849
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2849
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2850 2850
 
2851 2851
 		//class name for actions/filters.
2852 2852
 		$classname = get_class($this);
2853 2853
 
2854 2854
 		//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
2855
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2856
-		$notices = EE_Error::get_notices( FALSE );
2855
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2856
+		$notices = EE_Error::get_notices(FALSE);
2857 2857
 
2858 2858
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2859
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2859
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2860 2860
 			EE_Error::overwrite_success();
2861 2861
 		}
2862 2862
 		// how many records affected ? more than one record ? or just one ?
2863
-		if ( $success > 1 && empty( $notices['errors'] )) {
2863
+		if ($success > 1 && empty($notices['errors'])) {
2864 2864
 			// set plural msg
2865
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2866
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2865
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2866
+		} else if ($success == 1 && empty($notices['errors'])) {
2867 2867
 			// set singular msg
2868
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2868
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2869 2869
 		}
2870 2870
 
2871 2871
 		// check that $query_args isn't something crazy
2872
-		if ( ! is_array( $query_args )) {
2872
+		if ( ! is_array($query_args)) {
2873 2873
 			$query_args = array();
2874 2874
 		}
2875 2875
 
@@ -2882,36 +2882,36 @@  discard block
 block discarded – undo
2882 2882
 		 * @param array $query_args   The original query_args array coming into the
2883 2883
 		 *                          		method.
2884 2884
 		 */
2885
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2885
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2886 2886
 
2887 2887
 		//calculate where we're going (if we have a "save and close" button pushed)
2888
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2888
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2889 2889
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2890
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2890
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2891 2891
 			// regenerate query args array from refferer URL
2892
-			parse_str( $parsed_url['query'], $query_args );
2892
+			parse_str($parsed_url['query'], $query_args);
2893 2893
 			// correct page and action will be in the query args now
2894
-			$redirect_url = admin_url( 'admin.php' );
2894
+			$redirect_url = admin_url('admin.php');
2895 2895
 		}
2896 2896
 
2897 2897
 		//merge any default query_args set in _default_route_query_args property
2898
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2898
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2899 2899
 			$args_to_merge = array();
2900
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2900
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2901 2901
 				//is there a wp_referer array in our _default_route_query_args property?
2902
-				if ( $query_param == 'wp_referer'  ) {
2902
+				if ($query_param == 'wp_referer') {
2903 2903
 					$query_value = (array) $query_value;
2904
-					foreach ( $query_value as $reference => $value ) {
2905
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2904
+					foreach ($query_value as $reference => $value) {
2905
+						if (strpos($reference, 'nonce') !== false) {
2906 2906
 							continue;
2907 2907
 						}
2908 2908
 
2909 2909
 						//finally we will override any arguments in the referer with
2910 2910
 						//what might be set on the _default_route_query_args array.
2911
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2912
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2911
+						if (isset($this->_default_route_query_args[$reference])) {
2912
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2913 2913
 						} else {
2914
-							$args_to_merge[$reference] = urlencode( $value );
2914
+							$args_to_merge[$reference] = urlencode($value);
2915 2915
 						}
2916 2916
 					}
2917 2917
 					continue;
@@ -2922,7 +2922,7 @@  discard block
 block discarded – undo
2922 2922
 
2923 2923
 			//now let's merge these arguments but override with what was specifically sent in to the
2924 2924
 			//redirect.
2925
-			$query_args = array_merge( $args_to_merge, $query_args );
2925
+			$query_args = array_merge($args_to_merge, $query_args);
2926 2926
 		}
2927 2927
 
2928 2928
 		$this->_process_notices($query_args);
@@ -2931,19 +2931,19 @@  discard block
 block discarded – undo
2931 2931
 		// generate redirect url
2932 2932
 
2933 2933
 		// if redirecting to anything other than the main page, add a nonce
2934
-		if ( isset( $query_args['action'] )) {
2934
+		if (isset($query_args['action'])) {
2935 2935
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2936
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2936
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2937 2937
 		}
2938 2938
 
2939 2939
 		//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).
2940
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2940
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2941 2941
 
2942
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2942
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2943 2943
 
2944 2944
 
2945 2945
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2946
-		if ( defined('DOING_AJAX' ) ) {
2946
+		if (defined('DOING_AJAX')) {
2947 2947
 			$default_data = array(
2948 2948
 				'close' => TRUE,
2949 2949
 				'redirect_url' => $redirect_url,
@@ -2952,11 +2952,11 @@  discard block
 block discarded – undo
2952 2952
 				);
2953 2953
 
2954 2954
 			$this->_template_args['success'] = $success;
2955
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2955
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2956 2956
 			$this->_return_json();
2957 2957
 		}
2958 2958
 
2959
-		wp_safe_redirect( $redirect_url );
2959
+		wp_safe_redirect($redirect_url);
2960 2960
 		exit();
2961 2961
 	}
2962 2962
 
@@ -2972,14 +2972,14 @@  discard block
 block discarded – undo
2972 2972
 	 * @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.
2973 2973
 	 * @return void
2974 2974
 	 */
2975
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
2975
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
2976 2976
 
2977 2977
 		$this->_template_args['notices'] = EE_Error::get_notices();
2978 2978
 
2979 2979
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
2980
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
2981
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
2982
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
2980
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
2981
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
2982
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
2983 2983
 		}
2984 2984
 	}
2985 2985
 
@@ -3001,32 +3001,32 @@  discard block
 block discarded – undo
3001 3001
 	 *
3002 3002
 	 * @return string html for button
3003 3003
 	 */
3004
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3004
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
3005 3005
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3006
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3007
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3006
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
3007
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
3008 3008
 
3009
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3010
-			throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) );
3009
+		if ( ! isset($this->_labels['buttons'][$type]))
3010
+			throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type));
3011 3011
 
3012 3012
 		//finally check user access for this button.
3013
-		$has_access = $this->check_user_access( $action, TRUE );
3014
-		if ( ! $has_access ) {
3013
+		$has_access = $this->check_user_access($action, TRUE);
3014
+		if ( ! $has_access) {
3015 3015
 			return '';
3016 3016
 		}
3017 3017
 
3018
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
3018
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3019 3019
 
3020 3020
 		$query_args = array(
3021 3021
 			'action' => $action  );
3022 3022
 
3023 3023
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3024
-		if ( !empty($extra_request) )
3025
-			$query_args = array_merge( $extra_request, $query_args );
3024
+		if ( ! empty($extra_request))
3025
+			$query_args = array_merge($extra_request, $query_args);
3026 3026
 
3027
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3027
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3028 3028
 
3029
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3029
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3030 3030
 
3031 3031
 		return $button;
3032 3032
 	}
@@ -3046,11 +3046,11 @@  discard block
 block discarded – undo
3046 3046
 		$args = array(
3047 3047
 			'label' => $this->_admin_page_title,
3048 3048
 			'default' => 10,
3049
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3049
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3050 3050
 			);
3051 3051
 		//ONLY add the screen option if the user has access to it.
3052
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3053
-			add_screen_option( $option, $args );
3052
+		if ($this->check_user_access($this->_current_view, true)) {
3053
+			add_screen_option($option, $args);
3054 3054
 		}
3055 3055
 	}
3056 3056
 
@@ -3066,36 +3066,36 @@  discard block
 block discarded – undo
3066 3066
 	 * @return void
3067 3067
 	 */
3068 3068
 	private function _set_per_page_screen_options() {
3069
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3070
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3069
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3070
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3071 3071
 
3072
-			if ( !$user = wp_get_current_user() )
3072
+			if ( ! $user = wp_get_current_user())
3073 3073
 			return;
3074 3074
 			$option = $_POST['wp_screen_options']['option'];
3075 3075
 			$value = $_POST['wp_screen_options']['value'];
3076 3076
 
3077
-			if ( $option != sanitize_key( $option ) )
3077
+			if ($option != sanitize_key($option))
3078 3078
 				return;
3079 3079
 
3080 3080
 			$map_option = $option;
3081 3081
 
3082 3082
 			$option = str_replace('-', '_', $option);
3083 3083
 
3084
-			switch ( $map_option ) {
3085
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3084
+			switch ($map_option) {
3085
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3086 3086
 					$value = (int) $value;
3087
-					if ( $value < 1 || $value > 999 )
3087
+					if ($value < 1 || $value > 999)
3088 3088
 						return;
3089 3089
 					break;
3090 3090
 				default:
3091
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3092
-					if ( false === $value )
3091
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3092
+					if (false === $value)
3093 3093
 						return;
3094 3094
 					break;
3095 3095
 			}
3096 3096
 
3097 3097
 			update_user_meta($user->ID, $option, $value);
3098
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3098
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3099 3099
 			exit;
3100 3100
 		}
3101 3101
 	}
@@ -3106,8 +3106,8 @@  discard block
 block discarded – undo
3106 3106
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3107 3107
 	 * @param array $data array that will be assigned to template args.
3108 3108
 	 */
3109
-	public function set_template_args( $data ) {
3110
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3109
+	public function set_template_args($data) {
3110
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3111 3111
 	}
3112 3112
 
3113 3113
 
@@ -3123,26 +3123,26 @@  discard block
 block discarded – undo
3123 3123
 	 * @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.
3124 3124
 	 * @return void
3125 3125
 	 */
3126
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3126
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3127 3127
 		$user_id = get_current_user_id();
3128 3128
 
3129
-		if ( !$skip_route_verify )
3129
+		if ( ! $skip_route_verify)
3130 3130
 			$this->_verify_route($route);
3131 3131
 
3132 3132
 
3133 3133
 		//now let's set the string for what kind of transient we're setting
3134
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3135
-		$data = $notices ? array( 'notices' => $data ) : $data;
3134
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3135
+		$data = $notices ? array('notices' => $data) : $data;
3136 3136
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3137
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3138
-		if ( $existing ) {
3139
-			$data = array_merge( (array) $data, (array) $existing );
3137
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3138
+		if ($existing) {
3139
+			$data = array_merge((array) $data, (array) $existing);
3140 3140
 		}
3141 3141
 
3142
-		if ( is_multisite() && is_network_admin() ) {
3143
-			set_site_transient( $transient, $data, 8 );
3142
+		if (is_multisite() && is_network_admin()) {
3143
+			set_site_transient($transient, $data, 8);
3144 3144
 		} else {
3145
-			set_transient( $transient, $data, 8 );
3145
+			set_transient($transient, $data, 8);
3146 3146
 		}
3147 3147
 	}
3148 3148
 
@@ -3154,18 +3154,18 @@  discard block
 block discarded – undo
3154 3154
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3155 3155
 	 * @return mixed data
3156 3156
 	 */
3157
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3157
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3158 3158
 		$user_id = get_current_user_id();
3159
-		$route = !$route ? $this->_req_action : $route;
3160
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3161
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3159
+		$route = ! $route ? $this->_req_action : $route;
3160
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3161
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3162 3162
 		//delete transient after retrieval (just in case it hasn't expired);
3163
-		if ( is_multisite() && is_network_admin() ) {
3164
-			delete_site_transient( $transient );
3163
+		if (is_multisite() && is_network_admin()) {
3164
+			delete_site_transient($transient);
3165 3165
 		} else {
3166
-			delete_transient( $transient );
3166
+			delete_transient($transient);
3167 3167
 		}
3168
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3168
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3169 3169
 	}
3170 3170
 
3171 3171
 
@@ -3182,12 +3182,12 @@  discard block
 block discarded – undo
3182 3182
 
3183 3183
 		//retrieve all existing transients
3184 3184
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3185
-		if ( $results = $wpdb->get_results( $query ) ) {
3186
-			foreach ( $results as $result ) {
3187
-				$transient = str_replace( '_transient_', '', $result->option_name );
3188
-				get_transient( $transient );
3189
-				if ( is_multisite() && is_network_admin() ) {
3190
-					get_site_transient( $transient );
3185
+		if ($results = $wpdb->get_results($query)) {
3186
+			foreach ($results as $result) {
3187
+				$transient = str_replace('_transient_', '', $result->option_name);
3188
+				get_transient($transient);
3189
+				if (is_multisite() && is_network_admin()) {
3190
+					get_site_transient($transient);
3191 3191
 				}
3192 3192
 			}
3193 3193
 		}
@@ -3311,23 +3311,23 @@  discard block
 block discarded – undo
3311 3311
 	 * @param string $line	line no where error occurred
3312 3312
 	 * @return boolean
3313 3313
 	 */
3314
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3314
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3315 3315
 
3316 3316
 		//remove any options that are NOT going to be saved with the config settings.
3317
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3317
+		if (isset($config->core->ee_ueip_optin)) {
3318 3318
 			$config->core->ee_ueip_has_notified = TRUE;
3319 3319
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3320
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3321
-			update_option( 'ee_ueip_has_notified', TRUE );
3320
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3321
+			update_option('ee_ueip_has_notified', TRUE);
3322 3322
 		}
3323 3323
 		// and save it (note we're also doing the network save here)
3324
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3325
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3326
-		if ( $config_saved && $net_saved ) {
3327
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3324
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3325
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3326
+		if ($config_saved && $net_saved) {
3327
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3328 3328
 			return TRUE;
3329 3329
 		} else {
3330
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3330
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3331 3331
 			return FALSE;
3332 3332
 		}
3333 3333
 	}
@@ -3340,7 +3340,7 @@  discard block
 block discarded – undo
3340 3340
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3341 3341
 	 * @return array
3342 3342
 	 */
3343
-	public function get_yes_no_values(){
3343
+	public function get_yes_no_values() {
3344 3344
 		return $this->_yes_no_values;
3345 3345
 	}
3346 3346
 
@@ -3362,8 +3362,8 @@  discard block
 block discarded – undo
3362 3362
 	 *
3363 3363
 	 * @return string
3364 3364
 	 */
3365
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3366
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3365
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3366
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3367 3367
 	}
3368 3368
 
3369 3369
 
@@ -3377,8 +3377,8 @@  discard block
 block discarded – undo
3377 3377
 	 *
3378 3378
 	 * @return string
3379 3379
 	 */
3380
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3381
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3380
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3381
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3382 3382
 	}
3383 3383
 
3384 3384
 
@@ -3397,8 +3397,8 @@  discard block
 block discarded – undo
3397 3397
 	 * @return bool success/fail
3398 3398
 	 */
3399 3399
 	protected function _process_resend_registration() {
3400
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3401
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3400
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3401
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3402 3402
 		return $this->_template_args['success'];
3403 3403
 	}
3404 3404
 
@@ -3411,9 +3411,9 @@  discard block
 block discarded – undo
3411 3411
 	 * @param \EE_Payment $payment
3412 3412
 	 * @return bool success/fail
3413 3413
 	 */
3414
-	protected function _process_payment_notification( EE_Payment $payment ) {
3415
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3416
-		$success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment );
3414
+	protected function _process_payment_notification(EE_Payment $payment) {
3415
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3416
+		$success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment);
3417 3417
 		$this->_template_args['success'] = $success;
3418 3418
 		return $success;
3419 3419
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT.core.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	/**
81
-	* @var EE_CPT_Base
82
-	*/
81
+	 * @var EE_CPT_Base
82
+	 */
83 83
 	protected $_cpt_model_obj = FALSE;
84 84
 
85 85
 
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 		$model = null;
660 660
 		if (
661 661
 			empty( $this->_cpt_model_names )
662
-		    || (
663
-			     ! $ignore_route_check
664
-			     && ! isset( $this->_cpt_routes[ $this->_req_action ] )
665
-		    ) || (
666
-			     $this->_cpt_model_obj instanceof EE_CPT_Base
667
-			     && $this->_cpt_model_obj->ID() === $id
662
+			|| (
663
+				 ! $ignore_route_check
664
+				 && ! isset( $this->_cpt_routes[ $this->_req_action ] )
665
+			) || (
666
+				 $this->_cpt_model_obj instanceof EE_CPT_Base
667
+				 && $this->_cpt_model_obj->ID() === $id
668 668
 			)
669 669
 		) {
670 670
 			EE_Admin::debug_log( __METHOD__, array( '**RETURN**' => true ) );
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 		//if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
907 907
 		if ( $update
908 908
 			&& (
909
-			     ! $this->_cpt_model_obj instanceof EE_CPT_Base
910
-			     || $this->_cpt_model_obj->ID() !== $post_id
911
-		     )
909
+				 ! $this->_cpt_model_obj instanceof EE_CPT_Base
910
+				 || $this->_cpt_model_obj->ID() !== $post_id
911
+			 )
912 912
 		) {
913 913
 			return;
914 914
 		}
Please login to merge, or discard this patch.
Spacing   +254 added lines, -254 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param  object $post    The post object of the cpt that was saved.
114 114
 	 * @return void
115 115
 	 */
116
-	abstract protected function _insert_update_cpt_item( $post_id, $post );
116
+	abstract protected function _insert_update_cpt_item($post_id, $post);
117 117
 
118 118
 
119 119
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $post_id The ID of the cpt that was trashed
127 127
 	 * @return void
128 128
 	 */
129
-	abstract public function trash_cpt_item( $post_id );
129
+	abstract public function trash_cpt_item($post_id);
130 130
 
131 131
 
132 132
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $post_id theID of the cpt that was untrashed
138 138
 	 * @return void
139 139
 	 */
140
-	abstract public function restore_cpt_item( $post_id );
140
+	abstract public function restore_cpt_item($post_id);
141 141
 
142 142
 
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $post_id the ID of the cpt that was deleted
149 149
 	 * @return void
150 150
 	 */
151
-	abstract public function delete_cpt_item( $post_id );
151
+	abstract public function delete_cpt_item($post_id);
152 152
 
153 153
 
154 154
 
@@ -161,32 +161,32 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function _before_page_setup() {
163 163
 
164
-		$page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug;
164
+		$page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
165 165
 
166
-		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes );
166
+		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes);
167 167
 
168 168
 		//let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
169
-		$this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page );
169
+		$this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page);
170 170
 
171 171
 		//tweak pagenow for page loading.
172
-		if( ! $this->_pagenow_map ) {
172
+		if ( ! $this->_pagenow_map) {
173 173
 			$this->_pagenow_map = array(
174 174
 				'create_new' => 'post-new.php',
175 175
 				'edit' => 'post.php',
176 176
 				'trash' => 'post.php'
177 177
 				);
178 178
 		}
179
-		add_action( 'current_screen', array( $this, 'modify_pagenow') );
179
+		add_action('current_screen', array($this, 'modify_pagenow'));
180 180
 
181 181
 
182 182
 		//TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
183 183
 		//get current page from autosave
184
-		$current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
-		$this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page;
184
+		$current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
+		$this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page;
186 186
 
187 187
 
188 188
 		//autosave... make sure its only for the correct page
189
-		if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) {
189
+		if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
190 190
 			//setup autosave ajax hook
191 191
 			//add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
192 192
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return void
204 204
 	 */
205
-	public function modify_pagenow( $current_screen ) {
205
+	public function modify_pagenow($current_screen) {
206 206
 		global $pagenow;
207 207
 		//possibly reset pagenow.
208
-		if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) {
208
+		if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) {
209 209
 			$pagenow = $this->_pagenow_map[$this->_req_data['action']];
210 210
 		}
211 211
 	}
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically you would send along the id of a metabox container.
221 221
 	 * @return void
222 222
 	 */
223
-	protected function _register_autosave_containers( $ids ) {
224
-		$this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids );
223
+	protected function _register_autosave_containers($ids) {
224
+		$this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids);
225 225
 	}
226 226
 
227 227
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$containers = array();
238 238
 
239
-		if ( empty( $wp_meta_boxes ) )
239
+		if (empty($wp_meta_boxes))
240 240
 			return;
241 241
 
242
-		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
242
+		$current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
243 243
 
244
-		foreach ( $current_metaboxes as $box_context ) {
245
-			foreach ( $box_context as $box_details ) {
246
-				foreach ( $box_details as $box ) {
247
-					if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){
244
+		foreach ($current_metaboxes as $box_context) {
245
+			foreach ($box_context as $box_details) {
246
+				foreach ($box_details as $box) {
247
+					if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) {
248 248
 						$containers[] = $box['id'];
249 249
 					}
250 250
 				}
251 251
 			}
252 252
 		}
253 253
 
254
-		$this->_autosave_containers = array_merge( $this->_autosave_containers, $containers );
254
+		$this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
255 255
 
256 256
 		//add hidden inputs container
257 257
 		$this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2
269 269
 
270 270
 		//filter _autosave_containers
271
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this );
272
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this );
271
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this);
272
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this);
273 273
 
274
-		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
274
+		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
275 275
 
276 276
 		$unsaved_data_msg = array(
277
-			'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
277
+			'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
278 278
 			'inputChanged' => 0
279 279
 			);
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	public function load_page_dependencies() {
287 287
 		try {
288 288
 			$this->_load_page_dependencies();
289
-		} catch ( EE_Error $e ) {
289
+		} catch (EE_Error $e) {
290 290
 			$e->get_error();
291 291
 		}
292 292
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	protected function _load_page_dependencies() {
303 303
 
304 304
 		//we only add stuff if this is a cpt_route!
305
-		if ( !$this->_cpt_route ) {
305
+		if ( ! $this->_cpt_route) {
306 306
 			parent::_load_page_dependencies();
307 307
 			return;
308 308
 		}
@@ -312,72 +312,72 @@  discard block
 block discarded – undo
312 312
 
313 313
 		//the following filters are for setting all the redirects on DEFAULT WP custom post type actions
314 314
 		//let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects!  Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
315
-		add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') );
315
+		add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
316 316
 
317 317
 		//inject our Admin page nav tabs...
318 318
 		//let's make sure the nav tabs are set if they aren't already
319 319
 		//if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
320
-		add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) );
320
+		add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
321 321
 
322 322
 		//modify the post_updated messages array
323
-		add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 );
323
+		add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
324 324
 
325 325
 		//add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts!
326
-		add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 );
326
+		add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
327 327
 
328 328
 		//This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
329
-		if ( !empty($this->_labels['publishbox'] ) ) {
329
+		if ( ! empty($this->_labels['publishbox'])) {
330 330
 
331
-			$box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
331
+			$box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
332 332
 
333
-			remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
334
-			add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
333
+			remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
334
+			add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
335 335
 		}
336 336
 
337 337
 		//let's add page_templates metabox if this cpt added support for it.
338
-		if ( $this->_supports_page_templates($this->_cpt_object->name) ) {
339
-			add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' );
338
+		if ($this->_supports_page_templates($this->_cpt_object->name)) {
339
+			add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default');
340 340
 		}/**/
341 341
 
342 342
 
343 343
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
344
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
345
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
344
+		if (method_exists($this, 'extra_permalink_field_buttons'))
345
+			add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
346 346
 
347 347
 		//add preview button
348
-		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
348
+		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
349 349
 
350 350
 
351 351
 		//insert our own post_stati dropdown
352
-		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
352
+		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
353 353
 
354 354
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
355
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
356
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
355
+		if (method_exists($this, 'extra_misc_actions_publish_box'))
356
+			add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
357 357
 
358 358
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
359
-		if ( method_exists( $this, 'edit_form_after_title' ) )
360
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
359
+		if (method_exists($this, 'edit_form_after_title'))
360
+			add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
361 361
 
362 362
 
363 363
 		/**
364 364
 		 * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
365 365
 		 */
366
-		add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 );
366
+		add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
367 367
 
368 368
 
369 369
 		parent::_load_page_dependencies();
370 370
 
371 371
 		//notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes.
372 372
 		global $pagenow;
373
-		do_action( 'load-' . $pagenow );
373
+		do_action('load-'.$pagenow);
374 374
 
375 375
 		$this->modify_current_screen();
376
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 );
376
+		add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
377 377
 		//we route REALLY early.
378 378
 		try {
379 379
 			$this->_route_admin_request();
380
-		} catch ( EE_Error $e ) {
380
+		} catch (EE_Error $e) {
381 381
 			$e->get_error();
382 382
 		}
383 383
 	}
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @return string possibly a new url for our route.
398 398
 	 */
399
-	public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) {
399
+	public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) {
400 400
 		$routes_to_match = array(
401 401
 			0 => array(
402 402
 				'edit.php?post_type=espresso_attendees',
403 403
 				'admin.php?page=espresso_registrations&action=contact_list'
404 404
 				),
405 405
 			 1 => array(
406
-			 	'edit.php?post_type=' . $this->_cpt_object->name,
407
-			 	'admin.php?page=' . $this->_cpt_object->name
406
+			 	'edit.php?post_type='.$this->_cpt_object->name,
407
+			 	'admin.php?page='.$this->_cpt_object->name
408 408
 				)
409 409
 			);
410 410
 
411
-		foreach( $routes_to_match as $route_matches ) {
412
-			if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) {
413
-				return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url );
411
+		foreach ($routes_to_match as $route_matches) {
412
+			if (strpos($good_protocol_url, $route_matches[0]) !== false) {
413
+				return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
414 414
 
415 415
 			}
416 416
 		}
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	 * @param string $cpt_name The cpt slug we're checking on.
427 427
 	 * @return bool True supported, false not.
428 428
 	 */
429
-	private function _supports_page_templates( $cpt_name ) {
429
+	private function _supports_page_templates($cpt_name) {
430 430
 		$cpt_args = EE_Register_CPTs::get_CPTs();
431
-		$cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array();
432
-		return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE;
431
+		$cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
432
+		return ! empty($cpt_args['page_templates']) ? TRUE : FALSE;
433 433
 	}
434 434
 
435 435
 
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 	public function page_template_meta_box() {
445 445
 		global $post;
446 446
 		$template = '';
447
-		if ( count( get_page_templates( $post ) ) != 0 ) {
448
-			$page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE );
449
-			$template = !empty( $page_template ) ? $page_template : '';
447
+		if (count(get_page_templates($post)) != 0) {
448
+			$page_template = get_post_meta($post->ID, '_wp_page_template', TRUE);
449
+			$template = ! empty($page_template) ? $page_template : '';
450 450
 		}
451 451
 		?>
452 452
 		<p><strong><?php _e('Template') ?></strong></p>
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
 	 * @param  string $new_slug  what the slug is
471 471
 	 * @return string            The new html string for the permalink area
472 472
 	 */
473
-	public function preview_button_html( $return, $id, $new_title, $new_slug ) {
474
-		$post = get_post( $id );
475
-		if ( 'publish' != get_post_status( $post ) ) {
476
-			$return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n";
473
+	public function preview_button_html($return, $id, $new_title, $new_slug) {
474
+		$post = get_post($id);
475
+		if ('publish' != get_post_status($post)) {
476
+			$return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n";
477 477
 		}
478 478
 		return $return;
479 479
 	}
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 			'cur_status' =>  $this->_cpt_model_obj->status(),
494 494
 			'statuses' => $statuses,
495 495
 			'cur_status_label' => $cur_status_label,
496
-			'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label )
496
+			'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label)
497 497
 			);
498 498
 
499 499
 		//we'll add a trash post status (WP doesn't add one for some reason)
500
-		if ( $this->_cpt_model_obj->status() == 'trash' ) {
500
+		if ($this->_cpt_model_obj->status() == 'trash') {
501 501
 			$template_args['cur_status_label'] = __('Trashed', 'event_espresso');
502 502
 			$statuses['trash'] = __('Trashed', 'event_espresso');
503 503
 			$template_args['statuses'] = $statuses;
504 504
 		}
505 505
 
506
-		$template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
507
-		EEH_Template::display_template( $template, $template_args );
506
+		$template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php';
507
+		EEH_Template::display_template($template, $template_args);
508 508
 	}
509 509
 
510 510
 
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	public function do_extra_autosave_stuff() {
544 544
 
545 545
 		//next let's check for the autosave nonce (we'll use _verify_nonce )
546
-		$nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL;
547
-		$this->_verify_nonce( $nonce, 'autosave' );
546
+		$nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL;
547
+		$this->_verify_nonce($nonce, 'autosave');
548 548
 
549 549
 
550 550
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
551
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
551
+		if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true);
552 552
 
553 553
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554
-		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
555
-			call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) );
554
+		if (method_exists($this, '_ee_autosave_'.$this->_current_view)) {
555
+			call_user_func(array($this, '_ee_autosave_'.$this->_current_view));
556 556
 		} else {
557 557
 			$this->_template_args['success'] = TRUE;
558 558
 		}
559 559
 
560
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this );
561
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this );
560
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
561
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this);
562 562
 
563 563
 		//now let's return json
564 564
 		$this->_return_json();
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	protected function _extend_page_config_for_cpt() {
579 579
 
580 580
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
581
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
581
+		if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug))
582 582
 			return;
583 583
 
584 584
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585
-		if ( !empty( $this->_cpt_object ) ) {
586
-			$this->_page_routes = array_merge( array(
585
+		if ( ! empty($this->_cpt_object)) {
586
+			$this->_page_routes = array_merge(array(
587 587
 				'create_new' => '_create_new_cpt_item',
588 588
 				'edit' => '_edit_cpt_item'
589
-				), $this->_page_routes );
589
+				), $this->_page_routes);
590 590
 
591 591
 
592
-			$this->_page_config = array_merge( array(
592
+			$this->_page_config = array_merge(array(
593 593
 				'create_new' => array(
594 594
 					'nav' => array(
595 595
 						'label' => $this->_cpt_object->labels->add_new_item,
@@ -611,23 +611,23 @@  discard block
 block discarded – undo
611 611
 		}
612 612
 
613 613
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
614
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
614
+		if ( ! isset($this->_cpt_routes[$this->_req_action]))
615 615
 			return;
616 616
 
617 617
 
618
-		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
618
+		$this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE;
619 619
 		//add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
620 620
 
621 621
 
622
-		if ( empty( $this->_cpt_object ) ) {
623
-			$msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) );
624
-			throw new EE_Error( $msg );
622
+		if (empty($this->_cpt_object)) {
623
+			$msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this));
624
+			throw new EE_Error($msg);
625 625
 		}
626 626
 
627 627
 
628
-		if ( $this->_cpt_route ) {
629
-			$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
630
-			$this->_set_model_object( $id );
628
+		if ($this->_cpt_route) {
629
+			$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
630
+			$this->_set_model_object($id);
631 631
 		}
632 632
 
633 633
 	}
@@ -641,14 +641,14 @@  discard block
 block discarded – undo
641 641
 	 * @param int  $id The id to retrieve the model object for. If empty we set a default object.
642 642
 	 * @param bool $ignore_route_check
643 643
 	 */
644
-	protected function _set_model_object( $id = NULL, $ignore_route_check = false ) {
644
+	protected function _set_model_object($id = NULL, $ignore_route_check = false) {
645 645
 		EE_Admin::debug_log(
646 646
 			__METHOD__,
647 647
 			array(
648 648
 				'id'                                              => $id,
649 649
 				'ignore_route_check'                              => $ignore_route_check,
650
-				'empty( this->_cpt_model_names )'                 => empty( $this->_cpt_model_names ),
651
-				'isset( this->_cpt_routes[ this->_req_action ] )' => isset( $this->_cpt_routes[ $this->_req_action ] ),
650
+				'empty( this->_cpt_model_names )'                 => empty($this->_cpt_model_names),
651
+				'isset( this->_cpt_routes[ this->_req_action ] )' => isset($this->_cpt_routes[$this->_req_action]),
652 652
 				'this->_cpt_model_obj instanceof EE_CPT_Base'     => $this->_cpt_model_obj instanceof EE_CPT_Base,
653 653
 				'this->_cpt_model_obj->ID()'                      => $this->_cpt_model_obj instanceof EE_CPT_Base
654 654
 				? $this->_cpt_model_obj->ID()
@@ -658,36 +658,36 @@  discard block
 block discarded – undo
658 658
 		);
659 659
 		$model = null;
660 660
 		if (
661
-			empty( $this->_cpt_model_names )
661
+			empty($this->_cpt_model_names)
662 662
 		    || (
663 663
 			     ! $ignore_route_check
664
-			     && ! isset( $this->_cpt_routes[ $this->_req_action ] )
664
+			     && ! isset($this->_cpt_routes[$this->_req_action])
665 665
 		    ) || (
666 666
 			     $this->_cpt_model_obj instanceof EE_CPT_Base
667 667
 			     && $this->_cpt_model_obj->ID() === $id
668 668
 			)
669 669
 		) {
670
-			EE_Admin::debug_log( __METHOD__, array( '**RETURN**' => true ) );
670
+			EE_Admin::debug_log(__METHOD__, array('**RETURN**' => true));
671 671
 			//get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
672 672
 			return;
673 673
 		}
674
-		EE_Admin::debug_log( __METHOD__, array( '**RETURN**' => false ) );
674
+		EE_Admin::debug_log(__METHOD__, array('**RETURN**' => false));
675 675
 		//if ignore_route_check is true, then get the model name via EE_Register_CPTs
676
-		if ( $ignore_route_check ) {
676
+		if ($ignore_route_check) {
677 677
 			$model_names = EE_Register_CPTs::get_cpt_model_names();
678
-			$post_type = get_post_type( $id );
679
-			if ( isset( $model_names[ $post_type ] ) ) {
680
-				$model = EE_Registry::instance()->load_model( $model_names[ $post_type ] );
678
+			$post_type = get_post_type($id);
679
+			if (isset($model_names[$post_type])) {
680
+				$model = EE_Registry::instance()->load_model($model_names[$post_type]);
681 681
 			}
682 682
 		} else {
683
-			$model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] );
683
+			$model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
684 684
 		}
685 685
 
686
-		if ( $model instanceof EEM_Base ) {
687
-			$this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object();
686
+		if ($model instanceof EEM_Base) {
687
+			$this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
688 688
 		}
689 689
 
690
-		do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' );
690
+		do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object');
691 691
 	}
692 692
 
693 693
 
@@ -701,47 +701,47 @@  discard block
 block discarded – undo
701 701
 	 */
702 702
 	public function admin_init_global() {
703 703
 
704
-		$post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL;
704
+		$post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL;
705 705
 
706 706
 		//its possible this is a new save so let's catch that instead
707
-		$post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post;
707
+		$post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
708 708
 		$post_type = $post ? $post->post_type : false;
709 709
 
710 710
 		$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
711 711
 
712
-		$route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
712
+		$route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
713 713
 
714
-		add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 );
715
-		add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 );
714
+		add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
715
+		add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
716 716
 
717 717
 
718
-		if ( $post_type === $route_to_check ) {
719
-			add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 );
718
+		if ($post_type === $route_to_check) {
719
+			add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
720 720
 			//catch trashed wp redirect
721
-			add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 );
721
+			add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2);
722 722
 		}
723 723
 
724 724
 		//now let's filter redirect if we're on a revision page and the revision is for an event CPT.
725
-		$revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL;
725
+		$revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
726 726
 
727 727
 		/**var_dump($this->_req_data);
728 728
 		exit();/**/
729 729
 
730
-		if ( !empty( $revision ) ) {
731
-			$action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL;
730
+		if ( ! empty($revision)) {
731
+			$action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL;
732 732
 
733 733
 			//doing a restore?
734
-			if ( !empty( $action ) && $action == 'restore' ) {
734
+			if ( ! empty($action) && $action == 'restore') {
735 735
 
736 736
 				//get post for revision
737
-				$rev_post = get_post( $revision );
738
-				$rev_parent = get_post( $rev_post->post_parent );
737
+				$rev_post = get_post($revision);
738
+				$rev_parent = get_post($rev_post->post_parent);
739 739
 
740 740
 				//only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
741
-				if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) {
742
-					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 );
741
+				if ($rev_parent && $rev_parent->post_type == $this->page_slug) {
742
+					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
743 743
 					//restores of revisions
744
-					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 );
744
+					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
745 745
 				}
746 746
 			}
747 747
 
@@ -750,15 +750,15 @@  discard block
 block discarded – undo
750 750
 		//NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
751 751
 
752 752
 
753
-		if ( $post_type && $post_type === $route_to_check ) {
753
+		if ($post_type && $post_type === $route_to_check) {
754 754
 			//$post_id, $post
755
-			add_action('save_post', array( $this, 'insert_update'), 10, 3 );
755
+			add_action('save_post', array($this, 'insert_update'), 10, 3);
756 756
 
757 757
 			//$post_id
758
-			add_action('trashed_post', array( $this, 'before_trash_cpt_item' ), 10 );
759
-			add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 );
760
-			add_action('untrashed_post', array( $this, 'before_restore_cpt_item'), 10 );
761
-			add_action('after_delete_post', array( $this, 'before_delete_cpt_item'), 10 );
758
+			add_action('trashed_post', array($this, 'before_trash_cpt_item'), 10);
759
+			add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
760
+			add_action('untrashed_post', array($this, 'before_restore_cpt_item'), 10);
761
+			add_action('after_delete_post', array($this, 'before_delete_cpt_item'), 10);
762 762
 		}
763 763
 
764 764
 	}
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
 	 *
773 773
 	 * @param int $post_id
774 774
 	 */
775
-	public function before_trash_cpt_item( $post_id ) {
776
-		$this->_set_model_object( $post_id, true );
775
+	public function before_trash_cpt_item($post_id) {
776
+		$this->_set_model_object($post_id, true);
777 777
 		//if our cpt object isn't existent then get out immediately.
778
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
778
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
779 779
 			return;
780 780
 		}
781
-		$this->trash_cpt_item( $post_id );
781
+		$this->trash_cpt_item($post_id);
782 782
 	}
783 783
 
784 784
 
@@ -788,13 +788,13 @@  discard block
 block discarded – undo
788 788
 	 *
789 789
 	 * @param $post_id
790 790
 	 */
791
-	public function before_restore_cpt_item( $post_id ) {
792
-		$this->_set_model_object( $post_id, true );
791
+	public function before_restore_cpt_item($post_id) {
792
+		$this->_set_model_object($post_id, true);
793 793
 		//if our cpt object isn't existent then get out immediately.
794
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
794
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
795 795
 			return;
796 796
 		}
797
-		$this->restore_cpt_item( $post_id );
797
+		$this->restore_cpt_item($post_id);
798 798
 	}
799 799
 
800 800
 
@@ -803,13 +803,13 @@  discard block
 block discarded – undo
803 803
 	 * Execute some basic checks before calling the delete_cpt_item method in the child class.
804 804
 	 * @param $post_id
805 805
 	 */
806
-	public function before_delete_cpt_item( $post_id ) {
807
-		$this->_set_model_object( $post_id, true );
806
+	public function before_delete_cpt_item($post_id) {
807
+		$this->_set_model_object($post_id, true);
808 808
 		//if our cpt object isn't existent then get out immediately.
809
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
809
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
810 810
 			return;
811 811
 		}
812
-		$this->delete_cpt_item( $post_id );
812
+		$this->delete_cpt_item($post_id);
813 813
 	}
814 814
 
815 815
 
@@ -821,15 +821,15 @@  discard block
 block discarded – undo
821 821
 	 * @return void
822 822
 	 */
823 823
 	public function verify_cpt_object() {
824
-		$label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label;
824
+		$label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
825 825
 		// verify event object
826
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
827
-			throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) );
826
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
827
+			throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label));
828 828
 		}
829 829
 		//if auto-draft then throw an error
830
-		if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) {
830
+		if ($this->_cpt_model_obj->get('status') == 'auto-draft') {
831 831
 			EE_Error::overwrite_errors();
832
-			EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ );
832
+			EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__);
833 833
 		}
834 834
 	}
835 835
 
@@ -858,22 +858,22 @@  discard block
 block discarded – undo
858 858
 	public function load_global_scripts_styles() {
859 859
 		parent::load_global_scripts_styles();
860 860
 
861
-		if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) {
861
+		if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
862 862
 			//setup custom post status object for localize script but only if we've got a cpt object
863 863
 			$statuses = $this->_cpt_model_obj->get_custom_post_statuses();
864 864
 
865
-			if ( !empty($statuses) ) {
865
+			if ( ! empty($statuses)) {
866 866
 				//get ALL statuses!
867 867
 				$statuses = $this->_cpt_model_obj->get_all_post_statuses();
868 868
 				//setup object
869 869
 				$ee_cpt_statuses = array();
870
-				foreach ( $statuses as $status => $label ) {
870
+				foreach ($statuses as $status => $label) {
871 871
 					$ee_cpt_statuses[$status] = array(
872 872
 						'label' => $label,
873
-						'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label )
873
+						'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label)
874 874
 						);
875 875
 				}
876
-				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses );
876
+				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
877 877
 			}
878 878
 		}
879 879
 	}
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
 	 * @param  bool   $update  Whether this is an update or a new save.
889 889
 	 * @return void
890 890
 	 */
891
-	public function insert_update( $post_id, $post, $update ) {
891
+	public function insert_update($post_id, $post, $update) {
892 892
 
893 893
 		//make sure that if this is a revision OR trash action that we don't do any updates!
894 894
 		if (
895
-			isset( $this->_req_data['action'] )
895
+			isset($this->_req_data['action'])
896 896
 			&& (
897 897
 				$this->_req_data['action'] == 'restore'
898 898
 				|| $this->_req_data['action'] == 'trash'
@@ -901,10 +901,10 @@  discard block
 block discarded – undo
901 901
 			return;
902 902
 		}
903 903
 
904
-		$this->_set_model_object( $post_id, true );
904
+		$this->_set_model_object($post_id, true);
905 905
 
906 906
 		//if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
907
-		if ( $update
907
+		if ($update
908 908
 			&& (
909 909
 			     ! $this->_cpt_model_obj instanceof EE_CPT_Base
910 910
 			     || $this->_cpt_model_obj->ID() !== $post_id
@@ -925,19 +925,19 @@  discard block
 block discarded – undo
925 925
 		}/**/ //TODO reactivate after autosave is implemented in 4.2
926 926
 
927 927
 		//take care of updating any selected page_template IF this cpt supports it.
928
-		if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) {
928
+		if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
929 929
 			$post->page_template = $this->_req_data['page_template'];
930
-			$page_templates = wp_get_theme()->get_page_templates( $post );
931
-			if ( 'default' != $this->_req_data['page_template']  && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) {
932
-				EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
930
+			$page_templates = wp_get_theme()->get_page_templates($post);
931
+			if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
932
+				EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
933 933
 			} else {
934
-				update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] );
934
+				update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
935 935
 			}
936 936
 		}
937 937
 
938
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
938
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
939 939
 			return; //TODO we'll remove this after reimplementing autosave in 4.2
940
-		$this->_insert_update_cpt_item( $post_id, $post );
940
+		$this->_insert_update_cpt_item($post_id, $post);
941 941
 	}
942 942
 
943 943
 
@@ -950,15 +950,15 @@  discard block
 block discarded – undo
950 950
 	 * @param  int    $post_id ID of the post
951 951
 	 * @return void
952 952
 	 */
953
-	public function dont_permanently_delete_ee_cpts( $post_id ) {
953
+	public function dont_permanently_delete_ee_cpts($post_id) {
954 954
 		//only do this if we're actually processing one of our CPTs
955 955
 		//if our cpt object isn't existent then get out immediately.
956
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
956
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
957 957
 			return;
958 958
 		}
959 959
 
960
-		delete_post_meta( $post_id, '_wp_trash_meta_status' );
961
-		delete_post_meta( $post_id, '_wp_trash_meta_time');
960
+		delete_post_meta($post_id, '_wp_trash_meta_status');
961
+		delete_post_meta($post_id, '_wp_trash_meta_time');
962 962
 
963 963
 		//our cpts may have comments so let's take care of that too
964 964
 		delete_post_meta($post_id, '_wp_trash_meta_comments_status');
@@ -976,14 +976,14 @@  discard block
 block discarded – undo
976 976
 	 * @param  int    $revision_id ID of revision being restored
977 977
 	 * @return void
978 978
 	 */
979
-	public function restore_revision( $post_id, $revision_id ) {
980
-		$this->_restore_cpt_item( $post_id, $revision_id );
979
+	public function restore_revision($post_id, $revision_id) {
980
+		$this->_restore_cpt_item($post_id, $revision_id);
981 981
 
982 982
 		//global action
983
-		do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
983
+		do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
984 984
 
985 985
 		//class specific action so you can limit hooking into a specific page.
986
-		do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id );
986
+		do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id);
987 987
 	}
988 988
 
989 989
 
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 	 * @param  int $revision_id ID of revision for item
995 995
 	 * @return void
996 996
 	 */
997
-	abstract protected function _restore_cpt_item( $post_id, $revision_id );
997
+	abstract protected function _restore_cpt_item($post_id, $revision_id);
998 998
 
999 999
 
1000 1000
 
@@ -1013,9 +1013,9 @@  discard block
 block discarded – undo
1013 1013
 	 */
1014 1014
 	public function modify_current_screen() {
1015 1015
 		//ONLY do this if the current page_route IS a cpt route
1016
-		if ( !$this->_cpt_route ) return;
1016
+		if ( ! $this->_cpt_route) return;
1017 1017
 		//routing things REALLY early b/c this is a cpt admin page
1018
-		set_current_screen( $this->_cpt_routes[$this->_req_action]);
1018
+		set_current_screen($this->_cpt_routes[$this->_req_action]);
1019 1019
 		$this->_current_screen = get_current_screen();
1020 1020
 		$this->_current_screen->base = 'event-espresso';
1021 1021
 		$this->_add_help_tabs(); //we make sure we add any help tabs back in!
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
 	 * @param string $title The new title (or existing if there is no editor_title defined)
1037 1037
 	 * @return string
1038 1038
 	 */
1039
-	public function add_custom_editor_default_title( $title ) {
1040
-		return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
1039
+	public function add_custom_editor_default_title($title) {
1040
+		return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
1041 1041
 	}
1042 1042
 
1043 1043
 
@@ -1050,11 +1050,11 @@  discard block
 block discarded – undo
1050 1050
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
1051 1051
 	 * @return string
1052 1052
 	 */
1053
-	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
1054
-		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
1055
-			$post = get_post( $id );
1056
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
1057
-			$shortlink = home_url('?p=' . $post->ID);
1053
+	public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) {
1054
+		if ( ! empty($id) && '' != get_option('permalink_structure')) {
1055
+			$post = get_post($id);
1056
+			if (isset($post->post_type) && $this->page_slug == $post->post_type)
1057
+			$shortlink = home_url('?p='.$post->ID);
1058 1058
 		}
1059 1059
 		return $shortlink;
1060 1060
 	}
@@ -1067,10 +1067,10 @@  discard block
 block discarded – undo
1067 1067
 	 * @return void
1068 1068
 	 */
1069 1069
 	public function route_admin_request() {
1070
-		if ( $this->_cpt_route ) return;
1070
+		if ($this->_cpt_route) return;
1071 1071
 		try {
1072 1072
 			$this->_route_admin_request();
1073
-		} catch ( EE_Error $e ) {
1073
+		} catch (EE_Error $e) {
1074 1074
 			$e->get_error();
1075 1075
 		}
1076 1076
 	}
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 	 * @return string html
1084 1084
 	 */
1085 1085
 	public function cpt_post_form_hidden_input() {
1086
-		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
1086
+		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />';
1087 1087
 
1088 1088
 		//we're also going to add the route value and the current page so we can direct autosave parsing correctly
1089 1089
 		echo '<div id="ee-cpt-hidden-inputs">';
1090
-		echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
1091
-		echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
1090
+		echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />';
1091
+		echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />';
1092 1092
 		echo '</div>';
1093 1093
 	}
1094 1094
 
@@ -1101,12 +1101,12 @@  discard block
 block discarded – undo
1101 1101
 	 * @param  int    $status   Status for http header
1102 1102
 	 * @return string           new (or original) url to redirect to.
1103 1103
 	 */
1104
-	public function revision_redirect( $location, $status ) {
1104
+	public function revision_redirect($location, $status) {
1105 1105
 		//get revision
1106 1106
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
1107 1107
 
1108 1108
 		//can't do anything without revision so let's get out if not present
1109
-		if ( empty( $rev_id ) )
1109
+		if (empty($rev_id))
1110 1110
 			return $location;
1111 1111
 
1112 1112
 		//get rev_post_data
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
 				'message' => 5
1121 1121
 			);
1122 1122
 
1123
-		$this->_process_notices( $query_args, TRUE );
1124
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1123
+		$this->_process_notices($query_args, TRUE);
1124
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1125 1125
 	}
1126 1126
 
1127 1127
 
@@ -1134,16 +1134,16 @@  discard block
 block discarded – undo
1134 1134
 	 * @param  string $context optional, defaults to display.  How to write the '&'
1135 1135
 	 * @return string          the link
1136 1136
 	 */
1137
-	public function modify_edit_post_link( $link, $id, $context ) {
1138
-		$post = get_post( $id );
1139
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1137
+	public function modify_edit_post_link($link, $id, $context) {
1138
+		$post = get_post($id);
1139
+		if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1140 1140
 			return $link;
1141 1141
 		$query_args = array(
1142 1142
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1143 1143
 			'post' => $id
1144 1144
 			);
1145 1145
 
1146
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1146
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1147 1147
 	}
1148 1148
 
1149 1149
 
@@ -1155,12 +1155,12 @@  discard block
 block discarded – undo
1155 1155
 	 * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1156 1156
 	 * @return string               new delete link
1157 1157
 	 */
1158
-	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1158
+	public function modify_delete_post_link($delete_link, $post_id, $force_delete) {
1159 1159
 		$post = get_post($post_id);
1160
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1160
+		if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]))
1161 1161
 			return $delete_link;
1162 1162
 
1163
-		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1163
+		return add_query_arg(array('current_route' => 'trash'), $delete_link);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1171,16 +1171,16 @@  discard block
 block discarded – undo
1171 1171
 	 * @param  string $status   status
1172 1172
 	 * @return string           url to redirect to
1173 1173
 	 */
1174
-	public function cpt_trash_post_location_redirect( $location, $status ) {
1175
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1174
+	public function cpt_trash_post_location_redirect($location, $status) {
1175
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post']))
1176 1176
 			return $location;
1177 1177
 
1178
-		$post = get_post( $this->_req_data['post'] );
1179
-		$query_args = array( 'action' => 'default' );
1178
+		$post = get_post($this->_req_data['post']);
1179
+		$query_args = array('action' => 'default');
1180 1180
 		$this->_cpt_object = get_post_type_object($post->post_type);
1181
-		EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) );
1182
-		$this->_process_notices( $query_args, TRUE );
1183
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1181
+		EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name));
1182
+		$this->_process_notices($query_args, TRUE);
1183
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1184 1184
 	}
1185 1185
 
1186 1186
 
@@ -1195,21 +1195,21 @@  discard block
 block discarded – undo
1195 1195
 	 * @param  string $post_id  This is the 'ID' value of the wp_posts table
1196 1196
 	 * @return string           the new location to redirect to
1197 1197
 	 */
1198
-	public function cpt_post_location_redirect( $location, $post_id ) {
1198
+	public function cpt_post_location_redirect($location, $post_id) {
1199 1199
 		//we DO have a match so let's setup the url
1200 1200
 		//we have to get the post to determine our route
1201 1201
 		$post = get_post($post_id);
1202 1202
 		$edit_route = $this->_cpt_edit_routes[$post->post_type];
1203 1203
 
1204 1204
 		//shared query_args
1205
-		$query_args = array( 'action' => $edit_route, 'post' => $post_id );
1205
+		$query_args = array('action' => $edit_route, 'post' => $post_id);
1206 1206
 		$admin_url = $this->_admin_base_url;
1207 1207
 //		$append = '';
1208 1208
 
1209
-		if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) {
1210
-			$status = get_post_status( $post_id );
1211
-			if ( isset( $this->_req_data['publish'] ) ) {
1212
-				switch ( $status ) {
1209
+		if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1210
+			$status = get_post_status($post_id);
1211
+			if (isset($this->_req_data['publish'])) {
1212
+				switch ($status) {
1213 1213
 					case 'pending':
1214 1214
 						$message = 8;
1215 1215
 						break;
@@ -1222,13 +1222,13 @@  discard block
 block discarded – undo
1222 1222
 			} else {
1223 1223
 					$message = 'draft' == $status ? 10 : 1;
1224 1224
 			}
1225
-		} else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) {
1225
+		} else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1226 1226
 			$message = 2;
1227 1227
 //			$append = '#postcustom';
1228
-		} else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) {
1228
+		} else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1229 1229
 			$message = 3;
1230 1230
 //			$append = '#postcustom';
1231
-		} elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) {
1231
+		} elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') {
1232 1232
 			$message = 7;
1233 1233
 		} else {
1234 1234
 			$message = 4;
@@ -1236,11 +1236,11 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 		//change the message if the post type is not viewable on the frontend
1238 1238
 		$this->_cpt_object = get_post_type_object($post->post_type);
1239
-		$message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message;
1239
+		$message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1240 1240
 
1241
-		$query_args = array_merge( array( 'message' => $message ), $query_args );
1242
-		$this->_process_notices( $query_args, TRUE );
1243
-		$redirect_url = self::add_query_args_and_nonce( $query_args, $admin_url );
1241
+		$query_args = array_merge(array('message' => $message), $query_args);
1242
+		$this->_process_notices($query_args, TRUE);
1243
+		$redirect_url = self::add_query_args_and_nonce($query_args, $admin_url);
1244 1244
 		EE_Admin::debug_log(
1245 1245
 			__METHOD__,
1246 1246
 			array(
@@ -1280,10 +1280,10 @@  discard block
 block discarded – undo
1280 1280
 	 * @param  array $messages the original messages array
1281 1281
 	 * @return array           the new messages array
1282 1282
 	 */
1283
-	public function post_update_messages( $messages ) {
1283
+	public function post_update_messages($messages) {
1284 1284
 		global $post;
1285
-		$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1286
-		$id = empty( $id ) && is_object( $post ) ? $post->ID : NULL;
1285
+		$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1286
+		$id = empty($id) && is_object($post) ? $post->ID : NULL;
1287 1287
 
1288 1288
 //		$post_type = $post ? $post->post_type : false;
1289 1289
 
@@ -1296,9 +1296,9 @@  discard block
 block discarded – undo
1296 1296
 			0 => '', //Unused. Messages start at index 1.
1297 1297
 
1298 1298
 			1 => sprintf(
1299
-				__( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1299
+				__('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1300 1300
 				$this->_cpt_object->labels->singular_name,
1301
-				'<a href="' . esc_url( get_permalink( $id )) . '">',
1301
+				'<a href="'.esc_url(get_permalink($id)).'">',
1302 1302
 				'</a>'
1303 1303
 			),
1304 1304
 
@@ -1306,38 +1306,38 @@  discard block
 block discarded – undo
1306 1306
 
1307 1307
 			3 => __('Custom field deleted.'),
1308 1308
 
1309
-			4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1309
+			4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1310 1310
 
1311
-			5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE,
1311
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE,
1312 1312
 
1313 1313
 			6 => sprintf(
1314
-					__( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1314
+					__('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1315 1315
 					$this->_cpt_object->labels->singular_name,
1316
-					'<a href="' . esc_url( get_permalink( $id )) . '">',
1316
+					'<a href="'.esc_url(get_permalink($id)).'">',
1317 1317
 					'</a>'
1318 1318
 				),
1319 1319
 
1320
-			7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1320
+			7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1321 1321
 
1322 1322
 			8 => sprintf(
1323 1323
 				__('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1324 1324
 				$this->_cpt_object->labels->singular_name,
1325
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">',
1325
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">',
1326 1326
 				'</a>'
1327 1327
 			),
1328 1328
 
1329 1329
 			9 => sprintf(
1330
-				__( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1330
+				__('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1331 1331
 				$this->_cpt_object->labels->singular_name,
1332
-				'<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>',
1333
-				'<a target="_blank" href="' . esc_url( get_permalink( $id )),
1332
+				'<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>',
1333
+				'<a target="_blank" href="'.esc_url(get_permalink($id)),
1334 1334
 				'</a>'
1335 1335
 			),
1336 1336
 
1337 1337
 			10 => sprintf(
1338 1338
 				__('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1339 1339
 				$this->_cpt_object->labels->singular_name,
1340
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) ,
1340
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1341 1341
 				'</a>'
1342 1342
 			)
1343 1343
 		);
@@ -1364,24 +1364,24 @@  discard block
 block discarded – undo
1364 1364
 		$post_type_object = $this->_cpt_object;
1365 1365
 		$title = $post_type_object->labels->add_new_item;
1366 1366
 		$editing = TRUE;
1367
-		wp_enqueue_script( 'autosave' );
1368
-		$post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE );
1367
+		wp_enqueue_script('autosave');
1368
+		$post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE);
1369 1369
 		$post_ID = $post->ID;
1370 1370
 		$is_IE = $is_IE;
1371 1371
 
1372
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1372
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1373 1373
 
1374 1374
 		//modify the default editor title field with default title.
1375
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1375
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1376 1376
 
1377
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1377
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1378 1378
 	}
1379 1379
 
1380 1380
 
1381 1381
 
1382 1382
 
1383 1383
 	public function add_new_admin_page_global() {
1384
-		$admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php';
1384
+		$admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1385 1385
 		?>
1386 1386
 		<script type="text/javascript">
1387 1387
 			adminpage = '<?php echo $admin_page; ?>';
@@ -1403,8 +1403,8 @@  discard block
 block discarded – undo
1403 1403
 	 */
1404 1404
 	protected function _edit_cpt_item() {
1405 1405
 		global $post, $title, $is_IE, $post_type, $post_type_object;
1406
-		$post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1407
-		$post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL;
1406
+		$post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1407
+		$post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL;
1408 1408
 		EE_Admin::debug_log(
1409 1409
 			__METHOD__,
1410 1410
 			array(
@@ -1415,14 +1415,14 @@  discard block
 block discarded – undo
1415 1415
 			false // don't update yet
1416 1416
 		);
1417 1417
 
1418
-		if ( empty ( $post ) ) {
1419
-			wp_die( __('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?') );
1418
+		if (empty ($post)) {
1419
+			wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1420 1420
 		}
1421 1421
 
1422
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
1423
-			wp_set_post_lock( $post_id );
1422
+		if ( ! empty($_GET['get-post-lock'])) {
1423
+			wp_set_post_lock($post_id);
1424 1424
 			EE_Admin::update_debug_log();
1425
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
1425
+			wp_redirect(get_edit_post_link($post_id, 'url'));
1426 1426
 			exit();
1427 1427
 		}
1428 1428
 
@@ -1432,34 +1432,34 @@  discard block
 block discarded – undo
1432 1432
 		$post_type = $this->_cpt_routes[$this->_req_action];
1433 1433
 		$post_type_object = $this->_cpt_object;
1434 1434
 
1435
-		if ( ! wp_check_post_lock( $post->ID ) ) {
1436
-			$active_post_lock = wp_set_post_lock( $post->ID );
1435
+		if ( ! wp_check_post_lock($post->ID)) {
1436
+			$active_post_lock = wp_set_post_lock($post->ID);
1437 1437
 			//wp_enqueue_script('autosave');
1438 1438
 		}
1439 1439
 
1440 1440
 		$title = $this->_cpt_object->labels->edit_item;
1441 1441
 
1442
-		add_action('admin_footer', '_admin_notice_post_locked' );
1442
+		add_action('admin_footer', '_admin_notice_post_locked');
1443 1443
 
1444
-		if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) {
1445
-			$create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this );
1444
+		if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) {
1445
+			$create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this);
1446 1446
 
1447
-			$post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' );
1447
+			$post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php');
1448 1448
 		}
1449 1449
 
1450
-		if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) {
1450
+		if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1451 1451
 			wp_enqueue_script('admin-comments');
1452 1452
 			enqueue_comment_hotkeys_js();
1453 1453
 		}
1454 1454
 
1455
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1455
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1456 1456
 
1457 1457
 		//modify the default editor title field with default title.
1458
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1458
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1459 1459
 
1460 1460
 		EE_Admin::update_debug_log();
1461 1461
 
1462
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1462
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1463 1463
 
1464 1464
 	}
1465 1465
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Loader.core.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @return \EE_Admin_Page_Loader
111 111
 	 */
112 112
 	public function __construct() {
113
-		EE_Admin::debug_log( __METHOD__ );
113
+		EE_Admin::debug_log(__METHOD__);
114 114
 		//load menu_map classes
115 115
 		EE_Registry::instance()->load_file(EE_ADMIN, 'EE_Admin_Page_Menu_Map', 'core');
116 116
 		//define the default "groups" for the admin_pages
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 		//let's do a scan and see what installed pages we have
121 121
 		$this->_get_installed_pages();
122 122
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
123
-		add_action('admin_menu', array( $this, 'set_menus' ));
124
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
123
+		add_action('admin_menu', array($this, 'set_menus'));
124
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
125 125
 	}
126 126
 
127 127
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @return void
135 135
 	 */
136 136
 	private function _define_caffeinated_constants() {
137
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
138
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
140
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
143
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
137
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
138
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
140
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
143
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
144 144
 		}
145 145
 	}
146 146
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
 		//set array of EE_Admin_Page_Menu_Group objects
161 161
 		$groups = array(
162
-			'main' => new EE_Admin_Page_Menu_Group( array(
162
+			'main' => new EE_Admin_Page_Menu_Group(array(
163 163
 				'menu_label' => __('Main', 'event_espresso'),
164 164
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
165 165
 				'menu_slug' => 'main',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				'menu_order' => 0,
168 168
 				'parent_slug' => 'espresso_events',
169 169
 				)),
170
-			'management' => new EE_Admin_Page_Menu_Group( array(
170
+			'management' => new EE_Admin_Page_Menu_Group(array(
171 171
 				'menu_label' => __('Management', 'event_espresso'),
172 172
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
173 173
 				'menu_slug' => 'management',
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 				'menu_order' => 10,
176 176
 				'parent_slug' => 'espresso_events'
177 177
 				)),
178
-			'settings' => new EE_Admin_Page_Menu_Group( array(
178
+			'settings' => new EE_Admin_Page_Menu_Group(array(
179 179
 				'menu_label' => __('Settings', 'event_espresso'),
180 180
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
181 181
 				'menu_slug' => 'settings',
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 				'menu_order' => 30,
184 184
 				'parent_slug' => 'espresso_events'
185 185
 				)),
186
-			'templates' => new EE_Admin_Page_Menu_Group( array(
186
+			'templates' => new EE_Admin_Page_Menu_Group(array(
187 187
 				'menu_label' => __('Templates', 'event_espresso'),
188 188
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
189 189
 				'menu_slug' => 'templates',
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				'menu_order' => 40,
192 192
 				'parent_slug' => 'espresso_events'
193 193
 				)),
194
-			'extras' => new EE_Admin_Page_Menu_Group( array(
194
+			'extras' => new EE_Admin_Page_Menu_Group(array(
195 195
 				'menu_label' => __('Extras', 'event_espresso'),
196 196
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
197 197
 				'menu_slug' => 'extras',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 				'parent_slug' => 'espresso_events',
201 201
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
202 202
 				)),
203
-			'tools' => new EE_Admin_Page_Menu_Group( array(
203
+			'tools' => new EE_Admin_Page_Menu_Group(array(
204 204
 				'menu_label' => __("Tools", "event_espresso"),
205 205
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
206 206
 				'menu_slug' => 'tools',
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				'menu_order' => 60,
209 209
 				'parent_slug' => 'espresso_events'
210 210
 				)),
211
-			'addons' => new EE_Admin_Page_Menu_Group( array(
211
+			'addons' => new EE_Admin_Page_Menu_Group(array(
212 212
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
213 213
 				'menu_label' => __('Add-ons', 'event_espresso'),
214 214
 				'menu_slug' => 'addons',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 				))
219 219
 			);
220 220
 
221
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
221
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
222 222
 	}
223 223
 
224 224
 
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 	private function _rearrange_menu_groups() {
237 237
 		$groups = array();
238 238
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
239
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
240
-		foreach ( $this->_admin_menu_groups as $group ) {
241
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
242
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
239
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
240
+		foreach ($this->_admin_menu_groups as $group) {
241
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
242
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
243 243
 			$groups[$group->menu_slug] = $group;
244 244
 		}
245 245
 		return $groups;
@@ -257,48 +257,48 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	private function _get_installed_pages() {
259 259
 		$installed_refs = array();
260
-		$exclude = array( 'assets', 'templates' );
260
+		$exclude = array('assets', 'templates');
261 261
 		// grab everything in the  admin core directory
262
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
263
-		if ( $admin_screens ) {
264
-			foreach( $admin_screens as $admin_screen ) {
262
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
263
+		if ($admin_screens) {
264
+			foreach ($admin_screens as $admin_screen) {
265 265
 				// files and anything in the exclude array need not apply
266
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
266
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
267 267
 					// these folders represent the different EE admin pages
268
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
268
+					$installed_refs[basename($admin_screen)] = $admin_screen;
269 269
 				}
270 270
 			}
271 271
 		}
272 272
 
273
-		if ( empty( $installed_refs ) ) {
273
+		if (empty($installed_refs)) {
274 274
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
275
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
276
-			throw new EE_Error( implode( '||', $error_msg ));
275
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
276
+			throw new EE_Error(implode('||', $error_msg));
277 277
 		}
278 278
 
279 279
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
280 280
 		$installed_refs = $this->_set_caffeinated($installed_refs);
281 281
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
282
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
283
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
282
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
283
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
284 284
 
285 285
 		//loop through admin pages and setup the $_installed_pages array.
286 286
 		$hooks_ref = array();
287
-		foreach ( $installed_refs as $page => $path ) {
287
+		foreach ($installed_refs as $page => $path) {
288 288
 			// set autoloaders for our admin page classes based on included path information
289
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
289
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
290 290
 			// build list of installed pages
291
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
291
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
292 292
 			// verify returned object
293
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
294
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
293
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
294
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
295 295
 					continue;
296 296
 				}
297 297
 
298 298
 				//skip if in full maintenance mode and maintenance_mode_parent is set
299 299
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
300
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
301
-					unset( $installed_refs[$page] );
300
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
301
+					unset($installed_refs[$page]);
302 302
 					continue;
303 303
 				}
304 304
 
@@ -306,45 +306,45 @@  discard block
 block discarded – undo
306 306
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
307 307
 				$extend = FALSE;
308 308
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
309
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
309
+				if (isset($this->_caffeinated_extends[$page])) {
310 310
 					$this->_current_caf_extend_slug = $page;
311
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
312
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
313
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
314
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
311
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
312
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
313
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
314
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
315 315
 
316
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
317
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
316
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
317
+					$hook_function_page = create_function('$admin_page', $page_runtime);
318 318
 
319
-					add_filter( $path_hook, $hook_function_path );
320
-					add_filter( $page_hook, $hook_function_page );
319
+					add_filter($path_hook, $hook_function_path);
320
+					add_filter($page_hook, $hook_function_page);
321 321
 					$extend = TRUE;
322 322
 				}
323 323
 				//let's do the registered hooks
324
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
324
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
325 325
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
326 326
 			}
327 327
 		}
328 328
 
329 329
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
330 330
 		//first make sure we've got unique values
331
-		$hooks_ref = array_unique( $hooks_ref );
331
+		$hooks_ref = array_unique($hooks_ref);
332 332
 		//now let's loop and require!
333
-		foreach ( $hooks_ref as $path ) {
334
-			require_once( $path );
333
+		foreach ($hooks_ref as $path) {
334
+			require_once($path);
335 335
 		}
336 336
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
337 337
 		global $ee_menu_slugs;
338 338
 		$ee_menu_slugs = $this->_menu_slugs;
339 339
 
340 340
 		//we need to loop again to run any early code
341
-		foreach ( $installed_refs as $page => $path ) {
342
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
341
+		foreach ($installed_refs as $page => $path) {
342
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
343 343
 				$this->_installed_pages[$page]->do_initial_loads();
344 344
 			}
345 345
 		}
346 346
 
347
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
347
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
348 348
 
349 349
 	}
350 350
 
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	 * @param string $page_slug
357 357
 	 * @return EE_Admin_Page
358 358
 	 */
359
-	public function get_admin_page_object( $page_slug = '' ) {
360
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
361
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
359
+	public function get_admin_page_object($page_slug = '') {
360
+		if (isset($this->_installed_pages[$page_slug])) {
361
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
362 362
 		}
363 363
 		return NULL;
364 364
 	}
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
 	 * @param $dir_name
372 372
 	 * @return string
373 373
 	 */
374
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
375
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
376
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
374
+	private function _get_classname_for_admin_page($dir_name = '') {
375
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
376
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
377 377
 	}
378 378
 
379 379
 
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
 	 * @param $dir_name
385 385
 	 * @return string
386 386
 	 */
387
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
388
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
389
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
387
+	private function _get_classname_for_admin_init_page($dir_name = '') {
388
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
389
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
390 390
 	}
391 391
 
392 392
 
@@ -399,15 +399,15 @@  discard block
 block discarded – undo
399 399
 	 * @throws EE_Error
400 400
 	 * @return object|bool  return page object if valid, bool false if not.
401 401
 	 */
402
-	private function _load_admin_page( $page = '', $path = '' ) {
403
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
404
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
405
-		if ( ! class_exists( $class_name )) {
406
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
407
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make 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, $class_name );
408
-			throw new EE_Error( implode( '||', $error_msg ));
402
+	private function _load_admin_page($page = '', $path = '') {
403
+		$class_name = $this->_get_classname_for_admin_init_page($page);
404
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
405
+		if ( ! class_exists($class_name)) {
406
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
407
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make 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, $class_name);
408
+			throw new EE_Error(implode('||', $error_msg));
409 409
 		}
410
-		EE_Admin::debug_log( __METHOD__ . ': ' . $class_name );
410
+		EE_Admin::debug_log(__METHOD__.': '.$class_name);
411 411
 		$a = new ReflectionClass($class_name);
412 412
 		return  $a->newInstance();
413 413
 	}
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 	public function set_menus() {
426 426
 		//prep the menu pages (sort, group.)
427 427
 		$this->_prep_pages();
428
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
429
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
430
-				$menu_map->add_menu_page( FALSE );
428
+		foreach ($this->_prepped_menu_maps as $menu_map) {
429
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
430
+				$menu_map->add_menu_page(FALSE);
431 431
 			}
432 432
 		}
433 433
 	}
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @return void
442 442
 	 */
443
-	public function set_network_menus(){
443
+	public function set_network_menus() {
444 444
 		$this->_prep_pages();
445
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
446
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
447
-				$menu_map->add_menu_page( TRUE );
445
+		foreach ($this->_prepped_menu_maps as $menu_map) {
446
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
447
+				$menu_map->add_menu_page(TRUE);
448 448
 			}
449 449
 		}
450 450
 	}
@@ -465,22 +465,22 @@  discard block
 block discarded – undo
465 465
 		//rearrange _admin_menu_groups to be indexed by group slug.
466 466
 		$menu_groups = $this->_rearrange_menu_groups();
467 467
 
468
-		foreach( $this->_installed_pages as $page ) {
469
-			if ( $page instanceof EE_Admin_page_Init ) {
468
+		foreach ($this->_installed_pages as $page) {
469
+			if ($page instanceof EE_Admin_page_Init) {
470 470
 				$page_map = $page->get_menu_map();
471 471
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
472
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
473
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
472
+				if (is_array($page_map) || empty($page_map)) {
473
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
474 474
 					continue;
475 475
 				}
476 476
 
477 477
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
478
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
479
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
478
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
479
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
480 480
 				}
481 481
 
482 482
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
483
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
483
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
484 484
 					continue;
485 485
 				}
486 486
 
@@ -489,21 +489,21 @@  discard block
 block discarded – undo
489 489
 			}
490 490
 		}
491 491
 
492
-		if ( empty( $pages_array )) {
493
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
492
+		if (empty($pages_array)) {
493
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
494 494
 		}
495 495
 
496 496
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
497
-		foreach ( $pages_array as $group => $menu_maps ) {
497
+		foreach ($pages_array as $group => $menu_maps) {
498 498
 			//valid_group?
499
-			if ( ! array_key_exists( $group, $menu_groups ) )
499
+			if ( ! array_key_exists($group, $menu_groups))
500 500
 				continue;
501 501
 
502 502
 			//sort pages.
503
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
503
+			usort($menu_maps, array($this, '_sort_menu_maps'));
504 504
 
505 505
 			//prepend header
506
-			array_unshift( $menu_maps, $menu_groups[$group] );
506
+			array_unshift($menu_maps, $menu_groups[$group]);
507 507
 
508 508
 			//reset $pages_array with prepped data
509 509
 			$pages_array[$group] = $menu_maps;
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
 
512 512
 
513 513
 		//now let's setup the _prepped_menu_maps property
514
-		foreach ( $menu_groups as $group => $group_objs ) {
515
-			if ( isset( $pages_array[$group] ) )
516
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
514
+		foreach ($menu_groups as $group => $group_objs) {
515
+			if (isset($pages_array[$group]))
516
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
517 517
 		}/**/
518 518
 
519 519
 	}
@@ -533,10 +533,10 @@  discard block
 block discarded – undo
533 533
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
534 534
 	 * @return array
535 535
 	 */
536
-	private function _set_caffeinated( $installed_refs ) {
536
+	private function _set_caffeinated($installed_refs) {
537 537
 
538 538
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
539
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
539
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
540 540
 			return $installed_refs;
541 541
 		}
542 542
 
@@ -545,15 +545,15 @@  discard block
 block discarded – undo
545 545
 		$exclude = array('tickets');
546 546
 
547 547
 		//okay let's setup an "New" pages first (we'll return installed refs later)
548
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
549
-		if ( $new_admin_screens ) {
550
-			foreach( $new_admin_screens as $admin_screen ) {
548
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
549
+		if ($new_admin_screens) {
550
+			foreach ($new_admin_screens as $admin_screen) {
551 551
 				// files and anything in the exclude array need not apply
552
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
552
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
553 553
 					// these folders represent the different NEW EE admin pages
554
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
554
+					$installed_refs[basename($admin_screen)] = $admin_screen;
555 555
 					// set autoloaders for our admin page classes based on included path information
556
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
556
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
557 557
 //					$this->_caf_autoloader[] = array(
558 558
 //						'dir' => 'new',
559 559
 //						'folder' => basename( $admin_screen )
@@ -563,18 +563,18 @@  discard block
 block discarded – undo
563 563
 		}
564 564
 
565 565
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
566
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
567
-		if ( $extends ) {
568
-			foreach( $extends as $extend ) {
569
-				if ( is_dir( $extend ) ) {
570
-					$extend_ref = basename( $extend );
566
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
567
+		if ($extends) {
568
+			foreach ($extends as $extend) {
569
+				if (is_dir($extend)) {
570
+					$extend_ref = basename($extend);
571 571
 					//now let's make sure there is a file that matches the expected format
572
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
573
-					$filename = 'Extend_' . $filename . '_Admin_Page';
574
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
572
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
573
+					$filename = 'Extend_'.$filename.'_Admin_Page';
574
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
575 575
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
576 576
 					// set autoloaders for our admin page classes based on included path information
577
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
577
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
578 578
 //					$this->_caf_autoloader[] = array(
579 579
 //						'dir' => 'extend',
580 580
 //						'folder' => $extend_ref
@@ -585,22 +585,22 @@  discard block
 block discarded – undo
585 585
 
586 586
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
587 587
 		$ee_admin_hooks = array();
588
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
589
-		if ( $hooks ) {
590
-			foreach ( $hooks as $hook ) {
591
-				if ( is_readable( $hook ) ) {
588
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
589
+		if ($hooks) {
590
+			foreach ($hooks as $hook) {
591
+				if (is_readable($hook)) {
592 592
 					require_once $hook;
593
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
593
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
594 594
 					$classname = str_replace('.class.php', '', $classname);
595
-					if ( class_exists( $classname ) ) {
596
-						$a = new ReflectionClass( $classname );
595
+					if (class_exists($classname)) {
596
+						$a = new ReflectionClass($classname);
597 597
 						$ee_admin_hooks[] = $a->newInstance();
598 598
 					}
599 599
 				}
600 600
 			}
601 601
 		}/**/
602 602
 
603
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
603
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
604 604
 
605 605
 		return $installed_refs;
606 606
 
@@ -657,8 +657,8 @@  discard block
 block discarded – undo
657 657
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
658 658
 	 * @return int    sort order
659 659
 	 */
660
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
661
-		if ( $a->menu_order == $b->menu_order )
660
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
661
+		if ($a->menu_order == $b->menu_order)
662 662
 			return 0;
663 663
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
664 664
 	}
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -606,9 +606,9 @@
 block discarded – undo
606 606
 		// first check if event is active.
607 607
 		if (
608 608
 			$orig_status === EEM_Event::cancelled
609
-		    || $orig_status === EEM_Event::postponed
610
-		    || $event->is_expired()
611
-		    || $event->is_inactive()
609
+			|| $orig_status === EEM_Event::postponed
610
+			|| $event->is_expired()
611
+			|| $event->is_inactive()
612 612
 		) {
613 613
 			return;
614 614
 		}
Please login to merge, or discard this patch.
Spacing   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 
57 57
 	protected function _init_page_props() {
58
-		EE_Admin::debug_log( __METHOD__ );
58
+		EE_Admin::debug_log(__METHOD__);
59 59
 		$this->page_slug = EVENTS_PG_SLUG;
60 60
 		$this->page_label = EVENTS_LABEL;
61 61
 		$this->_admin_base_url = EVENTS_ADMIN_URL;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$this->_cpt_edit_routes = array(
68 68
 			'espresso_events' => 'edit'
69 69
 		);
70
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
70
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
71 71
 	}
72 72
 
73 73
 	protected function _ajax_hooks() {
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 				'edit' => __('Update Event', 'event_espresso'),
94 94
 				'add_category' => __('Save New Category', 'event_espresso'),
95 95
 				'edit_category' => __('Update Category', 'event_espresso'),
96
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
96
+				'template_settings' => __('Update Settings', 'event_espresso')
97 97
 				)
98 98
 		);
99 99
 	}
100 100
 
101 101
 	protected function _set_page_routes() {
102 102
 		//load formatter helper
103
-		EE_Registry::instance()->load_helper( 'Formatter' );
103
+		EE_Registry::instance()->load_helper('Formatter');
104 104
 		//load field generator helper
105
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
105
+		EE_Registry::instance()->load_helper('Form_Fields');
106 106
 
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
109
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
109
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
110 110
 
111 111
 
112 112
 		$this->_page_routes = array(
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 				'help_tour' => array(
321 321
 					'Event_Editor_Help_Tour'
322 322
 					),
323
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
323
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
324 324
 				'require_nonce' => FALSE
325 325
 			),
326 326
 			'edit' => array(
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 				/*'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),*/
379
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => FALSE
381 381
 			),
382 382
 			'default_event_settings' => array(
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'filename' => 'events_default_settings_status'
399 399
 					)
400 400
 				),
401
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
401
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => FALSE
403 403
 			),
404 404
 			//template settings
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 						'filename' => 'general_settings_templates'
415 415
 					)
416 416
 				),
417
-				'help_tour' => array( 'Templates_Help_Tour' ),
417
+				'help_tour' => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => FALSE
419 419
 			),
420 420
 			//event category stuff
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 					'label' => __('Edit Category', 'event_espresso'),
439 439
 					'order' => 15,
440 440
 					'persistent' => FALSE,
441
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
441
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
442 442
 					),
443 443
 				'help_tabs' => array(
444 444
 					'edit_category_help_tab' => array(
@@ -508,14 +508,14 @@  discard block
 block discarded – undo
508 508
 
509 509
 	public function load_scripts_styles() {
510 510
 
511
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
511
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
512
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
513 513
 		wp_enqueue_style('events-admin-css');
514 514
 		wp_enqueue_style('ee-cat-admin');
515 515
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
516 516
 		//registers for all views
517 517
 		//scripts
518
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
519 519
 	}
520 520
 
521 521
 	/**
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 	public function load_scripts_styles_edit() {
534 534
 		//styles
535 535
 		wp_enqueue_style('espresso-ui-theme');
536
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
536
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
537 537
 		wp_enqueue_style('event-editor-css');
538 538
 
539 539
 		//scripts
540
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
540
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
541 541
 		wp_enqueue_script('event-datetime-metabox');
542 542
 
543 543
 	}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 
574 574
 	public function admin_init() {
575
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
575
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
576 576
 	}
577 577
 
578 578
 
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
 	 * @return void
593 593
 	 */
594 594
 	public function verify_event_edit($event = NULL) {
595
-		EE_Admin::debug_log( __METHOD__ );
595
+		EE_Admin::debug_log(__METHOD__);
596 596
 		// no event?
597
-		if ( empty( $event )) {
597
+		if (empty($event)) {
598 598
 			// set event
599 599
 			$event = $this->_cpt_model_obj;
600 600
 		}
601 601
 		// STILL no event?
602
-		if ( empty ( $event )) {
602
+		if (empty ($event)) {
603 603
 			return;
604 604
 		}
605 605
 		$orig_status = $event->status();
@@ -613,27 +613,27 @@  discard block
 block discarded – undo
613 613
 			return;
614 614
 		}
615 615
 		//made it here so it IS active... next check that any of the tickets are sold.
616
-		if ( $event->is_sold_out( true ) ) {
617
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
616
+		if ($event->is_sold_out(true)) {
617
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
618 618
 				EE_Error::add_attention(
619 619
 					sprintf(
620
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
621
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
620
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
621
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
622 622
 					)
623 623
 				);
624 624
 			}
625 625
 			return;
626
-		} else if ( $orig_status === EEM_Event::sold_out ) {
626
+		} else if ($orig_status === EEM_Event::sold_out) {
627 627
 			EE_Error::add_attention(
628 628
 				sprintf(
629
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
630
-						'event_espresso' ),
631
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
629
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
630
+						'event_espresso'),
631
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
632 632
 				)
633 633
 			);
634 634
 		}
635 635
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
636
-		if ( ! $event->tickets_on_sale() ) {
636
+		if ( ! $event->tickets_on_sale()) {
637 637
 			return;
638 638
 		}
639 639
 		//made it here so show warning
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 */
653 653
 	protected function _edit_event_warning() {
654 654
 		// we don't want to add warnings during these requests
655
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
655
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
656 656
 			return;
657 657
 		}
658 658
 		EE_Admin::debug_log(
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 			),
691 691
 		);
692 692
 
693
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
693
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
694 694
 			$this->_views['trash'] = array(
695 695
 				'slug' => 'trash',
696 696
 				'label' => __('Trash', 'event_espresso'),
@@ -720,39 +720,39 @@  discard block
 block discarded – undo
720 720
 				'desc' => __('View Registrations for Event', 'event_espresso')
721 721
 			)
722 722
 		);
723
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
723
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
724 724
 		$statuses = array(
725 725
 			'sold_out_status' => array(
726
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
727
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
726
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
727
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
728 728
 			),
729 729
 			'active_status' => array(
730
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
731
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
730
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
731
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
732 732
 			),
733 733
 			'upcoming_status' => array(
734
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
735
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
734
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
735
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
736 736
 			),
737 737
 			'postponed_status' => array(
738
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
739
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
738
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
739
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
740 740
 			),
741 741
 			'cancelled_status' => array(
742
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
743
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
742
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
743
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
744 744
 			),
745 745
 			'expired_status' => array(
746
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
747
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
746
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
747
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
748 748
 			),
749 749
 			'inactive_status' => array(
750
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
751
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
750
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
751
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
752 752
 			)
753 753
 		);
754
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
755
-		return array_merge( $items, $statuses );
754
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
755
+		return array_merge($items, $statuses);
756 756
 	}
757 757
 
758 758
 
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 	 * @return EEM_Event
765 765
 	 */
766 766
 	private function _event_model() {
767
-		if ( ! $this->_event_model instanceof EEM_Event ) {
768
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
767
+		if ( ! $this->_event_model instanceof EEM_Event) {
768
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
769 769
 		}
770 770
 		return $this->_event_model;
771 771
 	}
@@ -784,12 +784,12 @@  discard block
 block discarded – undo
784 784
 	 * @param  string $new_slug  what the slug is
785 785
 	 * @return string            The new html string for the permalink area
786 786
 	 */
787
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
787
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
788 788
 		//make sure this is only when editing
789
-		if ( !empty( $id ) ) {
790
-			$post = get_post( $id );
791
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
792
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
789
+		if ( ! empty($id)) {
790
+			$post = get_post($id);
791
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
792
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
793 793
 		}
794 794
 		return $return;
795 795
 	}
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
 	 * @return string html for generated table
806 806
 	 */
807 807
 	protected function _events_overview_list_table() {
808
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
809
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
808
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
809
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
810 810
 		$this->_display_legend($this->_event_legend_items());
811 811
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
812 812
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -824,51 +824,51 @@  discard block
 block discarded – undo
824 824
 
825 825
 
826 826
 
827
-	protected function _insert_update_cpt_item( $post_id, $post ) {
827
+	protected function _insert_update_cpt_item($post_id, $post) {
828 828
 
829
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
829
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
830 830
 			//getout we're not processing an event save.
831 831
 			return;
832 832
 		}
833 833
 
834 834
 		$event_values = array(
835
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
836
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
835
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
836
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
837 837
 			'EVT_additional_limit' => min(
838
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
839
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
840
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
841
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
842
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
843
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
844
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
845
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
838
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
839
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
840
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
841
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
842
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
843
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
844
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
845
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
846 846
 			);
847 847
 
848 848
 		//update event
849
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
849
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
850 850
 
851 851
 
852 852
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
853
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
854
-		$event = $this->_event_model()->get_one( array($get_one_where) );
853
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
854
+		$event = $this->_event_model()->get_one(array($get_one_where));
855 855
 
856 856
 
857 857
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
858
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
858
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
859 859
 
860 860
 		$att_success = TRUE;
861 861
 
862
-		foreach ( $event_update_callbacks as $e_callback ) {
863
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
864
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
862
+		foreach ($event_update_callbacks as $e_callback) {
863
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
864
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
865 865
 		}
866 866
 
867 867
 		//any errors?
868
-		if ( $success && FALSE === $att_success ) {
869
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
870
-		} else if ( $success === FALSE ) {
871
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
868
+		if ($success && FALSE === $att_success) {
869
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
870
+		} else if ($success === FALSE) {
871
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
872 872
 		}
873 873
 	}
874 874
 
@@ -878,14 +878,14 @@  discard block
 block discarded – undo
878 878
 	/**
879 879
 	 * @see parent::restore_item()
880 880
 	 */
881
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
881
+	protected function _restore_cpt_item($post_id, $revision_id) {
882 882
 		//copy existing event meta to new post
883 883
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
884
-		if ( $post_evt instanceof EE_Event ) {
884
+		if ($post_evt instanceof EE_Event) {
885 885
 			//meta revision restore
886
-			$post_evt->restore_revision( $revision_id );
886
+			$post_evt->restore_revision($revision_id);
887 887
 			//related objs restore
888
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
888
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
889 889
 		}
890 890
 	}
891 891
 
@@ -898,52 +898,52 @@  discard block
 block discarded – undo
898 898
 	 * @param  array  $data   The request data from the form
899 899
 	 * @return bool           Success or fail.
900 900
 	 */
901
-	protected function _default_venue_update( $evtobj, $data ) {
902
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
901
+	protected function _default_venue_update($evtobj, $data) {
902
+		require_once(EE_MODELS.'EEM_Venue.model.php');
903 903
 		$venue_model = EE_Registry::instance()->load_model('Venue');
904 904
 		$rows_affected = NULL;
905
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
905
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
906 906
 
907 907
 		// very important.  If we don't have a venue name...
908 908
 		// then we'll get out because not necessary to create empty venue
909
-		if ( empty( $data['venue_title'] ) ) {
909
+		if (empty($data['venue_title'])) {
910 910
 			return false;
911 911
 		}
912 912
 
913 913
 		$venue_array = array(
914 914
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
915
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
916
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
917
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
918
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
919
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
920
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
921
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
922
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
923
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
924
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
925
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
926
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
927
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
928
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
929
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
930
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
915
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
916
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
917
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
918
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
919
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
920
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
921
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
922
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
923
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
924
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
925
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
926
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
927
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
928
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
929
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
930
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
931 931
 				'status' => 'publish'
932 932
 			);
933 933
 
934 934
 
935 935
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
936
-		if ( !empty( $venue_id ) ) {
937
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
938
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
936
+		if ( ! empty($venue_id)) {
937
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
938
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
939 939
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
940
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
940
+			$evtobj->_add_relation_to($venue_id, 'Venue');
941 941
 			return $rows_affected > 0 ? TRUE : FALSE;
942 942
 		} else {
943 943
 			//we insert the venue
944
-			$venue_id = $venue_model->insert( $venue_array );
945
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
946
-			return !empty( $venue_id ) ? TRUE : FALSE;
944
+			$venue_id = $venue_model->insert($venue_array);
945
+			$evtobj->_add_relation_to($venue_id, 'Venue');
946
+			return ! empty($venue_id) ? TRUE : FALSE;
947 947
 		}
948 948
 		//when we have the ancestor come in it's already been handled by the revision save.
949 949
 	}
@@ -957,55 +957,55 @@  discard block
 block discarded – undo
957 957
 	 * @param  array    $data   The request data from the form
958 958
 	 * @return bool             success or fail
959 959
 	 */
960
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
960
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
961 961
 		$success = true;
962 962
 		$saved_dtt = null;
963 963
 		$saved_tickets = array();
964
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
964
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
965 965
 
966
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
966
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
967 967
 			//trim all values to ensure any excess whitespace is removed.
968
-			$dtt =  array_map( 'trim', $dtt );
969
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
968
+			$dtt = array_map('trim', $dtt);
969
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
970 970
 			$datetime_values = array(
971
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
971
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
972 972
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
973 973
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
974
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
974
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
975 975
 				'DTT_order' 	=> $row,
976 976
 			);
977 977
 
978 978
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
979 979
 
980
-			if ( !empty( $dtt['DTT_ID'] ) ) {
981
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
982
-				$DTM->set_date_format( $incoming_date_formats[0] );
983
-				$DTM->set_time_format( $incoming_date_formats[1] );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+			if ( ! empty($dtt['DTT_ID'])) {
981
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
982
+				$DTM->set_date_format($incoming_date_formats[0]);
983
+				$DTM->set_time_format($incoming_date_formats[1]);
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 
988 988
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
989 989
 				$saved_dtts[$DTM->ID()] = $DTM;
990 990
 			} else {
991
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
992
-				$DTM->set_date_format( $incoming_date_formats[0] );
993
-				$DTM->set_time_format( $incoming_date_formats[1] );
994
-				$DTM->set_timezone( $evtobj->get_timezone() );
995
-				foreach ( $datetime_values as $field => $value ) {
996
-					$DTM->set( $field, $value );
991
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
992
+				$DTM->set_date_format($incoming_date_formats[0]);
993
+				$DTM->set_time_format($incoming_date_formats[1]);
994
+				$DTM->set_timezone($evtobj->get_timezone());
995
+				foreach ($datetime_values as $field => $value) {
996
+					$DTM->set($field, $value);
997 997
 				}
998 998
 			}
999 999
 			$DTM->save();
1000 1000
 
1001
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
1001
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
1002 1002
 
1003 1003
 			//load DTT helper
1004 1004
 			EE_Registry::instance()->load_helper('DTT_Helper');
1005 1005
 
1006 1006
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1007
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
1008
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
1007
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
1008
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1009 1009
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1010 1010
 				$DTT->save();
1011 1011
 			}
@@ -1013,45 +1013,45 @@  discard block
 block discarded – undo
1013 1013
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1014 1014
 			$saved_dtt = $DTT;
1015 1015
 
1016
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1016
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1017 1017
 		}
1018 1018
 
1019 1019
 		//no dtts get deleted so we don't do any of that logic here.
1020 1020
 		//update tickets next
1021
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1022
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1023
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1021
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1022
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1023
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1024 1024
 			$update_prices = false;
1025
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1025
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1026 1026
 
1027 1027
 			// trim inputs to ensure any excess whitespace is removed.
1028
-			$tkt = array_map( 'trim', $tkt );
1028
+			$tkt = array_map('trim', $tkt);
1029 1029
 
1030
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1030
+			if (empty($tkt['TKT_start_date'])) {
1031 1031
 				//let's use now in the set timezone.
1032
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1033
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1032
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1033
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1034 1034
 			}
1035 1035
 
1036
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1036
+			if (empty($tkt['TKT_end_date'])) {
1037 1037
 				//use the start date of the first datetime
1038 1038
 				$dtt = $evtobj->first_datetime();
1039
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1039
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1040 1040
 			}
1041 1041
 
1042 1042
 			$TKT_values = array(
1043
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1044
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1045
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1046
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1043
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1044
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1045
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1046
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1047 1047
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1048 1048
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1049
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1050
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1051
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1052
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1049
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1050
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1051
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1052
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1053 1053
 				'TKT_row' 			=> $row,
1054
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1054
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1055 1055
 				'TKT_price' 		=> $ticket_price
1056 1056
 			);
1057 1057
 
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 
1061 1061
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1062
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1062
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1063 1063
 				$TKT_values['TKT_ID'] = 0;
1064 1064
 				$TKT_values['TKT_is_default'] = 0;
1065 1065
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1070,58 +1070,58 @@  discard block
 block discarded – undo
1070 1070
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1071 1071
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1072 1072
 
1073
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1074
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1075
-				if ( $TKT instanceof EE_Ticket ) {
1076
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1073
+			if ( ! empty($tkt['TKT_ID'])) {
1074
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1075
+				if ($TKT instanceof EE_Ticket) {
1076
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1077 1077
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1078
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1079
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1080
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1078
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1079
+					$TKT->set_date_format($incoming_date_formats[0]);
1080
+					$TKT->set_time_format($incoming_date_formats[1]);
1081 1081
 					//set new values
1082
-					foreach ( $TKT_values as $field => $value ) {
1083
-						if ( $field == 'TKT_qty' ) {
1084
-							$TKT->set_qty( $value );
1082
+					foreach ($TKT_values as $field => $value) {
1083
+						if ($field == 'TKT_qty') {
1084
+							$TKT->set_qty($value);
1085 1085
 						} else {
1086
-							$TKT->set( $field, $value );
1086
+							$TKT->set($field, $value);
1087 1087
 						}
1088 1088
 					}
1089 1089
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1090
-					if ( $create_new_TKT ) {
1090
+					if ($create_new_TKT) {
1091 1091
 						//archive the old ticket first
1092
-						$TKT->set( 'TKT_deleted', 1 );
1092
+						$TKT->set('TKT_deleted', 1);
1093 1093
 						$TKT->save();
1094 1094
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1095
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1095
+						$saved_tickets[$TKT->ID()] = $TKT;
1096 1096
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1097 1097
 						$TKT = clone $TKT;
1098
-						$TKT->set( 'TKT_ID', 0 );
1099
-						$TKT->set( 'TKT_deleted', 0 );
1100
-						$TKT->set( 'TKT_price', $ticket_price );
1101
-						$TKT->set( 'TKT_sold', 0 );
1098
+						$TKT->set('TKT_ID', 0);
1099
+						$TKT->set('TKT_deleted', 0);
1100
+						$TKT->set('TKT_price', $ticket_price);
1101
+						$TKT->set('TKT_sold', 0);
1102 1102
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1103 1103
 						$update_prices = true;
1104 1104
 					}
1105 1105
 					//make sure price is set if it hasn't been already
1106
-					$TKT->set( 'TKT_price', $ticket_price );
1106
+					$TKT->set('TKT_price', $ticket_price);
1107 1107
 				}
1108 1108
 
1109 1109
 			} else {
1110 1110
 				//no TKT_id so a new TKT
1111 1111
 				$TKT_values['TKT_price'] = $ticket_price;
1112
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1113
-				if ( $TKT instanceof EE_Ticket ) {
1112
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1113
+				if ($TKT instanceof EE_Ticket) {
1114 1114
 					//need to reset values to properly account for the date formats
1115
-					$TKT->set_date_format( $incoming_date_formats[0] );
1116
-					$TKT->set_time_format( $incoming_date_formats[1] );
1117
-					$TKT->set_timezone( $evtobj->get_timezone() );
1115
+					$TKT->set_date_format($incoming_date_formats[0]);
1116
+					$TKT->set_time_format($incoming_date_formats[1]);
1117
+					$TKT->set_timezone($evtobj->get_timezone());
1118 1118
 
1119 1119
 					//set new values
1120
-					foreach ( $TKT_values as $field => $value ) {
1121
-						if ( $field == 'TKT_qty' ) {
1122
-							$TKT->set_qty( $value );
1120
+					foreach ($TKT_values as $field => $value) {
1121
+						if ($field == 'TKT_qty') {
1122
+							$TKT->set_qty($value);
1123 1123
 						} else {
1124
-							$TKT->set( $field, $value );
1124
+							$TKT->set($field, $value);
1125 1125
 						}
1126 1126
 					}
1127 1127
 
@@ -1129,32 +1129,32 @@  discard block
 block discarded – undo
1129 1129
 				}
1130 1130
 			}
1131 1131
 			// cap ticket qty by datetime reg limits
1132
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1132
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1133 1133
 			//update ticket.
1134 1134
 			$TKT->save();
1135 1135
 
1136 1136
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1137
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1138
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1137
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1138
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1139 1139
 				EE_Registry::instance()->load_helper('DTT_Helper');
1140 1140
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1141 1141
 				$TKT->save();
1142 1142
 			}
1143 1143
 
1144 1144
 			//initially let's add the ticket to the dtt
1145
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1145
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1146 1146
 
1147 1147
 			$saved_tickets[$TKT->ID()] = $TKT;
1148 1148
 
1149 1149
 			//add prices to ticket
1150
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1150
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1151 1151
 		}
1152 1152
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1153
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1154
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1153
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1154
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1155 1155
 
1156
-		foreach ( $tickets_removed as $id ) {
1157
-			$id = absint( $id );
1156
+		foreach ($tickets_removed as $id) {
1157
+			$id = absint($id);
1158 1158
 
1159 1159
 			//get the ticket for this id
1160 1160
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1163 1163
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1164 1164
 
1165
-			foreach( $dtts as $dtt ) {
1165
+			foreach ($dtts as $dtt) {
1166 1166
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1167 1167
 			}
1168 1168
 
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1174 1174
 			$tkt_to_remove->delete_permanently();
1175 1175
 		}
1176
-		return array( $saved_dtt, $saved_tickets );
1176
+		return array($saved_dtt, $saved_tickets);
1177 1177
 	}
1178 1178
 
1179 1179
 
@@ -1188,31 +1188,31 @@  discard block
 block discarded – undo
1188 1188
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1189 1189
 	 * @return  void
1190 1190
 	 */
1191
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1192
-		foreach ( $prices as $row => $prc ) {
1191
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1192
+		foreach ($prices as $row => $prc) {
1193 1193
 			$PRC_values = array(
1194
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1195
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1196
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1197
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1198
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1194
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1195
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1196
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1197
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1198
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1199 1199
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1200 1200
 				'PRC_order' => $row
1201 1201
 			);
1202 1202
 
1203
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1203
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1204 1204
 				$PRC_values['PRC_ID'] = 0;
1205
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1205
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1206 1206
 			} else {
1207
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1207
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1208 1208
 				//update this price with new values
1209
-				foreach ( $PRC_values as $field => $newprc ) {
1210
-					$PRC->set( $field, $newprc );
1209
+				foreach ($PRC_values as $field => $newprc) {
1210
+					$PRC->set($field, $newprc);
1211 1211
 				}
1212 1212
 				$PRC->save();
1213 1213
 			}
1214 1214
 
1215
-			$ticket->_add_relation_to( $PRC, 'Price' );
1215
+			$ticket->_add_relation_to($PRC, 'Price');
1216 1216
 		}
1217 1217
 	}
1218 1218
 
@@ -1248,12 +1248,12 @@  discard block
 block discarded – undo
1248 1248
 	private function _generate_publish_box_extra_content() {
1249 1249
 
1250 1250
 		//load formatter helper
1251
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1251
+  		EE_Registry::instance()->load_helper('Formatter');
1252 1252
 
1253 1253
   		//args for getting related registrations
1254
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1255
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1256
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1254
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1255
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1256
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1257 1257
 
1258 1258
 
1259 1259
 		// publish box
@@ -1282,9 +1282,9 @@  discard block
 block discarded – undo
1282 1282
 				),
1283 1283
 				REG_ADMIN_URL
1284 1284
 			),
1285
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1286
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1287
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1285
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1286
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1287
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1288 1288
 			'misc_pub_section_class' => apply_filters(
1289 1289
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1290 1290
 				'misc-pub-section'
@@ -1303,9 +1303,9 @@  discard block
 block discarded – undo
1303 1303
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1304 1304
 			$this->_cpt_model_obj
1305 1305
 		);
1306
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1306
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1307 1307
 		// load template
1308
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1308
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1309 1309
 	}
1310 1310
 
1311 1311
 
@@ -1337,16 +1337,16 @@  discard block
 block discarded – undo
1337 1337
 		$this->verify_cpt_object();
1338 1338
 		add_meta_box(
1339 1339
 			'espresso_event_editor_tickets',
1340
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1341
-			array( $this, 'ticket_metabox' ),
1340
+			__('Event Datetime & Ticket', 'event_espresso'),
1341
+			array($this, 'ticket_metabox'),
1342 1342
 			$this->page_slug,
1343 1343
 			'normal',
1344 1344
 			'high'
1345 1345
 		);
1346 1346
 		add_meta_box(
1347 1347
 			'espresso_event_editor_event_options',
1348
-			__( 'Event Registration Options', 'event_espresso' ),
1349
-			array( $this, 'registration_options_meta_box' ),
1348
+			__('Event Registration Options', 'event_espresso'),
1349
+			array($this, 'registration_options_meta_box'),
1350 1350
 			$this->page_slug,
1351 1351
 			'side',
1352 1352
 			'default'
@@ -1376,37 +1376,37 @@  discard block
 block discarded – undo
1376 1376
 			'disabled' => ''
1377 1377
 			);
1378 1378
 
1379
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1379
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1380 1380
 
1381
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1381
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1382 1382
 
1383 1383
 		/**
1384 1384
 		 * 1. Start with retrieving Datetimes
1385 1385
 		 * 2. Fore each datetime get related tickets
1386 1386
 		 * 3. For each ticket get related prices
1387 1387
 		 */
1388
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1389
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1388
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1389
+		EE_Registry::instance()->load_helper('DTT_Helper');
1390 1390
 		/** @type EE_Datetime $first_datetime */
1391
-		$first_datetime = reset( $times );
1391
+		$first_datetime = reset($times);
1392 1392
 		//do we get related tickets?
1393
-		if ( $first_datetime instanceof EE_Datetime
1394
-			&& $first_datetime->ID() !== 0 ) {
1393
+		if ($first_datetime instanceof EE_Datetime
1394
+			&& $first_datetime->ID() !== 0) {
1395 1395
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1396 1396
 			$template_args['time'] = $first_datetime;
1397 1397
 			$related_tickets = $first_datetime->tickets(
1398 1398
 				array(
1399
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1399
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1400 1400
 					'default_where_conditions' => 'none'
1401 1401
 				)
1402 1402
 			);
1403 1403
 
1404
-			if ( !empty($related_tickets) ) {
1404
+			if ( ! empty($related_tickets)) {
1405 1405
 				$template_args['total_ticket_rows'] = count($related_tickets);
1406 1406
 				$row = 0;
1407
-				foreach ( $related_tickets as $ticket ) {
1407
+				foreach ($related_tickets as $ticket) {
1408 1408
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1409
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1409
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1410 1410
 
1411 1411
 					$row++;
1412 1412
 				}
@@ -1414,13 +1414,13 @@  discard block
 block discarded – undo
1414 1414
 				$template_args['total_ticket_rows'] = 1;
1415 1415
 				/** @type EE_Ticket $ticket */
1416 1416
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1417
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1417
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1418 1418
 			}
1419 1419
 		} else {
1420 1420
 			$template_args['time'] = $times[0];
1421 1421
 			/** @type EE_Ticket $ticket */
1422 1422
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1423
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1423
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1424 1424
 			// NOTE: we're just sending the first default row
1425 1425
 			// (decaf can't manage default tickets so this should be sufficient);
1426 1426
 		}
@@ -1429,8 +1429,8 @@  discard block
 block discarded – undo
1429 1429
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1430 1430
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1431 1431
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1432
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1433
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1432
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1433
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1434 1434
 		EEH_Template::display_template($template, $template_args);
1435 1435
 	}
1436 1436
 
@@ -1445,21 +1445,21 @@  discard block
 block discarded – undo
1445 1445
 	 * @param int        $row
1446 1446
 	 * @return string generated html for the ticket row.
1447 1447
 	 */
1448
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1448
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1449 1449
 		$template_args = array(
1450
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1451
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1450
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1451
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1452 1452
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1453 1453
 			'TKT_ID' => $ticket->get('TKT_ID'),
1454 1454
 			'TKT_name' => $ticket->get('TKT_name'),
1455 1455
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1456 1456
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1457 1457
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1458
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1458
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1459 1459
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1460 1460
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1461
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1462
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1461
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1462
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1463 1463
 			);
1464 1464
 
1465 1465
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1475,23 +1475,23 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
 		//make sure we have default start and end dates if skeleton
1477 1477
 		//handle rows that should NOT be empty
1478
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1478
+		if (empty($template_args['TKT_start_date'])) {
1479 1479
 			//if empty then the start date will be now.
1480 1480
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1481 1481
 		}
1482 1482
 
1483
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1483
+		if (empty($template_args['TKT_end_date'])) {
1484 1484
 			//get the earliest datetime (if present);
1485
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1485
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1486 1486
 
1487
-			if ( !empty( $earliest_dtt ) )
1487
+			if ( ! empty($earliest_dtt))
1488 1488
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1489 1489
 			else
1490
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1490
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1491 1491
 		}
1492 1492
 
1493
-		$template_args = array_merge( $template_args, $price_args );
1494
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1493
+		$template_args = array_merge($template_args, $price_args);
1494
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1495 1495
 		return EEH_Template::display_template($template, $template_args, TRUE);
1496 1496
 	}
1497 1497
 
@@ -1520,8 +1520,8 @@  discard block
 block discarded – undo
1520 1520
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1521 1521
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1522 1522
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1523
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1524
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1523
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1524
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1525 1525
 		EEH_Template::display_template($templatepath, $template_args);
1526 1526
 	}
1527 1527
 
@@ -1549,21 +1549,21 @@  discard block
 block discarded – undo
1549 1549
 		$EEME = $this->_event_model();
1550 1550
 
1551 1551
 		$offset = ($current_page - 1) * $per_page;
1552
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1552
+		$limit = $count ? NULL : $offset.','.$per_page;
1553 1553
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1554 1554
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1555 1555
 
1556 1556
 		if (isset($this->_req_data['month_range'])) {
1557 1557
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1558
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1559
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1558
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1559
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1560 1560
 		}
1561 1561
 
1562 1562
 		$where = array();
1563 1563
 
1564
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1564
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1565 1565
 		//determine what post_status our condition will have for the query.
1566
-		switch ( $status ) {
1566
+		switch ($status) {
1567 1567
 			case 'month' :
1568 1568
 			case 'today' :
1569 1569
 			case NULL :
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
 				break;
1572 1572
 
1573 1573
 			case 'draft' :
1574
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1574
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1575 1575
 				break;
1576 1576
 
1577 1577
 			default :
@@ -1579,43 +1579,43 @@  discard block
 block discarded – undo
1579 1579
 		}
1580 1580
 
1581 1581
 		//categories?
1582
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1582
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1583 1583
 
1584
-		if ( !empty ( $category ) ) {
1584
+		if ( ! empty ($category)) {
1585 1585
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1586 1586
 			$where['Term_Taxonomy.term_id'] = $category;
1587 1587
 		}
1588 1588
 
1589 1589
 		//date where conditions
1590
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1590
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1591 1591
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1592
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1593
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1594
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1595
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1592
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1593
+			$start = $DateTime->format(implode(' ', $start_formats));
1594
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1595
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1596 1596
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1597
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1598
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1599
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1600
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1601
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1602
-			$now = date( 'Y-m-01' );
1603
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1604
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1605
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1606
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1597
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1598
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1599
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1600
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1601
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1602
+			$now = date('Y-m-01');
1603
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1604
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1605
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1606
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1607 1607
 		}
1608 1608
 
1609 1609
 
1610
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
-			$where['EVT_wp_user'] =  get_current_user_id();
1610
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1611
+			$where['EVT_wp_user'] = get_current_user_id();
1612 1612
 		} else {
1613
-			if ( ! isset( $where['status'] ) ) {
1614
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1613
+			if ( ! isset($where['status'])) {
1614
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1615 1615
 					$where['OR'] = array(
1616
-						'status*restrict_private' => array( '!=', 'private' ),
1616
+						'status*restrict_private' => array('!=', 'private'),
1617 1617
 						'AND' => array(
1618
-							'status*inclusive' => array( '=', 'private' ),
1618
+							'status*inclusive' => array('=', 'private'),
1619 1619
 							'EVT_wp_user' => get_current_user_id()
1620 1620
 						)
1621 1621
 					);
@@ -1623,16 +1623,16 @@  discard block
 block discarded – undo
1623 1623
 			}
1624 1624
 		}
1625 1625
 
1626
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1627
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1626
+		if (isset($this->_req_data['EVT_wp_user'])) {
1627
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1628 1628
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1629 1629
 			}
1630 1630
 		}
1631 1631
 
1632 1632
 
1633 1633
 		//search query handling
1634
-		if ( isset( $this->_req_data['s'] ) ) {
1635
-			$search_string = '%' . $this->_req_data['s'] . '%';
1634
+		if (isset($this->_req_data['s'])) {
1635
+			$search_string = '%'.$this->_req_data['s'].'%';
1636 1636
 			$where['OR'] = array(
1637 1637
 				'EVT_name' => array('LIKE', $search_string),
1638 1638
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1641,32 +1641,32 @@  discard block
 block discarded – undo
1641 1641
 		}
1642 1642
 
1643 1643
 
1644
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1645
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1644
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1645
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1646 1646
 
1647 1647
 
1648 1648
 		//let's first check if we have special requests coming in.
1649
-		if ( isset( $this->_req_data['active_status'] ) ) {
1650
-			switch ( $this->_req_data['active_status'] ) {
1649
+		if (isset($this->_req_data['active_status'])) {
1650
+			switch ($this->_req_data['active_status']) {
1651 1651
 				case 'upcoming' :
1652
-					return $EEME->get_upcoming_events( $query_params, $count );
1652
+					return $EEME->get_upcoming_events($query_params, $count);
1653 1653
 					break;
1654 1654
 
1655 1655
 				case 'expired' :
1656
-					return $EEME->get_expired_events( $query_params, $count );
1656
+					return $EEME->get_expired_events($query_params, $count);
1657 1657
 					break;
1658 1658
 
1659 1659
 				case 'active' :
1660
-					return $EEME->get_active_events( $query_params, $count );
1660
+					return $EEME->get_active_events($query_params, $count);
1661 1661
 					break;
1662 1662
 
1663 1663
 				case 'inactive' :
1664
-					return $EEME->get_inactive_events( $query_params, $count );
1664
+					return $EEME->get_inactive_events($query_params, $count);
1665 1665
 					break;
1666 1666
 			}
1667 1667
 		}
1668 1668
 
1669
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1669
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1670 1670
 
1671 1671
 		return $events;
1672 1672
 	}
@@ -1675,23 +1675,23 @@  discard block
 block discarded – undo
1675 1675
 
1676 1676
 
1677 1677
 	//handling for WordPress CPT actions (trash, restore, delete)
1678
-	public function trash_cpt_item( $post_id ) {
1678
+	public function trash_cpt_item($post_id) {
1679 1679
 		$this->_req_data['EVT_ID'] = $post_id;
1680
-		$this->_trash_or_restore_event( 'trash', FALSE );
1680
+		$this->_trash_or_restore_event('trash', FALSE);
1681 1681
 	}
1682 1682
 
1683 1683
 
1684 1684
 
1685 1685
 
1686
-	public function restore_cpt_item( $post_id ) {
1686
+	public function restore_cpt_item($post_id) {
1687 1687
 		$this->_req_data['EVT_ID'] = $post_id;
1688
-		$this->_trash_or_restore_event( 'draft', FALSE );
1688
+		$this->_trash_or_restore_event('draft', FALSE);
1689 1689
 	}
1690 1690
 
1691 1691
 
1692
-	public function delete_cpt_item( $post_id ) {
1692
+	public function delete_cpt_item($post_id) {
1693 1693
 		$this->_req_data['EVT_ID'] = $post_id;
1694
-		$this->_delete_event( FALSE );
1694
+		$this->_delete_event(FALSE);
1695 1695
 	}
1696 1696
 
1697 1697
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	 * @param  string $event_status
1704 1704
 	 * @return void
1705 1705
 	 */
1706
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1706
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1707 1707
 		//determine the event id and set to array.
1708 1708
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1709 1709
 		// loop thru events
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 			// clean status
1712 1712
 			$event_status = sanitize_key($event_status);
1713 1713
 			// grab status
1714
-			if (!empty($event_status)) {
1714
+			if ( ! empty($event_status)) {
1715 1715
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1716 1716
 			} else {
1717 1717
 				$success = FALSE;
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		}
1726 1726
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1727 1727
 
1728
-		if ( $redirect_after )
1728
+		if ($redirect_after)
1729 1729
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1730 1730
 	}
1731 1731
 
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 		// clean status
1741 1741
 		$event_status = sanitize_key($event_status);
1742 1742
 		// grab status
1743
-		if (!empty($event_status)) {
1743
+		if ( ! empty($event_status)) {
1744 1744
 			$success = TRUE;
1745 1745
 			//determine the event id and set to array.
1746 1746
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1775,15 +1775,15 @@  discard block
 block discarded – undo
1775 1775
 	 * @param  string $event_status
1776 1776
 	 * @return bool
1777 1777
 	 */
1778
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1778
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1779 1779
 		// grab event id
1780
-		if (!$EVT_ID) {
1780
+		if ( ! $EVT_ID) {
1781 1781
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1782 1782
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1783 1783
 			return FALSE;
1784 1784
 		}
1785 1785
 
1786
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1786
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1787 1787
 
1788 1788
 		// clean status
1789 1789
 		$event_status = sanitize_key($event_status);
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 				$hook = FALSE;
1810 1810
 		}
1811 1811
 		//use class to change status
1812
-		$this->_cpt_model_obj->set_status( $event_status );
1812
+		$this->_cpt_model_obj->set_status($event_status);
1813 1813
 		$success = $this->_cpt_model_obj->save();
1814 1814
 
1815 1815
 		if ($success === FALSE) {
@@ -1831,15 +1831,15 @@  discard block
 block discarded – undo
1831 1831
 	 * @access protected
1832 1832
 	 * @param bool $redirect_after
1833 1833
 	 */
1834
-	protected function _delete_event( $redirect_after = TRUE ) {
1834
+	protected function _delete_event($redirect_after = TRUE) {
1835 1835
 		//determine the event id and set to array.
1836 1836
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1837
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1837
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1838 1838
 
1839 1839
 
1840 1840
 		// loop thru events
1841 1841
 		if ($EVT_ID) {
1842
-			$success = $this->_permanently_delete_event( $EVT_ID );
1842
+			$success = $this->_permanently_delete_event($EVT_ID);
1843 1843
 			// get list of events with no prices
1844 1844
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1845 1845
 			// remove this event from the list of events with no prices
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1854 1854
 		}
1855 1855
 
1856
-		if ( $redirect_after )
1856
+		if ($redirect_after)
1857 1857
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1858 1858
 	}
1859 1859
 
@@ -1871,12 +1871,12 @@  discard block
 block discarded – undo
1871 1871
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1872 1872
 		// loop thru events
1873 1873
 		foreach ($EVT_IDs as $EVT_ID) {
1874
-			$EVT_ID = absint( $EVT_ID );
1875
-			if ( $EVT_ID ) {
1876
-				$results = $this->_permanently_delete_event( $EVT_ID );
1874
+			$EVT_ID = absint($EVT_ID);
1875
+			if ($EVT_ID) {
1876
+				$results = $this->_permanently_delete_event($EVT_ID);
1877 1877
 				$success = $results !== FALSE ? $success : FALSE;
1878 1878
 				// remove this event from the list of events with no prices
1879
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1879
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1880 1880
 			} else {
1881 1881
 				$success = FALSE;
1882 1882
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1896,9 +1896,9 @@  discard block
 block discarded – undo
1896 1896
 	 * @param  int $EVT_ID
1897 1897
 	 * @return bool
1898 1898
 	 */
1899
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1899
+	private function _permanently_delete_event($EVT_ID = 0) {
1900 1900
 		// grab event id
1901
-		if ( ! $EVT_ID ) {
1901
+		if ( ! $EVT_ID) {
1902 1902
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1903 1903
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1904 1904
 			return FALSE;
@@ -1907,19 +1907,19 @@  discard block
 block discarded – undo
1907 1907
 			! $this->_cpt_model_obj instanceof EE_Event
1908 1908
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1909 1909
 		) {
1910
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1910
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1911 1911
 		}
1912 1912
 
1913
-		if ( ! $this->_cpt_model instanceof EE_Event ) {
1913
+		if ( ! $this->_cpt_model instanceof EE_Event) {
1914 1914
 			return false;
1915 1915
 		}
1916 1916
 
1917 1917
 		//need to delete related tickets and prices first.
1918 1918
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1919
-		foreach ( $datetimes as $datetime ) {
1919
+		foreach ($datetimes as $datetime) {
1920 1920
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1921 1921
 			$tickets = $datetime->get_many_related('Ticket');
1922
-			foreach ( $tickets as $ticket ) {
1922
+			foreach ($tickets as $ticket) {
1923 1923
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1924 1924
 				$ticket->delete_related_permanently('Price');
1925 1925
 				$ticket->delete_permanently();
@@ -1929,14 +1929,14 @@  discard block
 block discarded – undo
1929 1929
 
1930 1930
 		//what about related venues or terms?
1931 1931
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1932
-		foreach ( $venues as $venue ) {
1932
+		foreach ($venues as $venue) {
1933 1933
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1934 1934
 		}
1935 1935
 
1936 1936
 		//any attached question groups?
1937 1937
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1938
-		if ( !empty( $question_groups ) ) {
1939
-			foreach ( $question_groups as $question_group ) {
1938
+		if ( ! empty($question_groups)) {
1939
+			foreach ($question_groups as $question_group) {
1940 1940
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1941 1941
 			}
1942 1942
 		}
@@ -1945,12 +1945,12 @@  discard block
 block discarded – undo
1945 1945
 
1946 1946
 
1947 1947
 		//Message Template Groups
1948
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1948
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1949 1949
 
1950 1950
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1951 1951
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1952 1952
 
1953
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1953
+		foreach ($term_taxonomies as $term_taxonomy) {
1954 1954
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1955 1955
 		}
1956 1956
 
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1965 1965
 			return FALSE;
1966 1966
 		}
1967
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1967
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1968 1968
 		return TRUE;
1969 1969
 	}
1970 1970
 
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events() {
1983 1983
 
1984
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1984
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1985 1985
 		return $count;
1986 1986
 	}
1987 1987
 
@@ -1996,10 +1996,10 @@  discard block
 block discarded – undo
1996 1996
 	 */
1997 1997
 	public function total_events_draft() {
1998 1998
 		$where = array(
1999
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1999
+			'status' => array('IN', array('draft', 'auto-draft'))
2000 2000
 			);
2001 2001
 
2002
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2002
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2003 2003
 		return $count;
2004 2004
 	}
2005 2005
 
@@ -2018,7 +2018,7 @@  discard block
 block discarded – undo
2018 2018
 			'status' => 'trash'
2019 2019
 			);
2020 2020
 
2021
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2021
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2022 2022
 		return $count;
2023 2023
 	}
2024 2024
 
@@ -2046,11 +2046,11 @@  discard block
 block discarded – undo
2046 2046
 			// translated
2047 2047
 			TRUE
2048 2048
 		);
2049
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2049
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2050 2050
 
2051 2051
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2052 2052
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2053
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2053
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2054 2054
 		$this->display_admin_page_with_sidebar();
2055 2055
 	}
2056 2056
 
@@ -2076,9 +2076,9 @@  discard block
 block discarded – undo
2076 2076
 
2077 2077
 	protected function _template_settings() {
2078 2078
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2079
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2080
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2081
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2079
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2080
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2081
+		$this->display_admin_caf_preview_page('template_settings_tab');
2082 2082
 	}
2083 2083
 
2084 2084
 
@@ -2091,22 +2091,22 @@  discard block
 block discarded – undo
2091 2091
 	 * @return void
2092 2092
 	 */
2093 2093
 	private function _set_category_object() {
2094
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2094
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2095 2095
 			return; //already have the category object so get out.
2096 2096
 
2097 2097
 		//set default category object
2098 2098
 		$this->_set_empty_category_object();
2099 2099
 
2100 2100
 		//only set if we've got an id
2101
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2101
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2102 2102
 			return;
2103 2103
 		}
2104 2104
 
2105 2105
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2106 2106
 
2107
-		$term = get_term( $category_id, 'espresso_event_categories' );
2107
+		$term = get_term($category_id, 'espresso_event_categories');
2108 2108
 
2109
-		if ( !empty( $term ) ) {
2109
+		if ( ! empty($term)) {
2110 2110
 			$this->_category->category_name = $term->name;
2111 2111
 			$this->_category->category_identifier = $term->slug;
2112 2112
 			$this->_category->category_desc = $term->description;
@@ -2120,13 +2120,13 @@  discard block
 block discarded – undo
2120 2120
 
2121 2121
 	private function _set_empty_category_object() {
2122 2122
 		$this->_category = new stdClass();
2123
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2123
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2124 2124
 		$this->_category->id = $this->_category->parent = 0;
2125 2125
 	}
2126 2126
 
2127 2127
 
2128 2128
 	protected function _category_list_table() {
2129
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2129
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2130 2130
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2131 2131
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2132 2132
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2136,22 +2136,22 @@  discard block
 block discarded – undo
2136 2136
 	protected function _category_details($view) {
2137 2137
 
2138 2138
 		//load formatter helper
2139
-		EE_Registry::instance()->load_helper( 'Formatter' );
2139
+		EE_Registry::instance()->load_helper('Formatter');
2140 2140
 		//load field generator helper
2141
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2141
+		EE_Registry::instance()->load_helper('Form_Fields');
2142 2142
 
2143 2143
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2144 2144
 		$this->_set_add_edit_form_tags($route);
2145 2145
 
2146 2146
 		$this->_set_category_object();
2147
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2147
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2148 2148
 
2149 2149
 		$delete_action = 'delete_category';
2150 2150
 
2151 2151
 		//custom redirect
2152
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2152
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2153 2153
 
2154
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2154
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2155 2155
 
2156 2156
 		//take care of contents
2157 2157
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2165,25 +2165,25 @@  discard block
 block discarded – undo
2165 2165
 			'type' => 'wp_editor',
2166 2166
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2167 2167
 			'class' => 'my_editor_custom',
2168
-			'wpeditor_args' => array('media_buttons' => FALSE )
2168
+			'wpeditor_args' => array('media_buttons' => FALSE)
2169 2169
 		);
2170
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2170
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2171 2171
 
2172
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2172
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2173 2173
 
2174 2174
 		//setup category select for term parents.
2175 2175
 		$category_select_values[] = array(
2176 2176
 			'text' => __('No Parent', 'event_espresso'),
2177 2177
 			'id' => 0
2178 2178
 			);
2179
-		foreach ( $all_terms as $term ) {
2179
+		foreach ($all_terms as $term) {
2180 2180
 			$category_select_values[] = array(
2181 2181
 				'text' => $term->name,
2182 2182
 				'id' => $term->term_id
2183 2183
 				);
2184 2184
 		}
2185 2185
 
2186
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2186
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2187 2187
 
2188 2188
 		$template_args = array(
2189 2189
 			'category' => $this->_category,
@@ -2193,15 +2193,15 @@  discard block
 block discarded – undo
2193 2193
 			'disable' => '',
2194 2194
 			'disabled_message' => FALSE
2195 2195
 			);
2196
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2197
-		return EEH_Template::display_template($template, $template_args, TRUE );
2196
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2197
+		return EEH_Template::display_template($template, $template_args, TRUE);
2198 2198
 	}
2199 2199
 
2200 2200
 
2201 2201
 	protected function _delete_categories() {
2202
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2202
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2203 2203
 
2204
-		foreach ( $cat_ids as $cat_id ) {
2204
+		foreach ($cat_ids as $cat_id) {
2205 2205
 			$this->_delete_category($cat_id);
2206 2206
 		}
2207 2207
 
@@ -2209,7 +2209,7 @@  discard block
 block discarded – undo
2209 2209
 		$query_args = array(
2210 2210
 			'action' => 'category_list'
2211 2211
 			);
2212
-		$this->_redirect_after_action(0,'','',$query_args);
2212
+		$this->_redirect_after_action(0, '', '', $query_args);
2213 2213
 
2214 2214
 	}
2215 2215
 
@@ -2219,61 +2219,61 @@  discard block
 block discarded – undo
2219 2219
 
2220 2220
 	protected function _delete_category($cat_id) {
2221 2221
 		global $wpdb;
2222
-		$cat_id = absint( $cat_id );
2223
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2222
+		$cat_id = absint($cat_id);
2223
+		wp_delete_term($cat_id, 'espresso_event_categories');
2224 2224
 	}
2225 2225
 
2226 2226
 
2227 2227
 
2228 2228
 	protected function _insert_or_update_category($new_category) {
2229 2229
 
2230
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2230
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2231 2231
 		$success = 0; //we already have a success message so lets not send another.
2232 2232
 
2233
-		if ( $cat_id ) {
2233
+		if ($cat_id) {
2234 2234
 			$query_args = array(
2235 2235
 				'action'     => 'edit_category',
2236 2236
 				'EVT_CAT_ID' => $cat_id
2237 2237
 			);
2238 2238
 		} else {
2239
-			$query_args = array( 'action' => 'add_category' );
2239
+			$query_args = array('action' => 'add_category');
2240 2240
 		}
2241
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2241
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2242 2242
 
2243 2243
 	}
2244 2244
 
2245 2245
 
2246 2246
 
2247
-	private function _insert_category( $update = FALSE ) {
2247
+	private function _insert_category($update = FALSE) {
2248 2248
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2249
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2250
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2251
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2249
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2250
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2251
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2252 2252
 
2253
-		if ( empty( $category_name ) ) {
2254
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if (empty($category_name)) {
2254
+			$msg = __('You must add a name for the category.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 			return false;
2257 2257
 		}
2258 2258
 
2259
-		$term_args=array(
2259
+		$term_args = array(
2260 2260
 			'name'=>$category_name,
2261 2261
 			'description'=>$category_desc,
2262 2262
 			'parent'=>$category_parent
2263 2263
 		);
2264 2264
 		//was the category_identifier input disabled?
2265
-		if(isset($this->_req_data['category_identifier'])){
2265
+		if (isset($this->_req_data['category_identifier'])) {
2266 2266
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2267 2267
 		}
2268
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2268
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2269 2269
 
2270
-		if ( !is_array( $insert_ids ) ) {
2271
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2272
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2270
+		if ( ! is_array($insert_ids)) {
2271
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2272
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2273 2273
 		} else {
2274 2274
 			$cat_id = $insert_ids['term_id'];
2275
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2276
-			EE_Error::add_success( $msg );
2275
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2276
+			EE_Error::add_success($msg);
2277 2277
 		}
2278 2278
 
2279 2279
 		return $cat_id;
@@ -2282,32 +2282,32 @@  discard block
 block discarded – undo
2282 2282
 
2283 2283
 
2284 2284
 
2285
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2285
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2286 2286
 		global $wpdb;
2287 2287
 
2288 2288
 		//testing term stuff
2289
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2290
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2291
-		$limit = ($current_page-1)*$per_page;
2289
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2290
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2291
+		$limit = ($current_page - 1) * $per_page;
2292 2292
 
2293
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2293
+		$where = array('taxonomy' => 'espresso_event_categories');
2294 2294
 
2295
-		if ( isset( $this->_req_data['s'] ) ) {
2296
-			$sstr = '%' . $this->_req_data['s'] . '%';
2295
+		if (isset($this->_req_data['s'])) {
2296
+			$sstr = '%'.$this->_req_data['s'].'%';
2297 2297
 			$where['OR'] = array(
2298
-				'Term.name' => array( 'LIKE', $sstr),
2299
-				'description' => array( 'LIKE', $sstr )
2298
+				'Term.name' => array('LIKE', $sstr),
2299
+				'description' => array('LIKE', $sstr)
2300 2300
 				);
2301 2301
 		}
2302 2302
 
2303 2303
 		$query_params = array(
2304
-			$where ,
2305
-			'order_by' => array( $orderby => $order ),
2306
-			'limit' => $limit . ',' . $per_page,
2304
+			$where,
2305
+			'order_by' => array($orderby => $order),
2306
+			'limit' => $limit.','.$per_page,
2307 2307
 			'force_join' => array('Term')
2308 2308
 			);
2309 2309
 
2310
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2310
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2311 2311
 
2312 2312
 		return $categories;
2313 2313
 	}
Please login to merge, or discard this patch.
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -1484,10 +1485,11 @@  discard block
 block discarded – undo
1484 1485
 			//get the earliest datetime (if present);
1485 1486
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1486 1487
 
1487
-			if ( !empty( $earliest_dtt ) )
1488
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1489
-			else
1490
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1488
+			if ( !empty( $earliest_dtt ) ) {
1489
+							$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1490
+			} else {
1491
+							$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1492
+			}
1491 1493
 		}
1492 1494
 
1493 1495
 		$template_args = array_merge( $template_args, $price_args );
@@ -1725,8 +1727,9 @@  discard block
 block discarded – undo
1725 1727
 		}
1726 1728
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1727 1729
 
1728
-		if ( $redirect_after )
1729
-			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1730
+		if ( $redirect_after ) {
1731
+					$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1732
+		}
1730 1733
 	}
1731 1734
 
1732 1735
 	/**
@@ -1853,8 +1856,9 @@  discard block
 block discarded – undo
1853 1856
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1854 1857
 		}
1855 1858
 
1856
-		if ( $redirect_after )
1857
-			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1859
+		if ( $redirect_after ) {
1860
+					$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1861
+		}
1858 1862
 	}
1859 1863
 
1860 1864
 	/**
@@ -2091,8 +2095,10 @@  discard block
 block discarded – undo
2091 2095
 	 * @return void
2092 2096
 	 */
2093 2097
 	private function _set_category_object() {
2094
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2095
-			return; //already have the category object so get out.
2098
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
2099
+					return;
2100
+		}
2101
+		//already have the category object so get out.
2096 2102
 
2097 2103
 		//set default category object
2098 2104
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.