Completed
Branch BUG-9492-refactor-activation-l... (cb6da3)
by
unknown
33:41 queued 23:07
created
core/EE_Config.core.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 *    update_espresso_config
364 364
 	 *
365 365
 	 * @access   public
366
-	 * @return   bool
366
+	 * @return   boolean|null
367 367
 	 */
368 368
 	protected function  _reset_espresso_addon_config() {
369 369
 		$this->_config_option_names = array();
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 * @param    string                $name
444 444
 	 * @param    string                $config_class
445 445
 	 * @param    EE_Config_Base 	$config_obj
446
-	 * @param    array                 $tests_to_run
446
+	 * @param    integer[]                 $tests_to_run
447 447
 	 * @param    bool                  $display_errors
448 448
 	 * @return    bool    TRUE on success, FALSE on fail
449 449
 	 */
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 
1593 1593
 
1594 1594
 	/**
1595
-	 * @return array
1595
+	 * @return integer[]
1596 1596
 	 */
1597 1597
 	public function get_critical_pages_array() {
1598 1598
 		return array(
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 
1606 1606
 
1607 1607
 	/**
1608
-	 * @return array
1608
+	 * @return string[]
1609 1609
 	 */
1610 1610
 	public function get_critical_pages_shortcodes_array() {
1611 1611
 		return array(
@@ -1928,7 +1928,7 @@  discard block
 block discarded – undo
1928 1928
 	 *    class constructor
1929 1929
 	 *
1930 1930
 	 * @access    public
1931
-	 * @param null $CNT_ISO
1931
+	 * @param string $CNT_ISO
1932 1932
 	 * @return \EE_Currency_Config
1933 1933
 	 */
1934 1934
 	public function __construct( $CNT_ISO = NULL ) {
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 	 *
2568 2568
 	 * @param int $input_count the count of input vars.
2569 2569
 	 *
2570
-	 * @return array {
2570
+	 * @return string {
2571 2571
 	 *         An array that represents whether available space and if no available space the error message.
2572 2572
 	 *         @type bool $has_space		whether more inputs can be added.
2573 2573
 	 *         @type string $msg 		Any message to be displayed.
Please login to merge, or discard this patch.
Spacing   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public static function instance() {
130 130
 		// check if class object is instantiated, and instantiated properly
131
-		if ( ! self::$_instance instanceof EE_Config ) {
131
+		if ( ! self::$_instance instanceof EE_Config) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 	 * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode)
146 146
 	 * @return EE_Config
147 147
 	 */
148
-	public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){
149
-		if ( $hard_reset ) {
148
+	public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) {
149
+		if ($hard_reset) {
150 150
 			self::$_instance->_config_option_names = array();
151 151
 			self::$_instance->_initialize_config();
152 152
 			self::$_instance->update_espresso_config();
153 153
 		}
154
-		if( self::$_instance instanceof EE_Config ){
154
+		if (self::$_instance instanceof EE_Config) {
155 155
 			self::$_instance->shutdown();
156 156
 		}
157 157
 		self::$_instance = NULL;
158 158
 		//we don't need to reset the static properties imo because those should
159 159
 		//only change when a module is added or removed. Currently we don't
160 160
 		//support removing a module during a request when it previously existed
161
-		if( $reinstantiate ){
161
+		if ($reinstantiate) {
162 162
 			return self::instance();
163
-		}else{
163
+		} else {
164 164
 			return NULL;
165 165
 		}
166 166
 	}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @return \EE_Config
175 175
 	 */
176 176
 	private function __construct() {
177
-		do_action( 'AHEE__EE_Config__construct__begin',$this );
178
-		$this->_config_option_names = get_option( 'ee_config_option_names', array() );
177
+		do_action('AHEE__EE_Config__construct__begin', $this);
178
+		$this->_config_option_names = get_option('ee_config_option_names', array());
179 179
 		// setup empty config classes
180 180
 		$this->_initialize_config();
181 181
 		// load existing EE site settings
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 		// confirm everything loaded correctly and set filtered defaults if not
184 184
 		$this->_verify_config();
185 185
 		//  register shortcodes and modules
186
-		add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 );
186
+		add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999);
187 187
 		//  initialize shortcodes and modules
188
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ));
188
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
189 189
 		// register widgets
190
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
190
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
191 191
 		// shutdown
192
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
192
+		add_action('shutdown', array($this, 'shutdown'), 10);
193 193
 		// construct__end hook
194
-		do_action( 'AHEE__EE_Config__construct__end',$this );
194
+		do_action('AHEE__EE_Config__construct__end', $this);
195 195
 		// hardcoded hack
196 196
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
197 197
 	}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return string current theme set.
205 205
 	 */
206 206
 	public static function get_current_theme() {
207
-		return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
207
+		return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
208 208
 	}
209 209
 
210 210
 
@@ -238,27 +238,27 @@  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
-			$settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this );
246
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
247
-				$this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
245
+			$settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this);
246
+			if (is_object($settings) && property_exists($this, $config)) {
247
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
248 248
 				//call configs populate method to ensure any defaults are set for empty values.
249
-				if ( method_exists( $settings, 'populate' ) ) {
249
+				if (method_exists($settings, 'populate')) {
250 250
 					$this->{$config}->populate();
251 251
 				}
252
-				if ( method_exists( $settings, 'do_hooks' ) ) {
252
+				if (method_exists($settings, 'do_hooks')) {
253 253
 					$this->{$config}->do_hooks();
254 254
 				}
255 255
 			}
256 256
 		}
257
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) {
257
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) {
258 258
 			$this->update_espresso_config();
259 259
 		}
260 260
 		// load_core_config__end hook
261
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
261
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
262 262
 	}
263 263
 
264 264
 
@@ -272,40 +272,40 @@  discard block
 block discarded – undo
272 272
 	protected function _verify_config() {
273 273
 
274 274
 		$this->core = $this->core instanceof EE_Core_Config
275
-			? $this->core  : new EE_Core_Config();
276
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
275
+			? $this->core : new EE_Core_Config();
276
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
277 277
 
278 278
 		$this->organization = $this->organization instanceof EE_Organization_Config
279
-			? $this->organization  : new EE_Organization_Config();
280
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
279
+			? $this->organization : new EE_Organization_Config();
280
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
281 281
 
282 282
 		$this->currency = $this->currency instanceof EE_Currency_Config
283 283
 			? $this->currency : new EE_Currency_Config();
284
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
284
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
285 285
 
286 286
 		$this->registration = $this->registration instanceof EE_Registration_Config
287 287
 			? $this->registration : new EE_Registration_Config();
288
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
288
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
289 289
 
290 290
 		$this->admin = $this->admin instanceof EE_Admin_Config
291 291
 			? $this->admin : new EE_Admin_Config();
292
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
292
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
293 293
 
294 294
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
295 295
 			? $this->template_settings : new EE_Template_Config();
296
-		$this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings );
296
+		$this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings);
297 297
 
298 298
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
299 299
 			? $this->map_settings : new EE_Map_Config();
300
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
300
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
301 301
 
302 302
 		$this->environment = $this->environment instanceof EE_Environment_Config
303 303
 			? $this->environment : new EE_Environment_Config();
304
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
304
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
305 305
 
306 306
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
307 307
 			? $this->gateway : new EE_Gateway_Config();
308
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
308
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
309 309
 
310 310
 	}
311 311
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	public function get_espresso_config() {
321 321
 		// grab espresso configuration
322
-		return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() ));
322
+		return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array()));
323 323
 	}
324 324
 
325 325
 
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 * @param        $old_value
333 333
 	 * @param        $value
334 334
 	 */
