Completed
Branch FET-9795-new-interfaces (d74f38)
by
unknown
135:01 queued 115:59
created
core/admin/EE_Admin.core.php 2 patches
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\core\interfaces\ResettableInterface;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
5 5
 /**
6 6
  * Event Espresso
7 7
  *
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public static function instance() {
45 45
 		// check if class object is instantiated
46
-		if (  ! self::$_instance instanceof EE_Admin ) {
46
+		if ( ! self::$_instance instanceof EE_Admin) {
47 47
 			self::$_instance = new self();
48 48
 		}
49 49
 		return self::$_instance;
@@ -70,30 +70,30 @@  discard block
 block discarded – undo
70 70
 		// define global EE_Admin constants
71 71
 		$this->_define_all_constants();
72 72
 		// set autoloaders for our admin page classes based on included path information
73
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
73
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
74 74
 		// admin hooks
75
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
75
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
76 76
 		// load EE_Request_Handler early
77
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
78
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
77
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
78
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
79 79
 		// post shortcode tracking
80 80
 		add_action(
81 81
 			'AHEE__EE_System__initialize_last',
82
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
82
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
83 83
 		);
84
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
85
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
86
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
87
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
88
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
89
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
90
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
91
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
84
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
85
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
86
+		add_action('admin_init', array($this, 'admin_init'), 100);
87
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
88
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
89
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
90
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
91
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
92 92
 
93 93
 		//reset Environment config (we only do this on admin page loads);
94 94
 		EE_Registry::instance()->CFG->environment->recheck_values();
95 95
 
96
-		do_action( 'AHEE__EE_Admin__loaded' );
96
+		do_action('AHEE__EE_Admin__loaded');
97 97
 	}
98 98
 
99 99
 
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 	 * @return void
109 109
 	 */
110 110
 	private function _define_all_constants() {
111
-		if ( ! defined( 'EE_ADMIN_URL' ) ) {
112
-			define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
113
-			define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
114
-			define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
115
-			define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
116
-			define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ) );
111
+		if ( ! defined('EE_ADMIN_URL')) {
112
+			define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
113
+			define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
114
+			define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
115
+			define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
116
+			define('WP_AJAX_URL', admin_url('admin-ajax.php'));
117 117
 		}
118 118
 	}
119 119
 
@@ -127,23 +127,23 @@  discard block
 block discarded – undo
127 127
 	 * @param 	string 	$plugin
128 128
 	 * @return 	array
129 129
 	 */
130
-	public function filter_plugin_actions( $links, $plugin ) {
130
+	public function filter_plugin_actions($links, $plugin) {
131 131
 		// set $main_file in stone
132 132
 		static $main_file;
133 133
 		// if $main_file is not set yet
134
-		if ( ! $main_file ) {
135
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
134
+		if ( ! $main_file) {
135
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
136 136
 		}
137
-		 if ( $plugin === $main_file ) {
137
+		 if ($plugin === $main_file) {
138 138
 		 	// compare current plugin to this one
139
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
140
-				$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>';
141
-				array_unshift( $links, $maintenance_link );
139
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
140
+				$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>';
141
+				array_unshift($links, $maintenance_link);
142 142
 			} else {
143
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
144
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
143
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
144
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
145 145
 				// add before other links
146
-				array_unshift( $links, $org_settings_link, $events_link );
146
+				array_unshift($links, $org_settings_link, $events_link);
147 147
 			}
148 148
 		}
149 149
 		return $links;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 *	@return void
159 159
 	 */
160 160
 	public function get_request() {
161
-		EE_Registry::instance()->load_core( 'Request_Handler' );
162
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
161
+		EE_Registry::instance()->load_core('Request_Handler');
162
+		EE_Registry::instance()->load_core('CPT_Strategy');
163 163
 	}
164 164
 
165 165
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param array $admin_page_folder_names
172 172
 	 * @return array
173 173
 	 */
174
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
174
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
175 175
 		return array(
176
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
177
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
178
-			'support' => EE_ADMIN_PAGES . 'support' . DS
176
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
177
+			'about' => EE_ADMIN_PAGES.'about'.DS,
178
+			'support' => EE_ADMIN_PAGES.'support'.DS
179 179
 		);
180 180
 	}
181 181
 
@@ -189,31 +189,31 @@  discard block
 block discarded – undo
189 189
 	*/
190 190
 	public function init() {
191 191
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
192
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
192
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
193 193
 			//ok so we want to enable the entire admin
194
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
195
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
196
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
194
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
195
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
196
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
197 197
 			//at a glance dashboard widget
198
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
198
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
199 199
 			//filter for get_edit_post_link used on comments for custom post types
200
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
200
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
201 201
 		}
202 202
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
203
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
203
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
204 204
 			try {
205 205
 				//this loads the controller for the admin pages which will setup routing etc
206
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
207
-			} catch ( EE_Error $e ) {
206
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
207
+			} catch (EE_Error $e) {
208 208
 				$e->get_error();
209 209
 			}
210 210
 		}
211
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
211
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
212 212
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
213
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
214
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
213
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
214
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
215 215
 		//exclude EE critical pages from all nav menus and wp_list_pages
216
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
216
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
217 217
 	}
218 218
 
219 219
 
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 	 * @param  object $post_type WP post type object
227 227
 	 * @return object            WP post type object
228 228
 	 */
229
-	public function remove_pages_from_nav_menu( $post_type ) {
229
+	public function remove_pages_from_nav_menu($post_type) {
230 230
 		//if this isn't the "pages" post type let's get out
231
-		if ( $post_type->name !== 'page' ) {
231
+		if ($post_type->name !== 'page') {
232 232
 			return $post_type;
233 233
 		}
234 234
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -248,28 +248,28 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function enable_hidden_ee_nav_menu_metaboxes() {
250 250
 		global $wp_meta_boxes, $pagenow;
251
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
251
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
252 252
 			return;
253 253
 		}
254 254
 		$user = wp_get_current_user();
255 255
 		//has this been done yet?
256
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
256
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
257 257
 			return;
258 258
 		}
259 259
 
260
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
261
-		$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' ) );
260
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
261
+		$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 262
 
263
-		if ( is_array( $hidden_meta_boxes ) ) {
264
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
265
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
266
-					unset( $hidden_meta_boxes[ $key ] );
263
+		if (is_array($hidden_meta_boxes)) {
264
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
265
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
266
+					unset($hidden_meta_boxes[$key]);
267 267
 				}
268 268
 			}
269 269
 		}
270 270
 
271
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
272
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
271
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
272
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
273 273
 	}
274 274
 
275 275
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 * @return void
289 289
 	 */
290 290
 	public function register_custom_nav_menu_boxes() {
291
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
291
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
292 292
 	}
293 293
 
294 294
 
@@ -304,16 +304,16 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @return string  the (maybe) modified link
306 306
 	 */
307
-	public function modify_edit_post_link( $link, $id ) {
308
-		if ( ! $post = get_post( $id ) ){
307
+	public function modify_edit_post_link($link, $id) {
308
+		if ( ! $post = get_post($id)) {
309 309
 			return $link;
310 310
 		}
311
-		if ( $post->post_type === 'espresso_attendees' ) {
311
+		if ($post->post_type === 'espresso_attendees') {
312 312
 			$query_args = array(
313 313
 				'action' => 'edit_attendee',
314 314
 				'post' => $id
315 315
 			);
316
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
316
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
317 317
 		}
318 318
 		return $link;
319 319
 	}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		global $nav_menu_selected_id;
326 326
 
327 327
 		$db_fields = false;
328
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
328
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
329 329
 		$current_tab = 'event-archives';
330 330
 
331 331
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
 		?>
345 345
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
346 346
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
347
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
348
-					<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">
349
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
347
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
348
+					<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">
349
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
350 350
 					</a>
351 351
 				</li>
352 352
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -364,13 +364,13 @@  discard block
 block discarded – undo
364 364
  			<?php */ ?>
365 365
 
366 366
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
367
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
367
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
368 368
 			?>">
369 369
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
370 370
 					<?php
371 371
 					$pages = $this->_get_extra_nav_menu_pages_items();
372 372
 					$args['walker'] = $walker;
373
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
373
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
374 374
 					?>
375 375
 				</ul>
376 376
 			</div><!-- /.tabs-panel -->
@@ -378,18 +378,18 @@  discard block
 block discarded – undo
378 378
 			<p class="button-controls">
379 379
 				<span class="list-controls">
380 380
 					<a href="<?php
381
-						echo esc_url( add_query_arg(
381
+						echo esc_url(add_query_arg(
382 382
 							array(
383 383
 								'extra-nav-menu-pages-tab' => 'event-archives',
384 384
 								'selectall' => 1,
385 385
 							),
386
-							remove_query_arg( $removed_args )
386
+							remove_query_arg($removed_args)
387 387
 						));
388 388
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
389 389
 				</span>
390 390
 
391 391
 				<span class="add-to-menu">
392
-					<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' ); ?>" />
392
+					<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'); ?>" />
393 393
 					<span class="spinner"></span>
394 394
 				</span>
395 395
 			</p>
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 	private function _get_extra_nav_menu_pages_items() {
411 411
 		$menuitems[] = array(
412 412
 			'title' => __('Event List', 'event_espresso'),
413
-			'url' => get_post_type_archive_link( 'espresso_events' ),
413
+			'url' => get_post_type_archive_link('espresso_events'),
414 414
 			'description' => __('Archive page for all events.', 'event_espresso')
415 415
 		);
416
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
416
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
417 417
 	}
418 418
 
419 419
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 * @param $menu_item_values
426 426
 	 * @return stdClass
427 427
 	 */
428
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
428
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
429 429
 		$menu_item = new stdClass();
430 430
 		$keys = array(
431 431
 			'ID' => 0,
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 			'xfn' => ''
446 446
 		);
447 447
 
448
-		foreach ( $keys as $key => $value) {
449
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
448
+		foreach ($keys as $key => $value) {
449
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
450 450
 		}
451 451
 		return $menu_item;
452 452
 	}
@@ -485,9 +485,9 @@  discard block
 block discarded – undo
485 485
 		 * - check if doing post processing of one of EE CPTs
486 486
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
487 487
 		 */
488
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
489
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
490
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
488
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
489
+			EE_Registry::instance()->load_core('Register_CPTs');
490
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
491 491
 		}
492 492
 
493 493
 
@@ -496,8 +496,8 @@  discard block
 block discarded – undo
496 496
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
497 497
 		 */
498 498
 		global $pagenow;
499
-		if ( $pagenow === 'options-reading.php' ) {
500
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
499
+		if ($pagenow === 'options-reading.php') {
500
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
501 501
 		}
502 502
 
503 503
 	}
@@ -509,25 +509,25 @@  discard block
 block discarded – undo
509 509
 	 * @param string $output  Current output.
510 510
 	 * @return string
511 511
 	 */
512
-	public function modify_dropdown_pages( $output ) {
512
+	public function modify_dropdown_pages($output) {
513 513
 		//get critical pages
514 514
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
515 515
 
516 516
 		//split current output by line break for easier parsing.
517
-		$split_output = explode( "\n", $output );
517
+		$split_output = explode("\n", $output);
518 518
 
519 519
 		//loop through to remove any critical pages from the array.
520
-		foreach ( $critical_pages as $page_id ) {
521
-			$needle = 'value="' . $page_id . '"';
522
-			foreach( $split_output as $key => $haystack ) {
523
-				if( strpos( $haystack, $needle ) !== false ) {
524
-					unset( $split_output[$key] );
520
+		foreach ($critical_pages as $page_id) {
521
+			$needle = 'value="'.$page_id.'"';
522
+			foreach ($split_output as $key => $haystack) {
523
+				if (strpos($haystack, $needle) !== false) {
524
+					unset($split_output[$key]);
525 525
 				}
526 526
 			}
527 527
 		}
528 528
 
529 529
 		//replace output with the new contents
530
-		return implode( "\n", $split_output );
530
+		return implode("\n", $split_output);
531 531
 	}
532 532
 
533 533
 
@@ -541,36 +541,36 @@  discard block
 block discarded – undo
541 541
 	public function enqueue_admin_scripts() {
542 542
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
543 543
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
544
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
544
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
545 545
 		// register cookie script for future dependencies
546
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
546
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
547 547
 		// 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' );
548
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
548
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
549 549
 			// register jQuery Validate
550
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
550
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
551 551
 		}
552 552
 		//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' );
553
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
553
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
554 554
 			//joyride style
555
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
556
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
557
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
555
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
556
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
557
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
558 558
 			//joyride JS
559
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
559
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
560 560
 			// wanna go for a joyride?
561 561
 			wp_enqueue_style('ee-joyride-css');
562 562
 			wp_enqueue_script('jquery-joyride');
563 563
 		}
564 564
 		//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' );
565
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
565
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
566 566
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
567 567
 		}
568 568
 		//accounting.js library
569 569
 		// @link http://josscrowcroft.github.io/accounting.js/
570
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
571
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
572
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
573
-			wp_enqueue_script( 'ee-accounting' );
570
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
571
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
572
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
573
+			wp_enqueue_script('ee-accounting');
574 574
 			// array of settings to get converted to JSON array via wp_localize_script
575 575
 			$currency_config = array(
576 576
 				'currency' => array(
@@ -617,11 +617,11 @@  discard block
 block discarded – undo
617 617
 	public function get_persistent_admin_notices() {
618 618
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
619 619
 		$args = array(
620
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
621
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
620
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
621
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
622 622
 		);
623
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
624
-		echo EE_Error::get_persistent_admin_notices( $return_url );
623
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
624
+		echo EE_Error::get_persistent_admin_notices($return_url);
625 625
 	}
626 626
 
627 627
 
@@ -642,26 +642,26 @@  discard block
 block discarded – undo
642 642
 	 * @param $elements
643 643
 	 * @return array
644 644
 	 */
645
-	public function dashboard_glance_items( $elements ) {
645
+	public function dashboard_glance_items($elements) {
646 646
 		$events = EEM_Event::instance()->count();
647
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
648
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
647
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
648
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
649 649
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
650 650
 		$registrations = EEM_Registration::instance()->count(
651 651
 			array(
652 652
 				array(
653
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
653
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
654 654
 				)
655 655
 			)
656 656
 		);
657
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
658
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
657
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
658
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
659 659
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
660 660
 
661
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
661
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
662 662
 
663
-		foreach ( $items as $type => $item_properties ) {
664
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
663
+		foreach ($items as $type => $item_properties) {
664
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
665 665
 		}
666 666
 		return $elements;
667 667
 	}
@@ -678,31 +678,31 @@  discard block
 block discarded – undo
678 678
 	 * @throws EE_Error
679 679
 	 * @return    string
680 680
 	 */
681
-	public function check_for_invalid_datetime_formats( $value, $option ) {
681
+	public function check_for_invalid_datetime_formats($value, $option) {
682 682
 		// check for date_format or time_format
683
-		switch ( $option ) {
683
+		switch ($option) {
684 684
 			case 'date_format' :
685
-				$date_time_format = $value . ' ' . get_option('time_format');
685
+				$date_time_format = $value.' '.get_option('time_format');
686 686
 				break;
687 687
 			case 'time_format' :
688
-				$date_time_format = get_option('date_format') . ' ' . $value;
688
+				$date_time_format = get_option('date_format').' '.$value;
689 689
 				break;
690 690
 			default :
691 691
 				$date_time_format = FALSE;
692 692
 		}
693 693
 		// do we have a date_time format to check ?
694
-		if ( $date_time_format ) {
695
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
694
+		if ($date_time_format) {
695
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
696 696
 
697
-			if ( is_array( $error_msg ) ) {
698
-				$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>';
697
+			if (is_array($error_msg)) {
698
+				$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>';
699 699
 
700 700
 
701
-				foreach ( $error_msg as $error ) {
702
-					$msg .= '<li>' . $error . '</li>';
701
+				foreach ($error_msg as $error) {
702
+					$msg .= '<li>'.$error.'</li>';
703 703
 				}
704 704
 
705
-				$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>';
705
+				$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>';
706 706
 
707 707
 				// trigger WP settings error
708 708
 				add_settings_error(
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 				);
713 713
 
714 714
 				// set format to something valid
715
-				switch ( $option ) {
715
+				switch ($option) {
716 716
 					case 'date_format' :
717 717
 						$value = 'F j, Y';
718 718
 						break;
@@ -734,8 +734,8 @@  discard block
 block discarded – undo
734 734
 	 * @param $content
735 735
 	 * @return    string
736 736
 	 */
737
-	public function its_eSpresso( $content ) {
738
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
737
+	public function its_eSpresso($content) {
738
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
739 739
 	}
740 740
 
741 741
 
@@ -748,9 +748,9 @@  discard block
 block discarded – undo
748 748
 	 */
749 749
 	public function espresso_admin_footer() {
750 750
 		return sprintf(
751
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
751
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
752 752
 			'<a href="https://eventespresso.com/" title="',
753
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
753
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
754 754
 		);
755 755
 	}
756 756
 
@@ -770,12 +770,12 @@  discard block
 block discarded – undo
770 770
 	 * @param array $config
771 771
 	 * @return void
772 772
 	 */
773
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
774
-		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' );
775
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
773
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
774
+		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');
775
+		if (class_exists('EE_Register_Admin_Page')) {
776 776
 			$config['page_path'] = $page_path;
777 777
 		}
778
-		EE_Register_Admin_Page::register( $page_basename, $config );
778
+		EE_Register_Admin_Page::register($page_basename, $config);
779 779
 
780 780
 	}
781 781
 
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	 * @param  \WP_Post $post
789 789
 	 * @return void
790 790
 	 */
791
-	public static function parse_post_content_on_save( $post_ID, $post ) {
791
+	public static function parse_post_content_on_save($post_ID, $post) {
792 792
 		EE_Error::doing_it_wrong(
793 793
 			__METHOD__,
794 794
 			__(
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 			),
798 798
 			'4.8.41'
799 799
 		);
800
-		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post );
800
+		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post);
801 801
 	}
802 802
 
803 803
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 * @param  $value
811 811
 	 * @return void
812 812
 	 */
813
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
813
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
814 814
 		EE_Error::doing_it_wrong(
815 815
 			__METHOD__,
816 816
 			__(
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 			),
820 820
 			'4.8.41'
821 821
 		);
822
-		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value );
822
+		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value);
823 823
 	}
824 824
 
825 825
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\core\interfaces\ResettableInterface;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6
+}
5 7
 /**
6 8
  * Event Espresso
7 9
  *
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 2 patches
Spacing   +605 added lines, -605 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  * Event Espresso
6 6
  *
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
157 157
 	 * 		@access public
158 158
 	 */
159
-	public function __construct( $routing = TRUE ) {
159
+	public function __construct($routing = TRUE) {
160 160
 
161
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
161
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
162 162
 			$this->_is_caf = TRUE;
163 163
 
164 164
 		$this->_yes_no_values = array(
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
 
171 171
 		//set the _req_data property.
172
-		$this->_req_data = array_merge( $_GET, $_POST );
172
+		$this->_req_data = array_merge($_GET, $_POST);
173 173
 
174 174
 
175 175
 		//routing enabled?
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		$this->_do_other_page_hooks();
191 191
 
192 192
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
193
-		if ( method_exists( $this, '_before_page_setup' ) )
193
+		if (method_exists($this, '_before_page_setup'))
194 194
 			$this->_before_page_setup();
195 195
 
196 196
 		//set up page dependencies
@@ -460,16 +460,16 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	protected function _global_ajax_hooks() {
462 462
 		//for lazy loading of metabox content
463
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
463
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
464 464
 	}
465 465
 
466 466
 
467 467
 
468 468
 	public function ajax_metabox_content() {
469
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
470
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
469
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
470
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
471 471
 
472
-		self::cached_rss_display( $contentid, $url );
472
+		self::cached_rss_display($contentid, $url);
473 473
 		wp_die();
474 474
 	}
475 475
 
@@ -488,87 +488,87 @@  discard block
 block discarded – undo
488 488
 		//requires?
489 489
 
490 490
 		//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.
491
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
491
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
492 492
 
493 493
 
494 494
 		//next verify if we need to load anything...
495
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE;
496
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
495
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE;
496
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
497 497
 
498 498
 		global $ee_menu_slugs;
499 499
 		$ee_menu_slugs = (array) $ee_menu_slugs;
500 500
 
501
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
501
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
502 502
 
503 503
 
504 504
 		// 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
505
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
506
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
505
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
506
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
507 507
 		}
508 508
 		// then set blank or -1 action values to 'default'
509
-		$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';
509
+		$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';
510 510
 
511 511
 		//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.
512
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
512
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
513 513
 
514 514
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
515 515
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
516 516
 
517 517
 		$this->_current_view = $this->_req_action;
518
-		$this->_req_nonce = $this->_req_action . '_nonce';
518
+		$this->_req_nonce = $this->_req_action.'_nonce';
519 519
 		$this->_define_page_props();
520 520
 
521
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
521
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
522 522
 
523 523
 		//default things
524
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
524
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
525 525
 
526 526
 		//set page configs
527 527
 		$this->_set_page_routes();
528 528
 		$this->_set_page_config();
529 529
 
530 530
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
531
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
531
+		if (isset($this->_req_data['wp_referer'])) {
532 532
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
533 533
 		}
534 534
 
535 535
 		//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
536
-		if ( method_exists( $this, '_extend_page_config' ) )
536
+		if (method_exists($this, '_extend_page_config'))
537 537
 			$this->_extend_page_config();
538 538
 
539 539
 		//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.
540
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
540
+		if (method_exists($this, '_extend_page_config_for_cpt'))
541 541
 			$this->_extend_page_config_for_cpt();
542 542
 
543 543
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
544
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
545
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
544
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
545
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
546 546
 
547 547
 
548 548
 		//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
549
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
550
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
549
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
550
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
551 551
 		}
552 552
 
553 553
 
554 554
 		//next route only if routing enabled
555
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
555
+		if ($this->_routing && ! defined('DOING_AJAX')) {
556 556
 
557 557
 			$this->_verify_routes();
558 558
 
559 559
 			//next let's just check user_access and kill if no access
560 560
 			$this->check_user_access();
561 561
 
562
-			if ( $this->_is_UI_request ) {
562
+			if ($this->_is_UI_request) {
563 563
 				//admin_init stuff - global, all views for this page class, specific view
564
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
565
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
566
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
564
+				add_action('admin_init', array($this, 'admin_init'), 10);
565
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
566
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
567 567
 				}
568 568
 
569 569
 			} else {
570 570
 				//hijack regular WP loading and route admin request immediately
571
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
571
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
572 572
 				$this->route_admin_request();
573 573
 			}
574 574
 		}
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
 	 * @return void
586 586
 	 */
587 587
 	private function _do_other_page_hooks() {
588
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
588
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
589 589
 
590
-		foreach ( $registered_pages as $page ) {
590
+		foreach ($registered_pages as $page) {
591 591
 
592 592
 			//now let's setup the file name and class that should be present
593 593
 			$classname = str_replace('.class.php', '', $page);
594 594
 
595 595
 			//autoloaders should take care of loading file
596
-			if ( !class_exists( $classname ) ) {
597
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
598
-				$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 );
599
-				throw new EE_Error( implode( '||', $error_msg ));
596
+			if ( ! class_exists($classname)) {
597
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
598
+				$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);
599
+				throw new EE_Error(implode('||', $error_msg));
600 600
 			}
601 601
 
602 602
 			$a = new ReflectionClass($classname);
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	public function load_page_dependencies() {
612 612
 		try {
613 613
 			$this->_load_page_dependencies();
614
-		} catch ( EE_Error $e ) {
614
+		} catch (EE_Error $e) {
615 615
 			$e->get_error();
616 616
 		}
617 617
 	}
@@ -629,16 +629,16 @@  discard block
 block discarded – undo
629 629
 		$this->_current_screen = get_current_screen();
630 630
 
631 631
 		//load admin_notices - global, page class, and view specific
632
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
633
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
634
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
635
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
632
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
633
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
634
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
635
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
636 636
 		}
637 637
 
638 638
 		//load network admin_notices - global, page class, and view specific
639
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
640
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
641
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
639
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
640
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
641
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
642 642
 		}
643 643
 
644 644
 		//this will save any per_page screen options if they are present
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
 		//add screen options - global, page child class, and view specific
655 655
 		$this->_add_global_screen_options();
656 656
 		$this->_add_screen_options();
657
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
658
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
657
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
658
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
659 659
 
660 660
 
661 661
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -666,33 +666,33 @@  discard block
 block discarded – undo
666 666
 		//add feature_pointers - global, page child class, and view specific
667 667
 		$this->_add_feature_pointers();
668 668
 		$this->_add_global_feature_pointers();
669
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
670
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
669
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
670
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
671 671
 
672 672
 		//enqueue scripts/styles - global, page class, and view specific
673
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
674
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
675
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
676
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
673
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
674
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
675
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
676
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
677 677
 
678
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
678
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
679 679
 
680 680
 		//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
681
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
682
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
683
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
684
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
681
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
682
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
683
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
684
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
685 685
 
686 686
 		//admin footer scripts
687
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
688
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
689
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
690
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
687
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
688
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
689
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
690
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
691 691
 
692 692
 
693
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
693
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
694 694
 		//targeted hook
695
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
695
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
696 696
 
697 697
 	}
698 698
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	private function _set_defaults() {
708 708
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
709 709
 
710
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
710
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
711 711
 
712 712
 		$this->default_nav_tab_name = 'overview';
713 713
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	public function route_admin_request() {
735 735
 		try {
736 736
 			$this->_route_admin_request();
737
-		} catch ( EE_Error $e ) {
737
+		} catch (EE_Error $e) {
738 738
 			$e->get_error();
739 739
 		}
740 740
 	}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 		$this->_wp_page_slug = $wp_page_slug;
746 746
 
747 747
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
748
-		if ( is_network_admin() ) {
748
+		if (is_network_admin()) {
749 749
 			$this->_wp_page_slug .= '-network';
750 750
 		}
751 751
 	}
@@ -758,53 +758,53 @@  discard block
 block discarded – undo
758 758
 	 * @return void
759 759
 	 */
760 760
 	protected function _verify_routes() {
761
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
761
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
762 762
 
763
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
763
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
764 764
 
765 765
 		$this->_route = FALSE;
766 766
 		$func = FALSE;
767 767
 		$args = array();
768 768
 
769 769
 		// check that the page_routes array is not empty
770
-		if ( empty( $this->_page_routes )) {
770
+		if (empty($this->_page_routes)) {
771 771
 			// user error msg
772
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
772
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
773 773
 			// developer error msg
774
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
775
-			throw new EE_Error( $error_msg );
774
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
775
+			throw new EE_Error($error_msg);
776 776
 		}
777 777
 
778 778
 		// and that the requested page route exists
779
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
780
-			$this->_route = $this->_page_routes[ $this->_req_action ];
779
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
780
+			$this->_route = $this->_page_routes[$this->_req_action];
781 781
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
782 782
 		} else {
783 783
 			// user error msg
784
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
784
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
785 785
 			// developer error msg
786
-			$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 );
787
-			throw new EE_Error( $error_msg );
786
+			$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);
787
+			throw new EE_Error($error_msg);
788 788
 		}
789 789
 
790 790
 		// and that a default route exists
791
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
791
+		if ( ! array_key_exists('default', $this->_page_routes)) {
792 792
 			// user error msg
793
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
793
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
794 794
 			// developer error msg
795
-			$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' );
796
-			throw new EE_Error( $error_msg );
795
+			$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');
796
+			throw new EE_Error($error_msg);
797 797
 		}
798 798
 
799 799
 
800 800
 		//first lets' catch if the UI request has EVER been set.
801
-		if ( $this->_is_UI_request === NULL ) {
801
+		if ($this->_is_UI_request === NULL) {
802 802
 			//lets set if this is a UI request or not.
803
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
803
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
804 804
 
805 805
 
806 806
 			//wait a minute... we might have a noheader in the route array
807
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
807
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
808 808
 		}
809 809
 
810 810
 		$this->_set_current_labels();
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 	 * @param  string $route the route name we're verifying
820 820
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
821 821
 	 */
822
-	protected function _verify_route( $route ) {
823
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
822
+	protected function _verify_route($route) {
823
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
824 824
 			return true;
825 825
 		} else {
826 826
 			// user error msg
827
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
827
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
828 828
 			// developer error msg
829
-			$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 );
830
-			throw new EE_Error( $error_msg );
829
+			$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);
830
+			throw new EE_Error($error_msg);
831 831
 		}
832 832
 	}
833 833
 
@@ -841,18 +841,18 @@  discard block
 block discarded – undo
841 841
 	 * @param  string $nonce_ref The nonce reference string (name0)
842 842
 	 * @return mixed (bool|die)
843 843
 	 */
844
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
844
+	protected function _verify_nonce($nonce, $nonce_ref) {
845 845
 		// verify nonce against expected value
846
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
846
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
847 847
 			// these are not the droids you are looking for !!!
848
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
849
-			if ( WP_DEBUG ) {
850
-				$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__  );
848
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
849
+			if (WP_DEBUG) {
850
+				$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__);
851 851
 			}
852
-			if ( ! defined( 'DOING_AJAX' )) {
853
-				wp_die( $msg );
852
+			if ( ! defined('DOING_AJAX')) {
853
+				wp_die($msg);
854 854
 			} else {
855
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
855
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
856 856
 				$this->_return_json();
857 857
 			}
858 858
 		}
@@ -870,63 +870,63 @@  discard block
 block discarded – undo
870 870
 	 * @return void
871 871
 	 */
872 872
 	protected function _route_admin_request() {
873
-		if (  ! $this->_is_UI_request )
873
+		if ( ! $this->_is_UI_request)
874 874
 			$this->_verify_routes();
875 875
 
876
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
876
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
877 877
 
878
-		if ( $this->_req_action != 'default' && $nonce_check ) {
878
+		if ($this->_req_action != 'default' && $nonce_check) {
879 879
 			// set nonce from post data
880
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
881
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
880
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
881
+			$this->_verify_nonce($nonce, $this->_req_nonce);
882 882
 		}
883 883
 		//set the nav_tabs array but ONLY if this is  UI_request
884
-		if ( $this->_is_UI_request )
884
+		if ($this->_is_UI_request)
885 885
 			$this->_set_nav_tabs();
886 886
 
887 887
 		// grab callback function
888
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
888
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
889 889
 
890 890
 		// check if callback has args
891
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
891
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
892 892
 
893 893
 		$error_msg = '';
894 894
 
895 895
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
896
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
897
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
896
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
897
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
898 898
 		}
899 899
 
900 900
 		//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).
901
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
901
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
902 902
 
903
-		if ( ! empty( $func )) {
903
+		if ( ! empty($func)) {
904 904
 			$base_call = $addon_call = FALSE;
905 905
 			//try to access page route via this class
906
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
906
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
907 907
 				// user error msg
908
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
908
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
909 909
 				// developer error msg
910
-				$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 );
910
+				$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);
911 911
 			}
912 912
 
913 913
 			//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)
914 914
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
915 915
 
916
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
917
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
918
-				$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 );
916
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
917
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
918
+				$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);
919 919
 			}
920 920
 
921 921
 
922
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
923
-				throw new EE_Error( $error_msg );
922
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
923
+				throw new EE_Error($error_msg);
924 924
 		}
925 925
 
926 926
 		//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.
927 927
 		//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.
928
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
929
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
928
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
929
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
930 930
 		}
931 931
 	}
932 932
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 	 * @param  string    $new_route   New (non header) route to redirect to.
943 943
 	 * @return   void
944 944
 	 */
945
-	protected function _reset_routing_properties( $new_route ) {
945
+	protected function _reset_routing_properties($new_route) {
946 946
 		$this->_is_UI_request = TRUE;
947 947
 		//now we set the current route to whatever the headers_sent_route is set at
948 948
 		$this->_req_data['action'] = $new_route;
@@ -988,23 +988,23 @@  discard block
 block discarded – undo
988 988
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
989 989
 	 * 	@return string
990 990
 	 */
991
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
991
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
992 992
 
993 993
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
994
-		if ( $sticky ) {
994
+		if ($sticky) {
995 995
 			$request = $_REQUEST;
996
-			unset( $request['_wp_http_referer'] );
997
-			unset( $request['wp_referer'] );
998
-			foreach ( $request as $key => $value ) {
996
+			unset($request['_wp_http_referer']);
997
+			unset($request['wp_referer']);
998
+			foreach ($request as $key => $value) {
999 999
 				//do not add nonces
1000
-				if ( strpos( $key, 'nonce' ) !== false ) {
1000
+				if (strpos($key, 'nonce') !== false) {
1001 1001
 					continue;
1002 1002
 				}
1003
-				$args['wp_referer[' . $key . ']'] = $value;
1003
+				$args['wp_referer['.$key.']'] = $value;
1004 1004
 			}
1005 1005
 		}
1006 1006
 
1007
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1007
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1008 1008
 	}
1009 1009
 
1010 1010
 
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
 	 * @uses EEH_Template::get_help_tab_link()
1021 1021
 	 * @return string              generated link
1022 1022
 	 */
1023
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1024
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1023
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1024
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1025 1025
 	}
1026 1026
 
1027 1027
 
@@ -1038,30 +1038,30 @@  discard block
 block discarded – undo
1038 1038
 	 */
1039 1039
 	protected function _add_help_tabs() {
1040 1040
 		$tour_buttons = '';
1041
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1041
+		if (isset($this->_page_config[$this->_req_action])) {
1042 1042
 			$config = $this->_page_config[$this->_req_action];
1043 1043
 
1044 1044
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1045
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1045
+			if (isset($this->_help_tour[$this->_req_action])) {
1046 1046
 				$tb = array();
1047 1047
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1048
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1048
+				foreach ($this->_help_tour['tours'] as $tour) {
1049 1049
 					//if this is the end tour then we don't need to setup a button
1050
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1050
+					if ($tour instanceof EE_Help_Tour_final_stop)
1051 1051
 						continue;
1052
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1052
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1053 1053
 				}
1054 1054
 				$tour_buttons .= implode('<br />', $tb);
1055 1055
 				$tour_buttons .= '</div></div>';
1056 1056
 			}
1057 1057
 
1058 1058
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1059
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1059
+			if (is_array($config) && isset($config['help_sidebar'])) {
1060 1060
 				//check that the callback given is valid
1061
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1062
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1061
+				if ( ! method_exists($this, $config['help_sidebar']))
1062
+					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)));
1063 1063
 
1064
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1064
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1065 1065
 
1066 1066
 				$content .= $tour_buttons; //add help tour buttons.
1067 1067
 
@@ -1070,49 +1070,49 @@  discard block
 block discarded – undo
1070 1070
 			}
1071 1071
 
1072 1072
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1073
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1073
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1074 1074
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1075 1075
 			}
1076 1076
 
1077 1077
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1078
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1078
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1079 1079
 				$_ht['id'] = $this->page_slug;
1080 1080
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1081
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1081
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1082 1082
 				$this->_current_screen->add_help_tab($_ht);
1083 1083
 				}/**/
1084 1084
 
1085 1085
 
1086
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1086
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1087 1087
 
1088
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1088
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1089 1089
 				//we're here so there ARE help tabs!
1090 1090
 
1091 1091
 				//make sure we've got what we need
1092
-				if ( !isset( $cfg['title'] ) )
1093
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1092
+				if ( ! isset($cfg['title']))
1093
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1094 1094
 
1095 1095
 
1096
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1097
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1096
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1097
+					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'));
1098 1098
 
1099 1099
 
1100 1100
 
1101 1101
 				//first priority goes to content.
1102
-				if ( !empty($cfg['content'] ) ) {
1103
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1102
+				if ( ! empty($cfg['content'])) {
1103
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1104 1104
 
1105 1105
 				//second priority goes to filename
1106
-				} else if ( !empty($cfg['filename'] ) ) {
1107
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1106
+				} else if ( ! empty($cfg['filename'])) {
1107
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1108 1108
 
1109 1109
 
1110 1110
 					//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)
1111
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1111
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1112 1112
 
1113 1113
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1114
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1115
-						EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ );
1114
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1115
+						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__);
1116 1116
 						return;
1117 1117
 					}
1118 1118
 					$template_args['admin_page_obj'] = $this;
@@ -1123,21 +1123,21 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 
1125 1125
 				//check if callback is valid
1126
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1127
-					EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ );
1126
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1127
+					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__);
1128 1128
 					return;
1129 1129
 				}
1130 1130
 
1131 1131
 				//setup config array for help tab method
1132
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1132
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1133 1133
 				$_ht = array(
1134 1134
 					'id' => $id,
1135 1135
 					'title' => $cfg['title'],
1136
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1136
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1137 1137
 					'content' => $content
1138 1138
 					);
1139 1139
 
1140
-				$this->_current_screen->add_help_tab( $_ht );
1140
+				$this->_current_screen->add_help_tab($_ht);
1141 1141
 			}
1142 1142
 		}
1143 1143
 	}
@@ -1157,49 +1157,49 @@  discard block
 block discarded – undo
1157 1157
 		$this->_help_tour = array();
1158 1158
 
1159 1159
 		//exit early if help tours are turned off globally
1160
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1160
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1161 1161
 			return;
1162 1162
 
1163 1163
 		//loop through _page_config to find any help_tour defined
1164
-		foreach ( $this->_page_config as $route => $config ) {
1164
+		foreach ($this->_page_config as $route => $config) {
1165 1165
 			//we're only going to set things up for this route
1166
-			if ( $route !== $this->_req_action )
1166
+			if ($route !== $this->_req_action)
1167 1167
 				continue;
1168 1168
 
1169
-			if ( isset( $config['help_tour'] ) ) {
1169
+			if (isset($config['help_tour'])) {
1170 1170
 
1171
-				foreach( $config['help_tour'] as $tour ) {
1172
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1171
+				foreach ($config['help_tour'] as $tour) {
1172
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1173 1173
 					//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
1174
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1174
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1175 1175
 
1176 1176
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1177
-					if ( !is_readable($file_path) ) {
1178
-						EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ );
1177
+					if ( ! is_readable($file_path)) {
1178
+						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__);
1179 1179
 						return;
1180 1180
 					}
1181 1181
 
1182 1182
 					require_once $file_path;
1183
-					if ( !class_exists( $tour ) ) {
1184
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1185
-						$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) );
1186
-						throw new EE_Error( implode( '||', $error_msg ));
1183
+					if ( ! class_exists($tour)) {
1184
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1185
+						$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));
1186
+						throw new EE_Error(implode('||', $error_msg));
1187 1187
 					}
1188 1188
 					$a = new ReflectionClass($tour);
1189 1189
 					$tour_obj = $a->newInstance($this->_is_caf);
1190 1190
 
1191 1191
 					$tours[] = $tour_obj;
1192
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1192
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1193 1193
 				}
1194 1194
 
1195 1195
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1196 1196
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1197 1197
 				$tours[] = $end_stop_tour;
1198
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1198
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1199 1199
 			}
1200 1200
 		}
