Completed
Branch BUG-9623-config-log (fadf4a)
by
unknown
534:14 queued 517:23
created
core/admin/EE_Admin_Page_Loader.core.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 		//let's do a scan and see what installed pages we have
120 120
 		$this->_get_installed_pages();
121 121
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
122
-		add_action('admin_menu', array( $this, 'set_menus' ));
123
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
122
+		add_action('admin_menu', array($this, 'set_menus'));
123
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
124 124
 	}
125 125
 
126 126
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	private function _define_caffeinated_constants() {
136
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
137
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
138
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
140
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
136
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
137
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
138
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
140
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
143 143
 		}
144 144
 	}
145 145
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		//set array of EE_Admin_Page_Menu_Group objects
160 160
 		$groups = array(
161
-			'main' => new EE_Admin_Page_Menu_Group( array(
161
+			'main' => new EE_Admin_Page_Menu_Group(array(
162 162
 				'menu_label' => __('Main', 'event_espresso'),
163 163
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
164 164
 				'menu_slug' => 'main',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'menu_order' => 0,
167 167
 				'parent_slug' => 'espresso_events',
168 168
 				)),
169
-			'management' => new EE_Admin_Page_Menu_Group( array(
169
+			'management' => new EE_Admin_Page_Menu_Group(array(
170 170
 				'menu_label' => __('Management', 'event_espresso'),
171 171
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
172 172
 				'menu_slug' => 'management',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				'menu_order' => 10,
175 175
 				'parent_slug' => 'espresso_events'
176 176
 				)),
177
-			'settings' => new EE_Admin_Page_Menu_Group( array(
177
+			'settings' => new EE_Admin_Page_Menu_Group(array(
178 178
 				'menu_label' => __('Settings', 'event_espresso'),
179 179
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
180 180
 				'menu_slug' => 'settings',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'menu_order' => 30,
183 183
 				'parent_slug' => 'espresso_events'
184 184
 				)),
185
-			'templates' => new EE_Admin_Page_Menu_Group( array(
185
+			'templates' => new EE_Admin_Page_Menu_Group(array(
186 186
 				'menu_label' => __('Templates', 'event_espresso'),
187 187
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
188 188
 				'menu_slug' => 'templates',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'menu_order' => 40,
191 191
 				'parent_slug' => 'espresso_events'
192 192
 				)),
193
-			'extras' => new EE_Admin_Page_Menu_Group( array(
193
+			'extras' => new EE_Admin_Page_Menu_Group(array(
194 194
 				'menu_label' => __('Extras', 'event_espresso'),
195 195
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
196 196
 				'menu_slug' => 'extras',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				'parent_slug' => 'espresso_events',
200 200
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
201 201
 				)),
202
-			'tools' => new EE_Admin_Page_Menu_Group( array(
202
+			'tools' => new EE_Admin_Page_Menu_Group(array(
203 203
 				'menu_label' => __("Tools", "event_espresso"),
204 204
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
205 205
 				'menu_slug' => 'tools',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				'menu_order' => 60,
208 208
 				'parent_slug' => 'espresso_events'
209 209
 				)),
210
-			'addons' => new EE_Admin_Page_Menu_Group( array(
210
+			'addons' => new EE_Admin_Page_Menu_Group(array(
211 211
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
212 212
 				'menu_label' => __('Add-ons', 'event_espresso'),
213 213
 				'menu_slug' => 'addons',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				))
218 218
 			);
219 219
 
220
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
220
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
221 221
 	}
222 222
 
223 223
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	private function _rearrange_menu_groups() {
236 236
 		$groups = array();
237 237
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
-		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
238
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
239
+		foreach ($this->_admin_menu_groups as $group) {
240
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
241
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
242 242
 			$groups[$group->menu_slug] = $group;
243 243
 		}
244 244
 		return $groups;
@@ -256,48 +256,48 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private function _get_installed_pages() {
258 258
 		$installed_refs = array();
259
-		$exclude = array( 'assets', 'templates' );
259
+		$exclude = array('assets', 'templates');
260 260
 		// grab everything in the  admin core directory
261
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
262
-		if ( $admin_screens ) {
263
-			foreach( $admin_screens as $admin_screen ) {
261
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
262
+		if ($admin_screens) {
263
+			foreach ($admin_screens as $admin_screen) {
264 264
 				// files and anything in the exclude array need not apply
265
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
265
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
266 266
 					// these folders represent the different EE admin pages
267
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
267
+					$installed_refs[basename($admin_screen)] = $admin_screen;
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( empty( $installed_refs ) ) {
272
+		if (empty($installed_refs)) {
273 273
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
274
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
275
-			throw new EE_Error( implode( '||', $error_msg ));
274
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
275
+			throw new EE_Error(implode('||', $error_msg));
276 276
 		}
277 277
 
278 278
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
279 279
 		$installed_refs = $this->_set_caffeinated($installed_refs);
280 280
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
281
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
282
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
281
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
282
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
283 283
 
284 284
 		//loop through admin pages and setup the $_installed_pages array.
285 285
 		$hooks_ref = array();
286
-		foreach ( $installed_refs as $page => $path ) {
286
+		foreach ($installed_refs as $page => $path) {
287 287
 			// set autoloaders for our admin page classes based on included path information
288
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
288
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
289 289
 			// build list of installed pages
290
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
290
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
291 291
 			// verify returned object
292
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
293
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
292
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
293
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
294 294
 					continue;
295 295
 				}
296 296
 
297 297
 				//skip if in full maintenance mode and maintenance_mode_parent is set
298 298
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
299
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
300
-					unset( $installed_refs[$page] );
299
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
300
+					unset($installed_refs[$page]);
301 301
 					continue;
302 302
 				}
303 303
 
@@ -305,45 +305,45 @@  discard block
 block discarded – undo
305 305
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
306 306
 				$extend = FALSE;
307 307
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
308
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
308
+				if (isset($this->_caffeinated_extends[$page])) {
309 309
 					$this->_current_caf_extend_slug = $page;
310
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
311
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
312
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
313
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
310
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
311
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
312
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
313
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
314 314
 
315
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
316
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
315
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
316
+					$hook_function_page = create_function('$admin_page', $page_runtime);
317 317
 
318
-					add_filter( $path_hook, $hook_function_path );
319
-					add_filter( $page_hook, $hook_function_page );
318
+					add_filter($path_hook, $hook_function_path);
319
+					add_filter($page_hook, $hook_function_page);
320 320
 					$extend = TRUE;
321 321
 				}
322 322
 				//let's do the registered hooks
323
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
323
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
324 324
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
325 325
 			}
326 326
 		}
327 327
 
328 328
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
329 329
 		//first make sure we've got unique values
330
-		$hooks_ref = array_unique( $hooks_ref );
330
+		$hooks_ref = array_unique($hooks_ref);
331 331
 		//now let's loop and require!
332
-		foreach ( $hooks_ref as $path ) {
333
-			require_once( $path );
332
+		foreach ($hooks_ref as $path) {
333
+			require_once($path);
334 334
 		}
335 335
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
336 336
 		global $ee_menu_slugs;
337 337
 		$ee_menu_slugs = $this->_menu_slugs;
338 338
 
339 339
 		//we need to loop again to run any early code
340
-		foreach ( $installed_refs as $page => $path ) {
341
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
340
+		foreach ($installed_refs as $page => $path) {
341
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
342 342
 				$this->_installed_pages[$page]->do_initial_loads();
343 343
 			}
344 344
 		}
345 345
 
346
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
346
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
347 347
 
348 348
 	}
349 349
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 	 * @param string $page_slug
356 356
 	 * @return EE_Admin_Page
357 357
 	 */
358
-	public function get_admin_page_object( $page_slug = '' ) {
359
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
360
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
358
+	public function get_admin_page_object($page_slug = '') {
359
+		if (isset($this->_installed_pages[$page_slug])) {
360
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
361 361
 		}
362 362
 		return NULL;
363 363
 	}
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param $dir_name
371 371
 	 * @return string
372 372
 	 */
373
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
374
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
375
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
373
+	private function _get_classname_for_admin_page($dir_name = '') {
374
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
375
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
376 376
 	}
377 377
 
378 378
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	 * @param $dir_name
384 384
 	 * @return string
385 385
 	 */
386
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
387
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
388
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
386
+	private function _get_classname_for_admin_init_page($dir_name = '') {
387
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
388
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
389 389
 	}
390 390
 
391 391
 
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	 * @throws EE_Error
399 399
 	 * @return object|bool  return page object if valid, bool false if not.
400 400
 	 */
401
-	private function _load_admin_page( $page = '', $path = '' ) {
402
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
403
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404
-		if ( ! class_exists( $class_name )) {
405
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
406
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name );
407
-			throw new EE_Error( implode( '||', $error_msg ));
401
+	private function _load_admin_page($page = '', $path = '') {
402
+		$class_name = $this->_get_classname_for_admin_init_page($page);
403
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
404
+		if ( ! class_exists($class_name)) {
405
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
406
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name);
407
+			throw new EE_Error(implode('||', $error_msg));
408 408
 		}
409 409
 		$a = new ReflectionClass($class_name);
410 410
 		return  $a->newInstance();
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 	public function set_menus() {
424 424
 		//prep the menu pages (sort, group.)
425 425
 		$this->_prep_pages();
426
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
427
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
428
-				$menu_map->add_menu_page( FALSE );
426
+		foreach ($this->_prepped_menu_maps as $menu_map) {
427
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
428
+				$menu_map->add_menu_page(FALSE);
429 429
 			}
430 430
 		}
431 431
 	}
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
 	 *
439 439
 	 * @return void
440 440
 	 */
441
-	public function set_network_menus(){
441
+	public function set_network_menus() {
442 442
 		$this->_prep_pages();
443
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
444
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
445
-				$menu_map->add_menu_page( TRUE );
443
+		foreach ($this->_prepped_menu_maps as $menu_map) {
444
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
445
+				$menu_map->add_menu_page(TRUE);
446 446
 			}
447 447
 		}
448 448
 	}
@@ -463,22 +463,22 @@  discard block
 block discarded – undo
463 463
 		//rearrange _admin_menu_groups to be indexed by group slug.
464 464
 		$menu_groups = $this->_rearrange_menu_groups();
465 465
 
466
-		foreach( $this->_installed_pages as $page ) {
467
-			if ( $page instanceof EE_Admin_page_Init ) {
466
+		foreach ($this->_installed_pages as $page) {
467
+			if ($page instanceof EE_Admin_page_Init) {
468 468
 				$page_map = $page->get_menu_map();
469 469
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
470
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
471
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
470
+				if (is_array($page_map) || empty($page_map)) {
471
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
472 472
 					continue;
473 473
 				}
474 474
 
475 475
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
476
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
477
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
476
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
477
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
478 478
 				}
479 479
 
480 480
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
481
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
481
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
482 482
 					continue;
483 483
 				}
484 484
 
@@ -487,21 +487,21 @@  discard block
 block discarded – undo
487 487
 			}
488 488
 		}
489 489
 
490
-		if ( empty( $pages_array )) {
491
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
490
+		if (empty($pages_array)) {
491
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
492 492
 		}
493 493
 
494 494
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495
-		foreach ( $pages_array as $group => $menu_maps ) {
495
+		foreach ($pages_array as $group => $menu_maps) {
496 496
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
497
+			if ( ! array_key_exists($group, $menu_groups))
498 498
 				continue;
499 499
 
500 500
 			//sort pages.
501
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
501
+			usort($menu_maps, array($this, '_sort_menu_maps'));
502 502
 
503 503
 			//prepend header
504
-			array_unshift( $menu_maps, $menu_groups[$group] );
504
+			array_unshift($menu_maps, $menu_groups[$group]);
505 505
 
506 506
 			//reset $pages_array with prepped data
507 507
 			$pages_array[$group] = $menu_maps;
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 
510 510
 
511 511
 		//now let's setup the _prepped_menu_maps property
512
-		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
512
+		foreach ($menu_groups as $group => $group_objs) {
513
+			if (isset($pages_array[$group]))
514
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
515 515
 		}/**/
516 516
 
517 517
 	}
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
532 532
 	 * @return array
533 533
 	 */
534
-	private function _set_caffeinated( $installed_refs ) {
534
+	private function _set_caffeinated($installed_refs) {
535 535
 
536 536
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
537
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
537
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
538 538
 			return $installed_refs;
539 539
 		}
540 540
 
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 		$exclude = array('tickets');
544 544
 
545 545
 		//okay let's setup an "New" pages first (we'll return installed refs later)
546
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
547
-		if ( $new_admin_screens ) {
548
-			foreach( $new_admin_screens as $admin_screen ) {
546
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
547
+		if ($new_admin_screens) {
548
+			foreach ($new_admin_screens as $admin_screen) {
549 549
 				// files and anything in the exclude array need not apply
550
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
550
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
551 551
 					// these folders represent the different NEW EE admin pages
552
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
552
+					$installed_refs[basename($admin_screen)] = $admin_screen;
553 553
 					// set autoloaders for our admin page classes based on included path information
554
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
554
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
555 555
 //					$this->_caf_autoloader[] = array(
556 556
 //						'dir' => 'new',
557 557
 //						'folder' => basename( $admin_screen )
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
 		}
562 562
 
563 563
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
564
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
565
-		if ( $extends ) {
566
-			foreach( $extends as $extend ) {
567
-				if ( is_dir( $extend ) ) {
568
-					$extend_ref = basename( $extend );
564
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
565
+		if ($extends) {
566
+			foreach ($extends as $extend) {
567
+				if (is_dir($extend)) {
568
+					$extend_ref = basename($extend);
569 569
 					//now let's make sure there is a file that matches the expected format
570
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
571
-					$filename = 'Extend_' . $filename . '_Admin_Page';
572
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
570
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
571
+					$filename = 'Extend_'.$filename.'_Admin_Page';
572
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
573 573
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
574 574
 					// set autoloaders for our admin page classes based on included path information
575
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
575
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
576 576
 //					$this->_caf_autoloader[] = array(
577 577
 //						'dir' => 'extend',
578 578
 //						'folder' => $extend_ref
@@ -583,22 +583,22 @@  discard block
 block discarded – undo
583 583
 
584 584
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
585 585
 		$ee_admin_hooks = array();
586
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
587
-		if ( $hooks ) {
588
-			foreach ( $hooks as $hook ) {
589
-				if ( is_readable( $hook ) ) {
586
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
587
+		if ($hooks) {
588
+			foreach ($hooks as $hook) {
589
+				if (is_readable($hook)) {
590 590
 					require_once $hook;
591
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
591
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
592 592
 					$classname = str_replace('.class.php', '', $classname);
593
-					if ( class_exists( $classname ) ) {
594
-						$a = new ReflectionClass( $classname );
593
+					if (class_exists($classname)) {
594
+						$a = new ReflectionClass($classname);
595 595
 						$ee_admin_hooks[] = $a->newInstance();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}/**/
600 600
 
601
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
601
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
602 602
 
603 603
 		return $installed_refs;
604 604
 
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
656 656
 	 * @return int    sort order
657 657
 	 */
658
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
658
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
659
+		if ($a->menu_order == $b->menu_order)
660 660
 			return 0;
661 661
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 662
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 1 patch
Spacing   +595 added lines, -595 removed lines patch added patch discarded remove patch
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
148 148
 	 * 		@access public
149 149
 	 */
150
-	public function __construct( $routing = TRUE ) {
150
+	public function __construct($routing = TRUE) {
151 151
 
152
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
152
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
153 153
 			$this->_is_caf = TRUE;
154 154
 
155 155
 		$this->_yes_no_values = array(
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 
162 162
 		//set the _req_data property.
163
-		$this->_req_data = array_merge( $_GET, $_POST );
163
+		$this->_req_data = array_merge($_GET, $_POST);
164 164
 
165 165
 
166 166
 		//routing enabled?
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		$this->_do_other_page_hooks();
182 182
 
183 183
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
184
-		if ( method_exists( $this, '_before_page_setup' ) )
184
+		if (method_exists($this, '_before_page_setup'))
185 185
 			$this->_before_page_setup();
186 186
 
187 187
 		//set up page dependencies
@@ -451,16 +451,16 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	protected function _global_ajax_hooks() {
453 453
 		//for lazy loading of metabox content
454
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
454
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
455 455
 	}
456 456
 
457 457
 
458 458
 
459 459
 	public function ajax_metabox_content() {
460
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
461
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
460
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
461
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
462 462
 
463
-		self::cached_rss_display( $contentid, $url );
463
+		self::cached_rss_display($contentid, $url);
464 464
 		wp_die();
465 465
 	}
466 466
 
@@ -481,87 +481,87 @@  discard block
 block discarded – undo
481 481
 
482 482
 
483 483
 		//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.
484
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
484
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
485 485
 
486 486
 
487 487
 		//next verify if we need to load anything...
488
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE;
489
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
488
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE;
489
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
490 490
 
491 491
 		global $ee_menu_slugs;
492 492
 		$ee_menu_slugs = (array) $ee_menu_slugs;
493 493
 
494
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
494
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
495 495
 
496 496
 
497 497
 		// 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
498
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
499
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
498
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
499
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
500 500
 		}
501 501
 		// then set blank or -1 action values to 'default'
502
-		$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';
502
+		$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';
503 503
 
504 504
 		//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.
505
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
505
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
506 506
 
507 507
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
508 508
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
509 509
 
510 510
 		$this->_current_view = $this->_req_action;
511
-		$this->_req_nonce = $this->_req_action . '_nonce';
511
+		$this->_req_nonce = $this->_req_action.'_nonce';
512 512
 		$this->_define_page_props();
513 513
 
514
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
514
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
515 515
 
516 516
 		//default things
517
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
517
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
518 518
 
519 519
 		//set page configs
520 520
 		$this->_set_page_routes();
521 521
 		$this->_set_page_config();
522 522
 
523 523
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
524
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
524
+		if (isset($this->_req_data['wp_referer'])) {
525 525
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
526 526
 		}
527 527
 
528 528
 		//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
529
-		if ( method_exists( $this, '_extend_page_config' ) )
529
+		if (method_exists($this, '_extend_page_config'))
530 530
 			$this->_extend_page_config();
531 531
 
532 532
 		//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.
533
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
533
+		if (method_exists($this, '_extend_page_config_for_cpt'))
534 534
 			$this->_extend_page_config_for_cpt();
535 535
 
536 536
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
537
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
538
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
537
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
538
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
539 539
 
540 540
 
541 541
 		//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
542
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
543
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
542
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
543
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
544 544
 		}
545 545
 
546 546
 
547 547
 		//next route only if routing enabled
548
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
548
+		if ($this->_routing && ! defined('DOING_AJAX')) {
549 549
 
550 550
 			$this->_verify_routes();
551 551
 
552 552
 			//next let's just check user_access and kill if no access
553 553
 			$this->check_user_access();
554 554
 
555
-			if ( $this->_is_UI_request ) {
555
+			if ($this->_is_UI_request) {
556 556
 				//admin_init stuff - global, all views for this page class, specific view
557
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
558
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
559
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
557
+				add_action('admin_init', array($this, 'admin_init'), 10);
558
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
559
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
560 560
 				}
561 561
 
562 562
 			} else {
563 563
 				//hijack regular WP loading and route admin request immediately
564
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
564
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
565 565
 				$this->route_admin_request();
566 566
 			}
567 567
 		}
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	 * @return void
579 579
 	 */
580 580
 	private function _do_other_page_hooks() {
581
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
581
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
582 582
 
583
-		foreach ( $registered_pages as $page ) {
583
+		foreach ($registered_pages as $page) {
584 584
 
585 585
 			//now let's setup the file name and class that should be present
586 586
 			$classname = str_replace('.class.php', '', $page);
587 587
 
588 588
 			//autoloaders should take care of loading file
589
-			if ( !class_exists( $classname ) ) {
590
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
591
-				$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 );
592
-				throw new EE_Error( implode( '||', $error_msg ));
589
+			if ( ! class_exists($classname)) {
590
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
591
+				$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);
592
+				throw new EE_Error(implode('||', $error_msg));
593 593
 			}
594 594
 
595 595
 			$a = new ReflectionClass($classname);
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	public function load_page_dependencies() {
605 605
 		try {
606 606
 			$this->_load_page_dependencies();
607
-		} catch ( EE_Error $e ) {
607
+		} catch (EE_Error $e) {
608 608
 			$e->get_error();
609 609
 		}
610 610
 	}
@@ -622,16 +622,16 @@  discard block
 block discarded – undo
622 622
 		$this->_current_screen = get_current_screen();
623 623
 
624 624
 		//load admin_notices - global, page class, and view specific
625
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
626
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
627
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
628
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
625
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
626
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
627
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
628
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
629 629
 		}
630 630
 
631 631
 		//load network admin_notices - global, page class, and view specific
632
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
633
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
634
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
632
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
633
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
634
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
635 635
 		}
636 636
 
637 637
 		//this will save any per_page screen options if they are present
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 		//add screen options - global, page child class, and view specific
648 648
 		$this->_add_global_screen_options();
649 649
 		$this->_add_screen_options();
650
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
651
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
650
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
651
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
652 652
 
653 653
 
654 654
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -659,33 +659,33 @@  discard block
 block discarded – undo
659 659
 		//add feature_pointers - global, page child class, and view specific
660 660
 		$this->_add_feature_pointers();
661 661
 		$this->_add_global_feature_pointers();
662
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
663
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
662
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
663
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
664 664
 
665 665
 		//enqueue scripts/styles - global, page class, and view specific
666
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
667
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
668
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
669
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
666
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
667
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
668
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
669
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
670 670
 
671
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
671
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
672 672
 
673 673
 		//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
674
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
675
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
676
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
677
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
674
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
675
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
676
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
677
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
678 678
 
679 679
 		//admin footer scripts
680
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
681
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
682
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
683
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
680
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
681
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
682
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
683
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
684 684
 
685 685
 
686
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
686
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
687 687
 		//targeted hook
688
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
688
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
689 689
 
690 690
 	}
691 691
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	private function _set_defaults() {
701 701
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
702 702
 
703
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
703
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
704 704
 
705 705
 		$this->default_nav_tab_name = 'overview';
706 706
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	public function route_admin_request() {
728 728
 		try {
729 729
 			$this->_route_admin_request();
730
-		} catch ( EE_Error $e ) {
730
+		} catch (EE_Error $e) {
731 731
 			$e->get_error();
732 732
 		}
733 733
 	}
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 		$this->_wp_page_slug = $wp_page_slug;
739 739
 
740 740
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
741
-		if ( is_network_admin() ) {
741
+		if (is_network_admin()) {
742 742
 			$this->_wp_page_slug .= '-network';
743 743
 		}
744 744
 	}
@@ -751,53 +751,53 @@  discard block
 block discarded – undo
751 751
 	 * @return void
752 752
 	 */
753 753
 	protected function _verify_routes() {
754
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
754
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
755 755
 
756
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
756
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
757 757
 
758 758
 		$this->_route = FALSE;
759 759
 		$func = FALSE;
760 760
 		$args = array();
761 761
 
762 762
 		// check that the page_routes array is not empty
763
-		if ( empty( $this->_page_routes )) {
763
+		if (empty($this->_page_routes)) {
764 764
 			// user error msg
765
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
765
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
766 766
 			// developer error msg
767
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
768
-			throw new EE_Error( $error_msg );
767
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
768
+			throw new EE_Error($error_msg);
769 769
 		}
770 770
 
771 771
 		// and that the requested page route exists
772
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
773
-			$this->_route = $this->_page_routes[ $this->_req_action ];
772
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
773
+			$this->_route = $this->_page_routes[$this->_req_action];
774 774
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
775 775
 		} else {
776 776
 			// user error msg
777
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
777
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
778 778
 			// developer error msg
779
-			$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 );
780
-			throw new EE_Error( $error_msg );
779
+			$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);
780
+			throw new EE_Error($error_msg);
781 781
 		}
782 782
 
783 783
 		// and that a default route exists
784
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
784
+		if ( ! array_key_exists('default', $this->_page_routes)) {
785 785
 			// user error msg
786
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
786
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
787 787
 			// developer error msg
788
-			$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' );
789
-			throw new EE_Error( $error_msg );
788
+			$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');
789
+			throw new EE_Error($error_msg);
790 790
 		}
791 791
 
792 792
 
793 793
 		//first lets' catch if the UI request has EVER been set.
794
-		if ( $this->_is_UI_request === NULL ) {
794
+		if ($this->_is_UI_request === NULL) {
795 795
 			//lets set if this is a UI request or not.
796
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
796
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
797 797
 
798 798
 
799 799
 			//wait a minute... we might have a noheader in the route array
800
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
800
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
801 801
 		}
802 802
 
803 803
 		$this->_set_current_labels();
@@ -812,15 +812,15 @@  discard block
 block discarded – undo
812 812
 	 * @param  string $route the route name we're verifying
813 813
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
814 814
 	 */
815
-	protected function _verify_route( $route ) {
816
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
815
+	protected function _verify_route($route) {
816
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
817 817
 			return true;
818 818
 		} else {
819 819
 			// user error msg
820
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
820
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
821 821
 			// developer error msg
822
-			$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 );
823
-			throw new EE_Error( $error_msg );
822
+			$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);
823
+			throw new EE_Error($error_msg);
824 824
 		}
825 825
 	}
826 826
 
@@ -834,18 +834,18 @@  discard block
 block discarded – undo
834 834
 	 * @param  string $nonce_ref The nonce reference string (name0)
835 835
 	 * @return mixed (bool|die)
836 836
 	 */
837
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
837
+	protected function _verify_nonce($nonce, $nonce_ref) {
838 838
 		// verify nonce against expected value
839
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
839
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
840 840
 			// these are not the droids you are looking for !!!
841
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
842
-			if ( WP_DEBUG ) {
843
-				$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__  );
841
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
842
+			if (WP_DEBUG) {
843
+				$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__);
844 844
 			}
845
-			if ( ! defined( 'DOING_AJAX' )) {
846
-				wp_die( $msg );
845
+			if ( ! defined('DOING_AJAX')) {
846
+				wp_die($msg);
847 847
 			} else {
848
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
848
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
849 849
 				$this->_return_json();
850 850
 			}
851 851
 		}
@@ -863,63 +863,63 @@  discard block
 block discarded – undo
863 863
 	 * @return void
864 864
 	 */
865 865
 	protected function _route_admin_request() {
866
-		if (  ! $this->_is_UI_request )
866
+		if ( ! $this->_is_UI_request)
867 867
 			$this->_verify_routes();
868 868
 
869
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
869
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
870 870
 
871
-		if ( $this->_req_action != 'default' && $nonce_check ) {
871
+		if ($this->_req_action != 'default' && $nonce_check) {
872 872
 			// set nonce from post data
873
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
874
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
873
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
874
+			$this->_verify_nonce($nonce, $this->_req_nonce);
875 875
 		}
876 876
 		//set the nav_tabs array but ONLY if this is  UI_request
877
-		if ( $this->_is_UI_request )
877
+		if ($this->_is_UI_request)
878 878
 			$this->_set_nav_tabs();
879 879
 
880 880
 		// grab callback function
881
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
881
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
882 882
 
883 883
 		// check if callback has args
884
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
884
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
885 885
 
886 886
 		$error_msg = '';
887 887
 
888 888
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
889
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
890
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
889
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
890
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
891 891
 		}
892 892
 
893 893
 		//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).
894
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
894
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
895 895
 
896
-		if ( ! empty( $func )) {
896
+		if ( ! empty($func)) {
897 897
 			$base_call = $addon_call = FALSE;
898 898
 			//try to access page route via this class
899
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
899
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
900 900
 				// user error msg
901
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
901
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
902 902
 				// developer error msg
903
-				$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 );
903
+				$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);
904 904
 			}
905 905
 
906 906
 			//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)
907 907
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
908 908
 
909
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
910
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
911
-				$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 );
909
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
910
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
911
+				$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);
912 912
 			}
913 913
 
914 914
 
915
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
916
-				throw new EE_Error( $error_msg );
915
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
916
+				throw new EE_Error($error_msg);
917 917
 		}
918 918
 
919 919
 		//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.
920 920
 		//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.
921
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
922
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
921
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
922
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
923 923
 		}
924 924
 	}
925 925
 
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 	 * @param  string    $new_route   New (non header) route to redirect to.
936 936
 	 * @return   void
937 937
 	 */
938
-	protected function _reset_routing_properties( $new_route ) {
938
+	protected function _reset_routing_properties($new_route) {
939 939
 		$this->_is_UI_request = TRUE;
940 940
 		//now we set the current route to whatever the headers_sent_route is set at
941 941
 		$this->_req_data['action'] = $new_route;
@@ -981,24 +981,24 @@  discard block
 block discarded – undo
981 981
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
982 982
 	 * 	@return string
983 983
 	 */
984
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
984
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
985 985
 		EE_Registry::instance()->load_helper('URL');
986 986
 
987 987
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
988
-		if ( $sticky ) {
988
+		if ($sticky) {
989 989
 			$request = $_REQUEST;
990
-			unset( $request['_wp_http_referer'] );
991
-			unset( $request['wp_referer'] );
992
-			foreach ( $request as $key => $value ) {
990
+			unset($request['_wp_http_referer']);
991
+			unset($request['wp_referer']);
992
+			foreach ($request as $key => $value) {
993 993
 				//do not add nonces
994
-				if ( strpos( $key, 'nonce' ) !== false ) {
994
+				if (strpos($key, 'nonce') !== false) {
995 995
 					continue;
996 996
 				}
997
-				$args['wp_referer[' . $key . ']'] = $value;
997
+				$args['wp_referer['.$key.']'] = $value;
998 998
 			}
999 999
 		}
1000 1000
 
1001
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1001
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1002 1002
 	}
1003 1003
 
1004 1004
 
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
 	 * @uses EEH_Template::get_help_tab_link()
1015 1015
 	 * @return string              generated link
1016 1016
 	 */
1017
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1018
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1017
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1018
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1019 1019
 	}
1020 1020
 
1021 1021
 
@@ -1032,30 +1032,30 @@  discard block
 block discarded – undo
1032 1032
 	 */
1033 1033
 	protected function _add_help_tabs() {
1034 1034
 		$tour_buttons = '';
1035
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1035
+		if (isset($this->_page_config[$this->_req_action])) {
1036 1036
 			$config = $this->_page_config[$this->_req_action];
1037 1037
 
1038 1038
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1039
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1039
+			if (isset($this->_help_tour[$this->_req_action])) {
1040 1040
 				$tb = array();
1041 1041
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1042
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1042
+				foreach ($this->_help_tour['tours'] as $tour) {
1043 1043
 					//if this is the end tour then we don't need to setup a button
1044
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1044
+					if ($tour instanceof EE_Help_Tour_final_stop)
1045 1045
 						continue;
1046
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1046
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1047 1047
 				}
1048 1048
 				$tour_buttons .= implode('<br />', $tb);
1049 1049
 				$tour_buttons .= '</div></div>';
1050 1050
 			}
1051 1051
 
1052 1052
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1053
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1053
+			if (is_array($config) && isset($config['help_sidebar'])) {
1054 1054
 				//check that the callback given is valid
1055
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1056
-					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) ) );
1055
+				if ( ! method_exists($this, $config['help_sidebar']))
1056
+					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)));
1057 1057
 
1058
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1058
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1059 1059
 
1060 1060
 				$content .= $tour_buttons; //add help tour buttons.
1061 1061
 
@@ -1064,49 +1064,49 @@  discard block
 block discarded – undo
1064 1064
 			}
1065 1065
 
1066 1066
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1067
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1067
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1068 1068
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1069 1069
 			}
1070 1070
 
1071 1071
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1072
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1072
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1073 1073
 				$_ht['id'] = $this->page_slug;
1074 1074
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1075
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1075
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1076 1076
 				$this->_current_screen->add_help_tab($_ht);
1077 1077
 				}/**/
1078 1078
 
1079 1079
 
1080
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1080
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1081 1081
 
1082
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1082
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1083 1083
 				//we're here so there ARE help tabs!
1084 1084
 
1085 1085
 				//make sure we've got what we need
1086
-				if ( !isset( $cfg['title'] ) )
1087
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1086
+				if ( ! isset($cfg['title']))
1087
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1088 1088
 
1089 1089
 
1090
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1091
-					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') );
1090
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1091
+					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'));
1092 1092
 
1093 1093
 
1094 1094
 
1095 1095
 				//first priority goes to content.
1096
-				if ( !empty($cfg['content'] ) ) {
1097
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1096
+				if ( ! empty($cfg['content'])) {
1097
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1098 1098
 
1099 1099
 				//second priority goes to filename
1100
-				} else if ( !empty($cfg['filename'] ) ) {
1101
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1100
+				} else if ( ! empty($cfg['filename'])) {
1101
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1102 1102
 
1103 1103
 
1104 1104
 					//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)
1105
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1105
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1106 1106
 
1107 1107
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1108
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1109
-						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__ );
1108
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1109
+						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__);
1110 1110
 						return;
1111 1111
 					}
1112 1112
 					$template_args['admin_page_obj'] = $this;
@@ -1117,21 +1117,21 @@  discard block
 block discarded – undo
1117 1117
 
1118 1118
 
1119 1119
 				//check if callback is valid
1120
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1121
-					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__ );
1120
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1121
+					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__);
1122 1122
 					return;
1123 1123
 				}
1124 1124
 
1125 1125
 				//setup config array for help tab method
1126
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1126
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1127 1127
 				$_ht = array(
1128 1128
 					'id' => $id,
1129 1129
 					'title' => $cfg['title'],
1130
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1130
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1131 1131
 					'content' => $content
1132 1132
 					);
1133 1133
 
1134
-				$this->_current_screen->add_help_tab( $_ht );
1134
+				$this->_current_screen->add_help_tab($_ht);
1135 1135
 			}
1136 1136
 		}
1137 1137
 	}
@@ -1151,49 +1151,49 @@  discard block
 block discarded – undo
1151 1151
 		$this->_help_tour = array();
1152 1152
 
1153 1153
 		//exit early if help tours are turned off globally
1154
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1154
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1155 1155
 			return;
1156 1156
 
1157 1157
 		//loop through _page_config to find any help_tour defined
1158
-		foreach ( $this->_page_config as $route => $config ) {
1158
+		foreach ($this->_page_config as $route => $config) {
1159 1159
 			//we're only going to set things up for this route
1160
-			if ( $route !== $this->_req_action )
1160
+			if ($route !== $this->_req_action)
1161 1161
 				continue;
1162 1162
 
1163
-			if ( isset( $config['help_tour'] ) ) {
1163
+			if (isset($config['help_tour'])) {
1164 1164
 
1165
-				foreach( $config['help_tour'] as $tour ) {
1166
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1165
+				foreach ($config['help_tour'] as $tour) {
1166
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1167 1167
 					//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
1168
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1168
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1169 1169
 
1170 1170
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1171
-					if ( !is_readable($file_path) ) {
1172
-						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__ );
1171
+					if ( ! is_readable($file_path)) {
1172
+						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__);
1173 1173
 						return;
1174 1174
 					}
1175 1175
 
1176 1176
 					require_once $file_path;
1177
-					if ( !class_exists( $tour ) ) {
1178
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1179
-						$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) );
1180
-						throw new EE_Error( implode( '||', $error_msg ));
1177
+					if ( ! class_exists($tour)) {
1178
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1179
+						$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));
1180
+						throw new EE_Error(implode('||', $error_msg));
1181 1181
 					}
1182 1182
 					$a = new ReflectionClass($tour);
1183 1183
 					$tour_obj = $a->newInstance($this->_is_caf);
1184 1184
 
1185 1185
 					$tours[] = $tour_obj;
1186
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1186
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1187 1187
 				}
1188 1188
 
1189 1189
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1190 1190
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1191 1191
 				$tours[] = $end_stop_tour;
1192
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1192
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1193 1193
 			}
1194 1194
 		}
1195 1195
 
1196
-		if ( !empty( $tours ) )
1196
+		if ( ! empty($tours))
1197 1197
 			$this->_help_tour['tours'] = $tours;
1198 1198
 
1199 1199
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1209,13 +1209,13 @@  discard block
 block discarded – undo
1209 1209
 	 * @return void
1210 1210
 	 */
1211 1211
 	protected function _add_qtips() {
1212
-		if ( isset( $this->_route_config['qtips'] ) ) {
1212
+		if (isset($this->_route_config['qtips'])) {
1213 1213
 			$qtips = (array) $this->_route_config['qtips'];
1214 1214
 			//load qtip loader
1215 1215
 			EE_Registry::instance()->load_helper('Qtip_Loader', array(), TRUE);
1216 1216
 			$path = array(
1217
-				$this->_get_dir() . '/qtips/',
1218
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1217
+				$this->_get_dir().'/qtips/',
1218
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1219 1219
 				);
1220 1220
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1221 1221
 		}
@@ -1232,41 +1232,41 @@  discard block
 block discarded – undo
1232 1232
 	 * @return void
1233 1233
 	 */
1234 1234
 	protected function _set_nav_tabs() {
1235
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1235
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1236 1236
 		$i = 0;
1237
-		foreach ( $this->_page_config as $slug => $config ) {
1238
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1237
+		foreach ($this->_page_config as $slug => $config) {
1238
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1239 1239
 				continue; //no nav tab for this config
1240 1240
 
1241 1241
 			//check for persistent flag
1242
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1242
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1243 1243
 				continue; //nav tab is only to appear when route requested.
1244 1244
 
1245
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1245
+			if ( ! $this->check_user_access($slug, TRUE))
1246 1246
 				continue; //no nav tab becasue current user does not have access.
1247 1247
 
1248
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1248
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1249 1249
 			$this->_nav_tabs[$slug] = array(
1250
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1251
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1252
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1253
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1250
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1251
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1252
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1253
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1254 1254
 				);
1255 1255
 			$i++;
1256 1256
 		}
1257 1257
 
1258 1258
 		//if $this->_nav_tabs is empty then lets set the default
1259
-		if ( empty( $this->_nav_tabs ) ) {
1259
+		if (empty($this->_nav_tabs)) {
1260 1260
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1261 1261
 				'url' => $this->admin_base_url,
1262
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1262
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1263 1263
 				'css_class' => 'nav-tab-active',
1264 1264
 				'order' => 10
1265 1265
 				);
1266 1266
 		}
1267 1267
 
1268 1268
 		//now let's sort the tabs according to order
1269
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1269
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1270 1270
 
1271 1271
 	}
1272 1272
 
@@ -1282,10 +1282,10 @@  discard block
 block discarded – undo
1282 1282
 	 * @return void
1283 1283
 	 */
1284 1284
 	private function _set_current_labels() {
1285
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1286
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1287
-				if ( is_array($text) ) {
1288
-					foreach ( $text as $sublabel => $subtext ) {
1285
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1286
+			foreach ($this->_route_config['labels'] as $label => $text) {
1287
+				if (is_array($text)) {
1288
+					foreach ($text as $sublabel => $subtext) {
1289 1289
 						$this->_labels[$label][$sublabel] = $subtext;
1290 1290
 					}
1291 1291
 				} else {
@@ -1306,24 +1306,24 @@  discard block
 block discarded – undo
1306 1306
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1307 1307
 	*		@return 		BOOL|wp_die()
1308 1308
 	*/
1309
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1310
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1311
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1312
-		$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;
1309
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1310
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1311
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1312
+		$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;
1313 1313
 
1314
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1315
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1314
+		if (empty($capability) && empty($route_to_check)) {
1315
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1316 1316
 		} else {
1317
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1317
+			$capability = empty($capability) ? 'manage_options' : $capability;
1318 1318
 		}
1319 1319
 
1320
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1320
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1321 1321
 
1322
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1323
-			if ( $verify_only ) {
1322
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1323
+			if ($verify_only) {
1324 1324
 				return FALSE;
1325 1325
 			} else {
1326
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1326
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1327 1327
 			}
1328 1328
 		}
1329 1329
 		return TRUE;
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 		$this->_add_admin_page_overlay();
1401 1401
 
1402 1402
 		//if metaboxes are present we need to add the nonce field
1403
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1403
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1404 1404
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1405 1405
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1406 1406
 		}
@@ -1419,20 +1419,20 @@  discard block
 block discarded – undo
1419 1419
 	 */
1420 1420
 	public function admin_footer_global() {
1421 1421
 		//dialog container for dialog helper
1422
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1422
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1423 1423
 		$d_cont .= '<div class="ee-notices"></div>';
1424 1424
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1425 1425
 		$d_cont .= '</div>';
1426 1426
 		echo $d_cont;
1427 1427
 
1428 1428
 		//help tour stuff?
1429
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1429
+		if (isset($this->_help_tour[$this->_req_action])) {
1430 1430
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1431 1431
 		}
1432 1432
 
1433 1433
 		//current set timezone for timezone js
1434 1434
 		EE_Registry::instance()->load_helper('DTT_Helper');
1435
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1435
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1436 1436
 	}
1437 1437
 
1438 1438
 
@@ -1456,18 +1456,18 @@  discard block
 block discarded – undo
1456 1456
 	 * @access protected
1457 1457
 	 * @return string content
1458 1458
 	 */
1459
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1459
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1460 1460
 		$content = '';
1461 1461
 
1462
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1463
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1462
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1463
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1464 1464
 
1465 1465
 
1466 1466
 		//loop through the array and setup content
1467
-		foreach ( $help_array as $trigger => $help ) {
1467
+		foreach ($help_array as $trigger => $help) {
1468 1468
 			//make sure the array is setup properly
1469
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1470
-				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') );
1469
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1470
+				throw new EE_Error(__('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso'));
1471 1471
 			}
1472 1472
 
1473 1473
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1477,10 +1477,10 @@  discard block
 block discarded – undo
1477 1477
 				'help_popup_content' => $help['content']
1478 1478
 				);
1479 1479
 
1480
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1480
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1481 1481
 		}
1482 1482
 
1483
-		if ( $display )
1483
+		if ($display)
1484 1484
 			echo $content;
1485 1485
 		else
1486 1486
 			return $content;
@@ -1497,18 +1497,18 @@  discard block
 block discarded – undo
1497 1497
 	 */
1498 1498
 	private function _get_help_content() {
1499 1499
 		//what is the method we're looking for?
1500
-		$method_name = '_help_popup_content_' . $this->_req_action;
1500
+		$method_name = '_help_popup_content_'.$this->_req_action;
1501 1501
 
1502 1502
 		//if method doesn't exist let's get out.
1503
-		if ( !method_exists( $this, $method_name ) )
1503
+		if ( ! method_exists($this, $method_name))
1504 1504
 			return array();
1505 1505
 
1506 1506
 		//k we're good to go let's retrieve the help array
1507
-		$help_array = call_user_func( array( $this, $method_name ) );
1507
+		$help_array = call_user_func(array($this, $method_name));
1508 1508
 
1509 1509
 		//make sure we've got an array!
1510
-		if ( !is_array($help_array) ) {
1511
-			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' ) );
1510
+		if ( ! is_array($help_array)) {
1511
+			throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso'));
1512 1512
 		}
1513 1513
 
1514 1514
 		return $help_array;
@@ -1530,27 +1530,27 @@  discard block
 block discarded – undo
1530 1530
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1531 1531
 	 * @return string
1532 1532
 	 */
1533
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1533
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1534 1534
 
1535
-		if ( defined('DOING_AJAX') ) return;
1535
+		if (defined('DOING_AJAX')) return;
1536 1536
 
1537 1537
 		//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
1538 1538
 		$help_array = $this->_get_help_content();
1539 1539
 		$help_content = '';
1540 1540
 
1541
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1541
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1542 1542
 			$help_array[$trigger_id] = array(
1543 1543
 				'title' => __('Missing Content', 'event_espresso'),
1544 1544
 				'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')
1545 1545
 				);
1546
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1546
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1547 1547
 		}
1548 1548
 
1549 1549
 		//let's setup the trigger
1550
-		$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>';
1551
-		$content = $content . $help_content;
1550
+		$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>';
1551
+		$content = $content.$help_content;
1552 1552
 
1553
-		if ( $display )
1553
+		if ($display)
1554 1554
 			echo $content;
1555 1555
 		else
1556 1556
 			return $content;
@@ -1607,15 +1607,15 @@  discard block
 block discarded – undo
1607 1607
 	public function load_global_scripts_styles() {
1608 1608
 		/** STYLES **/
1609 1609
 		// add debugging styles
1610
-		if ( WP_DEBUG ) {
1611
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1610
+		if (WP_DEBUG) {
1611
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1612 1612
 		}
1613 1613
 
1614 1614
 		//register all styles
1615
-		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 );
1616
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1615
+		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);
1616
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1617 1617
 		//helpers styles
1618
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1618
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1619 1619
 		//enqueue global styles
1620 1620
 		wp_enqueue_style('ee-admin-css');
1621 1621
 
@@ -1623,66 +1623,66 @@  discard block
 block discarded – undo
1623 1623
 		/** SCRIPTS **/
1624 1624
 
1625 1625
 		//register all scripts
1626
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1627
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1628
-		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 );
1626
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1627
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1628
+		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);
1629 1629
 
1630
-		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 );
1630
+		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);
1631 1631
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1632
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1632
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1633 1633
 		add_filter('FHEE_load_joyride', '__return_true');
1634 1634
 
1635 1635
 		//script for sorting tables
1636
-		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);
1636
+		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);
1637 1637
 		//script for parsing uri's
1638
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1638
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1639 1639
 		//and parsing associative serialized form elements
1640
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1640
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1641 1641
 		//helpers scripts
1642
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1643
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1644
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1645
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1642
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1643
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1644
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1645
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1646 1646
 
1647 1647
 		//google charts
1648
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1648
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1649 1649
 
1650 1650
 		//enqueue global scripts
1651 1651
 
1652 1652
 		//taking care of metaboxes
1653
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1653
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1654 1654
 			wp_enqueue_script('dashboard');
1655 1655
 		}
1656 1656
 
1657 1657
 		//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
1658
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1658
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1659 1659
 			wp_enqueue_script('ee_admin_js');
1660 1660
 			wp_enqueue_style('ee-admin-css');
1661 1661
 		}
1662 1662
 
1663 1663
 
1664 1664
 		//localize script for ajax lazy loading
1665
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1666
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1665
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1666
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1667 1667
 
1668 1668
 
1669 1669
 		/**
1670 1670
 		 * help tour stuff
1671 1671
 		 */
1672
-		if ( !empty( $this->_help_tour ) ) {
1672
+		if ( ! empty($this->_help_tour)) {
1673 1673
 
1674 1674
 			//register the js for kicking things off
1675
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1675
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1676 1676
 
1677 1677
 			//setup tours for the js tour object
1678
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1678
+			foreach ($this->_help_tour['tours'] as $tour) {
1679 1679
 				$tours[] = array(
1680 1680
 					'id' => $tour->get_slug(),
1681 1681
 					'options' => $tour->get_options()
1682 1682
 					);
1683 1683
 			}
1684 1684
 
1685
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1685
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1686 1686
 
1687 1687
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1688 1688
 		}
@@ -1700,52 +1700,52 @@  discard block
 block discarded – undo
1700 1700
 	public function admin_footer_scripts_eei18n_js_strings() {
1701 1701
 
1702 1702
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1703
-		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' );
1704
-
1705
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1706
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1707
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1708
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1709
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1710
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1711
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1729
-
1730
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1703
+		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');
1704
+
1705
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1706
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1707
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1708
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1709
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1710
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1711
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1729
+
1730
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1744 1744
 
1745 1745
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1746 1746
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1747 1747
 		//espresso_core is listed as a dependency of ee_admin_js.
1748
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1748
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1749 1749
 
1750 1750
 	}
1751 1751
 
@@ -1779,23 +1779,23 @@  discard block
 block discarded – undo
1779 1779
 	protected function _set_list_table() {
1780 1780
 
1781 1781
 		//first is this a list_table view?
1782
-		if ( !isset($this->_route_config['list_table']) )
1782
+		if ( ! isset($this->_route_config['list_table']))
1783 1783
 			return; //not a list_table view so get out.
1784 1784
 
1785 1785
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1786 1786
 
1787
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1787
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1788 1788
 			//user error msg
1789
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1789
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1790 1790
 			//developer error msg
1791
-			$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 );
1792
-			throw new EE_Error( $error_msg );
1791
+			$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);
1792
+			throw new EE_Error($error_msg);
1793 1793
 		}
1794 1794
 
1795 1795
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1796
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1797
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1798
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1796
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1797
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1798
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1799 1799
 
1800 1800
 		$this->_set_list_table_view();
1801 1801
 		$this->_set_list_table_object();
@@ -1817,14 +1817,14 @@  discard block
 block discarded – undo
1817 1817
 	*		@return array
1818 1818
 	*/
1819 1819
 	protected function _set_list_table_view() {
1820
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1820
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1821 1821
 
1822 1822
 
1823 1823
 		// looking at active items or dumpster diving ?
1824
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1825
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1824
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1825
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1826 1826
 		} else {
1827
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1827
+			$this->_view = sanitize_key($this->_req_data['status']);
1828 1828
 		}
1829 1829
 	}
1830 1830
 
@@ -1835,9 +1835,9 @@  discard block
 block discarded – undo
1835 1835
 	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1836 1836
 	 */
1837 1837
 	protected function _set_list_table_object() {
1838
-		if ( isset($this->_route_config['list_table'] ) ) {
1839
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1840
-				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) ) );
1838
+		if (isset($this->_route_config['list_table'])) {
1839
+			if ( ! class_exists($this->_route_config['list_table']))
1840
+				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)));
1841 1841
 			$a = new ReflectionClass($this->_route_config['list_table']);
1842 1842
 			$this->_list_table_object = $a->newInstance($this);
1843 1843
 		}
@@ -1856,27 +1856,27 @@  discard block
 block discarded – undo
1856 1856
 	 *
1857 1857
 	 * @return array
1858 1858
 	 */
1859
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1859
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1860 1860
 
1861
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1861
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1862 1862
 
1863
-		if ( empty( $this->_views )) {
1863
+		if (empty($this->_views)) {
1864 1864
 			$this->_views = array();
1865 1865
 		}
1866 1866
 
1867 1867
 		// cycle thru views
1868
-		foreach ( $this->_views as $key => $view ) {
1868
+		foreach ($this->_views as $key => $view) {
1869 1869
 			$query_args = array();
1870 1870
 			// check for current view
1871
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1871
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1872 1872
 			$query_args['action'] = $this->_req_action;
1873
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1873
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1874 1874
 			$query_args['status'] = $view['slug'];
1875 1875
 			//merge any other arguments sent in.
1876
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1877
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1876
+			if (isset($extra_query_args[$view['slug']])) {
1877
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1878 1878
 			}
1879
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1879
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1880 1880
 		}
1881 1881
 
1882 1882
 		return $this->_views;
@@ -1893,15 +1893,15 @@  discard block
 block discarded – undo
1893 1893
 	 * @param int $max_entries total number of rows in the table
1894 1894
 	 * @return string
1895 1895
 	*/
1896
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1896
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1897 1897
 
1898
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1899
-		$values = array( 10, 25, 50, 100 );
1900
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1898
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1899
+		$values = array(10, 25, 50, 100);
1900
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1901 1901
 
1902
-		if ( $max_entries ) {
1902
+		if ($max_entries) {
1903 1903
 			$values[] = $max_entries;
1904
-			sort( $values );
1904
+			sort($values);
1905 1905
 		}
1906 1906
 
1907 1907
 		$entries_per_page_dropdown = '
@@ -1910,15 +1910,15 @@  discard block
 block discarded – undo
1910 1910
 					Show
1911 1911
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1912 1912
 
1913
-		foreach ( $values as $value ) {
1914
-			if ( $value < $max_entries ) {
1915
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1913
+		foreach ($values as $value) {
1914
+			if ($value < $max_entries) {
1915
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1916 1916
 				$entries_per_page_dropdown .= '
1917 1917
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1918 1918
 			}
1919 1919
 		}
1920 1920
 
1921
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1921
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1922 1922
 		$entries_per_page_dropdown .= '
1923 1923
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1924 1924
 
@@ -1941,8 +1941,8 @@  discard block
 block discarded – undo
1941 1941
 	*		@return 		void
1942 1942
 	*/
1943 1943
 	public function _set_search_attributes() {
1944
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1945
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1944
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1945
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1946 1946
 	}
1947 1947
 
1948 1948
 	/*** END LIST TABLE METHODS **/
@@ -1961,20 +1961,20 @@  discard block
 block discarded – undo
1961 1961
 	 * @return void
1962 1962
 	*/
1963 1963
 	private function _add_registered_meta_boxes() {
1964
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1964
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1965 1965
 
1966 1966
 		//we only add meta boxes if the page_route calls for it
1967
-		if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) {
1967
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) {
1968 1968
 
1969 1969
 
1970 1970
 			//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.
1971
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1972
-				if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) {
1971
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1972
+				if (call_user_func(array($this, &$metabox_callback)) === FALSE) {
1973 1973
 					// user error msg
1974
-				$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
1974
+				$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
1975 1975
 				// developer error msg
1976
-				$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 );
1977
-				throw new EE_Error( $error_msg );
1976
+				$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);
1977
+				throw new EE_Error($error_msg);
1978 1978
 				}
1979 1979
 			}
1980 1980
 		}
@@ -1991,17 +1991,17 @@  discard block
 block discarded – undo
1991 1991
 	 * @return void
1992 1992
 	 */
1993 1993
 	private function _add_screen_columns() {
1994
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
1994
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
1995 1995
 
1996
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
1996
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
1997 1997
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
1998 1998
 			$screen_id = $this->_current_screen->id;
1999 1999
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2000
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2001
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2000
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2001
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2002 2002
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2003 2003
 			$this->_template_args['screen'] = $this->_current_screen;
2004
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2004
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2005 2005
 
2006 2006
 			//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.
2007 2007
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2018,11 +2018,11 @@  discard block
 block discarded – undo
2018 2018
 	 */
2019 2019
 
2020 2020
 	private function _espresso_news_post_box() {
2021
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2022
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2021
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2022
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2023 2023
 			$this,
2024 2024
 			'espresso_news_post_box'
2025
-		), $this->_wp_page_slug, 'side' );
2025
+		), $this->_wp_page_slug, 'side');
2026 2026
 	}
2027 2027
 
2028 2028
 
@@ -2030,14 +2030,14 @@  discard block
 block discarded – undo
2030 2030
 	 * Code for setting up espresso ratings request metabox.
2031 2031
 	 */
2032 2032
 	protected function _espresso_ratings_request() {
2033
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2033
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2034 2034
 			return '';
2035 2035
 		}
2036
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2037
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2036
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2037
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2038 2038
 			$this,
2039 2039
 			'espresso_ratings_request'
2040
-		), $this->_wp_page_slug, 'side' );
2040
+		), $this->_wp_page_slug, 'side');
2041 2041
 	}
2042 2042
 
2043 2043
 
@@ -2045,35 +2045,35 @@  discard block
 block discarded – undo
2045 2045
 	 * Code for setting up espresso ratings request metabox content.
2046 2046
 	 */
2047 2047
 	public function espresso_ratings_request() {
2048
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2049
-		EE_Registry::instance()->load_helper( 'Template' );
2050
-		EEH_Template::display_template( $template_path, array() );
2048
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2049
+		EE_Registry::instance()->load_helper('Template');
2050
+		EEH_Template::display_template($template_path, array());
2051 2051
 	}
2052 2052
 
2053 2053
 
2054 2054
 
2055 2055
 
2056
-	public static function cached_rss_display( $rss_id, $url ) {
2057
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2058
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2059
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2060
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2061
-		$post = '</div>' . "\n";
2056
+	public static function cached_rss_display($rss_id, $url) {
2057
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2058
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2059
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2060
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2061
+		$post = '</div>'."\n";
2062 2062
 
2063
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2064
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2065
-			echo $pre . $output . $post;
2063
+		$cache_key = 'ee_rss_'.md5($rss_id);
2064
+		if (FALSE != ($output = get_transient($cache_key))) {
2065
+			echo $pre.$output.$post;
2066 2066
 			return TRUE;
2067 2067
 		}
2068 2068
 
2069
-		if ( ! $doing_ajax ) {
2070
-			echo $pre . $loading . $post;
2069
+		if ( ! $doing_ajax) {
2070
+			echo $pre.$loading.$post;
2071 2071
 			return FALSE;
2072 2072
 		}
2073 2073
 
2074 2074
 		ob_start();
2075
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2076
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2075
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2076
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2077 2077
 		return TRUE;
2078 2078
 
2079 2079
 	}
@@ -2085,13 +2085,13 @@  discard block
 block discarded – undo
2085 2085
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2086 2086
 	  		<?php
2087 2087
 	  		// Get RSS Feed(s)
2088
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2088
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2089 2089
 	  		$url = urlencode($feed_url);
2090
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2090
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2091 2091
 
2092 2092
 	  		?>
2093 2093
 	  	</div>
2094
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2094
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2095 2095
 	  </div>
2096 2096
 		<?php
2097 2097
 	}
@@ -2112,32 +2112,32 @@  discard block
 block discarded – undo
2112 2112
 
2113 2113
 	protected function _espresso_sponsors_post_box() {
2114 2114
 
2115
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2116
-		if ( $show_sponsors )
2117
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2115
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2116
+		if ($show_sponsors)
2117
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2118 2118
 	}
2119 2119
 
2120 2120
 
2121 2121
 	public function espresso_sponsors_post_box() {
2122
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2123
-		EEH_Template::display_template( $templatepath );
2122
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2123
+		EEH_Template::display_template($templatepath);
2124 2124
 	}
2125 2125
 
2126 2126
 
2127 2127
 
2128 2128
 	private function _publish_post_box() {
2129
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2129
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2130 2130
 
2131 2131
 		//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)
2132
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2133
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2132
+		if ( ! empty($this->_labels['publishbox'])) {
2133
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2134 2134
 		} else {
2135 2135
 			$box_label = __('Publish', 'event_espresso');
2136 2136
 		}
2137 2137
 
2138
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2138
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2139 2139
 
2140
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2140
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2141 2141
 
2142 2142
 	}
2143 2143
 
@@ -2145,9 +2145,9 @@  discard block
 block discarded – undo
2145 2145
 
2146 2146
 	public function editor_overview() {
2147 2147
 		//if we have extra content set let's add it in if not make sure its empty
2148
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2149
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2150
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2148
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2149
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2150
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2151 2151
 	}
2152 2152
 
2153 2153
 
@@ -2163,8 +2163,8 @@  discard block
 block discarded – undo
2163 2163
 	 * @see $this->_set_publish_post_box_vars for param details
2164 2164
 	 * @since 4.6.0
2165 2165
 	 */
2166
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2167
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2166
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2167
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2168 2168
 	}
2169 2169
 
2170 2170
 
@@ -2183,24 +2183,24 @@  discard block
 block discarded – undo
2183 2183
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2184 2184
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2185 2185
 	 */
2186
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2186
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2187 2187
 
2188 2188
 		// if Save & Close, use a custom redirect URL or default to the main page?
2189
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2189
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2190 2190
 		// create the Save & Close and Save buttons
2191
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2191
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2192 2192
 		//if we have extra content set let's add it in if not make sure its empty
2193
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2193
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2194 2194
 
2195 2195
 
2196
-		if ( $delete && ! empty( $id )  ) {
2196
+		if ($delete && ! empty($id)) {
2197 2197
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2198
-			$delete_link_args = array( $name => $id );
2199
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2198
+			$delete_link_args = array($name => $id);
2199
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2200 2200
 		}
2201 2201
 
2202
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2203
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2202
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2203
+		if ( ! empty($name) && ! empty($id)) {
2204 2204
 			$hidden_field_arr[$name] = array(
2205 2205
 				'type' => 'hidden',
2206 2206
 				'value' => $id
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
 			$hf = '';
2211 2211
 		}
2212 2212
 		// add hidden field
2213
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2213
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2214 2214
 
2215 2215
 	}
2216 2216
 
@@ -2227,8 +2227,8 @@  discard block
 block discarded – undo
2227 2227
 		<noscript>
2228 2228
 			<div id="no-js-message" class="error">
2229 2229
 				<p style="font-size:1.3em;">
2230
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2231
-					<?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' ); ?>
2230
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2231
+					<?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'); ?>
2232 2232
 				</p>
2233 2233
 			</div>
2234 2234
 		</noscript>
@@ -2248,7 +2248,7 @@  discard block
 block discarded – undo
2248 2248
 	*		@return 		string
2249 2249
 	*/
2250 2250
 	private function _display_espresso_notices() {
2251
-		$notices = $this->_get_transient( TRUE );
2251
+		$notices = $this->_get_transient(TRUE);
2252 2252
 		echo stripslashes($notices);
2253 2253
 	}
2254 2254
 
@@ -2300,11 +2300,11 @@  discard block
 block discarded – undo
2300 2300
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2301 2301
 	 * @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.
2302 2302
 	 */
2303
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2304
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2303
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2304
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2305 2305
 
2306 2306
 		//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.
2307
-		if ( empty( $callback_args ) && $create_func ) {
2307
+		if (empty($callback_args) && $create_func) {
2308 2308
 			$callback_args = array(
2309 2309
 				'template_path' => $this->_template_path,
2310 2310
 				'template_args' => $this->_template_args,
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
 		//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)
2315 2315
 		$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;
2316 2316
 
2317
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2317
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2318 2318
 	}
2319 2319
 
2320 2320
 
@@ -2327,7 +2327,7 @@  discard block
 block discarded – undo
2327 2327
 	 */
2328 2328
 	public function display_admin_page_with_metabox_columns() {
2329 2329
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2330
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2330
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2331 2331
 
2332 2332
 		//the final wrapper
2333 2333
 		$this->admin_page_wrapper();
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
 	 * @return void
2371 2371
 	 */
2372 2372
 	public function display_about_admin_page() {
2373
-		$this->_display_admin_page( FALSE, TRUE );
2373
+		$this->_display_admin_page(FALSE, TRUE);
2374 2374
 	}
2375 2375
 
2376 2376
 
@@ -2386,26 +2386,26 @@  discard block
 block discarded – undo
2386 2386
 	 * @return html           admin_page
2387 2387
 	 */
2388 2388
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2389
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2389
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2390 2390
 
2391 2391
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2392
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2392
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2393 2393
 
2394 2394
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2395 2395
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2396 2396
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2397 2397
 
2398
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2398
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2399 2399
 
2400
-		if ( defined('DOING_AJAX' ) )
2401
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2400
+		if (defined('DOING_AJAX'))
2401
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2402 2402
 
2403
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2403
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2404 2404
 
2405
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2405
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2406 2406
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2407 2407
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2408
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2408
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2409 2409
 
2410 2410
 
2411 2411
 		// the final template wrapper
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
 	 * @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.
2426 2426
 	 * @return void
2427 2427
 	 */
2428
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2428
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2429 2429
 		//let's generate a default preview action button if there isn't one already present.
2430 2430
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2431 2431
 		$buy_now_url = add_query_arg(
@@ -2438,10 +2438,10 @@  discard block
 block discarded – undo
2438 2438
 			),
2439 2439
 		'http://eventespresso.com/pricing/'
2440 2440
 		);
2441
-		$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'];
2442
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2443
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2444
-		$this->_display_admin_page( $display_sidebar );
2441
+		$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'];
2442
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2443
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2444
+		$this->_display_admin_page($display_sidebar);
2445 2445
 	}
2446 2446
 
2447 2447
 
@@ -2475,41 +2475,41 @@  discard block
 block discarded – undo
2475 2475
 	 * @param boolean $sidebar whether to display with sidebar or not.
2476 2476
 	 * @return html
2477 2477
 	 */
2478
-	private function _display_admin_list_table_page( $sidebar = false ) {
2478
+	private function _display_admin_list_table_page($sidebar = false) {
2479 2479
 		//setup search attributes
2480 2480
 		$this->_set_search_attributes();
2481 2481
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2482
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2482
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2483 2483
 
2484
-		$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);
2484
+		$this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2485 2485
 		$this->_template_args['list_table'] = $this->_list_table_object;
2486 2486
 		$this->_template_args['current_route'] = $this->_req_action;
2487
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2487
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2488 2488
 
2489 2489
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2490
-		if( ! empty( $ajax_sorting_callback )) {
2491
-			$sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE );
2490
+		if ( ! empty($ajax_sorting_callback)) {
2491
+			$sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE);
2492 2492
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2493 2493
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2494
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2495
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2494
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2495
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2496 2496
 		} else {
2497 2497
 			$sortable_list_table_form_fields = '';
2498 2498
 		}
2499 2499
 
2500 2500
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2501
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2502
-		$nonce_ref = $this->_req_action . '_nonce';
2503
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2501
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2502
+		$nonce_ref = $this->_req_action.'_nonce';
2503
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2504 2504
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2505 2505
 
2506 2506
 		//display message about search results?
2507
-		$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 );
2507
+		$this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action);
2508 2508
 
2509
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2509
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2510 2510
 
2511 2511
 		// the final template wrapper
2512
-		if ( $sidebar )
2512
+		if ($sidebar)
2513 2513
 			$this->display_admin_page_with_sidebar();
2514 2514
 		else
2515 2515
 			$this->display_admin_page_with_no_sidebar();
@@ -2532,9 +2532,9 @@  discard block
 block discarded – undo
2532 2532
 	 * @param  array $items  see above for format of array
2533 2533
 	 * @return string        html string of legend
2534 2534
 	 */
2535
-	protected function _display_legend( $items ) {
2536
-		$template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2537
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2535
+	protected function _display_legend($items) {
2536
+		$template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2537
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2538 2538
 		return EEH_Template::display_template($legend_template, $template_args, TRUE);
2539 2539
 	}
2540 2540
 
@@ -2559,31 +2559,31 @@  discard block
 block discarded – undo
2559 2559
 	 *
2560 2560
 	 * @return json object
2561 2561
 	 */
2562
-	protected function _return_json( $sticky_notices = FALSE ) {
2562
+	protected function _return_json($sticky_notices = FALSE) {
2563 2563
 
2564 2564
 		//make sure any EE_Error notices have been handled.
2565
-		$this->_process_notices( array(), true, $sticky_notices );
2565
+		$this->_process_notices(array(), true, $sticky_notices);
2566 2566
 
2567 2567
 
2568
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2568
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2569 2569
 		unset($this->_template_args['data']);
2570 2570
 		$json = array(
2571
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : FALSE,
2572
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : FALSE,
2571
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : FALSE,
2572
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : FALSE,
2573 2573
 			'notices' => EE_Error::get_notices(),
2574
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2575
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2574
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2575
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2576 2576
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2577 2577
 			);
2578 2578
 
2579 2579
 
2580 2580
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2581
-		if ( NULL === error_get_last() || ! headers_sent() )
2581
+		if (NULL === error_get_last() || ! headers_sent())
2582 2582
 			header('Content-Type: application/json; charset=UTF-8');
2583
-                if( function_exists( 'wp_json_encode' ) ) {
2584
-                    echo wp_json_encode( $json );
2583
+                if (function_exists('wp_json_encode')) {
2584
+                    echo wp_json_encode($json);
2585 2585
                 } else {
2586
-                    echo json_encode( $json );
2586
+                    echo json_encode($json);
2587 2587
                 }
2588 2588
 		exit();
2589 2589
 	}
@@ -2595,11 +2595,11 @@  discard block
 block discarded – undo
2595 2595
 	 * @return json_obj|EE_Error
2596 2596
 	 */
2597 2597
 	public function return_json() {
2598
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2598
+		if (defined('DOING_AJAX') && DOING_AJAX)
2599 2599
 			$this->_return_json();
2600 2600
 
2601 2601
 		else {
2602
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2602
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2603 2603
 		}
2604 2604
 	}
2605 2605
 
@@ -2614,7 +2614,7 @@  discard block
 block discarded – undo
2614 2614
 	 * @access public
2615 2615
 	 * @return void
2616 2616
 	 */
2617
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2617
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2618 2618
 		$this->_hook_obj = $hook_obj;
2619 2619
 	}
2620 2620
 
@@ -2630,33 +2630,33 @@  discard block
 block discarded – undo
2630 2630
 	*/
2631 2631
 	public function admin_page_wrapper($about = FALSE) {
2632 2632
 
2633
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2633
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2634 2634
 
2635 2635
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2636 2636
 
2637 2637
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2638 2638
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2639 2639
 
2640
-		$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'] : '');
2641
-		$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'] : '');
2640
+		$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'] : '');
2641
+		$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'] : '');
2642 2642
 
2643 2643
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2644 2644
 
2645 2645
 
2646 2646
 
2647 2647
 		// load settings page wrapper template
2648
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2648
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2649 2649
 
2650 2650
 		//about page?
2651
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2651
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2652 2652
 
2653 2653
 
2654
-		if ( defined( 'DOING_AJAX' ) ) {
2655
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2654
+		if (defined('DOING_AJAX')) {
2655
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2656 2656
 
2657 2657
 			$this->_return_json();
2658 2658
 		} else {
2659
-			EEH_Template::display_template( $template_path, $this->_template_args );
2659
+			EEH_Template::display_template($template_path, $this->_template_args);
2660 2660
 		}
2661 2661
 
2662 2662
 	}
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 	 */
2670 2670
 	protected function _get_main_nav_tabs() {
2671 2671
 		//let's generate the html using the EEH_Tabbed_Content helper.  We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute (rather than setting in the page_routes array)
2672
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
2672
+		EE_Registry::instance()->load_helper('Tabbed_Content');
2673 2673
 		return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs);
2674 2674
 	}
2675 2675
 
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
 	*		@access public
2686 2686
 	*		@return void
2687 2687
 	*/
2688
-	private function _sort_nav_tabs( $a, $b ) {
2688
+	private function _sort_nav_tabs($a, $b) {
2689 2689
 		if ($a['order'] == $b['order']) {
2690 2690
 	        return 0;
2691 2691
 	    }
@@ -2706,8 +2706,8 @@  discard block
 block discarded – undo
2706 2706
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2707 2707
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2708 2708
 	 */
2709
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2710
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2709
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2710
+		EE_Registry::instance()->load_helper('Form_Fields');
2711 2711
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2712 2712
 		return $content;
2713 2713
 	}
@@ -2729,25 +2729,25 @@  discard block
 block discarded – undo
2729 2729
 	 * @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.
2730 2730
 	 * @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).
2731 2731
 	 */
2732
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2732
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2733 2733
 		//make sure $text and $actions are in an array
2734 2734
 		$text = (array) $text;
2735 2735
 		$actions = (array) $actions;
2736 2736
 		$referrer_url = empty($referrer) ? '' : $referrer;
2737
-		$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 .'" />';
2737
+		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />';
2738 2738
 
2739
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2740
-		$default_names = array( 'save', 'save_and_close' );
2739
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2740
+		$default_names = array('save', 'save_and_close');
2741 2741
 
2742 2742
 		//add in a hidden index for the current page (so save and close redirects properly)
2743 2743
 		$this->_template_args['save_buttons'] = $referrer_url;
2744 2744
 
2745
-		foreach ( $button_text as $key => $button ) {
2745
+		foreach ($button_text as $key => $button) {
2746 2746
 			$ref = $default_names[$key];
2747
-			$id = $this->_current_view . '_' . $ref;
2748
-			$name = !empty($actions) ? $actions[$key] : $ref;
2749
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2750
-			if ( !$both ) break;
2747
+			$id = $this->_current_view.'_'.$ref;
2748
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2749
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2750
+			if ( ! $both) break;
2751 2751
 		}
2752 2752
 
2753 2753
 	}
@@ -2760,8 +2760,8 @@  discard block
 block discarded – undo
2760 2760
 	 * @since 4.6.0
2761 2761
 	 *
2762 2762
 	 */
2763
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2764
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2763
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2764
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2765 2765
 	}
2766 2766
 
2767 2767
 
@@ -2774,30 +2774,30 @@  discard block
 block discarded – undo
2774 2774
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2775 2775
 	 * @return void
2776 2776
 	 */
2777
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2777
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2778 2778
 
2779
-		if ( empty( $route )) {
2779
+		if (empty($route)) {
2780 2780
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2781
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2782
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2781
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2782
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2783 2783
 		}
2784 2784
 		// open form
2785
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2785
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2786 2786
 		// add nonce
2787
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2787
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2788 2788
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2789
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2789
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2790 2790
 		// add REQUIRED form action
2791 2791
 		$hidden_fields = array(
2792
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2792
+				'action' => array('type' => 'hidden', 'value' => $route),
2793 2793
 			);
2794 2794
 		// merge arrays
2795
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2795
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2796 2796
 		// generate form fields
2797
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2797
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2798 2798
 		// add fields to form
2799
-		foreach ( $form_fields as $field_name => $form_field ) {
2800
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2799
+		foreach ($form_fields as $field_name => $form_field) {
2800
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2801 2801
 		}
2802 2802
 
2803 2803
 		// close form
@@ -2814,8 +2814,8 @@  discard block
 block discarded – undo
2814 2814
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2815 2815
 	 * @since 4.5.0
2816 2816
 	 */
2817
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2818
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2817
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2818
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2819 2819
 	}
2820 2820
 
2821 2821
 
@@ -2831,32 +2831,32 @@  discard block
 block discarded – undo
2831 2831
 	 *	@access protected
2832 2832
 	 *	@return void
2833 2833
 	 */
2834
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2834
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2835 2835
 
2836
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2836
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2837 2837
 
2838 2838
 		//class name for actions/filters.
2839 2839
 		$classname = get_class($this);
2840 2840
 
2841 2841
 		//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
2842
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2843
-		$notices = EE_Error::get_notices( FALSE );
2842
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2843
+		$notices = EE_Error::get_notices(FALSE);
2844 2844
 
2845 2845
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2846
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2846
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2847 2847
 			EE_Error::overwrite_success();
2848 2848
 		}
2849 2849
 		// how many records affected ? more than one record ? or just one ?
2850
-		if ( $success > 1 && empty( $notices['errors'] )) {
2850
+		if ($success > 1 && empty($notices['errors'])) {
2851 2851
 			// set plural msg
2852
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2853
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2852
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2853
+		} else if ($success == 1 && empty($notices['errors'])) {
2854 2854
 			// set singular msg
2855
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2855
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2856 2856
 		}
2857 2857
 
2858 2858
 		// check that $query_args isn't something crazy
2859
-		if ( ! is_array( $query_args )) {
2859
+		if ( ! is_array($query_args)) {
2860 2860
 			$query_args = array();
2861 2861
 		}
2862 2862
 
@@ -2869,36 +2869,36 @@  discard block
 block discarded – undo
2869 2869
 		 * @param array $query_args   The original query_args array coming into the
2870 2870
 		 *                          		method.
2871 2871
 		 */
2872
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2872
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2873 2873
 
2874 2874
 		//calculate where we're going (if we have a "save and close" button pushed)
2875
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2875
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2876 2876
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2877
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2877
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2878 2878
 			// regenerate query args array from refferer URL
2879
-			parse_str( $parsed_url['query'], $query_args );
2879
+			parse_str($parsed_url['query'], $query_args);
2880 2880
 			// correct page and action will be in the query args now
2881
-			$redirect_url = admin_url( 'admin.php' );
2881
+			$redirect_url = admin_url('admin.php');
2882 2882
 		}
2883 2883
 
2884 2884
 		//merge any default query_args set in _default_route_query_args property
2885
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2885
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2886 2886
 			$args_to_merge = array();
2887
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2887
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2888 2888
 				//is there a wp_referer array in our _default_route_query_args property?
2889
-				if ( $query_param == 'wp_referer'  ) {
2889
+				if ($query_param == 'wp_referer') {
2890 2890
 					$query_value = (array) $query_value;
2891
-					foreach ( $query_value as $reference => $value ) {
2892
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2891
+					foreach ($query_value as $reference => $value) {
2892
+						if (strpos($reference, 'nonce') !== false) {
2893 2893
 							continue;
2894 2894
 						}
2895 2895
 
2896 2896
 						//finally we will override any arguments in the referer with
2897 2897
 						//what might be set on the _default_route_query_args array.
2898
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2899
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2898
+						if (isset($this->_default_route_query_args[$reference])) {
2899
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2900 2900
 						} else {
2901
-							$args_to_merge[$reference] = urlencode( $value );
2901
+							$args_to_merge[$reference] = urlencode($value);
2902 2902
 						}
2903 2903
 					}
2904 2904
 					continue;
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
 
2910 2910
 			//now let's merge these arguments but override with what was specifically sent in to the
2911 2911
 			//redirect.
2912
-			$query_args = array_merge( $args_to_merge, $query_args );
2912
+			$query_args = array_merge($args_to_merge, $query_args);
2913 2913
 		}
2914 2914
 
2915 2915
 		$this->_process_notices($query_args);
@@ -2918,19 +2918,19 @@  discard block
 block discarded – undo
2918 2918
 		// generate redirect url
2919 2919
 
2920 2920
 		// if redirecting to anything other than the main page, add a nonce
2921
-		if ( isset( $query_args['action'] )) {
2921
+		if (isset($query_args['action'])) {
2922 2922
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2923
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2923
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2924 2924
 		}
2925 2925
 
2926 2926
 		//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).
2927
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2927
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2928 2928
 
2929
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2929
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2930 2930
 
2931 2931
 
2932 2932
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2933
-		if ( defined('DOING_AJAX' ) ) {
2933
+		if (defined('DOING_AJAX')) {
2934 2934
 			$default_data = array(
2935 2935
 				'close' => TRUE,
2936 2936
 				'redirect_url' => $redirect_url,
@@ -2939,11 +2939,11 @@  discard block
 block discarded – undo
2939 2939
 				);
2940 2940
 
2941 2941
 			$this->_template_args['success'] = $success;
2942
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2942
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2943 2943
 			$this->_return_json();
2944 2944
 		}
2945 2945
 
2946
-		wp_safe_redirect( $redirect_url );
2946
+		wp_safe_redirect($redirect_url);
2947 2947
 		exit();
2948 2948
 	}
2949 2949
 
@@ -2959,14 +2959,14 @@  discard block
 block discarded – undo
2959 2959
 	 * @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.
2960 2960
 	 * @return void
2961 2961
 	 */
2962
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
2962
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
2963 2963
 
2964 2964
 		$this->_template_args['notices'] = EE_Error::get_notices();
2965 2965
 
2966 2966
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
2967
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
2968
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
2969
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
2967
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
2968
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
2969
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
2970 2970
 		}
2971 2971
 	}
2972 2972
 
@@ -2988,32 +2988,32 @@  discard block
 block discarded – undo
2988 2988
 	 *
2989 2989
 	 * @return string html for button
2990 2990
 	 */
2991
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
2991
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
2992 2992
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
2993
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
2994
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
2993
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
2994
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
2995 2995
 
2996
-		if ( !isset( $this->_labels['buttons'][$type] ) )
2997
-			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) );
2996
+		if ( ! isset($this->_labels['buttons'][$type]))
2997
+			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));
2998 2998
 
2999 2999
 		//finally check user access for this button.
3000
-		$has_access = $this->check_user_access( $action, TRUE );
3001
-		if ( ! $has_access ) {
3000
+		$has_access = $this->check_user_access($action, TRUE);
3001
+		if ( ! $has_access) {
3002 3002
 			return '';
3003 3003
 		}
3004 3004
 
3005
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
3005
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
3006 3006
 
3007 3007
 		$query_args = array(
3008 3008
 			'action' => $action  );
3009 3009
 
3010 3010
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3011
-		if ( !empty($extra_request) )
3012
-			$query_args = array_merge( $extra_request, $query_args );
3011
+		if ( ! empty($extra_request))
3012
+			$query_args = array_merge($extra_request, $query_args);
3013 3013
 
3014
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3014
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3015 3015
 
3016
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3016
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3017 3017
 
3018 3018
 		return $button;
3019 3019
 	}
@@ -3033,11 +3033,11 @@  discard block
 block discarded – undo
3033 3033
 		$args = array(
3034 3034
 			'label' => $this->_admin_page_title,
3035 3035
 			'default' => 10,
3036
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3036
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3037 3037
 			);
3038 3038
 		//ONLY add the screen option if the user has access to it.
3039
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3040
-			add_screen_option( $option, $args );
3039
+		if ($this->check_user_access($this->_current_view, true)) {
3040
+			add_screen_option($option, $args);
3041 3041
 		}
3042 3042
 	}
3043 3043
 
@@ -3053,36 +3053,36 @@  discard block
 block discarded – undo
3053 3053
 	 * @return void
3054 3054
 	 */
3055 3055
 	private function _set_per_page_screen_options() {
3056
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3057
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3056
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3057
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3058 3058
 
3059
-			if ( !$user = wp_get_current_user() )
3059
+			if ( ! $user = wp_get_current_user())
3060 3060
 			return;
3061 3061
 			$option = $_POST['wp_screen_options']['option'];
3062 3062
 			$value = $_POST['wp_screen_options']['value'];
3063 3063
 
3064
-			if ( $option != sanitize_key( $option ) )
3064
+			if ($option != sanitize_key($option))
3065 3065
 				return;
3066 3066
 
3067 3067
 			$map_option = $option;
3068 3068
 
3069 3069
 			$option = str_replace('-', '_', $option);
3070 3070
 
3071
-			switch ( $map_option ) {
3072
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3071
+			switch ($map_option) {
3072
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3073 3073
 					$value = (int) $value;
3074
-					if ( $value < 1 || $value > 999 )
3074
+					if ($value < 1 || $value > 999)
3075 3075
 						return;
3076 3076
 					break;
3077 3077
 				default:
3078
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3079
-					if ( false === $value )
3078
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3079
+					if (false === $value)
3080 3080
 						return;
3081 3081
 					break;
3082 3082
 			}
3083 3083
 
3084 3084
 			update_user_meta($user->ID, $option, $value);
3085
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3085
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3086 3086
 			exit;
3087 3087
 		}
3088 3088
 	}
@@ -3093,8 +3093,8 @@  discard block
 block discarded – undo
3093 3093
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3094 3094
 	 * @param array $data array that will be assigned to template args.
3095 3095
 	 */
3096
-	public function set_template_args( $data ) {
3097
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3096
+	public function set_template_args($data) {
3097
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3098 3098
 	}
3099 3099
 
3100 3100
 
@@ -3110,26 +3110,26 @@  discard block
 block discarded – undo
3110 3110
 	 * @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.
3111 3111
 	 * @return void
3112 3112
 	 */
3113
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3113
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3114 3114
 		$user_id = get_current_user_id();
3115 3115
 
3116
-		if ( !$skip_route_verify )
3116
+		if ( ! $skip_route_verify)
3117 3117
 			$this->_verify_route($route);
3118 3118
 
3119 3119
 
3120 3120
 		//now let's set the string for what kind of transient we're setting
3121
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3122
-		$data = $notices ? array( 'notices' => $data ) : $data;
3121
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3122
+		$data = $notices ? array('notices' => $data) : $data;
3123 3123
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3124
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3125
-		if ( $existing ) {
3126
-			$data = array_merge( (array) $data, (array) $existing );
3124
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3125
+		if ($existing) {
3126
+			$data = array_merge((array) $data, (array) $existing);
3127 3127
 		}
3128 3128
 
3129
-		if ( is_multisite() && is_network_admin() ) {
3130
-			set_site_transient( $transient, $data, 8 );
3129
+		if (is_multisite() && is_network_admin()) {
3130
+			set_site_transient($transient, $data, 8);
3131 3131
 		} else {
3132
-			set_transient( $transient, $data, 8 );
3132
+			set_transient($transient, $data, 8);
3133 3133
 		}
3134 3134
 	}
3135 3135
 
@@ -3141,18 +3141,18 @@  discard block
 block discarded – undo
3141 3141
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3142 3142
 	 * @return mixed data
3143 3143
 	 */
3144
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3144
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3145 3145
 		$user_id = get_current_user_id();
3146
-		$route = !$route ? $this->_req_action : $route;
3147
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3148
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3146
+		$route = ! $route ? $this->_req_action : $route;
3147
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3148
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3149 3149
 		//delete transient after retrieval (just in case it hasn't expired);
3150
-		if ( is_multisite() && is_network_admin() ) {
3151
-			delete_site_transient( $transient );
3150
+		if (is_multisite() && is_network_admin()) {
3151
+			delete_site_transient($transient);
3152 3152
 		} else {
3153
-			delete_transient( $transient );
3153
+			delete_transient($transient);
3154 3154
 		}
3155
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3155
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3156 3156
 	}
3157 3157
 
3158 3158
 
@@ -3169,12 +3169,12 @@  discard block
 block discarded – undo
3169 3169
 
3170 3170
 		//retrieve all existing transients
3171 3171
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3172
-		if ( $results = $wpdb->get_results( $query ) ) {
3173
-			foreach ( $results as $result ) {
3174
-				$transient = str_replace( '_transient_', '', $result->option_name );
3175
-				get_transient( $transient );
3176
-				if ( is_multisite() && is_network_admin() ) {
3177
-					get_site_transient( $transient );
3172
+		if ($results = $wpdb->get_results($query)) {
3173
+			foreach ($results as $result) {
3174
+				$transient = str_replace('_transient_', '', $result->option_name);
3175
+				get_transient($transient);
3176
+				if (is_multisite() && is_network_admin()) {
3177
+					get_site_transient($transient);
3178 3178
 				}
3179 3179
 			}
3180 3180
 		}
@@ -3298,23 +3298,23 @@  discard block
 block discarded – undo
3298 3298
 	 * @param string $line	line no where error occurred
3299 3299
 	 * @return boolean
3300 3300
 	 */
3301
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3301
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3302 3302
 
3303 3303
 		//remove any options that are NOT going to be saved with the config settings.
3304
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3304
+		if (isset($config->core->ee_ueip_optin)) {
3305 3305
 			$config->core->ee_ueip_has_notified = TRUE;
3306 3306
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3307
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3308
-			update_option( 'ee_ueip_has_notified', TRUE );
3307
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3308
+			update_option('ee_ueip_has_notified', TRUE);
3309 3309
 		}
3310 3310
 		// and save it (note we're also doing the network save here)
3311
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3312
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3313
-		if ( $config_saved && $net_saved ) {
3314
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3311
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3312
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3313
+		if ($config_saved && $net_saved) {
3314
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3315 3315
 			return TRUE;
3316 3316
 		} else {
3317
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3317
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3318 3318
 			return FALSE;
3319 3319
 		}
3320 3320
 	}
@@ -3327,7 +3327,7 @@  discard block
 block discarded – undo
3327 3327
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3328 3328
 	 * @return array
3329 3329
 	 */
3330
-	public function get_yes_no_values(){
3330
+	public function get_yes_no_values() {
3331 3331
 		return $this->_yes_no_values;
3332 3332
 	}
3333 3333
 
@@ -3349,8 +3349,8 @@  discard block
 block discarded – undo
3349 3349
 	 *
3350 3350
 	 * @return string
3351 3351
 	 */
3352
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3353
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3352
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3353
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3354 3354
 	}
3355 3355
 
3356 3356
 
@@ -3364,8 +3364,8 @@  discard block
 block discarded – undo
3364 3364
 	 *
3365 3365
 	 * @return string
3366 3366
 	 */
3367
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3368
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3367
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3368
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3369 3369
 	}
3370 3370
 
3371 3371
 
@@ -3384,8 +3384,8 @@  discard block
 block discarded – undo
3384 3384
 	 * @return bool success/fail
3385 3385
 	 */
3386 3386
 	protected function _process_resend_registration() {
3387
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3388
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3387
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3388
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3389 3389
 		return $this->_template_args['success'];
3390 3390
 	}
3391 3391
 
@@ -3398,9 +3398,9 @@  discard block
 block discarded – undo
3398 3398
 	 * @param \EE_Payment $payment
3399 3399
 	 * @return bool success/fail
3400 3400
 	 */
3401
-	protected function _process_payment_notification( EE_Payment $payment ) {
3402
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3403
-		$success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment );
3401
+	protected function _process_payment_notification(EE_Payment $payment) {
3402
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3403
+		$success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment);
3404 3404
 		$this->_template_args['success'] = $success;
3405 3405
 		return $success;
3406 3406
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT.core.php 1 patch
Spacing   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param  object $post    The post object of the cpt that was saved.
114 114
 	 * @return void
115 115
 	 */
116
-	abstract protected function _insert_update_cpt_item( $post_id, $post );
116
+	abstract protected function _insert_update_cpt_item($post_id, $post);
117 117
 
118 118
 
119 119
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $post_id The ID of the cpt that was trashed
127 127
 	 * @return void
128 128
 	 */
129
-	abstract public function trash_cpt_item( $post_id );
129
+	abstract public function trash_cpt_item($post_id);
130 130
 
131 131
 
132 132
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $post_id theID of the cpt that was untrashed
138 138
 	 * @return void
139 139
 	 */
140
-	abstract public function restore_cpt_item( $post_id );
140
+	abstract public function restore_cpt_item($post_id);
141 141
 
142 142
 
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $post_id the ID of the cpt that was deleted
149 149
 	 * @return void
150 150
 	 */
151
-	abstract public function delete_cpt_item( $post_id );
151
+	abstract public function delete_cpt_item($post_id);
152 152
 
153 153
 
154 154
 
@@ -161,32 +161,32 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function _before_page_setup() {
163 163
 
164
-		$page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug;
164
+		$page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
165 165
 
166
-		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes );
166
+		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes);
167 167
 
168 168
 		//let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
169
-		$this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page );
169
+		$this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page);
170 170
 
171 171
 		//tweak pagenow for page loading.
172
-		if( ! $this->_pagenow_map ) {
172
+		if ( ! $this->_pagenow_map) {
173 173
 			$this->_pagenow_map = array(
174 174
 				'create_new' => 'post-new.php',
175 175
 				'edit' => 'post.php',
176 176
 				'trash' => 'post.php'
177 177
 				);
178 178
 		}
179
-		add_action( 'current_screen', array( $this, 'modify_pagenow') );
179
+		add_action('current_screen', array($this, 'modify_pagenow'));
180 180
 
181 181
 
182 182
 		//TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
183 183
 		//get current page from autosave
184
-		$current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
-		$this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page;
184
+		$current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
+		$this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page;
186 186
 
187 187
 
188 188
 		//autosave... make sure its only for the correct page
189
-		if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) {
189
+		if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
190 190
 			//setup autosave ajax hook
191 191
 			//add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
192 192
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return void
204 204
 	 */
205
-	public function modify_pagenow( $current_screen ) {
205
+	public function modify_pagenow($current_screen) {
206 206
 		global $pagenow;
207 207
 		//possibly reset pagenow.
208
-		if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) {
208
+		if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) {
209 209
 			$pagenow = $this->_pagenow_map[$this->_req_data['action']];
210 210
 		}
211 211
 	}
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically you would send along the id of a metabox container.
221 221
 	 * @return void
222 222
 	 */
223
-	protected function _register_autosave_containers( $ids ) {
224
-		$this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids );
223
+	protected function _register_autosave_containers($ids) {
224
+		$this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids);
225 225
 	}
226 226
 
227 227
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$containers = array();
238 238
 
239
-		if ( empty( $wp_meta_boxes ) )
239
+		if (empty($wp_meta_boxes))
240 240
 			return;
241 241
 
242
-		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
242
+		$current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
243 243
 
244
-		foreach ( $current_metaboxes as $box_context ) {
245
-			foreach ( $box_context as $box_details ) {
246
-				foreach ( $box_details as $box ) {
247
-					if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){
244
+		foreach ($current_metaboxes as $box_context) {
245
+			foreach ($box_context as $box_details) {
246
+				foreach ($box_details as $box) {
247
+					if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) {
248 248
 						$containers[] = $box['id'];
249 249
 					}
250 250
 				}
251 251
 			}
252 252
 		}
253 253
 
254
-		$this->_autosave_containers = array_merge( $this->_autosave_containers, $containers );
254
+		$this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
255 255
 
256 256
 		//add hidden inputs container
257 257
 		$this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2
269 269
 
270 270
 		//filter _autosave_containers
271
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this );
272
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this );
271
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this);
272
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this);
273 273
 
274
-		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
274
+		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
275 275
 
276 276
 		$unsaved_data_msg = array(
277
-			'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
277
+			'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
278 278
 			'inputChanged' => 0
279 279
 			);
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	public function load_page_dependencies() {
287 287
 		try {
288 288
 			$this->_load_page_dependencies();
289
-		} catch ( EE_Error $e ) {
289
+		} catch (EE_Error $e) {
290 290
 			$e->get_error();
291 291
 		}
292 292
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	protected function _load_page_dependencies() {
303 303
 
304 304
 		//we only add stuff if this is a cpt_route!
305
-		if ( !$this->_cpt_route ) {
305
+		if ( ! $this->_cpt_route) {
306 306
 			parent::_load_page_dependencies();
307 307
 			return;
308 308
 		}
@@ -312,72 +312,72 @@  discard block
 block discarded – undo
312 312
 
313 313
 		//the following filters are for setting all the redirects on DEFAULT WP custom post type actions
314 314
 		//let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects!  Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
315
-		add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') );
315
+		add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
316 316
 
317 317
 		//inject our Admin page nav tabs...
318 318
 		//let's make sure the nav tabs are set if they aren't already
319 319
 		//if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
320
-		add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) );
320
+		add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
321 321
 
322 322
 		//modify the post_updated messages array
323
-		add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 );
323
+		add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
324 324
 
325 325
 		//add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts!
326
-		add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 );
326
+		add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
327 327
 
328 328
 		//This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
329
-		if ( !empty($this->_labels['publishbox'] ) ) {
329
+		if ( ! empty($this->_labels['publishbox'])) {
330 330
 
331
-			$box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
331
+			$box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
332 332
 
333
-			remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
334
-			add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
333
+			remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
334
+			add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
335 335
 		}
336 336
 
337 337
 		//let's add page_templates metabox if this cpt added support for it.
338
-		if ( $this->_supports_page_templates($this->_cpt_object->name) ) {
339
-			add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' );
338
+		if ($this->_supports_page_templates($this->_cpt_object->name)) {
339
+			add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default');
340 340
 		}/**/
341 341
 
342 342
 
343 343
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
344
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
345
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
344
+		if (method_exists($this, 'extra_permalink_field_buttons'))
345
+			add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
346 346
 
347 347
 		//add preview button
348
-		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
348
+		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
349 349
 
350 350
 
351 351
 		//insert our own post_stati dropdown
352
-		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
352
+		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
353 353
 
354 354
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
355
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
356
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
355
+		if (method_exists($this, 'extra_misc_actions_publish_box'))
356
+			add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
357 357
 
358 358
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
359
-		if ( method_exists( $this, 'edit_form_after_title' ) )
360
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
359
+		if (method_exists($this, 'edit_form_after_title'))
360
+			add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
361 361
 
362 362
 
363 363
 		/**
364 364
 		 * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
365 365
 		 */
366
-		add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 );
366
+		add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
367 367
 
368 368
 
369 369
 		parent::_load_page_dependencies();
370 370
 
371 371
 		//notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes.
372 372
 		global $pagenow;
373
-		do_action( 'load-' . $pagenow );
373
+		do_action('load-'.$pagenow);
374 374
 
375 375
 		$this->modify_current_screen();
376
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 );
376
+		add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
377 377
 		//we route REALLY early.
378 378
 		try {
379 379
 			$this->_route_admin_request();
380
-		} catch ( EE_Error $e ) {
380
+		} catch (EE_Error $e) {
381 381
 			$e->get_error();
382 382
 		}
383 383
 	}
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @return string possibly a new url for our route.
398 398
 	 */
399
-	public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) {
399
+	public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) {
400 400
 		$routes_to_match = array(
401 401
 			0 => array(
402 402
 				'edit.php?post_type=espresso_attendees',
403 403
 				'admin.php?page=espresso_registrations&action=contact_list'
404 404
 				),
405 405
 			 1 => array(
406
-			 	'edit.php?post_type=' . $this->_cpt_object->name,
407
-			 	'admin.php?page=' . $this->_cpt_object->name
406
+			 	'edit.php?post_type='.$this->_cpt_object->name,
407
+			 	'admin.php?page='.$this->_cpt_object->name
408 408
 				)
409 409
 			);
410 410
 
411
-		foreach( $routes_to_match as $route_matches ) {
412
-			if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) {
413
-				return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url );
411
+		foreach ($routes_to_match as $route_matches) {
412
+			if (strpos($good_protocol_url, $route_matches[0]) !== false) {
413
+				return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
414 414
 
415 415
 			}
416 416
 		}
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	 * @param string $cpt_name The cpt slug we're checking on.
427 427
 	 * @return bool True supported, false not.
428 428
 	 */
429
-	private function _supports_page_templates( $cpt_name ) {
429
+	private function _supports_page_templates($cpt_name) {
430 430
 		$cpt_args = EE_Register_CPTs::get_CPTs();
431
-		$cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array();
432
-		return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE;
431
+		$cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
432
+		return ! empty($cpt_args['page_templates']) ? TRUE : FALSE;
433 433
 	}
434 434
 
435 435
 
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 	public function page_template_meta_box() {
445 445
 		global $post;
446 446
 		$template = '';
447
-		if ( count( get_page_templates( $post ) ) != 0 ) {
448
-			$page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE );
449
-			$template = !empty( $page_template ) ? $page_template : '';
447
+		if (count(get_page_templates($post)) != 0) {
448
+			$page_template = get_post_meta($post->ID, '_wp_page_template', TRUE);
449
+			$template = ! empty($page_template) ? $page_template : '';
450 450
 		}
451 451
 		?>
452 452
 		<p><strong><?php _e('Template') ?></strong></p>
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
 	 * @param  string $new_slug  what the slug is
471 471
 	 * @return string            The new html string for the permalink area
472 472
 	 */
473
-	public function preview_button_html( $return, $id, $new_title, $new_slug ) {
474
-		$post = get_post( $id );
475
-		if ( 'publish' != get_post_status( $post ) ) {
476
-			$return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n";
473
+	public function preview_button_html($return, $id, $new_title, $new_slug) {
474
+		$post = get_post($id);
475
+		if ('publish' != get_post_status($post)) {
476
+			$return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n";
477 477
 		}
478 478
 		return $return;
479 479
 	}
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 			'cur_status' =>  $this->_cpt_model_obj->status(),
494 494
 			'statuses' => $statuses,
495 495
 			'cur_status_label' => $cur_status_label,
496
-			'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label )
496
+			'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label)
497 497
 			);
498 498
 
499 499
 		//we'll add a trash post status (WP doesn't add one for some reason)
500
-		if ( $this->_cpt_model_obj->status() == 'trash' ) {
500
+		if ($this->_cpt_model_obj->status() == 'trash') {
501 501
 			$template_args['cur_status_label'] = __('Trashed', 'event_espresso');
502 502
 			$statuses['trash'] = __('Trashed', 'event_espresso');
503 503
 			$template_args['statuses'] = $statuses;
504 504
 		}
505 505
 
506
-		$template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
507
-		EEH_Template::display_template( $template, $template_args );
506
+		$template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php';
507
+		EEH_Template::display_template($template, $template_args);
508 508
 	}
509 509
 
510 510
 
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	public function do_extra_autosave_stuff() {
544 544
 
545 545
 		//next let's check for the autosave nonce (we'll use _verify_nonce )
546
-		$nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL;
547
-		$this->_verify_nonce( $nonce, 'autosave' );
546
+		$nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL;
547
+		$this->_verify_nonce($nonce, 'autosave');
548 548
 
549 549
 
550 550
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
551
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
551
+		if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true);
552 552
 
553 553
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554
-		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
555
-			call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) );
554
+		if (method_exists($this, '_ee_autosave_'.$this->_current_view)) {
555
+			call_user_func(array($this, '_ee_autosave_'.$this->_current_view));
556 556
 		} else {
557 557
 			$this->_template_args['success'] = TRUE;
558 558
 		}
559 559
 
560
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this );
561
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this );
560
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
561
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this);
562 562
 
