Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
201:19 queued 184:10
created
core/admin/EE_Admin.core.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function instance() {
42 42
 		// check if class object is instantiated
43
-		if (  ! self::$_instance instanceof EE_Admin ) {
43
+		if ( ! self::$_instance instanceof EE_Admin) {
44 44
 			self::$_instance = new self();
45 45
 		}
46 46
 		return self::$_instance;
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		// define global EE_Admin constants
58 58
 		$this->_define_all_constants();
59 59
 		// set autoloaders for our admin page classes based on included path information
60
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
60
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
61 61
 		// admin hooks
62
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
62
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
63 63
 		// load EE_Request_Handler early
64
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
65
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
64
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
65
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
66 66
 		// post shortcode tracking
67 67
 		add_action(
68 68
 			'AHEE__EE_System__initialize_last',
69
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
69
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
70 70
 		);
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin === $main_file ) {
122
+		 if ($plugin === $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$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>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$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>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -174,31 +174,31 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177
-		if ( EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance ){
177
+		if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
178 178
 			//ok so we want to enable the entire admin
179
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
180
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
179
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
180
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
181
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
182 182
 			//at a glance dashboard widget
183
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
183
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
184 184
 			//filter for get_edit_post_link used on comments for custom post types
185
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
185
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
186 186
 		}
187 187
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
188
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
188
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
189 189
 			try {
190 190
 				//this loads the controller for the admin pages which will setup routing etc
191
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
192
-			} catch ( EE_Error $e ) {
191
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
192
+			} catch (EE_Error $e) {
193 193
 				$e->get_error();
194 194
 			}
195 195
 		}
196
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
196
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
197 197
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
198
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
199
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
198
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
199
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
200 200
 		//exclude EE critical pages from all nav menus and wp_list_pages
201
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
201
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
202 202
 	}
203 203
 
204 204
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param  object $post_type WP post type object
212 212
 	 * @return object            WP post type object
213 213
 	 */
214
-	public function remove_pages_from_nav_menu( $post_type ) {
214
+	public function remove_pages_from_nav_menu($post_type) {
215 215
 		//if this isn't the "pages" post type let's get out
216
-		if ( $post_type->name !== 'page' ) {
216
+		if ($post_type->name !== 'page') {
217 217
 			return $post_type;
218 218
 		}
219 219
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function enable_hidden_ee_nav_menu_metaboxes() {
235 235
 		global $wp_meta_boxes, $pagenow;
236
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
236
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
237 237
 			return;
238 238
 		}
239 239
 		$user = wp_get_current_user();
240 240
 		//has this been done yet?
241
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
241
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
246
-		$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' ) );
245
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
246
+		$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'));
247 247
 
248
-		if ( is_array( $hidden_meta_boxes ) ) {
249
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
250
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
251
-					unset( $hidden_meta_boxes[ $key ] );
248
+		if (is_array($hidden_meta_boxes)) {
249
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
250
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
251
+					unset($hidden_meta_boxes[$key]);
252 252
 				}
253 253
 			}
254 254
 		}
255 255
 
256
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
257
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
256
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
257
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
258 258
 	}
259 259
 
260 260
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return void
274 274
 	 */
275 275
 	public function register_custom_nav_menu_boxes() {
276
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
276
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
277 277
 	}
278 278
 
279 279
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string  the (maybe) modified link
291 291
 	 */
292
-	public function modify_edit_post_link( $link, $id ) {
293
-		if ( ! $post = get_post( $id ) ){
292
+	public function modify_edit_post_link($link, $id) {
293
+		if ( ! $post = get_post($id)) {
294 294
 			return $link;
295 295
 		}
296
-		if ( $post->post_type === 'espresso_attendees' ) {
296
+		if ($post->post_type === 'espresso_attendees') {
297 297
 			$query_args = array(
298 298
 				'action' => 'edit_attendee',
299 299
 				'post' => $id
300 300
 			);
301
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
301
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
302 302
 		}
303 303
 		return $link;
304 304
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		global $nav_menu_selected_id;
311 311
 
312 312
 		$db_fields = false;
313
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
313
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
314 314
 		$current_tab = 'event-archives';
315 315
 
316 316
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 		?>
330 330
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
331 331
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
332
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
333
-					<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">
334
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
332
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
333
+					<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">
334
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
335 335
 					</a>
336 336
 				</li>
337 337
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
  			<?php */ ?>
350 350
 
351 351
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
352
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
352
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
353 353
 			?>">
354 354
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
355 355
 					<?php
356 356
 					$pages = $this->_get_extra_nav_menu_pages_items();
357 357
 					$args['walker'] = $walker;
358
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
358
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
359 359
 					?>
360 360
 				</ul>
361 361
 			</div><!-- /.tabs-panel -->
@@ -363,18 +363,18 @@  discard block
 block discarded – undo
363 363
 			<p class="button-controls">
364 364
 				<span class="list-controls">
365 365
 					<a href="<?php
366
-						echo esc_url( add_query_arg(
366
+						echo esc_url(add_query_arg(
367 367
 							array(
368 368
 								'extra-nav-menu-pages-tab' => 'event-archives',
369 369
 								'selectall' => 1,
370 370
 							),
371
-							remove_query_arg( $removed_args )
371
+							remove_query_arg($removed_args)
372 372
 						));
373 373
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
374 374
 				</span>
375 375
 
376 376
 				<span class="add-to-menu">
377
-					<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' ); ?>" />
377
+					<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'); ?>" />
378 378
 					<span class="spinner"></span>
379 379
 				</span>
380 380
 			</p>
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 	private function _get_extra_nav_menu_pages_items() {
396 396
 		$menuitems[] = array(
397 397
 			'title' => __('Event List', 'event_espresso'),
398
-			'url' => get_post_type_archive_link( 'espresso_events' ),
398
+			'url' => get_post_type_archive_link('espresso_events'),
399 399
 			'description' => __('Archive page for all events.', 'event_espresso')
400 400
 		);
401
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
401
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
402 402
 	}
403 403
 
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @param $menu_item_values
411 411
 	 * @return stdClass
412 412
 	 */
413
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
413
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
414 414
 		$menu_item = new stdClass();
415 415
 		$keys = array(
416 416
 			'ID' => 0,
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			'xfn' => ''
431 431
 		);
432 432
 
433
-		foreach ( $keys as $key => $value) {
434
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
433
+		foreach ($keys as $key => $value) {
434
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
435 435
 		}
436 436
 		return $menu_item;
437 437
 	}
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 		 * - check if doing post processing of one of EE CPTs
471 471
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
472 472
 		 */
473
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
474
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
475
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
473
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
474
+			EE_Registry::instance()->load_core('Register_CPTs');
475
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
476 476
 		}
477 477
 
478 478
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
482 482
 		 */
483 483
 		global $pagenow;
484
-		if ( $pagenow === 'options-reading.php' ) {
485
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
484
+		if ($pagenow === 'options-reading.php') {
485
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
486 486
 		}
487 487
 
488 488
 	}
@@ -494,25 +494,25 @@  discard block
 block discarded – undo
494 494
 	 * @param string $output  Current output.
495 495
 	 * @return string
496 496
 	 */
497
-	public function modify_dropdown_pages( $output ) {
497
+	public function modify_dropdown_pages($output) {
498 498
 		//get critical pages
499 499
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
500 500
 
501 501
 		//split current output by line break for easier parsing.
502
-		$split_output = explode( "\n", $output );
502
+		$split_output = explode("\n", $output);
503 503
 
504 504
 		//loop through to remove any critical pages from the array.
505
-		foreach ( $critical_pages as $page_id ) {
506
-			$needle = 'value="' . $page_id . '"';
507
-			foreach( $split_output as $key => $haystack ) {
508
-				if( strpos( $haystack, $needle ) !== false ) {
509
-					unset( $split_output[$key] );
505
+		foreach ($critical_pages as $page_id) {
506
+			$needle = 'value="'.$page_id.'"';
507
+			foreach ($split_output as $key => $haystack) {
508
+				if (strpos($haystack, $needle) !== false) {
509
+					unset($split_output[$key]);
510 510
 				}
511 511
 			}
512 512
 		}
513 513
 
514 514
 		//replace output with the new contents
515
-		return implode( "\n", $split_output );
515
+		return implode("\n", $split_output);
516 516
 	}
517 517
 
518 518
 
@@ -526,36 +526,36 @@  discard block
 block discarded – undo
526 526
 	public function enqueue_admin_scripts() {
527 527
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
528 528
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
529
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
529
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
530 530
 		// register cookie script for future dependencies
531
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
531
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
532 532
 		// 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' );
533
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
533
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
534 534
 			// register jQuery Validate
535
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
535
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
536 536
 		}
537 537
 		//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' );
538
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
538
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
539 539
 			//joyride style
540
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
541
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
542
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
540
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
541
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
542
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
543 543
 			//joyride JS
544
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
544
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
545 545
 			// wanna go for a joyride?
546 546
 			wp_enqueue_style('ee-joyride-css');
547 547
 			wp_enqueue_script('jquery-joyride');
548 548
 		}
549 549
 		//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' );
550
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
550
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
551 551
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
552 552
 		}
553 553
 		//accounting.js library
554 554
 		// @link http://josscrowcroft.github.io/accounting.js/
555
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
556
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
557
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
558
-			wp_enqueue_script( 'ee-accounting' );
555
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
556
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
557
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
558
+			wp_enqueue_script('ee-accounting');
559 559
 			// array of settings to get converted to JSON array via wp_localize_script
560 560
 			$currency_config = array(
561 561
 				'currency' => array(
@@ -602,11 +602,11 @@  discard block
 block discarded – undo
602 602
 	public function get_persistent_admin_notices() {
603 603
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
604 604
 		$args = array(
605
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
606
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
605
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
606
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
607 607
 		);
608
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
609
-		echo EE_Error::get_persistent_admin_notices( $return_url );
608
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
609
+		echo EE_Error::get_persistent_admin_notices($return_url);
610 610
 	}
611 611
 
612 612
 
@@ -627,26 +627,26 @@  discard block
 block discarded – undo
627 627
 	 * @param $elements
628 628
 	 * @return array
629 629
 	 */
630
-	public function dashboard_glance_items( $elements ) {
630
+	public function dashboard_glance_items($elements) {
631 631
 		$events = EEM_Event::instance()->count();
632
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
633
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
632
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
633
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
634 634
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
635 635
 		$registrations = EEM_Registration::instance()->count(
636 636
 			array(
637 637
 				array(
638
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
638
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
639 639
 				)
640 640
 			)
641 641
 		);
642
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
643
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
642
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
643
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
644 644
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
645 645
 
646
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
646
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
647 647
 
648
-		foreach ( $items as $type => $item_properties ) {
649
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
648
+		foreach ($items as $type => $item_properties) {
649
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
650 650
 		}
651 651
 		return $elements;
652 652
 	}
@@ -663,31 +663,31 @@  discard block
 block discarded – undo
663 663
 	 * @throws EE_Error
664 664
 	 * @return    string
665 665
 	 */
666
-	public function check_for_invalid_datetime_formats( $value, $option ) {
666
+	public function check_for_invalid_datetime_formats($value, $option) {
667 667
 		// check for date_format or time_format
668
-		switch ( $option ) {
668
+		switch ($option) {
669 669
 			case 'date_format' :
670
-				$date_time_format = $value . ' ' . get_option('time_format');
670
+				$date_time_format = $value.' '.get_option('time_format');
671 671
 				break;
672 672
 			case 'time_format' :
673
-				$date_time_format = get_option('date_format') . ' ' . $value;
673
+				$date_time_format = get_option('date_format').' '.$value;
674 674
 				break;
675 675
 			default :
676 676
 				$date_time_format = FALSE;
677 677
 		}
678 678
 		// do we have a date_time format to check ?
679
-		if ( $date_time_format ) {
680
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
679
+		if ($date_time_format) {
680
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
681 681
 
682
-			if ( is_array( $error_msg ) ) {
683
-				$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>';
682
+			if (is_array($error_msg)) {
683
+				$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>';
684 684
 
685 685
 
686
-				foreach ( $error_msg as $error ) {
687
-					$msg .= '<li>' . $error . '</li>';
686
+				foreach ($error_msg as $error) {
687
+					$msg .= '<li>'.$error.'</li>';
688 688
 				}
689 689
 
690
-				$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>';
690
+				$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>';
691 691
 
692 692
 				// trigger WP settings error
693 693
 				add_settings_error(
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 				);
698 698
 
699 699
 				// set format to something valid
700
-				switch ( $option ) {
700
+				switch ($option) {
701 701
 					case 'date_format' :
702 702
 						$value = 'F j, Y';
703 703
 						break;
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
 	 * @param $content
720 720
 	 * @return    string
721 721
 	 */
722
-	public function its_eSpresso( $content ) {
723
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
722
+	public function its_eSpresso($content) {
723
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
724 724
 	}
725 725
 
726 726
 
@@ -733,9 +733,9 @@  discard block
 block discarded – undo
733 733
 	 */
734 734
 	public function espresso_admin_footer() {
735 735
 		return sprintf(
736
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
736
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
737 737
 			'<a href="https://eventespresso.com/" title="',
738
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
738
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
739 739
 		);
740 740
 	}
741 741
 
@@ -755,12 +755,12 @@  discard block
 block discarded – undo
755 755
 	 * @param array $config
756 756
 	 * @return void
757 757
 	 */
758
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
759
-		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' );
760
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
758
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
759
+		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');
760
+		if (class_exists('EE_Register_Admin_Page')) {
761 761
 			$config['page_path'] = $page_path;
762 762
 		}
763
-		EE_Register_Admin_Page::register( $page_basename, $config );
763
+		EE_Register_Admin_Page::register($page_basename, $config);
764 764
 
765 765
 	}
766 766
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 	 * @param  \WP_Post $post
774 774
 	 * @return void
775 775
 	 */
776
-	public static function parse_post_content_on_save( $post_ID, $post ) {
776
+	public static function parse_post_content_on_save($post_ID, $post) {
777 777
 		EE_Error::doing_it_wrong(
778 778
 			__METHOD__,
779 779
 			__(
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 			),
783 783
 			'4.8.41'
784 784
 		);
785
-		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post );
785
+		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post);
786 786
 	}
787 787
 
788 788
 
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 	 * @param  $value
796 796
 	 * @return void
797 797
 	 */
798
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
798
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
799 799
 		EE_Error::doing_it_wrong(
800 800
 			__METHOD__,
801 801
 			__(
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			),
805 805
 			'4.8.41'
806 806
 		);
807
-		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value );
807
+		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value);
808 808
 	}
809 809
 
810 810
 }
Please login to merge, or discard this patch.
core/CPTs/CptQueryModifier.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 
128 128
 	/**
129
-	 * @return \EEM_Base[]
129
+	 * @return \EE_Table_Base[]
130 130
 	 */
131 131
 	public function modelTables() {
132 132
 		return $this->model_tables;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 
203 203
 	/**
204
-	 * @return \EE_Request
204
+	 * @return \EE_Request_Handler
205 205
 	 */
206 206
 	public function request() {
207 207
 		return $this->request;
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -447,14 +447,14 @@
 block discarded – undo
447 447
 			global $wpdb;
448 448
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
449 449
 			$SQL .= ' LEFT JOIN '
450
-			        . $this->meta_table->get_table_name()
451
-			        . ' ON ( '
452
-			        . $this->meta_table->get_table_name()
453
-			        . '.'
454
-			        . $this->meta_table->get_fk_on_table()
455
-			        . ' = '
456
-			        . $wpdb->posts
457
-			        . '.ID ) ';
450
+					. $this->meta_table->get_table_name()
451
+					. ' ON ( '
452
+					. $this->meta_table->get_table_name()
453
+					. '.'
454
+					. $this->meta_table->get_fk_on_table()
455
+					. ' = '
456
+					. $wpdb->posts
457
+					. '.ID ) ';
458 458
 		}
459 459
 		remove_filter( 'posts_join', array( $this, 'postsJoin' ) );
460 460
 		return $SQL;
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Strategy.core.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * CPT_Strategy
4 4
  *
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		// check if class object is instantiated
72
-		if ( ! self::$_instance instanceof EE_CPT_Strategy ) {
72
+		if ( ! self::$_instance instanceof EE_CPT_Strategy) {
73 73
 			self::$_instance = new self();
74 74
 		}
75 75
 		return self::$_instance;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$this->_CPTs = EE_Register_CPTs::get_CPTs();
87 87
 		$this->_CPT_endpoints = $this->_set_CPT_endpoints();
88 88
 		$this->_CPT_taxonomies = EE_Register_CPTs::get_taxonomies();
89
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 );
89
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 5);
90 90
 	}
91 91
 
92 92
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	private function _set_CPT_endpoints() {
122 122
 		$_CPT_endpoints = array();
123
-		if ( is_array( $this->_CPTs )) {
124
-			foreach ( $this->_CPTs as $CPT_type => $CPT ) {
125
-				$_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type;
123
+		if (is_array($this->_CPTs)) {
124
+			foreach ($this->_CPTs as $CPT_type => $CPT) {
125
+				$_CPT_endpoints [$CPT['plural_slug']] = $CPT_type;
126 126
 			}
127 127
 		}
128 128
 		return $_CPT_endpoints;
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 	 * @param WP_Query $WP_Query
141 141
 	 * @return void
142 142
 	 */
143
-	public function pre_get_posts( $WP_Query ) {
143
+	public function pre_get_posts($WP_Query) {
144 144
 		// check that post-type is set
145
-		if ( ! $WP_Query instanceof WP_Query ) {
145
+		if ( ! $WP_Query instanceof WP_Query) {
146 146
 			return;
147 147
 		}
148 148
 		// add our conditionals
149
-		$this->_set_EE_tags_on_WP_Query( $WP_Query );
149
+		$this->_set_EE_tags_on_WP_Query($WP_Query);
150 150
 		// check for terms
151
-		$this->_set_post_type_for_terms( $WP_Query );
151
+		$this->_set_post_type_for_terms($WP_Query);
152 152
 		// make sure paging is always set
153
-		$this->_set_paging( $WP_Query );
153
+		$this->_set_paging($WP_Query);
154 154
 		// is a taxonomy set ?
155
-		$this->_set_CPT_taxonomies_on_WP_Query( $WP_Query );
155
+		$this->_set_CPT_taxonomies_on_WP_Query($WP_Query);
156 156
 		// loop thru post_types if set
157
-		$this->_process_WP_Query_post_types( $WP_Query );
157
+		$this->_process_WP_Query_post_types($WP_Query);
158 158
 	}
159 159
 
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param WP_Query $WP_Query
166 166
 	 * @return void
167 167
 	 */
168
-	private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) {
168
+	private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) {
169 169
 		$WP_Query->is_espresso_event_single = FALSE;
170 170
 		$WP_Query->is_espresso_event_archive = FALSE;
171 171
 		$WP_Query->is_espresso_event_taxonomy = FALSE;
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @return void
184 184
 	 */
185 185
 	private function _set_CPT_terms() {
186
-		if ( empty( $this->_CPT_terms )) {
186
+		if (empty($this->_CPT_terms)) {
187 187
 			$terms = EEM_Term::instance()->get_all_CPT_post_tags();
188
-			foreach ( $terms as $term ) {
189
-				if ( $term instanceof EE_Term ) {
190
-					$this->_CPT_terms[ $term->slug() ] = $term;
188
+			foreach ($terms as $term) {
189
+				if ($term instanceof EE_Term) {
190
+					$this->_CPT_terms[$term->slug()] = $term;
191 191
 				}
192 192
 			}
193 193
 		}
@@ -202,24 +202,24 @@  discard block
 block discarded – undo
202 202
 	 * @param $WP_Query
203 203
 	 * @return void
204 204
 	 */
205
-	private function _set_post_type_for_terms( WP_Query $WP_Query ) {
205
+	private function _set_post_type_for_terms(WP_Query $WP_Query) {
206 206
 		// is a tag set ?
207
-		if ( isset( $WP_Query->query['tag'] )) {
207
+		if (isset($WP_Query->query['tag'])) {
208 208
 			// set post_tags
209 209
 			$this->_set_CPT_terms();
210 210
 			// is this tag archive term in the list of terms used by our CPTs ?
211
-			$term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL;
211
+			$term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL;
212 212
 			// verify the term
213
-			if ( $term instanceof EE_Term ) {
214
-				$term->post_type  = array_merge( array( 'post', 'page' ), (array)$term->post_type );
215
-				$term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term );
213
+			if ($term instanceof EE_Term) {
214
+				$term->post_type = array_merge(array('post', 'page'), (array) $term->post_type);
215
+				$term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term);
216 216
 				// if a post type is already set
217
-				if ( isset( $WP_Query->query_vars['post_type'] )) {
217
+				if (isset($WP_Query->query_vars['post_type'])) {
218 218
 						// add to existing array
219
-						$term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type );
219
+						$term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type);
220 220
 				}
221 221
 				// just set post_type to our CPT
222
-				$WP_Query->set( 'post_type', array_unique( $term->post_type ) );
222
+				$WP_Query->set('post_type', array_unique($term->post_type));
223 223
 			}
224 224
 		}
225 225
 	}
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 	 * @param WP_Query $WP_Query
234 234
 	 * @return void
235 235
 	 */
236
-	public function _set_paging( $WP_Query ) {
237
-		if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) {
236
+	public function _set_paging($WP_Query) {
237
+		if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) {
238 238
 			$page = get_query_var('page') ? get_query_var('page') : NULL;
239 239
 			$paged = get_query_var('paged') ? get_query_var('paged') : $page;
240
-			$WP_Query->set( 'paged', $paged );
240
+			$WP_Query->set('paged', $paged);
241 241
 		}
242 242
 	}
243 243
 
@@ -247,28 +247,28 @@  discard block
 block discarded – undo
247 247
 	 * @access protected
248 248
 	 * @param \WP_Query $WP_Query
249 249
 	 */
250
-	protected function _set_CPT_taxonomies_on_WP_Query( WP_Query $WP_Query ) {
250
+	protected function _set_CPT_taxonomies_on_WP_Query(WP_Query $WP_Query) {
251 251
 		// is a taxonomy set ?
252
-		if ( $WP_Query->is_tax ) {
252
+		if ($WP_Query->is_tax) {
253 253
 			// loop thru our taxonomies
254
-			foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) {
254
+			foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) {
255 255
 				// check if one of our taxonomies is set as a query var
256
-				if ( isset( $WP_Query->query[ $CPT_taxonomy ] ) ) {
256
+				if (isset($WP_Query->query[$CPT_taxonomy])) {
257 257
 					// but which CPT does that correspond to??? hmmm... guess we gotta go looping
258
-					foreach ( $this->_CPTs as $post_type => $CPT ) {
258
+					foreach ($this->_CPTs as $post_type => $CPT) {
259 259
 						// verify our CPT has args, is public and has taxonomies set
260 260
 						if (
261
-							isset( $CPT['args'], $CPT['args']['public'] )
261
+							isset($CPT['args'], $CPT['args']['public'])
262 262
 							&& $CPT['args']['public']
263
-							&& ! empty( $CPT['args']['taxonomies'] )
264
-							&& in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )
263
+							&& ! empty($CPT['args']['taxonomies'])
264
+							&& in_array($CPT_taxonomy, $CPT['args']['taxonomies'])
265 265
 						) {
266 266
 							// if so, then add this CPT post_type to the current query's array of post_types'
267
-							$WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] )
267
+							$WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type'])
268 268
 								? (array) $WP_Query->query_vars['post_type']
269 269
 								: array();
270 270
 							$WP_Query->query_vars['post_type'][] = $post_type;
271
-							switch ( $post_type ) {
271
+							switch ($post_type) {
272 272
 								case 'espresso_events' :
273 273
 									$WP_Query->is_espresso_event_taxonomy = true;
274 274
 									break;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 									break;
278 278
 								default :
279 279
 									do_action(
280
-										'AHEE__EE_CPT_Strategy___set_CPT_taxonomies_on_WP_Query__for_' . $post_type . '_post_type',
280
+										'AHEE__EE_CPT_Strategy___set_CPT_taxonomies_on_WP_Query__for_'.$post_type.'_post_type',
281 281
 										$WP_Query,
282 282
 										$this
283 283
 									);
@@ -295,24 +295,24 @@  discard block
 block discarded – undo
295 295
 	 * @access public
296 296
 	 * @param \WP_Query $WP_Query
297 297
 	 */
298
-	protected function _process_WP_Query_post_types( WP_Query $WP_Query ) {
299
-		if ( isset( $WP_Query->query_vars['post_type'] ) ) {
298
+	protected function _process_WP_Query_post_types(WP_Query $WP_Query) {
299
+		if (isset($WP_Query->query_vars['post_type'])) {
300 300
 			// loop thru post_types as array
301
-			foreach ( (array) $WP_Query->query_vars['post_type'] as $post_type ) {
301
+			foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) {
302 302
 				// is current query for an EE CPT ?
303
-				if ( isset( $this->_CPTs[ $post_type ] ) ) {
303
+				if (isset($this->_CPTs[$post_type])) {
304 304
 					// is EE on or off ?
305
-					if ( EE_Maintenance_Mode::instance()->level() ) {
305
+					if (EE_Maintenance_Mode::instance()->level()) {
306 306
 						// reroute CPT template view to maintenance_mode.template.php
307
-						if ( ! has_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ) ) ) {
308
-							add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 );
307
+						if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) {
308
+							add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999);
309 309
 						}
310
-						if ( has_filter( 'the_content', array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) {
311
-							add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 );
310
+						if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) {
311
+							add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1);
312 312
 						}
313 313
 						return;
314 314
 					}
315
-					$this->_generate_CptQueryModifier( $WP_Query, $post_type );
315
+					$this->_generate_CptQueryModifier($WP_Query, $post_type);
316 316
 				}
317 317
 			}
318 318
 		}
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 * @param \WP_Query $WP_Query
325 325
 	 * @param string    $post_type
326 326
 	 */
327
-	protected function _generate_CptQueryModifier( WP_Query $WP_Query, $post_type ) {
327
+	protected function _generate_CptQueryModifier(WP_Query $WP_Query, $post_type) {
328 328
 		$this->query_modifier = new EventEspresso\Core\CPTs\CptQueryModifier(
329 329
 			$post_type,
330
-			$this->_CPTs[ $post_type ],
330
+			$this->_CPTs[$post_type],
331 331
 			$WP_Query,
332 332
 			EE_Registry::instance()->REQ
333 333
 		);
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
 	 * @param  $SQL
371 371
 	 * @return string
372 372
 	 */
373
-	public function posts_fields( $SQL ) {
374
-		remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1 );
375
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
376
-			return $this->query_modifier->postsFields( $SQL );
373
+	public function posts_fields($SQL) {
374
+		remove_filter('posts_fields', array($this, 'posts_fields'), 1);
375
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
376
+			return $this->query_modifier->postsFields($SQL);
377 377
 		}
378 378
 		return $SQL;
379 379
 	}
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 	 * @param  $SQL
388 388
 	 * @return string
389 389
 	 */
390
-	public function posts_join( $SQL ) {
391
-		remove_filter( 'posts_join', array( $this, 'posts_join' ), 1 );
392
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
393
-			return $this->query_modifier->postsJoin( $SQL );
390
+	public function posts_join($SQL) {
391
+		remove_filter('posts_join', array($this, 'posts_join'), 1);
392
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
393
+			return $this->query_modifier->postsJoin($SQL);
394 394
 		}
395 395
 		return $SQL;
396 396
 	}
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
 	 * @param  \WP_Post[] $posts
405 405
 	 * @return \WP_Post[]
406 406
 	 */
407
-	public function the_posts( $posts ) {
408
-		remove_filter( 'the_posts',	array( $this, 'the_posts' ), 1 );
409
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
410
-			$this->query_modifier->thePosts( $posts );
407
+	public function the_posts($posts) {
408
+		remove_filter('the_posts', array($this, 'the_posts'), 1);
409
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
410
+			$this->query_modifier->thePosts($posts);
411 411
 		}
412 412
 		return $posts;
413 413
 	}
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 	 * @param $ID
423 423
 	 * @return string
424 424
 	 */
425
-	public function get_edit_post_link( $url, $ID ) {
426
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
427
-			return $this->query_modifier->getEditPostLink( $url, $ID );
425
+	public function get_edit_post_link($url, $ID) {
426
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
427
+			return $this->query_modifier->getEditPostLink($url, $ID);
428 428
 		}
429 429
 		return '';
430 430
 	}
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 	 * @access public
438 438
 	 * @param null $WP_Query
439 439
 	 */
440
-	protected function _do_template_filters( $WP_Query = null ) {
441
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
440
+	protected function _do_template_filters($WP_Query = null) {
441
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
442 442
 			$this->query_modifier->addTemplateFilters();
443 443
 		}
444 444
 	}
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
 	 * @param string $current_template Existing default template path derived for this page call.
453 453
 	 * @return string the path to the full template file.
454 454
 	 */
455
-	public function single_cpt_template( $current_template ) {
456
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
457
-			return $this->query_modifier->singleCptTemplate( $current_template );
455
+	public function single_cpt_template($current_template) {
456
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
457
+			return $this->query_modifier->singleCptTemplate($current_template);
458 458
 		}
459 459
 		return $current_template;
460 460
 	}
Please login to merge, or discard this patch.