1201 1201
 
1202
-		if ( !empty( $tours ) )
1202
+		if ( ! empty($tours))
1203 1203
 			$this->_help_tour['tours'] = $tours;
1204 1204
 
1205 1205
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1215,12 +1215,12 @@  discard block
 block discarded – undo
1215 1215
 	 * @return void
1216 1216
 	 */
1217 1217
 	protected function _add_qtips() {
1218
-		if ( isset( $this->_route_config['qtips'] ) ) {
1218
+		if (isset($this->_route_config['qtips'])) {
1219 1219
 			$qtips = (array) $this->_route_config['qtips'];
1220 1220
 			//load qtip loader
1221 1221
 			$path = array(
1222
-				$this->_get_dir() . '/qtips/',
1223
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1222
+				$this->_get_dir().'/qtips/',
1223
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1224 1224
 				);
1225 1225
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1226 1226
 		}
@@ -1237,41 +1237,41 @@  discard block
 block discarded – undo
1237 1237
 	 * @return void
1238 1238
 	 */
1239 1239
 	protected function _set_nav_tabs() {
1240
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1240
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1241 1241
 		$i = 0;
1242
-		foreach ( $this->_page_config as $slug => $config ) {
1243
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1242
+		foreach ($this->_page_config as $slug => $config) {
1243
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1244 1244
 				continue; //no nav tab for this config
1245 1245
 
1246 1246
 			//check for persistent flag
1247
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1247
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1248 1248
 				continue; //nav tab is only to appear when route requested.
1249 1249
 
1250
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1250
+			if ( ! $this->check_user_access($slug, TRUE))
1251 1251
 				continue; //no nav tab becasue current user does not have access.
1252 1252
 
1253
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1253
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1254 1254
 			$this->_nav_tabs[$slug] = array(
1255
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1256
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1257
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1258
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1255
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1256
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1257
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1258
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1259 1259
 				);
1260 1260
 			$i++;
1261 1261
 		}
1262 1262
 
1263 1263
 		//if $this->_nav_tabs is empty then lets set the default
1264
-		if ( empty( $this->_nav_tabs ) ) {
1264
+		if (empty($this->_nav_tabs)) {
1265 1265
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1266 1266
 				'url' => $this->admin_base_url,
1267
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1267
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1268 1268
 				'css_class' => 'nav-tab-active',
1269 1269
 				'order' => 10
1270 1270
 				);
1271 1271
 		}
1272 1272
 
1273 1273
 		//now let's sort the tabs according to order
1274
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1274
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1275 1275
 
1276 1276
 	}
1277 1277
 
@@ -1287,10 +1287,10 @@  discard block
 block discarded – undo
1287 1287
 	 * @return void
1288 1288
 	 */
1289 1289
 	private function _set_current_labels() {
1290
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1291
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1292
-				if ( is_array($text) ) {
1293
-					foreach ( $text as $sublabel => $subtext ) {
1290
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1291
+			foreach ($this->_route_config['labels'] as $label => $text) {
1292
+				if (is_array($text)) {
1293
+					foreach ($text as $sublabel => $subtext) {
1294 1294
 						$this->_labels[$label][$sublabel] = $subtext;
1295 1295
 					}
1296 1296
 				} else {
@@ -1311,24 +1311,24 @@  discard block
 block discarded – undo
1311 1311
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1312 1312
 	*		@return 		BOOL|wp_die()
1313 1313
 	*/
1314
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1315
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1316
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1317
-		$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;
1314
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1315
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1316
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1317
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1318 1318
 
1319
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1320
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1319
+		if (empty($capability) && empty($route_to_check)) {
1320
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1321 1321
 		} else {
1322
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1322
+			$capability = empty($capability) ? 'manage_options' : $capability;
1323 1323
 		}
1324 1324
 
1325
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1325
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1326 1326
 
1327
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1328
-			if ( $verify_only ) {
1327
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1328
+			if ($verify_only) {
1329 1329
 				return FALSE;
1330 1330
 			} else {
1331
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1331
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1332 1332
 			}
1333 1333
 		}
1334 1334
 		return TRUE;
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 		$this->_add_admin_page_overlay();
1406 1406
 
1407 1407
 		//if metaboxes are present we need to add the nonce field
1408
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1408
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1409 1409
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1410 1410
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1411 1411
 		}
@@ -1424,19 +1424,19 @@  discard block
 block discarded – undo
1424 1424
 	 */
1425 1425
 	public function admin_footer_global() {
1426 1426
 		//dialog container for dialog helper
1427
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1427
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1428 1428
 		$d_cont .= '<div class="ee-notices"></div>';
1429 1429
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1430 1430
 		$d_cont .= '</div>';
1431 1431
 		echo $d_cont;
1432 1432
 
1433 1433
 		//help tour stuff?
1434
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1434
+		if (isset($this->_help_tour[$this->_req_action])) {
1435 1435
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1436 1436
 		}
1437 1437
 
1438 1438
 		//current set timezone for timezone js
1439
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1439
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1440 1440
 	}
1441 1441
 
1442 1442
 
@@ -1460,18 +1460,18 @@  discard block
 block discarded – undo
1460 1460
 	 * @access protected
1461 1461
 	 * @return string content
1462 1462
 	 */
1463
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1463
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1464 1464
 		$content = '';
1465 1465
 
1466
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1467
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1466
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1467
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1468 1468
 
1469 1469
 
1470 1470
 		//loop through the array and setup content
1471
-		foreach ( $help_array as $trigger => $help ) {
1471
+		foreach ($help_array as $trigger => $help) {
1472 1472
 			//make sure the array is setup properly
1473
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1474
-				throw new EE_Error( __('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') );
1473
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1474
+				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'));
1475 1475
 			}
1476 1476
 
1477 1477
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1481,10 +1481,10 @@  discard block
 block discarded – undo
1481 1481
 				'help_popup_content' => $help['content']
1482 1482
 				);
1483 1483
 
1484
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1484
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1485 1485
 		}
1486 1486
 
1487
-		if ( $display )
1487
+		if ($display)
1488 1488
 			echo $content;
1489 1489
 		else
1490 1490
 			return $content;
@@ -1501,18 +1501,18 @@  discard block
 block discarded – undo
1501 1501
 	 */
1502 1502
 	private function _get_help_content() {
1503 1503
 		//what is the method we're looking for?
1504
-		$method_name = '_help_popup_content_' . $this->_req_action;
1504
+		$method_name = '_help_popup_content_'.$this->_req_action;
1505 1505
 
1506 1506
 		//if method doesn't exist let's get out.
1507
-		if ( !method_exists( $this, $method_name ) )
1507
+		if ( ! method_exists($this, $method_name))
1508 1508
 			return array();
1509 1509
 
1510 1510
 		//k we're good to go let's retrieve the help array
1511
-		$help_array = call_user_func( array( $this, $method_name ) );
1511
+		$help_array = call_user_func(array($this, $method_name));
1512 1512
 
1513 1513
 		//make sure we've got an array!
1514
-		if ( !is_array($help_array) ) {
1515
-			throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) );
1514
+		if ( ! is_array($help_array)) {
1515
+			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'));
1516 1516
 		}
1517 1517
 
1518 1518
 		return $help_array;
@@ -1534,27 +1534,27 @@  discard block
 block discarded – undo
1534 1534
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1535 1535
 	 * @return string
1536 1536
 	 */
1537
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1537
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1538 1538
 
1539
-		if ( defined('DOING_AJAX') ) return;
1539
+		if (defined('DOING_AJAX')) return;
1540 1540
 
1541 1541
 		//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
1542 1542
 		$help_array = $this->_get_help_content();
1543 1543
 		$help_content = '';
1544 1544
 
1545
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1545
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1546 1546
 			$help_array[$trigger_id] = array(
1547 1547
 				'title' => __('Missing Content', 'event_espresso'),
1548 1548
 				'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')
1549 1549
 				);
1550
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1550
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1551 1551
 		}
1552 1552
 
1553 1553
 		//let's setup the trigger
1554
-		$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>';
1555
-		$content = $content . $help_content;
1554
+		$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>';
1555
+		$content = $content.$help_content;
1556 1556
 
1557
-		if ( $display )
1557
+		if ($display)
1558 1558
 			echo $content;
1559 1559
 		else
1560 1560
 			return $content;
@@ -1611,15 +1611,15 @@  discard block
 block discarded – undo
1611 1611
 	public function load_global_scripts_styles() {
1612 1612
 		/** STYLES **/
1613 1613
 		// add debugging styles
1614
-		if ( WP_DEBUG ) {
1615
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1614
+		if (WP_DEBUG) {
1615
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1616 1616
 		}
1617 1617
 
1618 1618
 		//register all styles
1619
-		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 );
1620
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1619
+		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);
1620
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1621 1621
 		//helpers styles
1622
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1622
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1623 1623
 		//enqueue global styles
1624 1624
 		wp_enqueue_style('ee-admin-css');
1625 1625
 
@@ -1627,66 +1627,66 @@  discard block
 block discarded – undo
1627 1627
 		/** SCRIPTS **/
1628 1628
 
1629 1629
 		//register all scripts
1630
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1631
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1632
-		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 );
1630
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1631
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1632
+		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);
1633 1633
 
1634
-		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 );
1634
+		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);
1635 1635
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1636
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1636
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1637 1637
 		add_filter('FHEE_load_joyride', '__return_true');
1638 1638
 
1639 1639
 		//script for sorting tables
1640
-		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);
1640
+		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);
1641 1641
 		//script for parsing uri's
1642
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1642
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1643 1643
 		//and parsing associative serialized form elements
1644
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1644
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1645 1645
 		//helpers scripts
1646
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1647
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1648
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1649
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1646
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1647
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1648
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1649
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1650 1650
 
1651 1651
 		//google charts
1652
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1652
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1653 1653
 
1654 1654
 		//enqueue global scripts
1655 1655
 
1656 1656
 		//taking care of metaboxes
1657
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1657
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1658 1658
 			wp_enqueue_script('dashboard');
1659 1659
 		}
1660 1660
 
1661 1661
 		//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
1662
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1662
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1663 1663
 			wp_enqueue_script('ee_admin_js');
1664 1664
 			wp_enqueue_style('ee-admin-css');
1665 1665
 		}
1666 1666
 
1667 1667
 
1668 1668
 		//localize script for ajax lazy loading
1669
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1670
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1669
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1670
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1671 1671
 
1672 1672
 
1673 1673
 		/**
1674 1674
 		 * help tour stuff
1675 1675
 		 */
1676
-		if ( !empty( $this->_help_tour ) ) {
1676
+		if ( ! empty($this->_help_tour)) {
1677 1677
 
1678 1678
 			//register the js for kicking things off
1679
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1679
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1680 1680
 
1681 1681
 			//setup tours for the js tour object
1682
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1682
+			foreach ($this->_help_tour['tours'] as $tour) {
1683 1683
 				$tours[] = array(
1684 1684
 					'id' => $tour->get_slug(),
1685 1685
 					'options' => $tour->get_options()
1686 1686
 					);
1687 1687
 			}
1688 1688
 
1689
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1689
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1690 1690
 
1691 1691
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1692 1692
 		}
@@ -1704,52 +1704,52 @@  discard block
 block discarded – undo
1704 1704
 	public function admin_footer_scripts_eei18n_js_strings() {
1705 1705
 
1706 1706
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1707
-		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' );
1708
-
1709
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1710
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1711
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1733
-
1734
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1746
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1747
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1707
+		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');
1708
+
1709
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1710
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1711
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1733
+
1734
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1746
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1747
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1748 1748
 
1749 1749
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1750 1750
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1751 1751
 		//espresso_core is listed as a dependency of ee_admin_js.
1752
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1752
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1753 1753
 
1754 1754
 	}
1755 1755
 
@@ -1783,23 +1783,23 @@  discard block
 block discarded – undo
1783 1783
 	protected function _set_list_table() {
1784 1784
 
1785 1785
 		//first is this a list_table view?
1786
-		if ( !isset($this->_route_config['list_table']) )
1786
+		if ( ! isset($this->_route_config['list_table']))
1787 1787
 			return; //not a list_table view so get out.
1788 1788
 
1789 1789
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1790 1790
 
1791
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1791
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1792 1792
 			//user error msg
1793
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1793
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1794 1794
 			//developer error msg
1795
-			$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 );
1796
-			throw new EE_Error( $error_msg );
1795
+			$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);
1796
+			throw new EE_Error($error_msg);
1797 1797
 		}
1798 1798
 
1799 1799
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1800
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1801
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1802
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1800
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1801
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1802
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1803 1803
 
1804 1804
 		$this->_set_list_table_view();
1805 1805
 		$this->_set_list_table_object();
@@ -1821,14 +1821,14 @@  discard block
 block discarded – undo
1821 1821
 	*		@return array
1822 1822
 	*/
1823 1823
 	protected function _set_list_table_view() {
1824
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1824
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1825 1825
 
1826 1826
 
1827 1827
 		// looking at active items or dumpster diving ?
1828
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1829
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1828
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1829
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1830 1830
 		} else {
1831
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1831
+			$this->_view = sanitize_key($this->_req_data['status']);
1832 1832
 		}
1833 1833
 	}
1834 1834
 
@@ -1839,9 +1839,9 @@  discard block
 block discarded – undo
1839 1839
 	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1840 1840
 	 */
1841 1841
 	protected function _set_list_table_object() {
1842
-		if ( isset($this->_route_config['list_table'] ) ) {
1843
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1844
-				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) ) );
1842
+		if (isset($this->_route_config['list_table'])) {
1843
+			if ( ! class_exists($this->_route_config['list_table']))
1844
+				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)));
1845 1845
 			$a = new ReflectionClass($this->_route_config['list_table']);
1846 1846
 			$this->_list_table_object = $a->newInstance($this);
1847 1847
 		}
@@ -1860,27 +1860,27 @@  discard block
 block discarded – undo
1860 1860
 	 *
1861 1861
 	 * @return array
1862 1862
 	 */
1863
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1863
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1864 1864
 
1865
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1865
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1866 1866
 
1867
-		if ( empty( $this->_views )) {
1867
+		if (empty($this->_views)) {
1868 1868
 			$this->_views = array();
1869 1869
 		}
1870 1870
 
1871 1871
 		// cycle thru views
1872
-		foreach ( $this->_views as $key => $view ) {
1872
+		foreach ($this->_views as $key => $view) {
1873 1873
 			$query_args = array();
1874 1874
 			// check for current view
1875
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1875
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1876 1876
 			$query_args['action'] = $this->_req_action;
1877
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1877
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1878 1878
 			$query_args['status'] = $view['slug'];
1879 1879
 			//merge any other arguments sent in.
1880
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1881
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1880
+			if (isset($extra_query_args[$view['slug']])) {
1881
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1882 1882
 			}
1883
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1883
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1884 1884
 		}
1885 1885
 
1886 1886
 		return $this->_views;
@@ -1897,15 +1897,15 @@  discard block
 block discarded – undo
1897 1897
 	 * @param int $max_entries total number of rows in the table
1898 1898
 	 * @return string
1899 1899
 	*/
1900
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1900
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1901 1901
 
1902
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1903
-		$values = array( 10, 25, 50, 100 );
1904
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1902
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1903
+		$values = array(10, 25, 50, 100);
1904
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1905 1905
 
1906
-		if ( $max_entries ) {
1906
+		if ($max_entries) {
1907 1907
 			$values[] = $max_entries;
1908
-			sort( $values );
1908
+			sort($values);
1909 1909
 		}
1910 1910
 
1911 1911
 		$entries_per_page_dropdown = '
@@ -1914,15 +1914,15 @@  discard block
 block discarded – undo
1914 1914
 					Show
1915 1915
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1916 1916
 
1917
-		foreach ( $values as $value ) {
1918
-			if ( $value < $max_entries ) {
1919
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1917
+		foreach ($values as $value) {
1918
+			if ($value < $max_entries) {
1919
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1920 1920
 				$entries_per_page_dropdown .= '
1921 1921
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1922 1922
 			}
1923 1923
 		}
1924 1924
 
1925
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1925
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1926 1926
 		$entries_per_page_dropdown .= '
1927 1927
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1928 1928
 
@@ -1945,8 +1945,8 @@  discard block
 block discarded – undo
1945 1945
 	*		@return 		void
1946 1946
 	*/
1947 1947
 	public function _set_search_attributes() {
1948
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1949
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1948
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1949
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1950 1950
 	}
1951 1951
 
1952 1952
 	/*** END LIST TABLE METHODS **/
@@ -1965,20 +1965,20 @@  discard block
 block discarded – undo
1965 1965
 	 * @return void
1966 1966
 	*/
1967 1967
 	private function _add_registered_meta_boxes() {
1968
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1968
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1969 1969
 
1970 1970
 		//we only add meta boxes if the page_route calls for it
1971
-		if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) {
1971
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) {
1972 1972
 
1973 1973
 
1974 1974
 			//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.
1975
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1976
-				if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) {
1975
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1976
+				if (call_user_func(array($this, &$metabox_callback)) === FALSE) {
1977 1977
 					// user error msg
1978
-				$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
1978
+				$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
1979 1979
 				// developer error msg
1980
-				$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 );
1981
-				throw new EE_Error( $error_msg );
1980
+				$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);
1981
+				throw new EE_Error($error_msg);
1982 1982
 				}
1983 1983
 			}
1984 1984
 		}
@@ -1995,17 +1995,17 @@  discard block
 block discarded – undo
1995 1995
 	 * @return void
1996 1996
 	 */
1997 1997
 	private function _add_screen_columns() {
1998
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
1998
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
1999 1999
 
2000
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2000
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2001 2001
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2002 2002
 			$screen_id = $this->_current_screen->id;
2003 2003
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2004
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2005
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2004
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2005
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2006 2006
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2007 2007
 			$this->_template_args['screen'] = $this->_current_screen;
2008
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2008
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2009 2009
 
2010 2010
 			//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.
2011 2011
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2022,11 +2022,11 @@  discard block
 block discarded – undo
2022 2022
 	 */
2023 2023
 
2024 2024
 	private function _espresso_news_post_box() {
2025
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2026
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2025
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2026
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2027 2027
 			$this,
2028 2028
 			'espresso_news_post_box'
2029
-		), $this->_wp_page_slug, 'side' );
2029
+		), $this->_wp_page_slug, 'side');
2030 2030
 	}
2031 2031
 
2032 2032
 
@@ -2034,14 +2034,14 @@  discard block
 block discarded – undo
2034 2034
 	 * Code for setting up espresso ratings request metabox.
2035 2035
 	 */
2036 2036
 	protected function _espresso_ratings_request() {
2037
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2037
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2038 2038
 			return '';
2039 2039
 		}
2040
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2041
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2040
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2041
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2042 2042
 			$this,
2043 2043
 			'espresso_ratings_request'
2044
-		), $this->_wp_page_slug, 'side' );
2044
+		), $this->_wp_page_slug, 'side');
2045 2045
 	}
2046 2046
 
2047 2047
 
@@ -2049,34 +2049,34 @@  discard block
 block discarded – undo
2049 2049
 	 * Code for setting up espresso ratings request metabox content.
2050 2050
 	 */
2051 2051
 	public function espresso_ratings_request() {
2052
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2053
-		EEH_Template::display_template( $template_path, array() );
2052
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2053
+		EEH_Template::display_template($template_path, array());
2054 2054
 	}
2055 2055
 
2056 2056
 
2057 2057
 
2058 2058
 
2059
-	public static function cached_rss_display( $rss_id, $url ) {
2060
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2061
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2062
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2063
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2064
-		$post = '</div>' . "\n";
2059
+	public static function cached_rss_display($rss_id, $url) {
2060
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2061
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2062
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2063
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2064
+		$post = '</div>'."\n";
2065 2065
 
2066
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2067
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2068
-			echo $pre . $output . $post;
2066
+		$cache_key = 'ee_rss_'.md5($rss_id);
2067
+		if (FALSE != ($output = get_transient($cache_key))) {
2068
+			echo $pre.$output.$post;
2069 2069
 			return TRUE;
2070 2070
 		}
2071 2071
 
2072
-		if ( ! $doing_ajax ) {
2073
-			echo $pre . $loading . $post;
2072
+		if ( ! $doing_ajax) {
2073
+			echo $pre.$loading.$post;
2074 2074
 			return FALSE;
2075 2075
 		}
2076 2076
 
2077 2077
 		ob_start();
2078
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2079
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2078
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2079
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2080 2080
 		return TRUE;
2081 2081
 
2082 2082
 	}
@@ -2088,13 +2088,13 @@  discard block
 block discarded – undo
2088 2088
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2089 2089
 	  		<?php
2090 2090
 	  		// Get RSS Feed(s)
2091
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2091
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2092 2092
 	  		$url = urlencode($feed_url);
2093
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2093
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2094 2094
 
2095 2095
 	  		?>
2096 2096
 	  	</div>
2097
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2097
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2098 2098
 	  </div>
2099 2099
 		<?php
2100 2100
 	}
@@ -2115,32 +2115,32 @@  discard block
 block discarded – undo
2115 2115
 
2116 2116
 	protected function _espresso_sponsors_post_box() {
2117 2117
 
2118
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2119
-		if ( $show_sponsors )
2120
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2118
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2119
+		if ($show_sponsors)
2120
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2121 2121
 	}
2122 2122
 
2123 2123
 
2124 2124
 	public function espresso_sponsors_post_box() {
2125
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2126
-		EEH_Template::display_template( $templatepath );
2125
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2126
+		EEH_Template::display_template($templatepath);
2127 2127
 	}
2128 2128
 
2129 2129
 
2130 2130
 
2131 2131
 	private function _publish_post_box() {
2132
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2132
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2133 2133
 
2134 2134
 		//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)
2135
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2136
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2135
+		if ( ! empty($this->_labels['publishbox'])) {
2136
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2137 2137
 		} else {
2138 2138
 			$box_label = __('Publish', 'event_espresso');
2139 2139
 		}
2140 2140
 
2141
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2141
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2142 2142
 
2143
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2143
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2144 2144
 
2145 2145
 	}
2146 2146
 
@@ -2148,9 +2148,9 @@  discard block
 block discarded – undo
2148 2148
 
2149 2149
 	public function editor_overview() {
2150 2150
 		//if we have extra content set let's add it in if not make sure its empty
2151
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2152
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2153
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2151
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2152
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2153
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2154 2154
 	}
2155 2155
 
2156 2156
 
@@ -2166,8 +2166,8 @@  discard block
 block discarded – undo
2166 2166
 	 * @see $this->_set_publish_post_box_vars for param details
2167 2167
 	 * @since 4.6.0
2168 2168
 	 */
2169
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2170
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2169
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2170
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2171 2171
 	}