563 563
 		//now let's return json
564 564
 		$this->_return_json();
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	protected function _extend_page_config_for_cpt() {
579 579
 
580 580
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
581
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
581
+		if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug))
582 582
 			return;
583 583
 
584 584
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585
-		if ( !empty( $this->_cpt_object ) ) {
586
-			$this->_page_routes = array_merge( array(
585
+		if ( ! empty($this->_cpt_object)) {
586
+			$this->_page_routes = array_merge(array(
587 587
 				'create_new' => '_create_new_cpt_item',
588 588
 				'edit' => '_edit_cpt_item'
589
-				), $this->_page_routes );
589
+				), $this->_page_routes);
590 590
 
591 591
 
592
-			$this->_page_config = array_merge( array(
592
+			$this->_page_config = array_merge(array(
593 593
 				'create_new' => array(
594 594
 					'nav' => array(
595 595
 						'label' => $this->_cpt_object->labels->add_new_item,
@@ -611,23 +611,23 @@  discard block
 block discarded – undo
611 611
 		}
612 612
 
613 613
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
614
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
614
+		if ( ! isset($this->_cpt_routes[$this->_req_action]))
615 615
 			return;
616 616
 
617 617
 
618
-		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
618
+		$this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE;
619 619
 		//add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
620 620
 
621 621
 
622
-		if ( empty( $this->_cpt_object ) ) {
623
-			$msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) );
624
-			throw new EE_Error( $msg );
622
+		if (empty($this->_cpt_object)) {
623
+			$msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this));
624
+			throw new EE_Error($msg);
625 625
 		}
626 626
 
627 627
 
628
-		if ( $this->_cpt_route ) {
629
-			$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
630
-			$this->_set_model_object( $id );
628
+		if ($this->_cpt_route) {
629
+			$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
630
+			$this->_set_model_object($id);
631 631
 		}
632 632
 
633 633
 	}
@@ -641,13 +641,13 @@  discard block
 block discarded – undo
641 641
 	 * @param int  $id The id to retrieve the model object for. If empty we set a default object.
642 642
 	 * @param bool $ignore_route_check
643 643
 	 */
644
-	protected function _set_model_object( $id = NULL, $ignore_route_check = false ) {
644
+	protected function _set_model_object($id = NULL, $ignore_route_check = false) {
645 645
 		$model = null;
646 646
 		if (
647
-			empty( $this->_cpt_model_names )
647
+			empty($this->_cpt_model_names)
648 648
 		    || (
649 649
 			     ! $ignore_route_check
650
-			     && ! isset( $this->_cpt_routes[ $this->_req_action ] )
650
+			     && ! isset($this->_cpt_routes[$this->_req_action])
651 651
 		    ) || (
652 652
 			     $this->_cpt_model_obj instanceof EE_CPT_Base
653 653
 			     && $this->_cpt_model_obj->ID() === $id
@@ -657,21 +657,21 @@  discard block
 block discarded – undo
657 657
 			return;
658 658
 		}
659 659
 		//if ignore_route_check is true, then get the model name via EE_Register_CPTs
660
-		if ( $ignore_route_check ) {
660
+		if ($ignore_route_check) {
661 661
 			$model_names = EE_Register_CPTs::get_cpt_model_names();
662
-			$post_type = get_post_type( $id );
663
-			if ( isset( $model_names[ $post_type ] ) ) {
664
-				$model = EE_Registry::instance()->load_model( $model_names[ $post_type ] );
662
+			$post_type = get_post_type($id);
663
+			if (isset($model_names[$post_type])) {
664
+				$model = EE_Registry::instance()->load_model($model_names[$post_type]);
665 665
 			}
666 666
 		} else {
667
-			$model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] );
667
+			$model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
668 668
 		}
669 669
 
670
-		if ( $model instanceof EEM_Base ) {
671
-			$this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object();
670
+		if ($model instanceof EEM_Base) {
671
+			$this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
672 672
 		}
673 673
 
674
-		do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' );
674
+		do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object');
675 675
 	}
676 676
 
677 677
 
@@ -685,47 +685,47 @@  discard block
 block discarded – undo
685 685
 	 */
686 686
 	public function admin_init_global() {
687 687
 
688
-		$post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL;
688
+		$post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL;
689 689
 
690 690
 		//its possible this is a new save so let's catch that instead
691
-		$post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post;
691
+		$post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
692 692
 		$post_type = $post ? $post->post_type : false;
693 693
 
694 694
 		$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
695 695
 
696
-		$route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
696
+		$route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
697 697
 
698
-		add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 );
699
-		add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 );
698
+		add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
699
+		add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
700 700
 
701 701
 
702
-		if ( $post_type === $route_to_check ) {
703
-			add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 );
702
+		if ($post_type === $route_to_check) {
703
+			add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
704 704
 			//catch trashed wp redirect
705
-			add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 );
705
+			add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2);
706 706
 		}
707 707
 
708 708
 		//now let's filter redirect if we're on a revision page and the revision is for an event CPT.
709
-		$revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL;
709
+		$revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
710 710
 
711 711
 		/**var_dump($this->_req_data);
712 712
 		exit();/**/
713 713
 
714
-		if ( !empty( $revision ) ) {
715
-			$action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL;
714
+		if ( ! empty($revision)) {
715
+			$action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL;
716 716
 
717 717
 			//doing a restore?
718
-			if ( !empty( $action ) && $action == 'restore' ) {
718
+			if ( ! empty($action) && $action == 'restore') {
719 719
 
720 720
 				//get post for revision
721
-				$rev_post = get_post( $revision );
722
-				$rev_parent = get_post( $rev_post->post_parent );
721
+				$rev_post = get_post($revision);
722
+				$rev_parent = get_post($rev_post->post_parent);
723 723
 
724 724
 				//only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
725
-				if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) {
726
-					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 );
725
+				if ($rev_parent && $rev_parent->post_type == $this->page_slug) {
726
+					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
727 727
 					//restores of revisions
728
-					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 );
728
+					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
729 729
 				}
730 730
 			}
731 731
 
@@ -734,15 +734,15 @@  discard block
 block discarded – undo
734 734
 		//NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
735 735
 
736 736
 
737
-		if ( $post_type && $post_type === $route_to_check ) {
737
+		if ($post_type && $post_type === $route_to_check) {
738 738
 			//$post_id, $post
739
-			add_action('save_post', array( $this, 'insert_update'), 10, 3 );
739
+			add_action('save_post', array($this, 'insert_update'), 10, 3);
740 740
 
741 741
 			//$post_id
742
-			add_action('trashed_post', array( $this, 'before_trash_cpt_item' ), 10 );
743
-			add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 );
744
-			add_action('untrashed_post', array( $this, 'before_restore_cpt_item'), 10 );
745
-			add_action('after_delete_post', array( $this, 'before_delete_cpt_item'), 10 );
742
+			add_action('trashed_post', array($this, 'before_trash_cpt_item'), 10);
743
+			add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
744
+			add_action('untrashed_post', array($this, 'before_restore_cpt_item'), 10);
745
+			add_action('after_delete_post', array($this, 'before_delete_cpt_item'), 10);
746 746
 		}
747 747
 
748 748
 	}
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @param int $post_id
758 758
 	 */
759
-	public function before_trash_cpt_item( $post_id ) {
760
-		$this->_set_model_object( $post_id, true );
759
+	public function before_trash_cpt_item($post_id) {
760
+		$this->_set_model_object($post_id, true);
761 761
 		//if our cpt object isn't existent then get out immediately.
762
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
762
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
763 763
 			return;
764 764
 		}
765
-		$this->trash_cpt_item( $post_id );
765
+		$this->trash_cpt_item($post_id);
766 766
 	}
767 767
 
768 768
 
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
 	 *
773 773
 	 * @param $post_id
774 774
 	 */
775
-	public function before_restore_cpt_item( $post_id ) {
776
-		$this->_set_model_object( $post_id, true );
775
+	public function before_restore_cpt_item($post_id) {
776
+		$this->_set_model_object($post_id, true);
777 777
 		//if our cpt object isn't existent then get out immediately.
778
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
778
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
779 779
 			return;
780 780
 		}
781
-		$this->restore_cpt_item( $post_id );
781
+		$this->restore_cpt_item($post_id);
782 782
 	}
783 783
 
784 784
 
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
 	 * Execute some basic checks before calling the delete_cpt_item method in the child class.
788 788
 	 * @param $post_id
789 789
 	 */
790
-	public function before_delete_cpt_item( $post_id ) {
791
-		$this->_set_model_object( $post_id, true );
790
+	public function before_delete_cpt_item($post_id) {
791
+		$this->_set_model_object($post_id, true);
792 792
 		//if our cpt object isn't existent then get out immediately.
793
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id ) {
793
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base || $this->_cpt_model_obj->ID() !== $post_id) {
794 794
 			return;
795 795
 		}
796
-		$this->delete_cpt_item( $post_id );
796
+		$this->delete_cpt_item($post_id);
797 797
 	}
798 798
 
799 799
 
@@ -805,15 +805,15 @@  discard block
 block discarded – undo
805 805
 	 * @return void
806 806
 	 */
807 807
 	public function verify_cpt_object() {
808
-		$label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label;
808
+		$label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
809 809
 		// verify event object
810
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
811
-			throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) );
810
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
811
+			throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label));
812 812
 		}