335
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
335
+	public function double_check_config_comparison($option = '', $old_value, $value) {
336 336
 		// make sure we're checking the ee config
337
-		if ( $option == 'ee_config' ) {
337
+		if ($option == 'ee_config') {
338 338
 			// run a loose comparison of the old value against the new value for type and properties,
339 339
 			// but NOT exact instance like WP update_option does
340
-			if ( $value != $old_value ) {
340
+			if ($value != $old_value) {
341 341
 				// if they are NOT the same, then remove the hook,
342 342
 				// which means the subsequent update results will be based solely on the update query results
343 343
 				// the reason we do this is because, as stated above,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				// the string it sees in the db looks the same as the new one it has been passed!!!
353 353
 				// This results in the query returning an "affected rows" value of ZERO,
354 354
 				// which gets returned immediately by WP update_option and looks like an error.
355
-				remove_action( 'update_option', array( $this, 'check_config_updated' ));
355
+				remove_action('update_option', array($this, 'check_config_updated'));
356 356
 			}
357 357
 		}
358 358
 	}
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	protected function  _reset_espresso_addon_config() {
369 369
 		$this->_config_option_names = array();
370
-		foreach( $this->addons as $addon_name => $addon_config_obj ) {
371
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
372
-			$config_class = get_class( $addon_config_obj );
373
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
374
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE );
370
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
371
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
372
+			$config_class = get_class($addon_config_obj);
373
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
374
+				$this->update_config('addons', $addon_name, $addon_config_obj, FALSE);
375 375
 			}
376 376
 			$this->addons->{$addon_name} = NULL;
377 377
 		}
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
 	 * @param   bool $add_error
388 388
 	 * @return   bool
389 389
 	 */
390
-	public function  update_espresso_config( $add_success = FALSE, $add_error = TRUE ) {
390
+	public function  update_espresso_config($add_success = FALSE, $add_error = TRUE) {
391 391
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
392 392
 		//$clone = clone( self::$_instance );
393 393
 		//self::$_instance = NULL;
394
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this );
394
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
395 395
 		$this->_reset_espresso_addon_config();
396 396
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
397 397
 		// but BEFORE the actual update occurs
398
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
398
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
399 399
 		// now update "ee_config"
400
-		$saved = update_option( 'ee_config', $this );
400
+		$saved = update_option('ee_config', $this);
401 401
 		// if not saved... check if the hook we just added still exists;
402 402
 		// if it does, it means one of two things:
403 403
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 		// but just means no update occurred, so don't display an error to the user.
409 409
 		// BUT... if update_option returns FALSE, AND the hook is missing,
410 410
 		// then it means that something truly went wrong
411
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved;
411
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
412 412
 		// remove our action since we don't want it in the system anymore
413
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
414
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
413
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
414
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
415 415
 		//self::$_instance = $clone;
416 416
 		//unset( $clone );
417 417
 		// if config remains the same or was updated successfully
418
-		if ( $saved ) {
419
-			if ( $add_success ) {
418
+		if ($saved) {
419
+			if ($add_success) {
420 420
 				EE_Error::add_success(
421
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
421
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
422 422
 					__FILE__, __FUNCTION__, __LINE__
423 423
 				);
424 424
 			}
425 425
 			return TRUE;
426 426
 		} else {
427
-			if ( $add_error ) {
427
+			if ($add_error) {
428 428
 				EE_Error::add_error(
429
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
429
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
430 430
 					__FILE__, __FUNCTION__, __LINE__
431 431
 				);
432 432
 			}
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 		$name = '',
453 453
 		$config_class = '',
454 454
 		$config_obj = NULL,
455
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
455
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
456 456
 		$display_errors = TRUE
457 457
 	) {
458 458
 		try {
459
-			foreach ( $tests_to_run as $test ) {
460
-				switch ( $test ) {
459
+			foreach ($tests_to_run as $test) {
460
+				switch ($test) {
461 461
 
462 462
 					// TEST #1 : check that section was set
463 463
 					case 1 :
464
-						if ( empty( $section ) ) {
465
-							if ( $display_errors ) {
464
+						if (empty($section)) {
465
+							if ($display_errors) {
466 466
 								throw new EE_Error(
467 467
 									sprintf(
468
-										__( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ),
468
+										__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'),
469 469
 										$config_class
470 470
 									)
471 471
 								);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 					// TEST #2 : check that settings section exists
478 478
 					case 2 :
479
-						if ( ! isset( $this->{$section} ) ) {
480
-							if ( $display_errors ) {
479
+						if ( ! isset($this->{$section} )) {
480
+							if ($display_errors) {
481 481
 								throw new EE_Error(
482
-									sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ),
483
-											 $section )
482
+									sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'),
483
+											 $section)
484 484
 								);
485 485
 							}
486 486
 							return false;
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 					// TEST #3 : check that section is the proper format
491 491
 					case 3 :
492 492
 						if (
493
-							! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
493
+							! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
494 494
 						) {
495
-							if ( $display_errors ) {
495
+							if ($display_errors) {
496 496
 								throw new EE_Error(
497 497
 									sprintf(
498
-										__( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ),
498
+										__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'),
499 499
 										$section
500 500
 									)
501 501
 								);
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 
507 507
 					// TEST #4 : check that config section name has been set
508 508
 					case 4 :
509
-						if ( empty( $name ) ) {
510
-							if ( $display_errors ) {
509
+						if (empty($name)) {
510
+							if ($display_errors) {
511 511
 								throw new EE_Error(
512
-									__( 'No name has been provided for the specific configuration section.', 'event_espresso' )
512
+									__('No name has been provided for the specific configuration section.', 'event_espresso')
513 513
 								);
514 514
 							}
515 515
 							return false;
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 
519 519
 					// TEST #5 : check that a config class name has been set
520 520
 					case 5 :
521
-						if ( empty( $config_class ) ) {
522
-							if ( $display_errors ) {
521
+						if (empty($config_class)) {
522
+							if ($display_errors) {
523 523
 								throw new EE_Error(
524
-									__( 'No class name has been provided for the specific configuration section.', 'event_espresso' )
524
+									__('No class name has been provided for the specific configuration section.', 'event_espresso')
525 525
 								);
526 526
 							}
527 527
 							return false;
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 
531 531
 					// TEST #6 : verify config class is accessible
532 532
 					case 6 :
533
-						if ( ! class_exists( $config_class ) ) {
534
-							if ( $display_errors ) {
533
+						if ( ! class_exists($config_class)) {
534
+							if ($display_errors) {
535 535
 								throw new EE_Error(
536 536
 									sprintf(
537
-										__( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ),
537
+										__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'),
538 538
 										$config_class
539 539
 									)
540 540
 								);
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 
546 546
 					// TEST #7 : check that config has even been set
547 547
 					case 7 :
548
-						if ( ! isset( $this->{$section}->{$name} ) ) {
549
-							if ( $display_errors ) {
548
+						if ( ! isset($this->{$section}->{$name} )) {
549
+							if ($display_errors) {
550 550
 								throw new EE_Error(
551 551
 									sprintf(
552
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
552
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
553 553
 										$section,
554 554
 										$name
555 555
 									)
@@ -558,17 +558,17 @@  discard block
 block discarded – undo
558 558
 							return false;
559 559
 						} else {
560 560
 							// and make sure it's not serialized
561
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
561
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
562 562
 						}
563 563
 						break;
564 564
 
565 565
 					// TEST #8 : check that config is the requested type
566 566
 					case 8 :
567
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
568
-							if ( $display_errors ) {
567
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
568
+							if ($display_errors) {
569 569
 								throw new EE_Error(
570 570
 									sprintf(
571
-										__( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ),
571
+										__('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'),
572 572
 										$section,
573 573
 										$name,
574 574
 										$config_class
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 
582 582
 					// TEST #9 : verify config object
583 583
 					case 9 :
584
-						if ( ! $config_obj instanceof EE_Config_Base ) {
585
-							if ( $display_errors ) {
584
+						if ( ! $config_obj instanceof EE_Config_Base) {
585
+							if ($display_errors) {
586 586
 								throw new EE_Error(
587 587
 									sprintf(
588
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
589
-										print_r( $config_obj, true )
588
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
589
+										print_r($config_obj, true)
590 590
 									)
591 591
 								);
592 592
 							}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 			}
599 599
 
600
-		} catch( EE_Error $e ) {
600
+		} catch (EE_Error $e) {
601 601
 			$e->get_error();
602 602
 		}
603 603
 		// you have successfully run the gauntlet
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
 	 * @param        string          $name
615 615
 	 * @return        string
616 616
 	 */
617
-	private function _generate_config_option_name( $section = '', $name = '' ) {
618
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
617
+	private function _generate_config_option_name($section = '', $name = '') {
618
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
619 619
 	}
620 620
 
621 621
 
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
 	 * @param 	string $name
630 630
 	 * @return 	string
631 631
 	 */
632
-	private function _set_config_class( $config_class = '', $name = '' ) {
633
-		return ! empty( $config_class )
632
+	private function _set_config_class($config_class = '', $name = '') {
633
+		return ! empty($config_class)
634 634
 			? $config_class
635
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
635
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
636 636
 	}
637 637
 
638 638
 
@@ -646,34 +646,34 @@  discard block
 block discarded – undo
646 646
 	 * @param 	EE_Config_Base $config_obj
647 647
 	 * @return 	EE_Config_Base
648 648
 	 */
649
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
649
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
650 650
 		// ensure config class is set to something
651
-		$config_class = $this->_set_config_class( $config_class, $name );
651
+		$config_class = $this->_set_config_class($config_class, $name);
652 652
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
653
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) {
653
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
654 654
 			return null;
655 655
 		}
656
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
656
+		$config_option_name = $this->_generate_config_option_name($section, $name);
657 657
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
658
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
659
-			$this->_config_option_names[ $config_option_name ] = $config_class;
658
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
659
+			$this->_config_option_names[$config_option_name] = $config_class;
660 660
 		}
661 661
 		// verify the incoming config object but suppress errors
662
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) {
662
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
663 663
 			$config_obj = new $config_class();
664 664
 		}
665
-		if ( get_option( $config_option_name ) ) {
666
-			update_option( $config_option_name, $config_obj );
665
+		if (get_option($config_option_name)) {
666
+			update_option($config_option_name, $config_obj);
667 667
 			$this->{$section}->{$name} = $config_obj;
668 668
 			return $this->{$section}->{$name};
669 669
 		} else {
670 670
 			// create a wp-option for this config
671
-			if ( add_option( $config_option_name, $config_obj, '', 'no' )) {
672
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
671
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
672
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
673 673
 				return $this->{$section}->{$name};
674 674
 			} else {
675 675
 				EE_Error::add_error(
676
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
676
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
677 677
 					__FILE__, __FUNCTION__, __LINE__
678 678
 				);
679 679
 				return null;
@@ -694,37 +694,37 @@  discard block
 block discarded – undo
694 694
 	 * @param 	bool 					$throw_errors
695 695
 	 * @return 	bool
696 696
 	 */
697
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
698
-		$config_obj = maybe_unserialize( $config_obj );
697
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
698
+		$config_obj = maybe_unserialize($config_obj);
699 699
 		// get class name of the incoming object
700
-		$config_class = get_class( $config_obj );
700
+		$config_class = get_class($config_obj);
701 701
 		// run tests 1-5 and 9 to verify config
702
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) {
702
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) {
703 703
 			return false;
704 704
 		}
705
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
705
+		$config_option_name = $this->_generate_config_option_name($section, $name);
706 706
 		// check if config object has been added to db by seeing if config option name is in $this->_config_option_names array
707
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
707
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
708 708
 			// save new config to db
709
-			return $this->set_config( $section, $name, $config_class, $config_obj );
709
+			return $this->set_config($section, $name, $config_class, $config_obj);
710 710
 		} else {
711 711
 			// first check if the record already exists
712
-			$existing_config = get_option( $config_option_name );
713
-			$config_obj = serialize( $config_obj );
712
+			$existing_config = get_option($config_option_name);
713
+			$config_obj = serialize($config_obj);
714 714
 			// just return if db record is already up to date
715
-			if ( $existing_config == $config_obj ) {
715
+			if ($existing_config == $config_obj) {
716 716
 				$this->{$section}->{$name} = $config_obj;
717 717
 				return true;
718
-			} else if ( update_option( $config_option_name, $config_obj )) {
718
+			} else if (update_option($config_option_name, $config_obj)) {
719 719
 				// update wp-option for this config class
720 720
 				$this->{$section}->{$name} = $config_obj;
721 721
 				return true;
722
-			} elseif ( $throw_errors ) {
722
+			} elseif ($throw_errors) {
723 723
 				EE_Error::add_error(
724 724
 					sprintf(
725
-						__( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ),
725
+						__('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'),
726 726
 						$config_class,
727
-						'EE_Config->' . $section . '->' . $name
727
+						'EE_Config->'.$section.'->'.$name
728 728
 					),
729 729
 					__FILE__, __FUNCTION__, __LINE__
730 730
 				);
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param 	string 	$config_class
745 745
 	 * @return 	mixed EE_Config_Base | NULL
746 746
 	 */
747
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
747
+	public function get_config($section = '', $name = '', $config_class = '') {
748 748
 		// ensure config class is set to something
749
-		$config_class = $this->_set_config_class( $config_class, $name );
749
+		$config_class = $this->_set_config_class($config_class, $name);
750 750
 		// run tests 1-4, 6 and 7 to verify that all params have been set
751
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
751
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
752 752
 			return NULL;
753 753
 		}
754 754
 		// now test if the requested config object exists, but suppress errors
755
-		if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) {
755
+		if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) {
756 756
 			// config already exists, so pass it back
757 757
 			return $this->{$section}->{$name};
758 758
 		}
759 759
 		// load config option from db if it exists
760
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ));
760
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
761 761
 		// verify the newly retrieved config object, but suppress errors
762
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
762
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
763 763
 			// config is good, so set it and pass it back
764 764
 			$this->{$section}->{$name} = $config_obj;
765 765
 			return $this->{$section}->{$name};
766 766
 		}
767 767
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
768
-		$config_obj =$this->set_config( $section, $name, $config_class );
768
+		$config_obj = $this->set_config($section, $name, $config_class);
769 769
 		// verify the newly created config object
770
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) {
770
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
771 771
 			return $this->{$section}->{$name};
772 772
 		} else {
773 773
 			EE_Error::add_error(
774
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
774
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
775 775
 				__FILE__, __FUNCTION__, __LINE__
776 776
 			);
777 777
 		}
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * @param 	string 	$config_option_name
787 787
 	 * @return 	mixed EE_Config_Base | FALSE
788 788
 	 */
789
-	public function get_config_option( $config_option_name = '' ) {
789
+	public function get_config_option($config_option_name = '') {
790 790
 		// retrieve the wp-option for this config class.
791
-		return maybe_unserialize( get_option( $config_option_name ));
791
+		return maybe_unserialize(get_option($config_option_name));
792 792
 	}
793 793
 
794 794
 
@@ -803,14 +803,14 @@  discard block
 block discarded – undo
803 803
 	 *  @return 	string
804 804
 	 */
805 805
 	public static function get_page_for_posts() {
806
-		$page_for_posts = get_option( 'page_for_posts' );
807
-		if ( ! $page_for_posts ) {
806
+		$page_for_posts = get_option('page_for_posts');
807
+		if ( ! $page_for_posts) {
808 808
 			return 'posts';
809 809
 		}
810 810
 		/** @type WPDB $wpdb */
811 811
 		global $wpdb;
812 812
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
813
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ));
813
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
814 814
 	}
815 815
 
816 816
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	public function register_shortcodes_and_modules() {
829 829
 		// allow shortcodes to register with WP and to set hooks for the rest of the system
830
-		EE_Registry::instance()->shortcodes =$this->_register_shortcodes();
830
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
831 831
 		// allow modules to set hooks for the rest of the system
832 832
 		EE_Registry::instance()->modules = $this->_register_modules();
833 833
 	}
@@ -859,21 +859,21 @@  discard block
 block discarded – undo
859 859
 	public function widgets_init() {
860 860
 		//only init widgets on admin pages when not in complete maintenance, and
861 861
 		//on frontend when not in any maintenance mode
862
-		if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance)  || ! EE_Maintenance_Mode::instance()->level() ) {
862
+		if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) {
863 863
 			// grab list of installed widgets
864
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
864
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
865 865
 			// filter list of modules to register
866
-			$widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register );
866
+			$widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register);
867 867
 
868
-			if ( ! empty( $widgets_to_register ) ) {
868
+			if ( ! empty($widgets_to_register)) {
869 869
 				// cycle thru widget folders
870
-				foreach ( $widgets_to_register as $widget_path ) {
870
+				foreach ($widgets_to_register as $widget_path) {
871 871
 					// add to list of installed widget modules
872
-					EE_Config::register_ee_widget( $widget_path );
872
+					EE_Config::register_ee_widget($widget_path);
873 873
 				}
874 874
 			}
875 875
 			// filter list of installed modules
876
-			EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets );
876
+			EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets);
877 877
 		}
878 878
 	}
879 879
 
@@ -886,54 +886,54 @@  discard block
 block discarded – undo
886 886
 	 *  @param 	string 	$widget_path - full path up to and including widget folder
887 887
 	 *  @return 	void
888 888
 	 */
889
-	public static function register_ee_widget( $widget_path = NULL ) {
890
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
889
+	public static function register_ee_widget($widget_path = NULL) {
890
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
891 891
 		$widget_ext = '.widget.php';
892 892
 		// make all separators match
893
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
893
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
894 894
 		// does the file path INCLUDE the actual file name as part of the path ?
895
-		if ( strpos( $widget_path, $widget_ext ) !== FALSE ) {
895
+		if (strpos($widget_path, $widget_ext) !== FALSE) {
896 896
 			// grab and shortcode file name from directory name and break apart at dots
897
-			$file_name = explode( '.', basename( $widget_path ));
897
+			$file_name = explode('.', basename($widget_path));
898 898
 			// take first segment from file name pieces and remove class prefix if it exists
899
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
899
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
900 900
 			// sanitize shortcode directory name
901
-			$widget = sanitize_key( $widget );
901
+			$widget = sanitize_key($widget);
902 902
 			// now we need to rebuild the shortcode path
903
-			$widget_path = explode( DS, $widget_path );
903
+			$widget_path = explode(DS, $widget_path);
904 904
 			// remove last segment
905
-			array_pop( $widget_path );
905
+			array_pop($widget_path);
906 906
 			// glue it back together
907
-			$widget_path = implode( DS, $widget_path );
907
+			$widget_path = implode(DS, $widget_path);
908 908
 		} else {
909 909
 			// grab and sanitize widget directory name
910
-			$widget = sanitize_key( basename( $widget_path ));
910
+			$widget = sanitize_key(basename($widget_path));
911 911
 		}
912 912
 		// create classname from widget directory name
913
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget )));
913
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
914 914
 		// add class prefix
915
-		$widget_class = 'EEW_' . $widget;
915
+		$widget_class = 'EEW_'.$widget;
916 916
 		// does the widget exist ?
917
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) {
917
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
918 918
 			$msg = sprintf(
919
-				__( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ),
919
+				__('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'),
920 920
 				$widget_class,
921
-				$widget_path . DS . $widget_class . $widget_ext
921
+				$widget_path.DS.$widget_class.$widget_ext
922 922
 			);
923
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
923
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
924 924
 			return;
925 925
 		}
926 926
 		// load the widget class file
927
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
927
+		require_once($widget_path.DS.$widget_class.$widget_ext);
928 928
 		// verify that class exists
929
-		if ( ! class_exists( $widget_class )) {
930
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
931
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
929
+		if ( ! class_exists($widget_class)) {
930
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
931
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
932 932
 			return;
933 933
 		}
934
-		register_widget( $widget_class );
934
+		register_widget($widget_class);
935 935
 		// add to array of registered widgets
936
-		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
936
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
937 937
 	}
938 938
 
939 939
 
@@ -946,18 +946,18 @@  discard block
 block discarded – undo
946 946
 	 */
947 947
 	private function _register_shortcodes() {
948 948
 		// grab list of installed shortcodes
949
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
949
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
950 950
 		// filter list of modules to register
951
-		$shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register );
952
-		if ( ! empty( $shortcodes_to_register ) ) {
951
+		$shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register);
952
+		if ( ! empty($shortcodes_to_register)) {
953 953
 			// cycle thru shortcode folders
954
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
954
+			foreach ($shortcodes_to_register as $shortcode_path) {
955 955
 				// add to list of installed shortcode modules
956
-				EE_Config::register_shortcode( $shortcode_path );
956
+				EE_Config::register_shortcode($shortcode_path);
957 957
 			}
958 958
 		}
959 959
 		// filter list of installed modules
960
-		return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes );
960
+		return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes);
961 961
 	}
962 962
 
963 963
 
@@ -969,56 +969,56 @@  discard block
 block discarded – undo
969 969
 	 *  @param 	string 		$shortcode_path - full path up to and including shortcode folder
970 970
 	 *  @return 	bool
971 971
 	 */
972
-	public static function register_shortcode( $shortcode_path = NULL ) {
973
-		do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path );
972
+	public static function register_shortcode($shortcode_path = NULL) {
973
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
974 974
 		$shortcode_ext = '.shortcode.php';
975 975
 		// make all separators match
976
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
976
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
977 977
 		// does the file path INCLUDE the actual file name as part of the path ?
978
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) {
978
+		if (strpos($shortcode_path, $shortcode_ext) !== FALSE) {
979 979
 			// grab shortcode file name from directory name and break apart at dots
980
-			$shortcode_file = explode( '.', basename( $shortcode_path ));
980
+			$shortcode_file = explode('.', basename($shortcode_path));
981 981
 			// take first segment from file name pieces and remove class prefix if it exists
982
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0];
982
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0];
983 983
 			// sanitize shortcode directory name
984
-			$shortcode = sanitize_key( $shortcode );
984
+			$shortcode = sanitize_key($shortcode);
985 985
 			// now we need to rebuild the shortcode path
986
-			$shortcode_path = explode( DS, $shortcode_path );
986
+			$shortcode_path = explode(DS, $shortcode_path);
987 987
 			// remove last segment
988
-			array_pop( $shortcode_path );
988
+			array_pop($shortcode_path);
989 989
 			// glue it back together
990
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
990
+			$shortcode_path = implode(DS, $shortcode_path).DS;
991 991
 		} else {
992 992
 			// we need to generate the filename based off of the folder name
993 993
 			// grab and sanitize shortcode directory name
994
-			$shortcode = sanitize_key( basename( $shortcode_path ));
995
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
994
+			$shortcode = sanitize_key(basename($shortcode_path));
995
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
996 996
 		}
997 997
 		// create classname from shortcode directory or file name
998
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode )));
998
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
999 999
 		// add class prefix
1000
-		$shortcode_class = 'EES_' . $shortcode;
1000
+		$shortcode_class = 'EES_'.$shortcode;
1001 1001
 		// does the shortcode exist ?
1002
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) {
1002
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1003 1003
 			$msg = sprintf(
1004
-				__( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ),
1004
+				__('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'),
1005 1005
 				$shortcode_class,
1006
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1006
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1007 1007
 			);
1008
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1008
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1009 1009
 			return FALSE;
1010 1010
 		}
1011 1011
 		// load the shortcode class file
1012
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1012
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1013 1013
 		// verify that class exists
1014
-		if ( ! class_exists( $shortcode_class )) {
1015
-			$msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class );
1016
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1014
+		if ( ! class_exists($shortcode_class)) {
1015
+			$msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class);
1016
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1017 1017
 			return FALSE;
1018 1018
 		}
1019
-		$shortcode = strtoupper( $shortcode );
1019
+		$shortcode = strtoupper($shortcode);
1020 1020
 		// add to array of registered shortcodes
1021
-		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1021
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1022 1022
 		return TRUE;
1023 1023
 	}
1024 1024
 
@@ -1033,23 +1033,23 @@  discard block
 block discarded – undo
1033 1033
 	 */
1034 1034
 	private function _register_modules() {
1035 1035
 		// grab list of installed modules
1036
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1036
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1037 1037
 		// filter list of modules to register
1038
-		$modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register );
1038
+		$modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register);
1039 1039
 
1040 1040
 
1041
-		if ( ! empty( $modules_to_register ) ) {
1041
+		if ( ! empty($modules_to_register)) {
1042 1042
 			// loop through folders
1043
-			foreach ( $modules_to_register as $module_path ) {
1043
+			foreach ($modules_to_register as $module_path) {
1044 1044
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1045
-				if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) {
1045
+				if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') {
1046 1046
 					// add to list of installed modules
1047
-					EE_Config::register_module( $module_path );
1047
+					EE_Config::register_module($module_path);
1048 1048
 				}
1049 1049
 			}
1050 1050
 		}
1051 1051
 		// filter list of installed modules
1052
-		return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules );
1052
+		return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules);
1053 1053
 	}
1054 1054
 
1055 1055
 
@@ -1062,54 +1062,54 @@  discard block
 block discarded – undo
1062 1062
 	 *  @param 	string 		$module_path - full path up to and including module folder
1063 1063
 	 *  @return 	bool
1064 1064
 	 */
1065
-	public static function register_module( $module_path = NULL ) {
1066
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1065
+	public static function register_module($module_path = NULL) {
1066
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1067 1067
 		$module_ext = '.module.php';
1068 1068
 		// make all separators match
1069
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1069
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1070 1070
 		// does the file path INCLUDE the actual file name as part of the path ?
1071
-		if ( strpos( $module_path, $module_ext ) !== FALSE ) {
1071
+		if (strpos($module_path, $module_ext) !== FALSE) {
1072 1072
 			// grab and shortcode file name from directory name and break apart at dots
1073
-			$module_file = explode( '.', basename( $module_path ));
1073
+			$module_file = explode('.', basename($module_path));
1074 1074
 			// now we need to rebuild the shortcode path
1075
-			$module_path = explode( DS, $module_path );
1075
+			$module_path = explode(DS, $module_path);
1076 1076
 			// remove last segment
1077
-			array_pop( $module_path );
1077
+			array_pop($module_path);
1078 1078
 			// glue it back together
1079
-			$module_path = implode( DS, $module_path ) . DS;
1079
+			$module_path = implode(DS, $module_path).DS;
1080 1080
 			// take first segment from file name pieces and sanitize it
1081
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1081
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1082 1082
 			// ensure class prefix is added
1083
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1083
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1084 1084
 		} else {
1085 1085
 			// we need to generate the filename based off of the folder name
1086 1086
 			// grab and sanitize module name
1087
-			$module = strtolower( basename( $module_path ));
1088
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module);
1087
+			$module = strtolower(basename($module_path));
1088
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1089 1089
 			// like trailingslashit()
1090
-			$module_path = rtrim( $module_path, DS ) . DS;
1090
+			$module_path = rtrim($module_path, DS).DS;
1091 1091
 			// create classname from module directory name
1092
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module )));
1092
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1093 1093
 			// add class prefix
1094
-			$module_class = 'EED_' . $module;
1094
+			$module_class = 'EED_'.$module;
1095 1095
 		}
1096 1096
 		// does the module exist ?
1097
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) {
1098
-			$msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
1099
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1097
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1098
+			$msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
1099
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1100 1100
 			return FALSE;
1101 1101
 		}
1102 1102
 		// load the module class file
1103
-		require_once( $module_path . $module_class . $module_ext );
1103
+		require_once($module_path.$module_class.$module_ext);
1104 1104
 		// verify that class exists
1105
-		if ( ! class_exists( $module_class )) {
1106
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1107
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1105
+		if ( ! class_exists($module_class)) {
1106
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1107
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1108 1108
 			return FALSE;
1109 1109
 		}
1110 1110
 		// add to array of registered modules
1111
-		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1112
-		do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1111
+		EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1112
+		do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1113 1113
 		return TRUE;
1114 1114
 	}
1115 1115
 
@@ -1123,23 +1123,23 @@  discard block
 block discarded – undo
1123 1123
 	 */
1124 1124
 	private function _initialize_shortcodes() {
1125 1125
 		// cycle thru shortcode folders
1126
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1126
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1127 1127
 			// add class prefix
1128
-			$shortcode_class = 'EES_' . $shortcode;
1128
+			$shortcode_class = 'EES_'.$shortcode;
1129 1129
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1130 1130
 			// which set hooks ?
1131
-			if ( is_admin() ) {
1131
+			if (is_admin()) {
1132 1132
 				// fire immediately
1133
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ));
1133
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1134 1134
 			} else {
1135 1135
 				// delay until other systems are online
1136
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' ));
1136
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks'));
1137 1137
 				// convert classname to UPPERCASE and create WP shortcode.
1138
-				$shortcode_tag = strtoupper( $shortcode );
1138
+				$shortcode_tag = strtoupper($shortcode);
1139 1139
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1140
-				if ( ! shortcode_exists( $shortcode_tag )) {
1140
+				if ( ! shortcode_exists($shortcode_tag)) {
1141 1141
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1142
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ));
1142
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1143 1143
 				}
1144 1144
 			}
1145 1145
 		}
@@ -1156,15 +1156,15 @@  discard block
 block discarded – undo
1156 1156
 	 */
1157 1157
 	private function _initialize_modules() {
1158 1158
 		// cycle thru shortcode folders
1159
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1159
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1160 1160
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1161 1161
 			// which set hooks ?
1162
-			if ( is_admin() ) {
1162
+			if (is_admin()) {
1163 1163
 				// fire immediately
1164
-				call_user_func( array( $module_class, 'set_hooks_admin' ));
1164
+				call_user_func(array($module_class, 'set_hooks_admin'));
1165 1165
 			} else {
1166 1166
 				// delay until other systems are online
1167
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' ));
1167
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks'));
1168 1168
 			}
1169 1169
 		}
1170 1170
 	}
@@ -1182,26 +1182,26 @@  discard block
 block discarded – undo
1182 1182
 	 *  @param 	string 		$key - url param key indicating a route is being called
1183 1183
 	 *  @return 	bool
1184 1184
 	 */
1185
-	public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) {
1186
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1187
-		$module = str_replace( 'EED_', '', $module );
1188
-		$module_class = 'EED_' . $module;
1189
-		if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) {
1190
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1191
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1185
+	public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') {
1186
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1187
+		$module = str_replace('EED_', '', $module);
1188
+		$module_class = 'EED_'.$module;
1189
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) {
1190
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1191
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1192 1192
 			return FALSE;
1193 1193
 		}
1194
-		if ( empty( $route )) {
1195
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1196
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1194
+		if (empty($route)) {
1195
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1196
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1197 1197
 			return FALSE;
1198 1198
 		}
1199
-		if ( ! method_exists ( 'EED_' . $module, $method_name )) {
1200
-			$msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route );
1201
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1199
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1200
+			$msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route);
1201
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1202 1202
 			return FALSE;
1203 1203
 		}
1204
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1204
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1205 1205
 		return TRUE;
1206 1206
 	}
1207 1207
 
@@ -1215,11 +1215,11 @@  discard block
 block discarded – undo
1215 1215
 	 *  @param 	string 		$key - url param key indicating a route is being called
1216 1216
 	 *  @return 	string
1217 1217
 	 */
1218
-	public static function get_route( $route = NULL, $key = 'ee' ) {
1219
-		do_action( 'AHEE__EE_Config__get_route__begin',$route );
1220
-		$route = apply_filters( 'FHEE__EE_Config__get_route',$route );
1221
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) {
1222
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1218
+	public static function get_route($route = NULL, $key = 'ee') {
1219
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1220
+		$route = apply_filters('FHEE__EE_Config__get_route', $route);
1221
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1222
+			return EE_Config::$_module_route_map[$key][$route];
1223 1223
 		}
1224 1224
 		return NULL;
1225 1225
 	}
@@ -1248,35 +1248,35 @@  discard block
 block discarded – undo
1248 1248
 	 * @param    string 		$key - url param key indicating a route is being called
1249 1249
 	 * @return    bool
1250 1250
 	 */
1251
-	public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) {
1252
-		do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward );
1253
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1254
-			$msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route );
1255
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1251
+	public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') {
1252
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1253
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1254
+			$msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route);
1255
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return FALSE;
1257 1257
 		}
1258
-		if ( empty( $forward )) {
1259
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1260
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1258
+		if (empty($forward)) {
1259
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1260
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return FALSE;
1262 1262
 		}
1263
-		if ( is_array( $forward )) {
1264
-			if ( ! isset( $forward[1] )) {
1265
-				$msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route );
1266
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1263
+		if (is_array($forward)) {
1264
+			if ( ! isset($forward[1])) {
1265
+				$msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route);
1266
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1267 1267
 				return FALSE;
1268 1268
 			}
1269
-			if ( ! method_exists( $forward[0], $forward[1] )) {
1270
-				$msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route );
1271
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1269
+			if ( ! method_exists($forward[0], $forward[1])) {
1270
+				$msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route);
1271
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1272 1272
 				return FALSE;
1273 1273
 			}
1274
-		} else if ( ! function_exists( $forward )) {
1275
-			$msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route );
1276
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1274
+		} else if ( ! function_exists($forward)) {
1275
+			$msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route);
1276
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1277 1277
 			return FALSE;
1278 1278
 		}
1279
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1279
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1280 1280
 		return TRUE;
1281 1281
 	}
1282 1282
 
@@ -1291,10 +1291,10 @@  discard block
 block discarded – undo
1291 1291
 	 *  @param    string 		$key - url param key indicating a route is being called
1292 1292
 	 *  @return 	string
1293 1293
 	 */
1294
-	public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) {
1295
-		do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status );
1296
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) {
1297
-			return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status );
1294
+	public static function get_forward($route = NULL, $status = 0, $key = 'ee') {
1295
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1296
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1297
+			return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status);
1298 1298
 		}
1299 1299
 		return NULL;
1300 1300
 	}
@@ -1311,19 +1311,19 @@  discard block
 block discarded – undo
1311 1311
 	 * @param    string 		$key - url param key indicating a route is being called
1312 1312
 	 * @return    bool
1313 1313
 	 */
1314
-	public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) {
1315
-		do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view );
1316
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1317
-			$msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route );
1318
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1314
+	public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') {
1315
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1316
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1317
+			$msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route);
1318
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1319 1319
 			return FALSE;
1320 1320
 		}
1321
-		if ( ! is_readable( $view )) {
1322
-			$msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view );
1323
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1321
+		if ( ! is_readable($view)) {
1322
+			$msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view);
1323
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1324 1324
 			return FALSE;
1325 1325
 		}
1326
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1326
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1327 1327
 		return TRUE;
1328 1328
 	}
1329 1329
 
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 	 *  @param    string 		$key - url param key indicating a route is being called
1341 1341
 	 *  @return 	string
1342 1342
 	 */
1343
-	public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) {
1344
-		do_action( 'AHEE__EE_Config__get_view__begin',$route,$status );
1345
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) {
1346
-			return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status );
1343
+	public static function get_view($route = NULL, $status = 0, $key = 'ee') {
1344
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1345
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1346
+			return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status);
1347 1347
 		}