2172 2172
 
2173 2173
 
@@ -2186,24 +2186,24 @@  discard block
 block discarded – undo
2186 2186
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2187 2187
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2188 2188
 	 */
2189
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2189
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2190 2190
 
2191 2191
 		// if Save & Close, use a custom redirect URL or default to the main page?
2192
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2192
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2193 2193
 		// create the Save & Close and Save buttons
2194
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2194
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2195 2195
 		//if we have extra content set let's add it in if not make sure its empty
2196
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2196
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2197 2197
 
2198 2198
 
2199
-		if ( $delete && ! empty( $id )  ) {
2199
+		if ($delete && ! empty($id)) {
2200 2200
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2201
-			$delete_link_args = array( $name => $id );
2202
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2201
+			$delete_link_args = array($name => $id);
2202
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2203 2203
 		}
2204 2204
 
2205
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2206
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2205
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2206
+		if ( ! empty($name) && ! empty($id)) {
2207 2207
 			$hidden_field_arr[$name] = array(
2208 2208
 				'type' => 'hidden',
2209 2209
 				'value' => $id
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
 			$hf = '';
2214 2214
 		}
2215 2215
 		// add hidden field
2216
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2216
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2217 2217
 
2218 2218
 	}
2219 2219
 
@@ -2230,8 +2230,8 @@  discard block
 block discarded – undo
2230 2230
 		<noscript>
2231 2231
 			<div id="no-js-message" class="error">
2232 2232
 				<p style="font-size:1.3em;">
2233
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2234
-					<?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?>
2233
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2234
+					<?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'); ?>
2235 2235
 				</p>
2236 2236
 			</div>
2237 2237
 		</noscript>
@@ -2251,7 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 	*		@return 		string
2252 2252
 	*/
2253 2253
 	private function _display_espresso_notices() {
2254
-		$notices = $this->_get_transient( TRUE );
2254
+		$notices = $this->_get_transient(TRUE);
2255 2255
 		echo stripslashes($notices);
2256 2256
 	}
2257 2257
 
@@ -2303,11 +2303,11 @@  discard block
 block discarded – undo
2303 2303
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2304 2304
 	 * @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.
2305 2305
 	 */
2306
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2307
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2306
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2307
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2308 2308
 
2309 2309
 		//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.
2310
-		if ( empty( $callback_args ) && $create_func ) {
2310
+		if (empty($callback_args) && $create_func) {
2311 2311
 			$callback_args = array(
2312 2312
 				'template_path' => $this->_template_path,
2313 2313
 				'template_args' => $this->_template_args,
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 		//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)
2318 2318
 		$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;
2319 2319
 
2320
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2320
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2321 2321
 	}
2322 2322
 
2323 2323
 
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 	 */
2331 2331
 	public function display_admin_page_with_metabox_columns() {
2332 2332
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2333
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2333
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2334 2334
 
2335 2335
 		//the final wrapper
2336 2336
 		$this->admin_page_wrapper();
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
 	 * @return void
2374 2374
 	 */
2375 2375
 	public function display_about_admin_page() {
2376
-		$this->_display_admin_page( FALSE, TRUE );
2376
+		$this->_display_admin_page(FALSE, TRUE);
2377 2377
 	}
2378 2378
 
2379 2379
 
@@ -2389,26 +2389,26 @@  discard block
 block discarded – undo
2389 2389
 	 * @return html           admin_page
2390 2390
 	 */
2391 2391
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2392
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2392
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2393 2393
 
2394 2394
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2395
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2395
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2396 2396
 
2397 2397
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2398 2398
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2399 2399
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2400 2400
 
2401
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2401
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2402 2402
 
2403
-		if ( defined('DOING_AJAX' ) )
2404
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2403
+		if (defined('DOING_AJAX'))
2404
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2405 2405
 
2406
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2406
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2407 2407
 
2408
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2408
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2409 2409
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2410 2410
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2411
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2411
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2412 2412
 
2413 2413
 
2414 2414
 		// the final template wrapper
@@ -2428,7 +2428,7 @@  discard block
 block discarded – undo
2428 2428
 	 * @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.
2429 2429
 	 * @return void
2430 2430
 	 */
2431
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2431
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2432 2432
 		//let's generate a default preview action button if there isn't one already present.
2433 2433
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2434 2434
 		$buy_now_url = add_query_arg(
@@ -2441,10 +2441,10 @@  discard block
 block discarded – undo
2441 2441
 			),
2442 2442
 		'http://eventespresso.com/pricing/'
2443 2443
 		);
2444
-		$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'];
2445
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2446
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2447
-		$this->_display_admin_page( $display_sidebar );
2444
+		$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'];
2445
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2446
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2447
+		$this->_display_admin_page($display_sidebar);
2448 2448
 	}
2449 2449
 
2450 2450
 
@@ -2478,41 +2478,41 @@  discard block
 block discarded – undo
2478 2478
 	 * @param boolean $sidebar whether to display with sidebar or not.
2479 2479
 	 * @return html
2480 2480
 	 */
2481
-	private function _display_admin_list_table_page( $sidebar = false ) {
2481
+	private function _display_admin_list_table_page($sidebar = false) {
2482 2482
 		//setup search attributes
2483 2483
 		$this->_set_search_attributes();
2484 2484
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2485
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2485
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2486 2486
 
2487
-		$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);
2487
+		$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);
2488 2488
 		$this->_template_args['list_table'] = $this->_list_table_object;
2489 2489
 		$this->_template_args['current_route'] = $this->_req_action;
2490
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2490
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2491 2491
 
2492 2492
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2493
-		if( ! empty( $ajax_sorting_callback )) {
2494
-			$sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE );
2493
+		if ( ! empty($ajax_sorting_callback)) {
2494
+			$sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE);
2495 2495
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2496 2496
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2497
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2498
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2497
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2498
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2499 2499
 		} else {
2500 2500
 			$sortable_list_table_form_fields = '';
2501 2501
 		}
2502 2502
 
2503 2503
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2504
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2505
-		$nonce_ref = $this->_req_action . '_nonce';
2506
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2504
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2505
+		$nonce_ref = $this->_req_action.'_nonce';
2506
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2507 2507
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2508 2508
 
2509 2509
 		//display message about search results?
2510
-		$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 );
2510
+		$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);
2511 2511
 
2512
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2512
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2513 2513
 
2514 2514
 		// the final template wrapper
2515
-		if ( $sidebar )
2515
+		if ($sidebar)
2516 2516
 			$this->display_admin_page_with_sidebar();
2517 2517
 		else
2518 2518
 			$this->display_admin_page_with_no_sidebar();
@@ -2535,9 +2535,9 @@  discard block
 block discarded – undo
2535 2535
 	 * @param  array $items  see above for format of array
2536 2536
 	 * @return string        html string of legend
2537 2537
 	 */
2538
-	protected function _display_legend( $items ) {
2539
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2540
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2538
+	protected function _display_legend($items) {
2539
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2540
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2541 2541
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2542 2542
 	}
2543 2543
 
@@ -2562,33 +2562,33 @@  discard block
 block discarded – undo
2562 2562
 	 *
2563 2563
 	 * @return string json object
2564 2564
 	 */
2565
-	protected function _return_json( $sticky_notices = false ) {
2565
+	protected function _return_json($sticky_notices = false) {
2566 2566
 
2567 2567
 		//make sure any EE_Error notices have been handled.
2568
-		$this->_process_notices( array(), true, $sticky_notices );
2568
+		$this->_process_notices(array(), true, $sticky_notices);
2569 2569
 
2570 2570
 
2571
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2571
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2572 2572
 		unset($this->_template_args['data']);
2573 2573
 		$json = array(
2574
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2575
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2576
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2577
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2574
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2575
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2576
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2577
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2578 2578
 			'notices' => EE_Error::get_notices(),
2579
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2580
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2579
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2580
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2581 2581
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2582 2582
 			);
2583 2583
 
2584 2584
 
2585 2585
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2586
-		if ( NULL === error_get_last() || ! headers_sent() )
2586
+		if (NULL === error_get_last() || ! headers_sent())
2587 2587
 			header('Content-Type: application/json; charset=UTF-8');
2588
-                if( function_exists( 'wp_json_encode' ) ) {
2589
-                    echo wp_json_encode( $json );
2588
+                if (function_exists('wp_json_encode')) {
2589
+                    echo wp_json_encode($json);
2590 2590
                 } else {
2591
-                    echo json_encode( $json );
2591
+                    echo json_encode($json);
2592 2592
                 }
2593 2593
 		exit();
2594 2594
 	}
@@ -2600,11 +2600,11 @@  discard block
 block discarded – undo
2600 2600
 	 * @return json_obj|EE_Error
2601 2601
 	 */
2602 2602
 	public function return_json() {
2603
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2603
+		if (defined('DOING_AJAX') && DOING_AJAX)
2604 2604
 			$this->_return_json();
2605 2605
 
2606 2606
 		else {
2607
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2607
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2608 2608
 		}
2609 2609
 	}
2610 2610
 
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
 	 * @access public
2620 2620
 	 * @return void
2621 2621
 	 */
2622
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2622
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2623 2623
 		$this->_hook_obj = $hook_obj;
2624 2624
 	}
2625 2625
 
@@ -2635,33 +2635,33 @@  discard block
 block discarded – undo
2635 2635
 	*/
2636 2636
 	public function admin_page_wrapper($about = FALSE) {
2637 2637
 
2638
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2638
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2639 2639
 
2640 2640
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2641 2641
 
2642 2642
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2643 2643
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2644 2644
 
2645
-		$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'] : '');
2646
-		$this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : '');
2645
+		$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'] : '');
2646
+		$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'] : '');
2647 2647
 
2648 2648
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2649 2649
 
2650 2650
 
2651 2651
 
2652 2652
 		// load settings page wrapper template
2653
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2653
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2654 2654
 
2655 2655
 		//about page?
2656
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2656
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2657 2657
 
2658 2658
 
2659
-		if ( defined( 'DOING_AJAX' ) ) {
2660
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2659
+		if (defined('DOING_AJAX')) {
2660
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2661 2661
 
2662 2662
 			$this->_return_json();
2663 2663
 		} else {
2664
-			EEH_Template::display_template( $template_path, $this->_template_args );
2664
+			EEH_Template::display_template($template_path, $this->_template_args);
2665 2665
 		}
2666 2666
 
2667 2667
 	}
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
 	*		@access public
2690 2690
 	*		@return void
2691 2691
 	*/
2692
-	private function _sort_nav_tabs( $a, $b ) {
2692
+	private function _sort_nav_tabs($a, $b) {
2693 2693
 		if ($a['order'] == $b['order']) {
2694 2694
 	        return 0;
2695 2695
 	    }
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2711 2711
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2712 2712
 	 */
2713
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2713
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2714 2714
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2715 2715
 		return $content;
2716 2716
 	}
@@ -2732,25 +2732,25 @@  discard block
 block discarded – undo
2732 2732
 	 * @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.
2733 2733
 	 * @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).
2734 2734
 	 */
2735
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2735
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2736 2736
 		//make sure $text and $actions are in an array
2737 2737
 		$text = (array) $text;
2738 2738
 		$actions = (array) $actions;
2739 2739
 		$referrer_url = empty($referrer) ? '' : $referrer;
2740
-		$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 .'" />';
2740
+		$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.'" />';
2741 2741
 
2742
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2743
-		$default_names = array( 'save', 'save_and_close' );
2742
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2743
+		$default_names = array('save', 'save_and_close');
2744 2744
 
2745 2745
 		//add in a hidden index for the current page (so save and close redirects properly)
2746 2746
 		$this->_template_args['save_buttons'] = $referrer_url;
2747 2747
 
2748
-		foreach ( $button_text as $key => $button ) {
2748
+		foreach ($button_text as $key => $button) {
2749 2749
 			$ref = $default_names[$key];
2750
-			$id = $this->_current_view . '_' . $ref;
2751
-			$name = !empty($actions) ? $actions[$key] : $ref;
2752
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2753
-			if ( !$both ) break;
2750
+			$id = $this->_current_view.'_'.$ref;
2751
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2752
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2753
+			if ( ! $both) break;
2754 2754
 		}
2755 2755
 
2756 2756
 	}
@@ -2763,8 +2763,8 @@  discard block
 block discarded – undo
2763 2763
 	 * @since 4.6.0
2764 2764
 	 *
2765 2765
 	 */
2766
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2767
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2766
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2767
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2768 2768
 	}
2769 2769
 
2770 2770
 
@@ -2777,30 +2777,30 @@  discard block
 block discarded – undo
2777 2777
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2778 2778
 	 * @return void
2779 2779
 	 */
2780
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2780
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2781 2781
 
2782
-		if ( empty( $route )) {
2782
+		if (empty($route)) {
2783 2783
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2784
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2785
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2784
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2785
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2786 2786
 		}
2787 2787
 		// open form
2788
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2788
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2789 2789
 		// add nonce
2790
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2790
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2791 2791
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2792
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2792
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2793 2793
 		// add REQUIRED form action
2794 2794
 		$hidden_fields = array(
2795
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2795
+				'action' => array('type' => 'hidden', 'value' => $route),
2796 2796
 			);
2797 2797
 		// merge arrays
2798
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2798
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2799 2799
 		// generate form fields
2800
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2800
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2801 2801
 		// add fields to form
2802
-		foreach ( $form_fields as $field_name => $form_field ) {
2803
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2802
+		foreach ($form_fields as $field_name => $form_field) {
2803
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2804 2804
 		}
2805 2805
 
2806 2806
 		// close form
@@ -2817,8 +2817,8 @@  discard block
 block discarded – undo
2817 2817
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2818 2818
 	 * @since 4.5.0
2819 2819
 	 */
2820
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2821
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2820
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2821
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2822 2822
 	}
2823 2823
 
2824 2824
 
@@ -2834,32 +2834,32 @@  discard block
 block discarded – undo
2834 2834
 	 *	@access protected
2835 2835
 	 *	@return void
2836 2836
 	 */
2837
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2837
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2838 2838
 
2839
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2839
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2840 2840
 
2841 2841
 		//class name for actions/filters.
2842 2842
 		$classname = get_class($this);
2843 2843
 
2844 2844
 		//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
2845
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2846
-		$notices = EE_Error::get_notices( FALSE );
2845
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2846
+		$notices = EE_Error::get_notices(FALSE);
2847 2847
 
2848 2848
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2849
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2849
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2850 2850
 			EE_Error::overwrite_success();
2851 2851
 		}
2852 2852
 		// how many records affected ? more than one record ? or just one ?
2853
-		if ( $success > 1 && empty( $notices['errors'] )) {
2853
+		if ($success > 1 && empty($notices['errors'])) {
2854 2854
 			// set plural msg
2855
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2856
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2855
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2856
+		} else if ($success == 1 && empty($notices['errors'])) {
2857 2857
 			// set singular msg
2858
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2858
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2859 2859
 		}
2860 2860
 
2861 2861
 		// check that $query_args isn't something crazy
2862
-		if ( ! is_array( $query_args )) {
2862
+		if ( ! is_array($query_args)) {
2863 2863
 			$query_args = array();
2864 2864
 		}
2865 2865
 
@@ -2872,36 +2872,36 @@  discard block
 block discarded – undo
2872 2872
 		 * @param array $query_args   The original query_args array coming into the
2873 2873
 		 *                          		method.
2874 2874
 		 */
2875
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2875
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2876 2876
 
2877 2877
 		//calculate where we're going (if we have a "save and close" button pushed)
2878
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2878
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2879 2879
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2880
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2880
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2881 2881
 			// regenerate query args array from refferer URL
2882
-			parse_str( $parsed_url['query'], $query_args );
2882
+			parse_str($parsed_url['query'], $query_args);
2883 2883
 			// correct page and action will be in the query args now
2884
-			$redirect_url = admin_url( 'admin.php' );
2884
+			$redirect_url = admin_url('admin.php');
2885 2885
 		}
2886 2886
 
2887 2887
 		//merge any default query_args set in _default_route_query_args property
2888
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2888
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2889 2889
 			$args_to_merge = array();
2890
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2890
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2891 2891
 				//is there a wp_referer array in our _default_route_query_args property?
2892
-				if ( $query_param == 'wp_referer'  ) {
2892
+				if ($query_param == 'wp_referer') {
2893 2893
 					$query_value = (array) $query_value;
2894
-					foreach ( $query_value as $reference => $value ) {
2895
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2894
+					foreach ($query_value as $reference => $value) {
2895
+						if (strpos($reference, 'nonce') !== false) {
2896 2896
 							continue;
2897 2897
 						}
2898 2898
 
2899 2899
 						//finally we will override any arguments in the referer with
2900 2900
 						//what might be set on the _default_route_query_args array.
2901
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2902
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2901
+						if (isset($this->_default_route_query_args[$reference])) {
2902
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2903 2903
 						} else {
2904
-							$args_to_merge[$reference] = urlencode( $value );
2904
+							$args_to_merge[$reference] = urlencode($value);
2905 2905
 						}
2906 2906
 					}
2907 2907
 					continue;
@@ -2912,7 +2912,7 @@  discard block
 block discarded – undo
2912 2912
 
2913 2913
 			//now let's merge these arguments but override with what was specifically sent in to the
2914 2914
 			//redirect.
2915
-			$query_args = array_merge( $args_to_merge, $query_args );
2915
+			$query_args = array_merge($args_to_merge, $query_args);
2916 2916
 		}
2917 2917
 
2918 2918
 		$this->_process_notices($query_args);
@@ -2921,19 +2921,19 @@  discard block
 block discarded – undo
2921 2921
 		// generate redirect url
2922 2922
 
2923 2923
 		// if redirecting to anything other than the main page, add a nonce
2924
-		if ( isset( $query_args['action'] )) {
2924
+		if (isset($query_args['action'])) {
2925 2925
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2926
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2926
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2927 2927
 		}
2928 2928
 
2929 2929
 		//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).
2930
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2930
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2931 2931
 
2932
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2932
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2933 2933
 
2934 2934
 
2935 2935
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2936
-		if ( defined('DOING_AJAX' ) ) {
2936
+		if (defined('DOING_AJAX')) {
2937 2937
 			$default_data = array(
2938 2938
 				'close' => TRUE,
2939 2939
 				'redirect_url' => $redirect_url,
@@ -2942,11 +2942,11 @@  discard block
 block discarded – undo
2942 2942
 				);
2943 2943
 
2944 2944
 			$this->_template_args['success'] = $success;
2945
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2945
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2946 2946
 			$this->_return_json();
2947 2947
 		}
2948 2948
 
2949
-		wp_safe_redirect( $redirect_url );
2949
+		wp_safe_redirect($redirect_url);
2950 2950
 		exit();
2951 2951
 	}
2952 2952
 
@@ -2962,30 +2962,30 @@  discard block
 block discarded – undo
2962 2962
 	 * @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.
2963 2963
 	 * @return void
2964 2964
 	 */
2965
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
2965
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
2966 2966
 
2967 2967
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
2968
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2969
-			$notices = EE_Error::get_notices( false );
2970
-			if ( empty( $this->_template_args['success'] ) ) {
2971
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
2968
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2969
+			$notices = EE_Error::get_notices(false);
2970
+			if (empty($this->_template_args['success'])) {
2971
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
2972 2972
 			}
2973 2973
 
2974
-			if ( empty( $this->_template_args['errors'] ) ) {
2975
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
2974
+			if (empty($this->_template_args['errors'])) {
2975
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
2976 2976
 			}
2977 2977
 
2978
-			if ( empty( $this->_template_args['attention'] ) ) {
2979
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
2978
+			if (empty($this->_template_args['attention'])) {
2979
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
2980 2980
 			}
2981 2981
 		}
2982 2982
 
2983 2983
 		$this->_template_args['notices'] = EE_Error::get_notices();
2984 2984
 
2985 2985
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
2986
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
2987
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
2988
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
2986
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
2987
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
2988
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
2989 2989
 		}
2990 2990
 	}
2991 2991
 
@@ -3007,32 +3007,32 @@  discard block
 block discarded – undo
3007 3007
 	 *
3008 3008
 	 * @return string html for button
3009 3009
 	 */
3010
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3010
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
3011 3011
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3012
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3013
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3012
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
3013
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
3014 3014
 
3015
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3016
-			throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) );
3015
+		if ( ! isset($this->_labels['buttons'][$type]))
3016
+			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));
3017 3017
 
3018 3018
 		//finally check user access for this button.
3019
-		$has_access = $this->check_user_access( $action, TRUE );
3020
-		if ( ! $has_access ) {
3019
+		$has_access = $this->check_user_access($action, TRUE);
3020
+		if ( ! $has_access) {
3021 3021
 			return '';
3022 3022
 		}
3023 3023
 
3024
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
3024
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3025 3025
 
3026 3026
 		$query_args = array(
3027 3027
 			'action' => $action  );
3028 3028
 
3029 3029
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3030
-		if ( !empty($extra_request) )
3031
-			$query_args = array_merge( $extra_request, $query_args );
3030
+		if ( ! empty($extra_request))
3031
+			$query_args = array_merge($extra_request, $query_args);
3032 3032
 
3033
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3033
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3034 3034
 
3035
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3035
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3036 3036
 
3037 3037
 		return $button;
3038 3038
 	}
@@ -3052,11 +3052,11 @@  discard block
 block discarded – undo
3052 3052
 		$args = array(
3053 3053
 			'label' => $this->_admin_page_title,
3054 3054
 			'default' => 10,
3055
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3055
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3056 3056
 			);
3057 3057
 		//ONLY add the screen option if the user has access to it.
3058
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3059
-			add_screen_option( $option, $args );
3058
+		if ($this->check_user_access($this->_current_view, true)) {
3059
+			add_screen_option($option, $args);
3060 3060
 		}
3061 3061
 	}
3062 3062
 
@@ -3072,36 +3072,36 @@  discard block
 block discarded – undo
3072 3072
 	 * @return void
3073 3073
 	 */
3074 3074
 	private function _set_per_page_screen_options() {
3075
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3076
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3075
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3076
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3077 3077
 
3078
-			if ( !$user = wp_get_current_user() )
3078
+			if ( ! $user = wp_get_current_user())
3079 3079
 			return;
3080 3080
 			$option = $_POST['wp_screen_options']['option'];
3081 3081
 			$value = $_POST['wp_screen_options']['value'];
3082 3082
 
3083
-			if ( $option != sanitize_key( $option ) )
3083
+			if ($option != sanitize_key($option))
3084 3084
 				return;
3085 3085
 
3086 3086
 			$map_option = $option;
3087 3087
 
3088 3088
 			$option = str_replace('-', '_', $option);
3089 3089
 
3090
-			switch ( $map_option ) {
3091
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3090
+			switch ($map_option) {
3091
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3092 3092
 					$value = (int) $value;
3093
-					if ( $value < 1 || $value > 999 )
3093
+					if ($value < 1 || $value > 999)
3094 3094
 						return;
3095 3095
 					break;
3096 3096
 				default:
3097
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3098
-					if ( false === $value )
3097
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3098
+					if (false === $value)
3099 3099
 						return;
3100 3100
 					break;
3101 3101
 			}
3102 3102
 
3103 3103
 			update_user_meta($user->ID, $option, $value);
3104
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3104
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3105 3105
 			exit;
3106 3106
 		}
3107 3107
 	}
@@ -3112,8 +3112,8 @@  discard block
 block discarded – undo
3112 3112
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3113 3113
 	 * @param array $data array that will be assigned to template args.
3114 3114
 	 */
3115
-	public function set_template_args( $data ) {
3116
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3115
+	public function set_template_args($data) {
3116
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3117 3117
 	}
3118 3118
 
3119 3119
 
@@ -3129,26 +3129,26 @@  discard block
 block discarded – undo
3129 3129
 	 * @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.
3130 3130
 	 * @return void
3131 3131
 	 */
3132
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3132
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3133 3133
 		$user_id = get_current_user_id();
3134 3134
 
3135
-		if ( !$skip_route_verify )
3135
+		if ( ! $skip_route_verify)
3136 3136
 			$this->_verify_route($route);
3137 3137
 
3138 3138
 
3139 3139
 		//now let's set the string for what kind of transient we're setting
3140
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3141
-		$data = $notices ? array( 'notices' => $data ) : $data;
3140
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3141
+		$data = $notices ? array('notices' => $data) : $data;
3142 3142
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3143
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3144
-		if ( $existing ) {
3145
-			$data = array_merge( (array) $data, (array) $existing );
3143
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3144
+		if ($existing) {
3145
+			$data = array_merge((array) $data, (array) $existing);
3146 3146
 		}
3147 3147
 
3148
-		if ( is_multisite() && is_network_admin() ) {
3149
-			set_site_transient( $transient, $data, 8 );
3148
+		if (is_multisite() && is_network_admin()) {
3149
+			set_site_transient($transient, $data, 8);
3150 3150
 		} else {
3151
-			set_transient( $transient, $data, 8 );
3151
+			set_transient($transient, $data, 8);
3152 3152
 		}
3153 3153
 	}
3154 3154
 
@@ -3160,18 +3160,18 @@  discard block
 block discarded – undo
3160 3160
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3161 3161
 	 * @return mixed data
3162 3162
 	 */
3163
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3163
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3164 3164
 		$user_id = get_current_user_id();
3165
-		$route = !$route ? $this->_req_action : $route;
3166
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3167
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3165
+		$route = ! $route ? $this->_req_action : $route;
3166
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3167
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3168 3168
 		//delete transient after retrieval (just in case it hasn't expired);
3169
-		if ( is_multisite() && is_network_admin() ) {
3170
-			delete_site_transient( $transient );
3169
+		if (is_multisite() && is_network_admin()) {
3170
+			delete_site_transient($transient);
3171 3171
 		} else {
3172
-			delete_transient( $transient );
3172
+			delete_transient($transient);
3173 3173
 		}
3174
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3174
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3175 3175
 	}
3176 3176
 
3177 3177
 
@@ -3188,12 +3188,12 @@  discard block
 block discarded – undo
3188 3188
 
3189 3189
 		//retrieve all existing transients
3190 3190
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3191
-		if ( $results = $wpdb->get_results( $query ) ) {
3192
-			foreach ( $results as $result ) {
3193
-				$transient = str_replace( '_transient_', '', $result->option_name );
3194
-				get_transient( $transient );
3195
-				if ( is_multisite() && is_network_admin() ) {
3196
-					get_site_transient( $transient );
3191
+		if ($results = $wpdb->get_results($query)) {
3192
+			foreach ($results as $result) {
3193
+				$transient = str_replace('_transient_', '', $result->option_name);
3194
+				get_transient($transient);
3195
+				if (is_multisite() && is_network_admin()) {
3196
+					get_site_transient($transient);
3197 3197
 				}
3198 3198
 			}
3199 3199
 		}
@@ -3317,23 +3317,23 @@  discard block
 block discarded – undo
3317 3317
 	 * @param string $line	line no where error occurred
3318 3318
 	 * @return boolean
3319 3319
 	 */
3320
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3320
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3321 3321
 
3322 3322
 		//remove any options that are NOT going to be saved with the config settings.
3323
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3323
+		if (isset($config->core->ee_ueip_optin)) {
3324 3324
 			$config->core->ee_ueip_has_notified = TRUE;
3325 3325
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3326
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3327
-			update_option( 'ee_ueip_has_notified', TRUE );
3326
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3327
+			update_option('ee_ueip_has_notified', TRUE);
3328 3328
 		}
3329 3329
 		// and save it (note we're also doing the network save here)
3330
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3331
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3332
-		if ( $config_saved && $net_saved ) {
3333
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3330
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3331
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3332
+		if ($config_saved && $net_saved) {
3333
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3334 3334
 			return TRUE;
3335 3335
 		} else {
3336
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3336
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3337 3337
 			return FALSE;
3338 3338
 		}
3339 3339
 	}
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3347 3347
 	 * @return array
3348 3348
 	 */
3349
-	public function get_yes_no_values(){
3349
+	public function get_yes_no_values() {
3350 3350
 		return $this->_yes_no_values;
3351 3351
 	}
3352 3352
 
@@ -3368,8 +3368,8 @@  discard block
 block discarded – undo
3368 3368
 	 *
3369 3369
 	 * @return string
3370 3370
 	 */
3371
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3372
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3371
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3372
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3373 3373
 	}
3374 3374
 
3375 3375
 
@@ -3383,8 +3383,8 @@  discard block
 block discarded – undo
3383 3383
 	 *
3384 3384
 	 * @return string
3385 3385
 	 */
3386
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3387
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3386
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3387
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3388 3388
 	}
3389 3389
 
3390 3390
 
@@ -3403,8 +3403,8 @@  discard block
 block discarded – undo
3403 3403
 	 * @return bool success/fail
3404 3404
 	 */
3405 3405
 	protected function _process_resend_registration() {
3406
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3407
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3406
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3407
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3408 3408
 		return $this->_template_args['success'];
3409 3409
 	}
3410 3410
 
@@ -3417,11 +3417,11 @@  discard block
 block discarded – undo
3417 3417
 	 * @param \EE_Payment $payment
3418 3418
 	 * @return bool success/fail
3419 3419
 	 */
3420
-	protected function _process_payment_notification( EE_Payment $payment ) {
3421
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3422
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3423
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3424
-		return $this->_template_args[ 'success' ];
3420
+	protected function _process_payment_notification(EE_Payment $payment) {
3421
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3422
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3423
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3424
+		return $this->_template_args['success'];
3425 3425
 	}
3426 3426
 
3427 3427
 
Please login to merge, or discard this patch.
Braces   +149 added lines, -94 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * Event Espresso
6 8
  *
@@ -158,8 +160,9 @@  discard block
 block discarded – undo
158 160
 	 */
159 161
 	public function __construct( $routing = TRUE ) {
160 162
 
161
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
162
-			$this->_is_caf = TRUE;
163
+		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) {
164
+					$this->_is_caf = TRUE;
165
+		}
163 166
 
164 167
 		$this->_yes_no_values = array(
165 168
 			array('id' => TRUE, 'text' => __('Yes', 'event_espresso')),
@@ -190,8 +193,9 @@  discard block
 block discarded – undo
190 193
 		$this->_do_other_page_hooks();
191 194
 
192 195
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
193
-		if ( method_exists( $this, '_before_page_setup' ) )
194
-			$this->_before_page_setup();
196
+		if ( method_exists( $this, '_before_page_setup' ) ) {
197
+					$this->_before_page_setup();
198
+		}
195 199
 
196 200
 		//set up page dependencies
197 201
 		$this->_page_setup();
@@ -498,7 +502,9 @@  discard block
 block discarded – undo
498 502
 		global $ee_menu_slugs;
499 503
 		$ee_menu_slugs = (array) $ee_menu_slugs;
500 504
 
501
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
505
+		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) {
506
+			return FALSE;
507
+		}
502 508
 
503 509
 
504 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
@@ -533,12 +539,14 @@  discard block
 block discarded – undo
533 539
 		}
534 540
 
535 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
536
-		if ( method_exists( $this, '_extend_page_config' ) )
537
-			$this->_extend_page_config();
542
+		if ( method_exists( $this, '_extend_page_config' ) ) {
543
+					$this->_extend_page_config();
544
+		}
538 545
 
539 546
 		//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.
540
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
541
-			$this->_extend_page_config_for_cpt();
547
+		if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) {
548
+					$this->_extend_page_config_for_cpt();
549
+		}
542 550
 
543 551
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
544 552
 		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
@@ -654,8 +662,9 @@  discard block
 block discarded – undo
654 662
 		//add screen options - global, page child class, and view specific
655 663
 		$this->_add_global_screen_options();
656 664
 		$this->_add_screen_options();
657
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
658
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
665
+		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) {
666
+					call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
667
+		}
659 668
 
660 669
 
661 670
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -666,28 +675,32 @@  discard block
 block discarded – undo
666 675
 		//add feature_pointers - global, page child class, and view specific
667 676
 		$this->_add_feature_pointers();
668 677
 		$this->_add_global_feature_pointers();
669
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
670
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
678
+		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) {
679
+					call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
680
+		}
671 681
 
672 682
 		//enqueue scripts/styles - global, page class, and view specific
673 683
 		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
674 684
 		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
675
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
676
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
685
+		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) {
686
+					add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
687
+		}
677 688
 