813 813
 		//if auto-draft then throw an error
814
-		if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) {
814
+		if ($this->_cpt_model_obj->get('status') == 'auto-draft') {
815 815
 			EE_Error::overwrite_errors();
816
-			EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ );
816
+			EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__);
817 817
 		}
818 818
 	}
819 819
 
@@ -842,22 +842,22 @@  discard block
 block discarded – undo
842 842
 	public function load_global_scripts_styles() {
843 843
 		parent::load_global_scripts_styles();
844 844
 
845
-		if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) {
845
+		if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
846 846
 			//setup custom post status object for localize script but only if we've got a cpt object
847 847
 			$statuses = $this->_cpt_model_obj->get_custom_post_statuses();
848 848
 
849
-			if ( !empty($statuses) ) {
849
+			if ( ! empty($statuses)) {
850 850
 				//get ALL statuses!
851 851
 				$statuses = $this->_cpt_model_obj->get_all_post_statuses();
852 852
 				//setup object
853 853
 				$ee_cpt_statuses = array();
854
-				foreach ( $statuses as $status => $label ) {
854
+				foreach ($statuses as $status => $label) {
855 855
 					$ee_cpt_statuses[$status] = array(
856 856
 						'label' => $label,
857
-						'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label )
857
+						'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label)
858 858
 						);
859 859
 				}
860
-				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses );
860
+				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
861 861
 			}
862 862
 		}
863 863
 	}
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 	 * @param  bool   $update  Whether this is an update or a new save.
873 873
 	 * @return void