1348 1348
 		return NULL;
1349 1349
 	}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
 
1353 1353
 	public function shutdown() {
1354
-		update_option( 'ee_config_option_names', $this->_config_option_names );
1354
+		update_option('ee_config_option_names', $this->_config_option_names);
1355 1355
 	}
1356 1356
 
1357 1357
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
  * magic functions in use, except we'll allow them to magically set and get stuff...
1368 1368
  * basically, they should just be well-defined stdClasses
1369 1369
  */
1370
-class EE_Config_Base{
1370
+class EE_Config_Base {
1371 1371
 
1372 1372
 	/**
1373 1373
 	 * Utility function for escaping the value of a property and returning.
@@ -1376,13 +1376,13 @@  discard block
 block discarded – undo
1376 1376
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1377 1377
 	 * @throws \EE_Error
1378 1378
 	 */
1379
-	public function get_pretty( $property ) {
1380
-		if ( ! property_exists( $this, $property ) ) {
1381
-			throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) );
1379
+	public function get_pretty($property) {
1380
+		if ( ! property_exists($this, $property)) {
1381
+			throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property));
1382 1382
 		}
1383 1383
 		//just handling escaping of strings for now.
1384
-		if ( is_string( $this->{$property} ) ) {
1385
-			return stripslashes( $this->{$property} );
1384
+		if (is_string($this->{$property} )) {
1385
+			return stripslashes($this->{$property} );
1386 1386
 		}
1387 1387
 		return $this->{$property};
1388 1388
 	}
@@ -1391,19 +1391,19 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
 	public function populate() {
1393 1393
 		//grab defaults via a new instance of this class.
1394
-		$class_name = get_class( $this );
1394
+		$class_name = get_class($this);
1395 1395
 		$defaults = new $class_name;
1396 1396
 
1397 1397
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1398 1398
 		//default from our $defaults object.
1399
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1400
-			if ( is_null( $this->{$property} ) ) {
1399
+		foreach (get_object_vars($defaults) as $property => $value) {
1400
+			if (is_null($this->{$property} )) {
1401 1401
 				$this->{$property} = $value;
1402 1402
 			}
1403 1403
 		}
1404 1404
 
1405 1405
 		//cleanup
1406
-		unset( $defaults );
1406
+		unset($defaults);
1407 1407
 	}
1408 1408
 
1409 1409
 
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 		$this->current_blog_id = get_current_blog_id();
1508 1508
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1509 1509
 		$this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1510
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true;
1510
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1511 1511
 		$this->post_shortcodes = array();
1512 1512
 		$this->module_route_map = array();
1513 1513
 		$this->module_forward_map = array();
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
 		$this->event_cpt_slug = __('events', 'event_espresso');
1527 1527
 
1528 1528
 		//ueip constant check
1529
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1529
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1530 1530
 			$this->ee_ueip_optin = FALSE;
1531 1531
 			$this->ee_ueip_has_notified = TRUE;
1532 1532
 		}
@@ -1566,8 +1566,8 @@  discard block
 block discarded – undo
1566 1566
 	 *  @return 	string
1567 1567
 	 */
1568 1568
 	public function reg_page_url() {
1569
-		if ( ! $this->reg_page_url ) {
1570
-			$this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout';
1569
+		if ( ! $this->reg_page_url) {
1570
+			$this->reg_page_url = get_permalink($this->reg_page_id).'#checkout';
1571 1571
 		}
1572 1572
 		return $this->reg_page_url;
1573 1573
 	}
@@ -1580,12 +1580,12 @@  discard block
 block discarded – undo
1580 1580
 	 *  @return 	string
1581 1581
 	 */
1582 1582
 	public function txn_page_url($query_args = array()) {
1583
-		if ( ! $this->txn_page_url ) {
1584
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1583
+		if ( ! $this->txn_page_url) {
1584
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1585 1585
 		}
1586
-		if($query_args){
1587
-			return add_query_arg($query_args,$this->txn_page_url);
1588
-		}else{
1586
+		if ($query_args) {
1587
+			return add_query_arg($query_args, $this->txn_page_url);
1588
+		} else {
1589 1589
 			return $this->txn_page_url;
1590 1590
 		}
1591 1591
 	}
@@ -1597,12 +1597,12 @@  discard block
 block discarded – undo
1597 1597
 	 *  @return 	string
1598 1598
 	 */
1599 1599
 	public function thank_you_page_url($query_args = array()) {
1600
-		if ( ! $this->thank_you_page_url ) {
1601
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1600
+		if ( ! $this->thank_you_page_url) {
1601
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1602 1602
 		}
1603
-		if($query_args){
1604
-			return add_query_arg($query_args,$this->thank_you_page_url);
1605
-		}else{
1603
+		if ($query_args) {
1604
+			return add_query_arg($query_args, $this->thank_you_page_url);
1605
+		} else {
1606 1606
 			return $this->thank_you_page_url;
1607 1607
 		}
1608 1608
 	}
@@ -1613,8 +1613,8 @@  discard block
 block discarded – undo
1613 1613
 	 *  @return 	string
1614 1614
 	 */
1615 1615
 	public function cancel_page_url() {
1616
-		if ( ! $this->cancel_page_url ) {
1617
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1616
+		if ( ! $this->cancel_page_url) {
1617
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1618 1618
 		}
1619 1619
 		return $this->cancel_page_url;
1620 1620
 	}
@@ -1641,22 +1641,22 @@  discard block
 block discarded – undo
1641 1641
 	 */
1642 1642
 	protected function _get_main_ee_ueip_optin() {
1643 1643
 		//if this is the main site then we can just bypass our direct query.
1644
-		if ( is_main_site() ) {
1645
-			return get_option( 'ee_ueip_optin', false );
1644
+		if (is_main_site()) {
1645
+			return get_option('ee_ueip_optin', false);
1646 1646
 		}
1647 1647
 
1648 1648
 		//is this already cached for this request?  If so use it.
1649
-		if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) {
1649
+		if ( ! empty(EE_Core_Config::$ee_ueip_option)) {
1650 1650
 			return EE_Core_Config::$ee_ueip_option;
1651 1651
 		}
1652 1652
 
1653 1653
 		global $wpdb;
1654 1654
 		$current_network_main_site = is_multisite() ? get_current_site() : null;
1655
-		$current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1655
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1656 1656
 		$option = 'ee_ueip_optin';
1657 1657
 
1658 1658
 		//set correct table for query
1659
-		$table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options';
1659
+		$table_name = $wpdb->get_blog_prefix($current_main_site_id).'options';
1660 1660
 
1661 1661
 
1662 1662
 		//rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
@@ -1664,20 +1664,20 @@  discard block
 block discarded – undo
1664 1664
 		//re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1665 1665
 		//this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1666 1666
 		//for the purpose of caching.
1667
-		$pre = apply_filters( 'pre_option_' . $option, false, $option );
1668
-		if ( false !== $pre ) {
1667
+		$pre = apply_filters('pre_option_'.$option, false, $option);
1668
+		if (false !== $pre) {
1669 1669
 			EE_Core_Config::$ee_ueip_option = $pre;
1670 1670
 			return EE_Core_Config::$ee_ueip_option;
1671 1671
 		}
1672 1672
 
1673
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) );
1674
-		if ( is_object( $row ) ) {
1673
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option));
1674
+		if (is_object($row)) {
1675 1675
 			$value = $row->option_value;
1676 1676
 		} else { //option does not exist so use default.
1677
-			return apply_filters( 'default_option_' . $option, false, $option );
1677
+			return apply_filters('default_option_'.$option, false, $option);
1678 1678
 		}
1679 1679
 
1680
-		EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option );
1680
+		EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option);
1681 1681
 
1682 1682
 		return EE_Core_Config::$ee_ueip_option;
1683 1683
 	}
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 		//reset all url properties
1693 1693
 		$this->_reset_urls();
1694 1694
 		//return what to save to db
1695
-		return array_keys( get_object_vars( $this ) );
1695
+		return array_keys(get_object_vars($this));
1696 1696
 	}
1697 1697
 
1698 1698
 }
@@ -1924,38 +1924,38 @@  discard block
 block discarded – undo
1924 1924
 	 * @param null $CNT_ISO
1925 1925
 	 * @return \EE_Currency_Config
1926 1926
 	 */
1927
-	public function __construct( $CNT_ISO = NULL ) {
1927
+	public function __construct($CNT_ISO = NULL) {
1928 1928
 
1929 1929
 		// get country code from organization settings or use default
1930
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1930
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1931 1931
 		// but override if requested
1932
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
1932
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
1933 1933
 		// 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
1934
-		if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) {
1934
+		if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) {
1935 1935
 			// retrieve the country settings from the db, just in case they have been customized
1936
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
1937
-			if ( $country instanceof EE_Country ) {
1938
-				$this->code = $country->currency_code(); 	// currency code: USD, CAD, EUR
1939
-				$this->name = $country->currency_name_single();	// Dollar
1940
-				$this->plural = $country->currency_name_plural(); 	// Dollars
1941
-				$this->sign =  $country->currency_sign(); 			// currency sign: $
1942
-				$this->sign_b4 = $country->currency_sign_before(); 		// currency sign before or after: $TRUE  or  FALSE$
1943
-				$this->dec_plc = $country->currency_decimal_places();	// decimal places: 2 = 0.00  3 = 0.000
1944
-				$this->dec_mrk = $country->currency_decimal_mark();	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1945
-				$this->thsnds = $country->currency_thousands_separator();	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1936
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
1937
+			if ($country instanceof EE_Country) {
1938
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
1939
+				$this->name = $country->currency_name_single(); // Dollar
1940
+				$this->plural = $country->currency_name_plural(); // Dollars
1941
+				$this->sign = $country->currency_sign(); // currency sign: $
1942
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
1943
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
1944
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1945
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1946 1946
 			}
1947 1947
 		}
1948 1948
 		// fallback to hardcoded defaults, in case the above failed
1949
-		if ( empty( $this->code )) {
1949
+		if (empty($this->code)) {
1950 1950
 			// set default currency settings
1951
-			$this->code = 'USD'; 	// currency code: USD, CAD, EUR
1952
-			$this->name = __( 'Dollar', 'event_espresso' ); 	// Dollar
1953
-			$this->plural = __( 'Dollars', 'event_espresso' ); 	// Dollars
1954
-			$this->sign =  '$'; 	// currency sign: $
1955
-			$this->sign_b4 = TRUE; 	// currency sign before or after: $TRUE  or  FALSE$
1956
-			$this->dec_plc = 2; 	// decimal places: 2 = 0.00  3 = 0.000
1957
-			$this->dec_mrk = '.'; 	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1958
-			$this->thsnds = ','; 	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1951
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
1952
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
1953
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
1954
+			$this->sign = '$'; // currency sign: $
1955
+			$this->sign_b4 = TRUE; // currency sign before or after: $TRUE  or  FALSE$
1956
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
1957
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1958
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1959 1959
 		}
1960 1960
 	}
1961 1961
 }
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 	 * @since 4.8.8.rc.019
2105 2105
 	 */
2106 2106
 	public function do_hooks() {
2107
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ));
2107
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2108 2108
 	}
2109 2109
 
2110 2110
 
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 	 * @return void
2113 2113
 	 */
2114 2114
 	public function set_default_reg_status_on_EEM_Event() {
2115
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2115
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2116 2116
 	}
2117 2117
 
2118 2118
 
@@ -2217,10 +2217,10 @@  discard block
 block discarded – undo
2217 2217
 	 * @param bool $reset
2218 2218
 	 * @return string
2219 2219
 	 */
2220
-	public function log_file_name( $reset = FALSE ) {
2221
-		if ( empty( $this->log_file_name ) || $reset ) {
2222
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt';
2223
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2220
+	public function log_file_name($reset = FALSE) {
2221
+		if (empty($this->log_file_name) || $reset) {
2222
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt';
2223
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2224 2224
 		}
2225 2225
 		return $this->log_file_name;
2226 2226
 	}
@@ -2232,10 +2232,10 @@  discard block
 block discarded – undo
2232 2232
 	 * @param bool $reset
2233 2233
 	 * @return string
2234 2234
 	 */
2235
-	public function debug_file_name( $reset = FALSE ) {
2236
-		if ( empty( $this->debug_file_name ) || $reset ) {
2237
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt';
2238
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2235
+	public function debug_file_name($reset = FALSE) {
2236
+		if (empty($this->debug_file_name) || $reset) {
2237
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt';
2238
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2239 2239
 		}
2240 2240
 		return $this->debug_file_name;
2241 2241
 	}
@@ -2408,21 +2408,21 @@  discard block
 block discarded – undo
2408 2408
 		// set default map settings
2409 2409
 		$this->use_google_maps = TRUE;
2410 2410
 		// for event details pages (reg page)
2411
-		$this->event_details_map_width = 585; 			// ee_map_width_single
2412
-		$this->event_details_map_height = 362; 			// ee_map_height_single
2413
-		$this->event_details_map_zoom = 14; 			// ee_map_zoom_single
2414
-		$this->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
2415
-		$this->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
2416
-		$this->event_details_control_type = 'default'; 		// ee_map_type_control_single
2417
-		$this->event_details_map_align = 'center'; 			// ee_map_align_single
2411
+		$this->event_details_map_width = 585; // ee_map_width_single
2412
+		$this->event_details_map_height = 362; // ee_map_height_single
2413
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2414
+		$this->event_details_display_nav = TRUE; // ee_map_nav_display_single
2415
+		$this->event_details_nav_size = FALSE; // ee_map_nav_size_single
2416
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2417
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2418 2418
 		// for event list pages
2419
-		$this->event_list_map_width = 300; 			// ee_map_width
2420
-		$this->event_list_map_height = 185; 		// ee_map_height
2421
-		$this->event_list_map_zoom = 12; 			// ee_map_zoom
2422
-		$this->event_list_display_nav = FALSE; 		// ee_map_nav_display
2423
-		$this->event_list_nav_size = TRUE; 			// ee_map_nav_size
2424
-		$this->event_list_control_type = 'dropdown'; 		// ee_map_type_control
2425
-		$this->event_list_map_align = 'center'; 			// ee_map_align
2419
+		$this->event_list_map_width = 300; // ee_map_width
2420
+		$this->event_list_map_height = 185; // ee_map_height
2421
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2422
+		$this->event_list_display_nav = FALSE; // ee_map_nav_display
2423
+		$this->event_list_nav_size = TRUE; // ee_map_nav_size
2424
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2425
+		$this->event_list_map_align = 'center'; // ee_map_align
2426 2426
 	}
2427 2427
 
2428 2428
 }
@@ -2433,7 +2433,7 @@  discard block
 block discarded – undo
2433 2433
 /**
2434 2434
  * stores Events_Archive settings
2435 2435
  */
2436
-class EE_Events_Archive_Config extends EE_Config_Base{
2436
+class EE_Events_Archive_Config extends EE_Config_Base {
2437 2437
 
2438 2438
 	public $display_status_banner;
2439 2439
 	public $display_description;
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
 	/**
2453 2453
 	 *	class constructor
2454 2454
 	 */
2455
-	public function __construct(){
2455
+	public function __construct() {
2456 2456
 		$this->display_status_banner = 0;
2457 2457
 		$this->display_description = 1;
2458 2458
 		$this->display_ticket_selector = 0;
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 /**
2473 2473
  * Stores Event_Single_Config settings
2474 2474
  */
2475
-class EE_Event_Single_Config extends EE_Config_Base{
2475
+class EE_Event_Single_Config extends EE_Config_Base {
2476 2476
 
2477 2477
 	public $display_status_banner_single;
2478 2478
 	public $display_venue;
@@ -2501,7 +2501,7 @@  discard block
 block discarded – undo
2501 2501
 /**
2502 2502
  * Stores Ticket_Selector_Config settings
2503 2503
  */
2504
-class EE_Ticket_Selector_Config extends EE_Config_Base{
2504
+class EE_Ticket_Selector_Config extends EE_Config_Base {
2505 2505
 	public $show_ticket_sale_columns;
2506 2506
 	public $show_ticket_details;
2507 2507
 	public $show_expired_tickets;
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
 	 * @return void
2556 2556
 	 */
2557 2557
 	protected function _set_php_values() {
2558
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2558
+		$this->php->max_input_vars = ini_get('max_input_vars');
2559 2559
 		$this->php->version = phpversion();
2560 2560
 	}
2561 2561
 
@@ -2574,9 +2574,9 @@  discard block
 block discarded – undo
2574 2574
 	 *         @type string $msg 		Any message to be displayed.
2575 2575
 	 * }
2576 2576
 	 */
2577
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2578
-		if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) {
2579
-			return  sprintf( __('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2577
+	public function max_input_vars_limit_check($input_count = 0) {
2578
+		if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) {
2579
+			return  sprintf(__('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2580 2580
 		} else {
2581 2581
 			return '';
2582 2582
 		}
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
  * stores payment gateway info
2612 2612
  * @deprecated
2613 2613
  */
2614
-class EE_Gateway_Config extends EE_Config_Base{
2614
+class EE_Gateway_Config extends EE_Config_Base {
2615 2615
 
2616 2616
 	/**
2617 2617
 	 * Array with keys that are payment gateways slugs, and values are arrays
@@ -2633,9 +2633,9 @@  discard block
 block discarded – undo
2633 2633
 	 *	class constructor
2634 2634
 	 * @deprecated
2635 2635
 	 */
2636
-	public function __construct(){
2636
+	public function __construct() {
2637 2637
 		$this->payment_settings = array();
2638
-		$this->active_gateways = array( 'Invoice' => FALSE );
2638
+		$this->active_gateways = array('Invoice' => FALSE);
2639 2639
 	}
2640 2640
 }
2641 2641
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_events-venues.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,64 +1,64 @@
 block discarded – undo
1 1
 <?php
2 2
 //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' &nbsp; <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>';
3 3
 if (
4
-	( is_single() && espresso_display_venue_in_event_details() )
5
-	|| ( is_archive() && espresso_display_venue_in_event_list() )
4
+	(is_single() && espresso_display_venue_in_event_details())
5
+	|| (is_archive() && espresso_display_venue_in_event_list())
6 6
 ) :
7 7
 	global $post;
8
-	do_action( 'AHEE_event_details_before_venue_details', $post );
9
-	$venue_name = espresso_venue_name( 0, 'details', FALSE );
10
-	if ( empty( $venue_name ) && espresso_is_venue_private() ) {
11
-		do_action( 'AHEE_event_details_after_venue_details', $post );
8
+	do_action('AHEE_event_details_before_venue_details', $post);
9
+	$venue_name = espresso_venue_name(0, 'details', FALSE);
10
+	if (empty($venue_name) && espresso_is_venue_private()) {
11
+		do_action('AHEE_event_details_after_venue_details', $post);
12 12
 		return '';
13 13
 	}
14 14
 ?>
15 15
 
16 16
 <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>">
17 17
 	<h3 class="event-venues-h3 ee-event-h3">
18
-		<?php _e( 'Location', 'event_espresso' ); ?>
18
+		<?php _e('Location', 'event_espresso'); ?>
19 19
 	</h3>
20
-	<h4><strong><?php _e( 'Venue:', 'event_espresso' ); ?></strong>&nbsp;&nbsp; <strong> <?php echo $venue_name; ?></strong></h4>
20
+	<h4><strong><?php _e('Venue:', 'event_espresso'); ?></strong>&nbsp;&nbsp; <strong> <?php echo $venue_name; ?></strong></h4>
21 21
 	<p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p>
22
-<?php  if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
22
+<?php  if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
23 23
 	<p>
24
-		<span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?></strong></span> <?php echo $venue_phone; ?>
24
+		<span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?></strong></span> <?php echo $venue_phone; ?>
25 25
 	</p>
26
-<?php endif;  ?>
27
-<?php  if ( espresso_venue_has_address( $post->ID )) : ?>
28
-	<strong><span class="dashicons dashicons-location-alt"></span><?php _e( 'Address:', 'event_espresso' ); ?></strong>
29
-	<?php espresso_venue_address( 'inline' ); ?>
30
-	<?php espresso_venue_gmap( $post->ID ); ?>
26
+<?php endif; ?>
27
+<?php  if (espresso_venue_has_address($post->ID)) : ?>
28
+	<strong><span class="dashicons dashicons-location-alt"></span><?php _e('Address:', 'event_espresso'); ?></strong>
29
+	<?php espresso_venue_address('inline'); ?>
30
+	<?php espresso_venue_gmap($post->ID); ?>
31 31
 	<div class="clear"><br/></div>
32
-<?php endif;  ?>
32
+<?php endif; ?>
33 33
 
34
-	<?php $VNU_ID = espresso_venue_id( $post->ID ); ?>
35
-	<?php if ( is_single() ) : ?>
36
-		<?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?>
37
-		<?php if ( $venue_description ) : ?>
34
+	<?php $VNU_ID = espresso_venue_id($post->ID); ?>
35
+	<?php if (is_single()) : ?>
36
+		<?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?>
37
+		<?php if ($venue_description) : ?>
38 38
 	<p>
39
-		<strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/>
40
-		<?php echo do_shortcode( $venue_description ); ?>
39
+		<strong><?php _e('Description:', 'event_espresso'); ?></strong><br/>
40
+		<?php echo do_shortcode($venue_description); ?>
41 41
 	</p>
42
-		<?php endif;  ?>
42
+		<?php endif; ?>
43 43
 	<?php else : ?>
44
-		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?>
45
-		<?php if ( $venue_excerpt ) : ?>
44
+		<?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?>
45
+		<?php if ($venue_excerpt) : ?>
46 46
 	<p>
47
-		<strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/>
47
+		<strong><?php _e('Description:', 'event_espresso'); ?></strong><br/>
48 48
 		<?php echo $venue_excerpt; ?>
49 49
 	</p>
50
-			<?php endif;  ?>
51
-		<?php endif;  ?>
50
+			<?php endif; ?>
51
+		<?php endif; ?>
52 52
 </div>
53 53
 <!-- .espresso-venue-dv -->
54 54
 <?php
55
-do_action( 'AHEE_event_details_after_venue_details', $post );
55
+do_action('AHEE_event_details_after_venue_details', $post);
56 56
 else :
57
-	if ( espresso_venue_is_password_protected() ) :
57
+	if (espresso_venue_is_password_protected()) :
58 58
 ?>
59 59
 	<div class="espresso-venue-dv  espresso-password-protected-venue-dv" >
60 60
 		<h3 class="event-venues-h3 ee-event-h3">
61
-			<?php _e( 'Location', 'event_espresso' );?>
61
+			<?php _e('Location', 'event_espresso'); ?>
62 62
 		</h3>
63 63
 		<?php echo espresso_password_protected_venue_form(); ?>
64 64
 	</div>
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,8 +40,11 @@  discard block
 block discarded – undo
40 40
 		<?php echo do_shortcode( $venue_description ); ?>
41 41
 	</p>
42 42
 		<?php endif;  ?>
43
-	<?php else : ?>
44
-		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?>
43
+	<?php else {
44
+	: ?>
45
+		<?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE );
46
+}
47
+?>
45 48
 		<?php if ( $venue_excerpt ) : ?>
46 49
 	<p>
47 50
 		<strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/>
@@ -53,12 +56,15 @@  discard block
 block discarded – undo
53 56
 <!-- .espresso-venue-dv -->
54 57
 <?php
55 58
 do_action( 'AHEE_event_details_after_venue_details', $post );
56
-else :
59
+else {
60
+	:
57 61
 	if ( espresso_venue_is_password_protected() ) :
58 62
 ?>
59 63
 	<div class="espresso-venue-dv  espresso-password-protected-venue-dv" >
60 64
 		<h3 class="event-venues-h3 ee-event-h3">
61
-			<?php _e( 'Location', 'event_espresso' );?>
65
+			<?php _e( 'Location', 'event_espresso' );
66
+}
67
+?>
62 68
 		</h3>
63 69
 		<?php echo espresso_password_protected_venue_form(); ?>
64 70
 	</div>
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Select_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php  if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Class EE_Select_Input
4 4
  *
@@ -10,22 +10,22 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Select_Input extends EE_Form_Input_With_Options_Base{
13
+class EE_Select_Input extends EE_Form_Input_With_Options_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param array $answer_options
17 17
 	 * @param array $input_settings
18 18
 	 */
19
-	public function __construct( $answer_options, $input_settings = array() ) {
20
-		$this->_set_display_strategy( new EE_Select_Display_Strategy( $answer_options ) );
19
+	public function __construct($answer_options, $input_settings = array()) {
20
+		$this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options));
21 21
 		$this->_add_validation_strategy(
22 22
 			new EE_Enum_Validation_Strategy(
23
-				isset( $input_settings['validation_error_message'] )
23
+				isset($input_settings['validation_error_message'])
24 24
 					? $input_settings['validation_error_message']
25 25
 					: null
26 26
 			)
27 27
 		);
28
-		parent::__construct( $answer_options, $input_settings );
28
+		parent::__construct($answer_options, $input_settings);
29 29
 	}
30 30
 
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 3 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -810,8 +810,7 @@
 block discarded – undo
810 810
 	 * (If that doesn't exist, we also check for this subsection's name
811 811
 	 * at the TOP LEVEL of the request data. Eg $_REQUEST['form_input_1'].)
812 812
 	 * This function finds its value in the form.
813
-
814
-*
813
+	 *
815 814
 *@param array $req_data
816 815
 	 * @return mixed whatever the raw value of this form section is in the request data
817 816
 	 * @throws \EE_Error
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					$this->html_id()
244 244
 				)
245 245
 			);
246
-		}else{
246
+		} else{
247 247
 			return $this->_display_strategy;
248 248
 		}
249 249
 	}
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
459 459
 				try{
460 460
 					$validation_strategy->validate($this->normalized_value());
461
-				}catch(EE_Validation_Error $e){
461
+				} catch(EE_Validation_Error $e){
462 462
 					$this->add_validation_error($e);
463 463
 				}
464 464
 			}
465 465
 		}
466 466
 		if( $this->get_validation_errors()){
467 467
 			return false;
468
-		}else{
468
+		} else{
469 469
 			return true;
470 470
 		}
471 471
 	}
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
829 829
 			$name_parts = $matches[ 1 ];
830 830
 			array_unshift($name_parts, $before_any_brackets);
831
-		}else{
831
+		} else{
832 832
 			$name_parts = array( $before_any_brackets );
833 833
 		}
834 834
 		// now get the value for the input
@@ -853,13 +853,13 @@  discard block
 block discarded – undo
853 853
 		if( isset( $req_data[ $first_part_to_consider ] ) ){
854 854
 			if( empty($html_name_parts ) ){
855 855
 				return $req_data[ $first_part_to_consider ];
856
-			}else{
856
+			} else{
857 857
 				return $this->_find_form_data_for_this_section_using_name_parts(
858 858
 					$html_name_parts,
859 859
 					$req_data[ $first_part_to_consider ]
860 860
 				);
861 861
 			}
862
-		}else{
862
+		} else{
863 863
 			return NULL;
864 864
 		}
865 865
 	}
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 		$checked_value = $this->find_form_data_for_this_section( $req_data );
881 881
 		if( $checked_value !== null ){
882 882
 			return TRUE;
883
-		}else{
883
+		} else{
884 884
 			return FALSE;
885 885
 		}
886 886
 	}
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	 *  @type EE_Validation_Strategy_Base[]  $validation_strategies
144 144
 	 * }
145 145
 	 */
146
-	public function __construct( $input_args = array() ){
147
-		$input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
146
+	public function __construct($input_args = array()) {
147
+		$input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
148 148
 		// the following properties must be cast as arrays
149
-		if ( isset( $input_args['validation_strategies'] ) ) {
150
-			foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) {
151
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
152
-					$this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy;
149
+		if (isset($input_args['validation_strategies'])) {
150
+			foreach ((array) $input_args['validation_strategies'] as $validation_strategy) {
151
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
152
+					$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
153 153
 				}
154 154
 			}
155
-			unset( $input_args['validation_strategies'] );
155
+			unset($input_args['validation_strategies']);
156 156
 		}
157 157
 		// loop thru incoming options
158
-		foreach( $input_args as $key => $value ) {
158
+		foreach ($input_args as $key => $value) {
159 159
 			// add underscore to $key to match property names
160
-			$_key = '_' . $key;
161
-			if ( property_exists( $this, $_key )) {
160
+			$_key = '_'.$key;
161
+			if (property_exists($this, $_key)) {
162 162
 				$this->{$_key} = $value;
163 163
 			}
164 164
 		}
165 165
 		// ensure that "required" is set correctly
166 166
 		$this->set_required(
167
-			$this->_required, isset( $input_args[ 'required_validation_error_message' ] )
168
-				? $input_args[ 'required_validation_error_message' ]
167
+			$this->_required, isset($input_args['required_validation_error_message'])
168
+				? $input_args['required_validation_error_message']
169 169
 				: null
170 170
 		);
171 171
 
172 172
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
173 173
 
174 174
 		$this->_display_strategy->_construct_finalize($this);
175
-		foreach( $this->_validation_strategies as $validation_strategy ){
175
+		foreach ($this->_validation_strategies as $validation_strategy) {
176 176
 			$validation_strategy->_construct_finalize($this);
177 177
 		}
178 178
 
179
-		if( ! $this->_normalization_strategy){
179
+		if ( ! $this->_normalization_strategy) {
180 180
 			$this->_normalization_strategy = new EE_Text_Normalization();
181 181
 		}
182 182
 		$this->_normalization_strategy->_construct_finalize($this);
183 183
 
184 184
 		//at least we can use the normalization strategy to populate the default
185
-		if( isset( $input_args[ 'default' ] ) ) {
186
-			$this->set_default( $input_args[ 'default' ] );
185
+		if (isset($input_args['default'])) {
186
+			$this->set_default($input_args['default']);
187 187
 		}
188 188
 
189
-		if( ! $this->_sensitive_data_removal_strategy){
189
+		if ( ! $this->_sensitive_data_removal_strategy) {
190 190
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
191 191
 		}
192 192
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
193
-		parent::__construct( $input_args );
193
+		parent::__construct($input_args);
194 194
 	}
195 195
 
196 196
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @throws \EE_Error
203 203
 	 */
204
-	protected function _set_default_html_name_if_empty(){
205
-		if( ! $this->_html_name){
204
+	protected function _set_default_html_name_if_empty() {
205
+		if ( ! $this->_html_name) {
206 206
 			$this->_html_name = $this->name();
207
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
208
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
207
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
208
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
209 209
 			}
210 210
 		}
211 211
 	}
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	public function _construct_finalize($parent_form_section, $name) {
221 221
 		parent::_construct_finalize($parent_form_section, $name);
222 222
 		$this->_set_default_html_name_if_empty();
223
-		if( ! $this->_html_label && ! $this->_html_label_text){
224
-			$this->_html_label_text = ucwords( str_replace("_"," ",$name));
223
+		if ( ! $this->_html_label && ! $this->_html_label_text) {
224
+			$this->_html_label_text = ucwords(str_replace("_", " ", $name));
225 225
 		}
226
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
226
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
227 227
 	}
228 228
 
229 229
 	 /**
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	  * @return EE_Display_Strategy_Base
232 232
 	  * @throws EE_Error
233 233
 	  */
234
-	protected function _get_display_strategy(){
235
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
234
+	protected function _get_display_strategy() {
235
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
236 236
 			throw new EE_Error(
237 237
 				sprintf(
238 238
 					__(
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					$this->html_id()
244 244
 				)
245 245
 			);
246
-		}else{
246
+		} else {
247 247
 			return $this->_display_strategy;
248 248
 		}
249 249
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * Sets the display strategy.
252 252
 	 * @param EE_Display_Strategy_Base $strategy
253 253
 	 */
254
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
254
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
255 255
 		$this->_display_strategy = $strategy;
256 256
 	}
257 257
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * Sets the sanitization strategy
260 260
 	 * @param EE_Normalization_Strategy_Base $strategy
261 261
 	 */
262
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
262
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
263 263
 		$this->_normalization_strategy = $strategy;
264 264
 	}
265 265
 
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 	 * Gets the display strategy for this input
286 286
 	 * @return EE_Display_Strategy_Base
287 287
 	 */
288
-	public function get_display_strategy(){
288
+	public function get_display_strategy() {
289 289
 		return $this->_display_strategy;
290 290
 	}
291 291
 	/**
292 292
 	 * Overwrites the display strategy
293 293
 	 * @param EE_Display_Strategy_Base $display_strategy
294 294
 	 */
295
-	public function set_display_strategy($display_strategy){
295
+	public function set_display_strategy($display_strategy) {
296 296
 		$this->_display_strategy = $display_strategy;
297 297
 		$this->_display_strategy->_construct_finalize($this);
298 298
 	}
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 * Gets the normalization strategy set on this input
301 301
 	 * @return EE_Normalization_Strategy_Base
302 302
 	 */
303
-	public function get_normalization_strategy(){
303
+	public function get_normalization_strategy() {
304 304
 		return $this->_normalization_strategy;
305 305
 	}
306 306
 	/**
307 307
 	 * Overwrites the normalization strategy
308 308
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
309 309
 	 */
310
-	public function set_normalization_strategy($normalization_strategy){
310
+	public function set_normalization_strategy($normalization_strategy) {
311 311
 		$this->_normalization_strategy = $normalization_strategy;
312 312
 		$this->_normalization_strategy->_construct_finalize($this);
313 313
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
317 317
 	 * @return EE_Validation_Strategy_Base[]
318 318
 	 */
319
-	public function get_validation_strategies(){
319
+	public function get_validation_strategies() {
320 320
 		return $this->_validation_strategies;
321 321
 	}
322 322
 
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Validation_Strategy_Base $validation_strategy
328 328
 	 * @return void
329 329
 	 */
330
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
331
-		$validation_strategy->_construct_finalize( $this );
330
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
331
+		$validation_strategy->_construct_finalize($this);
332 332
 		$this->_validation_strategies[] = $validation_strategy;
333 333
 	}
334 334
 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_Validation_Strategy_Base $validation_strategy
340 340
 	 * @return void
341 341
 	 */
342
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
343
-		$this->_add_validation_strategy( $validation_strategy );
342
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
343
+		$this->_add_validation_strategy($validation_strategy);
344 344
 	}
345 345
 
346 346
 
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @param string $validation_strategy_classname
352 352
 	 */
353
-	public function remove_validation_strategy( $validation_strategy_classname ) {
354
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
355
-			if(
353
+	public function remove_validation_strategy($validation_strategy_classname) {
354
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
355
+			if (
356 356
 				$validation_strategy instanceof $validation_strategy_classname
357
-				|| is_subclass_of( $validation_strategy, $validation_strategy_classname )
357
+				|| is_subclass_of($validation_strategy, $validation_strategy_classname)
358 358
 			) {
359
-				unset( $this->_validation_strategies[ $key ] );
359
+				unset($this->_validation_strategies[$key]);
360 360
 			}
361 361
 		}
362 362
 	}
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 	 * @param array $validation_strategy_classnames
370 370
 	 * @return bool
371 371
 	 */
372
-	public function has_validation_strategy( $validation_strategy_classnames ) {
373
-		$validation_strategy_classnames = is_array( $validation_strategy_classnames )
372
+	public function has_validation_strategy($validation_strategy_classnames) {
373
+		$validation_strategy_classnames = is_array($validation_strategy_classnames)
374 374
 			? $validation_strategy_classnames
375
-			: array( $validation_strategy_classnames );
376
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
377
-			if( in_array( $key, $validation_strategy_classnames ) ) {
375
+			: array($validation_strategy_classnames);
376
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
377
+			if (in_array($key, $validation_strategy_classnames)) {
378 378
 				return true;
379 379
 			}
380 380
 		}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * Gets the HTML
388 388
 	 * @return string
389 389
 	 */
390
-	public function get_html(){
390
+	public function get_html() {
391 391
 		return $this->_parent_section->get_html_for_input($this);
392 392
 	}
393 393
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return string
402 402
 	 * @throws \EE_Error
403 403
 	 */
404
-	public function get_html_for_input(){
404
+	public function get_html_for_input() {
405 405
 		return  $this->_get_display_strategy()->display();
406 406
 	}
407 407
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 * @return string
412 412
 	 */
413 413
 	public function html_other_attributes() {
414
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
414
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
415 415
 	}
416 416
 
417 417
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	/**
420 420
 	 * @param string $html_other_attributes
421 421
 	 */
422
-	public function set_html_other_attributes( $html_other_attributes ) {
422
+	public function set_html_other_attributes($html_other_attributes) {
423 423
 		$this->_html_other_attributes = $html_other_attributes;
424 424
 	}
425 425
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * according to the form section's layout strategy
429 429
 	 * @return string
430 430
 	 */
431
-	public function get_html_for_label(){
431
+	public function get_html_for_label() {
432 432
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
433 433
 	}
434 434
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 * according to the form section's layout strategy
437 437
 	 * @return string
438 438
 	 */
439
-	public function get_html_for_errors(){
439
+	public function get_html_for_errors() {
440 440
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
441 441
 	}
442 442
 	/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * according to the form section's layout strategy
445 445
 	 * @return string
446 446
 	 */
447
-	public function get_html_for_help(){
447
+	public function get_html_for_help() {
448 448
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
449 449
 	}
450 450
 	/**
@@ -453,18 +453,18 @@  discard block
 block discarded – undo
453 453
 	 * @return boolean
454 454
 	 */
455 455
 	protected function _validate() {
456
-		foreach($this->_validation_strategies as $validation_strategy){
457
-			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
458
-				try{
456
+		foreach ($this->_validation_strategies as $validation_strategy) {
457
+			if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
458
+				try {
459 459
 					$validation_strategy->validate($this->normalized_value());
460
-				}catch(EE_Validation_Error $e){
460
+				} catch (EE_Validation_Error $e) {
461 461
 					$this->add_validation_error($e);
462 462
 				}
463 463
 			}
464 464
 		}
465
-		if( $this->get_validation_errors()){
465
+		if ($this->get_validation_errors()) {
466 466
 			return false;
467
-		}else{
467
+		} else {
468 468
 			return true;
469 469
 		}
470 470
 	}
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	 * @param string $value
478 478
 	 * @return null|string
479 479
 	 */
480
-	private function _sanitize($value){
481
-		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL;//don't sanitize_text_field
480
+	private function _sanitize($value) {
481
+		return $value !== NULL ?stripslashes(html_entity_decode($value)) : NULL; //don't sanitize_text_field
482 482
 	}
483 483
 
484 484
 
@@ -492,24 +492,24 @@  discard block
 block discarded – undo
492 492
 	 * @return boolean whether or not there was an error
493 493
 	 * @throws \EE_Error
494 494
 	 */
495
-	protected function _normalize( $req_data ) {
495
+	protected function _normalize($req_data) {
496 496
 		//any existing validation errors don't apply so clear them
497 497
 		$this->_validation_errors = array();
498 498
 		try {
499
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
499
+			$raw_input = $this->find_form_data_for_this_section($req_data);
500 500
 			//super simple sanitization for now
501
-			if ( is_array( $raw_input )) {
501
+			if (is_array($raw_input)) {
502 502
 				$this->_raw_value = array();
503
-				foreach( $raw_input as $key => $value ) {
504
-					$this->_raw_value[ $key ] = $this->_sanitize( $value );
503
+				foreach ($raw_input as $key => $value) {
504
+					$this->_raw_value[$key] = $this->_sanitize($value);
505 505
 				}
506 506
 			} else {
507
-				$this->_raw_value = $this->_sanitize( $raw_input );
507
+				$this->_raw_value = $this->_sanitize($raw_input);
508 508
 			}
509 509
 			//we want ot mostly leave the input alone in case we need to re-display it to the user
510
-			$this->_normalized_value = $this->_normalization_strategy->normalize( $this->raw_value() );
511
-		} catch ( EE_Validation_Error $e ) {
512
-			$this->add_validation_error( $e );
510
+			$this->_normalized_value = $this->_normalization_strategy->normalize($this->raw_value());
511
+		} catch (EE_Validation_Error $e) {
512
+			$this->add_validation_error($e);
513 513
 		}
514 514
 	}
515 515
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	/**
519 519
 	 * @return string
520 520
 	 */
521
-	public function html_name(){
521
+	public function html_name() {
522 522
 		return $this->_html_name;
523 523
 	}
524 524
 
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * @return string
529 529
 	 */
530
-	public function html_label_id(){
531
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
530
+	public function html_label_id() {
531
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
532 532
 	}
533 533
 
534 534
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	/**
537 537
 	 * @return string
538 538
 	 */
539
-	public function html_label_class(){
539
+	public function html_label_class() {
540 540
 		return $this->_html_label_class;
541 541
 	}
542 542
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	/**
546 546
 	 * @return string
547 547
 	 */
548
-	public function html_label_style(){
548
+	public function html_label_style() {
549 549
 		return $this->_html_label_style;
550 550
 	}
551 551
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	/**
555 555
 	 * @return string
556 556
 	 */
557
-	public function html_label_text(){
557
+	public function html_label_text() {
558 558
 		return $this->_html_label_text;
559 559
 	}
560 560
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	/**
564 564
 	 * @return string
565 565
 	 */
566
-	public function html_help_text(){
566
+	public function html_help_text() {
567 567
 		return $this->_html_help_text;
568 568
 	}
569 569
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	/**
573 573
 	 * @return string
574 574
 	 */
575
-	public function html_help_class(){
575
+	public function html_help_class() {
576 576
 		return $this->_html_help_class;
577 577
 	}
578 578
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	/**
582 582
 	 * @return string
583 583
 	 */
584
-	public function html_help_style(){
584
+	public function html_help_style() {
585 585
 		return $this->_html_style;
586 586
 	}
587 587
 	/**
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	 * in which case, we would have stored the malicious content to our database.
595 595
 	 * @return string
596 596
 	 */
597
-	public function raw_value(){
597
+	public function raw_value() {
598 598
 		return $this->_raw_value;
599 599
 	}
600 600
 	/**
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 	 * it escapes all html entities
603 603
 	 * @return string
604 604
 	 */
605
-	public function raw_value_in_form(){
606
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
605
+	public function raw_value_in_form() {
606
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
607 607
 	}
608 608
 	/**
609 609
 	 * returns the value after it's been sanitized, and then converted into it's proper type
610 610
 	 * in PHP. Eg, a string, an int, an array,
611 611
 	 * @return mixed
612 612
 	 */
613
-	public function normalized_value(){
613
+	public function normalized_value() {
614 614
 		return $this->_normalized_value;
615 615
 	}
616 616
 
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * the best thing to display
621 621
 	 * @return string
622 622
 	 */
623
-	public function pretty_value(){
623
+	public function pretty_value() {
624 624
 		return $this->_normalized_value;
625 625
 	}
626 626
 	/**
@@ -639,19 +639,19 @@  discard block
 block discarded – undo
639 639
 		  }</code>
640 640
 	 * @return array
641 641
 	 */
642
-	public function get_jquery_validation_rules(){
642
+	public function get_jquery_validation_rules() {
643 643
 		$jquery_validation_js = array();
644 644
 		$jquery_validation_rules = array();
645
-		foreach($this->get_validation_strategies() as $validation_strategy){
645
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
646 646
 			$jquery_validation_rules = array_replace_recursive(
647 647
 				$jquery_validation_rules,
648 648
 				$validation_strategy->get_jquery_validation_rule_array()
649 649
 			);
650 650
 		}
651 651
 
652
-		if(! empty($jquery_validation_rules)){
653
-			foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) {
654
-				$jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules;
652
+		if ( ! empty($jquery_validation_rules)) {
653
+			foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) {
654
+				$jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules;
655 655
 			}
656 656
 		}
657 657
 		return $jquery_validation_js;
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
 	 * @param mixed $value
664 664
 	 * @return void
665 665
 	 */
666
-	public function set_default($value){
666
+	public function set_default($value) {
667 667
 		$this->_normalized_value = $value;
668
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
668
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
669 669
 	}
670 670
 
671 671
 	/**
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	 * @param string $label
674 674
 	 * @return void
675 675
 	 */
676
-	public function set_html_label_text($label){
676
+	public function set_html_label_text($label) {
677 677
 		$this->_html_label_text = $label;
678 678
 	}
679 679
 
@@ -687,13 +687,13 @@  discard block
 block discarded – undo
687 687
 	 * @param boolean $required boolean
688 688
 	 * @param null    $required_text
689 689
 	 */
690
-	public function set_required($required = true, $required_text = NULL ){
691
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN  );
690
+	public function set_required($required = true, $required_text = NULL) {
691
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
692 692
 		//whether $required is a string or a boolean, we want to add a required validation strategy
693
-		if ( $required ) {
694
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
693
+		if ($required) {
694
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
695 695
 		} else {
696
-			unset( $this->_validation_strategies[ 'EE_Required_Validation_Strategy' ] );
696
+			unset($this->_validation_strategies['EE_Required_Validation_Strategy']);
697 697
 		}
698 698
 		$this->_required = $required;
699 699
 	}
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	 * Returns whether or not this field is required
702 702
 	 * @return boolean
703 703
 	 */
704
-	public function required(){
704
+	public function required() {
705 705
 		return $this->_required;
706 706
 	}
707 707
 
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	/**
711 711
 	 * @param string $required_css_class
712 712
 	 */
713
-	public function set_required_css_class( $required_css_class ) {
713
+	public function set_required_css_class($required_css_class) {
714 714
 		$this->_required_css_class = $required_css_class;
715 715
 	}
716 716
 
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 	 * Sets the help text, in case
730 730
 	 * @param string $text
731 731
 	 */
732
-	public function set_html_help_text($text){
732
+	public function set_html_help_text($text) {
733 733
 		$this->_html_help_text = $text;
734 734
 	}
735 735
 	/**
@@ -741,8 +741,8 @@  discard block
 block discarded – undo
741 741
 	public function clean_sensitive_data() {
742 742
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
743 743
 		//if we need more logic than this we'll make a strategy for it
744
-		if( $this->_sensitive_data_removal_strategy &&
745
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
744
+		if ($this->_sensitive_data_removal_strategy &&
745
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
746 746
 			$this->_raw_value = NULL;
747 747
 		}
748 748
 		//and clean the normalized value according to the appropriate strategy
@@ -758,10 +758,10 @@  discard block
 block discarded – undo
758 758
 	 * @param string $button_size
759 759
 	 * @param string $other_attributes
760 760
 	 */
761
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
761
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
762 762
 		$button_css_attributes = 'button';
763 763
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
764
-		switch ( $button_size ) {
764
+		switch ($button_size) {
765 765
 			case 'xs' :
766 766
 			case 'extra-small' :
767 767
 				$button_css_attributes .= ' button-xs';
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 			default :
783 783
 				$button_css_attributes .= '';
784 784
 		}
785
-		$this->_button_css_attributes .= ! empty( $other_attributes )
786
-			? $button_css_attributes . ' ' . $other_attributes
785
+		$this->_button_css_attributes .= ! empty($other_attributes)
786
+			? $button_css_attributes.' '.$other_attributes
787 787
 			: $button_css_attributes;
788 788
 	}
789 789
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 	 * @return string
794 794
 	 */
795 795
 	public function button_css_attributes() {
796
-		if ( empty( $this->_button_css_attributes )) {
796
+		if (empty($this->_button_css_attributes)) {
797 797
 			$this->set_button_css_attributes();
798 798
 		}
799 799
 		return $this->_button_css_attributes;
@@ -815,26 +815,26 @@  discard block
 block discarded – undo
815 815
 	 * @return mixed whatever the raw value of this form section is in the request data
816 816
 	 * @throws \EE_Error
817 817
 	 */
818
-	public function find_form_data_for_this_section( $req_data ){
818
+	public function find_form_data_for_this_section($req_data) {
819 819
 		// break up the html name by "[]"
820
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
821
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
820
+		if (strpos($this->html_name(), '[') !== FALSE) {
821
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
822 822
 		} else {
823 823
 			$before_any_brackets = $this->html_name();
824 824
 		}
825 825
 		// grab all of the segments
826
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
827
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
828
-			$name_parts = $matches[ 1 ];
826
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
827
+		if (isset($matches[1]) && is_array($matches[1])) {
828
+			$name_parts = $matches[1];
829 829
 			array_unshift($name_parts, $before_any_brackets);
830
-		}else{
831
-			$name_parts = array( $before_any_brackets );
830
+		} else {
831
+			$name_parts = array($before_any_brackets);
832 832
 		}
833 833
 		// now get the value for the input
834 834
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
835 835
 		// check if this thing's name is at the TOP level of the request data
836
-		if( $value === null && isset( $req_data[ $this->name() ] ) ){
837
-			$value = $req_data[ $this->name() ];
836
+		if ($value === null && isset($req_data[$this->name()])) {
837
+			$value = $req_data[$this->name()];
838 838
 		}
839 839
 		return $value;
840 840
 	}
@@ -847,18 +847,18 @@  discard block
 block discarded – undo
847 847
 	 * @param array $req_data
848 848
 	 * @return array | NULL
849 849
 	 */
850
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
851
-		$first_part_to_consider = array_shift( $html_name_parts );
852
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
853
-			if( empty($html_name_parts ) ){
854
-				return $req_data[ $first_part_to_consider ];
855
-			}else{
850
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
851
+		$first_part_to_consider = array_shift($html_name_parts);
852
+		if (isset($req_data[$first_part_to_consider])) {
853
+			if (empty($html_name_parts)) {
854
+				return $req_data[$first_part_to_consider];
855
+			} else {
856 856
 				return $this->_find_form_data_for_this_section_using_name_parts(
857 857
 					$html_name_parts,
858
-					$req_data[ $first_part_to_consider ]
858
+					$req_data[$first_part_to_consider]
859 859
 				);
860 860
 			}
861
-		}else{
861
+		} else {
862 862
 			return NULL;
863 863
 		}
864 864
 	}
@@ -872,14 +872,14 @@  discard block
 block discarded – undo
872 872
 	 * @return boolean
873 873
 	 * @throws \EE_Error
874 874
 	 */
875
-	public function form_data_present_in($req_data = NULL){
876
-		if( $req_data === NULL ){
875
+	public function form_data_present_in($req_data = NULL) {
876
+		if ($req_data === NULL) {
877 877
 			$req_data = $_POST;
878 878
 		}
879
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
880
-		if( $checked_value !== null ){
879
+		$checked_value = $this->find_form_data_for_this_section($req_data);
880
+		if ($checked_value !== null) {
881 881
 			return TRUE;
882
-		}else{
882
+		} else {
883 883
 			return FALSE;
884 884
 		}
885 885
 	}
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	 * @param array $form_other_js_data
891 891
 	 * @return array
892 892
 	 */
893
-	public function get_other_js_data( $form_other_js_data = array() ) {
894
-		$form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data );
893
+	public function get_other_js_data($form_other_js_data = array()) {
894
+		$form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data);
895 895
 		return $form_other_js_data;
896 896
 	}
897 897
 
@@ -904,10 +904,10 @@  discard block
 block discarded – undo
904 904
 	 * @param array $form_other_js_data
905 905
 	 * @return array
906 906
 	 */
907
-	public function get_other_js_data_from_strategies( $form_other_js_data = array() ) {
908
-		$form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data );
909
-		foreach( $this->get_validation_strategies() as $validation_strategy ) {
910
-			$form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data );
907
+	public function get_other_js_data_from_strategies($form_other_js_data = array()) {
908
+		$form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data);
909
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
910
+			$form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data);
911 911
 		}
912 912
 		return $form_other_js_data;
913 913
 	}
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 	 * Override parent because we want to give our strategies an opportunity to enqueue some js and css
917 917
 	 * @return void
918 918
 	 */
919
-	public function enqueue_js(){
919
+	public function enqueue_js() {
920 920
 		//ask our display strategy and validation strategies if they have js to enqueue
921 921
 		$this->enqueue_js_from_strategies();
922 922
 	}
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 	 */
928 928
 	public function enqueue_js_from_strategies() {
929 929
 		$this->get_display_strategy()->enqueue_js();
930
-		foreach( $this->get_validation_strategies() as $validation_strategy ) {
930
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
931 931
 			$validation_strategy->enqueue_js();
932 932
 		}
933 933
 	}
Please login to merge, or discard this patch.
strategies/validation/EE_Required_Validation_Strategy.strategy.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
  * @since 				4.6
9 9
  *
10 10
  */
11
-class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 
14 14
 
15 15
 	/**
16 16
 	 * @param string $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = null ) {
19
-		if( ! $validation_error_message ){
18
+	public function __construct($validation_error_message = null) {
19
+		if ( ! $validation_error_message) {
20 20
 			$validation_error_message = __("This field is required.", "event_espresso");
21 21
 		}
22
-		parent::__construct( $validation_error_message );
22
+		parent::__construct($validation_error_message);
23 23
 	}
24 24
 
25 25
 
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 	 * @throws \EE_Validation_Error
35 35
 	 */
36 36
 	public function validate($normalized_value) {
37
-		if(
37
+		if (
38 38
 			$normalized_value === ''
39 39
 			|| $normalized_value === null
40 40
 			|| $normalized_value === array()
41 41
 		) {
42
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'required');
43
-		}else{
42
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
43
+		} else {
44 44
 			return true;
45 45
 		}
46 46
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return array
52 52
 	 * @throws \EE_Error
53 53
 	 */
54
-	public function get_jquery_validation_rule_array(){
54
+	public function get_jquery_validation_rule_array() {
55 55
 		return array(
56 56
 			'required'=> true,
57 57
 			'messages' => array(
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 			|| $normalized_value === array()
41 41
 		) {
42 42
 			throw new EE_Validation_Error( $this->get_validation_error_message(), 'required');
43
-		}else{
43
+		} else{
44 44
 			return true;
45 45
 		}
46 46
 	}
Please login to merge, or discard this patch.
core/admin/PostShortcodeTracking.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\admin;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
 	public static function set_hooks_admin() {
29 29
 		add_action(
30 30
 			'save_post',
31
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
31
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save'),
32 32
 			100,
33 33
 			2
34 34
 		);
35 35
 		add_action(
36 36
 			'delete_post',
37
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
37
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete'),
38 38
 			100,
39 39
 			1
40 40
 		);
41 41
 		add_action(
42 42
 			'add_option_page_for_posts',
43
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
43
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set'),
44 44
 			100,
45 45
 			2
46 46
 		);
47 47
 		add_action(
48 48
 			'update_option',
49
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
49
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change'),
50 50
 			100,
51 51
 			3
52 52
 		);
53 53
 		add_action(
54 54
 			'delete_option',
55
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
55
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete'),
56 56
 			100,
57 57
 			1
58 58
 		);
@@ -72,61 +72,61 @@  discard block
 block discarded – undo
72 72
 	 * @param \WP_Post $post
73 73
 	 * @return    void
74 74
 	 */
75
-	public static function parse_post_content_on_save( $post_ID, $post ) {
75
+	public static function parse_post_content_on_save($post_ID, $post) {
76 76
 		// if the post is trashed, then let's remove our post shortcode tracking
77
-		if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
78
-			PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
77
+		if ($post instanceof \WP_Post && $post->post_status === 'trash') {
78
+			PostShortcodeTracking::unset_post_shortcodes_on_delete($post_ID);
79 79
 			return;
80 80
 		}
81 81
 		// default post types
82
-		$post_types = array( 'post' => 0, 'page' => 1 );
82
+		$post_types = array('post' => 0, 'page' => 1);
83 83
 		// add CPTs
84 84
 		$CPTs = \EE_Register_CPTs::get_CPTs();
85
-		$post_types = array_merge( $post_types, $CPTs );
85
+		$post_types = array_merge($post_types, $CPTs);
86 86
 		// for default or CPT posts...
87
-		if ( isset( $post_types[ $post->post_type ] ) ) {
87
+		if (isset($post_types[$post->post_type])) {
88 88
 			// post on frontpage ?
89 89
 			$page_for_posts = \EE_Config::get_page_for_posts();
90
-			if ( $post->post_name === $page_for_posts ) {
91
-				PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
90
+			if ($post->post_name === $page_for_posts) {
91
+				PostShortcodeTracking::set_post_shortcodes_for_posts_page($page_for_posts);
92 92
 				return;
93 93
 			}
94 94
 			// array of shortcodes indexed by post name
95
-			\EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
95
+			\EE_Registry::CFG()->core->post_shortcodes = isset(\EE_Registry::CFG()->core->post_shortcodes)
96 96
 				? \EE_Registry::CFG()->core->post_shortcodes
97 97
 				: array();
98 98
 			// whether to proceed with update
99 99
 			$update_post_shortcodes = false;
100 100
 			// empty both arrays
101
-			\EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
101
+			\EE_Registry::CFG()->core->post_shortcodes[$post->post_name] = array();
102 102
 			// check that posts page is already being tracked
103
-			if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
103
+			if ( ! isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) {
104 104
 				// if not, then ensure that it is properly added
105
-				\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
105
+				\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
106 106
 			}
107 107
 			// loop thru shortcodes
108
-			foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
108
+			foreach (\EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
109 109
 				// convert to UPPERCASE to get actual shortcode
110
-				$EES_Shortcode = strtoupper( $EES_Shortcode );
110
+				$EES_Shortcode = strtoupper($EES_Shortcode);
111 111
 				// is the shortcode in the post_content ?
112
-				if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
112
+				if (strpos($post->post_content, $EES_Shortcode) !== false) {
113 113
 					// map shortcode to post names and post IDs
114
-					\EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
114
+					\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
115 115
 					// and add this shortcode to the tracking for the blog page
116
-					PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
116
+					PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID);
117 117
 					$update_post_shortcodes = true;
118 118
 				} else {
119 119
 					// shortcode is not present in post content, so check if we were tracking it previously
120 120
 					// stop tracking if shortcode is not used in this specific post
121
-					if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
122
-						unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
121
+					if (isset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode])) {
122
+						unset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode]);
123 123
 						$update_post_shortcodes = true;
124 124
 					}
125 125
 					// make sure that something is set for the shortcode posts (even though we may remove this)
126 126
 					$shortcode_posts = isset(
127
-						\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
127
+						\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]
128 128
 					)
129
-						? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
129
+						? \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]
130 130
 						: array();
131 131
 					// and stop tracking for this shortcode on the blog page if it is not used
132 132
 					$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 						: $update_post_shortcodes;
141 141
 				}
142 142
 			}
143
-			if ( $update_post_shortcodes ) {
144
-				PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
143
+			if ($update_post_shortcodes) {
144
+				PostShortcodeTracking::update_post_shortcodes($page_for_posts);
145 145
 			}
146 146
 		}
147 147
 	}
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
 	 * @param  string $page_for_posts
159 159
 	 * @return void
160 160
 	 */
161
-	protected static function set_post_shortcodes_for_posts_page( $page_for_posts ) {
162
-		\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
161
+	protected static function set_post_shortcodes_for_posts_page($page_for_posts) {
162
+		\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
163 163
 		// loop thru shortcodes
164
-		foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
165
-			foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
166
-				PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
164
+		foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
165
+			foreach ($post_shortcodes as $EES_Shortcode => $post_ID) {
166
+				PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID);
167 167
 			}
168 168
 		}
169
-		PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
169
+		PostShortcodeTracking::update_post_shortcodes($page_for_posts);
170 170
 	}
171 171
 
172 172
 
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
 	 * @param         $EES_Shortcode
182 182
 	 * @param         $post_ID
183 183
 	 */
184
-	protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID ) {
184
+	protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID) {
185 185
 		// critical page shortcodes that we do NOT want added to the Posts page (blog)
186 186
 		$critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
187 187
 		// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
188
-		if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
188
+		if (in_array($EES_Shortcode, $critical_shortcodes)) {
189 189
 			return;
190 190
 		}
191 191
 		// add shortcode to "Posts page" tracking
192
-		if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
192
+		if (isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) {
193 193
 			// make sure tracking is in form of an array
194
-			if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
195
-				\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
196
-					\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true
194
+			if ( ! is_array(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) {
195
+				\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array(
196
+					\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] => true
197 197
 				);
198 198
 			}
199
-			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
199
+			\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] += array($post_ID => true);
200 200
 		} else {
201
-			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
201
+			\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array($post_ID => true);
202 202
 		}
203 203
 	}
204 204
 
@@ -211,16 +211,16 @@  discard block
 block discarded – undo
211 211
 	 * @param  int $ID
212 212
 	 * @return void
213 213
 	 */
214
-	public static function unset_post_shortcodes_on_delete( $ID ) {
214
+	public static function unset_post_shortcodes_on_delete($ID) {
215 215
 		$update_post_shortcodes = false;
216 216
 		// post on frontpage ?
217 217
 		$page_for_posts = \EE_Config::get_page_for_posts();
218 218
 		// looking for any references to this post
219
-		foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
219
+		foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
220 220
 			// is this the "Posts Page" (blog) ?
221
-			if ( $post_name === $page_for_posts ) {
221
+			if ($post_name === $page_for_posts) {
222 222
 				// loop thru shortcodes registered for the posts page
223
-				foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
223
+				foreach ($post_shortcodes as $shortcode_class => $shortcode_posts) {
224 224
 					$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
225 225
 						$ID,
226 226
 						$shortcode_class,
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 				}
234 234
 			} else {
235 235
 				// loop thru shortcodes registered for each page
236
-				foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
236
+				foreach ($post_shortcodes as $shortcode_class => $post_ID) {
237 237
 					// if this is page is being deleted, then don't track any post shortcodes for it
238
-					if ( $post_ID === $ID ) {
239
-						unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
238
+					if ($post_ID === $ID) {
239
+						unset(\EE_Registry::CFG()->core->post_shortcodes[$post_name]);
240 240
 						$update_post_shortcodes = true;
241 241
 					}
242 242
 				}
243 243
 			}
244 244
 		}
245
-		if ( $update_post_shortcodes ) {
246
-			PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
245
+		if ($update_post_shortcodes) {
246
+			PostShortcodeTracking::update_post_shortcodes($page_for_posts);
247 247
 		}
248 248
 	}
249 249
 
@@ -268,20 +268,20 @@  discard block
 block discarded – undo
268 268
 		$update_post_shortcodes = false
269 269
 	) {
270 270
 		// make sure that an array of post IDs is being tracked for each  shortcode
271
-		if ( ! is_array( $shortcode_posts ) ) {
272
-			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
271
+		if ( ! is_array($shortcode_posts)) {
272
+			\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class] = array(
273 273
 				$shortcode_posts => true
274 274
 			);
275 275
 			$update_post_shortcodes = true;
276 276
 		}
277 277
 		// now if the ID of the post being deleted is in the $shortcode_posts array
278
-		if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
279
-			unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
278
+		if (is_array($shortcode_posts) && isset($shortcode_posts[$ID])) {
279
+			unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class][$ID]);
280 280
 			$update_post_shortcodes = true;
281 281
 		}
282 282
 		// if nothing is registered for that shortcode anymore, then delete the shortcode altogether
283
-		if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
284
-			unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
283
+		if (empty(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])) {
284
+			unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class]);
285 285
 			$update_post_shortcodes = true;
286 286
 		}
287 287
 		return $update_post_shortcodes;
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 	 * @param $page_for_posts
297 297
 	 * @return    void
298 298
 	 */
299
-	public static function update_post_shortcodes( $page_for_posts = '' ) {
299
+	public static function update_post_shortcodes($page_for_posts = '') {
300 300
 		// make sure page_for_posts is set
301
-		$page_for_posts = ! empty( $page_for_posts )
301
+		$page_for_posts = ! empty($page_for_posts)
302 302
 			? $page_for_posts
303 303
 			: \EE_Config::get_page_for_posts();
304 304
 		// allow others to mess stuff up :D
@@ -314,45 +314,45 @@  discard block
 block discarded – undo
314 314
 			$page_for_posts
315 315
 		);
316 316
 		// verify that post_shortcodes is set
317
-		\EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
318
-		                                                && is_array( \EE_Config::instance()->core->post_shortcodes )
317
+		\EE_Config::instance()->core->post_shortcodes = isset(\EE_Config::instance()->core->post_shortcodes)
318
+		                                                && is_array(\EE_Config::instance()->core->post_shortcodes)
319 319
 			? \EE_Config::instance()->core->post_shortcodes
320 320
 			: array();
321 321
 		// cycle thru post_shortcodes
322
-		foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
322
+		foreach (\EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes) {
323 323
 			// are there any shortcodes to track ?
324
-			if ( ! empty( $shortcodes ) ) {
324
+			if ( ! empty($shortcodes)) {
325 325
 				// loop thru list of tracked shortcodes
326
-				foreach ( $shortcodes as $shortcode => $post_id ) {
326
+				foreach ($shortcodes as $shortcode => $post_id) {
327 327
 					// if shortcode is for a critical page,
328 328
 					// BUT this is NOT the corresponding critical page for that shortcode
329
-					if ( $post_name === $page_for_posts ) {
329
+					if ($post_name === $page_for_posts) {
330 330
 						continue;
331 331
 					}
332 332
 					// skip the posts page, because we want all shortcodes registered for it
333
-					if ( $post_name === $page_for_posts ) {
333
+					if ($post_name === $page_for_posts) {
334 334
 						continue;
335 335
 					}
336 336
 					// make sure post still exists
337
-					$post = get_post( $post_id );
337
+					$post = get_post($post_id);
338 338
 					// check that the post name matches what we have saved
339
-					if ( $post && $post->post_name === $post_name ) {
339
+					if ($post && $post->post_name === $post_name) {
340 340
 						// if so, then break before hitting the unset below
341 341
 						continue;
342 342
 					}
343 343
 					// we don't like missing posts around here >:(
344
-					unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
344
+					unset(\EE_Config::instance()->core->post_shortcodes[$post_name]);
345 345
 				}
346 346
 			} else {
347 347
 				// you got no shortcodes to keep track of !
348
-				unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
348
+				unset(\EE_Config::instance()->core->post_shortcodes[$post_name]);
349 349
 			}
350 350
 		}
351 351
 		// critical page shortcodes that we do NOT want added to the Posts page (blog)
352 352
 		$critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
353
-		$critical_shortcodes = array_flip( $critical_shortcodes );
354
-		foreach ( $critical_shortcodes as $critical_shortcode ) {
355
-			unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
353
+		$critical_shortcodes = array_flip($critical_shortcodes);
354
+		foreach ($critical_shortcodes as $critical_shortcode) {
355
+			unset(\EE_Config::instance()->core->post_shortcodes[$page_for_posts][$critical_shortcode]);
356 356
 		}
357 357
 		//only show errors
358 358
 		\EE_Config::instance()->update_espresso_config();
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 	 * @param  string $value
373 373
 	 * @return void
374 374
 	 */
375
-	public static function reset_page_for_posts_on_initial_set( $option, $value ) {
376
-		PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
375
+	public static function reset_page_for_posts_on_initial_set($option, $value) {
376
+		PostShortcodeTracking::reset_page_for_posts_on_change($option, '', $value);
377 377
 	}
378 378
 
379 379
 
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
 	 * @param  string $value
391 391
 	 * @return void
392 392
 	 */
393
-	public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' ) {
394
-		if ( $option === 'page_for_posts' ) {
393
+	public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '') {
394
+		if ($option === 'page_for_posts') {
395 395
 			global $wpdb;
396 396
 			$table = $wpdb->posts;
397 397
 			$SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
398
-			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
399
-			PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
398
+			$new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
399
+			PostShortcodeTracking::set_post_shortcodes_for_posts_page($new_page_for_posts);
400 400
 		}
401 401
 	}
402 402
 
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 	 * @param  string $option
413 413
 	 * @return void
414 414
 	 */
415
-	public static function reset_page_for_posts_on_delete( $option ) {
416
-		if ( $option === 'page_for_posts' ) {
417
-			PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
415
+	public static function reset_page_for_posts_on_delete($option) {
416
+		if ($option === 'page_for_posts') {
417
+			PostShortcodeTracking::set_post_shortcodes_for_posts_page('posts');
418 418
 		}
419 419
 	}
420 420
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT.core.php 3 patches
Braces   +49 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EE_Admin_Page_CPT class
4 6
  *
@@ -236,8 +238,9 @@  discard block
 block discarded – undo
236 238
 
237 239
 		$containers = array();
238 240
 
239
-		if ( empty( $wp_meta_boxes ) )
240
-			return;
241
+		if ( empty( $wp_meta_boxes ) ) {
242
+					return;
243
+		}
241 244
 
242 245
 		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
243 246
 
@@ -341,8 +344,9 @@  discard block
 block discarded – undo
341 344
 
342 345
 
343 346
 		//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 );
347
+		if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) {
348
+					add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
349
+		}
346 350
 
347 351
 		//add preview button
348 352
 		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
@@ -352,12 +356,14 @@  discard block
 block discarded – undo
352 356
 		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
353 357
 
354 358
 		//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 );
359
+		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) {
360
+					add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
361
+		}
357 362
 
358 363
 		//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 );
364
+		if ( method_exists( $this, 'edit_form_after_title' ) ) {
365
+					add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
366
+		}
361 367
 
362 368
 
363 369
 		/**
@@ -548,7 +554,9 @@  discard block
 block discarded – undo
548 554
 
549 555
 
550 556
 		//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);
557
+		if ( !defined('DOING_AUTOSAVE') ) {
558
+			define('DOING_AUTOSAVE', true);
559
+		}
552 560
 
553 561
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554 562
 		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
@@ -578,8 +586,9 @@  discard block
 block discarded – undo
578 586
 	protected function _extend_page_config_for_cpt() {
579 587
 
580 588
 		//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 ) )
582
-			return;
589
+		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) {
590
+					return;
591
+		}
583 592
 
584 593
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585 594
 		if ( !empty( $this->_cpt_object ) ) {
@@ -611,8 +620,9 @@  discard block
 block discarded – undo
611 620
 		}
612 621
 
613 622
 		//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] ) )
615
-			return;
623
+		if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) {
624
+					return;
625
+		}
616 626
 
617 627
 
618 628
 		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
@@ -896,8 +906,10 @@  discard block
 block discarded – undo
896 906
 			}
897 907
 		}
898 908
 
899
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
900
-			return; //TODO we'll remove this after reimplementing autosave in 4.2
909
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
910
+					return;
911
+		}
912
+		//TODO we'll remove this after reimplementing autosave in 4.2
901 913
 		$this->_insert_update_cpt_item( $post_id, $post );
902 914
 	}
903 915
 
@@ -974,7 +986,9 @@  discard block
 block discarded – undo
974 986
 	 */
975 987
 	public function modify_current_screen() {
976 988
 		//ONLY do this if the current page_route IS a cpt route
977
-		if ( !$this->_cpt_route ) return;
989
+		if ( !$this->_cpt_route ) {
990
+			return;
991
+		}
978 992
 		//routing things REALLY early b/c this is a cpt admin page
979 993
 		set_current_screen( $this->_cpt_routes[$this->_req_action]);
980 994
 		$this->_current_screen = get_current_screen();
@@ -1014,8 +1028,9 @@  discard block
 block discarded – undo
1014 1028
 	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
1015 1029
 		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
1016 1030
 			$post = get_post( $id );
1017
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
1018
-			$shortlink = home_url('?p=' . $post->ID);
1031
+			if ( isset($post->post_type) && $this->page_slug == $post->post_type ) {
1032
+						$shortlink = home_url('?p=' . $post->ID);
1033
+			}
1019 1034
 		}
1020 1035
 		return $shortlink;
1021 1036
 	}
@@ -1028,7 +1043,9 @@  discard block
 block discarded – undo
1028 1043
 	 * @return void
1029 1044
 	 */
1030 1045
 	public function route_admin_request() {
1031
-		if ( $this->_cpt_route ) return;
1046
+		if ( $this->_cpt_route ) {
1047
+			return;
1048
+		}
1032 1049
 		try {
1033 1050
 			$this->_route_admin_request();
1034 1051
 		} catch ( EE_Error $e ) {
@@ -1067,8 +1084,9 @@  discard block
 block discarded – undo
1067 1084
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
1068 1085
 
1069 1086
 		//can't do anything without revision so let's get out if not present
1070
-		if ( empty( $rev_id ) )
1071
-			return $location;
1087
+		if ( empty( $rev_id ) ) {
1088
+					return $location;
1089
+		}
1072 1090
 
1073 1091
 		//get rev_post_data
1074 1092
 		$rev = get_post($rev_id);
@@ -1097,8 +1115,9 @@  discard block
 block discarded – undo
1097 1115
 	 */
1098 1116
 	public function modify_edit_post_link( $link, $id, $context ) {
1099 1117
 		$post = get_post( $id );
1100
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1101
-			return $link;
1118
+		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) {
1119
+					return $link;
1120
+		}
1102 1121
 		$query_args = array(
1103 1122
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1104 1123
 			'post' => $id
@@ -1118,8 +1137,9 @@  discard block
 block discarded – undo
1118 1137
 	 */
1119 1138
 	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1120 1139
 		$post = get_post($post_id);
1121
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1122
-			return $delete_link;
1140
+		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) {
1141
+					return $delete_link;
1142
+		}
1123 1143
 
1124 1144
 		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1125 1145
 	}
@@ -1133,8 +1153,9 @@  discard block
 block discarded – undo
1133 1153
 	 * @return string           url to redirect to
1134 1154
 	 */
1135 1155
 	public function cpt_trash_post_location_redirect( $location, $status ) {
1136
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1137
-			return $location;
1156
+		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) {
1157
+					return $location;
1158
+		}
1138 1159
 
1139 1160
 		$post = get_post( $this->_req_data['post'] );
1140 1161
 		$query_args = array( 'action' => 'default' );
Please login to merge, or discard this 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.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	/**
81
-	* @var EE_CPT_Base
82
-	*/
81
+	 * @var EE_CPT_Base
82
+	 */
83 83
 	protected $_cpt_model_obj = FALSE;
84 84
 
85 85
 
@@ -645,12 +645,12 @@  discard block
 block discarded – undo
645 645
 		$model = null;
646 646
 		if (
647 647
 			empty( $this->_cpt_model_names )
648
-		    || (
649
-			     ! $ignore_route_check
650
-			     && ! isset( $this->_cpt_routes[ $this->_req_action ] )
651
-		    ) || (
652
-			     $this->_cpt_model_obj instanceof EE_CPT_Base
653
-			     && $this->_cpt_model_obj->ID() === $id
648
+			|| (
649
+				 ! $ignore_route_check
650
+				 && ! isset( $this->_cpt_routes[ $this->_req_action ] )
651
+			) || (
652
+				 $this->_cpt_model_obj instanceof EE_CPT_Base
653
+				 && $this->_cpt_model_obj->ID() === $id
654 654
 			)
655 655
 		) {
656 656
 			//get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
@@ -890,9 +890,9 @@  discard block
 block discarded – undo
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 891
 		if ( $update
892 892
 			&& (
893
-			     ! $this->_cpt_model_obj instanceof EE_CPT_Base
894
-			     || $this->_cpt_model_obj->ID() !== $post_id
895
-		     )
893
+				 ! $this->_cpt_model_obj instanceof EE_CPT_Base
894
+				 || $this->_cpt_model_obj->ID() !== $post_id
895
+			 )
896 896
 		) {
897 897
 			return;
898 898
 		}
Please login to merge, or discard this patch.
shortcodes/espresso_txn_page/EES_Espresso_Txn_Page.shortcode.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
 				$gateway = $payment_method->type_obj()->get_gateway();
97 97
 				if (
98 98
 					$gateway instanceof EE_Offsite_Gateway
99
-				    && $gateway->handle_IPN_in_this_request(
99
+					&& $gateway->handle_IPN_in_this_request(
100 100
 						\EE_Registry::instance()->REQ->params(),
101 101
 						true
102 102
 					)
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * EES_Espresso_Txn_Page
4 4
  *
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *  @return 	void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 );
30
+		add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2);
31 31
 	}
32 32
 
33 33
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *  @return 	void
49 49
 	 */
50 50
 	public static function set_definitions() {
51
-		define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
52
-		define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
51
+		define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
52
+		define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53 53
 	}
54 54
 
55 55
 
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	 * @throws \Exception
67 67
 	 * @throws \EE_Error
68 68
 	 */
69
-	public function run( WP $WP ) {
69
+	public function run(WP $WP) {
70 70
 		$this->_current_txn = null;
71
-		if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){
71
+		if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
72 72
 			/** @var EEM_Transaction $EEM_Transaction */
73
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
73
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
74 74
 			$this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link();
75 75
 		}
76
-		if ( $this->_current_txn instanceof EE_Transaction ) {
76
+		if ($this->_current_txn instanceof EE_Transaction) {
77 77
 			$payment_method = null;
78
-			$payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null );
79
-			if( $payment_method_slug ) {
80
-				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug );
78
+			$payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null);
79
+			if ($payment_method_slug) {
80
+				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug);
81 81
 			}
82 82
 
83
-			if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) {
83
+			if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) {
84 84
 				$gateway = $payment_method->type_obj()->get_gateway();
85 85
 				if (
86 86
 					$gateway instanceof EE_Offsite_Gateway
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 					)
91 91
 				) {
92 92
 					/** @type EE_Payment_Processor $payment_processor */
93
-					$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
94
-					$payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method );
93
+					$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
94
+					$payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method);
95 95
 				}
96 96
 			}
97 97
 			//allow gateways to add a filter to stop rendering the page
98
-			if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){
98
+			if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) {
99 99
 				exit;
100 100
 			}
101 101
 		}
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 *  @param		array 	$attributes
113 113
 	 *  @return 	string
114 114
 	 */
115
-	public function process_shortcode( $attributes = array() ) {
116
-		return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' );
115
+	public function process_shortcode($attributes = array()) {
116
+		return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
117 117
 	}
118 118
 
119 119
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -606,9 +606,9 @@
 block discarded – undo
606 606
 		// first check if event is active.
607 607
 		if (
608 608
 			$orig_status === EEM_Event::cancelled
609
-		    || $orig_status === EEM_Event::postponed
610
-		    || $event->is_expired()
611
-		    || $event->is_inactive()
609
+			|| $orig_status === EEM_Event::postponed
610
+			|| $event->is_expired()
611
+			|| $event->is_inactive()
612 612
 		) {
613 613
 			return;
614 614
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -1484,10 +1485,11 @@  discard block
 block discarded – undo
1484 1485
 			//get the earliest datetime (if present);
1485 1486
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1486 1487
 
1487
-			if ( !empty( $earliest_dtt ) )
1488
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1489
-			else
1490
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1488
+			if ( !empty( $earliest_dtt ) ) {
1489
+							$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1490
+			} else {
1491
+							$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1492
+			}
1491 1493
 		}
1492 1494
 
1493 1495
 		$template_args = array_merge( $template_args, $price_args );
@@ -1725,8 +1727,9 @@  discard block
 block discarded – undo
1725 1727
 		}
1726 1728
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1727 1729
 
1728
-		if ( $redirect_after )
1729
-			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1730
+		if ( $redirect_after ) {
1731
+					$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1732
+		}
1730 1733
 	}
1731 1734
 
1732 1735
 	/**
@@ -1853,8 +1856,9 @@  discard block
 block discarded – undo
1853 1856
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1854 1857
 		}
1855 1858
 
1856
-		if ( $redirect_after )
1857
-			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1859
+		if ( $redirect_after ) {
1860
+					$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1861
+		}
1858 1862
 	}
1859 1863
 
1860 1864
 	/**
@@ -2091,8 +2095,10 @@  discard block
 block discarded – undo
2091 2095
 	 * @return void
2092 2096
 	 */
2093 2097
 	private function _set_category_object() {
2094
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2095
-			return; //already have the category object so get out.
2098
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
2099
+					return;
2100
+		}
2101
+		//already have the category object so get out.
2096 2102
 
2097 2103
 		//set default category object
2098 2104
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +383 added lines, -383 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,7 +92,7 @@  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
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		//load field generator helper
103 103
 
104 104
 		//is there a evt_id in the request?
105
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
106
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
105
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
106
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
107 107
 
108 108
 
109 109
 		$this->_page_routes = array(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				'help_tour' => array(
318 318
 					'Event_Editor_Help_Tour'
319 319
 					),
320
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
320
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
321 321
 				'require_nonce' => FALSE
322 322
 			),
323 323
 			'edit' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				/*'help_tour' => array(
374 374
 					'Event_Edit_Help_Tour'
375 375
 				),*/
376
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
376
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
377 377
 				'require_nonce' => FALSE
378 378
 			),
379 379
 			'default_event_settings' => array(
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'filename' => 'events_default_settings_status'
396 396
 					)
397 397
 				),
398
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
398
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
399 399
 				'require_nonce' => FALSE
400 400
 			),
401 401
 			//template settings
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						'filename' => 'general_settings_templates'
412 412
 					)
413 413
 				),
414
-				'help_tour' => array( 'Templates_Help_Tour' ),
414
+				'help_tour' => array('Templates_Help_Tour'),
415 415
 				'require_nonce' => FALSE
416 416
 			),
417 417
 			//event category stuff
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					'label' => __('Edit Category', 'event_espresso'),
436 436
 					'order' => 15,
437 437
 					'persistent' => FALSE,
438
-					'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
438
+					'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
439 439
 					),
440 440
 				'help_tabs' => array(
441 441
 					'edit_category_help_tab' => array(
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 	public function load_scripts_styles() {
507 507
 
508
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
508
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
510 510
 		wp_enqueue_style('events-admin-css');
511 511
 		wp_enqueue_style('ee-cat-admin');
512 512
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
513 513
 		//registers for all views
514 514
 		//scripts
515
-		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);
515
+		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);
516 516
 	}
517 517
 
518 518
 	/**
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	public function load_scripts_styles_edit() {
531 531
 		//styles
532 532
 		wp_enqueue_style('espresso-ui-theme');
533
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
533
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
534 534
 		wp_enqueue_style('event-editor-css');
535 535
 
536 536
 		//scripts
537
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
537
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
538 538
 		wp_enqueue_script('event-datetime-metabox');
539 539
 
540 540
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
 
571 571
 	public function admin_init() {
572
-		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' );
572
+		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');
573 573
 	}
574 574
 
575 575
 
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function verify_event_edit($event = NULL) {
592 592
 		// no event?
593
-		if ( empty( $event )) {
593
+		if (empty($event)) {
594 594
 			// set event
595 595
 			$event = $this->_cpt_model_obj;
596 596
 		}
597 597
 		// STILL no event?
598
-		if ( empty ( $event )) {
598
+		if (empty ($event)) {
599 599
 			return;
600 600
 		}
601 601
 		$orig_status = $event->status();
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 			return;
610 610
 		}
611 611
 		//made it here so it IS active... next check that any of the tickets are sold.
612
-		if ( $event->is_sold_out( true ) ) {
613
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
612
+		if ($event->is_sold_out(true)) {
613
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
614 614
 				EE_Error::add_attention(
615 615
 					sprintf(
616
-						__( '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' ),
617
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
616
+						__('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'),
617
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
618 618
 					)
619 619
 				);
620 620
 			}
621 621
 			return;
622
-		} else if ( $orig_status === EEM_Event::sold_out ) {
622
+		} else if ($orig_status === EEM_Event::sold_out) {
623 623
 			EE_Error::add_attention(
624 624
 				sprintf(
625
-					__( '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.',
626
-						'event_espresso' ),
627
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
625
+					__('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.',
626
+						'event_espresso'),
627
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
628 628
 				)
629 629
 			);
630 630
 		}
631 631
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
632
-		if ( ! $event->tickets_on_sale() ) {
632
+		if ( ! $event->tickets_on_sale()) {
633 633
 			return;
634 634
 		}
635 635
 		//made it here so show warning
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	protected function _edit_event_warning() {
650 650
 		// we don't want to add warnings during these requests
651
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
651
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
652 652
 			return;
653 653
 		}
654 654
 		EE_Error::add_attention(
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			),
680 680
 		);
681 681
 
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
683 683
 			$this->_views['trash'] = array(
684 684
 				'slug' => 'trash',
685 685
 				'label' => __('Trash', 'event_espresso'),
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 				'desc' => __('View Registrations for Event', 'event_espresso')
710 710
 			)
711 711
 		);
712
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
712
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
713 713
 		$statuses = array(
714 714
 			'sold_out_status' => array(
715
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
716
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
715
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
716
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
717 717
 			),
718 718
 			'active_status' => array(
719
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
720
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
719
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
720
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
721 721
 			),
722 722
 			'upcoming_status' => array(
723
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
724
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
723
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
724
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
725 725
 			),
726 726
 			'postponed_status' => array(
727
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
728
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
727
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
728
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
729 729
 			),
730 730
 			'cancelled_status' => array(
731
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
732
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
731
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
732
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
733 733
 			),
734 734
 			'expired_status' => array(
735
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
736
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
735
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
736
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
737 737
 			),
738 738
 			'inactive_status' => array(
739
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
740
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
739
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
740
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
741 741
 			)
742 742
 		);
743
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
744
-		return array_merge( $items, $statuses );
743
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
744
+		return array_merge($items, $statuses);
745 745
 	}
746 746
 
747 747
 
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @return EEM_Event
754 754
 	 */
755 755
 	private function _event_model() {
756
-		if ( ! $this->_event_model instanceof EEM_Event ) {
757
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
756
+		if ( ! $this->_event_model instanceof EEM_Event) {
757
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
758 758
 		}
759 759
 		return $this->_event_model;
760 760
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param  string $new_slug  what the slug is
774 774
 	 * @return string            The new html string for the permalink area
775 775
 	 */
776
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
776
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
777 777
 		//make sure this is only when editing
778
-		if ( !empty( $id ) ) {
779
-			$post = get_post( $id );
780
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
781
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
778
+		if ( ! empty($id)) {
779
+			$post = get_post($id);
780
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
781
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
782 782
 		}
783 783
 		return $return;
784 784
 	}
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
 	 * @return string html for generated table
795 795
 	 */
796 796
 	protected function _events_overview_list_table() {
797
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
798
-		$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' ) .
797
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
798
+		$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 799
 		$this->_display_legend($this->_event_legend_items());
800 800
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
801 801
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -813,51 +813,51 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 
816
-	protected function _insert_update_cpt_item( $post_id, $post ) {
816
+	protected function _insert_update_cpt_item($post_id, $post) {
817 817
 
818
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
818
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
819 819
 			//getout we're not processing an event save.
820 820
 			return;
821 821
 		}
822 822
 
823 823
 		$event_values = array(
824
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
825
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
824
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
825
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
826 826
 			'EVT_additional_limit' => min(
827
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
828
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
829
-			'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,
830
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
831
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
832
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
833
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
834
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
827
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
828
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
829
+			'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,
830
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
831
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
832
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
833
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
834
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
835 835
 			);
836 836
 
837 837
 		//update event
838
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
838
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
839 839
 
840 840
 
841 841
 		//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!
842
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
843
-		$event = $this->_event_model()->get_one( array($get_one_where) );
842
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
843
+		$event = $this->_event_model()->get_one(array($get_one_where));
844 844
 
845 845
 
846 846
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
847
-		$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') ) );
847
+		$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')));
848 848
 
849 849
 		$att_success = TRUE;
850 850
 
851
-		foreach ( $event_update_callbacks as $e_callback ) {
852
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
853
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
851
+		foreach ($event_update_callbacks as $e_callback) {
852
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
853
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
854 854
 		}
855 855
 
856 856
 		//any errors?
857
-		if ( $success && FALSE === $att_success ) {
858
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
-		} else if ( $success === FALSE ) {
860
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
857
+		if ($success && FALSE === $att_success) {
858
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859
+		} else if ($success === FALSE) {
860
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861 861
 		}
862 862
 	}
863 863
 
@@ -867,14 +867,14 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * @see parent::restore_item()
869 869
 	 */
870
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
870
+	protected function _restore_cpt_item($post_id, $revision_id) {
871 871
 		//copy existing event meta to new post
872 872
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
873
-		if ( $post_evt instanceof EE_Event ) {
873
+		if ($post_evt instanceof EE_Event) {
874 874
 			//meta revision restore
875
-			$post_evt->restore_revision( $revision_id );
875
+			$post_evt->restore_revision($revision_id);
876 876
 			//related objs restore
877
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
877
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
878 878
 		}
879 879
 	}
880 880
 
@@ -887,52 +887,52 @@  discard block
 block discarded – undo
887 887
 	 * @param  array  $data   The request data from the form
888 888
 	 * @return bool           Success or fail.
889 889
 	 */
890
-	protected function _default_venue_update( $evtobj, $data ) {
891
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
890
+	protected function _default_venue_update($evtobj, $data) {
891
+		require_once(EE_MODELS.'EEM_Venue.model.php');
892 892
 		$venue_model = EE_Registry::instance()->load_model('Venue');
893 893
 		$rows_affected = NULL;
894
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
894
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
895 895
 
896 896
 		// very important.  If we don't have a venue name...
897 897
 		// then we'll get out because not necessary to create empty venue
898
-		if ( empty( $data['venue_title'] ) ) {
898
+		if (empty($data['venue_title'])) {
899 899
 			return false;
900 900
 		}
901 901
 
902 902
 		$venue_array = array(
903 903
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
904
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
905
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
906
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
907
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
908
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
909
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
910
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
911
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
912
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
913
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
914
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
915
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
916
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
917
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
919
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
904
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
905
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
906
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
907
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
908
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
909
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
910
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
911
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
912
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
913
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
914
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
915
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
916
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
917
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
919
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
920 920
 				'status' => 'publish'
921 921
 			);
922 922
 
923 923
 
924 924
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
925
-		if ( !empty( $venue_id ) ) {
926
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
927
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
925
+		if ( ! empty($venue_id)) {
926
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
927
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
928 928
 			//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.
929
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
929
+			$evtobj->_add_relation_to($venue_id, 'Venue');
930 930
 			return $rows_affected > 0 ? TRUE : FALSE;
931 931
 		} else {
932 932
 			//we insert the venue
933
-			$venue_id = $venue_model->insert( $venue_array );
934
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
935
-			return !empty( $venue_id ) ? TRUE : FALSE;
933
+			$venue_id = $venue_model->insert($venue_array);
934
+			$evtobj->_add_relation_to($venue_id, 'Venue');
935
+			return ! empty($venue_id) ? TRUE : FALSE;
936 936
 		}
937 937
 		//when we have the ancestor come in it's already been handled by the revision save.
938 938
 	}
@@ -946,54 +946,54 @@  discard block
 block discarded – undo
946 946
 	 * @param  array    $data   The request data from the form
947 947
 	 * @return bool             success or fail
948 948
 	 */
949
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
949
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
950 950
 		$success = true;
951 951
 		$saved_dtt = null;
952 952
 		$saved_tickets = array();
953
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
953
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
954 954
 
955
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
955
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
956 956
 			//trim all values to ensure any excess whitespace is removed.
957
-			$dtt =  array_map( 'trim', $dtt );
958
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
957
+			$dtt = array_map('trim', $dtt);
958
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959 959
 			$datetime_values = array(
960
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
960
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
961 961
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
962 962
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
963
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
963
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
964 964
 				'DTT_order' 	=> $row,
965 965
 			);
966 966
 
967 967
 			//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.
968 968
 
969
-			if ( !empty( $dtt['DTT_ID'] ) ) {
970
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				foreach ( $datetime_values as $field => $value ) {
974
-					$DTM->set( $field, $value );
969
+			if ( ! empty($dtt['DTT_ID'])) {
970
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				foreach ($datetime_values as $field => $value) {
974
+					$DTM->set($field, $value);
975 975
 				}
976 976
 
977 977
 				//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.
978 978
 				$saved_dtts[$DTM->ID()] = $DTM;
979 979
 			} else {
980
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
981
-				$DTM->set_date_format( $incoming_date_formats[0] );
982
-				$DTM->set_time_format( $incoming_date_formats[1] );
983
-				$DTM->set_timezone( $evtobj->get_timezone() );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
981
+				$DTM->set_date_format($incoming_date_formats[0]);
982
+				$DTM->set_time_format($incoming_date_formats[1]);
983
+				$DTM->set_timezone($evtobj->get_timezone());
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 			}
988 988
 			$DTM->save();
989 989
 
990
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
990
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
991 991
 
992 992
 			//load DTT helper
993 993
 
994 994
 			//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.
995
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
995
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
996
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
997 997
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998 998
 				$DTT->save();
999 999
 			}
@@ -1001,45 +1001,45 @@  discard block
 block discarded – undo
1001 1001
 			//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.
1002 1002
 			$saved_dtt = $DTT;
1003 1003
 
1004
-			$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.
1004
+			$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.
1005 1005
 		}
1006 1006
 
1007 1007
 		//no dtts get deleted so we don't do any of that logic here.
1008 1008
 		//update tickets next
1009
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1010
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1011
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1009
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1010
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1011
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1012 1012
 			$update_prices = false;
1013
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1013
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1014 1014
 
1015 1015
 			// trim inputs to ensure any excess whitespace is removed.
1016
-			$tkt = array_map( 'trim', $tkt );
1016
+			$tkt = array_map('trim', $tkt);
1017 1017
 
1018
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1018
+			if (empty($tkt['TKT_start_date'])) {
1019 1019
 				//let's use now in the set timezone.
1020
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1021
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1020
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1021
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1022 1022
 			}
1023 1023
 
1024
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1024
+			if (empty($tkt['TKT_end_date'])) {
1025 1025
 				//use the start date of the first datetime
1026 1026
 				$dtt = $evtobj->first_datetime();
1027
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1027
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1028 1028
 			}
1029 1029
 
1030 1030
 			$TKT_values = array(
1031
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1032
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1033
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1034
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1031
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1032
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1033
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1034
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1035 1035
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1036 1036
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1037
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1038
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1039
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1040
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1037
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1038
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1039
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1040
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1041 1041
 				'TKT_row' 			=> $row,
1042
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1042
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1043 1043
 				'TKT_price' 		=> $ticket_price
1044 1044
 			);
1045 1045
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 
1049 1049
 			//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.
1050
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1050
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1051 1051
 				$TKT_values['TKT_ID'] = 0;
1052 1052
 				$TKT_values['TKT_is_default'] = 0;
1053 1053
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1058,58 +1058,58 @@  discard block
 block discarded – undo
1058 1058
 			//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.
1059 1059
 			//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.
1060 1060
 
1061
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1062
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1063
-				if ( $TKT instanceof EE_Ticket ) {
1064
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1061
+			if ( ! empty($tkt['TKT_ID'])) {
1062
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1063
+				if ($TKT instanceof EE_Ticket) {
1064
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1065 1065
 					//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.
1066
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1067
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1068
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1066
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1067
+					$TKT->set_date_format($incoming_date_formats[0]);
1068
+					$TKT->set_time_format($incoming_date_formats[1]);
1069 1069
 					//set new values
1070
-					foreach ( $TKT_values as $field => $value ) {
1071
-						if ( $field == 'TKT_qty' ) {
1072
-							$TKT->set_qty( $value );
1070
+					foreach ($TKT_values as $field => $value) {
1071
+						if ($field == 'TKT_qty') {
1072
+							$TKT->set_qty($value);
1073 1073
 						} else {
1074
-							$TKT->set( $field, $value );
1074
+							$TKT->set($field, $value);
1075 1075
 						}
1076 1076
 					}
1077 1077
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1078
-					if ( $create_new_TKT ) {
1078
+					if ($create_new_TKT) {
1079 1079
 						//archive the old ticket first
1080
-						$TKT->set( 'TKT_deleted', 1 );
1080
+						$TKT->set('TKT_deleted', 1);
1081 1081
 						$TKT->save();
1082 1082
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1083
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1083
+						$saved_tickets[$TKT->ID()] = $TKT;
1084 1084
 						//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.
1085 1085
 						$TKT = clone $TKT;
1086
-						$TKT->set( 'TKT_ID', 0 );
1087
-						$TKT->set( 'TKT_deleted', 0 );
1088
-						$TKT->set( 'TKT_price', $ticket_price );
1089
-						$TKT->set( 'TKT_sold', 0 );
1086
+						$TKT->set('TKT_ID', 0);
1087
+						$TKT->set('TKT_deleted', 0);
1088
+						$TKT->set('TKT_price', $ticket_price);
1089
+						$TKT->set('TKT_sold', 0);
1090 1090
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1091 1091
 						$update_prices = true;
1092 1092
 					}
1093 1093
 					//make sure price is set if it hasn't been already
1094
-					$TKT->set( 'TKT_price', $ticket_price );
1094
+					$TKT->set('TKT_price', $ticket_price);
1095 1095
 				}
1096 1096
 
1097 1097
 			} else {
1098 1098
 				//no TKT_id so a new TKT
1099 1099
 				$TKT_values['TKT_price'] = $ticket_price;
1100
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1101
-				if ( $TKT instanceof EE_Ticket ) {
1100
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1101
+				if ($TKT instanceof EE_Ticket) {
1102 1102
 					//need to reset values to properly account for the date formats
1103
-					$TKT->set_date_format( $incoming_date_formats[0] );
1104
-					$TKT->set_time_format( $incoming_date_formats[1] );
1105
-					$TKT->set_timezone( $evtobj->get_timezone() );
1103
+					$TKT->set_date_format($incoming_date_formats[0]);
1104
+					$TKT->set_time_format($incoming_date_formats[1]);
1105
+					$TKT->set_timezone($evtobj->get_timezone());
1106 1106
 
1107 1107
 					//set new values
1108
-					foreach ( $TKT_values as $field => $value ) {
1109
-						if ( $field == 'TKT_qty' ) {
1110
-							$TKT->set_qty( $value );
1108
+					foreach ($TKT_values as $field => $value) {
1109
+						if ($field == 'TKT_qty') {
1110
+							$TKT->set_qty($value);
1111 1111
 						} else {
1112
-							$TKT->set( $field, $value );
1112
+							$TKT->set($field, $value);
1113 1113
 						}
1114 1114
 					}
1115 1115
 
@@ -1117,31 +1117,31 @@  discard block
 block discarded – undo
1117 1117
 				}
1118 1118
 			}
1119 1119
 			// cap ticket qty by datetime reg limits
1120
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1120
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1121 1121
 			//update ticket.
1122 1122
 			$TKT->save();
1123 1123
 
1124 1124
 			//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.
1125
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1125
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1126
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1127 1127
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128 1128
 				$TKT->save();
1129 1129
 			}
1130 1130
 
1131 1131
 			//initially let's add the ticket to the dtt
1132
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1132
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1133 1133
 
1134 1134
 			$saved_tickets[$TKT->ID()] = $TKT;
1135 1135
 
1136 1136
 			//add prices to ticket
1137
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1137
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1138 1138
 		}
1139 1139
 		//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.
1140
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1140
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1142 1142
 
1143
-		foreach ( $tickets_removed as $id ) {
1144
-			$id = absint( $id );
1143
+		foreach ($tickets_removed as $id) {
1144
+			$id = absint($id);
1145 1145
 
1146 1146
 			//get the ticket for this id
1147 1147
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			//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)
1150 1150
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1151 1151
 
1152
-			foreach( $dtts as $dtt ) {
1152
+			foreach ($dtts as $dtt) {
1153 1153
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1154 1154
 			}
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1161 1161
 			$tkt_to_remove->delete_permanently();
1162 1162
 		}
1163
-		return array( $saved_dtt, $saved_tickets );
1163
+		return array($saved_dtt, $saved_tickets);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1175,31 +1175,31 @@  discard block
 block discarded – undo
1175 1175
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1176 1176
 	 * @return  void
1177 1177
 	 */
1178
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1179
-		foreach ( $prices as $row => $prc ) {
1178
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1179
+		foreach ($prices as $row => $prc) {
1180 1180
 			$PRC_values = array(
1181
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1182
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1183
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1184
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1185
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1181
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1182
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1183
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1184
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1185
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1186 1186
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1187 1187
 				'PRC_order' => $row
1188 1188
 			);
1189 1189
 
1190
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1190
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1191 1191
 				$PRC_values['PRC_ID'] = 0;
1192
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1192
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1193 1193
 			} else {
1194
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1194
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1195 1195
 				//update this price with new values
1196
-				foreach ( $PRC_values as $field => $newprc ) {
1197
-					$PRC->set( $field, $newprc );
1196
+				foreach ($PRC_values as $field => $newprc) {
1197
+					$PRC->set($field, $newprc);
1198 1198
 				}
1199 1199
 				$PRC->save();
1200 1200
 			}
1201 1201
 
1202
-			$ticket->_add_relation_to( $PRC, 'Price' );
1202
+			$ticket->_add_relation_to($PRC, 'Price');
1203 1203
 		}
1204 1204
 	}
1205 1205
 
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 		//load formatter helper
1238 1238
 
1239 1239
   		//args for getting related registrations
1240
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1241
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1242
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1240
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1241
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1242
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1243 1243
 
1244 1244
 
1245 1245
 		// publish box
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
 				),
1269 1269
 				REG_ADMIN_URL
1270 1270
 			),
1271
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1272
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1273
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1271
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1272
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1273
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1274 1274
 			'misc_pub_section_class' => apply_filters(
1275 1275
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1276 1276
 				'misc-pub-section'
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1290 1290
 			$this->_cpt_model_obj
1291 1291
 		);
1292
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1292
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1293 1293
 		// load template
1294
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1294
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1295 1295
 	}
1296 1296
 
1297 1297
 
@@ -1323,16 +1323,16 @@  discard block
 block discarded – undo
1323 1323
 		$this->verify_cpt_object();
1324 1324
 		add_meta_box(
1325 1325
 			'espresso_event_editor_tickets',
1326
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1327
-			array( $this, 'ticket_metabox' ),
1326
+			__('Event Datetime & Ticket', 'event_espresso'),
1327
+			array($this, 'ticket_metabox'),
1328 1328
 			$this->page_slug,
1329 1329
 			'normal',
1330 1330
 			'high'
1331 1331
 		);
1332 1332
 		add_meta_box(
1333 1333
 			'espresso_event_editor_event_options',
1334
-			__( 'Event Registration Options', 'event_espresso' ),
1335
-			array( $this, 'registration_options_meta_box' ),
1334
+			__('Event Registration Options', 'event_espresso'),
1335
+			array($this, 'registration_options_meta_box'),
1336 1336
 			$this->page_slug,
1337 1337
 			'side',
1338 1338
 			'default'
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
 			'disabled' => ''
1363 1363
 			);
1364 1364
 
1365
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1365
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1366 1366
 
1367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * 1. Start with retrieving Datetimes
1371 1371
 		 * 2. Fore each datetime get related tickets
1372 1372
 		 * 3. For each ticket get related prices
1373 1373
 		 */
1374
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1374
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1375 1375
 		/** @type EE_Datetime $first_datetime */
1376
-		$first_datetime = reset( $times );
1376
+		$first_datetime = reset($times);
1377 1377
 		//do we get related tickets?
1378
-		if ( $first_datetime instanceof EE_Datetime
1379
-			&& $first_datetime->ID() !== 0 ) {
1378
+		if ($first_datetime instanceof EE_Datetime
1379
+			&& $first_datetime->ID() !== 0) {
1380 1380
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1381 1381
 			$template_args['time'] = $first_datetime;
1382 1382
 			$related_tickets = $first_datetime->tickets(
1383 1383
 				array(
1384
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1384
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1385 1385
 					'default_where_conditions' => 'none'
1386 1386
 				)
1387 1387
 			);
1388 1388
 
1389
-			if ( !empty($related_tickets) ) {
1389
+			if ( ! empty($related_tickets)) {
1390 1390
 				$template_args['total_ticket_rows'] = count($related_tickets);
1391 1391
 				$row = 0;
1392
-				foreach ( $related_tickets as $ticket ) {
1392
+				foreach ($related_tickets as $ticket) {
1393 1393
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1394
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1394
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1395 1395
 
1396 1396
 					$row++;
1397 1397
 				}
@@ -1399,13 +1399,13 @@  discard block
 block discarded – undo
1399 1399
 				$template_args['total_ticket_rows'] = 1;
1400 1400
 				/** @type EE_Ticket $ticket */
1401 1401
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1402
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1402
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1403 1403
 			}
1404 1404
 		} else {
1405 1405
 			$template_args['time'] = $times[0];
1406 1406
 			/** @type EE_Ticket $ticket */
1407 1407
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1408
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1408
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1409 1409
 			// NOTE: we're just sending the first default row
1410 1410
 			// (decaf can't manage default tickets so this should be sufficient);
1411 1411
 		}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1415 1415
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1416 1416
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1417
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1418
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1417
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1418
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1419 1419
 		EEH_Template::display_template($template, $template_args);
1420 1420
 	}
1421 1421
 
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
 	 * @param int        $row
1431 1431
 	 * @return string generated html for the ticket row.
1432 1432
 	 */
1433
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1433
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1434 1434
 		$template_args = array(
1435
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1436
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1435
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1436
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1437 1437
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1438 1438
 			'TKT_ID' => $ticket->get('TKT_ID'),
1439 1439
 			'TKT_name' => $ticket->get('TKT_name'),
1440 1440
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1441 1441
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1442 1442
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1443
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1443
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1444 1444
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1445 1445
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1446
-			'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',
1447
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1446
+			'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',
1447
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1448 1448
 			);
1449 1449
 
1450 1450
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 		//make sure we have default start and end dates if skeleton
1462 1462
 		//handle rows that should NOT be empty
1463
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1463
+		if (empty($template_args['TKT_start_date'])) {
1464 1464
 			//if empty then the start date will be now.
1465 1465
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1466 1466
 		}
1467 1467
 
1468
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1468
+		if (empty($template_args['TKT_end_date'])) {
1469 1469
 			//get the earliest datetime (if present);
1470
-			$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;
1470
+			$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;
1471 1471
 
1472
-			if ( !empty( $earliest_dtt ) )
1472
+			if ( ! empty($earliest_dtt))
1473 1473
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1474 1474
 			else
1475
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1475
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1476 1476
 		}
1477 1477
 
1478
-		$template_args = array_merge( $template_args, $price_args );
1479
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1478
+		$template_args = array_merge($template_args, $price_args);
1479
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1480 1480
 		return EEH_Template::display_template($template, $template_args, TRUE);
1481 1481
 	}
1482 1482
 
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1506 1506
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1507 1507
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1508
-		$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 );
1509
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1508
+		$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);
1509
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1510 1510
 		EEH_Template::display_template($templatepath, $template_args);
1511 1511
 	}
1512 1512
 
@@ -1534,21 +1534,21 @@  discard block
 block discarded – undo
1534 1534
 		$EEME = $this->_event_model();
1535 1535
 
1536 1536
 		$offset = ($current_page - 1) * $per_page;
1537
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1537
+		$limit = $count ? NULL : $offset.','.$per_page;
1538 1538
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1539 1539
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1540 1540
 
1541 1541
 		if (isset($this->_req_data['month_range'])) {
1542 1542
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1543
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1543
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1545 1545
 		}
1546 1546
 
1547 1547
 		$where = array();
1548 1548
 
1549
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1549
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1550 1550
 		//determine what post_status our condition will have for the query.
1551
-		switch ( $status ) {
1551
+		switch ($status) {
1552 1552
 			case 'month' :
1553 1553
 			case 'today' :
1554 1554
 			case NULL :
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 				break;
1557 1557
 
1558 1558
 			case 'draft' :
1559
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1559
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1560 1560
 				break;
1561 1561
 
1562 1562
 			default :
@@ -1564,43 +1564,43 @@  discard block
 block discarded – undo
1564 1564
 		}
1565 1565
 
1566 1566
 		//categories?
1567
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1567
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568 1568
 
1569
-		if ( !empty ( $category ) ) {
1569
+		if ( ! empty ($category)) {
1570 1570
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1571 1571
 			$where['Term_Taxonomy.term_id'] = $category;
1572 1572
 		}
1573 1573
 
1574 1574
 		//date where conditions
1575
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1575
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1576 1576
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1577
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1578
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1579
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1580
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1577
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1578
+			$start = $DateTime->format(implode(' ', $start_formats));
1579
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1580
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1581 1581
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1582
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1583
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1584
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1586
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1587
-			$now = date( 'Y-m-01' );
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->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1583
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1587
+			$now = date('Y-m-01');
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->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592 1592
 		}
1593 1593
 
1594 1594
 
1595
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1596
-			$where['EVT_wp_user'] =  get_current_user_id();
1595
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1596
+			$where['EVT_wp_user'] = get_current_user_id();
1597 1597
 		} else {
1598
-			if ( ! isset( $where['status'] ) ) {
1599
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1598
+			if ( ! isset($where['status'])) {
1599
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1600 1600
 					$where['OR'] = array(
1601
-						'status*restrict_private' => array( '!=', 'private' ),
1601
+						'status*restrict_private' => array('!=', 'private'),
1602 1602
 						'AND' => array(
1603
-							'status*inclusive' => array( '=', 'private' ),
1603
+							'status*inclusive' => array('=', 'private'),
1604 1604
 							'EVT_wp_user' => get_current_user_id()
1605 1605
 						)
1606 1606
 					);
@@ -1608,16 +1608,16 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 		}
1610 1610
 
1611
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1612
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
+		if (isset($this->_req_data['EVT_wp_user'])) {
1612
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1613 1613
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617 1617
 
1618 1618
 		//search query handling
1619
-		if ( isset( $this->_req_data['s'] ) ) {
1620
-			$search_string = '%' . $this->_req_data['s'] . '%';
1619
+		if (isset($this->_req_data['s'])) {
1620
+			$search_string = '%'.$this->_req_data['s'].'%';
1621 1621
 			$where['OR'] = array(
1622 1622
 				'EVT_name' => array('LIKE', $search_string),
1623 1623
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1626,32 +1626,32 @@  discard block
 block discarded – undo
1626 1626
 		}
1627 1627
 
1628 1628
 
1629
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1630
-		$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 );
1629
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1630
+		$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);
1631 1631
 
1632 1632
 
1633 1633
 		//let's first check if we have special requests coming in.
1634
-		if ( isset( $this->_req_data['active_status'] ) ) {
1635
-			switch ( $this->_req_data['active_status'] ) {
1634
+		if (isset($this->_req_data['active_status'])) {
1635
+			switch ($this->_req_data['active_status']) {
1636 1636
 				case 'upcoming' :
1637
-					return $EEME->get_upcoming_events( $query_params, $count );
1637
+					return $EEME->get_upcoming_events($query_params, $count);
1638 1638
 					break;
1639 1639
 
1640 1640
 				case 'expired' :
1641
-					return $EEME->get_expired_events( $query_params, $count );
1641
+					return $EEME->get_expired_events($query_params, $count);
1642 1642
 					break;
1643 1643
 
1644 1644
 				case 'active' :
1645
-					return $EEME->get_active_events( $query_params, $count );
1645
+					return $EEME->get_active_events($query_params, $count);
1646 1646
 					break;
1647 1647
 
1648 1648
 				case 'inactive' :
1649
-					return $EEME->get_inactive_events( $query_params, $count );
1649
+					return $EEME->get_inactive_events($query_params, $count);
1650 1650
 					break;
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1654
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1655 1655
 
1656 1656
 		return $events;
1657 1657
 	}
@@ -1660,23 +1660,23 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 
1662 1662
 	//handling for WordPress CPT actions (trash, restore, delete)
1663
-	public function trash_cpt_item( $post_id ) {
1663
+	public function trash_cpt_item($post_id) {
1664 1664
 		$this->_req_data['EVT_ID'] = $post_id;
1665
-		$this->_trash_or_restore_event( 'trash', FALSE );
1665
+		$this->_trash_or_restore_event('trash', FALSE);
1666 1666
 	}
1667 1667
 
1668 1668
 
1669 1669
 
1670 1670
 
1671
-	public function restore_cpt_item( $post_id ) {
1671
+	public function restore_cpt_item($post_id) {
1672 1672
 		$this->_req_data['EVT_ID'] = $post_id;
1673
-		$this->_trash_or_restore_event( 'draft', FALSE );
1673
+		$this->_trash_or_restore_event('draft', FALSE);
1674 1674
 	}
1675 1675
 
1676 1676
 
1677
-	public function delete_cpt_item( $post_id ) {
1677
+	public function delete_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_delete_event( FALSE );
1679
+		$this->_delete_event(FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 	 * @param  string $event_status
1689 1689
 	 * @return void
1690 1690
 	 */
1691
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1691
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1692 1692
 		//determine the event id and set to array.
1693 1693
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1694 1694
 		// loop thru events
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			// clean status
1697 1697
 			$event_status = sanitize_key($event_status);
1698 1698
 			// grab status
1699
-			if (!empty($event_status)) {
1699
+			if ( ! empty($event_status)) {
1700 1700
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1701 1701
 			} else {
1702 1702
 				$success = FALSE;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1712 1712
 
1713
-		if ( $redirect_after )
1713
+		if ($redirect_after)
1714 1714
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1715 1715
 	}
1716 1716
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		// clean status
1726 1726
 		$event_status = sanitize_key($event_status);
1727 1727
 		// grab status
1728
-		if (!empty($event_status)) {
1728
+		if ( ! empty($event_status)) {
1729 1729
 			$success = TRUE;
1730 1730
 			//determine the event id and set to array.
1731 1731
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 	 * @param  string $event_status
1761 1761
 	 * @return bool
1762 1762
 	 */
1763
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1763
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1764 1764
 		// grab event id
1765
-		if (!$EVT_ID) {
1765
+		if ( ! $EVT_ID) {
1766 1766
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1767 1767
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1768 1768
 			return FALSE;
1769 1769
 		}
1770 1770
 
1771
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1771
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1772 1772
 
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 				$hook = FALSE;
1795 1795
 		}
1796 1796
 		//use class to change status
1797
-		$this->_cpt_model_obj->set_status( $event_status );
1797
+		$this->_cpt_model_obj->set_status($event_status);
1798 1798
 		$success = $this->_cpt_model_obj->save();
1799 1799
 
1800 1800
 		if ($success === FALSE) {
@@ -1816,15 +1816,15 @@  discard block
 block discarded – undo
1816 1816
 	 * @access protected
1817 1817
 	 * @param bool $redirect_after
1818 1818
 	 */
1819
-	protected function _delete_event( $redirect_after = TRUE ) {
1819
+	protected function _delete_event($redirect_after = TRUE) {
1820 1820
 		//determine the event id and set to array.
1821 1821
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1822
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1822
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1823 1823
 
1824 1824
 
1825 1825
 		// loop thru events
1826 1826
 		if ($EVT_ID) {
1827
-			$success = $this->_permanently_delete_event( $EVT_ID );
1827
+			$success = $this->_permanently_delete_event($EVT_ID);
1828 1828
 			// get list of events with no prices
1829 1829
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1830 1830
 			// remove this event from the list of events with no prices
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 		}
1840 1840
 
1841
-		if ( $redirect_after )
1841
+		if ($redirect_after)
1842 1842
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1843 1843
 	}
1844 1844
 
@@ -1856,12 +1856,12 @@  discard block
 block discarded – undo
1856 1856
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1857 1857
 		// loop thru events
1858 1858
 		foreach ($EVT_IDs as $EVT_ID) {
1859
-			$EVT_ID = absint( $EVT_ID );
1860
-			if ( $EVT_ID ) {
1861
-				$results = $this->_permanently_delete_event( $EVT_ID );
1859
+			$EVT_ID = absint($EVT_ID);
1860
+			if ($EVT_ID) {
1861
+				$results = $this->_permanently_delete_event($EVT_ID);
1862 1862
 				$success = $results !== FALSE ? $success : FALSE;
1863 1863
 				// remove this event from the list of events with no prices
1864
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1864
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1865 1865
 			} else {
1866 1866
 				$success = FALSE;
1867 1867
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1881,9 +1881,9 @@  discard block
 block discarded – undo
1881 1881
 	 * @param  int $EVT_ID
1882 1882
 	 * @return bool
1883 1883
 	 */
1884
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1884
+	private function _permanently_delete_event($EVT_ID = 0) {
1885 1885
 		// grab event id
1886
-		if ( ! $EVT_ID ) {
1886
+		if ( ! $EVT_ID) {
1887 1887
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1892,19 +1892,19 @@  discard block
 block discarded – undo
1892 1892
 			! $this->_cpt_model_obj instanceof EE_Event
1893 1893
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1894 1894
 		) {
1895
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1895
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1896 1896
 		}
1897 1897
 
1898
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
1898
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
1899 1899
 			return false;
1900 1900
 		}
1901 1901
 
1902 1902
 		//need to delete related tickets and prices first.
1903 1903
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1904
-		foreach ( $datetimes as $datetime ) {
1904
+		foreach ($datetimes as $datetime) {
1905 1905
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1906 1906
 			$tickets = $datetime->get_many_related('Ticket');
1907
-			foreach ( $tickets as $ticket ) {
1907
+			foreach ($tickets as $ticket) {
1908 1908
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1909 1909
 				$ticket->delete_related_permanently('Price');
1910 1910
 				$ticket->delete_permanently();
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
 		//what about related venues or terms?
1916 1916
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1917
-		foreach ( $venues as $venue ) {
1917
+		foreach ($venues as $venue) {
1918 1918
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1919 1919
 		}
1920 1920
 
1921 1921
 		//any attached question groups?
1922 1922
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1923
-		if ( !empty( $question_groups ) ) {
1924
-			foreach ( $question_groups as $question_group ) {
1923
+		if ( ! empty($question_groups)) {
1924
+			foreach ($question_groups as $question_group) {
1925 1925
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1926 1926
 			}
1927 1927
 		}
@@ -1930,12 +1930,12 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 
1932 1932
 		//Message Template Groups
1933
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1933
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1934 1934
 
1935 1935
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1936 1936
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1937 1937
 
1938
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1938
+		foreach ($term_taxonomies as $term_taxonomy) {
1939 1939
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1940 1940
 		}
1941 1941
 
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1950 1950
 			return FALSE;
1951 1951
 		}
1952
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1952
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1953 1953
 		return TRUE;
1954 1954
 	}
1955 1955
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	public function total_events() {
1968 1968
 
1969
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1969
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1970 1970
 		return $count;
1971 1971
 	}
1972 1972
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events_draft() {
1983 1983
 		$where = array(
1984
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1984
+			'status' => array('IN', array('draft', 'auto-draft'))
1985 1985
 			);
1986 1986
 
1987
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1987
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1988 1988
 		return $count;
1989 1989
 	}
1990 1990
 
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 			'status' => 'trash'
2004 2004
 			);
2005 2005
 
2006
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2006
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2007 2007
 		return $count;
2008 2008
 	}
2009 2009
 
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 			// translated
2032 2032
 			TRUE
2033 2033
 		);
2034
-		$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;
2034
+		$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;
2035 2035
 
2036 2036
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2037 2037
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2038
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2038
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2039 2039
 		$this->display_admin_page_with_sidebar();
2040 2040
 	}
2041 2041
 
@@ -2061,9 +2061,9 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	protected function _template_settings() {
2063 2063
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2064
-		$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' ) . '" />';
2065
-		$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>';
2066
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2064
+		$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').'" />';
2065
+		$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>';
2066
+		$this->display_admin_caf_preview_page('template_settings_tab');
2067 2067
 	}
2068 2068
 
2069 2069
 
@@ -2076,22 +2076,22 @@  discard block
 block discarded – undo
2076 2076
 	 * @return void
2077 2077
 	 */
2078 2078
 	private function _set_category_object() {
2079
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2079
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2080 2080
 			return; //already have the category object so get out.
2081 2081
 
2082 2082
 		//set default category object
2083 2083
 		$this->_set_empty_category_object();
2084 2084
 
2085 2085
 		//only set if we've got an id
2086
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2086
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2087 2087
 			return;
2088 2088
 		}
2089 2089
 
2090 2090
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2091 2091
 
2092
-		$term = get_term( $category_id, 'espresso_event_categories' );
2092
+		$term = get_term($category_id, 'espresso_event_categories');
2093 2093
 
2094
-		if ( !empty( $term ) ) {
2094
+		if ( ! empty($term)) {
2095 2095
 			$this->_category->category_name = $term->name;
2096 2096
 			$this->_category->category_identifier = $term->slug;
2097 2097
 			$this->_category->category_desc = $term->description;
@@ -2105,13 +2105,13 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 	private function _set_empty_category_object() {
2107 2107
 		$this->_category = new stdClass();
2108
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2108
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2109 2109
 		$this->_category->id = $this->_category->parent = 0;
2110 2110
 	}
2111 2111
 
2112 2112
 
2113 2113
 	protected function _category_list_table() {
2114
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2114
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2115 2115
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2116 2116
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2117 2117
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,14 +2127,14 @@  discard block
 block discarded – undo
2127 2127
 		$this->_set_add_edit_form_tags($route);
2128 2128
 
2129 2129
 		$this->_set_category_object();
2130
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2130
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2131 2131
 
2132 2132
 		$delete_action = 'delete_category';
2133 2133
 
2134 2134
 		//custom redirect
2135
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2135
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2136 2136
 
2137
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2137
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2138 2138
 
2139 2139
 		//take care of contents
2140 2140
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2148,25 +2148,25 @@  discard block
 block discarded – undo
2148 2148
 			'type' => 'wp_editor',
2149 2149
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2150 2150
 			'class' => 'my_editor_custom',
2151
-			'wpeditor_args' => array('media_buttons' => FALSE )
2151
+			'wpeditor_args' => array('media_buttons' => FALSE)
2152 2152
 		);
2153
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2153
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2154 2154
 
2155
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2155
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2156 2156
 
2157 2157
 		//setup category select for term parents.
2158 2158
 		$category_select_values[] = array(
2159 2159
 			'text' => __('No Parent', 'event_espresso'),
2160 2160
 			'id' => 0
2161 2161
 			);
2162
-		foreach ( $all_terms as $term ) {
2162
+		foreach ($all_terms as $term) {
2163 2163
 			$category_select_values[] = array(
2164 2164
 				'text' => $term->name,
2165 2165
 				'id' => $term->term_id
2166 2166
 				);
2167 2167
 		}
2168 2168
 
2169
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2169
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2170 2170
 
2171 2171
 		$template_args = array(
2172 2172
 			'category' => $this->_category,
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
 			'disable' => '',
2177 2177
 			'disabled_message' => FALSE
2178 2178
 			);
2179
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2180
-		return EEH_Template::display_template($template, $template_args, TRUE );
2179
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2180
+		return EEH_Template::display_template($template, $template_args, TRUE);
2181 2181
 	}
2182 2182
 
2183 2183
 
2184 2184
 	protected function _delete_categories() {
2185
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2185
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2186 2186
 
2187
-		foreach ( $cat_ids as $cat_id ) {
2187
+		foreach ($cat_ids as $cat_id) {
2188 2188
 			$this->_delete_category($cat_id);
2189 2189
 		}
2190 2190
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$query_args = array(
2193 2193
 			'action' => 'category_list'
2194 2194
 			);
2195
-		$this->_redirect_after_action(0,'','',$query_args);
2195
+		$this->_redirect_after_action(0, '', '', $query_args);
2196 2196
 
2197 2197
 	}
2198 2198
 
@@ -2202,61 +2202,61 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	protected function _delete_category($cat_id) {
2204 2204
 		global $wpdb;
2205
-		$cat_id = absint( $cat_id );
2206
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2205
+		$cat_id = absint($cat_id);
2206
+		wp_delete_term($cat_id, 'espresso_event_categories');
2207 2207
 	}
2208 2208
 
2209 2209
 
2210 2210
 
2211 2211
 	protected function _insert_or_update_category($new_category) {
2212 2212
 
2213
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2213
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2214 2214
 		$success = 0; //we already have a success message so lets not send another.
2215 2215
 
2216
-		if ( $cat_id ) {
2216
+		if ($cat_id) {
2217 2217
 			$query_args = array(
2218 2218
 				'action'     => 'edit_category',
2219 2219
 				'EVT_CAT_ID' => $cat_id
2220 2220
 			);
2221 2221
 		} else {
2222
-			$query_args = array( 'action' => 'add_category' );
2222
+			$query_args = array('action' => 'add_category');
2223 2223
 		}
2224
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2224
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2225 2225
 
2226 2226
 	}
2227 2227
 
2228 2228
 
2229 2229
 
2230
-	private function _insert_category( $update = FALSE ) {
2230
+	private function _insert_category($update = FALSE) {
2231 2231
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2232
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2233
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2234
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2232
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2233
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2234
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2235 2235
 
2236
-		if ( empty( $category_name ) ) {
2237
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2236
+		if (empty($category_name)) {
2237
+			$msg = __('You must add a name for the category.', 'event_espresso');
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239 2239
 			return false;
2240 2240
 		}
2241 2241
 
2242
-		$term_args=array(
2242
+		$term_args = array(
2243 2243
 			'name'=>$category_name,
2244 2244
 			'description'=>$category_desc,
2245 2245
 			'parent'=>$category_parent
2246 2246
 		);
2247 2247
 		//was the category_identifier input disabled?
2248
-		if(isset($this->_req_data['category_identifier'])){
2248
+		if (isset($this->_req_data['category_identifier'])) {
2249 2249
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2250 2250
 		}
2251
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2251
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2252 2252
 
2253
-		if ( !is_array( $insert_ids ) ) {
2254
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if ( ! is_array($insert_ids)) {
2254
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 		} else {
2257 2257
 			$cat_id = $insert_ids['term_id'];
2258
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2259
+			EE_Error::add_success($msg);
2260 2260
 		}
2261 2261
 
2262 2262
 		return $cat_id;
@@ -2265,32 +2265,32 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
 
2267 2267
 
2268
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2268
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2269 2269
 		global $wpdb;
2270 2270
 
2271 2271
 		//testing term stuff
2272
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2274
-		$limit = ($current_page-1)*$per_page;
2272
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2274
+		$limit = ($current_page - 1) * $per_page;
2275 2275
 
2276
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2276
+		$where = array('taxonomy' => 'espresso_event_categories');
2277 2277
 
2278
-		if ( isset( $this->_req_data['s'] ) ) {
2279
-			$sstr = '%' . $this->_req_data['s'] . '%';
2278
+		if (isset($this->_req_data['s'])) {
2279
+			$sstr = '%'.$this->_req_data['s'].'%';
2280 2280
 			$where['OR'] = array(
2281
-				'Term.name' => array( 'LIKE', $sstr),
2282
-				'description' => array( 'LIKE', $sstr )
2281
+				'Term.name' => array('LIKE', $sstr),
2282
+				'description' => array('LIKE', $sstr)
2283 2283
 				);
2284 2284
 		}
2285 2285
 
2286 2286
 		$query_params = array(
2287
-			$where ,
2288
-			'order_by' => array( $orderby => $order ),
2289
-			'limit' => $limit . ',' . $per_page,
2287
+			$where,
2288
+			'order_by' => array($orderby => $order),
2289
+			'limit' => $limit.','.$per_page,
2290 2290
 			'force_join' => array('Term')
2291 2291
 			);
2292 2292
 
2293
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2293
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2294 2294
 
2295 2295
 		return $categories;
2296 2296
 	}
Please login to merge, or discard this patch.