678 689
 		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
679 690
 
680 691
 		//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
681 692
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
682 693
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
683
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
684
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
694
+		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) {
695
+					add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
696
+		}
685 697
 
686 698
 		//admin footer scripts
687 699
 		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
688 700
 		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
689
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
690
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
701
+		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) {
702
+					add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
703
+		}
691 704
 
692 705
 
693 706
 		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
@@ -760,7 +773,9 @@  discard block
 block discarded – undo
760 773
 	protected function _verify_routes() {
761 774
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
762 775
 
763
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
776
+		if ( !$this->_current_page && !defined( 'DOING_AJAX')) {
777
+			return FALSE;
778
+		}
764 779
 
765 780
 		$this->_route = FALSE;
766 781
 		$func = FALSE;
@@ -870,8 +885,9 @@  discard block
 block discarded – undo
870 885
 	 * @return void
871 886
 	 */
872 887
 	protected function _route_admin_request() {
873
-		if (  ! $this->_is_UI_request )
874
-			$this->_verify_routes();
888
+		if (  ! $this->_is_UI_request ) {
889
+					$this->_verify_routes();
890
+		}
875 891
 
876 892
 		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
877 893
 
@@ -881,8 +897,9 @@  discard block
 block discarded – undo
881 897
 			$this->_verify_nonce( $nonce, $this->_req_nonce );
882 898
 		}
883 899
 		//set the nav_tabs array but ONLY if this is  UI_request
884
-		if ( $this->_is_UI_request )
885
-			$this->_set_nav_tabs();
900
+		if ( $this->_is_UI_request ) {
901
+					$this->_set_nav_tabs();
902
+		}
886 903
 
887 904
 		// grab callback function
888 905
 		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
@@ -919,8 +936,9 @@  discard block
 block discarded – undo
919 936
 			}
920 937
 
921 938
 
922
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
923
-				throw new EE_Error( $error_msg );
939
+			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) {
940
+							throw new EE_Error( $error_msg );
941
+			}
924 942
 		}
925 943
 
926 944
 		//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.
@@ -1047,8 +1065,9 @@  discard block
 block discarded – undo
1047 1065
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1048 1066
 				foreach ( $this->_help_tour['tours'] as $tour ) {
1049 1067
 					//if this is the end tour then we don't need to setup a button
1050
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1051
-						continue;
1068
+					if ( $tour instanceof EE_Help_Tour_final_stop ) {
1069
+											continue;
1070
+					}
1052 1071
 					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1053 1072
 				}
1054 1073
 				$tour_buttons .= implode('<br />', $tb);
@@ -1058,8 +1077,9 @@  discard block
 block discarded – undo
1058 1077
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1059 1078
 			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1060 1079
 				//check that the callback given is valid
1061
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1062
-					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) ) );
1080
+				if ( !method_exists($this, $config['help_sidebar'] ) ) {
1081
+									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) ) );
1082
+				}
1063 1083
 
1064 1084
 				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1065 1085
 
@@ -1083,18 +1103,23 @@  discard block
 block discarded – undo
1083 1103
 				}/**/
1084 1104
 
1085 1105
 
1086
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1106
+			if ( !isset( $config['help_tabs'] ) ) {
1107
+				return;
1108
+			}
1109
+			//no help tabs for this route
1087 1110
 
1088 1111
 			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1089 1112
 				//we're here so there ARE help tabs!
1090 1113
 
1091 1114
 				//make sure we've got what we need
1092
-				if ( !isset( $cfg['title'] ) )
1093
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1115
+				if ( !isset( $cfg['title'] ) ) {
1116
+									throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1117
+				}
1094 1118
 
1095 1119
 
1096
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1097
-					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') );
1120
+				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) {
1121
+									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') );
1122
+				}
1098 1123
 
1099 1124
 
1100 1125
 
@@ -1157,14 +1182,16 @@  discard block
 block discarded – undo
1157 1182
 		$this->_help_tour = array();
1158 1183
 
1159 1184
 		//exit early if help tours are turned off globally
1160
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1161
-			return;
1185
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) {
1186
+					return;
1187
+		}
1162 1188
 
1163 1189
 		//loop through _page_config to find any help_tour defined
1164 1190
 		foreach ( $this->_page_config as $route => $config ) {
1165 1191
 			//we're only going to set things up for this route
1166
-			if ( $route !== $this->_req_action )
1167
-				continue;
1192
+			if ( $route !== $this->_req_action ) {
1193
+							continue;
1194
+			}
1168 1195
 
1169 1196
 			if ( isset( $config['help_tour'] ) ) {
1170 1197
 
@@ -1199,8 +1226,9 @@  discard block
 block discarded – undo
1199 1226
 			}
1200 1227
 		}
1201 1228
 
1202
-		if ( !empty( $tours ) )
1203
-			$this->_help_tour['tours'] = $tours;
1229
+		if ( !empty( $tours ) ) {
1230
+					$this->_help_tour['tours'] = $tours;
1231
+		}
1204 1232
 
1205 1233
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
1206 1234
 	}
@@ -1240,15 +1268,21 @@  discard block
 block discarded – undo
1240 1268
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1241 1269
 		$i = 0;
1242 1270
 		foreach ( $this->_page_config as $slug => $config ) {
1243
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1244
-				continue; //no nav tab for this config
1271
+			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) {
1272
+							continue;
1273
+			}
1274
+			//no nav tab for this config
1245 1275
 
1246 1276
 			//check for persistent flag
1247
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1248
-				continue; //nav tab is only to appear when route requested.
1277
+			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) {
1278
+							continue;
1279
+			}
1280
+			//nav tab is only to appear when route requested.
1249 1281
 
1250
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1251
-				continue; //no nav tab becasue current user does not have access.
1282
+			if ( ! $this->check_user_access( $slug, TRUE ) ) {
1283
+							continue;
1284
+			}
1285
+			//no nav tab becasue current user does not have access.
1252 1286
 
1253 1287
 			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1254 1288
 			$this->_nav_tabs[$slug] = array(
@@ -1484,10 +1518,11 @@  discard block
 block discarded – undo
1484 1518
 			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1485 1519
 		}
1486 1520
 
1487
-		if ( $display )
1488
-			echo $content;
1489
-		else
1490
-			return $content;
1521
+		if ( $display ) {
1522
+					echo $content;
1523
+		} else {
1524
+					return $content;
1525
+		}
1491 1526
 	}
1492 1527
 
1493 1528
 
@@ -1504,8 +1539,9 @@  discard block
 block discarded – undo
1504 1539
 		$method_name = '_help_popup_content_' . $this->_req_action;
1505 1540
 
1506 1541
 		//if method doesn't exist let's get out.
1507
-		if ( !method_exists( $this, $method_name ) )
1508
-			return array();
1542
+		if ( !method_exists( $this, $method_name ) ) {
1543
+					return array();
1544
+		}
1509 1545
 
1510 1546
 		//k we're good to go let's retrieve the help array
1511 1547
 		$help_array = call_user_func( array( $this, $method_name ) );
@@ -1536,7 +1572,9 @@  discard block
 block discarded – undo
1536 1572
 	 */
1537 1573
 	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1538 1574
 
1539
-		if ( defined('DOING_AJAX') ) return;
1575
+		if ( defined('DOING_AJAX') ) {
1576
+			return;
1577
+		}
1540 1578
 
1541 1579
 		//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
1542 1580
 		$help_array = $this->_get_help_content();
@@ -1554,10 +1592,11 @@  discard block
 block discarded – undo
1554 1592
 		$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>';
1555 1593
 		$content = $content . $help_content;
1556 1594
 
1557
-		if ( $display )
1558
-			echo $content;
1559
-		else
1560
-			return $content;
1595
+		if ( $display ) {
1596
+					echo $content;
1597
+		} else {
1598
+					return $content;
1599
+		}
1561 1600
 	}
1562 1601
 
1563 1602
 
@@ -1783,8 +1822,10 @@  discard block
 block discarded – undo
1783 1822
 	protected function _set_list_table() {
1784 1823
 
1785 1824
 		//first is this a list_table view?
1786
-		if ( !isset($this->_route_config['list_table']) )
1787
-			return; //not a list_table view so get out.
1825
+		if ( !isset($this->_route_config['list_table']) ) {
1826
+					return;
1827
+		}
1828
+		//not a list_table view so get out.
1788 1829
 
1789 1830
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1790 1831
 
@@ -1840,8 +1881,9 @@  discard block
 block discarded – undo
1840 1881
 	 */
1841 1882
 	protected function _set_list_table_object() {
1842 1883
 		if ( isset($this->_route_config['list_table'] ) ) {
1843
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1844
-				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) ) );
1884
+			if ( !class_exists( $this->_route_config['list_table'] ) ) {
1885
+							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) ) );
1886
+			}
1845 1887
 			$a = new ReflectionClass($this->_route_config['list_table']);
1846 1888
 			$this->_list_table_object = $a->newInstance($this);
1847 1889
 		}
@@ -2116,8 +2158,9 @@  discard block
 block discarded – undo
2116 2158
 	protected function _espresso_sponsors_post_box() {
2117 2159
 
2118 2160
 		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2119
-		if ( $show_sponsors )
2120
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2161
+		if ( $show_sponsors ) {
2162
+					add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2163
+		}
2121 2164
 	}
2122 2165
 
2123 2166
 
@@ -2400,8 +2443,9 @@  discard block
 block discarded – undo
2400 2443
 
2401 2444
 		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2402 2445
 
2403
-		if ( defined('DOING_AJAX' ) )
2404
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2446
+		if ( defined('DOING_AJAX' ) ) {
2447
+					$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2448
+		}
2405 2449
 
2406 2450
 		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2407 2451
 
@@ -2512,10 +2556,11 @@  discard block
 block discarded – undo
2512 2556
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2513 2557
 
2514 2558
 		// the final template wrapper
2515
-		if ( $sidebar )
2516
-			$this->display_admin_page_with_sidebar();
2517
-		else
2518
-			$this->display_admin_page_with_no_sidebar();
2559
+		if ( $sidebar ) {
2560
+					$this->display_admin_page_with_sidebar();
2561
+		} else {
2562
+					$this->display_admin_page_with_no_sidebar();
2563
+		}
2519 2564
 	}
2520 2565
 
2521 2566
 
@@ -2583,8 +2628,9 @@  discard block
 block discarded – undo
2583 2628
 
2584 2629
 
2585 2630
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2586
-		if ( NULL === error_get_last() || ! headers_sent() )
2587
-			header('Content-Type: application/json; charset=UTF-8');
2631
+		if ( NULL === error_get_last() || ! headers_sent() ) {
2632
+					header('Content-Type: application/json; charset=UTF-8');
2633
+		}
2588 2634
                 if( function_exists( 'wp_json_encode' ) ) {
2589 2635
                     echo wp_json_encode( $json );
2590 2636
                 } else {
@@ -2600,10 +2646,9 @@  discard block
 block discarded – undo
2600 2646
 	 * @return json_obj|EE_Error
2601 2647
 	 */
2602 2648
 	public function return_json() {
2603
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2604
-			$this->_return_json();
2605
-
2606
-		else {
2649
+		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2650
+					$this->_return_json();
2651
+		} else {
2607 2652
 			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2608 2653
 		}
2609 2654
 	}
@@ -2750,7 +2795,9 @@  discard block
 block discarded – undo
2750 2795
 			$id = $this->_current_view . '_' . $ref;
2751 2796
 			$name = !empty($actions) ? $actions[$key] : $ref;
2752 2797
 			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2753
-			if ( !$both ) break;
2798
+			if ( !$both ) {
2799
+				break;
2800
+			}
2754 2801
 		}
2755 2802
 
2756 2803
 	}
@@ -3009,11 +3056,13 @@  discard block
 block discarded – undo
3009 3056
 	 */
3010 3057
 	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
3011 3058
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3012
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
3013
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3059
+		if ( !isset($this->_page_routes[$action]) && !$base_url ) {
3060
+					throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
3061
+		}
3014 3062
 
3015
-		if ( !isset( $this->_labels['buttons'][$type] ) )
3016
-			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) );
3063
+		if ( !isset( $this->_labels['buttons'][$type] ) ) {
3064
+					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) );
3065
+		}
3017 3066
 
3018 3067
 		//finally check user access for this button.
3019 3068
 		$has_access = $this->check_user_access( $action, TRUE );
@@ -3027,8 +3076,9 @@  discard block
 block discarded – undo
3027 3076
 			'action' => $action  );
3028 3077
 
3029 3078
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3030
-		if ( !empty($extra_request) )
3031
-			$query_args = array_merge( $extra_request, $query_args );
3079
+		if ( !empty($extra_request) ) {
3080
+					$query_args = array_merge( $extra_request, $query_args );
3081
+		}
3032 3082
 
3033 3083
 		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3034 3084
 
@@ -3075,13 +3125,15 @@  discard block
 block discarded – undo
3075 3125
 		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3076 3126
 			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3077 3127
 
3078
-			if ( !$user = wp_get_current_user() )
3079
-			return;
3128
+			if ( !$user = wp_get_current_user() ) {
3129
+						return;
3130
+			}
3080 3131
 			$option = $_POST['wp_screen_options']['option'];
3081 3132
 			$value = $_POST['wp_screen_options']['value'];
3082 3133
 
3083
-			if ( $option != sanitize_key( $option ) )
3084
-				return;
3134
+			if ( $option != sanitize_key( $option ) ) {
3135
+							return;
3136
+			}
3085 3137
 
3086 3138
 			$map_option = $option;
3087 3139
 
@@ -3090,13 +3142,15 @@  discard block
 block discarded – undo
3090 3142
 			switch ( $map_option ) {
3091 3143
 				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3092 3144
 					$value = (int) $value;
3093
-					if ( $value < 1 || $value > 999 )
3094
-						return;
3145
+					if ( $value < 1 || $value > 999 ) {
3146
+											return;
3147
+					}
3095 3148
 					break;
3096 3149
 				default:
3097 3150
 					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3098
-					if ( false === $value )
3099
-						return;
3151
+					if ( false === $value ) {
3152
+											return;
3153
+					}
3100 3154
 					break;
3101 3155
 			}
3102 3156
 
@@ -3132,8 +3186,9 @@  discard block
 block discarded – undo
3132 3186
 	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3133 3187
 		$user_id = get_current_user_id();
3134 3188
 
3135
-		if ( !$skip_route_verify )
3136
-			$this->_verify_route($route);
3189
+		if ( !$skip_route_verify ) {
3190
+					$this->_verify_route($route);
3191
+		}
3137 3192
 
3138 3193
 
3139 3194
 		//now let's set the string for what kind of transient we're setting
Please login to merge, or discard this patch.
core/EE_Psr4AutoloaderInit.core.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
4 4
 
5 5
 use EventEspresso\core\Psr4Autoloader;
6 6
 
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public static function initialize_psr4_loader() {
40 40
 		static $initialized = false;
41
-		if ( ! $initialized ) {
41
+		if ( ! $initialized) {
42 42
 			// instantiate PSR4 autoloader
43
-			espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' );
43
+			espresso_load_required('Psr4Autoloader', EE_CORE.'Psr4Autoloader.php');
44 44
 			EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader();
45 45
 			// register the autoloader
46 46
 			EE_Psr4AutoloaderInit::$psr4_loader->register();
47 47
 			// register the base directories for the namespace prefix
48
-			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspresso', EE_PLUGIN_DIR_PATH );
49
-			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspressoBatchRequest', EE_LIBRARIES . 'batch' );
48
+			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
49
+			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES.'batch');
50 50
 			$initialized = true;
51 51
 		}
52 52
 	}
Please login to merge, or discard this patch.
core/EE_Encryption.core.php 2 patches
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  * EE_Encryption class
6 6
  *
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @access private
32 32
 	 */