874 874
 	 */
875
-	public function insert_update( $post_id, $post, $update ) {
875
+	public function insert_update($post_id, $post, $update) {
876 876
 
877 877
 		//make sure that if this is a revision OR trash action that we don't do any updates!
878 878
 		if (
879
-			isset( $this->_req_data['action'] )
879
+			isset($this->_req_data['action'])
880 880
 			&& (
881 881
 				$this->_req_data['action'] == 'restore'
882 882
 				|| $this->_req_data['action'] == 'trash'
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
 			return;
886 886
 		}
887 887
 
888
-		$this->_set_model_object( $post_id, true );
888
+		$this->_set_model_object($post_id, true);
889 889
 
890 890
 		//if our cpt object is not instantiated and its NOT the same post_id as what is triggering this callback, then exit.
891
-		if ( $update
891
+		if ($update
892 892
 			&& (
893 893
 			     ! $this->_cpt_model_obj instanceof EE_CPT_Base
894 894
 			     || $this->_cpt_model_obj->ID() !== $post_id
@@ -909,19 +909,19 @@  discard block
 block discarded – undo
909 909
 		}/**/ //TODO reactivate after autosave is implemented in 4.2
910 910
 
911 911
 		//take care of updating any selected page_template IF this cpt supports it.
912
-		if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) {
912
+		if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
913 913
 			$post->page_template = $this->_req_data['page_template'];
914
-			$page_templates = wp_get_theme()->get_page_templates( $post );
915
-			if ( 'default' != $this->_req_data['page_template']  && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) {
916
-				EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
914
+			$page_templates = wp_get_theme()->get_page_templates($post);
915
+			if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
916
+				EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
917 917
 			} else {
918
-				update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] );
918
+				update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
919 919
 			}
920 920
 		}
921 921
 
922
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
922
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
923 923
 			return; //TODO we'll remove this after reimplementing autosave in 4.2
924
-		$this->_insert_update_cpt_item( $post_id, $post );
924
+		$this->_insert_update_cpt_item($post_id, $post);
925 925
 	}
926 926
 
927 927
 
@@ -934,15 +934,15 @@  discard block
 block discarded – undo
934 934
 	 * @param  int    $post_id ID of the post
935 935
 	 * @return void
936 936
 	 */
937
-	public function dont_permanently_delete_ee_cpts( $post_id ) {
937
+	public function dont_permanently_delete_ee_cpts($post_id) {
938 938
 		//only do this if we're actually processing one of our CPTs
939 939
 		//if our cpt object isn't existent then get out immediately.
940
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
940
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
941 941
 			return;
942 942
 		}
943 943
 
944
-		delete_post_meta( $post_id, '_wp_trash_meta_status' );
945
-		delete_post_meta( $post_id, '_wp_trash_meta_time');
944
+		delete_post_meta($post_id, '_wp_trash_meta_status');
945
+		delete_post_meta($post_id, '_wp_trash_meta_time');
946 946
 
947 947
 		//our cpts may have comments so let's take care of that too
948 948
 		delete_post_meta($post_id, '_wp_trash_meta_comments_status');
@@ -960,14 +960,14 @@  discard block
 block discarded – undo
960 960
 	 * @param  int    $revision_id ID of revision being restored
961 961
 	 * @return void
962 962
 	 */
963
-	public function restore_revision( $post_id, $revision_id ) {
964
-		$this->_restore_cpt_item( $post_id, $revision_id );
963
+	public function restore_revision($post_id, $revision_id) {
964
+		$this->_restore_cpt_item($post_id, $revision_id);
965 965
 
966 966
 		//global action
967
-		do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
967
+		do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
968 968
 
969 969
 		//class specific action so you can limit hooking into a specific page.
970
-		do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id );
970
+		do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id);
971 971
 	}
972 972
 
973 973
 
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 	 * @param  int $revision_id ID of revision for item
979 979
 	 * @return void
980 980
 	 */
981
-	abstract protected function _restore_cpt_item( $post_id, $revision_id );
981
+	abstract protected function _restore_cpt_item($post_id, $revision_id);
982 982
 
983 983
 
984 984
 
@@ -997,9 +997,9 @@  discard block
 block discarded – undo
997 997
 	 */
998 998
 	public function modify_current_screen() {
999 999
 		//ONLY do this if the current page_route IS a cpt route
1000
-		if ( !$this->_cpt_route ) return;
1000
+		if ( ! $this->_cpt_route) return;
1001 1001
 		//routing things REALLY early b/c this is a cpt admin page
1002
-		set_current_screen( $this->_cpt_routes[$this->_req_action]);
1002
+		set_current_screen($this->_cpt_routes[$this->_req_action]);
1003 1003
 		$this->_current_screen = get_current_screen();
1004 1004
 		$this->_current_screen->base = 'event-espresso';
1005 1005
 		$this->_add_help_tabs(); //we make sure we add any help tabs back in!
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
 	 * @param string $title The new title (or existing if there is no editor_title defined)
1021 1021
 	 * @return string
1022 1022
 	 */
1023
-	public function add_custom_editor_default_title( $title ) {
1024
-		return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
1023
+	public function add_custom_editor_default_title($title) {
1024
+		return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
1025 1025
 	}
1026 1026
 
1027 1027
 
@@ -1034,11 +1034,11 @@  discard block
 block discarded – undo
1034 1034
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
1035 1035
 	 * @return string
1036 1036
 	 */
1037
-	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
1038
-		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
1039
-			$post = get_post( $id );
1040
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
1041
-			$shortlink = home_url('?p=' . $post->ID);
1037
+	public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) {
1038
+		if ( ! empty($id) && '' != get_option('permalink_structure')) {
1039
+			$post = get_post($id);
1040
+			if (isset($post->post_type) && $this->page_slug == $post->post_type)
1041
+			$shortlink = home_url('?p='.$post->ID);
1042 1042
 		}
1043 1043
 		return $shortlink;
1044 1044
 	}
@@ -1051,10 +1051,10 @@  discard block
 block discarded – undo
1051 1051
 	 * @return void
1052 1052
 	 */
1053 1053
 	public function route_admin_request() {
1054
-		if ( $this->_cpt_route ) return;
1054
+		if ($this->_cpt_route) return;
1055 1055
 		try {
1056 1056
 			$this->_route_admin_request();
1057
-		} catch ( EE_Error $e ) {
1057
+		} catch (EE_Error $e) {
1058 1058
 			$e->get_error();
1059 1059
 		}
1060 1060
 	}
@@ -1067,12 +1067,12 @@  discard block
 block discarded – undo
1067 1067
 	 * @return string html
1068 1068
 	 */
1069 1069
 	public function cpt_post_form_hidden_input() {
1070
-		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
1070
+		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />';
1071 1071
 
1072 1072
 		//we're also going to add the route value and the current page so we can direct autosave parsing correctly
1073 1073
 		echo '<div id="ee-cpt-hidden-inputs">';
1074
-		echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
1075
-		echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
1074
+		echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />';
1075
+		echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />';
1076 1076
 		echo '</div>';
1077 1077
 	}
1078 1078
 
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 * @param  int    $status   Status for http header
1086 1086
 	 * @return string           new (or original) url to redirect to.
1087 1087
 	 */
1088
-	public function revision_redirect( $location, $status ) {
1088
+	public function revision_redirect($location, $status) {
1089 1089
 		//get revision
1090 1090
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
1091 1091
 
1092 1092
 		//can't do anything without revision so let's get out if not present
1093
-		if ( empty( $rev_id ) )
1093
+		if (empty($rev_id))
1094 1094
 			return $location;
1095 1095
 
1096 1096
 		//get rev_post_data
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 				'message' => 5
1105 1105
 			);
1106 1106
 
1107
-		$this->_process_notices( $query_args, TRUE );
1108
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1107
+		$this->_process_notices($query_args, TRUE);
1108
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1118,16 +1118,16 @@  discard block
 block discarded – undo
1118 1118
 	 * @param  string $context optional, defaults to display.  How to write the '&'
1119 1119
 	 * @return string          the link
1120 1120
 	 */
1121
-	public function modify_edit_post_link( $link, $id, $context ) {
1122
-		$post = get_post( $id );
1123
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1121
+	public function modify_edit_post_link($link, $id, $context) {
1122
+		$post = get_post($id);
1123
+		if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1124 1124
 			return $link;
1125 1125
 		$query_args = array(
1126 1126
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1127 1127
 			'post' => $id
1128 1128
 			);
1129 1129
 
1130
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1130
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1139,12 +1139,12 @@  discard block
 block discarded – undo
1139 1139
 	 * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1140 1140
 	 * @return string               new delete link
1141 1141
 	 */
1142
-	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1142
+	public function modify_delete_post_link($delete_link, $post_id, $force_delete) {
1143 1143
 		$post = get_post($post_id);
1144
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1144
+		if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]))
1145 1145
 			return $delete_link;
1146 1146
 
1147
-		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1147
+		return add_query_arg(array('current_route' => 'trash'), $delete_link);
1148 1148
 	}
1149 1149
 
1150 1150
 
@@ -1155,16 +1155,16 @@  discard block
 block discarded – undo
1155 1155
 	 * @param  string $status   status
1156 1156
 	 * @return string           url to redirect to
1157 1157
 	 */
1158
-	public function cpt_trash_post_location_redirect( $location, $status ) {
1159
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1158
+	public function cpt_trash_post_location_redirect($location, $status) {
1159
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post']))
1160 1160
 			return $location;
1161 1161
 
1162
-		$post = get_post( $this->_req_data['post'] );
1163
-		$query_args = array( 'action' => 'default' );
1162
+		$post = get_post($this->_req_data['post']);
1163
+		$query_args = array('action' => 'default');
1164 1164
 		$this->_cpt_object = get_post_type_object($post->post_type);
1165
-		EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) );
1166
-		$this->_process_notices( $query_args, TRUE );
1167
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1165
+		EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name));
1166
+		$this->_process_notices($query_args, TRUE);
1167
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1168 1168
 	}
1169 1169
 
1170 1170
 
@@ -1179,21 +1179,21 @@  discard block
 block discarded – undo
1179 1179
 	 * @param  string $post_id  This is the 'ID' value of the wp_posts table
1180 1180
 	 * @return string           the new location to redirect to
1181 1181
 	 */
1182
-	public function cpt_post_location_redirect( $location, $post_id ) {
1182
+	public function cpt_post_location_redirect($location, $post_id) {
1183 1183
 		//we DO have a match so let's setup the url
1184 1184
 		//we have to get the post to determine our route
1185 1185
 		$post = get_post($post_id);
1186 1186
 		$edit_route = $this->_cpt_edit_routes[$post->post_type];
1187 1187
 
1188 1188
 		//shared query_args
1189
-		$query_args = array( 'action' => $edit_route, 'post' => $post_id );
1189
+		$query_args = array('action' => $edit_route, 'post' => $post_id);
1190 1190
 		$admin_url = $this->_admin_base_url;
1191 1191
 //		$append = '';
1192 1192
 
1193
-		if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) {
1194
-			$status = get_post_status( $post_id );
1195
-			if ( isset( $this->_req_data['publish'] ) ) {
1196
-				switch ( $status ) {
1193
+		if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1194
+			$status = get_post_status($post_id);
1195
+			if (isset($this->_req_data['publish'])) {
1196
+				switch ($status) {
1197 1197
 					case 'pending':
1198 1198
 						$message = 8;
1199 1199
 						break;
@@ -1206,13 +1206,13 @@  discard block
 block discarded – undo
1206 1206
 			} else {
1207 1207
 					$message = 'draft' == $status ? 10 : 1;
1208 1208
 			}
1209
-		} else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) {
1209
+		} else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1210 1210
 			$message = 2;
1211 1211
 //			$append = '#postcustom';
1212
-		} else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) {
1212
+		} else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1213 1213
 			$message = 3;
1214 1214
 //			$append = '#postcustom';
1215
-		} elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) {
1215
+		} elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') {
1216 1216
 			$message = 7;
1217 1217
 		} else {
1218 1218
 			$message = 4;
@@ -1220,11 +1220,11 @@  discard block
 block discarded – undo
1220 1220
 
1221 1221
 		//change the message if the post type is not viewable on the frontend
1222 1222
 		$this->_cpt_object = get_post_type_object($post->post_type);
1223
-		$message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message;
1223
+		$message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1224 1224
 
1225
-		$query_args = array_merge( array( 'message' => $message ), $query_args );
1226
-		$this->_process_notices( $query_args, TRUE );
1227
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1225
+		$query_args = array_merge(array('message' => $message), $query_args);
1226
+		$this->_process_notices($query_args, TRUE);
1227
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1228 1228
 	}
1229 1229
 
1230 1230
 
@@ -1256,10 +1256,10 @@  discard block
 block discarded – undo
1256 1256
 	 * @param  array $messages the original messages array
1257 1257
 	 * @return array           the new messages array
1258 1258
 	 */