33 33
   private function __construct() {
34
-		define( 'ESPRESSO_ENCRYPT', true );
35
-		if ( ! function_exists( 'mcrypt_encrypt' ) ) {
34
+		define('ESPRESSO_ENCRYPT', true);
35
+		if ( ! function_exists('mcrypt_encrypt')) {
36 36
 			$this->_use_mcrypt = false;
37 37
 		}
38 38
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 *	@access public
45 45
 	 * @return \EE_Encryption
46 46
 	 */
47
-	public static function instance ( ) {
47
+	public static function instance( ) {
48 48
 		// check if class object is instantiated
49
-		if ( ! self::$_instance instanceof EE_Encryption ) {
49
+		if ( ! self::$_instance instanceof EE_Encryption) {
50 50
 			self::$_instance = new self();
51 51
 		}
52 52
 		return self::$_instance;
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public  function get_encryption_key() {
63 63
 		// if encryption key has not been set
64
-		if ( empty( $this->_encryption_key )) {
64
+		if (empty($this->_encryption_key)) {
65 65
 			// retrieve encryption_key from db
66
-			$this->_encryption_key = get_option( 'ee_encryption_key', '' );
66
+			$this->_encryption_key = get_option('ee_encryption_key', '');
67 67
 			// WHAT?? No encryption_key in the db ??
68
-			if ( $this->_encryption_key == '' ) {
68
+			if ($this->_encryption_key == '') {
69 69
 				// let's make one. And md5 it to make it just the right size for a key
70
-				$new_key =  md5( self::generate_random_string() );
70
+				$new_key = md5(self::generate_random_string());
71 71
 				// now save it to the db for later
72
-				add_option( 'ee_encryption_key', $new_key );
72
+				add_option('ee_encryption_key', $new_key);
73 73
 				// here's the key - FINALLY !
74 74
 				$this->_encryption_key = $new_key;
75 75
 			}
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
 	 * @param string $text_string  - the text to be encrypted
86 86
 	 * @return string
87 87
 	 */
88
-	public function encrypt ( $text_string = '' ) {
88
+	public function encrypt($text_string = '') {
89 89
 		// you give me nothing??? GET OUT !
90
-		if  ( empty( $text_string ))  {
90
+		if (empty($text_string)) {
91 91
 			return $text_string;
92 92
 		}
93
-		if ( $this->_use_mcrypt ) {
94
-			$encrypted_text = $this->m_encrypt( $text_string );
93
+		if ($this->_use_mcrypt) {
94
+			$encrypted_text = $this->m_encrypt($text_string);
95 95
 		} else {
96
-			$encrypted_text = $this->acme_encrypt( $text_string );
96
+			$encrypted_text = $this->acme_encrypt($text_string);
97 97
 		}
98 98
 		return $encrypted_text;
99 99
 	}
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 	 * @param string $encrypted_text - the text to be decrypted
107 107
 	 * @return string
108 108
 	 */
109
-	public function decrypt  ( $encrypted_text = '' )  {
109
+	public function decrypt($encrypted_text = '') {
110 110
 		// you give me nothing??? GET OUT !
111
-		if  ( empty( $encrypted_text ))  {
111
+		if (empty($encrypted_text)) {
112 112
 			return $encrypted_text;
113 113
 		}
114 114
 		// if PHP's mcrypt functions are installed then we'll use them
115
-		if ( $this->_use_mcrypt ) {
116
-			$decrypted_text = $this->m_decrypt( $encrypted_text );
115
+		if ($this->_use_mcrypt) {
116
+			$decrypted_text = $this->m_decrypt($encrypted_text);
117 117
 		} else {
118
-			$decrypted_text = $this->acme_decrypt( $encrypted_text );
118
+			$decrypted_text = $this->acme_decrypt($encrypted_text);
119 119
 		}
120 120
 		return $decrypted_text;
121 121
  	}
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 	 * @internal param $string - the text to be encoded
131 131
 	 * @return string
132 132
 	 */
133
-	public function base64_url_encode ( $text_string = '' ) {
133
+	public function base64_url_encode($text_string = '') {
134 134
 		// you give me nothing??? GET OUT !
135
-		if  ( ! $text_string )  {
135
+		if ( ! $text_string) {
136 136
 			return $text_string;
137 137
 		}
138 138
 		// encode
139
-		$encoded_string = base64_encode ( $text_string );
139
+		$encoded_string = base64_encode($text_string);
140 140
 		// remove chars to make encoding more URL friendly
141
-		$encoded_string = strtr ( $encoded_string, '+/=', '-_,' );
141
+		$encoded_string = strtr($encoded_string, '+/=', '-_,');
142 142
 		return $encoded_string;
143 143
 	}
144 144
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 * @internal param $string - the text to be decoded
153 153
 	 * @return string
154 154
 	 */
155
-	public function base64_url_decode ( $encoded_string = '' ) {
155
+	public function base64_url_decode($encoded_string = '') {
156 156
 		// you give me nothing??? GET OUT !
157
-		if  ( ! $encoded_string )  {
157
+		if ( ! $encoded_string) {
158 158
 			return $encoded_string;
159 159
 		}
160 160
 		// replace previously removed characters
161
-		$encoded_string = strtr ( $encoded_string, '-_,', '+/=' );
161
+		$encoded_string = strtr($encoded_string, '-_,', '+/=');
162 162
 		// decode
163
-		$decoded_string = base64_decode ( $encoded_string );
163
+		$decoded_string = base64_decode($encoded_string);
164 164
 		return $decoded_string;
165 165
 	}
166 166
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	 * @internal param $string - the text to be encrypted
174 174
 	 * @return string
175 175
 	 */
176
-	private function m_encrypt  ( $text_string = '' ) {
176
+	private function m_encrypt($text_string = '') {
177 177
 		// you give me nothing??? GET OUT !
178
-		if  ( ! $text_string )  {
178
+		if ( ! $text_string) {
179 179
 			return $text_string;
180 180
 		}
181 181
 		// get the initialization vector size
182
-		$iv_size = mcrypt_get_iv_size ( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
182
+		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
183 183
 		// initialization vector
184
-		$iv = mcrypt_create_iv ( $iv_size, MCRYPT_RAND );
184
+		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
185 185
 		// encrypt it
186
-		$encrypted_text = mcrypt_encrypt ( MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $text_string, MCRYPT_MODE_ECB, $iv );
186
+		$encrypted_text = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $text_string, MCRYPT_MODE_ECB, $iv);
187 187
 		// trim and encode
188
-		$encrypted_text = trim ( base64_encode( $encrypted_text ) );
188
+		$encrypted_text = trim(base64_encode($encrypted_text));
189 189
 		return $encrypted_text;
190 190
 	}
191 191
 
@@ -198,19 +198,19 @@  discard block
 block discarded – undo
198 198
 	 * @internal param $string - the text to be decrypted
199 199
 	 * @return string
200 200
 	 */
201
-	private function m_decrypt  ( $encrypted_text = '' )  {
201
+	private function m_decrypt($encrypted_text = '') {
202 202
 		// you give me nothing??? GET OUT !
203
-		if  ( ! $encrypted_text )  {
203
+		if ( ! $encrypted_text) {
204 204
 			return $encrypted_text;
205 205
 		}
206 206
 		// decode
207
-		$encrypted_text = base64_decode ( $encrypted_text );
207
+		$encrypted_text = base64_decode($encrypted_text);
208 208
 		// get the initialization vector size
209
-		$iv_size = mcrypt_get_iv_size ( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
210
-		$iv = mcrypt_create_iv ( $iv_size, MCRYPT_RAND );
209
+		$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
210
+		$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
211 211
 		// decrypt it
212
-		$decrypted_text = mcrypt_decrypt ( MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $encrypted_text, MCRYPT_MODE_ECB, $iv );
213
-		$decrypted_text = trim ( $decrypted_text );
212
+		$decrypted_text = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->get_encryption_key(), $encrypted_text, MCRYPT_MODE_ECB, $iv);
213
+		$decrypted_text = trim($decrypted_text);
214 214
 		return $decrypted_text;
215 215
 	}
216 216
 
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
 	 * @internal param $string - the text to be decrypted
225 225
 	 * @return string
226 226
 	 */
227
-	private function acme_encrypt ( $text_string = '' ) {
227
+	private function acme_encrypt($text_string = '') {
228 228
 		// you give me nothing??? GET OUT !
229
-		if  ( ! $text_string )  {
229
+		if ( ! $text_string) {
230 230
 			return $text_string;
231 231
 		}
232
-		$key_bits = str_split ( str_pad ( '', strlen( $text_string ), $this->get_encryption_key(), STR_PAD_RIGHT ));
233
-		$string_bits = str_split( $text_string );
234
-		foreach ( $string_bits as $k =>$v ) {
235
-			$temp = ord( $v ) + ord ( $key_bits[$k] );
236
-			$string_bits[$k] = chr ( $temp > 255 ? ( $temp - 256 ) : $temp );
232
+		$key_bits = str_split(str_pad('', strlen($text_string), $this->get_encryption_key(), STR_PAD_RIGHT));
233
+		$string_bits = str_split($text_string);
234
+		foreach ($string_bits as $k =>$v) {
235
+			$temp = ord($v) + ord($key_bits[$k]);
236
+			$string_bits[$k] = chr($temp > 255 ? ($temp - 256) : $temp);
237 237
 		}
238
-		$encrypted = base64_encode( join( '', $string_bits ) );
238
+		$encrypted = base64_encode(join('', $string_bits));
239 239
 		return $encrypted;
240 240
 	}
241 241
 
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
 	 * @internal param $string - the text to be decrypted
250 250
 	 * @return string
251 251
 	 */
252
-	private function acme_decrypt ( $encrypted_text = false ) {
252
+	private function acme_decrypt($encrypted_text = false) {
253 253
 		// you give me nothing??? GET OUT !
254
-		if  ( ! $encrypted_text )  {
254
+		if ( ! $encrypted_text) {
255 255
 			return false;
256 256
 		}
257
-		$encrypted_text = base64_decode ( $encrypted_text );
258
-		$key_bits = str_split ( str_pad ( '', strlen ( $encrypted_text ), $this->get_encryption_key(), STR_PAD_RIGHT ));
259
-		$string_bits = str_split ( $encrypted_text );
260
-		foreach ( $string_bits as $k => $v ) {
261
-			$temp = ord ( $v ) - ord ( $key_bits[$k] );
262
-			$string_bits[$k] = chr ( $temp < 0 ? ( $temp + 256 ) : $temp );
257
+		$encrypted_text = base64_decode($encrypted_text);
258
+		$key_bits = str_split(str_pad('', strlen($encrypted_text), $this->get_encryption_key(), STR_PAD_RIGHT));
259
+		$string_bits = str_split($encrypted_text);
260
+		foreach ($string_bits as $k => $v) {
261
+			$temp = ord($v) - ord($key_bits[$k]);
262
+			$string_bits[$k] = chr($temp < 0 ? ($temp + 256) : $temp);
263 263
 		}
264
-		$decrypted = join( '', $string_bits );
264
+		$decrypted = join('', $string_bits);
265 265
 		return $decrypted;
266 266
 	}
267 267
 
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 	 * @internal param $string - number of characters for random string
276 276
 	 * @return string
277 277
 	 */
278
-	public function generate_random_string ( $length = 40 ) {
279
-		$iterations = ceil ( $length / 40 );
278
+	public function generate_random_string($length = 40) {
279
+		$iterations = ceil($length / 40);
280 280
 		$random_string = '';
281
-		for ($i = 0; $i < $iterations; $i ++) {
282
-			$random_string .= sha1( microtime(TRUE) . mt_rand( 10000, 90000 ));
281
+		for ($i = 0; $i < $iterations; $i++) {
282
+			$random_string .= sha1(microtime(TRUE).mt_rand(10000, 90000));
283 283
 		}
284
-		$random_string =  substr( $random_string, 0, $length );
284
+		$random_string = substr($random_string, 0, $length);
285 285
 		return $random_string;
286 286
 	}
287 287
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\InterminableInterface;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if (!defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * EE_Encryption class
6 8
  *
Please login to merge, or discard this patch.
core/EE_Config.core.php 2 patches
Spacing   +392 added lines, -392 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  * Event Espresso
6 6
  *
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public static function instance() {
132 132
 		// check if class object is instantiated, and instantiated properly
133
-		if ( ! self::$_instance instanceof EE_Config ) {
133
+		if ( ! self::$_instance instanceof EE_Config) {
134 134
 			self::$_instance = new self();
135 135
 		}
136 136
 		return self::$_instance;
@@ -147,22 +147,22 @@  discard block
 block discarded – undo
147 147
 	 * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode)
148 148
 	 * @return EE_Config
149 149
 	 */
150
-	public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){
151
-		if ( $hard_reset ) {
150
+	public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) {
151
+		if ($hard_reset) {
152 152
 			self::$_instance->_config_option_names = array();
153 153
 			self::$_instance->_initialize_config();
154 154
 			self::$_instance->update_espresso_config();
155 155
 		}
156
-		if( self::$_instance instanceof EE_Config ){
156
+		if (self::$_instance instanceof EE_Config) {
157 157
 			self::$_instance->shutdown();
158 158
 		}
159 159
 		self::$_instance = NULL;
160 160
 		//we don't need to reset the static properties imo because those should
161 161
 		//only change when a module is added or removed. Currently we don't
162 162
 		//support removing a module during a request when it previously existed
163
-		if( $reinstantiate ){
163
+		if ($reinstantiate) {
164 164
 			return self::instance();
165
-		}else{
165
+		} else {
166 166
 			return NULL;
167 167
 		}
168 168
 	}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	 * @return \EE_Config
177 177
 	 */
178 178
 	private function __construct() {
179
-		do_action( 'AHEE__EE_Config__construct__begin',$this );
180
-		$this->_config_option_names = get_option( 'ee_config_option_names', array() );
179
+		do_action('AHEE__EE_Config__construct__begin', $this);
180
+		$this->_config_option_names = get_option('ee_config_option_names', array());
181 181
 		// setup empty config classes
182 182
 		$this->_initialize_config();
183 183
 		// load existing EE site settings
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 		// confirm everything loaded correctly and set filtered defaults if not
186 186
 		$this->_verify_config();
187 187
 		//  register shortcodes and modules
188
-		add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 );
188
+		add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999);
189 189
 		//  initialize shortcodes and modules
190
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ));
190
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
191 191
 		// register widgets
192
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
192
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
193 193
 		// shutdown
194
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
194
+		add_action('shutdown', array($this, 'shutdown'), 10);
195 195
 		// construct__end hook
196
-		do_action( 'AHEE__EE_Config__construct__end',$this );
196
+		do_action('AHEE__EE_Config__construct__end', $this);
197 197
 		// hardcoded hack
198 198
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
199 199
 	}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @return string current theme set.
207 207
 	 */
208 208
 	public static function get_current_theme() {
209
-		return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
209
+		return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
210 210
 	}
211 211
 
212 212
 
@@ -240,27 +240,27 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	private function _load_core_config() {
242 242
 		// load_core_config__start hook
243
-		do_action( 'AHEE__EE_Config___load_core_config__start', $this );
243
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
244 244
 		$espresso_config = $this->get_espresso_config();
245
-		foreach ( $espresso_config as $config => $settings ) {
245
+		foreach ($espresso_config as $config => $settings) {
246 246
 			// load_core_config__start hook
247
-			$settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this );
248
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
249
-				$this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
247
+			$settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this);
248
+			if (is_object($settings) && property_exists($this, $config)) {
249
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
250 250
 				//call configs populate method to ensure any defaults are set for empty values.
251
-				if ( method_exists( $settings, 'populate' ) ) {
251
+				if (method_exists($settings, 'populate')) {
252 252
 					$this->{$config}->populate();
253 253
 				}
254
-				if ( method_exists( $settings, 'do_hooks' ) ) {
254
+				if (method_exists($settings, 'do_hooks')) {
255 255
 					$this->{$config}->do_hooks();
256 256
 				}
257 257
 			}
258 258
 		}
259
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) {
259
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) {
260 260
 			$this->update_espresso_config();
261 261
 		}
262 262
 		// load_core_config__end hook
263
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
263
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
264 264
 	}
265 265
 
266 266
 
@@ -274,40 +274,40 @@  discard block
 block discarded – undo
274 274
 	protected function _verify_config() {
275 275
 
276 276
 		$this->core = $this->core instanceof EE_Core_Config
277
-			? $this->core  : new EE_Core_Config();
278
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
277
+			? $this->core : new EE_Core_Config();
278
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
279 279
 
280 280
 		$this->organization = $this->organization instanceof EE_Organization_Config
281
-			? $this->organization  : new EE_Organization_Config();
282
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
281
+			? $this->organization : new EE_Organization_Config();
282
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
283 283
 
284 284
 		$this->currency = $this->currency instanceof EE_Currency_Config
285 285
 			? $this->currency : new EE_Currency_Config();
286
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
286
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
287 287
 
288 288
 		$this->registration = $this->registration instanceof EE_Registration_Config
289 289
 			? $this->registration : new EE_Registration_Config();
290
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
290
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
291 291
 
292 292
 		$this->admin = $this->admin instanceof EE_Admin_Config
293 293
 			? $this->admin : new EE_Admin_Config();
294
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
294
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
295 295
 
296 296
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
297 297
 			? $this->template_settings : new EE_Template_Config();
298
-		$this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings );
298
+		$this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings);
299 299
 
300 300
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
301 301
 			? $this->map_settings : new EE_Map_Config();
302
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
302
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
303 303
 
304 304
 		$this->environment = $this->environment instanceof EE_Environment_Config
305 305
 			? $this->environment : new EE_Environment_Config();
306
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
306
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
307 307
 
308 308
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
309 309
 			? $this->gateway : new EE_Gateway_Config();
310
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
310
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
311 311
 
312 312
 	}
313 313
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	public function get_espresso_config() {
323 323
 		// grab espresso configuration
324
-		return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() ));
324
+		return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array()));
325 325
 	}
326 326
 
327 327
 
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 * @param        $old_value
335 335
 	 * @param        $value
336 336
 	 */
337
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
337
+	public function double_check_config_comparison($option = '', $old_value, $value) {
338 338
 		// make sure we're checking the ee config
339
-		if ( $option == 'ee_config' ) {
339
+		if ($option == 'ee_config') {
340 340
 			// run a loose comparison of the old value against the new value for type and properties,
341 341
 			// but NOT exact instance like WP update_option does
342
-			if ( $value != $old_value ) {
342
+			if ($value != $old_value) {
343 343
 				// if they are NOT the same, then remove the hook,
344 344
 				// which means the subsequent update results will be based solely on the update query results
345 345
 				// the reason we do this is because, as stated above,
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 				// the string it sees in the db looks the same as the new one it has been passed!!!
355 355
 				// This results in the query returning an "affected rows" value of ZERO,
356 356
 				// which gets returned immediately by WP update_option and looks like an error.
357
-				remove_action( 'update_option', array( $this, 'check_config_updated' ));
357
+				remove_action('update_option', array($this, 'check_config_updated'));
358 358
 			}
359 359
 		}
360 360
 	}
@@ -369,11 +369,11 @@  discard block
 block discarded – undo
369 369
 	 */
370 370
 	protected function  _reset_espresso_addon_config() {
371 371
 		$this->_config_option_names = array();
372
-		foreach( $this->addons as $addon_name => $addon_config_obj ) {
373
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
374
-			$config_class = get_class( $addon_config_obj );
375
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
376
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE );
372
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
373
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
374
+			$config_class = get_class($addon_config_obj);
375
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
376
+				$this->update_config('addons', $addon_name, $addon_config_obj, FALSE);
377 377
 			}
378 378
 			$this->addons->{$addon_name} = NULL;
379 379
 		}
@@ -389,17 +389,17 @@  discard block
 block discarded – undo
389 389
 	 * @param   bool $add_error
390 390
 	 * @return   bool
391 391
 	 */
392
-	public function  update_espresso_config( $add_success = FALSE, $add_error = TRUE ) {
392
+	public function  update_espresso_config($add_success = FALSE, $add_error = TRUE) {
393 393
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
394 394
 		//$clone = clone( self::$_instance );
395 395
 		//self::$_instance = NULL;
396
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this );
396
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
397 397
 		$this->_reset_espresso_addon_config();
398 398
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
399 399
 		// but BEFORE the actual update occurs
400
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
400
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
401 401
 		// now update "ee_config"
402
-		$saved = update_option( 'ee_config', $this );
402
+		$saved = update_option('ee_config', $this);
403 403
 		// if not saved... check if the hook we just added still exists;
404 404
 		// if it does, it means one of two things:
405 405
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -410,25 +410,25 @@  discard block
 block discarded – undo
410 410
 		// but just means no update occurred, so don't display an error to the user.
411 411
 		// BUT... if update_option returns FALSE, AND the hook is missing,
412 412
 		// then it means that something truly went wrong
413
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved;
413
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
414 414
 		// remove our action since we don't want it in the system anymore
415
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
416
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
415
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
416
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
417 417
 		//self::$_instance = $clone;
418 418
 		//unset( $clone );
419 419
 		// if config remains the same or was updated successfully
420
-		if ( $saved ) {
421
-			if ( $add_success ) {
420
+		if ($saved) {
421
+			if ($add_success) {
422 422
 				EE_Error::add_success(
423
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
423
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
424 424
 					__FILE__, __FUNCTION__, __LINE__
425 425
 				);
426 426
 			}
427 427
 			return TRUE;
428 428
 		} else {
429
-			if ( $add_error ) {
429
+			if ($add_error) {
430 430
 				EE_Error::add_error(
431
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
431
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
432 432
 					__FILE__, __FUNCTION__, __LINE__
433 433
 				);
434 434
 			}
@@ -454,20 +454,20 @@  discard block
 block discarded – undo
454 454
 		$name = '',
455 455
 		$config_class = '',
456 456
 		$config_obj = NULL,
457
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
457
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
458 458
 		$display_errors = TRUE
459 459
 	) {
460 460
 		try {
461
-			foreach ( $tests_to_run as $test ) {
462
-				switch ( $test ) {
461
+			foreach ($tests_to_run as $test) {
462
+				switch ($test) {
463 463
 
464 464
 					// TEST #1 : check that section was set
465 465
 					case 1 :
466
-						if ( empty( $section ) ) {
467
-							if ( $display_errors ) {
466
+						if (empty($section)) {
467
+							if ($display_errors) {
468 468
 								throw new EE_Error(
469 469
 									sprintf(
470
-										__( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ),
470
+										__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'),
471 471
 										$config_class
472 472
 									)
473 473
 								);
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 
479 479
 					// TEST #2 : check that settings section exists
480 480
 					case 2 :
481
-						if ( ! isset( $this->{$section} ) ) {
482
-							if ( $display_errors ) {
481
+						if ( ! isset($this->{$section} )) {
482
+							if ($display_errors) {
483 483
 								throw new EE_Error(
484
-									sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ),
485
-											 $section )
484
+									sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'),
485
+											 $section)
486 486
 								);
487 487
 							}
488 488
 							return false;
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 					// TEST #3 : check that section is the proper format
493 493
 					case 3 :
494 494
 						if (
495
-							! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
495
+							! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
496 496
 						) {
497
-							if ( $display_errors ) {
497
+							if ($display_errors) {
498 498
 								throw new EE_Error(
499 499
 									sprintf(
500
-										__( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ),
500
+										__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'),
501 501
 										$section
502 502
 									)
503 503
 								);
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 
509 509
 					// TEST #4 : check that config section name has been set
510 510
 					case 4 :
511
-						if ( empty( $name ) ) {
512
-							if ( $display_errors ) {
511
+						if (empty($name)) {
512
+							if ($display_errors) {
513 513
 								throw new EE_Error(
514
-									__( 'No name has been provided for the specific configuration section.', 'event_espresso' )
514
+									__('No name has been provided for the specific configuration section.', 'event_espresso')
515 515
 								);
516 516
 							}
517 517
 							return false;
@@ -520,10 +520,10 @@  discard block
 block discarded – undo
520 520
 
521 521
 					// TEST #5 : check that a config class name has been set
522 522
 					case 5 :
523
-						if ( empty( $config_class ) ) {
524
-							if ( $display_errors ) {
523
+						if (empty($config_class)) {
524
+							if ($display_errors) {
525 525
 								throw new EE_Error(
526
-									__( 'No class name has been provided for the specific configuration section.', 'event_espresso' )
526
+									__('No class name has been provided for the specific configuration section.', 'event_espresso')
527 527
 								);
528 528
 							}
529 529
 							return false;
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
 
533 533
 					// TEST #6 : verify config class is accessible
534 534
 					case 6 :
535
-						if ( ! class_exists( $config_class ) ) {
536
-							if ( $display_errors ) {
535
+						if ( ! class_exists($config_class)) {
536
+							if ($display_errors) {
537 537
 								throw new EE_Error(
538 538
 									sprintf(
539
-										__( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ),
539
+										__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'),
540 540
 										$config_class
541 541
 									)
542 542
 								);
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
 
548 548
 					// TEST #7 : check that config has even been set
549 549
 					case 7 :
550
-						if ( ! isset( $this->{$section}->{$name} ) ) {
551
-							if ( $display_errors ) {
550
+						if ( ! isset($this->{$section}->{$name} )) {
551
+							if ($display_errors) {
552 552
 								throw new EE_Error(
553 553
 									sprintf(
554
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
554
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
555 555
 										$section,
556 556
 										$name
557 557
 									)
@@ -560,17 +560,17 @@  discard block
 block discarded – undo
560 560
 							return false;
561 561
 						} else {
562 562
 							// and make sure it's not serialized
563
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
563
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
564 564
 						}
565 565
 						break;
566 566
 
567 567
 					// TEST #8 : check that config is the requested type
568 568
 					case 8 :
569
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
570
-							if ( $display_errors ) {
569
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
570
+							if ($display_errors) {
571 571
 								throw new EE_Error(
572 572
 									sprintf(
573
-										__( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ),
573
+										__('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'),
574 574
 										$section,
575 575
 										$name,
576 576
 										$config_class
@@ -583,12 +583,12 @@  discard block
 block discarded – undo
583 583
 
584 584
 					// TEST #9 : verify config object
585 585
 					case 9 :
586
-						if ( ! $config_obj instanceof EE_Config_Base ) {
587
-							if ( $display_errors ) {
586
+						if ( ! $config_obj instanceof EE_Config_Base) {
587
+							if ($display_errors) {
588 588
 								throw new EE_Error(
589 589
 									sprintf(
590
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
591
-										print_r( $config_obj, true )
590
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
591
+										print_r($config_obj, true)
592 592
 									)
593 593
 								);
594 594
 							}
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 				}
600 600
 			}
601 601
 
602
-		} catch( EE_Error $e ) {
602
+		} catch (EE_Error $e) {
603 603
 			$e->get_error();
604 604
 		}
605 605
 		// you have successfully run the gauntlet
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 	 * @param        string          $name
617 617
 	 * @return        string
618 618
 	 */
619
-	private function _generate_config_option_name( $section = '', $name = '' ) {
620
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
619
+	private function _generate_config_option_name($section = '', $name = '') {
620
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
621 621
 	}
622 622
 
623 623
 
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 	 * @param 	string $name
632 632
 	 * @return 	string
633 633
 	 */
634
-	private function _set_config_class( $config_class = '', $name = '' ) {
635
-		return ! empty( $config_class )
634
+	private function _set_config_class($config_class = '', $name = '') {
635
+		return ! empty($config_class)
636 636
 			? $config_class
637
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
637
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
638 638
 	}
639 639
 
640 640
 
@@ -648,34 +648,34 @@  discard block
 block discarded – undo
648 648
 	 * @param 	EE_Config_Base $config_obj
649 649
 	 * @return 	EE_Config_Base
650 650
 	 */
651
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
651
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
652 652
 		// ensure config class is set to something
653
-		$config_class = $this->_set_config_class( $config_class, $name );
653
+		$config_class = $this->_set_config_class($config_class, $name);
654 654
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
655
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) {
655
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
656 656
 			return null;
657 657
 		}
658
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
658
+		$config_option_name = $this->_generate_config_option_name($section, $name);
659 659
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
660
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
661
-			$this->_config_option_names[ $config_option_name ] = $config_class;
660
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
661
+			$this->_config_option_names[$config_option_name] = $config_class;
662 662
 		}
663 663
 		// verify the incoming config object but suppress errors
664
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) {
664
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
665 665
 			$config_obj = new $config_class();
666 666
 		}
667
-		if ( get_option( $config_option_name ) ) {
668
-			update_option( $config_option_name, $config_obj );
667
+		if (get_option($config_option_name)) {
668
+			update_option($config_option_name, $config_obj);
669 669
 			$this->{$section}->{$name} = $config_obj;
670 670
 			return $this->{$section}->{$name};
671 671
 		} else {
672 672
 			// create a wp-option for this config
673
-			if ( add_option( $config_option_name, $config_obj, '', 'no' )) {
674
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
673
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
674
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
675 675
 				return $this->{$section}->{$name};
676 676
 			} else {
677 677
 				EE_Error::add_error(
678
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
678
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
679 679
 					__FILE__, __FUNCTION__, __LINE__
680 680
 				);
681 681
 				return null;
@@ -696,37 +696,37 @@  discard block
 block discarded – undo
696 696
 	 * @param 	bool 					$throw_errors
697 697
 	 * @return 	bool
698 698
 	 */
699
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
700
-		$config_obj = maybe_unserialize( $config_obj );
699
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
700
+		$config_obj = maybe_unserialize($config_obj);
701 701
 		// get class name of the incoming object
702
-		$config_class = get_class( $config_obj );
702
+		$config_class = get_class($config_obj);
703 703
 		// run tests 1-5 and 9 to verify config
704
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) {
704
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) {
705 705
 			return false;
706 706
 		}
707
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
707
+		$config_option_name = $this->_generate_config_option_name($section, $name);
708 708
 		// check if config object has been added to db by seeing if config option name is in $this->_config_option_names array
709
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
709
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
710 710
 			// save new config to db
711
-			return $this->set_config( $section, $name, $config_class, $config_obj );
711
+			return $this->set_config($section, $name, $config_class, $config_obj);
712 712
 		} else {
713 713
 			// first check if the record already exists
714
-			$existing_config = get_option( $config_option_name );
715
-			$config_obj = serialize( $config_obj );
714
+			$existing_config = get_option($config_option_name);
715
+			$config_obj = serialize($config_obj);
716 716
 			// just return if db record is already up to date
717
-			if ( $existing_config == $config_obj ) {
717
+			if ($existing_config == $config_obj) {
718 718
 				$this->{$section}->{$name} = $config_obj;
719 719
 				return true;
720
-			} else if ( update_option( $config_option_name, $config_obj )) {
720
+			} else if (update_option($config_option_name, $config_obj)) {
721 721
 				// update wp-option for this config class
722 722
 				$this->{$section}->{$name} = $config_obj;
723 723
 				return true;
724
-			} elseif ( $throw_errors ) {
724
+			} elseif ($throw_errors) {
725 725
 				EE_Error::add_error(
726 726
 					sprintf(
727
-						__( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ),
727
+						__('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'),
728 728
 						$config_class,
729
-						'EE_Config->' . $section . '->' . $name
729
+						'EE_Config->'.$section.'->'.$name
730 730
 					),
731 731
 					__FILE__, __FUNCTION__, __LINE__
732 732
 				);
@@ -746,34 +746,34 @@  discard block
 block discarded – undo
746 746
 	 * @param 	string 	$config_class
747 747
 	 * @return 	mixed EE_Config_Base | NULL
748 748
 	 */
749
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
749
+	public function get_config($section = '', $name = '', $config_class = '') {
750 750
 		// ensure config class is set to something
751
-		$config_class = $this->_set_config_class( $config_class, $name );
751
+		$config_class = $this->_set_config_class($config_class, $name);
752 752
 		// run tests 1-4, 6 and 7 to verify that all params have been set
753
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
753
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
754 754
 			return NULL;
755 755
 		}
756 756
 		// now test if the requested config object exists, but suppress errors
757
-		if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) {
757
+		if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) {
758 758
 			// config already exists, so pass it back
759 759
 			return $this->{$section}->{$name};
760 760
 		}
761 761
 		// load config option from db if it exists
762
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ));
762
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
763 763
 		// verify the newly retrieved config object, but suppress errors
764
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
764
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
765 765
 			// config is good, so set it and pass it back
766 766
 			$this->{$section}->{$name} = $config_obj;
767 767
 			return $this->{$section}->{$name};
768 768
 		}
769 769
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
770
-		$config_obj =$this->set_config( $section, $name, $config_class );
770
+		$config_obj = $this->set_config($section, $name, $config_class);
771 771
 		// verify the newly created config object
772
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) {
772
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
773 773
 			return $this->{$section}->{$name};
774 774
 		} else {
775 775
 			EE_Error::add_error(
776
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
776
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
777 777
 				__FILE__, __FUNCTION__, __LINE__
778 778
 			);
779 779
 		}
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
 	 * @param 	string 	$config_option_name
789 789
 	 * @return 	mixed EE_Config_Base | FALSE
790 790
 	 */
791
-	public function get_config_option( $config_option_name = '' ) {
791
+	public function get_config_option($config_option_name = '') {
792 792
 		// retrieve the wp-option for this config class.
793
-		return maybe_unserialize( get_option( $config_option_name ));
793
+		return maybe_unserialize(get_option($config_option_name));
794 794
 	}
795 795
 
796 796
 
@@ -805,14 +805,14 @@  discard block
 block discarded – undo
805 805
 	 *  @return 	string
806 806
 	 */
807 807
 	public static function get_page_for_posts() {
808
-		$page_for_posts = get_option( 'page_for_posts' );
809
-		if ( ! $page_for_posts ) {
808
+		$page_for_posts = get_option('page_for_posts');
809
+		if ( ! $page_for_posts) {
810 810
 			return 'posts';
811 811
 		}
812 812
 		/** @type WPDB $wpdb */
813 813
 		global $wpdb;
814 814
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
815
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ));
815
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
816 816
 	}
817 817
 
818 818
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 	 */
830 830
 	public function register_shortcodes_and_modules() {
831 831
 		// allow shortcodes to register with WP and to set hooks for the rest of the system
832
-		EE_Registry::instance()->shortcodes =$this->_register_shortcodes();
832
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
833 833
 		// allow modules to set hooks for the rest of the system
834 834
 		EE_Registry::instance()->modules = $this->_register_modules();
835 835
 	}
@@ -861,21 +861,21 @@  discard block
 block discarded – undo
861 861
 	public function widgets_init() {
862 862
 		//only init widgets on admin pages when not in complete maintenance, and
863 863
 		//on frontend when not in any maintenance mode
864
-		if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance)  || ! EE_Maintenance_Mode::instance()->level() ) {
864
+		if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) {
865 865
 			// grab list of installed widgets
866
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
866
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
867 867
 			// filter list of modules to register
868
-			$widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register );
868
+			$widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register);
869 869
 
870
-			if ( ! empty( $widgets_to_register ) ) {
870
+			if ( ! empty($widgets_to_register)) {
871 871
 				// cycle thru widget folders
872
-				foreach ( $widgets_to_register as $widget_path ) {
872
+				foreach ($widgets_to_register as $widget_path) {
873 873
 					// add to list of installed widget modules
874
-					EE_Config::register_ee_widget( $widget_path );
874
+					EE_Config::register_ee_widget($widget_path);
875 875
 				}
876 876
 			}
877 877
 			// filter list of installed modules
878
-			EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets );
878
+			EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets);
879 879
 		}
880 880
 	}
881 881
 
@@ -888,54 +888,54 @@  discard block
 block discarded – undo
888 888
 	 *  @param 	string 	$widget_path - full path up to and including widget folder
889 889
 	 *  @return 	void
890 890
 	 */
891
-	public static function register_ee_widget( $widget_path = NULL ) {
892
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
891
+	public static function register_ee_widget($widget_path = NULL) {
892
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
893 893
 		$widget_ext = '.widget.php';
894 894
 		// make all separators match
895
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
895
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
896 896
 		// does the file path INCLUDE the actual file name as part of the path ?
897
-		if ( strpos( $widget_path, $widget_ext ) !== FALSE ) {
897
+		if (strpos($widget_path, $widget_ext) !== FALSE) {
898 898
 			// grab and shortcode file name from directory name and break apart at dots
899
-			$file_name = explode( '.', basename( $widget_path ));
899
+			$file_name = explode('.', basename($widget_path));
900 900
 			// take first segment from file name pieces and remove class prefix if it exists
901
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
901
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
902 902
 			// sanitize shortcode directory name
903
-			$widget = sanitize_key( $widget );
903
+			$widget = sanitize_key($widget);
904 904
 			// now we need to rebuild the shortcode path
905
-			$widget_path = explode( DS, $widget_path );
905
+			$widget_path = explode(DS, $widget_path);
906 906
 			// remove last segment
907
-			array_pop( $widget_path );
907
+			array_pop($widget_path);
908 908
 			// glue it back together
909
-			$widget_path = implode( DS, $widget_path );
909
+			$widget_path = implode(DS, $widget_path);
910 910
 		} else {
911 911
 			// grab and sanitize widget directory name
912
-			$widget = sanitize_key( basename( $widget_path ));
912
+			$widget = sanitize_key(basename($widget_path));
913 913
 		}
914 914
 		// create classname from widget directory name
915
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget )));
915
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
916 916
 		// add class prefix
917
-		$widget_class = 'EEW_' . $widget;
917
+		$widget_class = 'EEW_'.$widget;
918 918
 		// does the widget exist ?
919
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) {
919
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
920 920
 			$msg = sprintf(
921
-				__( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ),
921
+				__('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'),
922 922
 				$widget_class,
923
-				$widget_path . DS . $widget_class . $widget_ext
923
+				$widget_path.DS.$widget_class.$widget_ext
924 924
 			);
925
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
925
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
926 926
 			return;
927 927
 		}
928 928
 		// load the widget class file
929
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
929
+		require_once($widget_path.DS.$widget_class.$widget_ext);
930 930
 		// verify that class exists
931
-		if ( ! class_exists( $widget_class )) {
932
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
933
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
931
+		if ( ! class_exists($widget_class)) {
932
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
933
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
934 934
 			return;
935 935
 		}
936
-		register_widget( $widget_class );
936
+		register_widget($widget_class);
937 937
 		// add to array of registered widgets
938
-		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
938
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
939 939
 	}
940 940
 
941 941
 
@@ -948,18 +948,18 @@  discard block
 block discarded – undo
948 948
 	 */
949 949
 	private function _register_shortcodes() {
950 950
 		// grab list of installed shortcodes
951
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
951
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
952 952
 		// filter list of modules to register
953
-		$shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register );
954
-		if ( ! empty( $shortcodes_to_register ) ) {
953
+		$shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register);
954
+		if ( ! empty($shortcodes_to_register)) {
955 955
 			// cycle thru shortcode folders
956
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
956
+			foreach ($shortcodes_to_register as $shortcode_path) {
957 957
 				// add to list of installed shortcode modules
958
-				EE_Config::register_shortcode( $shortcode_path );
958
+				EE_Config::register_shortcode($shortcode_path);
959 959
 			}
960 960
 		}
961 961
 		// filter list of installed modules
962
-		return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes );
962
+		return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes);
963 963
 	}
964 964
 
965 965
 
@@ -971,56 +971,56 @@  discard block
 block discarded – undo
971 971
 	 *  @param 	string 		$shortcode_path - full path up to and including shortcode folder
972 972
 	 *  @return 	bool
973 973
 	 */
974
-	public static function register_shortcode( $shortcode_path = NULL ) {
975
-		do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path );
974
+	public static function register_shortcode($shortcode_path = NULL) {
975
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
976 976
 		$shortcode_ext = '.shortcode.php';
977 977
 		// make all separators match
978
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
978
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
979 979
 		// does the file path INCLUDE the actual file name as part of the path ?
980
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) {
980
+		if (strpos($shortcode_path, $shortcode_ext) !== FALSE) {
981 981
 			// grab shortcode file name from directory name and break apart at dots
982
-			$shortcode_file = explode( '.', basename( $shortcode_path ));
982
+			$shortcode_file = explode('.', basename($shortcode_path));
983 983
 			// take first segment from file name pieces and remove class prefix if it exists
984
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0];
984
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0];
985 985
 			// sanitize shortcode directory name
986
-			$shortcode = sanitize_key( $shortcode );
986
+			$shortcode = sanitize_key($shortcode);
987 987
 			// now we need to rebuild the shortcode path
988
-			$shortcode_path = explode( DS, $shortcode_path );
988
+			$shortcode_path = explode(DS, $shortcode_path);
989 989
 			// remove last segment
990
-			array_pop( $shortcode_path );
990
+			array_pop($shortcode_path);
991 991
 			// glue it back together
992
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
992
+			$shortcode_path = implode(DS, $shortcode_path).DS;
993 993
 		} else {
994 994
 			// we need to generate the filename based off of the folder name
995 995
 			// grab and sanitize shortcode directory name
996
-			$shortcode = sanitize_key( basename( $shortcode_path ));
997
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
996
+			$shortcode = sanitize_key(basename($shortcode_path));
997
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
998 998
 		}
999 999
 		// create classname from shortcode directory or file name
1000
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode )));
1000
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1001 1001
 		// add class prefix
1002
-		$shortcode_class = 'EES_' . $shortcode;
1002
+		$shortcode_class = 'EES_'.$shortcode;
1003 1003
 		// does the shortcode exist ?
1004
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) {
1004
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1005 1005
 			$msg = sprintf(
1006
-				__( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ),
1006
+				__('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'),
1007 1007
 				$shortcode_class,
1008
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1008
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1009 1009
 			);
1010
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1010
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1011 1011
 			return FALSE;
1012 1012
 		}
1013 1013
 		// load the shortcode class file
1014
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1014
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1015 1015
 		// verify that class exists
1016
-		if ( ! class_exists( $shortcode_class )) {
1017
-			$msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class );
1018
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1016
+		if ( ! class_exists($shortcode_class)) {
1017
+			$msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class);
1018
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1019 1019
 			return FALSE;
1020 1020
 		}
1021
-		$shortcode = strtoupper( $shortcode );
1021
+		$shortcode = strtoupper($shortcode);
1022 1022
 		// add to array of registered shortcodes
1023
-		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1023
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1024 1024
 		return TRUE;
1025 1025
 	}
1026 1026
 
@@ -1035,23 +1035,23 @@  discard block
 block discarded – undo
1035 1035
 	 */
1036 1036
 	private function _register_modules() {
1037 1037
 		// grab list of installed modules
1038
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1038
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1039 1039
 		// filter list of modules to register
1040
-		$modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register );
1040
+		$modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register);
1041 1041
 
1042 1042
 
1043
-		if ( ! empty( $modules_to_register ) ) {
1043
+		if ( ! empty($modules_to_register)) {
1044 1044
 			// loop through folders
1045
-			foreach ( $modules_to_register as $module_path ) {
1045
+			foreach ($modules_to_register as $module_path) {
1046 1046
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1047
-				if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) {
1047
+				if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') {
1048 1048
 					// add to list of installed modules
1049
-					EE_Config::register_module( $module_path );
1049
+					EE_Config::register_module($module_path);
1050 1050
 				}
1051 1051
 			}
1052 1052
 		}
1053 1053
 		// filter list of installed modules
1054
-		return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules );
1054
+		return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules);
1055 1055
 	}
1056 1056
 
1057 1057
 
@@ -1064,54 +1064,54 @@  discard block
 block discarded – undo
1064 1064
 	 *  @param 	string 		$module_path - full path up to and including module folder
1065 1065
 	 *  @return 	bool
1066 1066
 	 */
1067
-	public static function register_module( $module_path = NULL ) {
1068
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1067
+	public static function register_module($module_path = NULL) {
1068
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1069 1069
 		$module_ext = '.module.php';
1070 1070
 		// make all separators match
1071
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1071
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1072 1072
 		// does the file path INCLUDE the actual file name as part of the path ?
1073
-		if ( strpos( $module_path, $module_ext ) !== FALSE ) {
1073
+		if (strpos($module_path, $module_ext) !== FALSE) {
1074 1074
 			// grab and shortcode file name from directory name and break apart at dots
1075
-			$module_file = explode( '.', basename( $module_path ));
1075
+			$module_file = explode('.', basename($module_path));
1076 1076
 			// now we need to rebuild the shortcode path
1077
-			$module_path = explode( DS, $module_path );
1077
+			$module_path = explode(DS, $module_path);
1078 1078
 			// remove last segment
1079
-			array_pop( $module_path );
1079
+			array_pop($module_path);
1080 1080
 			// glue it back together
1081
-			$module_path = implode( DS, $module_path ) . DS;
1081
+			$module_path = implode(DS, $module_path).DS;
1082 1082
 			// take first segment from file name pieces and sanitize it
1083
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1083
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1084 1084
 			// ensure class prefix is added
1085
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1085
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1086 1086
 		} else {
1087 1087
 			// we need to generate the filename based off of the folder name
1088 1088
 			// grab and sanitize module name
1089
-			$module = strtolower( basename( $module_path ));
1090
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module);
1089
+			$module = strtolower(basename($module_path));
1090
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1091 1091
 			// like trailingslashit()
1092
-			$module_path = rtrim( $module_path, DS ) . DS;
1092
+			$module_path = rtrim($module_path, DS).DS;
1093 1093
 			// create classname from module directory name
1094
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module )));
1094
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1095 1095
 			// add class prefix
1096
-			$module_class = 'EED_' . $module;
1096
+			$module_class = 'EED_'.$module;
1097 1097
 		}
1098 1098
 		// does the module exist ?
1099
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) {
1100
-			$msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
1101
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1099
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1100
+			$msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
1101
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1102 1102
 			return FALSE;
1103 1103
 		}
1104 1104
 		// load the module class file
1105
-		require_once( $module_path . $module_class . $module_ext );
1105
+		require_once($module_path.$module_class.$module_ext);
1106 1106
 		// verify that class exists
1107
-		if ( ! class_exists( $module_class )) {
1108
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1109
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1107
+		if ( ! class_exists($module_class)) {
1108
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1109
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1110 1110
 			return FALSE;
1111 1111
 		}
1112 1112
 		// add to array of registered modules
1113
-		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1114
-		do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1113
+		EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1114
+		do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1115 1115
 		return TRUE;
1116 1116
 	}
1117 1117
 
@@ -1125,23 +1125,23 @@  discard block
 block discarded – undo
1125 1125
 	 */
1126 1126
 	private function _initialize_shortcodes() {
1127 1127
 		// cycle thru shortcode folders
1128
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1128
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1129 1129
 			// add class prefix
1130
-			$shortcode_class = 'EES_' . $shortcode;
1130
+			$shortcode_class = 'EES_'.$shortcode;
1131 1131
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1132 1132
 			// which set hooks ?
1133
-			if ( is_admin() ) {
1133
+			if (is_admin()) {
1134 1134
 				// fire immediately
1135
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ));
1135
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1136 1136
 			} else {
1137 1137
 				// delay until other systems are online
1138
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' ));
1138
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks'));
1139 1139
 				// convert classname to UPPERCASE and create WP shortcode.
1140
-				$shortcode_tag = strtoupper( $shortcode );
1140
+				$shortcode_tag = strtoupper($shortcode);
1141 1141
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1142
-				if ( ! shortcode_exists( $shortcode_tag )) {
1142
+				if ( ! shortcode_exists($shortcode_tag)) {
1143 1143
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1144
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ));
1144
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1145 1145
 				}
1146 1146
 			}
1147 1147
 		}
@@ -1158,15 +1158,15 @@  discard block
 block discarded – undo
1158 1158
 	 */
1159 1159
 	private function _initialize_modules() {
1160 1160
 		// cycle thru shortcode folders
1161
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1161
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1162 1162
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1163 1163
 			// which set hooks ?
1164
-			if ( is_admin() ) {
1164
+			if (is_admin()) {
1165 1165
 				// fire immediately
1166
-				call_user_func( array( $module_class, 'set_hooks_admin' ));
1166
+				call_user_func(array($module_class, 'set_hooks_admin'));
1167 1167
 			} else {
1168 1168
 				// delay until other systems are online
1169
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' ));
1169
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks'));
1170 1170
 			}
1171 1171
 		}
1172 1172
 	}
@@ -1184,26 +1184,26 @@  discard block
 block discarded – undo
1184 1184
 	 *  @param 	string 		$key - url param key indicating a route is being called
1185 1185
 	 *  @return 	bool
1186 1186
 	 */
1187
-	public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) {
1188
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1189
-		$module = str_replace( 'EED_', '', $module );
1190
-		$module_class = 'EED_' . $module;
1191
-		if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) {
1192
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1193
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1187
+	public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') {
1188
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1189
+		$module = str_replace('EED_', '', $module);
1190
+		$module_class = 'EED_'.$module;
1191
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) {
1192
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1193
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1194 1194
 			return FALSE;
1195 1195
 		}
1196
-		if ( empty( $route )) {
1197
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1198
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1196
+		if (empty($route)) {
1197
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1198
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1199 1199
 			return FALSE;
1200 1200
 		}
1201
-		if ( ! method_exists ( 'EED_' . $module, $method_name )) {
1202
-			$msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route );
1203
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1201
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1202
+			$msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route);
1203
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1204 1204
 			return FALSE;
1205 1205
 		}
1206
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1206
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1207 1207
 		return TRUE;
1208 1208
 	}
1209 1209
 
@@ -1217,11 +1217,11 @@  discard block
 block discarded – undo
1217 1217
 	 *  @param 	string 		$key - url param key indicating a route is being called
1218 1218
 	 *  @return 	string
1219 1219
 	 */
1220
-	public static function get_route( $route = NULL, $key = 'ee' ) {
1221
-		do_action( 'AHEE__EE_Config__get_route__begin',$route );
1222
-		$route = apply_filters( 'FHEE__EE_Config__get_route',$route );
1223
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) {
1224
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1220
+	public static function get_route($route = NULL, $key = 'ee') {
1221
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1222
+		$route = apply_filters('FHEE__EE_Config__get_route', $route);
1223
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1224
+			return EE_Config::$_module_route_map[$key][$route];
1225 1225
 		}
1226 1226
 		return NULL;
1227 1227
 	}
@@ -1250,35 +1250,35 @@  discard block
 block discarded – undo
1250 1250
 	 * @param    string 		$key - url param key indicating a route is being called
1251 1251
 	 * @return    bool
1252 1252
 	 */
1253
-	public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) {
1254
-		do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward );
1255
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1256
-			$msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route );
1257
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1253
+	public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') {
1254
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1255
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1256
+			$msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route);
1257
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1258 1258
 			return FALSE;
1259 1259
 		}
1260
-		if ( empty( $forward )) {
1261
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1262
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1260
+		if (empty($forward)) {
1261
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1262
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1263 1263
 			return FALSE;
1264 1264
 		}
1265
-		if ( is_array( $forward )) {
1266
-			if ( ! isset( $forward[1] )) {
1267
-				$msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route );
1268
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1265
+		if (is_array($forward)) {
1266
+			if ( ! isset($forward[1])) {
1267
+				$msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route);
1268
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1269 1269
 				return FALSE;
1270 1270
 			}
1271
-			if ( ! method_exists( $forward[0], $forward[1] )) {
1272
-				$msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route );
1273
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1271
+			if ( ! method_exists($forward[0], $forward[1])) {
1272
+				$msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route);
1273
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1274 1274
 				return FALSE;
1275 1275
 			}
1276
-		} else if ( ! function_exists( $forward )) {
1277
-			$msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route );
1278
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1276
+		} else if ( ! function_exists($forward)) {
1277
+			$msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route);
1278
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1279 1279
 			return FALSE;
1280 1280
 		}
1281
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1281
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1282 1282
 		return TRUE;
1283 1283
 	}
1284 1284
 
@@ -1293,10 +1293,10 @@  discard block
 block discarded – undo
1293 1293
 	 *  @param    string 		$key - url param key indicating a route is being called
1294 1294
 	 *  @return 	string
1295 1295
 	 */
1296
-	public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) {
1297
-		do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status );
1298
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) {
1299
-			return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status );
1296
+	public static function get_forward($route = NULL, $status = 0, $key = 'ee') {
1297
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1298
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1299
+			return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status);
1300 1300
 		}
1301 1301
 		return NULL;
1302 1302
 	}
@@ -1313,19 +1313,19 @@  discard block
 block discarded – undo
1313 1313
 	 * @param    string 		$key - url param key indicating a route is being called
1314 1314
 	 * @return    bool
1315 1315
 	 */
1316
-	public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) {
1317
-		do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view );
1318
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1319
-			$msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route );
1320
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1316
+	public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') {
1317
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1318
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1319
+			$msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route);
1320
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1321 1321
 			return FALSE;
1322 1322
 		}
1323
-		if ( ! is_readable( $view )) {
1324
-			$msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view );
1325
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1323
+		if ( ! is_readable($view)) {
1324
+			$msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view);
1325
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1326 1326
 			return FALSE;
1327 1327
 		}
1328
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1328
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1329 1329
 		return TRUE;
1330 1330
 	}
1331 1331
 
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
 	 *  @param    string 		$key - url param key indicating a route is being called
1343 1343
 	 *  @return 	string
1344 1344
 	 */
1345
-	public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) {
1346
-		do_action( 'AHEE__EE_Config__get_view__begin',$route,$status );
1347
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) {
1348
-			return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status );
1345
+	public static function get_view($route = NULL, $status = 0, $key = 'ee') {
1346
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1347
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1348
+			return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status);
1349 1349
 		}
1350 1350
 		return NULL;
1351 1351
 	}
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 
1355 1355
 	public function shutdown() {
1356
-		update_option( 'ee_config_option_names', $this->_config_option_names );
1356
+		update_option('ee_config_option_names', $this->_config_option_names);
1357 1357
 	}
1358 1358
 
1359 1359
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
  * magic functions in use, except we'll allow them to magically set and get stuff...
1370 1370
  * basically, they should just be well-defined stdClasses
1371 1371
  */
1372
-class EE_Config_Base{
1372
+class EE_Config_Base {
1373 1373
 
1374 1374
 	/**
1375 1375
 	 * Utility function for escaping the value of a property and returning.
@@ -1378,13 +1378,13 @@  discard block
 block discarded – undo
1378 1378
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1379 1379
 	 * @throws \EE_Error
1380 1380
 	 */
1381
-	public function get_pretty( $property ) {
1382
-		if ( ! property_exists( $this, $property ) ) {
1383
-			throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) );
1381
+	public function get_pretty($property) {
1382
+		if ( ! property_exists($this, $property)) {
1383
+			throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property));
1384 1384
 		}
1385 1385
 		//just handling escaping of strings for now.
1386
-		if ( is_string( $this->{$property} ) ) {
1387
-			return stripslashes( $this->{$property} );
1386
+		if (is_string($this->{$property} )) {
1387
+			return stripslashes($this->{$property} );
1388 1388
 		}
1389 1389
 		return $this->{$property};
1390 1390
 	}
@@ -1393,19 +1393,19 @@  discard block
 block discarded – undo
1393 1393
 
1394 1394
 	public function populate() {
1395 1395
 		//grab defaults via a new instance of this class.
1396
-		$class_name = get_class( $this );
1396
+		$class_name = get_class($this);
1397 1397
 		$defaults = new $class_name;
1398 1398
 
1399 1399
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1400 1400
 		//default from our $defaults object.
1401
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1402
-			if ( is_null( $this->{$property} ) ) {
1401
+		foreach (get_object_vars($defaults) as $property => $value) {
1402
+			if (is_null($this->{$property} )) {
1403 1403
 				$this->{$property} = $value;
1404 1404
 			}
1405 1405
 		}
1406 1406
 
1407 1407
 		//cleanup
1408
-		unset( $defaults );
1408
+		unset($defaults);
1409 1409
 	}
1410 1410
 
1411 1411
 
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 		$this->current_blog_id = get_current_blog_id();
1510 1510
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1511 1511
 		$this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1512
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true;
1512
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1513 1513
 		$this->post_shortcodes = array();
1514 1514
 		$this->module_route_map = array();
1515 1515
 		$this->module_forward_map = array();
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 		$this->event_cpt_slug = __('events', 'event_espresso');
1529 1529
 
1530 1530
 		//ueip constant check
1531
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1531
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1532 1532
 			$this->ee_ueip_optin = FALSE;
1533 1533
 			$this->ee_ueip_has_notified = TRUE;
1534 1534
 		}
@@ -1568,8 +1568,8 @@  discard block
 block discarded – undo
1568 1568
 	 *  @return 	string
1569 1569
 	 */
1570 1570
 	public function reg_page_url() {
1571
-		if ( ! $this->reg_page_url ) {
1572
-			$this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout';
1571
+		if ( ! $this->reg_page_url) {
1572
+			$this->reg_page_url = get_permalink($this->reg_page_id).'#checkout';
1573 1573
 		}
1574 1574
 		return $this->reg_page_url;
1575 1575
 	}
@@ -1582,12 +1582,12 @@  discard block
 block discarded – undo
1582 1582
 	 *  @return 	string
1583 1583
 	 */
1584 1584
 	public function txn_page_url($query_args = array()) {
1585
-		if ( ! $this->txn_page_url ) {
1586
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1585
+		if ( ! $this->txn_page_url) {
1586
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1587 1587
 		}
1588
-		if($query_args){
1589
-			return add_query_arg($query_args,$this->txn_page_url);
1590
-		}else{
1588
+		if ($query_args) {
1589
+			return add_query_arg($query_args, $this->txn_page_url);
1590
+		} else {
1591 1591
 			return $this->txn_page_url;
1592 1592
 		}
1593 1593
 	}
@@ -1599,12 +1599,12 @@  discard block
 block discarded – undo
1599 1599
 	 *  @return 	string
1600 1600
 	 */
1601 1601
 	public function thank_you_page_url($query_args = array()) {
1602
-		if ( ! $this->thank_you_page_url ) {
1603
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1602
+		if ( ! $this->thank_you_page_url) {
1603
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1604 1604
 		}
1605
-		if($query_args){
1606
-			return add_query_arg($query_args,$this->thank_you_page_url);
1607
-		}else{
1605
+		if ($query_args) {
1606
+			return add_query_arg($query_args, $this->thank_you_page_url);
1607
+		} else {
1608 1608
 			return $this->thank_you_page_url;
1609 1609
 		}
1610 1610
 	}
@@ -1615,8 +1615,8 @@  discard block
 block discarded – undo
1615 1615
 	 *  @return 	string
1616 1616
 	 */
1617 1617
 	public function cancel_page_url() {
1618
-		if ( ! $this->cancel_page_url ) {
1619
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1618
+		if ( ! $this->cancel_page_url) {
1619
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1620 1620
 		}
1621 1621
 		return $this->cancel_page_url;
1622 1622
 	}
@@ -1643,22 +1643,22 @@  discard block
 block discarded – undo
1643 1643
 	 */
1644 1644
 	protected function _get_main_ee_ueip_optin() {
1645 1645
 		//if this is the main site then we can just bypass our direct query.
1646
-		if ( is_main_site() ) {
1647
-			return get_option( 'ee_ueip_optin', false );
1646
+		if (is_main_site()) {
1647
+			return get_option('ee_ueip_optin', false);
1648 1648
 		}
1649 1649
 
1650 1650
 		//is this already cached for this request?  If so use it.
1651
-		if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) {
1651
+		if ( ! empty(EE_Core_Config::$ee_ueip_option)) {
1652 1652
 			return EE_Core_Config::$ee_ueip_option;
1653 1653
 		}
1654 1654
 
1655 1655
 		global $wpdb;
1656 1656
 		$current_network_main_site = is_multisite() ? get_current_site() : null;
1657
-		$current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1657
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1658 1658
 		$option = 'ee_ueip_optin';
1659 1659
 
1660 1660
 		//set correct table for query
1661
-		$table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options';
1661
+		$table_name = $wpdb->get_blog_prefix($current_main_site_id).'options';
1662 1662
 
1663 1663
 
1664 1664
 		//rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
@@ -1666,20 +1666,20 @@  discard block
 block discarded – undo
1666 1666
 		//re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1667 1667
 		//this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1668 1668
 		//for the purpose of caching.
1669
-		$pre = apply_filters( 'pre_option_' . $option, false, $option );
1670
-		if ( false !== $pre ) {
1669
+		$pre = apply_filters('pre_option_'.$option, false, $option);
1670
+		if (false !== $pre) {
1671 1671
 			EE_Core_Config::$ee_ueip_option = $pre;
1672 1672
 			return EE_Core_Config::$ee_ueip_option;
1673 1673
 		}
1674 1674
 
1675
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) );
1676
-		if ( is_object( $row ) ) {
1675
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option));
1676
+		if (is_object($row)) {
1677 1677
 			$value = $row->option_value;
1678 1678
 		} else { //option does not exist so use default.
1679
-			return apply_filters( 'default_option_' . $option, false, $option );
1679
+			return apply_filters('default_option_'.$option, false, $option);
1680 1680
 		}
1681 1681
 
1682
-		EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option );
1682
+		EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option);
1683 1683
 
1684 1684
 		return EE_Core_Config::$ee_ueip_option;
1685 1685
 	}
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 		//reset all url properties
1695 1695
 		$this->_reset_urls();
1696 1696
 		//return what to save to db
1697
-		return array_keys( get_object_vars( $this ) );
1697
+		return array_keys(get_object_vars($this));
1698 1698
 	}
1699 1699
 
1700 1700
 }
@@ -1926,38 +1926,38 @@  discard block
 block discarded – undo
1926 1926
 	 * @param null $CNT_ISO
1927 1927
 	 * @return \EE_Currency_Config
1928 1928
 	 */
1929
-	public function __construct( $CNT_ISO = NULL ) {
1929
+	public function __construct($CNT_ISO = NULL) {
1930 1930
 
1931 1931
 		// get country code from organization settings or use default
1932
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1932
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1933 1933
 		// but override if requested
1934
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
1934
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
1935 1935
 		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
1936
-		if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) {
1936
+		if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) {
1937 1937
 			// retrieve the country settings from the db, just in case they have been customized
1938
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
1939
-			if ( $country instanceof EE_Country ) {
1940
-				$this->code = $country->currency_code(); 	// currency code: USD, CAD, EUR
1941
-				$this->name = $country->currency_name_single();	// Dollar
1942
-				$this->plural = $country->currency_name_plural(); 	// Dollars
1943
-				$this->sign =  $country->currency_sign(); 			// currency sign: $
1944
-				$this->sign_b4 = $country->currency_sign_before(); 		// currency sign before or after: $TRUE  or  FALSE$
1945
-				$this->dec_plc = $country->currency_decimal_places();	// decimal places: 2 = 0.00  3 = 0.000
1946
-				$this->dec_mrk = $country->currency_decimal_mark();	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1947
-				$this->thsnds = $country->currency_thousands_separator();	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1938
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
1939
+			if ($country instanceof EE_Country) {
1940
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
1941
+				$this->name = $country->currency_name_single(); // Dollar
1942
+				$this->plural = $country->currency_name_plural(); // Dollars
1943
+				$this->sign = $country->currency_sign(); // currency sign: $
1944
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
1945
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
1946
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1947
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1948 1948
 			}
1949 1949
 		}
1950 1950
 		// fallback to hardcoded defaults, in case the above failed
1951
-		if ( empty( $this->code )) {
1951
+		if (empty($this->code)) {
1952 1952
 			// set default currency settings
1953
-			$this->code = 'USD'; 	// currency code: USD, CAD, EUR
1954
-			$this->name = __( 'Dollar', 'event_espresso' ); 	// Dollar
1955
-			$this->plural = __( 'Dollars', 'event_espresso' ); 	// Dollars
1956
-			$this->sign =  '$'; 	// currency sign: $
1957
-			$this->sign_b4 = TRUE; 	// currency sign before or after: $TRUE  or  FALSE$
1958
-			$this->dec_plc = 2; 	// decimal places: 2 = 0.00  3 = 0.000
1959
-			$this->dec_mrk = '.'; 	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1960
-			$this->thsnds = ','; 	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1953
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
1954
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
1955
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
1956
+			$this->sign = '$'; // currency sign: $
1957
+			$this->sign_b4 = TRUE; // currency sign before or after: $TRUE  or  FALSE$
1958
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
1959
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1960
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1961 1961
 		}
1962 1962
 	}
1963 1963
 }
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 * @since 4.8.8.rc.019
2107 2107
 	 */
2108 2108
 	public function do_hooks() {
2109
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ));
2109
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2110 2110
 	}
2111 2111
 
2112 2112
 
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 	 * @return void
2115 2115
 	 */
2116 2116
 	public function set_default_reg_status_on_EEM_Event() {
2117
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2117
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2118 2118
 	}
2119 2119
 
2120 2120
 
@@ -2219,10 +2219,10 @@  discard block
 block discarded – undo
2219 2219
 	 * @param bool $reset
2220 2220
 	 * @return string
2221 2221
 	 */
2222
-	public function log_file_name( $reset = FALSE ) {
2223
-		if ( empty( $this->log_file_name ) || $reset ) {
2224
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt';
2225
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2222
+	public function log_file_name($reset = FALSE) {
2223
+		if (empty($this->log_file_name) || $reset) {
2224
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt';
2225
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2226 2226
 		}
2227 2227
 		return $this->log_file_name;
2228 2228
 	}
@@ -2234,10 +2234,10 @@  discard block
 block discarded – undo
2234 2234
 	 * @param bool $reset
2235 2235
 	 * @return string
2236 2236
 	 */
2237
-	public function debug_file_name( $reset = FALSE ) {
2238
-		if ( empty( $this->debug_file_name ) || $reset ) {
2239
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt';
2240
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2237
+	public function debug_file_name($reset = FALSE) {
2238
+		if (empty($this->debug_file_name) || $reset) {
2239
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt';
2240
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2241 2241
 		}
2242 2242
 		return $this->debug_file_name;
2243 2243
 	}
@@ -2410,21 +2410,21 @@  discard block
 block discarded – undo
2410 2410
 		// set default map settings
2411 2411
 		$this->use_google_maps = TRUE;
2412 2412
 		// for event details pages (reg page)
2413
-		$this->event_details_map_width = 585; 			// ee_map_width_single
2414
-		$this->event_details_map_height = 362; 			// ee_map_height_single
2415
-		$this->event_details_map_zoom = 14; 			// ee_map_zoom_single
2416
-		$this->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
2417
-		$this->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
2418
-		$this->event_details_control_type = 'default'; 		// ee_map_type_control_single
2419
-		$this->event_details_map_align = 'center'; 			// ee_map_align_single
2413
+		$this->event_details_map_width = 585; // ee_map_width_single
2414
+		$this->event_details_map_height = 362; // ee_map_height_single
2415
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2416
+		$this->event_details_display_nav = TRUE; // ee_map_nav_display_single
2417
+		$this->event_details_nav_size = FALSE; // ee_map_nav_size_single
2418
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2419
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2420 2420
 		// for event list pages
2421
-		$this->event_list_map_width = 300; 			// ee_map_width
2422
-		$this->event_list_map_height = 185; 		// ee_map_height
2423
-		$this->event_list_map_zoom = 12; 			// ee_map_zoom
2424
-		$this->event_list_display_nav = FALSE; 		// ee_map_nav_display
2425
-		$this->event_list_nav_size = TRUE; 			// ee_map_nav_size
2426
-		$this->event_list_control_type = 'dropdown'; 		// ee_map_type_control
2427
-		$this->event_list_map_align = 'center'; 			// ee_map_align
2421
+		$this->event_list_map_width = 300; // ee_map_width
2422
+		$this->event_list_map_height = 185; // ee_map_height
2423
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2424
+		$this->event_list_display_nav = FALSE; // ee_map_nav_display
2425
+		$this->event_list_nav_size = TRUE; // ee_map_nav_size
2426
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2427
+		$this->event_list_map_align = 'center'; // ee_map_align
2428 2428
 	}
2429 2429
 
2430 2430
 }
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
 /**
2436 2436
  * stores Events_Archive settings
2437 2437
  */
2438
-class EE_Events_Archive_Config extends EE_Config_Base{
2438
+class EE_Events_Archive_Config extends EE_Config_Base {
2439 2439
 
2440 2440
 	public $display_status_banner;
2441 2441
 	public $display_description;
@@ -2454,7 +2454,7 @@  discard block
 block discarded – undo
2454 2454
 	/**
2455 2455
 	 *	class constructor
2456 2456
 	 */
2457
-	public function __construct(){
2457
+	public function __construct() {
2458 2458
 		$this->display_status_banner = 0;
2459 2459
 		$this->display_description = 1;
2460 2460
 		$this->display_ticket_selector = 0;
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 /**
2475 2475
  * Stores Event_Single_Config settings
2476 2476
  */
2477
-class EE_Event_Single_Config extends EE_Config_Base{
2477
+class EE_Event_Single_Config extends EE_Config_Base {
2478 2478
 
2479 2479
 	public $display_status_banner_single;
2480 2480
 	public $display_venue;
@@ -2503,7 +2503,7 @@  discard block
 block discarded – undo
2503 2503
 /**
2504 2504
  * Stores Ticket_Selector_Config settings
2505 2505
  */
2506
-class EE_Ticket_Selector_Config extends EE_Config_Base{
2506
+class EE_Ticket_Selector_Config extends EE_Config_Base {
2507 2507
 	public $show_ticket_sale_columns;
2508 2508
 	public $show_ticket_details;
2509 2509
 	public $show_expired_tickets;
@@ -2557,7 +2557,7 @@  discard block
 block discarded – undo
2557 2557
 	 * @return void
2558 2558
 	 */
2559 2559
 	protected function _set_php_values() {
2560
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2560
+		$this->php->max_input_vars = ini_get('max_input_vars');
2561 2561
 		$this->php->version = phpversion();
2562 2562
 	}
2563 2563
 
@@ -2576,9 +2576,9 @@  discard block
 block discarded – undo
2576 2576
 	 *         @type string $msg 		Any message to be displayed.
2577 2577
 	 * }
2578 2578
 	 */
2579
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2580
-		if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) {
2581
-			return  sprintf( __('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2579
+	public function max_input_vars_limit_check($input_count = 0) {
2580
+		if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) {
2581
+			return  sprintf(__('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2582 2582
 		} else {
2583 2583
 			return '';
2584 2584
 		}
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
  * stores payment gateway info
2614 2614
  * @deprecated
2615 2615
  */
2616
-class EE_Gateway_Config extends EE_Config_Base{
2616
+class EE_Gateway_Config extends EE_Config_Base {
2617 2617
 
2618 2618
 	/**
2619 2619
 	 * Array with keys that are payment gateways slugs, and values are arrays
@@ -2635,9 +2635,9 @@  discard block
 block discarded – undo
2635 2635
 	 *	class constructor
2636 2636
 	 * @deprecated
2637 2637
 	 */
2638
-	public function __construct(){
2638
+	public function __construct() {
2639 2639
 		$this->payment_settings = array();
2640
-		$this->active_gateways = array( 'Invoice' => FALSE );
2640
+		$this->active_gateways = array('Invoice' => FALSE);
2641 2641
 	}
2642 2642
 }
2643 2643
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * Event Espresso
6 8
  *
@@ -162,7 +164,7 @@  discard block
 block discarded – undo
162 164
 		//support removing a module during a request when it previously existed
163 165
 		if( $reinstantiate ){
164 166
 			return self::instance();
165
-		}else{
167
+		} else{
166 168
 			return NULL;
167 169
 		}
168 170
 	}
@@ -1587,7 +1589,7 @@  discard block
 block discarded – undo
1587 1589
 		}
1588 1590
 		if($query_args){
1589 1591
 			return add_query_arg($query_args,$this->txn_page_url);
1590
-		}else{
1592
+		} else{
1591 1593
 			return $this->txn_page_url;
1592 1594
 		}
1593 1595
 	}
@@ -1604,7 +1606,7 @@  discard block
 block discarded – undo
1604 1606
 		}
1605 1607
 		if($query_args){
1606 1608
 			return add_query_arg($query_args,$this->thank_you_page_url);
1607
-		}else{
1609
+		} else{
1608 1610
 			return $this->thank_you_page_url;
1609 1611
 		}
1610 1612
 	}
Please login to merge, or discard this patch.
core/EED_Module.module.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  * Event Espresso
6 6
  *
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *  @var 			WP $WP
84 84
 	 *  @return 	void
85 85
 	 */
86
-	public abstract function run( $WP );
86
+	public abstract function run($WP);
87 87
 
88 88
 
89 89
 
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 	 * @param $module_name
107 107
 	 * @return EED_Module
108 108
 	 */
109
-	protected static function get_instance( $module_name = '' ) {
110
-		$module_name = ! empty( $module_name ) ? $module_name : get_called_class();
111
-		if ( ! isset(  EE_Registry::instance()->modules->{$module_name} ) || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module ) {
112
-			EE_Registry::instance()->add_module( $module_name );
109
+	protected static function get_instance($module_name = '') {
110
+		$module_name = ! empty($module_name) ? $module_name : get_called_class();
111
+		if ( ! isset(EE_Registry::instance()->modules->{$module_name} ) || ! EE_Registry::instance()->modules->{$module_name} instanceof EED_Module) {
112
+			EE_Registry::instance()->add_module($module_name);
113 113
 		}
114
-		return EE_Registry::instance()->get_module( $module_name );
114
+		return EE_Registry::instance()->get_module($module_name);
115 115
 	}
116 116
 
117 117
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @return    string
124 124
 	 */
125 125
 	public function module_name() {
126
-		return get_class( $this );
126
+		return get_class($this);
127 127
 	}
128 128
 
129 129
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * Event Espresso
6 8
  *
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
4 4
 /**
5 5
  *
6 6
  * Class EE_Payment_Method_Manager
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public static function instance() {
39 39
 		// check if class object is instantiated, and instantiated properly
40
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
40
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
41 41
 			self::$_instance = new self();
42 42
 		}
43 43
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * Resets the instance and returns a new one
49 49
 	 * @return EE_Payment_Method_Manager
50 50
 	 */
51
-	public static function reset(){
51
+	public static function reset() {
52 52
 		self::$_instance = NULL;
53 53
 		return self::instance();
54 54
 	}
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	 * or just re-use the PMTs we found last time we checked during this request (if
60 60
 	 * we have not yet checked during this request, then we need to check anyways)
61 61
 	 */
62
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
63
-		if( ! $this->_payment_method_types || $force_recheck ){
62
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
63
+		if ( ! $this->_payment_method_types || $force_recheck) {
64 64
 			$this->_register_payment_methods();
65 65
 			//if in admin lets ensure caps are set.
66
-			if ( is_admin() ) {
67
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
66
+			if (is_admin()) {
67
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
68 68
 				EE_Registry::instance()->CAP->init_caps();
69 69
 			}
70 70
 		}
@@ -77,19 +77,19 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	protected function _register_payment_methods() {
79 79
 		// grab list of installed modules
80
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
80
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
81 81
 		// filter list of modules to register
82
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
82
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
83 83
 
84 84
 		// loop through folders
85
-		foreach ( $pm_to_register as $pm_path ) {
86
-				$this->register_payment_method( $pm_path );
85
+		foreach ($pm_to_register as $pm_path) {
86
+				$this->register_payment_method($pm_path);
87 87
 		}
88
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
88
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
89 89
 		// filter list of installed modules
90 90
 		//keep them organized alphabetically by the payment method type's name
91
-		ksort( $this->_payment_method_types );
92
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
91
+		ksort($this->_payment_method_types);
92
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
93 93
 	}
94 94
 
95 95
 
@@ -101,35 +101,35 @@  discard block
 block discarded – undo
101 101
 	 * @param string $payment_method_path - full path up to and including payment method folder
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function register_payment_method( $payment_method_path = '' ) {
105
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
104
+	public function register_payment_method($payment_method_path = '') {
105
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
106 106
 		$module_ext = '.pm.php';
107 107
 		// make all separators match
108
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
108
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
109 109
 		// grab and sanitize module name
110
-		$module_dir = basename( $payment_method_path );
110
+		$module_dir = basename($payment_method_path);
111 111
 		// create classname from module directory name
112
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
112
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
113 113
 		// add class prefix
114
-		$module_class = 'EE_PMT_' . $module;
114
+		$module_class = 'EE_PMT_'.$module;
115 115
 		// does the module exist ?
116
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
117
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
118
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
116
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
117
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
118
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
119 119
 			return FALSE;
120 120
 		}
121
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
121
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
122 122
 		// load the module class file
123
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
124
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123
+		require_once($payment_method_path.DS.$module_class.$module_ext);
124
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
125 125
 		// verify that class exists
126
-		if ( ! class_exists( $module_class )) {
127
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
128
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
126
+		if ( ! class_exists($module_class)) {
127
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
128
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
129 129
 			return FALSE;
130 130
 		}
131 131
 		// add to array of registered modules
132
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
132
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
133 133
 		return TRUE;
134 134
 	}
135 135
 	/**
@@ -138,18 +138,18 @@  discard block
 block discarded – undo
138 138
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
139 139
 	 * @return boolean
140 140
 	 */
141
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
141
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
142 142
 		if (
143 143
 			$force_recheck
144
-			|| ! is_array( $this->_payment_method_types )
145
-			|| ! isset( $this->_payment_method_types[$payment_method_name] )
144
+			|| ! is_array($this->_payment_method_types)
145
+			|| ! isset($this->_payment_method_types[$payment_method_name])
146 146
 		) {
147 147
 			$this->maybe_register_payment_methods($force_recheck);
148 148
 		}
149
-		if(isset($this->_payment_method_types[$payment_method_name])){
149
+		if (isset($this->_payment_method_types[$payment_method_name])) {
150 150
 			require_once($this->_payment_method_types[$payment_method_name]);
151 151
 			return true;
152
-		}else{
152
+		} else {
153 153
 			return false;
154 154
 		}
155 155
 	}
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
161 161
 	 * @return array
162 162
 	 */
163
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
163
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
164 164
 		$this->maybe_register_payment_methods($force_recheck);
165
-		if($with_prefixes){
165
+		if ($with_prefixes) {
166 166
 			$classnames = array_keys($this->_payment_method_types);
167 167
 			$payment_methods = array();
168
-			foreach($classnames as $classname){
168
+			foreach ($classnames as $classname) {
169 169
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
170 170
 			}
171 171
 			return $payment_methods;
172
-		}else{
172
+		} else {
173 173
 			return array_keys($this->_payment_method_types);
174 174
 		}
175 175
 	}
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
180 180
 	 * @return EE_PMT_Base[]
181 181
 	 */
182
-	public function payment_method_types( $force_recheck = FALSE ){
182
+	public function payment_method_types($force_recheck = FALSE) {
183 183
 		$this->maybe_register_payment_methods($force_recheck);
184 184
 		$pmt_objs = array();
185
-		foreach($this->payment_method_type_names(true) as $classname){
185
+		foreach ($this->payment_method_type_names(true) as $classname) {
186 186
 			$pmt_objs[] = new $classname;
187 187
 		}
188 188
 		return $pmt_objs;
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 * @param string $classname
195 195
 	 * @return string
196 196
 	 */
197
-	public function payment_method_type_sans_class_prefix($classname){
198
-		return str_replace( "EE_PMT_", "", $classname );
197
+	public function payment_method_type_sans_class_prefix($classname) {
198
+		return str_replace("EE_PMT_", "", $classname);
199 199
 	}
200 200
 
201 201
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @param string $type
204 204
 	 * @return string
205 205
 	 */
206
-	public function payment_method_class_from_type($type){
206
+	public function payment_method_class_from_type($type) {
207 207
 		$this->maybe_register_payment_methods();
208 208
 		return "EE_PMT_".$type;
209 209
 	}
@@ -217,39 +217,39 @@  discard block
 block discarded – undo
217 217
 	 * @return \EE_Payment_Method
218 218
 	 * @throws \EE_Error
219 219
 	 */
220
-	public function activate_a_payment_method_of_type( $payment_method_type ){
220
+	public function activate_a_payment_method_of_type($payment_method_type) {
221 221
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
222
-		if( ! $payment_method instanceof EE_Payment_Method ){
222
+		if ( ! $payment_method instanceof EE_Payment_Method) {
223 223
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
224
-			if(class_exists($pm_type_class)){
224
+			if (class_exists($pm_type_class)) {
225 225
 				/** @var $pm_type_obj EE_PMT_Base */
226 226
 				$pm_type_obj = new $pm_type_class;
227 227
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
228
-				if( ! $payment_method){
229
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
228
+				if ( ! $payment_method) {
229
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
230 230
 				}
231
-				$payment_method->set_type( $payment_method_type );
232
-				$this->initialize_payment_method( $payment_method );
231
+				$payment_method->set_type($payment_method_type);
232
+				$this->initialize_payment_method($payment_method);
233 233
 			} else {
234 234
 				throw new EE_Error(
235 235
 					sprintf(
236
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
236
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
237 237
 						$pm_type_class )
238 238
 				);
239 239
 			}
240 240
 		}
241 241
 		$payment_method->set_active();
242 242
 		$payment_method->save();
243
-		$this->set_usable_currencies_on_payment_method( $payment_method );
244
-		if( $payment_method->type() === 'Invoice' ){
243
+		$this->set_usable_currencies_on_payment_method($payment_method);
244
+		if ($payment_method->type() === 'Invoice') {
245 245
 			/** @type EE_Message_Resource_Manager $message_resource_manager */
246
-			$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
247
-			$message_resource_manager->ensure_message_type_is_active( 'invoice', 'html' );
248
-			$message_resource_manager->ensure_messenger_is_active( 'pdf' );
246
+			$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
247
+			$message_resource_manager->ensure_message_type_is_active('invoice', 'html');
248
+			$message_resource_manager->ensure_messenger_is_active('pdf');
249 249
 			EE_Error::add_attention(
250 250
 				sprintf(
251
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
252
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
251
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
252
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
253 253
 					'</a>'
254 254
 				)
255 255
 			);
@@ -267,17 +267,17 @@  discard block
 block discarded – undo
267 267
 	 * @return EE_Payment_Method
268 268
 	 * @throws \EE_Error
269 269
 	 */
270
-	public function create_payment_method_of_type( $pm_type_obj ) {
270
+	public function create_payment_method_of_type($pm_type_obj) {
271 271
 		global $current_user;
272 272
 		$payment_method = EE_Payment_Method::new_instance(
273 273
 			array(
274 274
 				'PMD_type' 		 => $pm_type_obj->system_name(),
275 275
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
276 276
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
277
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
277
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
278 278
 				'PMD_wp_user' 	 => $current_user->ID,
279 279
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
280
-					array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
280
+					array(array('PMD_type' => array('!=', 'Admin_Only')))
281 281
 				) * 10,
282 282
 			)
283 283
 		);
@@ -293,21 +293,21 @@  discard block
 block discarded – undo
293 293
 	 * @return EE_Payment_Method
294 294
 	 * @throws \EE_Error
295 295
 	 */
296
-	public function initialize_payment_method( $payment_method ) {
296
+	public function initialize_payment_method($payment_method) {
297 297
 		$pm_type_obj = $payment_method->type_obj();
298
-		$payment_method->set_description( $pm_type_obj->default_description() );
299
-		if( ! $payment_method->button_url() ){
300
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
298
+		$payment_method->set_description($pm_type_obj->default_description());
299
+		if ( ! $payment_method->button_url()) {
300
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
301 301
 		}
302 302
 		//now add setup its default extra meta properties
303 303
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
304
-		if ( ! empty( $extra_metas ) ) {
304
+		if ( ! empty($extra_metas)) {
305 305
 			//verify the payment method has an ID before adding extra meta
306
-			if ( ! $payment_method->ID() ) {
306
+			if ( ! $payment_method->ID()) {
307 307
 				$payment_method->save();
308 308
 			}
309
-			foreach ( $extra_metas as $meta_name => $input ) {
310
-				$payment_method->update_extra_meta( $meta_name, $input->raw_value() );
309
+			foreach ($extra_metas as $meta_name => $input) {
310
+				$payment_method->update_extra_meta($meta_name, $input->raw_value());
311 311
 			}
312 312
 		}
313 313
 		return $payment_method;
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 * @return EE_Payment_Method
323 323
 	 * @throws \EE_Error
324 324
 	 */
325
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
326
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
325
+	public function set_usable_currencies_on_payment_method($payment_method) {
326
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
327 327
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
328 328
 		}
329 329
 		return $payment_method;
@@ -341,19 +341,19 @@  discard block
 block discarded – undo
341 341
 	 *
342 342
 	 * @return int count of rows updated.
343 343
 	 */
344
-	public function deactivate_payment_method( $payment_method_slug ) {
344
+	public function deactivate_payment_method($payment_method_slug) {
345 345
 		EE_Log::instance()->log(
346 346
 				__FILE__,
347 347
 				__FUNCTION__,
348 348
 				sprintf(
349
-					__( 'Payment method with slug %1$s is being deactivated by site admin', 'event_espresso' ),
349
+					__('Payment method with slug %1$s is being deactivated by site admin', 'event_espresso'),
350 350
 					$payment_method_slug
351 351
 				),
352 352
 				'payment_method_change'
353 353
 			);
354 354
 		$count_updated = EEM_Payment_Method::instance()->update(
355
-			array( 'PMD_scope' => array() ),
356
-			array( array( 'PMD_slug' => $payment_method_slug ) )
355
+			array('PMD_scope' => array()),
356
+			array(array('PMD_slug' => $payment_method_slug))
357 357
 		);
358 358
 		return $count_updated;
359 359
 	}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @param array $caps capabilities being filtered
368 368
 	 * @return array
369 369
 	 */
370
-	public function add_payment_method_caps( $caps ) {
370
+	public function add_payment_method_caps($caps) {
371 371
 		/* add dynamic caps from payment methods
372 372
 		 * at the time of writing, october 20 2014, these are the caps added:
373 373
 		 * ee_payment_method_admin_only
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		 * their related capability automatically added too, so long as they are
383 383
 		 * registered properly using EE_Register_Payment_Method::register()
384 384
 		 */
385
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
385
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
386 386
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
387 387
 		}
388 388
 		return $caps;
Please login to merge, or discard this patch.
core/db_classes/EE_Import.class.php 2 patches
Spacing   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
5 5
 /**
6 6
  * EE_Import class
7 7
  *
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function instance() {
60 60
 		// check if class object is instantiated
61
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Import )) {
61
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Import)) {
62 62
 			self::$_instance = new self();
63 63
 		}
64 64
 		return self::$_instance;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Resets the importer
69 69
 	 * @return EE_Import
70 70
 	 */
71
-	public static function reset(){
71
+	public static function reset() {
72 72
 		self::$_instance = null;
73 73
 		return self::instance();
74 74
 	}
@@ -86,27 +86,27 @@  discard block
 block discarded – undo
86 86
 	 * 	@param 	string 		$type - type of file to import
87 87
 	 *	@ return 	string
88 88
 	 */
89
-	public function upload_form ( $title, $intro, $form_url, $action, $type  ) {
89
+	public function upload_form($title, $intro, $form_url, $action, $type) {
90 90
 
91
-		$form_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => $action ), $form_url );
91
+		$form_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => $action), $form_url);
92 92
 
93 93
 		ob_start();
94 94
 ?>
95 95
 	<div class="ee-upload-form-dv">
96
-		<h3><?php echo $title;?></h3>
97
-		<p><?php echo $intro;?></p>
96
+		<h3><?php echo $title; ?></h3>
97
+		<p><?php echo $intro; ?></p>
98 98
 
99 99
 		<form action="<?php echo $form_url?>" method="post" enctype="multipart/form-data">
100
-			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php echo time();?>">
101
-			<input name="import" type="hidden" value="<?php echo $type;?>" />
100
+			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php echo time(); ?>">
101
+			<input name="import" type="hidden" value="<?php echo $type; ?>" />
102 102
 			<input type="file" name="file[]" size="90" >
103
-			<input class="button-primary" type="submit" value="<?php _e( 'Upload File', 'event_espresso' );?>">
103
+			<input class="button-primary" type="submit" value="<?php _e('Upload File', 'event_espresso'); ?>">
104 104
 		</form>
105 105
 
106 106
 		<p class="ee-attention">
107
-			<b><?php _e( 'Attention', 'event_espresso' );?></b><br/>
108
-			<?php echo sprintf( __( 'Accepts .%s file types only.', 'event_espresso' ), $type ) ;?>
109
-			<?php echo __( 'Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso' );?>
107
+			<b><?php _e('Attention', 'event_espresso'); ?></b><br/>
108
+			<?php echo sprintf(__('Accepts .%s file types only.', 'event_espresso'), $type); ?>
109
+			<?php echo __('Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso'); ?>
110 110
 		</p>
111 111
 
112 112
 	</div>
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function import() {
129 129
 
130
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
130
+		require_once(EE_CLASSES.'EE_CSV.class.php');
131 131
 		$this->EE_CSV = EE_CSV::instance();
132 132
 
133
-		if ( isset( $_REQUEST['import'] )) {
134
-			if( isset( $_POST['csv_submitted'] )) {
133
+		if (isset($_REQUEST['import'])) {
134
+			if (isset($_POST['csv_submitted'])) {
135 135
 
136
-			    switch ( $_FILES['file']['error'][0] ) {
136
+			    switch ($_FILES['file']['error'][0]) {
137 137
 			        case UPLOAD_ERR_OK:
138 138
 			            $error_msg = FALSE;
139 139
 			            break;
@@ -163,32 +163,32 @@  discard block
 block discarded – undo
163 163
 			            break;
164 164
 			    }
165 165
 
166
-				if ( ! $error_msg ) {
166
+				if ( ! $error_msg) {
167 167
 
168
-				    $filename	= $_FILES['file']['name'][0];
169
-					$file_ext 		= substr( strrchr( $filename, '.' ), 1 );
170
-				    $file_type 	= $_FILES['file']['type'][0];
171
-				    $temp_file	= $_FILES['file']['tmp_name'][0];
172
-				    $filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
168
+				    $filename = $_FILES['file']['name'][0];
169
+					$file_ext = substr(strrchr($filename, '.'), 1);
170
+				    $file_type = $_FILES['file']['type'][0];
171
+				    $temp_file = $_FILES['file']['tmp_name'][0];
172
+				    $filesize = $_FILES['file']['size'][0] / 1024; //convert from bytes to KB
173 173
 
174
-					if ( $file_ext=='csv' ) {
174
+					if ($file_ext == 'csv') {
175 175
 
176
-						$max_upload = $this->EE_CSV->get_max_upload_size();//max upload size in KB
177
-						if ( $filesize < $max_upload || true) {
176
+						$max_upload = $this->EE_CSV->get_max_upload_size(); //max upload size in KB
177
+						if ($filesize < $max_upload || true) {
178 178
 
179
-							$wp_upload_dir = str_replace( array( '\\', '/' ), DS, wp_upload_dir());
180
-							$path_to_file = $wp_upload_dir['basedir'] . DS . 'espresso' . DS . $filename;
179
+							$wp_upload_dir = str_replace(array('\\', '/'), DS, wp_upload_dir());
180
+							$path_to_file = $wp_upload_dir['basedir'].DS.'espresso'.DS.$filename;
181 181
 
182
-							if( move_uploaded_file( $temp_file, $path_to_file )) {
182
+							if (move_uploaded_file($temp_file, $path_to_file)) {
183 183
 
184 184
 								// convert csv to array
185
-								$this->csv_array = $this->EE_CSV->import_csv_to_model_data_array( $path_to_file );
185
+								$this->csv_array = $this->EE_CSV->import_csv_to_model_data_array($path_to_file);
186 186
 
187 187
 								// was data successfully stored in an array?
188
-								if ( is_array( $this->csv_array ) ) {
188
+								if (is_array($this->csv_array)) {
189 189
 
190
-									$import_what = str_replace( 'csv_import_', '', $_REQUEST['action'] );
191
-									$import_what = str_replace( '_', ' ', ucwords( $import_what ));
190
+									$import_what = str_replace('csv_import_', '', $_REQUEST['action']);
191
+									$import_what = str_replace('_', ' ', ucwords($import_what));
192 192
 									$processed_data = $this->csv_array;
193 193
 									$this->columns_to_save = FALSE;
194 194
 
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
 
208 208
 									}
209 209
 									// save processed codes to db
210
-									if ( $this->save_csv_data_array_to_db( $processed_data, $this->columns_to_save ) ) {
210
+									if ($this->save_csv_data_array_to_db($processed_data, $this->columns_to_save)) {
211 211
 										return TRUE;
212 212
 
213 213
 									}
214 214
 								} else {
215 215
 									// no array? must be an error
216
-									EE_Error::add_error(sprintf(__("No file seems to have been uploaded", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
216
+									EE_Error::add_error(sprintf(__("No file seems to have been uploaded", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
217 217
 									return FALSE;
218 218
 								}
219 219
 
220 220
 							} else {
221
-								EE_Error::add_error(sprintf(__("%s was not successfully uploaded", "event_espresso"),$filename), __FILE__, __FUNCTION__, __LINE__ );
221
+								EE_Error::add_error(sprintf(__("%s was not successfully uploaded", "event_espresso"), $filename), __FILE__, __FUNCTION__, __LINE__);
222 222
 								return FALSE;
223 223
 							}
224 224
 
225 225
 						} else {
226
-							EE_Error::add_error( sprintf(__("%s was too large of a file and could not be uploaded. The max filesize is %s' KB.", "event_espresso"),$filename,$max_upload), __FILE__, __FUNCTION__, __LINE__ );
226
+							EE_Error::add_error(sprintf(__("%s was too large of a file and could not be uploaded. The max filesize is %s' KB.", "event_espresso"), $filename, $max_upload), __FILE__, __FUNCTION__, __LINE__);
227 227
 							return FALSE;
228 228
 						}
229 229
 
230 230
 					} else {
231
-						EE_Error::add_error( sprintf(__("%s  had an invalid file extension, not uploaded", "event_espresso"),$filename), __FILE__, __FUNCTION__, __LINE__ );
231
+						EE_Error::add_error(sprintf(__("%s  had an invalid file extension, not uploaded", "event_espresso"), $filename), __FILE__, __FUNCTION__, __LINE__);
232 232
 						return FALSE;
233 233
 					}
234 234
 
235 235
 				} else {
236
-					EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
236
+					EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
237 237
 					return FALSE;
238 238
 				}
239 239
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 *			@param array $fields_to_save - an array containing the csv column names as keys with the corresponding db table fields they will be saved to
275 275
 	 *			@return TRUE on success, FALSE on fail
276 276
 	 */
277
-	public function save_csv_data_array_to_db( $csv_data_array, $model_name = FALSE ) {
277
+	public function save_csv_data_array_to_db($csv_data_array, $model_name = FALSE) {
278 278
 
279 279
 
280 280
 		$success = FALSE;
@@ -284,22 +284,22 @@  discard block
 block discarded – undo
284 284
 		$export_from_site_a_to_b = true;
285 285
 		// first level of array is not table information but a table name was passed to the function
286 286
 		// array is only two levels deep, so let's fix that by adding a level, else the next steps will fail
287
-		if($model_name){
287
+		if ($model_name) {
288 288
 			$csv_data_array = array($csv_data_array);
289 289
 		}
290 290
 		// begin looking through the $csv_data_array, expecting the toplevel key to be the model's name...
291 291
 		$old_site_url = 'none-specified';
292 292
 
293 293
 		//hanlde metadata
294
-		if(isset($csv_data_array[EE_CSV::metadata_header]) ){
294
+		if (isset($csv_data_array[EE_CSV::metadata_header])) {
295 295
 			$csv_metadata = array_shift($csv_data_array[EE_CSV::metadata_header]);
296 296
 			//ok so its metadata, dont try to save it to ehte db obviously...
297
-			if(isset($csv_metadata['site_url']) && $csv_metadata['site_url'] == site_url()){
297
+			if (isset($csv_metadata['site_url']) && $csv_metadata['site_url'] == site_url()) {
298 298
 				EE_Error::add_attention(sprintf(__("CSV Data appears to be from the same database, so attempting to update data", "event_espresso")));
299 299
 				$export_from_site_a_to_b = false;
300
-			}else{
301
-				$old_site_url = isset( $csv_metadata['site_url']) ? $csv_metadata['site_url'] : $old_site_url;
302
-				EE_Error::add_attention(sprintf(__("CSV Data appears to be from a different database (%s instead of %s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database", "event_espresso"),$old_site_url,site_url()));
300
+			} else {
301
+				$old_site_url = isset($csv_metadata['site_url']) ? $csv_metadata['site_url'] : $old_site_url;
302
+				EE_Error::add_attention(sprintf(__("CSV Data appears to be from a different database (%s instead of %s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database", "event_espresso"), $old_site_url, site_url()));
303 303
 			};
304 304
 			unset($csv_data_array[EE_CSV::metadata_header]);
305 305
 		}
@@ -308,40 +308,40 @@  discard block
 block discarded – undo
308 308
 		* the value will be the newly-inserted ID.
309 309
 		* If we have already imported data from the same website via CSV, it shoudl be kept in this wp option
310 310
 		*/
311
-	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url),array());
312
-	   if( $old_db_to_new_db_mapping){
313
-		   EE_Error::add_attention(sprintf(__("We noticed you have imported data via CSV from %s before. Because of this, IDs in your CSV have been mapped to their new IDs in %s", "event_espresso"),$old_site_url,site_url()));
311
+	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url), array());
312
+	   if ($old_db_to_new_db_mapping) {
313
+		   EE_Error::add_attention(sprintf(__("We noticed you have imported data via CSV from %s before. Because of this, IDs in your CSV have been mapped to their new IDs in %s", "event_espresso"), $old_site_url, site_url()));
314 314
 	   }
315 315
 	   $old_db_to_new_db_mapping = $this->save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping);
316 316
 
317 317
 		//save the mapping from old db to new db in case they try re-importing the same data from the same website again
318
-		update_option('ee_id_mapping_from'.sanitize_title($old_site_url),$old_db_to_new_db_mapping);
318
+		update_option('ee_id_mapping_from'.sanitize_title($old_site_url), $old_db_to_new_db_mapping);
319 319
 
320
-		if ( $this->_total_updates > 0 ) {
321
-			EE_Error::add_success( sprintf(__("%s existing records in the database were updated.", "event_espresso"),$this->_total_updates));
320
+		if ($this->_total_updates > 0) {
321
+			EE_Error::add_success(sprintf(__("%s existing records in the database were updated.", "event_espresso"), $this->_total_updates));
322 322
 			$success = true;
323 323
 		}
324
-		if ( $this->_total_inserts > 0 ) {
325
-			EE_Error::add_success(sprintf(__("%s new records were added to the database.", "event_espresso"),$this->_total_inserts));
324
+		if ($this->_total_inserts > 0) {
325
+			EE_Error::add_success(sprintf(__("%s new records were added to the database.", "event_espresso"), $this->_total_inserts));
326 326
 			$success = true;
327 327
 		}
328 328
 
329
-		if ( $this->_total_update_errors > 0 ) {
330
-			EE_Error::add_error(sprintf(__("'One or more errors occurred, and a total of %s existing records in the database were <strong>not</strong> updated.'", "event_espresso"),$this->_total_update_errors), __FILE__, __FUNCTION__, __LINE__ );
329
+		if ($this->_total_update_errors > 0) {
330
+			EE_Error::add_error(sprintf(__("'One or more errors occurred, and a total of %s existing records in the database were <strong>not</strong> updated.'", "event_espresso"), $this->_total_update_errors), __FILE__, __FUNCTION__, __LINE__);
331 331
 			$error = true;
332 332
 		}
333
-		if ( $this->_total_insert_errors > 0 ) {
334
-			EE_Error::add_error(sprintf(__("One or more errors occurred, and a total of %s new records were <strong>not</strong> added to the database.'", "event_espresso"),$this->_total_insert_errors), __FILE__, __FUNCTION__, __LINE__ );
333
+		if ($this->_total_insert_errors > 0) {
334
+			EE_Error::add_error(sprintf(__("One or more errors occurred, and a total of %s new records were <strong>not</strong> added to the database.'", "event_espresso"), $this->_total_insert_errors), __FILE__, __FUNCTION__, __LINE__);
335 335
 			$error = true;
336 336
 		}
337 337
 
338 338
 		//lastly, we need to update the datetime and ticket sold amounts
339 339
 		//as those may ahve been affected by this
340
-		EEM_Datetime::instance()->update_sold( EEM_Datetime::instance()->get_all() );
340
+		EEM_Datetime::instance()->update_sold(EEM_Datetime::instance()->get_all());
341 341
 		EEM_Ticket::instance()->update_tickets_sold(EEM_Ticket::instance()->get_all());
342 342
 
343 343
 		// if there was at least one success and absolutely no errors
344
-		if ( $success && ! $error ) {
344
+		if ($success && ! $error) {
345 345
 			return TRUE;
346 346
 		} else {
347 347
 			return FALSE;
@@ -373,81 +373,81 @@  discard block
 block discarded – undo
373 373
 	 * @param type $old_db_to_new_db_mapping
374 374
 	 * @return array updated $old_db_to_new_db_mapping
375 375
 	 */
376
-	public function save_data_rows_to_db( $csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping ) {
377
-		foreach ( $csv_data_array as $model_name_in_csv_data => $model_data_from_import ) {
376
+	public function save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping) {
377
+		foreach ($csv_data_array as $model_name_in_csv_data => $model_data_from_import) {
378 378
 			//now check that assumption was correct. If
379
-			if ( EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
379
+			if (EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
380 380
 				$model_name = $model_name_in_csv_data;
381
-			}else {
381
+			} else {
382 382
 				// no table info in the array and no table name passed to the function?? FAIL
383
-				EE_Error::add_error( __('No table information was specified and/or found, therefore the import could not be completed','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
383
+				EE_Error::add_error(__('No table information was specified and/or found, therefore the import could not be completed', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
384 384
 				return FALSE;
385 385
 			}
386 386
 			/* @var $model EEM_Base */
387 387
 			$model = EE_Registry::instance()->load_model($model_name);
388 388
 
389 389
 			//so without further ado, scanning all the data provided for primary keys and their inital values
390
-			foreach ( $model_data_from_import as $model_object_data ) {
390
+			foreach ($model_data_from_import as $model_object_data) {
391 391
 				//before we do ANYTHING, make sure the csv row wasn't just completely blank
392 392
 				$row_is_completely_empty = true;
393
-				foreach($model_object_data as $field){
394
-					if($field){
393
+				foreach ($model_object_data as $field) {
394
+					if ($field) {
395 395
 						$row_is_completely_empty = false;
396 396
 					}
397 397
 				}
398
-				if($row_is_completely_empty){
398
+				if ($row_is_completely_empty) {
399 399
 					continue;
400 400
 				}
401 401
 				//find the PK in the row of data (or a combined key if
402 402
 				//there is no primary key)
403
-				if($model->has_primary_key_field()){
404
-					$id_in_csv =  $model_object_data[$model->primary_key_name()];
405
-				}else{
403
+				if ($model->has_primary_key_field()) {
404
+					$id_in_csv = $model_object_data[$model->primary_key_name()];
405
+				} else {
406 406
 					$id_in_csv = $model->get_index_primary_key_string($model_object_data);
407 407
 				}
408 408
 
409 409
 
410
-				$model_object_data = $this->_replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b );
410
+				$model_object_data = $this->_replace_temp_ids_with_mappings($model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b);
411 411
 				//now we need to decide if we're going to add a new model object given the $model_object_data,
412 412
 				//or just update.
413
-				if($export_from_site_a_to_b){
414
-					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
415
-				}else{//this is just a re-import
416
-					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
413
+				if ($export_from_site_a_to_b) {
414
+					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
415
+				} else {//this is just a re-import
416
+					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
417 417
 				}
418
-				if( $what_to_do == self::do_nothing ) {
418
+				if ($what_to_do == self::do_nothing) {
419 419
 					continue;
420 420
 				}
421 421
 
422 422
 				//double-check we actually want to insert, if that's what we're planning
423 423
 				//based on whether this item would be unique in the DB or not
424
-				if( $what_to_do == self::do_insert ) {
424
+				if ($what_to_do == self::do_insert) {
425 425
 					//we're supposed to be inserting. But wait, will this thing
426 426
 					//be acceptable if inserted?
427
-					$conflicting = $model->get_one_conflicting( $model_object_data, false );
428
-					if($conflicting){
427
+					$conflicting = $model->get_one_conflicting($model_object_data, false);
428
+					if ($conflicting) {
429 429
 						//ok, this item would conflict if inserted. Just update the item that it conflicts with.
430 430
 						$what_to_do = self::do_update;
431 431
 						//and if this model has a primary key, remember its mapping
432
-						if($model->has_primary_key_field()){
432
+						if ($model->has_primary_key_field()) {
433 433
 							$old_db_to_new_db_mapping[$model_name][$id_in_csv] = $conflicting->ID();
434 434
 							$model_object_data[$model->primary_key_name()] = $conflicting->ID();
435
-						}else{
435
+						} else {
436 436
 							//we want to update this conflicting item, instead of inserting a conflicting item
437 437
 							//so we need to make sure they match entirely (its possible that they only conflicted on one field, but we need them to match on other fields
438 438
 							//for the WHERE conditions in the update). At the time of this comment, there were no models like this
439
-							foreach($model->get_combined_primary_key_fields() as $key_field){
439
+							foreach ($model->get_combined_primary_key_fields() as $key_field) {
440 440
 								$model_object_data[$key_field->get_name()] = $conflicting->get($key_field->get_name());
441 441
 							}
442 442
 						}
443 443
 					}
444 444
 				}
445
-				if( $what_to_do == self::do_insert ) {
446
-					$old_db_to_new_db_mapping = $this->_insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
447
-				}elseif( $what_to_do == self::do_update ) {
448
-					$old_db_to_new_db_mapping = $this->_update_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
449
-				}else{
450
-					throw new EE_Error( sprintf( __( 'Programming error. We shoudl be inserting or updating, but instead we are being told to "%s", whifh is invalid', 'event_espresso' ), $what_to_do ) );
445
+				if ($what_to_do == self::do_insert) {
446
+					$old_db_to_new_db_mapping = $this->_insert_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
447
+				}elseif ($what_to_do == self::do_update) {
448
+					$old_db_to_new_db_mapping = $this->_update_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
449
+				} else {
450
+					throw new EE_Error(sprintf(__('Programming error. We shoudl be inserting or updating, but instead we are being told to "%s", whifh is invalid', 'event_espresso'), $what_to_do));
451 451
 				}
452 452
 			}
453 453
 		}
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 	 * @param array $old_db_to_new_db_mapping by reference so it can be modified
469 469
 	 * @return string one of the consts on this class that starts with do_*
470 470
 	 */
471
-	protected function _decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping ) {
471
+	protected function _decide_whether_to_insert_or_update_given_data_from_other_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
472 472
 		$model_name = $model->get_this_model_name();
473 473
 		//if it's a site-to-site export-and-import, see if this modelobject's id
474 474
 		//in the old data that we know of
475
-		if( isset($old_db_to_new_db_mapping[$model_name][$id_in_csv]) ){
475
+		if (isset($old_db_to_new_db_mapping[$model_name][$id_in_csv])) {
476 476
 			return self::do_update;
477
-		}else{
477
+		} else {
478 478
 			return self::do_insert;
479 479
 		}
480 480
 	}
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 	 * @param type $old_db_to_new_db_mapping
490 490
 	 * @return
491 491
 	 */
492
-	protected function _decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model ) {
492
+	protected function _decide_whether_to_insert_or_update_given_data_from_same_db($id_in_csv, $model_object_data, $model) {
493 493
 		//in this case, check if this thing ACTUALLY exists in the database
494
-		if( $model->get_one_conflicting( $model_object_data ) ){
494
+		if ($model->get_one_conflicting($model_object_data)) {
495 495
 			return self::do_update;
496
-		}else{
496
+		} else {
497 497
 			return self::do_insert;
498 498
 		}
499 499
 	}
@@ -512,55 +512,55 @@  discard block
 block discarded – undo
512 512
 	 * @param boolean $export_from_site_a_to_b
513 513
 	 * @return array updated model object data with temp IDs removed
514 514
 	 */
515
-	protected function _replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b ) {
515
+	protected function _replace_temp_ids_with_mappings($model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
516 516
 		//if this model object's primary key is in the mapping, replace it
517
-		if( $model->has_primary_key_field() &&
517
+		if ($model->has_primary_key_field() &&
518 518
 				$model->get_primary_key_field()->is_auto_increment() &&
519
-				isset( $old_db_to_new_db_mapping[ $model->get_this_model_name() ] ) &&
520
-				isset( $old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $model_object_data[ $model->primary_key_name() ] ] ) ) {
521
-			$model_object_data[ $model->primary_key_name() ] = $old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $model_object_data[ $model->primary_key_name() ] ];
519
+				isset($old_db_to_new_db_mapping[$model->get_this_model_name()]) &&
520
+				isset($old_db_to_new_db_mapping[$model->get_this_model_name()][$model_object_data[$model->primary_key_name()]])) {
521
+			$model_object_data[$model->primary_key_name()] = $old_db_to_new_db_mapping[$model->get_this_model_name()][$model_object_data[$model->primary_key_name()]];
522 522
 		}
523 523
 
524
-		try{
524
+		try {
525 525
 			$model_name_field = $model->get_field_containing_related_model_name();
526 526
 			$models_pointed_to_by_model_name_field = $model_name_field->get_model_names_pointed_to();
527
-		}catch( EE_Error $e ){
527
+		} catch (EE_Error $e) {
528 528
 			$model_name_field = NULL;
529 529
 			$models_pointed_to_by_model_name_field = array();
530 530
 		}
531
-		foreach( $model->field_settings( true )  as $field_obj ){
532
-			if( $field_obj instanceof EE_Foreign_Key_Int_Field ) {
531
+		foreach ($model->field_settings(true)  as $field_obj) {
532
+			if ($field_obj instanceof EE_Foreign_Key_Int_Field) {
533 533
 				$models_pointed_to = $field_obj->get_model_names_pointed_to();
534 534
 				$found_a_mapping = false;
535
-				foreach( $models_pointed_to as $model_pointed_to_by_fk ) {
535
+				foreach ($models_pointed_to as $model_pointed_to_by_fk) {
536 536
 
537
-					if( $model_name_field ){
538
-						$value_of_model_name_field = $model_object_data[ $model_name_field->get_name() ];
539
-						if( $value_of_model_name_field == $model_pointed_to_by_fk ) {
540
-							$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
541
-									$model_object_data[ $field_obj->get_name() ],
537
+					if ($model_name_field) {
538
+						$value_of_model_name_field = $model_object_data[$model_name_field->get_name()];
539
+						if ($value_of_model_name_field == $model_pointed_to_by_fk) {
540
+							$model_object_data[$field_obj->get_name()] = $this->_find_mapping_in(
541
+									$model_object_data[$field_obj->get_name()],
542 542
 									$model_pointed_to_by_fk,
543 543
 									$old_db_to_new_db_mapping,
544 544
 									$export_from_site_a_to_b );
545 545
 								$found_a_mapping = true;
546 546
 								break;
547 547
 						}
548
-					}else{
549
-						$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
550
-								$model_object_data[ $field_obj->get_name() ],
548
+					} else {
549
+						$model_object_data[$field_obj->get_name()] = $this->_find_mapping_in(
550
+								$model_object_data[$field_obj->get_name()],
551 551
 								$model_pointed_to_by_fk,
552 552
 								$old_db_to_new_db_mapping,
553 553
 								$export_from_site_a_to_b );
554 554
 						$found_a_mapping = true;
555 555
 					}
556 556
 					//once we've found a mapping for this field no need to continue
557
-					if( $found_a_mapping ) {
557
+					if ($found_a_mapping) {
558 558
 						break;
559 559
 					}
560 560
 
561 561
 
562 562
 				}
563
-			}else{
563
+			} else {
564 564
 				//it's a string foreign key (which we leave alone, because those are things
565 565
 				//like country names, which we'd really rather not make 2 USAs etc (we'd actually
566 566
 				//prefer to just update one)
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 			}
569 569
 		}
570 570
 		//
571
-		if( $model instanceof EEM_Term_Taxonomy ){
572
-			$model_object_data = $this->_handle_split_term_ids( $model_object_data );
571
+		if ($model instanceof EEM_Term_Taxonomy) {
572
+			$model_object_data = $this->_handle_split_term_ids($model_object_data);
573 573
 		}
574 574
 		return $model_object_data;
575 575
 	}
@@ -581,11 +581,11 @@  discard block
 block discarded – undo
581 581
 	 * @param type $model_object_data
582 582
 	 * @return array new model object data
583 583
 	 */
584
-	protected function _handle_split_term_ids( $model_object_data ){
585
-		if( isset( $model_object_data['term_id'] ) && isset( $model_object_data[ 'taxonomy' ]) && apply_filters( 'FHEE__EE_Import__handle_split_term_ids__function_exists', function_exists( 'wp_get_split_term' ), $model_object_data ) ) {
586
-			$new_term_id = wp_get_split_term( $model_object_data[ 'term_id' ], $model_object_data[ 'taxonomy' ] );
587
-			if( $new_term_id ){
588
-				$model_object_data[ 'term_id' ] = $new_term_id;
584
+	protected function _handle_split_term_ids($model_object_data) {
585
+		if (isset($model_object_data['term_id']) && isset($model_object_data['taxonomy']) && apply_filters('FHEE__EE_Import__handle_split_term_ids__function_exists', function_exists('wp_get_split_term'), $model_object_data)) {
586
+			$new_term_id = wp_get_split_term($model_object_data['term_id'], $model_object_data['taxonomy']);
587
+			if ($new_term_id) {
588
+				$model_object_data['term_id'] = $new_term_id;
589 589
 			}
590 590
 		}
591 591
 		return $model_object_data;
@@ -599,18 +599,18 @@  discard block
 block discarded – undo
599 599
 	 * @param type $export_from_site_a_to_b
600 600
 	 * @return int
601 601
 	 */
602
-	protected function _find_mapping_in( $object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
603
-		if(	isset( $old_db_to_new_db_mapping[ $model_name ][ $object_id ] ) ){
602
+	protected function _find_mapping_in($object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
603
+		if (isset($old_db_to_new_db_mapping[$model_name][$object_id])) {
604 604
 
605
-				return $old_db_to_new_db_mapping[ $model_name ][ $object_id ];
606
-			}elseif( $object_id == '0' || $object_id == '' ) {
605
+				return $old_db_to_new_db_mapping[$model_name][$object_id];
606
+			}elseif ($object_id == '0' || $object_id == '') {
607 607
 				//leave as-is
608 608
 				return $object_id;
609
-			}elseif( $export_from_site_a_to_b ){
609
+			}elseif ($export_from_site_a_to_b) {
610 610
 				//we couldn't find a mapping for this, and it's from a different site,
611 611
 				//so blank it out
612 612
 				return NULL;
613
-			}elseif( ! $export_from_site_a_to_b ) {
613
+			}elseif ( ! $export_from_site_a_to_b) {
614 614
 				//we coudln't find a mapping for this, but it's from thsi DB anyway
615 615
 				//so let's just leave it as-is
616 616
 				return $object_id;
@@ -625,36 +625,36 @@  discard block
 block discarded – undo
625 625
 	 * @param type $old_db_to_new_db_mapping
626 626
 	 * @return array updated $old_db_to_new_db_mapping
627 627
 	 */
628
-	protected function _insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping ) {
628
+	protected function _insert_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
629 629
 		//remove the primary key, if there is one (we don't want it for inserts OR updates)
630 630
 		//we'll put it back in if we need it
631
-		if($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()){
631
+		if ($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()) {
632 632
 			$effective_id = $model_object_data[$model->primary_key_name()];
633 633
 			unset($model_object_data[$model->primary_key_name()]);
634
-		}else{
635
-			$effective_id = $model->get_index_primary_key_string( $model_object_data );
634
+		} else {
635
+			$effective_id = $model->get_index_primary_key_string($model_object_data);
636 636
 		}
637 637
 		//the model takes care of validating the CSV's input
638
-		try{
638
+		try {
639 639
 			$new_id = $model->insert($model_object_data);
640
-			if( $new_id ){
640
+			if ($new_id) {
641 641
 				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_id;
642 642
 				$this->_total_inserts++;
643
-				EE_Error::add_success( sprintf(__("Successfully added new %s (with id %s) with csv data %s", "event_espresso"),$model->get_this_model_name(),$new_id, implode(",",$model_object_data)));
644
-			}else{
643
+				EE_Error::add_success(sprintf(__("Successfully added new %s (with id %s) with csv data %s", "event_espresso"), $model->get_this_model_name(), $new_id, implode(",", $model_object_data)));
644
+			} else {
645 645
 				$this->_total_insert_errors++;
646 646
 				//put the ID used back in there for the error message
647
-				if($model->has_primary_key_field()){
647
+				if ($model->has_primary_key_field()) {
648 648
 					$model_object_data[$model->primary_key_name()] = $effective_id;
649 649
 				}
650
-				EE_Error::add_error( sprintf(__("Could not insert new %s with the csv data: %s", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data)), __FILE__, __FUNCTION__, __LINE__ );
650
+				EE_Error::add_error(sprintf(__("Could not insert new %s with the csv data: %s", "event_espresso"), $model->get_this_model_name(), http_build_query($model_object_data)), __FILE__, __FUNCTION__, __LINE__);
651 651
 			}
652
-		}catch(EE_Error $e){
652
+		} catch (EE_Error $e) {
653 653
 			$this->_total_insert_errors++;
654
-			if($model->has_primary_key_field()){
654
+			if ($model->has_primary_key_field()) {
655 655
 				$model_object_data[$model->primary_key_name()] = $effective_id;
656 656
 			}
657
-			EE_Error::add_error( sprintf(__("Could not insert new %s with the csv data: %s because %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data),$e->getMessage()), __FILE__, __FUNCTION__, __LINE__ );
657
+			EE_Error::add_error(sprintf(__("Could not insert new %s with the csv data: %s because %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
658 658
 		}
659 659
 		return $old_db_to_new_db_mapping;
660 660
 	}
@@ -667,55 +667,55 @@  discard block
 block discarded – undo
667 667
 	 * @param array $old_db_to_new_db_mapping
668 668
 	 * @return array updated $old_db_to_new_db_mapping
669 669
 	 */
670
-	protected function _update_from_data_array( $id_in_csv,  $model_object_data, $model, $old_db_to_new_db_mapping ) {
671
-		try{
670
+	protected function _update_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
671
+		try {
672 672
 			//let's keep two copies of the model object data:
673 673
 			//one for performing an update, one for everthing else
674 674
 			$model_object_data_for_update = $model_object_data;
675
-			if($model->has_primary_key_field()){
675
+			if ($model->has_primary_key_field()) {
676 676
 				$conditions = array($model->primary_key_name() => $model_object_data[$model->primary_key_name()]);
677 677
 				//remove the primary key because we shouldn't use it for updating
678 678
 				unset($model_object_data_for_update[$model->primary_key_name()]);
679
-			}elseif($model->get_combined_primary_key_fields() > 1 ){
679
+			}elseif ($model->get_combined_primary_key_fields() > 1) {
680 680
 				$conditions = array();
681
-				foreach($model->get_combined_primary_key_fields() as $key_field){
681
+				foreach ($model->get_combined_primary_key_fields() as $key_field) {
682 682
 					$conditions[$key_field->get_name()] = $model_object_data[$key_field->get_name()];
683 683
 				}
684
-			}else{
685
-				$model->primary_key_name();//this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
684
+			} else {
685
+				$model->primary_key_name(); //this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
686 686
 			}
687 687
 
688
-			$success = $model->update($model_object_data_for_update,array($conditions));
689
-			if($success){
688
+			$success = $model->update($model_object_data_for_update, array($conditions));
689
+			if ($success) {
690 690
 				$this->_total_updates++;
691
-				EE_Error::add_success( sprintf(__("Successfully updated %s with csv data %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data_for_update)));
691
+				EE_Error::add_success(sprintf(__("Successfully updated %s with csv data %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data_for_update)));
692 692
 				//we should still record the mapping even though it was an update
693 693
 				//because if we were going to insert somethign but it was going to conflict
694 694
 				//we would have last-minute decided to update. So we'd like to know what we updated
695 695
 				//and so we record what record ended up being updated using the mapping
696
-				if( $model->has_primary_key_field() ){
697
-					$new_key_for_mapping = $model_object_data[ $model->primary_key_name() ];
698
-				}else{
696
+				if ($model->has_primary_key_field()) {
697
+					$new_key_for_mapping = $model_object_data[$model->primary_key_name()];
698
+				} else {
699 699
 					//no primary key just a combined key
700
-					$new_key_for_mapping = $model->get_index_primary_key_string( $model_object_data );
700
+					$new_key_for_mapping = $model->get_index_primary_key_string($model_object_data);
701 701
 				}
702
-				$old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $id_in_csv ] = $new_key_for_mapping;
703
-			}else{
702
+				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_key_for_mapping;
703
+			} else {
704 704
 				$matched_items = $model->get_all(array($conditions));
705
-				if( ! $matched_items){
705
+				if ( ! $matched_items) {
706 706
 					//no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
707 707
 					$this->_total_update_errors++;
708
-					EE_Error::add_error( sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data),http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__ );
709
-				}else{
708
+					EE_Error::add_error(sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"), $model->get_this_model_name(), http_build_query($model_object_data), http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__);
709
+				} else {
710 710
 					$this->_total_updates++;
711
-					EE_Error::add_success( sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data)));
711
+					EE_Error::add_success(sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data)));
712 712
 				}
713 713
 			}
714
-		}catch(EE_Error $e){
714
+		} catch (EE_Error $e) {
715 715
 			$this->_total_update_errors++;
716
-			$basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data),$e->getMessage());
717
-			$debug_message = $basic_message . ' Stack trace: ' . $e->getTraceAsString();
718
-			EE_Error::add_error( "$basic_message | $debug_message", __FILE__, __FUNCTION__, __LINE__ );
716
+			$basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data), $e->getMessage());
717
+			$debug_message = $basic_message.' Stack trace: '.$e->getTraceAsString();
718
+			EE_Error::add_error("$basic_message | $debug_message", __FILE__, __FUNCTION__, __LINE__);
719 719
 		}
720 720
 		return $old_db_to_new_db_mapping;
721 721
 	}
@@ -724,28 +724,28 @@  discard block
 block discarded – undo
724 724
 	 * Gets the number of inserts performed since importer was instantiated or reset
725 725
 	 * @return int
726 726
 	 */
727
-	public function get_total_inserts(){
727
+	public function get_total_inserts() {
728 728
 		return $this->_total_inserts;
729 729
 	}
730 730
 	/**
731 731
 	 *  Gets the number of insert errors since importer was instantiated or reset
732 732
 	 * @return int
733 733
 	 */
734
-	public function get_total_insert_errors(){
734
+	public function get_total_insert_errors() {
735 735
 		return $this->_total_insert_errors;
736 736
 	}
737 737
 	/**
738 738
 	 *  Gets the number of updates performed since importer was instantiated or reset
739 739
 	 * @return int
740 740
 	 */
741
-	public function get_total_updates(){
741
+	public function get_total_updates() {
742 742
 		return $this->_total_updates;
743 743
 	}
744 744
 	/**
745 745
 	 *  Gets the number of update errors since importer was instantiated or reset
746 746
 	 * @return int
747 747
 	 */
748
-	public function get_total_update_errors(){
748
+	public function get_total_update_errors() {
749 749
 		return $this->_total_update_errors;
750 750
 	}
751 751
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if (!defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
5 7
 /**
6 8
  * EE_Import class
@@ -297,7 +299,7 @@  discard block
 block discarded – undo
297 299
 			if(isset($csv_metadata['site_url']) && $csv_metadata['site_url'] == site_url()){
298 300
 				EE_Error::add_attention(sprintf(__("CSV Data appears to be from the same database, so attempting to update data", "event_espresso")));
299 301
 				$export_from_site_a_to_b = false;
300
-			}else{
302
+			} else{
301 303
 				$old_site_url = isset( $csv_metadata['site_url']) ? $csv_metadata['site_url'] : $old_site_url;
302 304
 				EE_Error::add_attention(sprintf(__("CSV Data appears to be from a different database (%s instead of %s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database", "event_espresso"),$old_site_url,site_url()));
303 305
 			};
@@ -378,7 +380,7 @@  discard block
 block discarded – undo
378 380
 			//now check that assumption was correct. If
379 381
 			if ( EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
380 382
 				$model_name = $model_name_in_csv_data;
381
-			}else {
383
+			} else {
382 384
 				// no table info in the array and no table name passed to the function?? FAIL
383 385
 				EE_Error::add_error( __('No table information was specified and/or found, therefore the import could not be completed','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
384 386
 				return FALSE;
@@ -402,7 +404,7 @@  discard block
 block discarded – undo
402 404
 				//there is no primary key)
403 405
 				if($model->has_primary_key_field()){
404 406
 					$id_in_csv =  $model_object_data[$model->primary_key_name()];
405
-				}else{
407
+				} else{
406 408
 					$id_in_csv = $model->get_index_primary_key_string($model_object_data);
407 409
 				}
408 410
 
@@ -412,7 +414,7 @@  discard block
 block discarded – undo
412 414
 				//or just update.
413 415
 				if($export_from_site_a_to_b){
414 416
 					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
415
-				}else{//this is just a re-import
417
+				} else{//this is just a re-import
416 418
 					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
417 419
 				}
418 420
 				if( $what_to_do == self::do_nothing ) {
@@ -432,7 +434,7 @@  discard block
 block discarded – undo
432 434
 						if($model->has_primary_key_field()){
433 435
 							$old_db_to_new_db_mapping[$model_name][$id_in_csv] = $conflicting->ID();
434 436
 							$model_object_data[$model->primary_key_name()] = $conflicting->ID();
435
-						}else{
437
+						} else{
436 438
 							//we want to update this conflicting item, instead of inserting a conflicting item
437 439
 							//so we need to make sure they match entirely (its possible that they only conflicted on one field, but we need them to match on other fields
438 440
 							//for the WHERE conditions in the update). At the time of this comment, there were no models like this
@@ -444,9 +446,9 @@  discard block
 block discarded – undo
444 446
 				}
445 447
 				if( $what_to_do == self::do_insert ) {
446 448
 					$old_db_to_new_db_mapping = $this->_insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
447
-				}elseif( $what_to_do == self::do_update ) {
449
+				} elseif( $what_to_do == self::do_update ) {
448 450
 					$old_db_to_new_db_mapping = $this->_update_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
449
-				}else{
451
+				} else{
450 452
 					throw new EE_Error( sprintf( __( 'Programming error. We shoudl be inserting or updating, but instead we are being told to "%s", whifh is invalid', 'event_espresso' ), $what_to_do ) );
451 453
 				}
452 454
 			}
@@ -474,7 +476,7 @@  discard block
 block discarded – undo
474 476
 		//in the old data that we know of
475 477
 		if( isset($old_db_to_new_db_mapping[$model_name][$id_in_csv]) ){
476 478
 			return self::do_update;
477
-		}else{
479
+		} else{
478 480
 			return self::do_insert;
479 481
 		}
480 482
 	}
@@ -493,7 +495,7 @@  discard block
 block discarded – undo
493 495
 		//in this case, check if this thing ACTUALLY exists in the database
494 496
 		if( $model->get_one_conflicting( $model_object_data ) ){
495 497
 			return self::do_update;
496
-		}else{
498
+		} else{
497 499
 			return self::do_insert;
498 500
 		}
499 501
 	}
@@ -524,7 +526,7 @@  discard block
 block discarded – undo
524 526
 		try{
525 527
 			$model_name_field = $model->get_field_containing_related_model_name();
526 528
 			$models_pointed_to_by_model_name_field = $model_name_field->get_model_names_pointed_to();
527
-		}catch( EE_Error $e ){
529
+		} catch( EE_Error $e ){
528 530
 			$model_name_field = NULL;
529 531
 			$models_pointed_to_by_model_name_field = array();
530 532
 		}
@@ -545,7 +547,7 @@  discard block
 block discarded – undo
545 547
 								$found_a_mapping = true;
546 548
 								break;
547 549
 						}
548
-					}else{
550
+					} else{
549 551
 						$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
550 552
 								$model_object_data[ $field_obj->get_name() ],
551 553
 								$model_pointed_to_by_fk,
@@ -560,7 +562,7 @@  discard block
 block discarded – undo
560 562
 
561 563
 
562 564
 				}
563
-			}else{
565
+			} else{
564 566
 				//it's a string foreign key (which we leave alone, because those are things
565 567
 				//like country names, which we'd really rather not make 2 USAs etc (we'd actually
566 568
 				//prefer to just update one)
@@ -603,14 +605,14 @@  discard block
 block discarded – undo
603 605
 		if(	isset( $old_db_to_new_db_mapping[ $model_name ][ $object_id ] ) ){
604 606
 
605 607
 				return $old_db_to_new_db_mapping[ $model_name ][ $object_id ];
606
-			}elseif( $object_id == '0' || $object_id == '' ) {
608
+			} elseif( $object_id == '0' || $object_id == '' ) {
607 609
 				//leave as-is
608 610
 				return $object_id;
609
-			}elseif( $export_from_site_a_to_b ){
611
+			} elseif( $export_from_site_a_to_b ){
610 612
 				//we couldn't find a mapping for this, and it's from a different site,
611 613
 				//so blank it out
612 614
 				return NULL;
613
-			}elseif( ! $export_from_site_a_to_b ) {
615
+			} elseif( ! $export_from_site_a_to_b ) {
614 616
 				//we coudln't find a mapping for this, but it's from thsi DB anyway
615 617
 				//so let's just leave it as-is
616 618
 				return $object_id;
@@ -631,7 +633,7 @@  discard block
 block discarded – undo
631 633
 		if($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()){
632 634
 			$effective_id = $model_object_data[$model->primary_key_name()];
633 635
 			unset($model_object_data[$model->primary_key_name()]);
634
-		}else{
636
+		} else{
635 637
 			$effective_id = $model->get_index_primary_key_string( $model_object_data );
636 638
 		}
637 639
 		//the model takes care of validating the CSV's input
@@ -641,7 +643,7 @@  discard block
 block discarded – undo
641 643
 				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_id;
642 644
 				$this->_total_inserts++;
643 645
 				EE_Error::add_success( sprintf(__("Successfully added new %s (with id %s) with csv data %s", "event_espresso"),$model->get_this_model_name(),$new_id, implode(",",$model_object_data)));
644
-			}else{
646
+			} else{
645 647
 				$this->_total_insert_errors++;
646 648
 				//put the ID used back in there for the error message
647 649
 				if($model->has_primary_key_field()){
@@ -649,7 +651,7 @@  discard block
 block discarded – undo
649 651
 				}
650 652
 				EE_Error::add_error( sprintf(__("Could not insert new %s with the csv data: %s", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data)), __FILE__, __FUNCTION__, __LINE__ );
651 653
 			}
652
-		}catch(EE_Error $e){
654
+		} catch(EE_Error $e){
653 655
 			$this->_total_insert_errors++;
654 656
 			if($model->has_primary_key_field()){
655 657
 				$model_object_data[$model->primary_key_name()] = $effective_id;
@@ -676,12 +678,12 @@  discard block
 block discarded – undo
676 678
 				$conditions = array($model->primary_key_name() => $model_object_data[$model->primary_key_name()]);
677 679
 				//remove the primary key because we shouldn't use it for updating
678 680
 				unset($model_object_data_for_update[$model->primary_key_name()]);
679
-			}elseif($model->get_combined_primary_key_fields() > 1 ){
681
+			} elseif($model->get_combined_primary_key_fields() > 1 ){
680 682
 				$conditions = array();
681 683
 				foreach($model->get_combined_primary_key_fields() as $key_field){
682 684
 					$conditions[$key_field->get_name()] = $model_object_data[$key_field->get_name()];
683 685
 				}
684
-			}else{
686
+			} else{
685 687
 				$model->primary_key_name();//this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
686 688
 			}
687 689
 
@@ -695,23 +697,23 @@  discard block
 block discarded – undo
695 697
 				//and so we record what record ended up being updated using the mapping
696 698
 				if( $model->has_primary_key_field() ){
697 699
 					$new_key_for_mapping = $model_object_data[ $model->primary_key_name() ];
698
-				}else{
700
+				} else{
699 701
 					//no primary key just a combined key
700 702
 					$new_key_for_mapping = $model->get_index_primary_key_string( $model_object_data );
701 703
 				}
702 704
 				$old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $id_in_csv ] = $new_key_for_mapping;
703
-			}else{
705
+			} else{
704 706
 				$matched_items = $model->get_all(array($conditions));
705 707
 				if( ! $matched_items){
706 708
 					//no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
707 709
 					$this->_total_update_errors++;
708 710
 					EE_Error::add_error( sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data),http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__ );
709
-				}else{
711
+				} else{
710 712
 					$this->_total_updates++;
711 713
 					EE_Error::add_success( sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data)));
712 714
 				}
713 715
 			}
714
-		}catch(EE_Error $e){
716
+		} catch(EE_Error $e){
715 717
 			$this->_total_update_errors++;
716 718
 			$basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data),$e->getMessage());
717 719
 			$debug_message = $basic_message . ' Stack trace: ' . $e->getTraceAsString();
Please login to merge, or discard this patch.