1259
-	public function post_update_messages( $messages ) {
1259
+	public function post_update_messages($messages) {
1260 1260
 		global $post;
1261
-		$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1262
-		$id = empty( $id ) && is_object( $post ) ? $post->ID : NULL;
1261
+		$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1262
+		$id = empty($id) && is_object($post) ? $post->ID : NULL;
1263 1263
 
1264 1264
 //		$post_type = $post ? $post->post_type : false;
1265 1265
 
@@ -1272,9 +1272,9 @@  discard block
 block discarded – undo
1272 1272
 			0 => '', //Unused. Messages start at index 1.
1273 1273
 
1274 1274
 			1 => sprintf(
1275
-				__( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1275
+				__('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1276 1276
 				$this->_cpt_object->labels->singular_name,
1277
-				'<a href="' . esc_url( get_permalink( $id )) . '">',
1277
+				'<a href="'.esc_url(get_permalink($id)).'">',
1278 1278
 				'</a>'
1279 1279
 			),
1280 1280
 
@@ -1282,38 +1282,38 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
 			3 => __('Custom field deleted.'),
1284 1284
 
1285
-			4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1285
+			4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1286 1286
 
1287
-			5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE,
1287
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE,
1288 1288
 
1289 1289
 			6 => sprintf(
1290
-					__( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1290
+					__('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1291 1291
 					$this->_cpt_object->labels->singular_name,
1292
-					'<a href="' . esc_url( get_permalink( $id )) . '">',
1292
+					'<a href="'.esc_url(get_permalink($id)).'">',
1293 1293
 					'</a>'
1294 1294
 				),
1295 1295
 
1296
-			7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1296
+			7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1297 1297
 
1298 1298
 			8 => sprintf(
1299 1299
 				__('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1300 1300
 				$this->_cpt_object->labels->singular_name,
1301
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">',
1301
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">',
1302 1302
 				'</a>'
1303 1303
 			),
1304 1304
 
1305 1305
 			9 => sprintf(
1306
-				__( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1306
+				__('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1307 1307
 				$this->_cpt_object->labels->singular_name,
1308
-				'<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>',
1309
-				'<a target="_blank" href="' . esc_url( get_permalink( $id )),
1308
+				'<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>',
1309
+				'<a target="_blank" href="'.esc_url(get_permalink($id)),
1310 1310
 				'</a>'
1311 1311
 			),
1312 1312
 
1313 1313
 			10 => sprintf(
1314 1314
 				__('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1315 1315
 				$this->_cpt_object->labels->singular_name,
1316
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) ,
1316
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1317 1317
 				'</a>'
1318 1318
 			)
1319 1319
 		);
@@ -1340,24 +1340,24 @@  discard block
 block discarded – undo
1340 1340
 		$post_type_object = $this->_cpt_object;
1341 1341
 		$title = $post_type_object->labels->add_new_item;
1342 1342
 		$editing = TRUE;
1343
-		wp_enqueue_script( 'autosave' );
1344
-		$post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE );
1343
+		wp_enqueue_script('autosave');
1344
+		$post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE);
1345 1345
 		$post_ID = $post->ID;
1346 1346
 		$is_IE = $is_IE;
1347 1347
 
1348
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1348
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1349 1349
 
1350 1350
 		//modify the default editor title field with default title.
1351
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1351
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1352 1352
 
1353
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1353
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1354 1354
 	}
1355 1355
 
1356 1356
 
1357 1357
 
1358 1358
 
1359 1359
 	public function add_new_admin_page_global() {
1360
-		$admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php';
1360
+		$admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1361 1361
 		?>
1362 1362
 		<script type="text/javascript">
1363 1363
 			adminpage = '<?php echo $admin_page; ?>';
@@ -1379,16 +1379,16 @@  discard block
 block discarded – undo
1379 1379
 	 */
1380 1380
 	protected function _edit_cpt_item() {
1381 1381
 		global $post, $title, $is_IE, $post_type, $post_type_object;
1382
-		$post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1383
-		$post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL;
1382
+		$post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1383
+		$post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL;
1384 1384
 
1385
-		if ( empty ( $post ) ) {
1386
-			wp_die( __('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?') );
1385
+		if (empty ($post)) {
1386
+			wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1387 1387
 		}
1388 1388
 
1389
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
1390
-			wp_set_post_lock( $post_id );
1391
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
1389
+		if ( ! empty($_GET['get-post-lock'])) {
1390
+			wp_set_post_lock($post_id);
1391
+			wp_redirect(get_edit_post_link($post_id, 'url'));
1392 1392
 			exit();
1393 1393
 		}
1394 1394
 
@@ -1398,32 +1398,32 @@  discard block
 block discarded – undo
1398 1398
 		$post_type = $this->_cpt_routes[$this->_req_action];
1399 1399
 		$post_type_object = $this->_cpt_object;
1400 1400
 
1401
-		if ( ! wp_check_post_lock( $post->ID ) ) {
1402
-			$active_post_lock = wp_set_post_lock( $post->ID );
1401
+		if ( ! wp_check_post_lock($post->ID)) {
1402
+			$active_post_lock = wp_set_post_lock($post->ID);
1403 1403
 			//wp_enqueue_script('autosave');
1404 1404
 		}
1405 1405
 
1406 1406
 		$title = $this->_cpt_object->labels->edit_item;
1407 1407
 
1408
-		add_action('admin_footer', '_admin_notice_post_locked' );
1408
+		add_action('admin_footer', '_admin_notice_post_locked');
1409 1409
 
1410
-		if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) {
1411
-			$create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this );
1410
+		if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) {
1411
+			$create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this);
1412 1412
 
1413
-			$post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' );
1413
+			$post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php');
1414 1414
 		}
1415 1415
 
1416
-		if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) {
1416
+		if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1417 1417
 			wp_enqueue_script('admin-comments');
1418 1418
 			enqueue_comment_hotkeys_js();
1419 1419
 		}
1420 1420
 
1421
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1421
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1422 1422
 
1423 1423
 		//modify the default editor title field with default title.
1424
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1424
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1425 1425
 
1426
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1426
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1427 1427
 
1428 1428
 	}
1429 1429
 
Please login to merge, or discard this patch.
core/EE_Config.core.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 *    update_espresso_config
374 374
 	 *
375 375
 	 * @access   public
376
-	 * @return   bool
376
+	 * @return   boolean|null
377 377
 	 */
378 378
 	protected function _reset_espresso_addon_config() {
379 379
 		$this->_addon_option_names = array();
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * @param    string         $name
460 460
 	 * @param    string         $config_class
461 461
 	 * @param    EE_Config_Base $config_obj
462
-	 * @param    array          $tests_to_run
462
+	 * @param    integer[]          $tests_to_run
463 463
 	 * @param    bool           $display_errors
464 464
 	 * @return    bool    TRUE on success, FALSE on fail
465 465
 	 */
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 
1737 1737
 
1738 1738
 	/**
1739
-	 * @return array
1739
+	 * @return integer[]
1740 1740
 	 */
1741 1741
 	public function get_critical_pages_array() {
1742 1742
 		return array(
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 
1751 1751
 
1752 1752
 	/**
1753
-	 * @return array
1753
+	 * @return string[]
1754 1754
 	 */
1755 1755
 	public function get_critical_pages_shortcodes_array() {
1756 1756
 		return array(
@@ -2785,7 +2785,7 @@  discard block
 block discarded – undo
2785 2785
 	 * according to max_input_vars
2786 2786
 	 *
2787 2787
 	 * @param int   $input_count the count of input vars.
2788
-	 * @return array {
2788
+	 * @return string {
2789 2789
 	 *                           An array that represents whether available space and if no available space the error
2790 2790
 	 *                           message.
2791 2791
 	 * @type bool   $has_space   whether more inputs can be added.
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
 	public function __construct( $CNT_ISO = '' ) {
2106 2106
 		// get country code from organization settings or use default
2107 2107
 		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization )
2108
-		           && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2108
+				   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2109 2109
 			? EE_Registry::instance()->CFG->organization->CNT_ISO
2110 2110
 			: '';
2111 2111
 		// but override if requested
@@ -2794,8 +2794,8 @@  discard block
 block discarded – undo
2794 2794
 	 */
2795 2795
 	public function max_input_vars_limit_check( $input_count = 0 ) {
2796 2796
 		if ( ! empty( $this->php->max_input_vars )
2797
-		     && ( $input_count >= $this->php->max_input_vars )
2798
-		     && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 )
2797
+			 && ( $input_count >= $this->php->max_input_vars )
2798
+			 && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 )
2799 2799
 		) {
2800 2800
 			return sprintf(
2801 2801
 				__(
Please login to merge, or discard this patch.
Spacing   +375 added lines, -375 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public static function instance() {
123 123
 		// check if class object is instantiated, and instantiated properly
124
-		if ( ! self::$_instance instanceof EE_Config ) {
124
+		if ( ! self::$_instance instanceof EE_Config) {
125 125
 			self::$_instance = new self();
126 126
 		}
127 127
 		return self::$_instance;
@@ -141,20 +141,20 @@  discard block
 block discarded – undo
141 141
 	 *                               site was put into maintenance mode)
142 142
 	 * @return EE_Config
143 143
 	 */
144
-	public static function reset( $hard_reset = false, $reinstantiate = true ) {
145
-		if ( $hard_reset ) {
144
+	public static function reset($hard_reset = false, $reinstantiate = true) {
145
+		if ($hard_reset) {
146 146
 			self::$_instance->_addon_option_names = array();
147 147
 			self::$_instance->_initialize_config();
148 148
 			self::$_instance->update_espresso_config();
149 149
 		}
150
-		if ( self::$_instance instanceof EE_Config ) {
150
+		if (self::$_instance instanceof EE_Config) {
151 151
 			self::$_instance->update_addon_option_names();
152 152
 		}
153 153
 		self::$_instance = null;
154 154
 		//we don't need to reset the static properties imo because those should
155 155
 		//only change when a module is added or removed. Currently we don't
156 156
 		//support removing a module during a request when it previously existed
157
-		if ( $reinstantiate ) {
157
+		if ($reinstantiate) {
158 158
 			return self::instance();
159 159
 		} else {
160 160
 			return null;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @return \EE_Config
171 171
 	 */
172 172
 	private function __construct() {
173
-		do_action( 'AHEE__EE_Config__construct__begin', $this );
173
+		do_action('AHEE__EE_Config__construct__begin', $this);
174 174
 		// setup empty config classes
175 175
 		$this->_initialize_config();
176 176
 		// load existing EE site settings
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 		//  register shortcodes and modules
181 181
 		add_action(
182 182
 			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
183
-			array( $this, 'register_shortcodes_and_modules' ),
183
+			array($this, 'register_shortcodes_and_modules'),
184 184
 			999
185 185
 		);
186 186
 		//  initialize shortcodes and modules
187
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) );
187
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
188 188
 		// register widgets
189
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
189
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
190 190
 		// shutdown
191
-		add_action( 'shutdown', array( $this, 'update_addon_option_names' ), 10 );
191
+		add_action('shutdown', array($this, 'update_addon_option_names'), 10);
192 192
 		// construct__end hook
193
-		do_action( 'AHEE__EE_Config__construct__end', $this );
193
+		do_action('AHEE__EE_Config__construct__end', $this);
194 194
 		// hardcoded hack
195 195
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
196 196
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @return string current theme set.
204 204
 	 */
205 205
 	public static function get_current_theme() {
206
-		return isset( self::$_instance->template_settings->current_espresso_theme )
206
+		return isset(self::$_instance->template_settings->current_espresso_theme)
207 207
 			? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
208 208
 	}
209 209
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	private function _initialize_config() {
219 219
 		EE_Config::trim_log();
220 220
 		//set defaults
221
-		$this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() );
221
+		$this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
222 222
 		$this->addons = new stdClass();
223 223
 		// set _module_route_map
224 224
 		EE_Config::$_module_route_map = array();
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	private function _load_core_config() {
240 240
 		// load_core_config__start hook
241
-		do_action( 'AHEE__EE_Config___load_core_config__start', $this );
241
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
242 242
 		$espresso_config = $this->get_espresso_config();
243
-		foreach ( $espresso_config as $config => $settings ) {
243
+		foreach ($espresso_config as $config => $settings) {
244 244
 			// load_core_config__start hook
245 245
 			$settings = apply_filters(
246 246
 				'FHEE__EE_Config___load_core_config__config_settings',
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 				$config,
249 249
 				$this
250 250
 			);
251
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
252
-				$this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
251
+			if (is_object($settings) && property_exists($this, $config)) {
252
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
253 253
 				//call configs populate method to ensure any defaults are set for empty values.
254
-				if ( method_exists( $settings, 'populate' ) ) {
254
+				if (method_exists($settings, 'populate')) {
255 255
 					$this->{$config}->populate();
256 256
 				}
257
-				if ( method_exists( $settings, 'do_hooks' ) ) {
257
+				if (method_exists($settings, 'do_hooks')) {
258 258
 					$this->{$config}->do_hooks();
259 259
 				}
260 260
 			}
261 261
 		}
262
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) {
262
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) {
263 263
 			$this->update_espresso_config();
264 264
 		}
265 265
 		// load_core_config__end hook
266
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
266
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
267 267
 	}
268 268
 
269 269
 
@@ -278,23 +278,23 @@  discard block
 block discarded – undo
278 278
 		$this->core = $this->core instanceof EE_Core_Config
279 279
 			? $this->core
280 280
 			: new EE_Core_Config();
281
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
281
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
282 282
 		$this->organization = $this->organization instanceof EE_Organization_Config
283 283
 			? $this->organization
284 284
 			: new EE_Organization_Config();
285
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
285
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
286 286
 		$this->currency = $this->currency instanceof EE_Currency_Config
287 287
 			? $this->currency
288 288
 			: new EE_Currency_Config();
289
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
289
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
290 290
 		$this->registration = $this->registration instanceof EE_Registration_Config
291 291
 			? $this->registration
292 292
 			: new EE_Registration_Config();
293
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
293
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
294 294
 		$this->admin = $this->admin instanceof EE_Admin_Config
295 295
 			? $this->admin
296 296
 			: new EE_Admin_Config();
297
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
297
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
298 298
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
299 299
 			? $this->template_settings
300 300
 			: new EE_Template_Config();
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
306 306
 			? $this->map_settings
307 307
 			: new EE_Map_Config();
308
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
308
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
309 309
 		$this->environment = $this->environment instanceof EE_Environment_Config
310 310
 			? $this->environment
311 311
 			: new EE_Environment_Config();
312
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
312
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
313 313
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
314 314
 			? $this->gateway
315 315
 			: new EE_Gateway_Config();
316
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
316
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
317 317
 	}
318 318
 
319 319
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		// grab espresso configuration
329 329
 		return apply_filters(
330 330
 			'FHEE__EE_Config__get_espresso_config__CFG',
331
-			get_option( EE_Config::OPTION_NAME, array() )
331
+			get_option(EE_Config::OPTION_NAME, array())
332 332
 		);
333 333
 	}
334 334
 
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 	 * @param        $old_value
343 343
 	 * @param        $value
344 344
 	 */
345
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
345
+	public function double_check_config_comparison($option = '', $old_value, $value) {
346 346
 		// make sure we're checking the ee config
347
-		if ( $option === EE_Config::OPTION_NAME ) {
347
+		if ($option === EE_Config::OPTION_NAME) {
348 348
 			// run a loose comparison of the old value against the new value for type and properties,
349 349
 			// but NOT exact instance like WP update_option does (ie: NOT type safe comparison)
350
-			if ( $value != $old_value ) {
350
+			if ($value != $old_value) {
351 351
 				// if they are NOT the same, then remove the hook,
352 352
 				// which means the subsequent update results will be based solely on the update query results
353 353
 				// the reason we do this is because, as stated above,
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				// the string it sees in the db looks the same as the new one it has been passed!!!
363 363
 				// This results in the query returning an "affected rows" value of ZERO,
364 364
 				// which gets returned immediately by WP update_option and looks like an error.
365
-				remove_action( 'update_option', array( $this, 'check_config_updated' ) );
365
+				remove_action('update_option', array($this, 'check_config_updated'));
366 366
 			}
367 367
 		}
368 368
 	}
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	protected function _reset_espresso_addon_config() {
379 379
 		$this->_addon_option_names = array();
380
-		foreach ( $this->addons as $addon_name => $addon_config_obj ) {
381
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
382
-			$config_class = get_class( $addon_config_obj );
383
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
384
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, false );
380
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
381
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
382
+			$config_class = get_class($addon_config_obj);
383
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
384
+				$this->update_config('addons', $addon_name, $addon_config_obj, false);
385 385
 			}
386 386
 			$this->addons->{$addon_name} = null;
387 387
 		}
@@ -397,18 +397,18 @@  discard block
 block discarded – undo
397 397
 	 * @param   bool $add_error
398 398
 	 * @return   bool
399 399
 	 */
400
-	public function update_espresso_config( $add_success = false, $add_error = true ) {
400
+	public function update_espresso_config($add_success = false, $add_error = true) {
401 401
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
402 402
 		//$clone = clone( self::$_instance );
403 403
 		//self::$_instance = NULL;
404
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this );
404
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
405 405
 		$this->_reset_espresso_addon_config();
406 406
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
407 407
 		// but BEFORE the actual update occurs
408
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
408
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
409 409
 		// now update "ee_config"
410
-		$saved = update_option( EE_Config::OPTION_NAME, $this );
411
-		EE_Config::log( EE_Config::OPTION_NAME );
410
+		$saved = update_option(EE_Config::OPTION_NAME, $this);
411
+		EE_Config::log(EE_Config::OPTION_NAME);
412 412
 		// if not saved... check if the hook we just added still exists;
413 413
 		// if it does, it means one of two things:
414 414
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -419,17 +419,17 @@  discard block
 block discarded – undo
419 419
 		// but just means no update occurred, so don't display an error to the user.
420 420
 		// BUT... if update_option returns FALSE, AND the hook is missing,
421 421
 		// then it means that something truly went wrong
422
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved;
422
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
423 423
 		// remove our action since we don't want it in the system anymore
424
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
425
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
424
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
425
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
426 426
 		//self::$_instance = $clone;
427 427
 		//unset( $clone );
428 428
 		// if config remains the same or was updated successfully
429
-		if ( $saved ) {
430
-			if ( $add_success ) {
429
+		if ($saved) {
430
+			if ($add_success) {
431 431
 				EE_Error::add_success(
432
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
432
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
433 433
 					__FILE__,
434 434
 					__FUNCTION__,
435 435
 					__LINE__
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 			}
438 438
 			return true;
439 439
 		} else {
440
-			if ( $add_error ) {
440
+			if ($add_error) {
441 441
 				EE_Error::add_error(
442
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
442
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
443 443
 					__FILE__,
444 444
 					__FUNCTION__,
445 445
 					__LINE__
@@ -468,16 +468,16 @@  discard block
 block discarded – undo
468 468
 		$name = '',
469 469
 		$config_class = '',
470 470
 		$config_obj = null,
471
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
471
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
472 472
 		$display_errors = true
473 473
 	) {
474 474
 		try {
475
-			foreach ( $tests_to_run as $test ) {
476
-				switch ( $test ) {
475
+			foreach ($tests_to_run as $test) {
476
+				switch ($test) {
477 477
 					// TEST #1 : check that section was set
478 478
 					case 1 :
479
-						if ( empty( $section ) ) {
480
-							if ( $display_errors ) {
479
+						if (empty($section)) {
480
+							if ($display_errors) {
481 481
 								throw new EE_Error(
482 482
 									sprintf(
483 483
 										__(
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
 						break;
494 494
 					// TEST #2 : check that settings section exists
495 495
 					case 2 :
496
-						if ( ! isset( $this->{$section} ) ) {
497
-							if ( $display_errors ) {
496
+						if ( ! isset($this->{$section} )) {
497
+							if ($display_errors) {
498 498
 								throw new EE_Error(
499 499
 									sprintf(
500
-										__( 'The "%s" configuration section does not exist.', 'event_espresso' ),
500
+										__('The "%s" configuration section does not exist.', 'event_espresso'),
501 501
 										$section
502 502
 									)
503 503
 								);
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
 					// TEST #3 : check that section is the proper format
509 509
 					case 3 :
510 510
 						if (
511
-						! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
511
+						! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
512 512
 						) {
513
-							if ( $display_errors ) {
513
+							if ($display_errors) {
514 514
 								throw new EE_Error(
515 515
 									sprintf(
516 516
 										__(
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 						break;
527 527
 					// TEST #4 : check that config section name has been set
528 528
 					case 4 :
529
-						if ( empty( $name ) ) {
530
-							if ( $display_errors ) {
529
+						if (empty($name)) {
530
+							if ($display_errors) {
531 531
 								throw new EE_Error(
532 532
 									__(
533 533
 										'No name has been provided for the specific configuration section.',
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 						break;
541 541
 					// TEST #5 : check that a config class name has been set
542 542
 					case 5 :
543
-						if ( empty( $config_class ) ) {
544
-							if ( $display_errors ) {
543
+						if (empty($config_class)) {
544
+							if ($display_errors) {
545 545
 								throw new EE_Error(
546 546
 									__(
547 547
 										'No class name has been provided for the specific configuration section.',
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 						break;
555 555
 					// TEST #6 : verify config class is accessible
556 556
 					case 6 :
557
-						if ( ! class_exists( $config_class ) ) {
558
-							if ( $display_errors ) {
557
+						if ( ! class_exists($config_class)) {
558
+							if ($display_errors) {
559 559
 								throw new EE_Error(
560 560
 									sprintf(
561 561
 										__(
@@ -571,11 +571,11 @@  discard block
 block discarded – undo
571 571
 						break;
572 572
 					// TEST #7 : check that config has even been set
573 573
 					case 7 :
574
-						if ( ! isset( $this->{$section}->{$name} ) ) {
575
-							if ( $display_errors ) {
574
+						if ( ! isset($this->{$section}->{$name} )) {
575
+							if ($display_errors) {
576 576
 								throw new EE_Error(
577 577
 									sprintf(
578
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
578
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
579 579
 										$section,
580 580
 										$name
581 581
 									)
@@ -584,13 +584,13 @@  discard block
 block discarded – undo
584 584
 							return false;
585 585
 						} else {
586 586
 							// and make sure it's not serialized
587
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
587
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
588 588
 						}
589 589
 						break;
590 590
 					// TEST #8 : check that config is the requested type
591 591
 					case 8 :
592
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
593
-							if ( $display_errors ) {
592
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
593
+							if ($display_errors) {
594 594
 								throw new EE_Error(
595 595
 									sprintf(
596 596
 										__(
@@ -608,12 +608,12 @@  discard block
 block discarded – undo
608 608
 						break;
609 609
 					// TEST #9 : verify config object
610 610
 					case 9 :
611
-						if ( ! $config_obj instanceof EE_Config_Base ) {
612
-							if ( $display_errors ) {
611
+						if ( ! $config_obj instanceof EE_Config_Base) {
612
+							if ($display_errors) {
613 613
 								throw new EE_Error(
614 614
 									sprintf(
615
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
616
-										print_r( $config_obj, true )
615
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
616
+										print_r($config_obj, true)
617 617
 									)
618 618
 								);
619 619
 							}
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 						break;
623 623
 				}
624 624
 			}
625
-		} catch ( EE_Error $e ) {
625
+		} catch (EE_Error $e) {
626 626
 			$e->get_error();
627 627
 		}
628 628
 		// you have successfully run the gauntlet
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @param        string $name
640 640
 	 * @return        string
641 641
 	 */
642
-	private function _generate_config_option_name( $section = '', $name = '' ) {
643
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
642
+	private function _generate_config_option_name($section = '', $name = '') {
643
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
644 644
 	}
645 645
 
646 646
 
@@ -654,10 +654,10 @@  discard block
 block discarded – undo
654 654
 	 * @param    string $name
655 655
 	 * @return    string
656 656
 	 */
657
-	private function _set_config_class( $config_class = '', $name = '' ) {
658
-		return ! empty( $config_class )
657
+	private function _set_config_class($config_class = '', $name = '') {
658
+		return ! empty($config_class)
659 659
 			? $config_class
660
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
660
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
661 661
 	}
662 662
 
663 663
 
@@ -672,36 +672,36 @@  discard block
 block discarded – undo
672 672
 	 * @param    EE_Config_Base $config_obj
673 673
 	 * @return    EE_Config_Base
674 674
 	 */
675
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
675
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
676 676
 		// ensure config class is set to something
677
-		$config_class = $this->_set_config_class( $config_class, $name );
677
+		$config_class = $this->_set_config_class($config_class, $name);
678 678
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
679
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) {
679
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
680 680
 			return null;
681 681
 		}
682
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
682
+		$config_option_name = $this->_generate_config_option_name($section, $name);
683 683
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
684
-		if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) {
685
-			$this->_addon_option_names[ $config_option_name ] = $config_class;
684
+		if ( ! isset($this->_addon_option_names[$config_option_name])) {
685
+			$this->_addon_option_names[$config_option_name] = $config_class;
686 686
 			$this->update_addon_option_names();
687 687
 		}
688 688
 		// verify the incoming config object but suppress errors
689
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) {
689
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
690 690
 			$config_obj = new $config_class();
691 691
 		}
692
-		if ( get_option( $config_option_name ) ) {
693
-			EE_Config::log( $config_option_name );
694
-			update_option( $config_option_name, $config_obj );
692
+		if (get_option($config_option_name)) {
693
+			EE_Config::log($config_option_name);
694
+			update_option($config_option_name, $config_obj);
695 695
 			$this->{$section}->{$name} = $config_obj;
696 696
 			return $this->{$section}->{$name};
697 697
 		} else {
698 698
 			// create a wp-option for this config
699
-			if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) {
700
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
699
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
700
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
701 701
 				return $this->{$section}->{$name};
702 702
 			} else {
703 703
 				EE_Error::add_error(
704
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
704
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
705 705
 					__FILE__,
706 706
 					__FUNCTION__,
707 707
 					__LINE__
@@ -724,40 +724,40 @@  discard block
 block discarded – undo
724 724
 	 * @param    bool                  $throw_errors
725 725
 	 * @return    bool
726 726
 	 */
727
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
728
-		$config_obj = maybe_unserialize( $config_obj );
727
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
728
+		$config_obj = maybe_unserialize($config_obj);
729 729
 		// get class name of the incoming object
730
-		$config_class = get_class( $config_obj );
730
+		$config_class = get_class($config_obj);
731 731
 		// run tests 1-5 and 9 to verify config
732 732
 		if ( ! $this->_verify_config_params(
733 733
 			$section,
734 734
 			$name,
735 735
 			$config_class,
736 736
 			$config_obj,
737
-			array( 1, 2, 3, 4, 7, 9 )
737
+			array(1, 2, 3, 4, 7, 9)
738 738
 		)
739 739
 		) {
740 740
 			return false;
741 741
 		}
742
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
742
+		$config_option_name = $this->_generate_config_option_name($section, $name);
743 743
 		// check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
744
-		if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) {
744
+		if ( ! isset($this->_addon_option_names[$config_option_name])) {
745 745
 			// save new config to db
746
-			return $this->set_config( $section, $name, $config_class, $config_obj );
746
+			return $this->set_config($section, $name, $config_class, $config_obj);
747 747
 		} else {
748 748
 			// first check if the record already exists
749
-			$existing_config = get_option( $config_option_name );
750
-			$config_obj = serialize( $config_obj );
749
+			$existing_config = get_option($config_option_name);
750
+			$config_obj = serialize($config_obj);
751 751
 			// just return if db record is already up to date (NOT type safe comparison)
752
-			if ( $existing_config == $config_obj ) {
752
+			if ($existing_config == $config_obj) {
753 753
 				$this->{$section}->{$name} = $config_obj;
754 754
 				return true;
755
-			} else if ( update_option( $config_option_name, $config_obj ) ) {
756
-				EE_Config::log( $config_option_name );
755
+			} else if (update_option($config_option_name, $config_obj)) {
756
+				EE_Config::log($config_option_name);
757 757
 				// update wp-option for this config class
758 758
 				$this->{$section}->{$name} = $config_obj;
759 759
 				return true;
760
-			} elseif ( $throw_errors ) {
760
+			} elseif ($throw_errors) {
761 761
 				EE_Error::add_error(
762 762
 					sprintf(
763 763
 						__(
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 							'event_espresso'
766 766
 						),
767 767
 						$config_class,
768
-						'EE_Config->' . $section . '->' . $name
768
+						'EE_Config->'.$section.'->'.$name
769 769
 					),
770 770
 					__FILE__,
771 771
 					__FUNCTION__,
@@ -787,34 +787,34 @@  discard block
 block discarded – undo
787 787
 	 * @param    string $config_class
788 788
 	 * @return    mixed EE_Config_Base | NULL
789 789
 	 */
790
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
790
+	public function get_config($section = '', $name = '', $config_class = '') {
791 791
 		// ensure config class is set to something
792
-		$config_class = $this->_set_config_class( $config_class, $name );
792
+		$config_class = $this->_set_config_class($config_class, $name);
793 793
 		// run tests 1-4, 6 and 7 to verify that all params have been set
794
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) {
794
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
795 795
 			return null;
796 796
 		}
797 797
 		// now test if the requested config object exists, but suppress errors
798
-		if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) {
798
+		if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) {
799 799
 			// config already exists, so pass it back
800 800
 			return $this->{$section}->{$name};
801 801
 		}
802 802
 		// load config option from db if it exists
803
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) );
803
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
804 804
 		// verify the newly retrieved config object, but suppress errors
805
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) {
805
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
806 806
 			// config is good, so set it and pass it back
807 807
 			$this->{$section}->{$name} = $config_obj;
808 808
 			return $this->{$section}->{$name};
809 809
 		}
810 810
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
811
-		$config_obj = $this->set_config( $section, $name, $config_class );
811
+		$config_obj = $this->set_config($section, $name, $config_class);
812 812
 		// verify the newly created config object
813
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) {
813
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
814 814
 			return $this->{$section}->{$name};
815 815
 		} else {
816 816
 			EE_Error::add_error(
817
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
817
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
818 818
 				__FILE__,
819 819
 				__FUNCTION__,
820 820
 				__LINE__
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
 	 * @param    string $config_option_name
833 833
 	 * @return    mixed EE_Config_Base | FALSE
834 834
 	 */
835
-	public function get_config_option( $config_option_name = '' ) {
835
+	public function get_config_option($config_option_name = '') {
836 836
 		// retrieve the wp-option for this config class.
837
-		return maybe_unserialize( get_option( $config_option_name ) );
837
+		return maybe_unserialize(get_option($config_option_name));
838 838
 	}
839 839
 
840 840
 
@@ -844,11 +844,11 @@  discard block
 block discarded – undo
844 844
 	 *
845 845
 	 * @param string $config_option_name
846 846
 	 */
847
-	public static function log( $config_option_name = '' ) {
848
-		if ( ! empty( $config_option_name ) ) {
849
-			$config_log = get_option( EE_Config::LOG_NAME, array() );
850
-			$config_log[ (string) microtime( true ) ] = $config_option_name;
851
-			update_option( EE_Config::LOG_NAME, $config_log );
847
+	public static function log($config_option_name = '') {
848
+		if ( ! empty($config_option_name)) {
849
+			$config_log = get_option(EE_Config::LOG_NAME, array());
850
+			$config_log[(string) microtime(true)] = $config_option_name;
851
+			update_option(EE_Config::LOG_NAME, $config_log);
852 852
 		}
853 853
 	}
854 854
 
@@ -859,12 +859,12 @@  discard block
 block discarded – undo
859 859
 	 * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH
860 860
 	 */
861 861
 	public static function trim_log() {
862
-		$config_log = get_option( EE_Config::LOG_NAME, array() );
863
-		$log_length = count( $config_log );
864
-		if ( $log_length > EE_Config::LOG_LENGTH ) {
865
-			ksort( $config_log );
866
-			$config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true );
867
-			update_option( EE_Config::LOG_NAME, $config_log );
862
+		$config_log = get_option(EE_Config::LOG_NAME, array());
863
+		$log_length = count($config_log);
864
+		if ($log_length > EE_Config::LOG_LENGTH) {
865
+			ksort($config_log);
866
+			$config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true);
867
+			update_option(EE_Config::LOG_NAME, $config_log);
868 868
 		}
869 869
 	}
870 870
 
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 	 * @return    string
880 880
 	 */
881 881
 	public static function get_page_for_posts() {
882
-		$page_for_posts = get_option( 'page_for_posts' );
883
-		if ( ! $page_for_posts ) {
882
+		$page_for_posts = get_option('page_for_posts');
883
+		if ( ! $page_for_posts) {
884 884
 			return 'posts';
885 885
 		}
886 886
 		/** @type WPDB $wpdb */
887 887
 		global $wpdb;
888 888
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
889
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) );
889
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
890 890
 	}
891 891
 
892 892
 
@@ -942,17 +942,17 @@  discard block
 block discarded – undo
942 942
 			)
943 943
 		) {
944 944
 			// grab list of installed widgets
945
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
945
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
946 946
 			// filter list of modules to register
947 947
 			$widgets_to_register = apply_filters(
948 948
 				'FHEE__EE_Config__register_widgets__widgets_to_register',
949 949
 				$widgets_to_register
950 950
 			);
951
-			if ( ! empty( $widgets_to_register ) ) {
951
+			if ( ! empty($widgets_to_register)) {
952 952
 				// cycle thru widget folders
953
-				foreach ( $widgets_to_register as $widget_path ) {
953
+				foreach ($widgets_to_register as $widget_path) {
954 954
 					// add to list of installed widget modules
955
-					EE_Config::register_ee_widget( $widget_path );
955
+					EE_Config::register_ee_widget($widget_path);
956 956
 				}
957 957
 			}
958 958
 			// filter list of installed modules
@@ -972,57 +972,57 @@  discard block
 block discarded – undo
972 972
 	 * @param    string $widget_path - full path up to and including widget folder
973 973
 	 * @return    void
974 974
 	 */
975
-	public static function register_ee_widget( $widget_path = null ) {
976
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
975
+	public static function register_ee_widget($widget_path = null) {
976
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
977 977
 		$widget_ext = '.widget.php';
978 978
 		// make all separators match
979
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
979
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
980 980
 		// does the file path INCLUDE the actual file name as part of the path ?
981
-		if ( strpos( $widget_path, $widget_ext ) !== false ) {
981
+		if (strpos($widget_path, $widget_ext) !== false) {
982 982
 			// grab and shortcode file name from directory name and break apart at dots
983
-			$file_name = explode( '.', basename( $widget_path ) );
983
+			$file_name = explode('.', basename($widget_path));
984 984
 			// take first segment from file name pieces and remove class prefix if it exists
985
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
985
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
986 986
 			// sanitize shortcode directory name
987
-			$widget = sanitize_key( $widget );
987
+			$widget = sanitize_key($widget);
988 988
 			// now we need to rebuild the shortcode path
989
-			$widget_path = explode( DS, $widget_path );
989
+			$widget_path = explode(DS, $widget_path);
990 990
 			// remove last segment
991
-			array_pop( $widget_path );
991
+			array_pop($widget_path);
992 992
 			// glue it back together
993
-			$widget_path = implode( DS, $widget_path );
993
+			$widget_path = implode(DS, $widget_path);
994 994
 		} else {
995 995
 			// grab and sanitize widget directory name
996
-			$widget = sanitize_key( basename( $widget_path ) );
996
+			$widget = sanitize_key(basename($widget_path));
997 997
 		}
998 998
 		// create classname from widget directory name
999
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) );
999
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1000 1000
 		// add class prefix
1001
-		$widget_class = 'EEW_' . $widget;
1001
+		$widget_class = 'EEW_'.$widget;
1002 1002
 		// does the widget exist ?
1003
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) {
1003
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
1004 1004
 			$msg = sprintf(
1005 1005
 				__(
1006 1006
 					'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',
1007 1007
 					'event_espresso'
1008 1008
 				),
1009 1009
 				$widget_class,
1010
-				$widget_path . DS . $widget_class . $widget_ext
1010
+				$widget_path.DS.$widget_class.$widget_ext
1011 1011
 			);
1012
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1012
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1013 1013
 			return;
1014 1014
 		}
1015 1015
 		// load the widget class file
1016
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
1016
+		require_once($widget_path.DS.$widget_class.$widget_ext);
1017 1017
 		// verify that class exists
1018
-		if ( ! class_exists( $widget_class ) ) {
1019
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
1020
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1018
+		if ( ! class_exists($widget_class)) {
1019
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1020
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1021 1021
 			return;
1022 1022
 		}
1023
-		register_widget( $widget_class );
1023
+		register_widget($widget_class);
1024 1024
 		// add to array of registered widgets
1025
-		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
1025
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
1026 1026
 	}
1027 1027
 
1028 1028
 
@@ -1035,17 +1035,17 @@  discard block
 block discarded – undo
1035 1035
 	 */
1036 1036
 	private function _register_shortcodes() {
1037 1037
 		// grab list of installed shortcodes
1038
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
1038
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
1039 1039
 		// filter list of modules to register
1040 1040
 		$shortcodes_to_register = apply_filters(
1041 1041
 			'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
1042 1042
 			$shortcodes_to_register
1043 1043
 		);
1044
-		if ( ! empty( $shortcodes_to_register ) ) {
1044
+		if ( ! empty($shortcodes_to_register)) {
1045 1045
 			// cycle thru shortcode folders
1046
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
1046
+			foreach ($shortcodes_to_register as $shortcode_path) {
1047 1047
 				// add to list of installed shortcode modules
1048
-				EE_Config::register_shortcode( $shortcode_path );
1048
+				EE_Config::register_shortcode($shortcode_path);
1049 1049
 			}
1050 1050
 		}
1051 1051
 		// filter list of installed modules
@@ -1064,64 +1064,64 @@  discard block
 block discarded – undo
1064 1064
 	 * @param    string $shortcode_path - full path up to and including shortcode folder
1065 1065
 	 * @return    bool
1066 1066
 	 */
1067
-	public static function register_shortcode( $shortcode_path = null ) {
1068
-		do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path );
1067
+	public static function register_shortcode($shortcode_path = null) {
1068
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
1069 1069
 		$shortcode_ext = '.shortcode.php';
1070 1070
 		// make all separators match
1071
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
1071
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
1072 1072
 		// does the file path INCLUDE the actual file name as part of the path ?
1073
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) {
1073
+		if (strpos($shortcode_path, $shortcode_ext) !== false) {
1074 1074
 			// grab shortcode file name from directory name and break apart at dots
1075
-			$shortcode_file = explode( '.', basename( $shortcode_path ) );
1075
+			$shortcode_file = explode('.', basename($shortcode_path));
1076 1076
 			// take first segment from file name pieces and remove class prefix if it exists
1077
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0
1078
-				? substr( $shortcode_file[0], 4 )
1077
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0
1078
+				? substr($shortcode_file[0], 4)
1079 1079
 				: $shortcode_file[0];
1080 1080
 			// sanitize shortcode directory name
1081
-			$shortcode = sanitize_key( $shortcode );
1081
+			$shortcode = sanitize_key($shortcode);
1082 1082
 			// now we need to rebuild the shortcode path
1083
-			$shortcode_path = explode( DS, $shortcode_path );
1083
+			$shortcode_path = explode(DS, $shortcode_path);
1084 1084
 			// remove last segment
1085
-			array_pop( $shortcode_path );
1085
+			array_pop($shortcode_path);
1086 1086
 			// glue it back together
1087
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
1087
+			$shortcode_path = implode(DS, $shortcode_path).DS;
1088 1088
 		} else {
1089 1089
 			// we need to generate the filename based off of the folder name
1090 1090
 			// grab and sanitize shortcode directory name
1091
-			$shortcode = sanitize_key( basename( $shortcode_path ) );
1092
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
1091
+			$shortcode = sanitize_key(basename($shortcode_path));
1092
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
1093 1093
 		}
1094 1094
 		// create classname from shortcode directory or file name
1095
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) );
1095
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1096 1096
 		// add class prefix
1097
-		$shortcode_class = 'EES_' . $shortcode;
1097
+		$shortcode_class = 'EES_'.$shortcode;
1098 1098
 		// does the shortcode exist ?
1099
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) {
1099
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1100 1100
 			$msg = sprintf(
1101 1101
 				__(
1102 1102
 					'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s',
1103 1103
 					'event_espresso'
1104 1104
 				),
1105 1105
 				$shortcode_class,
1106
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1106
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1107 1107
 			);
1108
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1108
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1109 1109
 			return false;
1110 1110
 		}
1111 1111
 		// load the shortcode class file
1112
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1112
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1113 1113
 		// verify that class exists
1114
-		if ( ! class_exists( $shortcode_class ) ) {
1114
+		if ( ! class_exists($shortcode_class)) {
1115 1115
 			$msg = sprintf(
1116
-				__( 'The requested %s shortcode class does not exist.', 'event_espresso' ),
1116
+				__('The requested %s shortcode class does not exist.', 'event_espresso'),
1117 1117
 				$shortcode_class
1118 1118
 			);
1119
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1119
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1120 1120
 			return false;
1121 1121
 		}
1122
-		$shortcode = strtoupper( $shortcode );
1122
+		$shortcode = strtoupper($shortcode);
1123 1123
 		// add to array of registered shortcodes
1124
-		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1124
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1125 1125
 		return true;
1126 1126
 	}
1127 1127
 
@@ -1135,22 +1135,22 @@  discard block
 block discarded – undo
1135 1135
 	 */
1136 1136
 	private function _register_modules() {
1137 1137
 		// grab list of installed modules
1138
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1138
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1139 1139
 		// filter list of modules to register
1140 1140
 		$modules_to_register = apply_filters(
1141 1141
 			'FHEE__EE_Config__register_modules__modules_to_register',
1142 1142
 			$modules_to_register
1143 1143
 		);
1144
-		if ( ! empty( $modules_to_register ) ) {
1144
+		if ( ! empty($modules_to_register)) {
1145 1145
 			// loop through folders
1146
-			foreach ( $modules_to_register as $module_path ) {
1146
+			foreach ($modules_to_register as $module_path) {
1147 1147
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1148 1148
 				if (
1149
-					$module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1150
-					&& $module_path !== EE_MODULES . 'gateways'
1149
+					$module_path !== EE_MODULES.'zzz-copy-this-module-template'
1150
+					&& $module_path !== EE_MODULES.'gateways'
1151 1151
 				) {
1152 1152
 					// add to list of installed modules
1153
-					EE_Config::register_module( $module_path );
1153
+					EE_Config::register_module($module_path);
1154 1154
 				}
1155 1155
 			}
1156 1156
 		}
@@ -1170,39 +1170,39 @@  discard block
 block discarded – undo
1170 1170
 	 * @param    string $module_path - full path up to and including module folder
1171 1171
 	 * @return    bool
1172 1172
 	 */
1173
-	public static function register_module( $module_path = null ) {
1174
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1173
+	public static function register_module($module_path = null) {
1174
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1175 1175
 		$module_ext = '.module.php';
1176 1176
 		// make all separators match
1177
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1177
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1178 1178
 		// does the file path INCLUDE the actual file name as part of the path ?
1179
-		if ( strpos( $module_path, $module_ext ) !== false ) {
1179
+		if (strpos($module_path, $module_ext) !== false) {
1180 1180
 			// grab and shortcode file name from directory name and break apart at dots
1181
-			$module_file = explode( '.', basename( $module_path ) );
1181
+			$module_file = explode('.', basename($module_path));
1182 1182
 			// now we need to rebuild the shortcode path
1183
-			$module_path = explode( DS, $module_path );
1183
+			$module_path = explode(DS, $module_path);
1184 1184
 			// remove last segment
1185
-			array_pop( $module_path );
1185
+			array_pop($module_path);
1186 1186
 			// glue it back together
1187
-			$module_path = implode( DS, $module_path ) . DS;
1187
+			$module_path = implode(DS, $module_path).DS;
1188 1188
 			// take first segment from file name pieces and sanitize it
1189
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1189
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1190 1190
 			// ensure class prefix is added
1191
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1191
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1192 1192
 		} else {
1193 1193
 			// we need to generate the filename based off of the folder name
1194 1194
 			// grab and sanitize module name
1195
-			$module = strtolower( basename( $module_path ) );
1196
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module );
1195
+			$module = strtolower(basename($module_path));
1196
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1197 1197
 			// like trailingslashit()
1198
-			$module_path = rtrim( $module_path, DS ) . DS;
1198
+			$module_path = rtrim($module_path, DS).DS;
1199 1199
 			// create classname from module directory name
1200
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) );
1200
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1201 1201
 			// add class prefix
1202
-			$module_class = 'EED_' . $module;
1202
+			$module_class = 'EED_'.$module;
1203 1203
 		}
1204 1204
 		// does the module exist ?
1205
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) {
1205
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1206 1206
 			$msg = sprintf(
1207 1207
 				__(
1208 1208
 					'The requested %s module file could not be found or is not readable due to file permissions.',
@@ -1210,19 +1210,19 @@  discard block
 block discarded – undo
1210 1210
 				),
1211 1211
 				$module
1212 1212
 			);
1213
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1213
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1214 1214
 			return false;
1215 1215
 		}
1216 1216
 		// load the module class file
1217
-		require_once( $module_path . $module_class . $module_ext );
1217
+		require_once($module_path.$module_class.$module_ext);
1218 1218
 		// verify that class exists
1219
-		if ( ! class_exists( $module_class ) ) {
1220
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1221
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1219
+		if ( ! class_exists($module_class)) {
1220
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1221
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1222 1222
 			return false;
1223 1223
 		}
1224 1224
 		// add to array of registered modules
1225
-		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1225
+		EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1226 1226
 		do_action(
1227 1227
 			'AHEE__EE_Config__register_module__complete',
1228 1228
 			$module_class,
@@ -1242,26 +1242,26 @@  discard block
 block discarded – undo
1242 1242
 	 */
1243 1243
 	private function _initialize_shortcodes() {
1244 1244
 		// cycle thru shortcode folders
1245
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1245
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1246 1246
 			// add class prefix
1247
-			$shortcode_class = 'EES_' . $shortcode;
1247
+			$shortcode_class = 'EES_'.$shortcode;
1248 1248
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1249 1249
 			// which set hooks ?
1250
-			if ( is_admin() ) {
1250
+			if (is_admin()) {
1251 1251
 				// fire immediately
1252
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ) );
1252
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1253 1253
 			} else {
1254 1254
 				// delay until other systems are online
1255 1255
 				add_action(
1256 1256
 					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1257
-					array( $shortcode_class, 'set_hooks' )
1257
+					array($shortcode_class, 'set_hooks')
1258 1258
 				);
1259 1259
 				// convert classname to UPPERCASE and create WP shortcode.
1260
-				$shortcode_tag = strtoupper( $shortcode );
1260
+				$shortcode_tag = strtoupper($shortcode);
1261 1261
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1262
-				if ( ! shortcode_exists( $shortcode_tag ) ) {
1262
+				if ( ! shortcode_exists($shortcode_tag)) {
1263 1263
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1264
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) );
1264
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1265 1265
 				}
1266 1266
 			}
1267 1267
 		}
@@ -1278,17 +1278,17 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	private function _initialize_modules() {
1280 1280
 		// cycle thru shortcode folders
1281
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1281
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1282 1282
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1283 1283
 			// which set hooks ?
1284
-			if ( is_admin() ) {
1284
+			if (is_admin()) {
1285 1285
 				// fire immediately
1286
-				call_user_func( array( $module_class, 'set_hooks_admin' ) );
1286
+				call_user_func(array($module_class, 'set_hooks_admin'));
1287 1287
 			} else {
1288 1288
 				// delay until other systems are online
1289 1289
 				add_action(
1290 1290
 					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1291
-					array( $module_class, 'set_hooks' )
1291
+					array($module_class, 'set_hooks')
1292 1292
 				);
1293 1293
 			}
1294 1294
 		}
@@ -1306,29 +1306,29 @@  discard block
 block discarded – undo
1306 1306
 	 * @param    string $key         - url param key indicating a route is being called
1307 1307
 	 * @return    bool
1308 1308
 	 */
1309
-	public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) {
1310
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1311
-		$module = str_replace( 'EED_', '', $module );
1312
-		$module_class = 'EED_' . $module;
1313
-		if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) {
1314
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1315
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1309
+	public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') {
1310
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1311
+		$module = str_replace('EED_', '', $module);
1312
+		$module_class = 'EED_'.$module;
1313
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) {
1314
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1315
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1316 1316
 			return false;
1317 1317
 		}
1318
-		if ( empty( $route ) ) {
1319
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1320
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1318
+		if (empty($route)) {
1319
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1320
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1321 1321
 			return false;
1322 1322
 		}
1323
-		if ( ! method_exists( 'EED_' . $module, $method_name ) ) {
1323
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1324 1324
 			$msg = sprintf(
1325
-				__( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ),
1325
+				__('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1326 1326
 				$route
1327 1327
 			);
1328
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1328
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1329 1329
 			return false;
1330 1330
 		}
1331
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1331
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1332 1332
 		return true;
1333 1333
 	}
1334 1334
 
@@ -1342,11 +1342,11 @@  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_route( $route = null, $key = 'ee' ) {
1346
-		do_action( 'AHEE__EE_Config__get_route__begin', $route );
1347
-		$route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route );
1348
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) {
1349
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1345
+	public static function get_route($route = null, $key = 'ee') {
1346
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1347
+		$route = (string) apply_filters('FHEE__EE_Config__get_route', $route);
1348
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1349
+			return EE_Config::$_module_route_map[$key][$route];
1350 1350
 		}
1351 1351
 		return null;
1352 1352
 	}
@@ -1376,49 +1376,49 @@  discard block
 block discarded – undo
1376 1376
 	 * @param    string       $key     - url param key indicating a route is being called
1377 1377
 	 * @return    bool
1378 1378
 	 */
1379
-	public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) {
1380
-		do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward );
1381
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) {
1379
+	public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') {
1380
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1381
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1382 1382
 			$msg = sprintf(
1383
-				__( 'The module route %s for this forward has not been registered.', 'event_espresso' ),
1383
+				__('The module route %s for this forward has not been registered.', 'event_espresso'),
1384 1384
 				$route
1385 1385
 			);
1386
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1386
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1387 1387
 			return false;
1388 1388
 		}
1389
-		if ( empty( $forward ) ) {
1390
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1391
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1389
+		if (empty($forward)) {
1390
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1391
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1392 1392
 			return false;
1393 1393
 		}
1394
-		if ( is_array( $forward ) ) {
1395
-			if ( ! isset( $forward[1] ) ) {
1394
+		if (is_array($forward)) {
1395
+			if ( ! isset($forward[1])) {
1396 1396
 				$msg = sprintf(
1397
-					__( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ),
1397
+					__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1398 1398
 					$route
1399 1399
 				);
1400
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1400
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1401 1401
 				return false;
1402 1402
 			}
1403
-			if ( ! method_exists( $forward[0], $forward[1] ) ) {
1403
+			if ( ! method_exists($forward[0], $forward[1])) {
1404 1404
 				$msg = sprintf(
1405
-					__( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ),
1405
+					__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1406 1406
 					$forward[1],
1407 1407
 					$route
1408 1408
 				);
1409
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1409
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1410 1410
 				return false;
1411 1411
 			}
1412
-		} else if ( ! function_exists( $forward ) ) {
1412
+		} else if ( ! function_exists($forward)) {
1413 1413
 			$msg = sprintf(
1414
-				__( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ),
1414
+				__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1415 1415
 				$forward,
1416 1416
 				$route
1417 1417
 			);
1418
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1418
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1419 1419
 			return false;
1420 1420
 		}
1421
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1421
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1422 1422
 		return true;
1423 1423
 	}
1424 1424
 
@@ -1434,12 +1434,12 @@  discard block
 block discarded – undo
1434 1434
 	 * @param    string  $key    - url param key indicating a route is being called
1435 1435
 	 * @return    string
1436 1436
 	 */
1437
-	public static function get_forward( $route = null, $status = 0, $key = 'ee' ) {
1438
-		do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status );
1439
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) {
1437
+	public static function get_forward($route = null, $status = 0, $key = 'ee') {
1438
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1439
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1440 1440
 			return apply_filters(
1441 1441
 				'FHEE__EE_Config__get_forward',
1442
-				EE_Config::$_module_forward_map[ $key ][ $route ][ $status ],
1442
+				EE_Config::$_module_forward_map[$key][$route][$status],
1443 1443
 				$route,
1444 1444
 				$status
1445 1445
 			);
@@ -1461,17 +1461,17 @@  discard block
 block discarded – undo
1461 1461
 	 * @param    string  $key    - url param key indicating a route is being called
1462 1462
 	 * @return    bool
1463 1463
 	 */
1464
-	public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) {
1465
-		do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view );
1466
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) {
1464
+	public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') {
1465
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1466
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1467 1467
 			$msg = sprintf(
1468
-				__( 'The module route %s for this view has not been registered.', 'event_espresso' ),
1468
+				__('The module route %s for this view has not been registered.', 'event_espresso'),
1469 1469
 				$route
1470 1470
 			);
1471
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1471
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1472 1472
 			return false;
1473 1473
 		}
1474
-		if ( ! is_readable( $view ) ) {
1474
+		if ( ! is_readable($view)) {
1475 1475
 			$msg = sprintf(
1476 1476
 				__(
1477 1477
 					'The %s view file could not be found or is not readable due to file permissions.',
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
 				),
1480 1480
 				$view
1481 1481
 			);
1482
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1482
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1483 1483
 			return false;
1484 1484
 		}
1485
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1485
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1486 1486
 		return true;
1487 1487
 	}
1488 1488
 
@@ -1498,12 +1498,12 @@  discard block
 block discarded – undo
1498 1498
 	 * @param    string  $key    - url param key indicating a route is being called
1499 1499
 	 * @return    string
1500 1500
 	 */
1501
-	public static function get_view( $route = null, $status = 0, $key = 'ee' ) {
1502
-		do_action( 'AHEE__EE_Config__get_view__begin', $route, $status );
1503
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) {
1501
+	public static function get_view($route = null, $status = 0, $key = 'ee') {
1502
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1503
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1504 1504
 			return apply_filters(
1505 1505
 				'FHEE__EE_Config__get_view',
1506
-				EE_Config::$_module_view_map[ $key ][ $route ][ $status ],
1506
+				EE_Config::$_module_view_map[$key][$route][$status],
1507 1507
 				$route,
1508 1508
 				$status
1509 1509
 			);
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 
1515 1515
 
1516 1516
 	public function update_addon_option_names() {
1517
-		update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names );
1517
+		update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names);
1518 1518
 	}
1519 1519
 
1520 1520
 
@@ -1537,22 +1537,22 @@  discard block
 block discarded – undo
1537 1537
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1538 1538
 	 * @throws \EE_Error
1539 1539
 	 */
1540
-	public function get_pretty( $property ) {
1541
-		if ( ! property_exists( $this, $property ) ) {
1540
+	public function get_pretty($property) {
1541
+		if ( ! property_exists($this, $property)) {
1542 1542
 			throw new EE_Error(
1543 1543
 				sprintf(
1544 1544
 					__(
1545 1545
 						'%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.',
1546 1546
 						'event_espresso'
1547 1547
 					),
1548
-					get_class( $this ),
1548
+					get_class($this),
1549 1549
 					$property
1550 1550
 				)
1551 1551
 			);
1552 1552
 		}
1553 1553
 		//just handling escaping of strings for now.
1554
-		if ( is_string( $this->{$property} ) ) {
1555
-			return stripslashes( $this->{$property} );
1554
+		if (is_string($this->{$property} )) {
1555
+			return stripslashes($this->{$property} );
1556 1556
 		}
1557 1557
 		return $this->{$property};
1558 1558
 	}
@@ -1561,17 +1561,17 @@  discard block
 block discarded – undo
1561 1561
 
1562 1562
 	public function populate() {
1563 1563
 		//grab defaults via a new instance of this class.
1564
-		$class_name = get_class( $this );
1564
+		$class_name = get_class($this);
1565 1565
 		$defaults = new $class_name;
1566 1566
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1567 1567
 		//default from our $defaults object.
1568
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1569
-			if ( $this->{$property} === null ) {
1568
+		foreach (get_object_vars($defaults) as $property => $value) {
1569
+			if ($this->{$property} === null) {
1570 1570
 				$this->{$property} = $value;
1571 1571
 			}
1572 1572
 		}
1573 1573
 		//cleanup
1574
-		unset( $defaults );
1574
+		unset($defaults);
1575 1575
 	}
1576 1576
 
1577 1577
 
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 	 * @param $a
1588 1588
 	 * @return bool
1589 1589
 	 */
1590
-	public function __isset( $a ) {
1590
+	public function __isset($a) {
1591 1591
 		return false;
1592 1592
 	}
1593 1593
 
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 	 * @param $a
1600 1600
 	 * @return bool
1601 1601
 	 */
1602
-	public function __unset( $a ) {
1602
+	public function __unset($a) {
1603 1603
 		return false;
1604 1604
 	}
1605 1605
 
@@ -1698,18 +1698,18 @@  discard block
 block discarded – undo
1698 1698
 	 */
1699 1699
 	public function __construct() {
1700 1700
 		$current_network_main_site = is_multisite() ? get_current_site() : null;
1701
-		$current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1701
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1702 1702
 		// set default organization settings
1703 1703
 		$this->current_blog_id = get_current_blog_id();
1704 1704
 		$this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id;
1705 1705
 		$this->ee_ueip_optin = is_main_site()
1706
-			? get_option( 'ee_ueip_optin', true )
1706
+			? get_option('ee_ueip_optin', true)
1707 1707
 			: get_blog_option(
1708 1708
 				$current_main_site_id,
1709 1709
 				'ee_ueip_optin',
1710 1710
 				true
1711 1711
 			);
1712
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true;
1712
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1713 1713
 		$this->post_shortcodes = array();
1714 1714
 		$this->module_route_map = array();
1715 1715
 		$this->module_forward_map = array();
@@ -1725,9 +1725,9 @@  discard block
 block discarded – undo
1725 1725
 		$this->thank_you_page_url = '';
1726 1726
 		$this->cancel_page_url = '';
1727 1727
 		//cpt slugs
1728
-		$this->event_cpt_slug = __( 'events', 'event_espresso' );
1728
+		$this->event_cpt_slug = __('events', 'event_espresso');
1729 1729
 		//ueip constant check
1730
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1730
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1731 1731
 			$this->ee_ueip_optin = false;
1732 1732
 			$this->ee_ueip_has_notified = true;
1733 1733
 		}
@@ -1770,8 +1770,8 @@  discard block
 block discarded – undo
1770 1770
 	 * @return    string
1771 1771
 	 */
1772 1772
 	public function reg_page_url() {
1773
-		if ( ! $this->reg_page_url ) {
1774
-			$this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout';
1773
+		if ( ! $this->reg_page_url) {
1774
+			$this->reg_page_url = get_permalink($this->reg_page_id).'#checkout';
1775 1775
 		}
1776 1776
 		return $this->reg_page_url;
1777 1777
 	}
@@ -1786,12 +1786,12 @@  discard block
 block discarded – undo
1786 1786
 	 * @access    public
1787 1787
 	 * @return    string
1788 1788
 	 */
1789
-	public function txn_page_url( $query_args = array() ) {
1790
-		if ( ! $this->txn_page_url ) {
1791
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1789
+	public function txn_page_url($query_args = array()) {
1790
+		if ( ! $this->txn_page_url) {
1791
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1792 1792
 		}
1793
-		if ( $query_args ) {
1794
-			return add_query_arg( $query_args, $this->txn_page_url );
1793
+		if ($query_args) {
1794
+			return add_query_arg($query_args, $this->txn_page_url);
1795 1795
 		} else {
1796 1796
 			return $this->txn_page_url;
1797 1797
 		}
@@ -1807,12 +1807,12 @@  discard block
 block discarded – undo
1807 1807
 	 * @access    public
1808 1808
 	 * @return    string
1809 1809
 	 */
1810
-	public function thank_you_page_url( $query_args = array() ) {
1811
-		if ( ! $this->thank_you_page_url ) {
1812
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1810
+	public function thank_you_page_url($query_args = array()) {
1811
+		if ( ! $this->thank_you_page_url) {
1812
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1813 1813
 		}
1814
-		if ( $query_args ) {
1815
-			return add_query_arg( $query_args, $this->thank_you_page_url );
1814
+		if ($query_args) {
1815
+			return add_query_arg($query_args, $this->thank_you_page_url);
1816 1816
 		} else {
1817 1817
 			return $this->thank_you_page_url;
1818 1818
 		}
@@ -1827,8 +1827,8 @@  discard block
 block discarded – undo
1827 1827
 	 * @return    string
1828 1828
 	 */
1829 1829
 	public function cancel_page_url() {
1830
-		if ( ! $this->cancel_page_url ) {
1831
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1830
+		if ( ! $this->cancel_page_url) {
1831
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1832 1832
 		}
1833 1833
 		return $this->cancel_page_url;
1834 1834
 	}
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 		//reset all url properties
1860 1860
 		$this->_reset_urls();
1861 1861
 		//return what to save to db
1862
-		return array_keys( get_object_vars( $this ) );
1862
+		return array_keys(get_object_vars($this));
1863 1863
 	}
1864 1864
 
1865 1865
 }
@@ -2007,14 +2007,14 @@  discard block
 block discarded – undo
2007 2007
 	 */
2008 2008
 	public function __construct() {
2009 2009
 		// set default organization settings
2010
-		$this->name = get_bloginfo( 'name' );
2010
+		$this->name = get_bloginfo('name');
2011 2011
 		$this->address_1 = '123 Onna Road';
2012 2012
 		$this->address_2 = 'PO Box 123';
2013 2013
 		$this->city = 'Inna City';
2014 2014
 		$this->STA_ID = 4;
2015 2015
 		$this->CNT_ISO = 'US';
2016 2016
 		$this->zip = '12345';
2017
-		$this->email = get_bloginfo( 'admin_email' );
2017
+		$this->email = get_bloginfo('admin_email');
2018 2018
 		$this->phone = '';
2019 2019
 		$this->vat = '123456789';
2020 2020
 		$this->logo_url = '';
@@ -2102,45 +2102,45 @@  discard block
 block discarded – undo
2102 2102
 	 * @param string $CNT_ISO
2103 2103
 	 * @return \EE_Currency_Config
2104 2104
 	 */
2105
-	public function __construct( $CNT_ISO = '' ) {
2105
+	public function __construct($CNT_ISO = '') {
2106 2106
 		// get country code from organization settings or use default
2107
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization )
2107
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2108 2108
 		           && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2109 2109
 			? EE_Registry::instance()->CFG->organization->CNT_ISO
2110 2110
 			: '';
2111 2111
 		// but override if requested
2112
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
2113
-		EE_Registry::instance()->load_helper( 'Activation' );
2112
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2113
+		EE_Registry::instance()->load_helper('Activation');
2114 2114
 		// 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
2115 2115
 		if (
2116
-			! empty( $CNT_ISO )
2116
+			! empty($CNT_ISO)
2117 2117
 			&& EE_Maintenance_Mode::instance()->models_can_query()
2118
-			&& EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() )
2118
+			&& EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())
2119 2119
 		) {
2120 2120
 			// retrieve the country settings from the db, just in case they have been customized
2121
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
2122
-			if ( $country instanceof EE_Country ) {
2123
-				$this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2124
-				$this->name = $country->currency_name_single();    // Dollar
2125
-				$this->plural = $country->currency_name_plural();    // Dollars
2126
-				$this->sign = $country->currency_sign();            // currency sign: $
2127
-				$this->sign_b4 = $country->currency_sign_before();        // currency sign before or after: $TRUE  or  FALSE$
2128
-				$this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2129
-				$this->dec_mrk = $country->currency_decimal_mark();    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2130
-				$this->thsnds = $country->currency_thousands_separator();    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2121
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2122
+			if ($country instanceof EE_Country) {
2123
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
2124
+				$this->name = $country->currency_name_single(); // Dollar
2125
+				$this->plural = $country->currency_name_plural(); // Dollars
2126
+				$this->sign = $country->currency_sign(); // currency sign: $
2127
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
2128
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
2129
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2130
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2131 2131
 			}
2132 2132
 		}
2133 2133
 		// fallback to hardcoded defaults, in case the above failed
2134
-		if ( empty( $this->code ) ) {
2134
+		if (empty($this->code)) {
2135 2135
 			// set default currency settings
2136
-			$this->code = 'USD';    // currency code: USD, CAD, EUR
2137
-			$this->name = __( 'Dollar', 'event_espresso' );    // Dollar
2138
-			$this->plural = __( 'Dollars', 'event_espresso' );    // Dollars
2139
-			$this->sign = '$';    // currency sign: $
2140
-			$this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2141
-			$this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2142
-			$this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2143
-			$this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2136
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
2137
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
2138
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
2139
+			$this->sign = '$'; // currency sign: $
2140
+			$this->sign_b4 = true; // currency sign before or after: $TRUE  or  FALSE$
2141
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
2142
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2143
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2144 2144
 		}
2145 2145
 	}
2146 2146
 }
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
 	 * @since 4.8.8.rc.019
2304 2304
 	 */
2305 2305
 	public function do_hooks() {
2306
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) );
2306
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2307 2307
 	}
2308 2308
 
2309 2309
 
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 	 * @return void
2313 2313
 	 */
2314 2314
 	public function set_default_reg_status_on_EEM_Event() {
2315
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2315
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2316 2316
 	}
2317 2317
 
2318 2318
 
@@ -2417,10 +2417,10 @@  discard block
 block discarded – undo
2417 2417
 	 * @param bool $reset
2418 2418
 	 * @return string
2419 2419
 	 */
2420
-	public function log_file_name( $reset = false ) {
2421
-		if ( empty( $this->log_file_name ) || $reset ) {
2422
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt';
2423
-			EE_Config::instance()->update_espresso_config( false, false );
2420
+	public function log_file_name($reset = false) {
2421
+		if (empty($this->log_file_name) || $reset) {
2422
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt';
2423
+			EE_Config::instance()->update_espresso_config(false, false);
2424 2424
 		}
2425 2425
 		return $this->log_file_name;
2426 2426
 	}
@@ -2431,10 +2431,10 @@  discard block
 block discarded – undo
2431 2431
 	 * @param bool $reset
2432 2432
 	 * @return string
2433 2433
 	 */
2434
-	public function debug_file_name( $reset = false ) {
2435
-		if ( empty( $this->debug_file_name ) || $reset ) {
2436
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt';
2437
-			EE_Config::instance()->update_espresso_config( false, false );
2434
+	public function debug_file_name($reset = false) {
2435
+		if (empty($this->debug_file_name) || $reset) {
2436
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt';
2437
+			EE_Config::instance()->update_espresso_config(false, false);
2438 2438
 		}
2439 2439
 		return $this->debug_file_name;
2440 2440
 	}
@@ -2606,21 +2606,21 @@  discard block
 block discarded – undo
2606 2606
 		// set default map settings
2607 2607
 		$this->use_google_maps = true;
2608 2608
 		// for event details pages (reg page)
2609
-		$this->event_details_map_width = 585;            // ee_map_width_single
2610
-		$this->event_details_map_height = 362;            // ee_map_height_single
2611
-		$this->event_details_map_zoom = 14;            // ee_map_zoom_single
2612
-		$this->event_details_display_nav = true;            // ee_map_nav_display_single
2613
-		$this->event_details_nav_size = false;            // ee_map_nav_size_single
2614
-		$this->event_details_control_type = 'default';        // ee_map_type_control_single
2615
-		$this->event_details_map_align = 'center';            // ee_map_align_single
2609
+		$this->event_details_map_width = 585; // ee_map_width_single
2610
+		$this->event_details_map_height = 362; // ee_map_height_single
2611
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2612
+		$this->event_details_display_nav = true; // ee_map_nav_display_single
2613
+		$this->event_details_nav_size = false; // ee_map_nav_size_single
2614
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2615
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2616 2616
 		// for event list pages
2617
-		$this->event_list_map_width = 300;            // ee_map_width
2618
-		$this->event_list_map_height = 185;        // ee_map_height
2619
-		$this->event_list_map_zoom = 12;            // ee_map_zoom
2620
-		$this->event_list_display_nav = false;        // ee_map_nav_display
2621
-		$this->event_list_nav_size = true;            // ee_map_nav_size
2622
-		$this->event_list_control_type = 'dropdown';        // ee_map_type_control
2623
-		$this->event_list_map_align = 'center';            // ee_map_align
2617
+		$this->event_list_map_width = 300; // ee_map_width
2618
+		$this->event_list_map_height = 185; // ee_map_height
2619
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2620
+		$this->event_list_display_nav = false; // ee_map_nav_display
2621
+		$this->event_list_nav_size = true; // ee_map_nav_size
2622
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2623
+		$this->event_list_map_align = 'center'; // ee_map_align
2624 2624
 	}
2625 2625
 
2626 2626
 }
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
 	 * @return void
2774 2774
 	 */
2775 2775
 	protected function _set_php_values() {
2776
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2776
+		$this->php->max_input_vars = ini_get('max_input_vars');
2777 2777
 		$this->php->version = phpversion();
2778 2778
 	}
2779 2779
 
@@ -2792,10 +2792,10 @@  discard block
 block discarded – undo
2792 2792
 	 * @type string $msg         Any message to be displayed.
2793 2793
 	 *                           }
2794 2794
 	 */
2795
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2796
-		if ( ! empty( $this->php->max_input_vars )
2797
-		     && ( $input_count >= $this->php->max_input_vars )
2798
-		     && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 )
2795
+	public function max_input_vars_limit_check($input_count = 0) {
2796
+		if ( ! empty($this->php->max_input_vars)
2797
+		     && ($input_count >= $this->php->max_input_vars)
2798
+		     && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)
2799 2799
 		) {
2800 2800
 			return sprintf(
2801 2801
 				__(
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
 	 */
2862 2862
 	public function __construct() {
2863 2863
 		$this->payment_settings = array();
2864
-		$this->active_gateways = array( 'Invoice' => false );
2864
+		$this->active_gateways = array('Invoice' => false);
2865 2865
 	}
2866 2866
 }
2867 2867
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +389 added lines, -389 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 				'edit' => __('Update Event', 'event_espresso'),
93 93
 				'add_category' => __('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => __('Update Category', 'event_espresso'),
95
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => __('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
99 99
 
100 100
 	protected function _set_page_routes() {
101 101
 		//load formatter helper
102
-		EE_Registry::instance()->load_helper( 'Formatter' );
102
+		EE_Registry::instance()->load_helper('Formatter');
103 103
 		//load field generator helper
104
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
104
+		EE_Registry::instance()->load_helper('Form_Fields');
105 105
 
106 106
 		//is there a evt_id in the request?
107
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
108
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
107
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
108
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
109 109
 
110 110
 
111 111
 		$this->_page_routes = array(
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 				'help_tour' => array(
320 320
 					'Event_Editor_Help_Tour'
321 321
 					),
322
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
322
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
323 323
 				'require_nonce' => FALSE
324 324
 			),
325 325
 			'edit' => array(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 				/*'help_tour' => array(
376 376
 					'Event_Edit_Help_Tour'
377 377
 				),*/
378
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
378
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
379 379
 				'require_nonce' => FALSE
380 380
 			),
381 381
 			'default_event_settings' => array(
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 						'filename' => 'events_default_settings_status'
398 398
 					)
399 399
 				),
400
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
400
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
401 401
 				'require_nonce' => FALSE
402 402
 			),
403 403
 			//template settings
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'general_settings_templates'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Templates_Help_Tour' ),
416
+				'help_tour' => array('Templates_Help_Tour'),
417 417
 				'require_nonce' => FALSE
418 418
 			),
419 419
 			//event category stuff
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 					'label' => __('Edit Category', 'event_espresso'),
438 438
 					'order' => 15,
439 439
 					'persistent' => FALSE,
440
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
440
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
441 441
 					),
442 442
 				'help_tabs' => array(
443 443
 					'edit_category_help_tab' => array(
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
 
508 508
 	public function load_scripts_styles() {
509 509
 
510
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
511
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
510
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
511
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
512 512
 		wp_enqueue_style('events-admin-css');
513 513
 		wp_enqueue_style('ee-cat-admin');
514 514
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
515 515
 		//registers for all views
516 516
 		//scripts
517
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
517
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
518 518
 	}
519 519
 
520 520
 	/**
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
 	public function load_scripts_styles_edit() {
533 533
 		//styles
534 534
 		wp_enqueue_style('espresso-ui-theme');
535
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
535
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
536 536
 		wp_enqueue_style('event-editor-css');
537 537
 
538 538
 		//scripts
539
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
539
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
540 540
 		wp_enqueue_script('event-datetime-metabox');
541 541
 
542 542
 	}
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 
573 573
 	public function admin_init() {
574
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
574
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
575 575
 	}
576 576
 
577 577
 
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function verify_event_edit($event = NULL) {
594 594
 		// no event?
595
-		if ( empty( $event )) {
595
+		if (empty($event)) {
596 596
 			// set event
597 597
 			$event = $this->_cpt_model_obj;
598 598
 		}
599 599
 		// STILL no event?
600
-		if ( empty ( $event )) {
600
+		if (empty ($event)) {
601 601
 			return;
602 602
 		}
603 603
 		$orig_status = $event->status();
@@ -611,27 +611,27 @@  discard block
 block discarded – undo
611 611
 			return;
612 612
 		}
613 613
 		//made it here so it IS active... next check that any of the tickets are sold.
614
-		if ( $event->is_sold_out( true ) ) {
615
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
614
+		if ($event->is_sold_out(true)) {
615
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
616 616
 				EE_Error::add_attention(
617 617
 					sprintf(
618
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
619
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
618
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
619
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
620 620
 					)
621 621
 				);
622 622
 			}
623 623
 			return;
624
-		} else if ( $orig_status === EEM_Event::sold_out ) {
624
+		} else if ($orig_status === EEM_Event::sold_out) {
625 625
 			EE_Error::add_attention(
626 626
 				sprintf(
627
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
628
-						'event_espresso' ),
629
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
627
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
628
+						'event_espresso'),
629
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
630 630
 				)
631 631
 			);
632 632
 		}
633 633
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
634
-		if ( ! $event->tickets_on_sale() ) {
634
+		if ( ! $event->tickets_on_sale()) {
635 635
 			return;
636 636
 		}
637 637
 		//made it here so show warning
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	protected function _edit_event_warning() {
652 652
 		// we don't want to add warnings during these requests
653
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
653
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
654 654
 			return;
655 655
 		}
656 656
 		EE_Error::add_attention(
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			),
682 682
 		);
683 683
 
684
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
684
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
685 685
 			$this->_views['trash'] = array(
686 686
 				'slug' => 'trash',
687 687
 				'label' => __('Trash', 'event_espresso'),
@@ -711,39 +711,39 @@  discard block
 block discarded – undo
711 711
 				'desc' => __('View Registrations for Event', 'event_espresso')
712 712
 			)
713 713
 		);
714
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
714
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
715 715
 		$statuses = array(
716 716
 			'sold_out_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
719 719
 			),
720 720
 			'active_status' => array(
721
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
722
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
721
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
722
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
723 723
 			),
724 724
 			'upcoming_status' => array(
725
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
726
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
725
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
726
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
727 727
 			),
728 728
 			'postponed_status' => array(
729
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
730
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
729
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
730
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
731 731
 			),
732 732
 			'cancelled_status' => array(
733
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
734
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
733
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
734
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
735 735
 			),
736 736
 			'expired_status' => array(
737
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
738
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
737
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
738
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
739 739
 			),
740 740
 			'inactive_status' => array(
741
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
742
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
741
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
742
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
743 743
 			)
744 744
 		);
745
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
746
-		return array_merge( $items, $statuses );
745
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
746
+		return array_merge($items, $statuses);
747 747
 	}
748 748
 
749 749
 
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 	 * @return EEM_Event
756 756
 	 */
757 757
 	private function _event_model() {
758
-		if ( ! $this->_event_model instanceof EEM_Event ) {
759
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
758
+		if ( ! $this->_event_model instanceof EEM_Event) {
759
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
760 760
 		}
761 761
 		return $this->_event_model;
762 762
 	}
@@ -775,12 +775,12 @@  discard block
 block discarded – undo
775 775
 	 * @param  string $new_slug  what the slug is
776 776
 	 * @return string            The new html string for the permalink area
777 777
 	 */
778
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
778
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
779 779
 		//make sure this is only when editing
780
-		if ( !empty( $id ) ) {
781
-			$post = get_post( $id );
782
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
783
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
780
+		if ( ! empty($id)) {
781
+			$post = get_post($id);
782
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
783
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
784 784
 		}
785 785
 		return $return;
786 786
 	}
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 	 * @return string html for generated table
797 797
 	 */
798 798
 	protected function _events_overview_list_table() {
799
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
800
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
799
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
800
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
801 801
 		$this->_display_legend($this->_event_legend_items());
802 802
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
803 803
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -815,51 +815,51 @@  discard block
 block discarded – undo
815 815
 
816 816
 
817 817
 
818
-	protected function _insert_update_cpt_item( $post_id, $post ) {
818
+	protected function _insert_update_cpt_item($post_id, $post) {
819 819
 
820
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
820
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
821 821
 			//getout we're not processing an event save.
822 822
 			return;
823 823
 		}
824 824
 
825 825
 		$event_values = array(
826
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
827
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
826
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
827
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
828 828
 			'EVT_additional_limit' => min(
829
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
830
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
831
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
832
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
833
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
834
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
835
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
836
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
829
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
830
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
831
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
832
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
833
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
834
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
835
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
836
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
837 837
 			);
838 838
 
839 839
 		//update event
840
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
840
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
841 841
 
842 842
 
843 843
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
844
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
845
-		$event = $this->_event_model()->get_one( array($get_one_where) );
844
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
845
+		$event = $this->_event_model()->get_one(array($get_one_where));
846 846
 
847 847
 
848 848
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
849
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
849
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
850 850
 
851 851
 		$att_success = TRUE;
852 852
 
853
-		foreach ( $event_update_callbacks as $e_callback ) {
854
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
855
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
853
+		foreach ($event_update_callbacks as $e_callback) {
854
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
855
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
856 856
 		}
857 857
 
858 858
 		//any errors?
859
-		if ( $success && FALSE === $att_success ) {
860
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
861
-		} else if ( $success === FALSE ) {
862
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
+		if ($success && FALSE === $att_success) {
860
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861
+		} else if ($success === FALSE) {
862
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
863 863
 		}
864 864
 	}
865 865
 
@@ -869,14 +869,14 @@  discard block
 block discarded – undo
869 869
 	/**
870 870
 	 * @see parent::restore_item()
871 871
 	 */
872
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
872
+	protected function _restore_cpt_item($post_id, $revision_id) {
873 873
 		//copy existing event meta to new post
874 874
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
875
-		if ( $post_evt instanceof EE_Event ) {
875
+		if ($post_evt instanceof EE_Event) {
876 876
 			//meta revision restore
877
-			$post_evt->restore_revision( $revision_id );
877
+			$post_evt->restore_revision($revision_id);
878 878
 			//related objs restore
879
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
879
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
880 880
 		}
881 881
 	}
882 882
 
@@ -889,52 +889,52 @@  discard block
 block discarded – undo
889 889
 	 * @param  array  $data   The request data from the form
890 890
 	 * @return bool           Success or fail.
891 891
 	 */
892
-	protected function _default_venue_update( $evtobj, $data ) {
893
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
892
+	protected function _default_venue_update($evtobj, $data) {
893
+		require_once(EE_MODELS.'EEM_Venue.model.php');
894 894
 		$venue_model = EE_Registry::instance()->load_model('Venue');
895 895
 		$rows_affected = NULL;
896
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
896
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
897 897
 
898 898
 		// very important.  If we don't have a venue name...
899 899
 		// then we'll get out because not necessary to create empty venue
900
-		if ( empty( $data['venue_title'] ) ) {
900
+		if (empty($data['venue_title'])) {
901 901
 			return false;
902 902
 		}
903 903
 
904 904
 		$venue_array = array(
905 905
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
906
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
907
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
908
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
909
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
910
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
911
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
912
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
913
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
914
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
915
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
916
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
917
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
918
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
919
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
920
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
921
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
906
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
907
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
908
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
909
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
910
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
911
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
912
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
913
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
914
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
915
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
916
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
917
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
918
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
919
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
920
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
921
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
922 922
 				'status' => 'publish'
923 923
 			);
924 924
 
925 925
 
926 926
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
927
-		if ( !empty( $venue_id ) ) {
928
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
929
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
927
+		if ( ! empty($venue_id)) {
928
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
929
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
930 930
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
931
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
931
+			$evtobj->_add_relation_to($venue_id, 'Venue');
932 932
 			return $rows_affected > 0 ? TRUE : FALSE;
933 933
 		} else {
934 934
 			//we insert the venue
935
-			$venue_id = $venue_model->insert( $venue_array );
936
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
937
-			return !empty( $venue_id ) ? TRUE : FALSE;
935
+			$venue_id = $venue_model->insert($venue_array);
936
+			$evtobj->_add_relation_to($venue_id, 'Venue');
937
+			return ! empty($venue_id) ? TRUE : FALSE;
938 938
 		}
939 939
 		//when we have the ancestor come in it's already been handled by the revision save.
940 940
 	}
@@ -948,55 +948,55 @@  discard block
 block discarded – undo
948 948
 	 * @param  array    $data   The request data from the form
949 949
 	 * @return bool             success or fail
950 950
 	 */
951
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
951
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
952 952
 		$success = true;
953 953
 		$saved_dtt = null;
954 954
 		$saved_tickets = array();
955
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
955
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
956 956
 
957
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
957
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
958 958
 			//trim all values to ensure any excess whitespace is removed.
959
-			$dtt =  array_map( 'trim', $dtt );
960
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959
+			$dtt = array_map('trim', $dtt);
960
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
961 961
 			$datetime_values = array(
962
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
962
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
963 963
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
964 964
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
965
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
965
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
966 966
 				'DTT_order' 	=> $row,
967 967
 			);
968 968
 
969 969
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
970 970
 
971
-			if ( !empty( $dtt['DTT_ID'] ) ) {
972
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
973
-				$DTM->set_date_format( $incoming_date_formats[0] );
974
-				$DTM->set_time_format( $incoming_date_formats[1] );
975
-				foreach ( $datetime_values as $field => $value ) {
976
-					$DTM->set( $field, $value );
971
+			if ( ! empty($dtt['DTT_ID'])) {
972
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
973
+				$DTM->set_date_format($incoming_date_formats[0]);
974
+				$DTM->set_time_format($incoming_date_formats[1]);
975
+				foreach ($datetime_values as $field => $value) {
976
+					$DTM->set($field, $value);
977 977
 				}
978 978
 
979 979
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
980 980
 				$saved_dtts[$DTM->ID()] = $DTM;
981 981
 			} else {
982
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
983
-				$DTM->set_date_format( $incoming_date_formats[0] );
984
-				$DTM->set_time_format( $incoming_date_formats[1] );
985
-				$DTM->set_timezone( $evtobj->get_timezone() );
986
-				foreach ( $datetime_values as $field => $value ) {
987
-					$DTM->set( $field, $value );
982
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
983
+				$DTM->set_date_format($incoming_date_formats[0]);
984
+				$DTM->set_time_format($incoming_date_formats[1]);
985
+				$DTM->set_timezone($evtobj->get_timezone());
986
+				foreach ($datetime_values as $field => $value) {
987
+					$DTM->set($field, $value);
988 988
 				}
989 989
 			}
990 990
 			$DTM->save();
991 991
 
992
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
992
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
993 993
 
994 994
 			//load DTT helper
995 995
 			EE_Registry::instance()->load_helper('DTT_Helper');
996 996
 
997 997
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
998
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
999
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
998
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
999
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1000 1000
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1001 1001
 				$DTT->save();
1002 1002
 			}
@@ -1004,45 +1004,45 @@  discard block
 block discarded – undo
1004 1004
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1005 1005
 			$saved_dtt = $DTT;
1006 1006
 
1007
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1007
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1008 1008
 		}
1009 1009
 
1010 1010
 		//no dtts get deleted so we don't do any of that logic here.
1011 1011
 		//update tickets next
1012
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1013
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1014
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1012
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1013
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1014
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1015 1015
 			$update_prices = false;
1016
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1016
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1017 1017
 
1018 1018
 			// trim inputs to ensure any excess whitespace is removed.
1019
-			$tkt = array_map( 'trim', $tkt );
1019
+			$tkt = array_map('trim', $tkt);
1020 1020
 
1021
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1021
+			if (empty($tkt['TKT_start_date'])) {
1022 1022
 				//let's use now in the set timezone.
1023
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1024
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1023
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1024
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1025 1025
 			}
1026 1026
 
1027
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1027
+			if (empty($tkt['TKT_end_date'])) {
1028 1028
 				//use the start date of the first datetime
1029 1029
 				$dtt = $evtobj->first_datetime();
1030
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1030
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1031 1031
 			}
1032 1032
 
1033 1033
 			$TKT_values = array(
1034
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1035
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1036
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1037
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1034
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1035
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1036
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1037
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1038 1038
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1039 1039
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1040
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1041
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1042
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1043
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1040
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1041
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1042
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1043
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1044 1044
 				'TKT_row' 			=> $row,
1045
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1045
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1046 1046
 				'TKT_price' 		=> $ticket_price
1047 1047
 			);
1048 1048
 
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 
1052 1052
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1053
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1053
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1054 1054
 				$TKT_values['TKT_ID'] = 0;
1055 1055
 				$TKT_values['TKT_is_default'] = 0;
1056 1056
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1061,58 +1061,58 @@  discard block
 block discarded – undo
1061 1061
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1062 1062
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1063 1063
 
1064
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1065
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1066
-				if ( $TKT instanceof EE_Ticket ) {
1067
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1064
+			if ( ! empty($tkt['TKT_ID'])) {
1065
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1066
+				if ($TKT instanceof EE_Ticket) {
1067
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1068 1068
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1069
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1070
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1071
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1069
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1070
+					$TKT->set_date_format($incoming_date_formats[0]);
1071
+					$TKT->set_time_format($incoming_date_formats[1]);
1072 1072
 					//set new values
1073
-					foreach ( $TKT_values as $field => $value ) {
1074
-						if ( $field == 'TKT_qty' ) {
1075
-							$TKT->set_qty( $value );
1073
+					foreach ($TKT_values as $field => $value) {
1074
+						if ($field == 'TKT_qty') {
1075
+							$TKT->set_qty($value);
1076 1076
 						} else {
1077
-							$TKT->set( $field, $value );
1077
+							$TKT->set($field, $value);
1078 1078
 						}
1079 1079
 					}
1080 1080
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1081
-					if ( $create_new_TKT ) {
1081
+					if ($create_new_TKT) {
1082 1082
 						//archive the old ticket first
1083
-						$TKT->set( 'TKT_deleted', 1 );
1083
+						$TKT->set('TKT_deleted', 1);
1084 1084
 						$TKT->save();
1085 1085
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1086
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1086
+						$saved_tickets[$TKT->ID()] = $TKT;
1087 1087
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1088 1088
 						$TKT = clone $TKT;
1089
-						$TKT->set( 'TKT_ID', 0 );
1090
-						$TKT->set( 'TKT_deleted', 0 );
1091
-						$TKT->set( 'TKT_price', $ticket_price );
1092
-						$TKT->set( 'TKT_sold', 0 );
1089
+						$TKT->set('TKT_ID', 0);
1090
+						$TKT->set('TKT_deleted', 0);
1091
+						$TKT->set('TKT_price', $ticket_price);
1092
+						$TKT->set('TKT_sold', 0);
1093 1093
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1094 1094
 						$update_prices = true;
1095 1095
 					}
1096 1096
 					//make sure price is set if it hasn't been already
1097
-					$TKT->set( 'TKT_price', $ticket_price );
1097
+					$TKT->set('TKT_price', $ticket_price);
1098 1098
 				}
1099 1099
 
1100 1100
 			} else {
1101 1101
 				//no TKT_id so a new TKT
1102 1102
 				$TKT_values['TKT_price'] = $ticket_price;
1103
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1104
-				if ( $TKT instanceof EE_Ticket ) {
1103
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1104
+				if ($TKT instanceof EE_Ticket) {
1105 1105
 					//need to reset values to properly account for the date formats
1106
-					$TKT->set_date_format( $incoming_date_formats[0] );
1107
-					$TKT->set_time_format( $incoming_date_formats[1] );
1108
-					$TKT->set_timezone( $evtobj->get_timezone() );
1106
+					$TKT->set_date_format($incoming_date_formats[0]);
1107
+					$TKT->set_time_format($incoming_date_formats[1]);
1108
+					$TKT->set_timezone($evtobj->get_timezone());
1109 1109
 
1110 1110
 					//set new values
1111
-					foreach ( $TKT_values as $field => $value ) {
1112
-						if ( $field == 'TKT_qty' ) {
1113
-							$TKT->set_qty( $value );
1111
+					foreach ($TKT_values as $field => $value) {
1112
+						if ($field == 'TKT_qty') {
1113
+							$TKT->set_qty($value);
1114 1114
 						} else {
1115
-							$TKT->set( $field, $value );
1115
+							$TKT->set($field, $value);
1116 1116
 						}
1117 1117
 					}
1118 1118
 
@@ -1120,32 +1120,32 @@  discard block
 block discarded – undo
1120 1120
 				}
1121 1121
 			}
1122 1122
 			// cap ticket qty by datetime reg limits
1123
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1123
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1124 1124
 			//update ticket.
1125 1125
 			$TKT->save();
1126 1126
 
1127 1127
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1128
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1129
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1128
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1129
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1130 1130
 				EE_Registry::instance()->load_helper('DTT_Helper');
1131 1131
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1132 1132
 				$TKT->save();
1133 1133
 			}
1134 1134
 
1135 1135
 			//initially let's add the ticket to the dtt
1136
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1136
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1137 1137
 
1138 1138
 			$saved_tickets[$TKT->ID()] = $TKT;
1139 1139
 
1140 1140
 			//add prices to ticket
1141
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1141
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1142 1142
 		}
1143 1143
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1144
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1145
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1144
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1145
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1146 1146
 
1147
-		foreach ( $tickets_removed as $id ) {
1148
-			$id = absint( $id );
1147
+		foreach ($tickets_removed as $id) {
1148
+			$id = absint($id);
1149 1149
 
1150 1150
 			//get the ticket for this id
1151 1151
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1154 1154
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1155 1155
 
1156
-			foreach( $dtts as $dtt ) {
1156
+			foreach ($dtts as $dtt) {
1157 1157
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1158 1158
 			}
1159 1159
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1165 1165
 			$tkt_to_remove->delete_permanently();
1166 1166
 		}
1167
-		return array( $saved_dtt, $saved_tickets );
1167
+		return array($saved_dtt, $saved_tickets);
1168 1168
 	}
1169 1169
 
1170 1170
 
@@ -1179,31 +1179,31 @@  discard block
 block discarded – undo
1179 1179
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1180 1180
 	 * @return  void
1181 1181
 	 */
1182
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1183
-		foreach ( $prices as $row => $prc ) {
1182
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1183
+		foreach ($prices as $row => $prc) {
1184 1184
 			$PRC_values = array(
1185
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1186
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1187
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1188
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1189
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1185
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1186
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1187
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1188
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1189
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1190 1190
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1191 1191
 				'PRC_order' => $row
1192 1192
 			);
1193 1193
 
1194
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1194
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1195 1195
 				$PRC_values['PRC_ID'] = 0;
1196
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1196
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1197 1197
 			} else {
1198
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1198
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1199 1199
 				//update this price with new values
1200
-				foreach ( $PRC_values as $field => $newprc ) {
1201
-					$PRC->set( $field, $newprc );
1200
+				foreach ($PRC_values as $field => $newprc) {
1201
+					$PRC->set($field, $newprc);
1202 1202
 				}
1203 1203
 				$PRC->save();
1204 1204
 			}
1205 1205
 
1206
-			$ticket->_add_relation_to( $PRC, 'Price' );
1206
+			$ticket->_add_relation_to($PRC, 'Price');
1207 1207
 		}
1208 1208
 	}
1209 1209
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	private function _generate_publish_box_extra_content() {
1240 1240
 
1241 1241
 		//load formatter helper
1242
-  		EE_Registry::instance()->load_helper( 'Formatter' );
1242
+  		EE_Registry::instance()->load_helper('Formatter');
1243 1243
 
1244 1244
   		//args for getting related registrations
1245
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1246
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1247
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1245
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1246
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1247
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1248 1248
 
1249 1249
 
1250 1250
 		// publish box
@@ -1273,9 +1273,9 @@  discard block
 block discarded – undo
1273 1273
 				),
1274 1274
 				REG_ADMIN_URL
1275 1275
 			),
1276
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1277
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1278
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1276
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1277
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1278
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1279 1279
 			'misc_pub_section_class' => apply_filters(
1280 1280
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1281 1281
 				'misc-pub-section'
@@ -1294,9 +1294,9 @@  discard block
 block discarded – undo
1294 1294
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1295 1295
 			$this->_cpt_model_obj
1296 1296
 		);
1297
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1297
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1298 1298
 		// load template
1299
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1299
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1300 1300
 	}
1301 1301
 
1302 1302
 
@@ -1328,16 +1328,16 @@  discard block
 block discarded – undo
1328 1328
 		$this->verify_cpt_object();
1329 1329
 		add_meta_box(
1330 1330
 			'espresso_event_editor_tickets',
1331
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1332
-			array( $this, 'ticket_metabox' ),
1331
+			__('Event Datetime & Ticket', 'event_espresso'),
1332
+			array($this, 'ticket_metabox'),
1333 1333
 			$this->page_slug,
1334 1334
 			'normal',
1335 1335
 			'high'
1336 1336
 		);
1337 1337
 		add_meta_box(
1338 1338
 			'espresso_event_editor_event_options',
1339
-			__( 'Event Registration Options', 'event_espresso' ),
1340
-			array( $this, 'registration_options_meta_box' ),
1339
+			__('Event Registration Options', 'event_espresso'),
1340
+			array($this, 'registration_options_meta_box'),
1341 1341
 			$this->page_slug,
1342 1342
 			'side',
1343 1343
 			'default'
@@ -1367,37 +1367,37 @@  discard block
 block discarded – undo
1367 1367
 			'disabled' => ''
1368 1368
 			);
1369 1369
 
1370
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1370
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1371 1371
 
1372
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1372
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1373 1373
 
1374 1374
 		/**
1375 1375
 		 * 1. Start with retrieving Datetimes
1376 1376
 		 * 2. Fore each datetime get related tickets
1377 1377
 		 * 3. For each ticket get related prices
1378 1378
 		 */
1379
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1380
-		EE_Registry::instance()->load_helper('DTT_Helper' );
1379
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1380
+		EE_Registry::instance()->load_helper('DTT_Helper');
1381 1381
 		/** @type EE_Datetime $first_datetime */
1382
-		$first_datetime = reset( $times );
1382
+		$first_datetime = reset($times);
1383 1383
 		//do we get related tickets?
1384
-		if ( $first_datetime instanceof EE_Datetime
1385
-			&& $first_datetime->ID() !== 0 ) {
1384
+		if ($first_datetime instanceof EE_Datetime
1385
+			&& $first_datetime->ID() !== 0) {
1386 1386
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1387 1387
 			$template_args['time'] = $first_datetime;
1388 1388
 			$related_tickets = $first_datetime->tickets(
1389 1389
 				array(
1390
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1390
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1391 1391
 					'default_where_conditions' => 'none'
1392 1392
 				)
1393 1393
 			);
1394 1394
 
1395
-			if ( !empty($related_tickets) ) {
1395
+			if ( ! empty($related_tickets)) {
1396 1396
 				$template_args['total_ticket_rows'] = count($related_tickets);
1397 1397
 				$row = 0;
1398
-				foreach ( $related_tickets as $ticket ) {
1398
+				foreach ($related_tickets as $ticket) {
1399 1399
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1400
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1400
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1401 1401
 
1402 1402
 					$row++;
1403 1403
 				}
@@ -1405,13 +1405,13 @@  discard block
 block discarded – undo
1405 1405
 				$template_args['total_ticket_rows'] = 1;
1406 1406
 				/** @type EE_Ticket $ticket */
1407 1407
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1408
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1408
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1409 1409
 			}
1410 1410
 		} else {
1411 1411
 			$template_args['time'] = $times[0];
1412 1412
 			/** @type EE_Ticket $ticket */
1413 1413
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1414
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1414
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1415 1415
 			// NOTE: we're just sending the first default row
1416 1416
 			// (decaf can't manage default tickets so this should be sufficient);
1417 1417
 		}
@@ -1420,8 +1420,8 @@  discard block
 block discarded – undo
1420 1420
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1421 1421
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1422 1422
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1423
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1424
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1423
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1424
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1425 1425
 		EEH_Template::display_template($template, $template_args);
1426 1426
 	}
1427 1427
 
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
 	 * @param int        $row
1437 1437
 	 * @return string generated html for the ticket row.
1438 1438
 	 */
1439
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1439
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1440 1440
 		$template_args = array(
1441
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1442
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1441
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1442
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1443 1443
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1444 1444
 			'TKT_ID' => $ticket->get('TKT_ID'),
1445 1445
 			'TKT_name' => $ticket->get('TKT_name'),
1446 1446
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1447 1447
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1448 1448
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1449
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1449
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1450 1450
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1451 1451
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1452
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1453
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1452
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1453
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1454 1454
 			);
1455 1455
 
1456 1456
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1466,23 +1466,23 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
 		//make sure we have default start and end dates if skeleton
1468 1468
 		//handle rows that should NOT be empty
1469
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1469
+		if (empty($template_args['TKT_start_date'])) {
1470 1470
 			//if empty then the start date will be now.
1471 1471
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1472 1472
 		}
1473 1473
 
1474
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1474
+		if (empty($template_args['TKT_end_date'])) {
1475 1475
 			//get the earliest datetime (if present);
1476
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1476
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1477 1477
 
1478
-			if ( !empty( $earliest_dtt ) )
1478
+			if ( ! empty($earliest_dtt))
1479 1479
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1480 1480
 			else
1481
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1481
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1482 1482
 		}
1483 1483
 
1484
-		$template_args = array_merge( $template_args, $price_args );
1485
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1484
+		$template_args = array_merge($template_args, $price_args);
1485
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1486 1486
 		return EEH_Template::display_template($template, $template_args, TRUE);
1487 1487
 	}
1488 1488
 
@@ -1511,8 +1511,8 @@  discard block
 block discarded – undo
1511 1511
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1512 1512
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1513 1513
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1514
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1515
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1514
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1515
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1516 1516
 		EEH_Template::display_template($templatepath, $template_args);
1517 1517
 	}
1518 1518
 
@@ -1540,21 +1540,21 @@  discard block
 block discarded – undo
1540 1540
 		$EEME = $this->_event_model();
1541 1541
 
1542 1542
 		$offset = ($current_page - 1) * $per_page;
1543
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1543
+		$limit = $count ? NULL : $offset.','.$per_page;
1544 1544
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1545 1545
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1546 1546
 
1547 1547
 		if (isset($this->_req_data['month_range'])) {
1548 1548
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1549
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1550
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1549
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1550
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1551 1551
 		}
1552 1552
 
1553 1553
 		$where = array();
1554 1554
 
1555
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1555
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1556 1556
 		//determine what post_status our condition will have for the query.
1557
-		switch ( $status ) {
1557
+		switch ($status) {
1558 1558
 			case 'month' :
1559 1559
 			case 'today' :
1560 1560
 			case NULL :
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 				break;
1563 1563
 
1564 1564
 			case 'draft' :
1565
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1565
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1566 1566
 				break;
1567 1567
 
1568 1568
 			default :
@@ -1570,43 +1570,43 @@  discard block
 block discarded – undo
1570 1570
 		}
1571 1571
 
1572 1572
 		//categories?
1573
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1573
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1574 1574
 
1575
-		if ( !empty ( $category ) ) {
1575
+		if ( ! empty ($category)) {
1576 1576
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1577 1577
 			$where['Term_Taxonomy.term_id'] = $category;
1578 1578
 		}
1579 1579
 
1580 1580
 		//date where conditions
1581
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1581
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1582 1582
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1583
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1584
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1585
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1586
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1583
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1584
+			$start = $DateTime->format(implode(' ', $start_formats));
1585
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1586
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1587 1587
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1588
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1592
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1593
-			$now = date( 'Y-m-01' );
1594
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1595
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1596
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1597
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1588
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1593
+			$now = date('Y-m-01');
1594
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1595
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1596
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1597
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1598 1598
 		}
1599 1599
 
1600 1600
 
1601
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1602
-			$where['EVT_wp_user'] =  get_current_user_id();
1601
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1602
+			$where['EVT_wp_user'] = get_current_user_id();
1603 1603
 		} else {
1604
-			if ( ! isset( $where['status'] ) ) {
1605
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1604
+			if ( ! isset($where['status'])) {
1605
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1606 1606
 					$where['OR'] = array(
1607
-						'status*restrict_private' => array( '!=', 'private' ),
1607
+						'status*restrict_private' => array('!=', 'private'),
1608 1608
 						'AND' => array(
1609
-							'status*inclusive' => array( '=', 'private' ),
1609
+							'status*inclusive' => array('=', 'private'),
1610 1610
 							'EVT_wp_user' => get_current_user_id()
1611 1611
 						)
1612 1612
 					);
@@ -1614,16 +1614,16 @@  discard block
 block discarded – undo
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1618
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1617
+		if (isset($this->_req_data['EVT_wp_user'])) {
1618
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1619 1619
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1620 1620
 			}
1621 1621
 		}
1622 1622
 
1623 1623
 
1624 1624
 		//search query handling
1625
-		if ( isset( $this->_req_data['s'] ) ) {
1626
-			$search_string = '%' . $this->_req_data['s'] . '%';
1625
+		if (isset($this->_req_data['s'])) {
1626
+			$search_string = '%'.$this->_req_data['s'].'%';
1627 1627
 			$where['OR'] = array(
1628 1628
 				'EVT_name' => array('LIKE', $search_string),
1629 1629
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1632,32 +1632,32 @@  discard block
 block discarded – undo
1632 1632
 		}
1633 1633
 
1634 1634
 
1635
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1636
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1635
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1636
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1637 1637
 
1638 1638
 
1639 1639
 		//let's first check if we have special requests coming in.
1640
-		if ( isset( $this->_req_data['active_status'] ) ) {
1641
-			switch ( $this->_req_data['active_status'] ) {
1640
+		if (isset($this->_req_data['active_status'])) {
1641
+			switch ($this->_req_data['active_status']) {
1642 1642
 				case 'upcoming' :
1643
-					return $EEME->get_upcoming_events( $query_params, $count );
1643
+					return $EEME->get_upcoming_events($query_params, $count);
1644 1644
 					break;
1645 1645
 
1646 1646
 				case 'expired' :
1647
-					return $EEME->get_expired_events( $query_params, $count );
1647
+					return $EEME->get_expired_events($query_params, $count);
1648 1648
 					break;
1649 1649
 
1650 1650
 				case 'active' :
1651
-					return $EEME->get_active_events( $query_params, $count );
1651
+					return $EEME->get_active_events($query_params, $count);
1652 1652
 					break;
1653 1653
 
1654 1654
 				case 'inactive' :
1655
-					return $EEME->get_inactive_events( $query_params, $count );
1655
+					return $EEME->get_inactive_events($query_params, $count);
1656 1656
 					break;
1657 1657
 			}
1658 1658
 		}
1659 1659
 
1660
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1660
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1661 1661
 
1662 1662
 		return $events;
1663 1663
 	}
@@ -1666,23 +1666,23 @@  discard block
 block discarded – undo
1666 1666
 
1667 1667
 
1668 1668
 	//handling for WordPress CPT actions (trash, restore, delete)
1669
-	public function trash_cpt_item( $post_id ) {
1669
+	public function trash_cpt_item($post_id) {
1670 1670
 		$this->_req_data['EVT_ID'] = $post_id;
1671
-		$this->_trash_or_restore_event( 'trash', FALSE );
1671
+		$this->_trash_or_restore_event('trash', FALSE);
1672 1672
 	}
1673 1673
 
1674 1674
 
1675 1675
 
1676 1676
 
1677
-	public function restore_cpt_item( $post_id ) {
1677
+	public function restore_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_trash_or_restore_event( 'draft', FALSE );
1679
+		$this->_trash_or_restore_event('draft', FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
1683
-	public function delete_cpt_item( $post_id ) {
1683
+	public function delete_cpt_item($post_id) {
1684 1684
 		$this->_req_data['EVT_ID'] = $post_id;
1685
-		$this->_delete_event( FALSE );
1685
+		$this->_delete_event(FALSE);
1686 1686
 	}
1687 1687
 
1688 1688
 
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 	 * @param  string $event_status
1695 1695
 	 * @return void
1696 1696
 	 */
1697
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1697
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1698 1698
 		//determine the event id and set to array.
1699 1699
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1700 1700
 		// loop thru events
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 			// clean status
1703 1703
 			$event_status = sanitize_key($event_status);
1704 1704
 			// grab status
1705
-			if (!empty($event_status)) {
1705
+			if ( ! empty($event_status)) {
1706 1706
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1707 1707
 			} else {
1708 1708
 				$success = FALSE;
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 		}
1717 1717
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1718 1718
 
1719
-		if ( $redirect_after )
1719
+		if ($redirect_after)
1720 1720
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1721 1721
 	}
1722 1722
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		// clean status
1732 1732
 		$event_status = sanitize_key($event_status);
1733 1733
 		// grab status
1734
-		if (!empty($event_status)) {
1734
+		if ( ! empty($event_status)) {
1735 1735
 			$success = TRUE;
1736 1736
 			//determine the event id and set to array.
1737 1737
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 	 * @param  string $event_status
1767 1767
 	 * @return bool
1768 1768
 	 */
1769
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1769
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1770 1770
 		// grab event id
1771
-		if (!$EVT_ID) {
1771
+		if ( ! $EVT_ID) {
1772 1772
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1773 1773
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1774 1774
 			return FALSE;
1775 1775
 		}
1776 1776
 
1777
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1777
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1778 1778
 
1779 1779
 		// clean status
1780 1780
 		$event_status = sanitize_key($event_status);
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 				$hook = FALSE;
1801 1801
 		}
1802 1802
 		//use class to change status
1803
-		$this->_cpt_model_obj->set_status( $event_status );
1803
+		$this->_cpt_model_obj->set_status($event_status);
1804 1804
 		$success = $this->_cpt_model_obj->save();
1805 1805
 
1806 1806
 		if ($success === FALSE) {
@@ -1822,15 +1822,15 @@  discard block
 block discarded – undo
1822 1822
 	 * @access protected
1823 1823
 	 * @param bool $redirect_after
1824 1824
 	 */
1825
-	protected function _delete_event( $redirect_after = TRUE ) {
1825
+	protected function _delete_event($redirect_after = TRUE) {
1826 1826
 		//determine the event id and set to array.
1827 1827
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1828
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1828
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1829 1829
 
1830 1830
 
1831 1831
 		// loop thru events
1832 1832
 		if ($EVT_ID) {
1833
-			$success = $this->_permanently_delete_event( $EVT_ID );
1833
+			$success = $this->_permanently_delete_event($EVT_ID);
1834 1834
 			// get list of events with no prices
1835 1835
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1836 1836
 			// remove this event from the list of events with no prices
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1845 1845
 		}
1846 1846
 
1847
-		if ( $redirect_after )
1847
+		if ($redirect_after)
1848 1848
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1849 1849
 	}
1850 1850
 
@@ -1862,12 +1862,12 @@  discard block
 block discarded – undo
1862 1862
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1863 1863
 		// loop thru events
1864 1864
 		foreach ($EVT_IDs as $EVT_ID) {
1865
-			$EVT_ID = absint( $EVT_ID );
1866
-			if ( $EVT_ID ) {
1867
-				$results = $this->_permanently_delete_event( $EVT_ID );
1865
+			$EVT_ID = absint($EVT_ID);
1866
+			if ($EVT_ID) {
1867
+				$results = $this->_permanently_delete_event($EVT_ID);
1868 1868
 				$success = $results !== FALSE ? $success : FALSE;
1869 1869
 				// remove this event from the list of events with no prices
1870
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1870
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1871 1871
 			} else {
1872 1872
 				$success = FALSE;
1873 1873
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1887,9 +1887,9 @@  discard block
 block discarded – undo
1887 1887
 	 * @param  int $EVT_ID
1888 1888
 	 * @return bool
1889 1889
 	 */
1890
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1890
+	private function _permanently_delete_event($EVT_ID = 0) {
1891 1891
 		// grab event id
1892
-		if ( ! $EVT_ID ) {
1892
+		if ( ! $EVT_ID) {
1893 1893
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1894 1894
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1895 1895
 			return FALSE;
@@ -1898,19 +1898,19 @@  discard block
 block discarded – undo
1898 1898
 			! $this->_cpt_model_obj instanceof EE_Event
1899 1899
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1900 1900
 		) {
1901
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1901
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1902 1902
 		}
1903 1903
 
1904
-		if ( ! $this->_cpt_model instanceof EE_Event ) {
1904
+		if ( ! $this->_cpt_model instanceof EE_Event) {
1905 1905
 			return false;
1906 1906
 		}
1907 1907
 
1908 1908
 		//need to delete related tickets and prices first.
1909 1909
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1910
-		foreach ( $datetimes as $datetime ) {
1910
+		foreach ($datetimes as $datetime) {
1911 1911
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1912 1912
 			$tickets = $datetime->get_many_related('Ticket');
1913
-			foreach ( $tickets as $ticket ) {
1913
+			foreach ($tickets as $ticket) {
1914 1914
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1915 1915
 				$ticket->delete_related_permanently('Price');
1916 1916
 				$ticket->delete_permanently();
@@ -1920,14 +1920,14 @@  discard block
 block discarded – undo
1920 1920
 
1921 1921
 		//what about related venues or terms?
1922 1922
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1923
-		foreach ( $venues as $venue ) {
1923
+		foreach ($venues as $venue) {
1924 1924
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1925 1925
 		}
1926 1926
 
1927 1927
 		//any attached question groups?
1928 1928
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1929
-		if ( !empty( $question_groups ) ) {
1930
-			foreach ( $question_groups as $question_group ) {
1929
+		if ( ! empty($question_groups)) {
1930
+			foreach ($question_groups as $question_group) {
1931 1931
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1932 1932
 			}
1933 1933
 		}
@@ -1936,12 +1936,12 @@  discard block
 block discarded – undo
1936 1936
 
1937 1937
 
1938 1938
 		//Message Template Groups
1939
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1939
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1940 1940
 
1941 1941
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1942 1942
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1943 1943
 
1944
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1944
+		foreach ($term_taxonomies as $term_taxonomy) {
1945 1945
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1946 1946
 		}
1947 1947
 
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1956 1956
 			return FALSE;
1957 1957
 		}
1958
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1958
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1959 1959
 		return TRUE;
1960 1960
 	}
1961 1961
 
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 	 */
1973 1973
 	public function total_events() {
1974 1974
 
1975
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1975
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1976 1976
 		return $count;
1977 1977
 	}
1978 1978
 
@@ -1987,10 +1987,10 @@  discard block
 block discarded – undo
1987 1987
 	 */
1988 1988
 	public function total_events_draft() {
1989 1989
 		$where = array(
1990
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1990
+			'status' => array('IN', array('draft', 'auto-draft'))
1991 1991
 			);
1992 1992
 
1993
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1993
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1994 1994
 		return $count;
1995 1995
 	}
1996 1996
 
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 			'status' => 'trash'
2010 2010
 			);
2011 2011
 
2012
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2012
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2013 2013
 		return $count;
2014 2014
 	}
2015 2015
 
@@ -2037,11 +2037,11 @@  discard block
 block discarded – undo
2037 2037
 			// translated
2038 2038
 			TRUE
2039 2039
 		);
2040
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2040
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2041 2041
 
2042 2042
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2043 2043
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2044
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2044
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2045 2045
 		$this->display_admin_page_with_sidebar();
2046 2046
 	}
2047 2047
 
@@ -2067,9 +2067,9 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
 	protected function _template_settings() {
2069 2069
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2070
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2071
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2072
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2070
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2071
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2072
+		$this->display_admin_caf_preview_page('template_settings_tab');
2073 2073
 	}
2074 2074
 
2075 2075
 
@@ -2082,22 +2082,22 @@  discard block
 block discarded – undo
2082 2082
 	 * @return void
2083 2083
 	 */
2084 2084
 	private function _set_category_object() {
2085
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2085
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2086 2086
 			return; //already have the category object so get out.
2087 2087
 
2088 2088
 		//set default category object
2089 2089
 		$this->_set_empty_category_object();
2090 2090
 
2091 2091
 		//only set if we've got an id
2092
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2092
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2093 2093
 			return;
2094 2094
 		}
2095 2095
 
2096 2096
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2097 2097
 
2098
-		$term = get_term( $category_id, 'espresso_event_categories' );
2098
+		$term = get_term($category_id, 'espresso_event_categories');
2099 2099
 
2100
-		if ( !empty( $term ) ) {
2100
+		if ( ! empty($term)) {
2101 2101
 			$this->_category->category_name = $term->name;
2102 2102
 			$this->_category->category_identifier = $term->slug;
2103 2103
 			$this->_category->category_desc = $term->description;
@@ -2111,13 +2111,13 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
 	private function _set_empty_category_object() {
2113 2113
 		$this->_category = new stdClass();
2114
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2114
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2115 2115
 		$this->_category->id = $this->_category->parent = 0;
2116 2116
 	}
2117 2117
 
2118 2118
 
2119 2119
 	protected function _category_list_table() {
2120
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2120
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2121 2121
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2122 2122
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2123 2123
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,22 +2127,22 @@  discard block
 block discarded – undo
2127 2127
 	protected function _category_details($view) {
2128 2128
 
2129 2129
 		//load formatter helper
2130
-		EE_Registry::instance()->load_helper( 'Formatter' );
2130
+		EE_Registry::instance()->load_helper('Formatter');
2131 2131
 		//load field generator helper
2132
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
2132
+		EE_Registry::instance()->load_helper('Form_Fields');
2133 2133
 
2134 2134
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2135 2135
 		$this->_set_add_edit_form_tags($route);
2136 2136
 
2137 2137
 		$this->_set_category_object();
2138
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2138
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2139 2139
 
2140 2140
 		$delete_action = 'delete_category';
2141 2141
 
2142 2142
 		//custom redirect
2143
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2143
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2144 2144
 
2145
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2145
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2146 2146
 
2147 2147
 		//take care of contents
2148 2148
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2156,25 +2156,25 @@  discard block
 block discarded – undo
2156 2156
 			'type' => 'wp_editor',
2157 2157
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2158 2158
 			'class' => 'my_editor_custom',
2159
-			'wpeditor_args' => array('media_buttons' => FALSE )
2159
+			'wpeditor_args' => array('media_buttons' => FALSE)
2160 2160
 		);
2161
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2161
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2162 2162
 
2163
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2163
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2164 2164
 
2165 2165
 		//setup category select for term parents.
2166 2166
 		$category_select_values[] = array(
2167 2167
 			'text' => __('No Parent', 'event_espresso'),
2168 2168
 			'id' => 0
2169 2169
 			);
2170
-		foreach ( $all_terms as $term ) {
2170
+		foreach ($all_terms as $term) {
2171 2171
 			$category_select_values[] = array(
2172 2172
 				'text' => $term->name,
2173 2173
 				'id' => $term->term_id
2174 2174
 				);
2175 2175
 		}
2176 2176
 
2177
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2177
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2178 2178
 
2179 2179
 		$template_args = array(
2180 2180
 			'category' => $this->_category,
@@ -2184,15 +2184,15 @@  discard block
 block discarded – undo
2184 2184
 			'disable' => '',
2185 2185
 			'disabled_message' => FALSE
2186 2186
 			);
2187
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2188
-		return EEH_Template::display_template($template, $template_args, TRUE );
2187
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2188
+		return EEH_Template::display_template($template, $template_args, TRUE);
2189 2189
 	}
2190 2190
 
2191 2191
 
2192 2192
 	protected function _delete_categories() {
2193
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2193
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2194 2194
 
2195
-		foreach ( $cat_ids as $cat_id ) {
2195
+		foreach ($cat_ids as $cat_id) {
2196 2196
 			$this->_delete_category($cat_id);
2197 2197
 		}
2198 2198
 
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 		$query_args = array(
2201 2201
 			'action' => 'category_list'
2202 2202
 			);
2203
-		$this->_redirect_after_action(0,'','',$query_args);
2203
+		$this->_redirect_after_action(0, '', '', $query_args);
2204 2204
 
2205 2205
 	}
2206 2206
 
@@ -2210,61 +2210,61 @@  discard block
 block discarded – undo
2210 2210
 
2211 2211
 	protected function _delete_category($cat_id) {
2212 2212
 		global $wpdb;
2213
-		$cat_id = absint( $cat_id );
2214
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2213
+		$cat_id = absint($cat_id);
2214
+		wp_delete_term($cat_id, 'espresso_event_categories');
2215 2215
 	}
2216 2216
 
2217 2217
 
2218 2218
 
2219 2219
 	protected function _insert_or_update_category($new_category) {
2220 2220
 
2221
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2221
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2222 2222
 		$success = 0; //we already have a success message so lets not send another.
2223 2223
 
2224
-		if ( $cat_id ) {
2224
+		if ($cat_id) {
2225 2225
 			$query_args = array(
2226 2226
 				'action'     => 'edit_category',
2227 2227
 				'EVT_CAT_ID' => $cat_id
2228 2228
 			);
2229 2229
 		} else {
2230
-			$query_args = array( 'action' => 'add_category' );
2230
+			$query_args = array('action' => 'add_category');
2231 2231
 		}
2232
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2232
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2233 2233
 
2234 2234
 	}
2235 2235
 
2236 2236
 
2237 2237
 
2238
-	private function _insert_category( $update = FALSE ) {
2238
+	private function _insert_category($update = FALSE) {
2239 2239
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2240
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2241
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2242
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2240
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2241
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2242
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2243 2243
 
2244
-		if ( empty( $category_name ) ) {
2245
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2246
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2244
+		if (empty($category_name)) {
2245
+			$msg = __('You must add a name for the category.', 'event_espresso');
2246
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2247 2247
 			return false;
2248 2248
 		}
2249 2249
 
2250
-		$term_args=array(
2250
+		$term_args = array(
2251 2251
 			'name'=>$category_name,
2252 2252
 			'description'=>$category_desc,
2253 2253
 			'parent'=>$category_parent
2254 2254
 		);
2255 2255
 		//was the category_identifier input disabled?
2256
-		if(isset($this->_req_data['category_identifier'])){
2256
+		if (isset($this->_req_data['category_identifier'])) {
2257 2257
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2258 2258
 		}
2259
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2259
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2260 2260
 
2261
-		if ( !is_array( $insert_ids ) ) {
2262
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2263
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2261
+		if ( ! is_array($insert_ids)) {
2262
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2263
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2264 2264
 		} else {
2265 2265
 			$cat_id = $insert_ids['term_id'];
2266
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2267
-			EE_Error::add_success( $msg );
2266
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2267
+			EE_Error::add_success($msg);
2268 2268
 		}
2269 2269
 
2270 2270
 		return $cat_id;
@@ -2273,32 +2273,32 @@  discard block
 block discarded – undo
2273 2273
 
2274 2274
 
2275 2275
 
2276
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2276
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2277 2277
 		global $wpdb;
2278 2278
 
2279 2279
 		//testing term stuff
2280
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2282
-		$limit = ($current_page-1)*$per_page;
2280
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2281
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2282
+		$limit = ($current_page - 1) * $per_page;
2283 2283
 
2284
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2284
+		$where = array('taxonomy' => 'espresso_event_categories');
2285 2285
 
2286
-		if ( isset( $this->_req_data['s'] ) ) {
2287
-			$sstr = '%' . $this->_req_data['s'] . '%';
2286
+		if (isset($this->_req_data['s'])) {
2287
+			$sstr = '%'.$this->_req_data['s'].'%';
2288 2288
 			$where['OR'] = array(
2289
-				'Term.name' => array( 'LIKE', $sstr),
2290
-				'description' => array( 'LIKE', $sstr )
2289
+				'Term.name' => array('LIKE', $sstr),
2290
+				'description' => array('LIKE', $sstr)
2291 2291
 				);
2292 2292
 		}
2293 2293
 
2294 2294
 		$query_params = array(
2295
-			$where ,
2296
-			'order_by' => array( $orderby => $order ),
2297
-			'limit' => $limit . ',' . $per_page,
2295
+			$where,
2296
+			'order_by' => array($orderby => $order),
2297
+			'limit' => $limit.','.$per_page,
2298 2298
 			'force_join' => array('Term')
2299 2299
 			);
2300 2300
 
2301
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2301
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2302 2302
 
2303 2303
 		return $categories;
2304 2304
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function instance() {
42 42
 		// check if class object is instantiated
43
-		if (  ! self::$_instance instanceof EE_Admin ) {
43
+		if ( ! self::$_instance instanceof EE_Admin) {
44 44
 			self::$_instance = new self();
45 45
 		}
46 46
 		return self::$_instance;
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		// define global EE_Admin constants
58 58
 		$this->_define_all_constants();
59 59
 		// set autoloaders for our admin page classes based on included path information
60
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
60
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
61 61
 		// admin hooks
62
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
62
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
63 63
 		// load EE_Request_Handler early
64
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
65
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
64
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
65
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
66 66
 		// post shortcode tracking
67 67
 		add_action(
68 68
 			'AHEE__EE_System__initialize_last',
69
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
69
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
70 70
 		);
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin === $main_file ) {
122
+		 if ($plugin === $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -174,31 +174,31 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177
-		if ( EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance ){
177
+		if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
178 178
 			//ok so we want to enable the entire admin
179
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
180
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
179
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
180
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
181
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
182 182
 			//at a glance dashboard widget
183
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
183
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
184 184
 			//filter for get_edit_post_link used on comments for custom post types
185
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
185
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
186 186
 		}
187 187
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
188
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
188
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
189 189
 			try {
190 190
 				//this loads the controller for the admin pages which will setup routing etc
191
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
192
-			} catch ( EE_Error $e ) {
191
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
192
+			} catch (EE_Error $e) {
193 193
 				$e->get_error();
194 194
 			}
195 195
 		}
196
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
196
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
197 197
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
198
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
199
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
198
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
199
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
200 200
 		//exclude EE critical pages from all nav menus and wp_list_pages
201
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
201
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
202 202
 	}
203 203
 
204 204
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param  object $post_type WP post type object
212 212
 	 * @return object            WP post type object
213 213
 	 */
214
-	public function remove_pages_from_nav_menu( $post_type ) {
214
+	public function remove_pages_from_nav_menu($post_type) {
215 215
 		//if this isn't the "pages" post type let's get out
216
-		if ( $post_type->name !== 'page' ) {
216
+		if ($post_type->name !== 'page') {
217 217
 			return $post_type;
218 218
 		}
219 219
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function enable_hidden_ee_nav_menu_metaboxes() {
235 235
 		global $wp_meta_boxes, $pagenow;
236
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
236
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
237 237
 			return;
238 238
 		}
239 239
 		$user = wp_get_current_user();
240 240
 		//has this been done yet?
241
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
241
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
246
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
245
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
246
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
247 247
 
248
-		if ( is_array( $hidden_meta_boxes ) ) {
249
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
250
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
251
-					unset( $hidden_meta_boxes[ $key ] );
248
+		if (is_array($hidden_meta_boxes)) {
249
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
250
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
251
+					unset($hidden_meta_boxes[$key]);
252 252
 				}
253 253
 			}
254 254
 		}
255 255
 
256
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
257
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
256
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
257
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
258 258
 	}
259 259
 
260 260
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return void
274 274
 	 */
275 275
 	public function register_custom_nav_menu_boxes() {
276
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
276
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
277 277
 	}
278 278
 
279 279
 
@@ -289,17 +289,17 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string  the (maybe) modified link
291 291
 	 */
292
-	public function modify_edit_post_link( $link, $id ) {
293
-		if ( ! $post = get_post( $id ) ){
292
+	public function modify_edit_post_link($link, $id) {
293
+		if ( ! $post = get_post($id)) {
294 294
 			return $link;
295 295
 		}
296
-		if ( $post->post_type === 'espresso_attendees' ) {
296
+		if ($post->post_type === 'espresso_attendees') {
297 297
 			$query_args = array(
298 298
 				'action' => 'edit_attendee',
299 299
 				'post' => $id
300 300
 			);
301 301
 			EE_Registry::instance()->load_helper('URL');
302
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
302
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
303 303
 		}
304 304
 		return $link;
305 305
 	}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		global $nav_menu_selected_id;
312 312
 
313 313
 		$db_fields = false;
314
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
314
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
315 315
 		$current_tab = 'event-archives';
316 316
 
317 317
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 		?>
331 331
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
332 332
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
333
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
334
-					<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">
335
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
333
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
334
+					<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">
335
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
336 336
 					</a>
337 337
 				</li>
338 338
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
  			<?php */ ?>
351 351
 
352 352
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
353
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
353
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
354 354
 			?>">
355 355
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
356 356
 					<?php
357 357
 					$pages = $this->_get_extra_nav_menu_pages_items();
358 358
 					$args['walker'] = $walker;
359
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
359
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
360 360
 					?>
361 361
 				</ul>
362 362
 			</div><!-- /.tabs-panel -->
@@ -364,18 +364,18 @@  discard block
 block discarded – undo
364 364
 			<p class="button-controls">
365 365
 				<span class="list-controls">
366 366
 					<a href="<?php
367
-						echo esc_url( add_query_arg(
367
+						echo esc_url(add_query_arg(
368 368
 							array(
369 369
 								'extra-nav-menu-pages-tab' => 'event-archives',
370 370
 								'selectall' => 1,
371 371
 							),
372
-							remove_query_arg( $removed_args )
372
+							remove_query_arg($removed_args)
373 373
 						));
374 374
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
375 375
 				</span>
376 376
 
377 377
 				<span class="add-to-menu">
378
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
378
+					<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'); ?>" />
379 379
 					<span class="spinner"></span>
380 380
 				</span>
381 381
 			</p>
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
 	private function _get_extra_nav_menu_pages_items() {
397 397
 		$menuitems[] = array(
398 398
 			'title' => __('Event List', 'event_espresso'),
399
-			'url' => get_post_type_archive_link( 'espresso_events' ),
399
+			'url' => get_post_type_archive_link('espresso_events'),
400 400
 			'description' => __('Archive page for all events.', 'event_espresso')
401 401
 		);
402
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
402
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
403 403
 	}
404 404
 
405 405
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 * @param $menu_item_values
412 412
 	 * @return stdClass
413 413
 	 */
414
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
414
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
415 415
 		$menu_item = new stdClass();
416 416
 		$keys = array(
417 417
 			'ID' => 0,
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 			'xfn' => ''
432 432
 		);
433 433
 
434
-		foreach ( $keys as $key => $value) {
435
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
434
+		foreach ($keys as $key => $value) {
435
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
436 436
 		}
437 437
 		return $menu_item;
438 438
 	}
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 		 * - check if doing post processing of one of EE CPTs
472 472
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
473 473
 		 */
474
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
475
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
476
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
474
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
475
+			EE_Registry::instance()->load_core('Register_CPTs');
476
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
477 477
 		}
478 478
 
479 479
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
483 483
 		 */
484 484
 		global $pagenow;
485
-		if ( $pagenow === 'options-reading.php' ) {
486
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
485
+		if ($pagenow === 'options-reading.php') {
486
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
487 487
 		}
488 488
 
489 489
 	}
@@ -495,25 +495,25 @@  discard block
 block discarded – undo
495 495
 	 * @param string $output  Current output.
496 496
 	 * @return string
497 497
 	 */
498
-	public function modify_dropdown_pages( $output ) {
498
+	public function modify_dropdown_pages($output) {
499 499
 		//get critical pages
500 500
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
501 501
 
502 502
 		//split current output by line break for easier parsing.
503
-		$split_output = explode( "\n", $output );
503
+		$split_output = explode("\n", $output);
504 504
 
505 505
 		//loop through to remove any critical pages from the array.
506
-		foreach ( $critical_pages as $page_id ) {
507
-			$needle = 'value="' . $page_id . '"';
508
-			foreach( $split_output as $key => $haystack ) {
509
-				if( strpos( $haystack, $needle ) !== false ) {
510
-					unset( $split_output[$key] );
506
+		foreach ($critical_pages as $page_id) {
507
+			$needle = 'value="'.$page_id.'"';
508
+			foreach ($split_output as $key => $haystack) {
509
+				if (strpos($haystack, $needle) !== false) {
510
+					unset($split_output[$key]);
511 511
 				}
512 512
 			}
513 513
 		}
514 514
 
515 515
 		//replace output with the new contents
516
-		return implode( "\n", $split_output );
516
+		return implode("\n", $split_output);
517 517
 	}
518 518
 
519 519
 
@@ -527,37 +527,37 @@  discard block
 block discarded – undo
527 527
 	public function enqueue_admin_scripts() {
528 528
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
529 529
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
530
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
530
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
531 531
 		// register cookie script for future dependencies
532
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
532
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
533 533
 		// 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' );
534
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
534
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
535 535
 			// register jQuery Validate
536
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
536
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
537 537
 		}
538 538
 		//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' );
539
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
539
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
540 540
 			//joyride style
541
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
542
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
543
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
541
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
542
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
543
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
544 544
 			//joyride JS
545
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
545
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
546 546
 			// wanna go for a joyride?
547 547
 			wp_enqueue_style('ee-joyride-css');
548 548
 			wp_enqueue_script('jquery-joyride');
549 549
 		}
550 550
 		//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' );
551
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
551
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
552 552
 			EE_Registry::instance()->load_helper('Qtip_Loader');
553 553
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
554 554
 		}
555 555
 		//accounting.js library
556 556
 		// @link http://josscrowcroft.github.io/accounting.js/
557
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
558
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
559
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
560
-			wp_enqueue_script( 'ee-accounting' );
557
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
558
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
559
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
560
+			wp_enqueue_script('ee-accounting');
561 561
 			// array of settings to get converted to JSON array via wp_localize_script
562 562
 			$currency_config = array(
563 563
 				'currency' => array(
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 	public function get_persistent_admin_notices() {
605 605
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
606 606
 		$args = array(
607
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
608
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
607
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
608
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
609 609
 		);
610
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
611
-		echo EE_Error::get_persistent_admin_notices( $return_url );
610
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
611
+		echo EE_Error::get_persistent_admin_notices($return_url);
612 612
 	}
613 613
 
614 614
 
@@ -629,26 +629,26 @@  discard block
 block discarded – undo
629 629
 	 * @param $elements
630 630
 	 * @return array
631 631
 	 */
632
-	public function dashboard_glance_items( $elements ) {
632
+	public function dashboard_glance_items($elements) {
633 633
 		$events = EEM_Event::instance()->count();
634
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
635
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
634
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
635
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
636 636
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
637 637
 		$registrations = EEM_Registration::instance()->count(
638 638
 			array(
639 639
 				array(
640
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
640
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
641 641
 				)
642 642
 			)
643 643
 		);
644
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
645
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
644
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
645
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
646 646
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
647 647
 
648
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
648
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
649 649
 
650
-		foreach ( $items as $type => $item_properties ) {
651
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
650
+		foreach ($items as $type => $item_properties) {
651
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
652 652
 		}
653 653
 		return $elements;
654 654
 	}
@@ -665,32 +665,32 @@  discard block
 block discarded – undo
665 665
 	 * @throws EE_Error
666 666
 	 * @return    string
667 667
 	 */
668
-	public function check_for_invalid_datetime_formats( $value, $option ) {
669
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
668
+	public function check_for_invalid_datetime_formats($value, $option) {
669
+		EE_Registry::instance()->load_helper('DTT_Helper');
670 670
 		// check for date_format or time_format
671
-		switch ( $option ) {
671
+		switch ($option) {
672 672
 			case 'date_format' :
673
-				$date_time_format = $value . ' ' . get_option('time_format');
673
+				$date_time_format = $value.' '.get_option('time_format');
674 674
 				break;
675 675
 			case 'time_format' :
676
-				$date_time_format = get_option('date_format') . ' ' . $value;
676
+				$date_time_format = get_option('date_format').' '.$value;
677 677
 				break;
678 678
 			default :
679 679
 				$date_time_format = FALSE;
680 680
 		}
681 681
 		// do we have a date_time format to check ?
682
-		if ( $date_time_format ) {
683
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
682
+		if ($date_time_format) {
683
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
684 684
 
685
-			if ( is_array( $error_msg ) ) {
686
-				$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>';
685
+			if (is_array($error_msg)) {
686
+				$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>';
687 687
 
688 688
 
689
-				foreach ( $error_msg as $error ) {
690
-					$msg .= '<li>' . $error . '</li>';
689
+				foreach ($error_msg as $error) {
690
+					$msg .= '<li>'.$error.'</li>';
691 691
 				}
692 692
 
693
-				$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>';
693
+				$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>';
694 694
 
695 695
 				// trigger WP settings error
696 696
 				add_settings_error(
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 				);
701 701
 
702 702
 				// set format to something valid
703
-				switch ( $option ) {
703
+				switch ($option) {
704 704
 					case 'date_format' :
705 705
 						$value = 'F j, Y';
706 706
 						break;
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 	 * @param $content
723 723
 	 * @return    string
724 724
 	 */
725
-	public function its_eSpresso( $content ) {
726
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
725
+	public function its_eSpresso($content) {
726
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
727 727
 	}
728 728
 
729 729
 
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
 	 */
737 737
 	public function espresso_admin_footer() {
738 738
 		return sprintf(
739
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
739
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
740 740
 			'<a href="https://eventespresso.com/" title="',
741
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
741
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
742 742
 		);
743 743
 	}
744 744
 
@@ -758,12 +758,12 @@  discard block
 block discarded – undo
758 758
 	 * @param array $config
759 759
 	 * @return void
760 760
 	 */
761
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
762
-		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' );
763
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
761
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
762
+		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');
763
+		if (class_exists('EE_Register_Admin_Page')) {
764 764
 			$config['page_path'] = $page_path;
765 765
 		}
766
-		EE_Register_Admin_Page::register( $page_basename, $config );
766
+		EE_Register_Admin_Page::register($page_basename, $config);
767 767
 
768 768
 	}
769 769
 
Please login to merge, or discard this patch.