Completed
Branch FET-8162-relation-exists (8f4753)
by
unknown
32:32 queued 23:52
created
core/EE_Addon.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	/**
111 111
 	 * Sets addon_name
112 112
 	 * @param string $addon_name
113
-	 * @return boolean
113
+	 * @return string
114 114
 	 */
115 115
 	function set_name( $addon_name ) {
116 116
 		return $this->_addon_name = $addon_name;
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	/**
74 74
 	 * @param mixed $version
75 75
 	 */
76
-	public function set_version( $version = NULL ) {
76
+	public function set_version($version = NULL) {
77 77
 		$this->_version = $version;
78 78
 	}
79 79
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	/**
92 92
 	 * @param mixed $min_core_version
93 93
 	 */
94
-	public function set_min_core_version( $min_core_version = NULL ) {
94
+	public function set_min_core_version($min_core_version = NULL) {
95 95
 		$this->_min_core_version = $min_core_version;
96 96
 	}
97 97
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param string $addon_name
113 113
 	 * @return boolean
114 114
 	 */
115
-	function set_name( $addon_name ) {
115
+	function set_name($addon_name) {
116 116
 		return $this->_addon_name = $addon_name;
117 117
 	}
118 118
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		do_action("AHEE__{$classname}__new_install");
139 139
 		do_action("AHEE__EE_Addon__new_install", $this);
140 140
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
141
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
141
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
142 142
 	}
143 143
 
144 144
 
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 		do_action("AHEE__{$classname}__reactivation");
154 154
 		do_action("AHEE__EE_Addon__reactivation", $this);
155 155
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
156
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
156
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
157 157
 	}
158 158
 
159
-	public function deactivation(){
159
+	public function deactivation() {
160 160
 		$classname = get_class($this);
161 161
 //		echo "Deactivating $classname";die;
162 162
 		do_action("AHEE__{$classname}__deactivation");
163 163
 		do_action("AHEE__EE_Addon__deactivation", $this);
164 164
 		//check if the site no longer needs to be in maintenance mode
165
-		EE_Register_Addon::deregister( $this->name() );
165
+		EE_Register_Addon::deregister($this->name());
166 166
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
167 167
 	}
168 168
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @return void
176 176
 	 */
177 177
 	public function initialize_db_if_no_migrations_required() {
178
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ) {
178
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
179 179
 			$this->initialize_db();
180 180
 			$this->initialize_default_data();
181 181
 			//@todo: this will probably need to be adjusted in 4.4 as the array changed formats I believe
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 */
189 189
 			EE_Registry::instance()->load_helper('Activation');
190 190
 			EEH_Activation::initialize_db_content();
191
-			update_option( 'ee_flush_rewrite_rules', TRUE );
192
-		}else{
191
+			update_option('ee_flush_rewrite_rules', TRUE);
192
+		} else {
193 193
 			//ask the data migration manager to init this addon's data
194 194
 			//when migrations are finished because we can't do it now
195
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( $this->name() );
195
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for($this->name());
196 196
 		}
197 197
 	}
198 198
 
@@ -206,20 +206,20 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function initialize_db() {
208 208
 		//find the migration script that sets the database to be compatible with the code
209
-		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms( $this->name() );
210
-		if( $current_dms_name ){
211
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $current_dms_name );
212
-			$current_data_migration_script->set_migrating( FALSE );
209
+		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms($this->name());
210
+		if ($current_dms_name) {
211
+			$current_data_migration_script = EE_Registry::instance()->load_dms($current_dms_name);
212
+			$current_data_migration_script->set_migrating(FALSE);
213 213
 			$current_data_migration_script->schema_changes_before_migration();
214 214
 			$current_data_migration_script->schema_changes_after_migration();
215
-			if ( $current_data_migration_script->get_errors() ) {
216
-				foreach( $current_data_migration_script->get_errors() as $error ) {
217
-					EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
215
+			if ($current_data_migration_script->get_errors()) {
216
+				foreach ($current_data_migration_script->get_errors() as $error) {
217
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
218 218
 				}
219 219
 			}
220 220
 		}
221 221
 		//if not DMS was found that should be ok. This addon just doesn't require any database changes
222
-		EE_Data_Migration_Manager::instance()->update_current_database_state_to( array( 'slug' => $this->name(), 'version' => $this->version() ) );
222
+		EE_Data_Migration_Manager::instance()->update_current_database_state_to(array('slug' => $this->name(), 'version' => $this->version()));
223 223
 	}
224 224
 
225 225
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * default data)
242 242
 		 * @param EE_Addon $addon the addon that called this
243 243
 		 */
244
-		do_action( 'AHEE__EE_Addon__initialize_default_data__begin', $this );
244
+		do_action('AHEE__EE_Addon__initialize_default_data__begin', $this);
245 245
 		//override to insert default data. It is safe to use the models here
246 246
 		//because the site should not be in maintenance mode
247 247
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		do_action("AHEE__EE_Addon__upgrade", $this);
261 261
 		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
262 262
 		//also it's possible there is new default data that needs to be added
263
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
263
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
264 264
 	}
265 265
 
266 266
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		do_action("AHEE__{$classname}__downgrade");
274 274
 		do_action("AHEE__EE_Addon__downgrade", $this);
275 275
 		//it's possible there's old default data that needs to be double-checked
276
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ) );
276
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
277 277
 	}
278 278
 
279 279
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 * plugin activation only. In the future, we'll want to do it on plugin updates too
285 285
 	 * @return bool
286 286
 	 */
287
-	public function set_db_update_option_name(){
287
+	public function set_db_update_option_name() {
288 288
 		EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Addon::set_db_update_option_name was renamed to EE_Addon::set_activation_indicator_option', 'event_espresso'), '4.3.0.alpha.016');
289 289
 		//let's just handle this on the next request, ok? right now we're just not really ready
290 290
 		return $this->set_activation_indicator_option();
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	public function set_activation_indicator_option() {
314 314
 		// let's just handle this on the next request, ok? right now we're just not really ready
315
-		return update_option( $this->get_activation_indicator_option_name(), TRUE );
315
+		return update_option($this->get_activation_indicator_option_name(), TRUE);
316 316
 	}
317 317
 
318 318
 
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * Gets the name of the wp option which is used to temporarily indicate that this addon was activated
321 321
 	 * @return string
322 322
 	 */
323
-	public function get_activation_indicator_option_name(){
324
-		return 'ee_activation_' . $this->name();
323
+	public function get_activation_indicator_option_name() {
324
+		return 'ee_activation_'.$this->name();
325 325
 	}
326 326
 
327 327
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 * Used by EE_System to set the request type of this addon. Should not be used by addon developers
332 332
 	 * @param int $req_type
333 333
 	 */
334
-	function set_req_type( $req_type ) {
334
+	function set_req_type($req_type) {
335 335
 		$this->_req_type = $req_type;
336 336
 	}
337 337
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * of addons
343 343
 	 */
344 344
 	function detect_req_type() {
345
-		if( ! $this->_req_type ){
345
+		if ( ! $this->_req_type) {
346 346
 			$this->detect_activation_or_upgrade();
347 347
 		}
348 348
 		return $this->_req_type;
@@ -355,36 +355,36 @@  discard block
 block discarded – undo
355 355
 	 * Should only be called once per request
356 356
 	 * @return void
357 357
 	 */
358
-	function detect_activation_or_upgrade(){
358
+	function detect_activation_or_upgrade() {
359 359
 		$activation_history_for_addon = $this->get_activation_history();
360 360
 //		d($activation_history_for_addon);
361 361
 		$request_type = EE_System::detect_req_type_given_activation_history($activation_history_for_addon, $this->get_activation_indicator_option_name(), $this->version());
362 362
 		$this->set_req_type($request_type);
363 363
 		$classname = get_class($this);
364
-		switch($request_type){
364
+		switch ($request_type) {
365 365
 			case EE_System::req_type_new_activation:
366
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__new_activation" );
367
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__new_activation", $this );
366
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__new_activation");
367
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__new_activation", $this);
368 368
 				$this->new_install();
369
-				$this->update_list_of_installed_versions( $activation_history_for_addon );
369
+				$this->update_list_of_installed_versions($activation_history_for_addon);
370 370
 				break;
371 371
 			case EE_System::req_type_reactivation:
372
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__reactivation" );
373
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__reactivation", $this );
372
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__reactivation");
373
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__reactivation", $this);
374 374
 				$this->reactivation();
375
-				$this->update_list_of_installed_versions( $activation_history_for_addon );
375
+				$this->update_list_of_installed_versions($activation_history_for_addon);
376 376
 				break;
377 377
 			case EE_System::req_type_upgrade:
378
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__upgrade" );
379
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__upgrade", $this );
378
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__upgrade");
379
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__upgrade", $this);
380 380
 				$this->upgrade();
381
-				$this->update_list_of_installed_versions($activation_history_for_addon );
381
+				$this->update_list_of_installed_versions($activation_history_for_addon);
382 382
 				break;
383 383
 			case EE_System::req_type_downgrade:
384
-				do_action( "AHEE__{$classname}__detect_activations_or_upgrades__downgrade" );
385
-				do_action( "AHEE__EE_Addon__detect_activations_or_upgrades__downgrade", $this );
384
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__downgrade");
385
+				do_action("AHEE__EE_Addon__detect_activations_or_upgrades__downgrade", $this);
386 386
 				$this->downgrade();
387
-				$this->update_list_of_installed_versions($activation_history_for_addon );
387
+				$this->update_list_of_installed_versions($activation_history_for_addon);
388 388
 				break;
389 389
 			case EE_System::req_type_normal:
390 390
 			default:
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				break;
393 393
 		}
394 394
 
395
-		do_action( "AHEE__{$classname}__detect_if_activation_or_upgrade__complete" );
395
+		do_action("AHEE__{$classname}__detect_if_activation_or_upgrade__complete");
396 396
 	}
397 397
 
398 398
 	/**
@@ -401,17 +401,17 @@  discard block
 block discarded – undo
401 401
 	 * @param string $current_version_to_add
402 402
 	 * @return boolean success
403 403
 	 */
404
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
405
-		if( ! $version_history ) {
404
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
405
+		if ( ! $version_history) {
406 406
 			$version_history = $this->get_activation_history();
407 407
 		}
408
-		if( $current_version_to_add == NULL){
408
+		if ($current_version_to_add == NULL) {
409 409
 			$current_version_to_add = $this->version();
410 410
 		}
411
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
411
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
412 412
 		// resave
413 413
 //		echo "updating list of installed versions:".$this->get_activation_history_option_name();d($version_history);
414
-		return update_option( $this->get_activation_history_option_name(), $version_history );
414
+		return update_option($this->get_activation_history_option_name(), $version_history);
415 415
 	}
416 416
 
417 417
 	/**
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 * of this addon
420 420
 	 * @return string
421 421
 	 */
422
-	function get_activation_history_option_name(){
423
-		return self::ee_addon_version_history_option_prefix . $this->name();
422
+	function get_activation_history_option_name() {
423
+		return self::ee_addon_version_history_option_prefix.$this->name();
424 424
 	}
425 425
 
426 426
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * Gets the wp option which stores the activation history for this addon
430 430
 	 * @return array
431 431
 	 */
432
-	function get_activation_history(){
432
+	function get_activation_history() {
433 433
 		return get_option($this->get_activation_history_option_name(), NULL);
434 434
 	}
435 435
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	/**
439 439
 	 * @param string $config_section
440 440
 	 */
441
-	public function set_config_section( $config_section = '' ) {
442
-		$this->_config_section = ! empty( $config_section ) ? $config_section : 'addons';
441
+	public function set_config_section($config_section = '') {
442
+		$this->_config_section = ! empty($config_section) ? $config_section : 'addons';
443 443
 	}
444 444
 	/**
445 445
 	 *	filepath to the main file, which can be used for register_activation_hook, register_deactivation_hook, etc.
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 	 * Sets the filepath to the main plugin file
453 453
 	 * @param string $filepath
454 454
 	 */
455
-	public function set_main_plugin_file( $filepath ) {
455
+	public function set_main_plugin_file($filepath) {
456 456
 		$this->_main_plugin_file = $filepath;
457 457
 	}
458 458
 	/**
459 459
 	 * gets the filepath to teh main file
460 460
 	 * @return string
461 461
 	 */
462
-	public function get_main_plugin_file(){
462
+	public function get_main_plugin_file() {
463 463
 		return $this->_main_plugin_file;
464 464
 	}
465 465
 
@@ -469,15 +469,15 @@  discard block
 block discarded – undo
469 469
 	 * @return string
470 470
 	 */
471 471
 	public function get_main_plugin_file_basename() {
472
-		return plugin_basename( $this->get_main_plugin_file() );
472
+		return plugin_basename($this->get_main_plugin_file());
473 473
 	}
474 474
 
475 475
 	/**
476 476
 	 * Gets the folder name which contains the main plugin file
477 477
 	 * @return string
478 478
 	 */
479
-	public function get_main_plugin_file_dirname(){
480
-		return dirname( $this->get_main_plugin_file() );
479
+	public function get_main_plugin_file_dirname() {
480
+		return dirname($this->get_main_plugin_file());
481 481
 	}
482 482
 
483 483
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@
 block discarded – undo
189 189
 			EE_Registry::instance()->load_helper('Activation');
190 190
 			EEH_Activation::initialize_db_content();
191 191
 			update_option( 'ee_flush_rewrite_rules', TRUE );
192
-		}else{
192
+		} else{
193 193
 			//ask the data migration manager to init this addon's data
194 194
 			//when migrations are finished because we can't do it now
195 195
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( $this->name() );
Please login to merge, or discard this patch.
core/EE_Error.core.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 *    error_handler
90 90
 	 * @access public
91
-	 * @param $code
91
+	 * @param integer $code
92 92
 	 * @param $message
93 93
 	 * @param $file
94 94
 	 * @param $line
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	/**
190 190
 	 *    _format_error
191 191
 	 * @access private
192
-	 * @param $code
192
+	 * @param string $code
193 193
 	 * @param $message
194 194
 	 * @param $file
195 195
 	 * @param $line
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 *
937 937
 	 * @access    public
938 938
 	 * @param string $return_url
939
-	 * @return    array
939
+	 * @return    string
940 940
 	 */
941 941
 	public static function get_persistent_admin_notices( $return_url = '' ) {
942 942
 		$notices = '';
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	 *
962 962
 	 * @access 	public
963 963
 	 * @param 	bool $force_print
964
-	 * @return 	void
964
+	 * @return 	null|string
965 965
 	 */
966 966
 	private static function _print_scripts( $force_print = FALSE ) {
967 967
 		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3 5
 if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4 6
 	set_error_handler( array( 'EE_Error', 'error_handler' ));
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 	}
550 550
 
551 551
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
563 563
 	* 	@return 		void
564 564
 	*/
565
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
566
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
565
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
566
+		self::_add_notice('success', $msg, $file, $func, $line);
567 567
 	}
568 568
 
569 569
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
581 581
 	* 	@return 		void
582 582
 	*/
583
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
584
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
583
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
584
+		self::_add_notice('attention', $msg, $file, $func, $line);
585 585
 	}
586 586
 
587 587
 
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
600 600
 	* 	@return 		void
601 601
 	*/
602
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
603
-		if ( empty( $msg )) {
602
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
603
+		if (empty($msg)) {
604 604
 			EE_Error::doing_it_wrong(
605
-				'EE_Error::add_' . $type . '()',
605
+				'EE_Error::add_'.$type.'()',
606 606
 				sprintf(
607
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
607
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
608 608
 					$type,
609 609
 					$file,
610 610
 					$line
@@ -612,26 +612,26 @@  discard block
 block discarded – undo
612 612
 				EVENT_ESPRESSO_VERSION
613 613
 			);
614 614
 		}
615
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
615
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
616 616
 			EE_Error::doing_it_wrong(
617 617
 				'EE_Error::add_error()',
618
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
618
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
619 619
 				EVENT_ESPRESSO_VERSION
620 620
 			);
621 621
 		}
622 622
 		// get separate user and developer messages if they exist
623
-		$msg = explode( '||', $msg );
623
+		$msg = explode('||', $msg);
624 624
 		$user_msg = $msg[0];
625
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
625
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
626 626
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
627 627
 		// add notice if message exists
628
-		if ( ! empty( $msg )) {
628
+		if ( ! empty($msg)) {
629 629
 			// get error code only on error
630
-			$error_code = $type == 'errors' ? EE_Error::generate_error_code ( $file, $func, $line ) : '';
631
-			$error_code =  ! empty( $error_code ) ? '<br/><span class="tiny-text">' . $error_code . '</span>' : '';
630
+			$error_code = $type == 'errors' ? EE_Error::generate_error_code($file, $func, $line) : '';
631
+			$error_code = ! empty($error_code) ? '<br/><span class="tiny-text">'.$error_code.'</span>' : '';
632 632
 			// add notice
633
-			self::$_espresso_notices[ $type ][] = $msg . $error_code;
634
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
633
+			self::$_espresso_notices[$type][] = $msg.$error_code;
634
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
635 635
 		}
636 636
 
637 637
 	}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	*	@access private
686 686
 	*	@return void
687 687
 	*/
688
-	public static function reset_notices(){
688
+	public static function reset_notices() {
689 689
     	self::$_espresso_notices['success'] = FALSE;
690 690
     	self::$_espresso_notices['attention'] = FALSE;
691 691
     	self::$_espresso_notices['errors'] = FALSE;
@@ -698,14 +698,14 @@  discard block
 block discarded – undo
698 698
 	*	@access public
699 699
 	*	@return int
700 700
 	*/
701
-    public static function has_notices(){
701
+    public static function has_notices() {
702 702
 		$has_notices = 0;
703 703
 		// check for success messages
704
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
704
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
705 705
 		// check for attention messages
706
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
706
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
707 707
 		// check for error messages
708
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
708
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
709 709
 		return $has_notices;
710 710
 	}
711 711
 
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
721 721
 	* 	@return 		array
722 722
 	*/
723
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
724
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
723
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
724
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
725 725
 
726 726
 		$success_messages = '';
727 727
 		$attention_messages = '';
@@ -731,44 +731,44 @@  discard block
 block discarded – undo
731 731
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
732 732
 
733 733
 		// either save notices to the db
734
-		if ( $save_to_transient ) {
735
-			update_option( 'ee_notices', self::$_espresso_notices );
734
+		if ($save_to_transient) {
735
+			update_option('ee_notices', self::$_espresso_notices);
736 736
 			return;
737 737
 		}
738 738
 		// grab any notices that have been previously saved
739
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
740
-			foreach ( $notices as $type => $notice ) {
741
-				if ( is_array( $notice ) && ! empty( $notice )) {
739
+		if ($notices = get_option('ee_notices', FALSE)) {
740
+			foreach ($notices as $type => $notice) {
741
+				if (is_array($notice) && ! empty($notice)) {
742 742
 					// make sure that existsing notice type is an array
743
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
743
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
744 744
 					// merge stored notices with any newly created ones
745
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
745
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
746 746
 					$print_scripts = TRUE;
747 747
 				}
748 748
 			}
749 749
 			// now clear any stored notices
750
-			update_option( 'ee_notices', FALSE );
750
+			update_option('ee_notices', FALSE);
751 751
 		}
752 752
 
753 753
 		// check for success messages
754
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
754
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
755 755
 			// combine messages
756
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
756
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
757 757
 			$print_scripts = TRUE;
758 758
 		}
759 759
 
760 760
 		// check for attention messages
761
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
761
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
762 762
 			// combine messages
763
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
763
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
764 764
 			$print_scripts = TRUE;
765 765
 		}
766 766
 
767 767
 		// check for error messages
768
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
769
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
768
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
769
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
770 770
 			// combine messages
771
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
771
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
772 772
 			$print_scripts = TRUE;
773 773
 		}
774 774
 
@@ -782,21 +782,21 @@  discard block
 block discarded – undo
782 782
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
783 783
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
784 784
 				//showMessage( $success_messages );
785
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
785
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
786 786
 			}
787 787
 
788 788
 			if ($attention_messages != '') {
789 789
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
790 790
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
791 791
 				//showMessage( $error_messages, TRUE );
792
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
792
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
793 793
 			}
794 794
 
795 795
 			if ($error_messages != '') {
796 796
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
797 797
 				$css_class = is_admin() ? 'error' : 'error fade-away';
798 798
 				//showMessage( $error_messages, TRUE );
799
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
799
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
800 800
 			}
801 801
 
802 802
 			$notices .= '</div>';
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 					'errors' => $error_messages
810 810
 			);
811 811
 
812
-			if ( $remove_empty ) {
812
+			if ($remove_empty) {
813 813
 				// remove empty notices
814 814
 				foreach ($notices as $type => $notice) {
815 815
 					if (empty($notice)) {
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 			}
820 820
 		}
821 821
 
822
-		if ( $print_scripts ) {
822
+		if ($print_scripts) {
823 823
 			self::_print_scripts();
824 824
 		}
825 825
 
@@ -839,17 +839,17 @@  discard block
 block discarded – undo
839 839
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
840 840
 	* 	@return 		void
841 841
 	*/
842
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
843
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
844
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
842
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
843
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
844
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
845 845
 			//maybe initialize persistent_admin_notices
846
-			if ( empty( $persistent_admin_notices )) {
847
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
846
+			if (empty($persistent_admin_notices)) {
847
+				add_option('ee_pers_admin_notices', array(), '', 'no');
848 848
 			}
849
-			$pan_name = sanitize_key( $pan_name );
850
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
851
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
852
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
849
+			$pan_name = sanitize_key($pan_name);
850
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
851
+				$persistent_admin_notices[$pan_name] = $pan_message;
852
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
853 853
 			}
854 854
 		}
855 855
 	}
@@ -865,34 +865,34 @@  discard block
 block discarded – undo
865 865
 	 * @param bool          $return_immediately
866 866
 	 * @return        void
867 867
 	 */
868
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
869
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
870
-		if ( ! empty( $pan_name )) {
871
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
868
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
869
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
870
+		if ( ! empty($pan_name)) {
871
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
872 872
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
873
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
873
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
874 874
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
875
-				if ( $purge ) {
876
-					unset( $persistent_admin_notices[ $pan_name ] );
875
+				if ($purge) {
876
+					unset($persistent_admin_notices[$pan_name]);
877 877
 				} else {
878
-					$persistent_admin_notices[ $pan_name ] = NULL;
878
+					$persistent_admin_notices[$pan_name] = NULL;
879 879
 				}
880
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
881
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
880
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
881
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
882 882
 				}
883 883
 			}
884 884
 		}
885
-		if ( $return_immediately ) {
885
+		if ($return_immediately) {
886 886
 			return;
887
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
887
+		} else if (EE_Registry::instance()->REQ->ajax) {
888 888
 			// grab any notices and concatenate into string
889
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
889
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
890 890
 			exit();
891 891
 		} else {
892 892
 			// save errors to a transient to be displayed on next request (after redirect)
893
-			EE_Error::get_notices( FALSE, TRUE );
894
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
895
-			wp_safe_redirect( urldecode( $return_url ));
893
+			EE_Error::get_notices(FALSE, TRUE);
894
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
895
+			wp_safe_redirect(urldecode($return_url));
896 896
 		}
897 897
 	}
898 898
 
@@ -907,20 +907,20 @@  discard block
 block discarded – undo
907 907
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
908 908
 	 *  	@return 		string
909 909
 	 */
910
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
911
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
910
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
911
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
912 912
 			$args = array(
913 913
 				'nag_notice' => $pan_name,
914
-				'return_url' => urlencode( $return_url ),
914
+				'return_url' => urlencode($return_url),
915 915
 				'ajax_url' => WP_AJAX_URL,
916
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
916
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
917 917
 			);
918
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
918
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
919 919
 			return '
920
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
921
-				<p>' . $pan_message . '</p>
922
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
923
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
920
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
921
+				<p>' . $pan_message.'</p>
922
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
923
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
924 924
 				</a>
925 925
 				<div style="clear:both;"></div>
926 926
 			</div>';
@@ -936,17 +936,17 @@  discard block
 block discarded – undo
936 936
 	 * @param string $return_url
937 937
 	 * @return    array
938 938
 	 */
939
-	public static function get_persistent_admin_notices( $return_url = '' ) {
939
+	public static function get_persistent_admin_notices($return_url = '') {
940 940
 		$notices = '';
941 941
 		// check for persistent admin notices
942
-		if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) {
942
+		if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) {
943 943
 			// load scripts
944
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
945
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
946
-			wp_enqueue_script( 'ee_error_js' );
944
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
945
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
946
+			wp_enqueue_script('ee_error_js');
947 947
 			// and display notices
948
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
949
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
948
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
949
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
950 950
 			}
951 951
 		}
952 952
 		return $notices;
@@ -961,26 +961,26 @@  discard block
 block discarded – undo
961 961
 	 * @param 	bool $force_print
962 962
 	 * @return 	void
963 963
 	 */
964
-	private static function _print_scripts( $force_print = FALSE ) {
965
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
966
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
964
+	private static function _print_scripts($force_print = FALSE) {
965
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
966
+			if (wp_script_is('ee_error_js', 'enqueued')) {
967 967
 				return;
968
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
969
-				add_filter( 'FHEE_load_css', '__return_true' );
970
-				add_filter( 'FHEE_load_js', '__return_true' );
971
-				wp_enqueue_script( 'ee_error_js' );
972
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
968
+			} else if (wp_script_is('ee_error_js', 'registered')) {
969
+				add_filter('FHEE_load_css', '__return_true');
970
+				add_filter('FHEE_load_js', '__return_true');
971
+				wp_enqueue_script('ee_error_js');
972
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
973 973
 			}
974 974
 		} else {
975 975
 			return '
976 976
 <script>
977 977
 /* <![CDATA[ */
978
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
978
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
979 979
 /* ]]> */
980 980
 </script>
981
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
982
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
983
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
981
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
982
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
983
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
984 984
 ';
985 985
 
986 986
 		}
@@ -1014,11 +1014,11 @@  discard block
 block discarded – undo
1014 1014
 	*	@ param string $line
1015 1015
 	*	@ return string
1016 1016
 	*/
1017
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1018
-		$file = explode( '.', basename( $file ));
1019
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1020
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1021
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1017
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1018
+		$file = explode('.', basename($file));
1019
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1020
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1021
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1022 1022
 		return $error_code;
1023 1023
 	}
1024 1024
 
@@ -1034,38 +1034,38 @@  discard block
 block discarded – undo
1034 1034
 	*	@ param object $ex
1035 1035
 	*	@ return void
1036 1036
 	*/
1037
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1037
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1038 1038
 
1039
-		if ( ! $ex ) {
1039
+		if ( ! $ex) {
1040 1040
 			return;
1041 1041
 		}
1042 1042
 
1043
-		if ( ! $time ) {
1043
+		if ( ! $time) {
1044 1044
 			$time = time();
1045 1045
 		}
1046 1046
 
1047
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1048
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1049
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1050
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1051
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1052
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1053
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1054
-		$exception_log .= $ex['string'] . PHP_EOL;
1055
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1056
-
1057
-		EE_Registry::instance()->load_helper( 'File' );
1047
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1048
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1049
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1050
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1051
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1052
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1053
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1054
+		$exception_log .= $ex['string'].PHP_EOL;
1055
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1056
+
1057
+		EE_Registry::instance()->load_helper('File');
1058 1058
 		try {
1059
-			EEH_File::ensure_folder_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' );
1060
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' );
1061
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1062
-			if ( ! $clear ) {
1059
+			EEH_File::ensure_folder_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs');
1060
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs');
1061
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1062
+			if ( ! $clear) {
1063 1063
 				//get existing log file and append new log info
1064
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1064
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1065 1065
 			}
1066
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1067
-		} catch( EE_Error $e ){
1068
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1066
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1067
+		} catch (EE_Error $e) {
1068
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1069 1069
 			return;
1070 1070
 		}
1071 1071
 
@@ -1088,10 +1088,10 @@  discard block
 block discarded – undo
1088 1088
 	 * @param  string $version  The version of Event Espresso where the error was added
1089 1089
 	 * @return trigger_error()
1090 1090
 	 */
1091
-	public static function doing_it_wrong( $function, $message, $version ) {
1092
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1091
+	public static function doing_it_wrong($function, $message, $version) {
1092
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1093 1093
 			EE_Registry::instance()->load_helper('Debug_Tools');
1094
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version );
1094
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version);
1095 1095
 		}
1096 1096
 	}
1097 1097
 
@@ -1111,13 +1111,13 @@  discard block
 block discarded – undo
1111 1111
  */
1112 1112
 function espresso_error_enqueue_scripts() {
1113 1113
 	// js for error handling
1114
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1115
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1114
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1115
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1116 1116
 }
1117
-if ( is_admin() ) {
1118
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1117
+if (is_admin()) {
1118
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1119 1119
 } else {
1120
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1120
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1121 1121
 }
1122 1122
 
1123 1123
 
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -18,52 +18,52 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
 	/**
21
-	* 	name of the file to log exceptions to
22
-	* 	@access	private
23
-    *	@var string
24
-	*/
21
+	 * 	name of the file to log exceptions to
22
+	 * 	@access	private
23
+	 *	@var string
24
+	 */
25 25
 	private static $_exception_log_file = 'espresso_error_log.txt';
26 26
 
27 27
 	/**
28
-	* 	the exception
29
-	* 	@access	private
30
-    *	@var object
31
-	*/
28
+	 * 	the exception
29
+	 * 	@access	private
30
+	 *	@var object
31
+	 */
32 32
 	private $_exception;
33 33
 
34 34
 	/**
35
-	* 	stores details for all exception
36
-	* 	@access	private
37
-    *	@var array
38
-	*/
35
+	 * 	stores details for all exception
36
+	 * 	@access	private
37
+	 *	@var array
38
+	 */
39 39
 	private static $_all_exceptions = array();
40 40
 
41 41
 	/**
42
-	* 	tracks number of errors
43
-	* 	@access	private
44
-    *	@var int
45
-	*/
42
+	 * 	tracks number of errors
43
+	 * 	@access	private
44
+	 *	@var int
45
+	 */
46 46
 	private static $_error_count = 0;
47 47
 
48 48
 	/**
49
-	* 	has JS been loaded ?
50
-	* 	@access	private
51
-    *	@var boolean
52
-	*/
49
+	 * 	has JS been loaded ?
50
+	 * 	@access	private
51
+	 *	@var boolean
52
+	 */
53 53
 	private static $_js_loaded = FALSE;
54 54
 
55 55
 	/**
56
-	* 	has shutdown action been added ?
57
-	* 	@access	private
58
-    *	@var boolean
59
-	*/
56
+	 * 	has shutdown action been added ?
57
+	 * 	@access	private
58
+	 *	@var boolean
59
+	 */
60 60
 	private static $_action_added = FALSE;
61 61
 
62 62
 	/**
63
-	* 	has shutdown action been added ?
64
-	* 	@access	private
65
-    *	@var boolean
66
-	*/
63
+	 * 	has shutdown action been added ?
64
+	 * 	@access	private
65
+	 *	@var boolean
66
+	 */
67 67
 	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
68 68
 
69 69
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 	/**
74
-	*	@override default exception handling
75
-	*	@access public
76
-	*	@echo string
77
-	*/
74
+	 *	@override default exception handling
75
+	 *	@access public
76
+	 *	@echo string
77
+	 */
78 78
 	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79 79
 		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80 80
 			parent::__construct( $message, $code );
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 	/**
176
-	*	fatal_error_handler
177
-	*	@access public
178
-	*	@return void
179
-	*/
176
+	 *	fatal_error_handler
177
+	 *	@access public
178
+	 *	@return void
179
+	 */
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182 182
 		if ( $last_error['type'] === E_ERROR ) {
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 
222 222
 
223 223
 	/**
224
-	*	_add_actions
225
-	*	@access public
226
-	*	@return void
227
-	*/
228
-    public function get_error() {
224
+	 *	_add_actions
225
+	 *	@access public
226
+	 *	@return void
227
+	 */
228
+	public function get_error() {
229 229
 
230 230
 		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
231 231
 			throw $this;
@@ -255,22 +255,22 @@  discard block
 block discarded – undo
255 255
 
256 256
 
257 257
 	/**
258
-	*	has_error
259
-	*	@access public
260
-	*	@return boolean
261
-	*/
262
-    public static function has_error(){
258
+	 *	has_error
259
+	 *	@access public
260
+	 *	@return boolean
261
+	 */
262
+	public static function has_error(){
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
266 266
 
267 267
 
268 268
 	/**
269
-	*	display_errors
270
-	*	@access public
271
-	*	@echo string
272
-	*/
273
-    public function display_errors(){
269
+	 *	display_errors
270
+	 *	@access public
271
+	 *	@echo string
272
+	 */
273
+	public function display_errors(){
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			// process trace info
343 343
 			if ( empty( $ex['trace'] )) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+				$trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
346 346
 
347 347
 			} else {
348 348
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395 395
 					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
396 396
 
397
-		              $trace_details .= '
397
+					  $trace_details .= '
398 398
 					<tr>
399 399
 						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400 400
 						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 				}
408 408
 
409
-	            $trace_details .= '
409
+				$trace_details .= '
410 410
 			 </table>
411 411
 			</div>';
412 412
 
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 
487 487
 
488 488
 	/**
489
-	*	generate string from exception trace args
490
-	*
491
-	*	@access private
492
-	*	@ param array $arguments
493
-	*	@ return string
494
-	*/
489
+	 *	generate string from exception trace args
490
+	 *
491
+	 *	@access private
492
+	 *	@ param array $arguments
493
+	 *	@ return string
494
+	 */
495 495
 	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
496 496
 
497 497
 		$arg_string = '';
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
 
536 536
 
537 537
 	/**
538
-	* 	add error message
539
-	*
540
-	*	@access public
541
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
542
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
543
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
544
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545
-	* 	@return 		void
546
-	*/
538
+	 * 	add error message
539
+	 *
540
+	 *	@access public
541
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
542
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
543
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
544
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
545
+	 * 	@return 		void
546
+	 */
547 547
 	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548 548
 		self::_add_notice ( 'errors', $msg, $file, $func, $line );
549 549
 	}
@@ -553,15 +553,15 @@  discard block
 block discarded – undo
553 553
 
554 554
 
555 555
 	/**
556
-	* 	add success message
557
-	*
558
-	*	@access public
559
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
560
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
561
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
562
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
563
-	* 	@return 		void
564
-	*/
556
+	 * 	add success message
557
+	 *
558
+	 *	@access public
559
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
560
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
561
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
562
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
563
+	 * 	@return 		void
564
+	 */
565 565
 	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
566 566
 		self::_add_notice ( 'success', $msg, $file, $func, $line );
567 567
 	}
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 
572 572
 
573 573
 	/**
574
-	* 	add attention message
575
-	*
576
-	*	@access public
577
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
578
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
579
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
580
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
581
-	* 	@return 		void
582
-	*/
574
+	 * 	add attention message
575
+	 *
576
+	 *	@access public
577
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
578
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
579
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
580
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
581
+	 * 	@return 		void
582
+	 */
583 583
 	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
584 584
 		self::_add_notice ( 'attention', $msg, $file, $func, $line );
585 585
 	}
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 
590 590
 
591 591
 	/**
592
-	* 	add success message
593
-	*
594
-	*	@access public
595
-	* 	@param		string		$type	whether the message is for a success or error notification
596
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
597
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
598
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
599
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
600
-	* 	@return 		void
601
-	*/
592
+	 * 	add success message
593
+	 *
594
+	 *	@access public
595
+	 * 	@param		string		$type	whether the message is for a success or error notification
596
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
597
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
598
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
599
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
600
+	 * 	@return 		void
601
+	 */
602 602
 	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
603 603
 		if ( empty( $msg )) {
604 604
 			EE_Error::doing_it_wrong(
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 
642 642
 
643 643
 	/**
644
-	* 	in some case it may be necessary to overwrite the existing success messages
645
-	*
646
-	*	@access public
647
-	* 	@return 		void
648
-	*/
644
+	 * 	in some case it may be necessary to overwrite the existing success messages
645
+	 *
646
+	 *	@access public
647
+	 * 	@return 		void
648
+	 */
649 649
 	public static function overwrite_success() {
650 650
 		self::$_espresso_notices['success'] = FALSE;
651 651
 	}
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 
656 656
 
657 657
 	/**
658
-	* 	in some case it may be necessary to overwrite the existing attention messages
659
-	*
660
-	*	@access public
661
-	* 	@return 		void
662
-	*/
658
+	 * 	in some case it may be necessary to overwrite the existing attention messages
659
+	 *
660
+	 *	@access public
661
+	 * 	@return 		void
662
+	 */
663 663
 	public static function overwrite_attention() {
664 664
 		self::$_espresso_notices['attention'] = FALSE;
665 665
 	}
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 
670 670
 
671 671
 	/**
672
-	* 	in some case it may be necessary to overwrite the existing error messages
673
-	*
674
-	*	@access public
675
-	* 	@return 		void
676
-	*/
672
+	 * 	in some case it may be necessary to overwrite the existing error messages
673
+	 *
674
+	 *	@access public
675
+	 * 	@return 		void
676
+	 */
677 677
 	public static function overwrite_errors() {
678 678
 		self::$_espresso_notices['errors'] = FALSE;
679 679
 	}
@@ -681,24 +681,24 @@  discard block
 block discarded – undo
681 681
 
682 682
 
683 683
 	/**
684
-	*	reset_notices
685
-	*	@access private
686
-	*	@return void
687
-	*/
684
+	 *	reset_notices
685
+	 *	@access private
686
+	 *	@return void
687
+	 */
688 688
 	public static function reset_notices(){
689
-    	self::$_espresso_notices['success'] = FALSE;
690
-    	self::$_espresso_notices['attention'] = FALSE;
691
-    	self::$_espresso_notices['errors'] = FALSE;
692
-    }
689
+		self::$_espresso_notices['success'] = FALSE;
690
+		self::$_espresso_notices['attention'] = FALSE;
691
+		self::$_espresso_notices['errors'] = FALSE;
692
+	}
693 693
 
694 694
 
695 695
 
696 696
 	/**
697
-	*	has_errors
698
-	*	@access public
699
-	*	@return int
700
-	*/
701
-    public static function has_notices(){
697
+	 *	has_errors
698
+	 *	@access public
699
+	 *	@return int
700
+	 */
701
+	public static function has_notices(){
702 702
 		$has_notices = 0;
703 703
 		// check for success messages
704 704
 		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
 
713 713
 
714 714
 	/**
715
-	* 	compile all error or success messages into one string
716
-	*
717
-	*	@access public
718
-	* 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
719
-	* 	@param		boolean		$save_to_transient	whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting
720
-	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
721
-	* 	@return 		array
722
-	*/
715
+	 * 	compile all error or success messages into one string
716
+	 *
717
+	 *	@access public
718
+	 * 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
719
+	 * 	@param		boolean		$save_to_transient	whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting
720
+	 * 	@param		boolean		$remove_empty		whether or not to unset empty messages
721
+	 * 	@return 		array
722
+	 */
723 723
 	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
724 724
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
725 725
 
@@ -831,14 +831,14 @@  discard block
 block discarded – undo
831 831
 
832 832
 
833 833
 	/**
834
-	* 	add_persistent_admin_notice
835
-	*
836
-	*	@access 	public
837
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
838
-	* 	@param		string	$pan_message	the message to be stored persistently until dismissed
839
-	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
840
-	* 	@return 		void
841
-	*/
834
+	 * 	add_persistent_admin_notice
835
+	 *
836
+	 *	@access 	public
837
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
838
+	 * 	@param		string	$pan_message	the message to be stored persistently until dismissed
839
+	 * 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
840
+	 * 	@return 		void
841
+	 */
842 842
 	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
843 843
 		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
844 844
 			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
@@ -902,9 +902,9 @@  discard block
 block discarded – undo
902 902
 	 * 	display_persistent_admin_notices
903 903
 	 *
904 904
 	 *  	@access 	public
905
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
906
-	* 	@param		string	$pan_name	the message to be stored persistently until dismissed
907
-	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
905
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
906
+	 * 	@param		string	$pan_name	the message to be stored persistently until dismissed
907
+	 * 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
908 908
 	 *  	@return 		string
909 909
 	 */
910 910
 	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
@@ -993,11 +993,11 @@  discard block
 block discarded – undo
993 993
 
994 994
 
995 995
 	/**
996
-	* 	enqueue_error_scripts
997
-	*
998
-	*	@access public
999
-	* 	@return 		void
1000
-	*/
996
+	 * 	enqueue_error_scripts
997
+	 *
998
+	 *	@access public
999
+	 * 	@return 		void
1000
+	 */
1001 1001
 	public static function enqueue_error_scripts() {
1002 1002
 		self::_print_scripts();
1003 1003
 	}
@@ -1005,15 +1005,15 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 
1007 1007
 	/**
1008
-	*	create error code from filepath, function name,
1009
-	*	and line number where exception or error was thrown
1010
-	*
1011
-	*	@access public
1012
-	*	@ param string $file
1013
-	*	@ param string $func
1014
-	*	@ param string $line
1015
-	*	@ return string
1016
-	*/
1008
+	 *	create error code from filepath, function name,
1009
+	 *	and line number where exception or error was thrown
1010
+	 *
1011
+	 *	@access public
1012
+	 *	@ param string $file
1013
+	 *	@ param string $func
1014
+	 *	@ param string $line
1015
+	 *	@ return string
1016
+	 */
1017 1017
 	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1018 1018
 		$file = explode( '.', basename( $file ));
1019 1019
 		$error_code = ! empty( $file[0] ) ? $file[0] : '';
@@ -1027,13 +1027,13 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
 
1029 1029
 	/**
1030
-	*	write exception details to log file
1031
-	*
1032
-	*	@access public
1033
-	*	@ param timestamp $time
1034
-	*	@ param object $ex
1035
-	*	@ return void
1036
-	*/
1030
+	 *	write exception details to log file
1031
+	 *
1032
+	 *	@access public
1033
+	 *	@ param timestamp $time
1034
+	 *	@ param object $ex
1035
+	 *	@ return void
1036
+	 */
1037 1037
 	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1038 1038
 
1039 1039
 		if ( ! $ex ) {
Please login to merge, or discard this patch.
core/EE_Maintenance_Mode.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
 	 *   returns TRUE if M-Mode is engaged and the current request is not for the admin
185 185
 	 *
186 186
 	 * @access    public
187
-	 * @return    string
187
+	 * @return    boolean
188 188
 	 */
189 189
 	public static function disable_frontend_for_maintenance() {
190 190
 		return ! is_admin() && EE_Maintenance_Mode::instance()->level() ? TRUE : FALSE;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
 	 */
49 49
 	const option_name_maintenance_mode = 'ee_maintenance_mode';
50 50
    /**
51
-     * 	EE_Maintenance_Mode Object
52
-     * 	@var EE_Maintenance_Mode $_instance
53
-	 * 	@access 	private
54
-     */
51
+    * 	EE_Maintenance_Mode Object
52
+    * 	@var EE_Maintenance_Mode $_instance
53
+    * 	@access 	private
54
+    */
55 55
 	private static $_instance = NULL;
56 56
 
57 57
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			current_user_can('administrator') && //when the user is an admin
142 142
 			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else{
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		} elseif( $this->level() == self::level_2_complete_maintenance ){
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162 162
 			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
163 163
 			return false;
164
-		}else{
164
+		} else{
165 165
 			return false;
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function instance() {
75 75
 		// check if class object is instantiated
76
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) {
76
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) {
77 77
 			self::$_instance = new self();
78 78
 		}
79 79
 		return self::$_instance;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode)
84 84
 	 * @return EE_Maintenance_Mode
85 85
 	 */
86
-	public static function reset(){
86
+	public static function reset() {
87 87
 		self::instance()->set_maintenance_mode_if_db_old();
88 88
 		return self::instance();
89 89
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	private function __construct() {
100 100
 		// if M-Mode level 2 is engaged, we still need basic assets loaded
101
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' ));
101
+		add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode'));
102 102
 		// shut 'er down down for maintenance ?
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 999 );
103
+		add_filter('the_content', array($this, 'the_content'), 999);
104 104
 		// add powered by EE msg
105
-		add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 );
105
+		add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * retrieves the maintenance mode option value from the db
113 113
 	 * @return int
114 114
 	 */
115
-	public function real_level(){
116
-		return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance );
115
+	public function real_level() {
116
+		return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * thinks their tables are present and up-to-date).
122 122
 	 * @return boolean
123 123
 	 */
124
-	public function models_can_query(){
124
+	public function models_can_query() {
125 125
 		return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance;
126 126
 	}
127 127
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode
135 135
 	 * @return int
136 136
 	 */
137
-	public function level(){
137
+	public function level() {
138 138
 		$real_maintenance_mode_level = $this->real_level();
139 139
 		//if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend
140
-		if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
140
+		if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
141 141
 			current_user_can('administrator') && //when the user is an admin
142
-			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
142
+			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else {
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	 * Determines if we need to put EE in maintenance mode because the database needs updating
152 152
 	 * @return boolean true if DB is old and maintenance mode was triggered; false otherwise
153 153
 	 */
154
-	public function set_maintenance_mode_if_db_old(){
155
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
156
-		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
154
+	public function set_maintenance_mode_if_db_old() {
155
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
156
+		if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		}elseif ($this->level() == self::level_2_complete_maintenance) {
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162
-			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
162
+			update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance);
163 163
 			return false;
164
-		}else{
164
+		} else {
165 165
 			return false;
166 166
 		}
167 167
 	}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param int $level
172 172
 	 * @return void
173 173
 	 */
174
-	public function set_maintenance_level($level){
175
-		do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level );
174
+	public function set_maintenance_level($level) {
175
+		do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level);
176 176
 		update_option(self::option_name_maintenance_mode, intval($level));
177 177
 	}
178 178
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 *  @return 	string
200 200
 	 */
201 201
 	public function load_assets_required_for_m_mode() {
202
-		if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) {
203
-			wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
202
+		if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) {
203
+			wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
204 204
 			wp_enqueue_style('espresso_default');
205
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
206
-			wp_enqueue_script( 'espresso_core' );
205
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
206
+			wp_enqueue_script('espresso_core');
207 207
 		}
208 208
 	}
209 209
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param    string $template_path
219 219
 	 * @return    string
220 220
 	 */
221
-	public static function template_include( $template_path ) {
222
-		EE_Registry::instance()->load_helper( 'Template' );
223
-		$template_located = EEH_Template::locate_template( EE_TEMPLATES . 'maintenance_mode.template.php', FALSE, FALSE );
221
+	public static function template_include($template_path) {
222
+		EE_Registry::instance()->load_helper('Template');
223
+		$template_located = EEH_Template::locate_template(EE_TEMPLATES.'maintenance_mode.template.php', FALSE, FALSE);
224 224
 		return $template_located ? $template_located : $template_path;
225 225
 	}
226 226
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param    string $the_content
236 236
 	 * @return    string
237 237
 	 */
238
-	public function the_content( $the_content ) {
238
+	public function the_content($the_content) {
239 239
 		// check if M-mode is engaged and for EE shortcode
240
-		if ( $this->level() && strpos( $the_content, '[ESPRESSO_' )) {
240
+		if ($this->level() && strpos($the_content, '[ESPRESSO_')) {
241 241
 			// this can eventually be moved to a template, or edited via admin. But for now...
242 242
 			$the_content = sprintf(
243
-				__( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ),
243
+				__('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'),
244 244
 				'<h2>',
245 245
 				'</h2><p>',
246 246
 				'</p>'
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public function display_maintenance_mode_notice() {
264 264
 		// check if M-mode is engaged and for EE shortcode
265
-		if ( $this->real_level() && current_user_can( 'administrator' ) && ! is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )) {
265
+		if ($this->real_level() && current_user_can('administrator') && ! is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) {
266 266
 			printf(
267
-				__( '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso' ),
267
+				__('%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso'),
268 268
 				'<div id="ee-m-mode-admin-notice-dv" class=""><a class="close-espresso-notice" title="',
269 269
 				'">&times;</a><p>',
270
-				' &raquo; <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">',
270
+				' &raquo; <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">',
271 271
 				'</a></p></div>'
272 272
 			);
273 273
 		}
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 *		@ return void
286 286
 	 */
287 287
 	final function __destruct() {}
288
-	final function __call($a,$b) {}
288
+	final function __call($a, $b) {}
289 289
 	final function __get($a) {}
290
-	final function __set($a,$b) {}
290
+	final function __set($a, $b) {}
291 291
 	final function __isset($a) {}
292 292
 	final function __unset($a) {}
293 293
 	final function __sleep() {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	final function __invoke() {}
299 299
 	final function __set_state() {}
300 300
 	final function __clone() {}
301
-	final static function __callStatic($a,$b) {}
301
+	final static function __callStatic($a, $b) {}
302 302
 
303 303
 }
304 304
 // End of file EE_Maintenance_Mode.core.php
Please login to merge, or discard this patch.
core/EE_Registry.core.php 4 patches
Doc Comments   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -214,6 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 	/**
216 216
 	 * @param mixed string | EED_Module $module
217
+	 * @param boolean|string $module
217 218
 	 */
218 219
 	public function add_module( $module ) {
219 220
 		if ( $module instanceof EED_Module ) {
@@ -245,7 +246,7 @@  discard block
 block discarded – undo
245 246
 	 * @param string $class_name - simple class name ie: session
246 247
 	 * @param mixed  $arguments
247 248
 	 * @param bool   $load_only
248
-	 * @return mixed
249
+	 * @return boolean
249 250
 	 */
250 251
 	public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) {
251 252
 		$core_paths = apply_filters(
@@ -269,7 +270,7 @@  discard block
 block discarded – undo
269 270
 	 * @access    public
270 271
 	 * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0
271 272
 	 * @param mixed  $arguments
272
-	 * @return EE_Data_Migration_Script_Base
273
+	 * @return boolean
273 274
 	 */
274 275
 	public function load_dms ( $class_name, $arguments = array() ) {
275 276
 		// retrieve instantiated class
@@ -286,7 +287,7 @@  discard block
 block discarded – undo
286 287
 	 *	@param bool   $from_db    - some classes are instantiated from the db and thus call a different method to instantiate
287 288
 	 *	@param bool   $cache      if you don't want the class to be stored in the internal cache (non-persistent) then set this to FALSE (ie. when instantiating model objects from client in a loop)
288 289
 	 *	@param bool   $load_only      whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
289
-	 *	@return EE_Base_Class
290
+	 *	@return boolean
290 291
 	 */
291 292
 	public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) {
292 293
 		$paths = apply_filters('FHEE__EE_Registry__load_class__paths',array(
@@ -307,7 +308,7 @@  discard block
 block discarded – undo
307 308
 	 * @param string $class_name - simple class name ie: price
308 309
 	 * @param mixed  $arguments
309 310
 	 * @param bool   $load_only
310
-	 * @return EEH_Base
311
+	 * @return boolean
311 312
 	 */
312 313
 	public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) {
313 314
 		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) );
@@ -324,7 +325,7 @@  discard block
 block discarded – undo
324 325
 	 * @param string $class_name - simple class name ie: session
325 326
 	 * @param mixed  $arguments
326 327
 	 * @param bool   $load_only
327
-	 * @return mixed
328
+	 * @return boolean
328 329
 	 */
329 330
 	public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) {
330 331
 		$paths = array(
@@ -346,7 +347,7 @@  discard block
 block discarded – undo
346 347
 	 * @param string $class_name - simple class name ie: price
347 348
 	 * @param mixed  $arguments
348 349
 	 * @param bool   $load_only
349
-	 * @return EEM_Base
350
+	 * @return boolean
350 351
 	 */
351 352
 	public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) {
352 353
 		$paths = apply_filters('FHEE__EE_Registry__load_model__paths',array(
@@ -365,7 +366,7 @@  discard block
 block discarded – undo
365 366
 	 * @param string $class_name - simple class name ie: price
366 367
 	 * @param mixed  $arguments
367 368
 	 * @param bool   $load_only
368
-	 * @return mixed
369
+	 * @return boolean
369 370
 	 */
370 371
 	public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) {
371 372
 		$paths = array(
@@ -401,7 +402,7 @@  discard block
 block discarded – undo
401 402
 	 * @param string $type         - file type - core? class? helper? model?
402 403
 	 * @param mixed  $arguments
403 404
 	 * @param bool   $load_only
404
-	 * @return mixed
405
+	 * @return boolean
405 406
 	 */
406 407
 	public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) {
407 408
 		// retrieve instantiated class
@@ -418,7 +419,7 @@  discard block
 block discarded – undo
418 419
 	 * @param string $type         - file type - core? class? helper? model?
419 420
 	 * @param mixed  $arguments
420 421
 	 * @param bool   $load_only
421
-	 * @return EE_Addon
422
+	 * @return boolean
422 423
 	 */
423 424
 	public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) {
424 425
 		// retrieve instantiated class
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public static function instance() {
171 171
 		// check if class object is instantiated
172
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) {
172
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) {
173 173
 			self::$_instance = new self();
174 174
 		}
175 175
 		return self::$_instance;
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 	 * @return \EE_Registry
185 185
 	 */
186 186
 	private function __construct() {
187
-		$this->load_core( 'Base' );
187
+		$this->load_core('Base');
188 188
 		// class library
189 189
 		$this->LIB = new StdClass();
190 190
 		$this->addons = new StdClass();
191 191
 		$this->modules = new StdClass();
192 192
 		$this->shortcodes = new StdClass();
193 193
 		$this->widgets = new StdClass();
194
-		add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ));
194
+		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init'));
195 195
 	}
196 196
 
197 197
 
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	public function init() {
206 206
 		// Get current page protocol
207
-		$protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
207
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
208 208
 		// Output admin-ajax.php URL with same protocol as current page
209
-		self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol );
210
-		self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE;
209
+		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol);
210
+		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE;
211 211
 	}
212 212
 
213 213
 
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 	/**
216 216
 	 * @param mixed string | EED_Module $module
217 217
 	 */
218
-	public function add_module( $module ) {
219
-		if ( $module instanceof EED_Module ) {
220
-			$module_class = get_class( $module );
218
+	public function add_module($module) {
219
+		if ($module instanceof EED_Module) {
220
+			$module_class = get_class($module);
221 221
 			$this->modules->{$module_class} = $module;
222 222
 		} else {
223
-			if ( ! class_exists( 'EE_Module_Request_Router' )) {
224
-				$this->load_core( 'Module_Request_Router' );
223
+			if ( ! class_exists('EE_Module_Request_Router')) {
224
+				$this->load_core('Module_Request_Router');
225 225
 			}
226
-			$this->modules->{$module} = EE_Module_Request_Router::module_factory( $module );
226
+			$this->modules->{$module} = EE_Module_Request_Router::module_factory($module);
227 227
 		}
228 228
 	}
229 229
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param string $module_name
234 234
 	 * @return mixed EED_Module | NULL
235 235
 	 */
236
-	public function get_module( $module_name = '' ) {
237
-		return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL;
236
+	public function get_module($module_name = '') {
237
+		return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL;
238 238
 	}
239 239
 
240 240
 
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
 	 * @param bool   $load_only
248 248
 	 * @return mixed
249 249
 	 */
250
-	public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) {
250
+	public function load_core($class_name, $arguments = array(), $load_only = FALSE) {
251 251
 		$core_paths = apply_filters(
252 252
 			'FHEE__EE_Registry__load_core__core_paths',
253 253
 			array(
254 254
 				EE_CORE,
255 255
 				EE_ADMIN,
256 256
 				EE_CPTS,
257
-				EE_CORE . 'data_migration_scripts' . DS
257
+				EE_CORE.'data_migration_scripts'.DS
258 258
 			)
259 259
 		);
260 260
 		// retrieve instantiated class
261
-		return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only );
261
+		return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only);
262 262
 	}
263 263
 
264 264
 
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
 	 * @param mixed  $arguments
272 272
 	 * @return EE_Data_Migration_Script_Base
273 273
 	 */
274
-	public function load_dms ( $class_name, $arguments = array() ) {
274
+	public function load_dms($class_name, $arguments = array()) {
275 275
 		// retrieve instantiated class
276
-		return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE );
276
+		return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE);
277 277
 	}
278 278
 
279 279
 
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 *	@param bool   $load_only      whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
289 289
 	 *	@return EE_Base_Class
290 290
 	 */
291
-	public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) {
292
-		$paths = apply_filters('FHEE__EE_Registry__load_class__paths',array(
291
+	public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) {
292
+		$paths = apply_filters('FHEE__EE_Registry__load_class__paths', array(
293 293
 			EE_CORE,
294 294
 			EE_CLASSES,
295 295
 			EE_BUSINESS
296 296
 		));
297 297
 		// retrieve instantiated class
298
-		return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only );
298
+		return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only);
299 299
 	}
300 300
 
301 301
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 	 * @param bool   $load_only
310 310
 	 * @return EEH_Base
311 311
 	 */
312
-	public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) {
313
-		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) );
312
+	public function load_helper($class_name, $arguments = array(), $load_only = TRUE) {
313
+		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS));
314 314
 		// retrieve instantiated class
315
-		return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only );
315
+		return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only);
316 316
 	}
317 317
 
318 318
 
@@ -326,16 +326,16 @@  discard block
 block discarded – undo
326 326
 	 * @param bool   $load_only
327 327
 	 * @return mixed
328 328
 	 */
329
-	public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) {
329
+	public function load_lib($class_name, $arguments = array(), $load_only = FALSE) {
330 330
 		$paths = array(
331 331
 			EE_LIBRARIES,
332
-			EE_LIBRARIES . 'messages' . DS,
333
-			EE_LIBRARIES . 'shortcodes' . DS,
334
-			EE_LIBRARIES . 'qtips' . DS,
335
-			EE_LIBRARIES . 'payment_methods' . DS,
332
+			EE_LIBRARIES.'messages'.DS,
333
+			EE_LIBRARIES.'shortcodes'.DS,
334
+			EE_LIBRARIES.'qtips'.DS,
335
+			EE_LIBRARIES.'payment_methods'.DS,
336 336
 		);
337 337
 		// retrieve instantiated class
338
-		return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only );
338
+		return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only);
339 339
 	}
340 340
 
341 341
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 	 * @param bool   $load_only
349 349
 	 * @return EEM_Base
350 350
 	 */
351
-	public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) {
352
-		$paths = apply_filters('FHEE__EE_Registry__load_model__paths',array(
351
+	public function load_model($class_name, $arguments = array(), $load_only = FALSE) {
352
+		$paths = apply_filters('FHEE__EE_Registry__load_model__paths', array(
353 353
 			EE_MODELS,
354 354
 			EE_CORE
355 355
 		));
356 356
 		// retrieve instantiated class
357
-		return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only );
357
+		return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only);
358 358
 	}
359 359
 
360 360
 
@@ -367,15 +367,15 @@  discard block
 block discarded – undo
367 367
 	 * @param bool   $load_only
368 368
 	 * @return mixed
369 369
 	 */
370
-	public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) {
370
+	public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) {
371 371
 		$paths = array(
372
-			EE_MODELS . 'fields' . DS,
373
-			EE_MODELS . 'helpers' . DS,
374
-			EE_MODELS . 'relations' . DS,
375
-			EE_MODELS . 'strategies' . DS
372
+			EE_MODELS.'fields'.DS,
373
+			EE_MODELS.'helpers'.DS,
374
+			EE_MODELS.'relations'.DS,
375
+			EE_MODELS.'strategies'.DS
376 376
 		);
377 377
 		// retrieve instantiated class
378
-		return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only );
378
+		return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only);
379 379
 	}
380 380
 
381 381
 
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 	 * @param string $model_name like Event, Attendee, Question_Group_Question, etc.
388 388
 	 * @return boolean
389 389
 	 */
390
-	public function is_model_name( $model_name ){
391
-		return isset( $this->models[ $model_name ] ) ? TRUE : FALSE;
390
+	public function is_model_name($model_name) {
391
+		return isset($this->models[$model_name]) ? TRUE : FALSE;
392 392
 	}
393 393
 
394 394
 
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 	 * @param bool   $load_only
404 404
 	 * @return mixed
405 405
 	 */
406
-	public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) {
406
+	public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) {
407 407
 		// retrieve instantiated class
408
-		return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only );
408
+		return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only);
409 409
 	}
410 410
 
411 411
 
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 	 * @param bool   $load_only
421 421
 	 * @return EE_Addon
422 422
 	 */
423
-	public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) {
423
+	public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) {
424 424
 		// retrieve instantiated class
425
-		return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only );
425
+		return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only);
426 426
 	}
427 427
 
428 428
 
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
 	 * @internal param string $file_path - file path including file name
441 441
 	 * @return bool | object
442 442
 	 */
443
-	private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) {
443
+	private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) {
444 444
 		// strip php file extension
445
-		$class_name = str_replace( '.php', '', trim( $class_name ));
445
+		$class_name = str_replace('.php', '', trim($class_name));
446 446
 		// does the class have a prefix ?
447
-		if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) {
447
+		if ( ! empty($class_prefix) && $class_prefix != 'addon') {
448 448
 			// make sure $class_prefix is uppercase
449
-			$class_prefix = strtoupper( trim( $class_prefix ));
449
+			$class_prefix = strtoupper(trim($class_prefix));
450 450
 			// add class prefix ONCE!!!
451
-			$class_name = $class_prefix . str_replace( $class_prefix, '', $class_name );
451
+			$class_name = $class_prefix.str_replace($class_prefix, '', $class_name);
452 452
 		}
453 453
 
454 454
 		$class_abbreviations = array(
@@ -461,56 +461,56 @@  discard block
 block discarded – undo
461 461
 		);
462 462
 
463 463
 		// check if class has already been loaded, and return it if it has been
464
-		if ( isset( $class_abbreviations[ $class_name ] ) && ! is_null( $this->$class_abbreviations[ $class_name ] )) {
465
-			return $this->$class_abbreviations[ $class_name ];
466
-		} else if ( isset ( $this->{$class_name} )) {
464
+		if (isset($class_abbreviations[$class_name]) && ! is_null($this->$class_abbreviations[$class_name])) {
465
+			return $this->$class_abbreviations[$class_name];
466
+		} else if (isset ($this->{$class_name} )) {
467 467
 			return $this->{$class_name};
468
-		} else if ( isset ( $this->LIB->$class_name )) {
468
+		} else if (isset ($this->LIB->$class_name)) {
469 469
 			return $this->LIB->$class_name;
470
-		} else if ( $class_prefix == 'addon' && isset ( $this->addons->$class_name )) {
470
+		} else if ($class_prefix == 'addon' && isset ($this->addons->$class_name)) {
471 471
 			return $this->addons->$class_name;
472 472
 		}
473 473
 
474 474
 		// assume all paths lead nowhere
475 475
 		$path = FALSE;
476 476
 		// make sure $file_paths is an array
477
-		$file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths );
477
+		$file_paths = is_array($file_paths) ? $file_paths : array($file_paths);
478 478
 		// cycle thru paths
479
-		foreach ( $file_paths as $key => $file_path ) {
479
+		foreach ($file_paths as $key => $file_path) {
480 480
 			// convert all separators to proper DS, if no filepath, then use EE_CLASSES
481
-			$file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES;
481
+			$file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES;
482 482
 			// prep file type
483
-			$type = ! empty( $type ) ? trim( $type, '.' ) . '.' : '';
483
+			$type = ! empty($type) ? trim($type, '.').'.' : '';
484 484
 			// build full file path
485
-			$file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php';
485
+			$file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php';
486 486
 			//does the file exist and can be read ?
487
-			if ( is_readable( $file_paths[ $key ] )) {
488
-				$path = $file_paths[ $key ];
487
+			if (is_readable($file_paths[$key])) {
488
+				$path = $file_paths[$key];
489 489
 				break;
490 490
 			}
491 491
 		}
492 492
 		// don't give up! you gotta...
493 493
 		try {
494 494
 			//does the file exist and can it be read ?
495
-			if ( ! $path ) {
495
+			if ( ! $path) {
496 496
 				// so sorry, can't find the file
497
-				throw new EE_Error (
498
-					sprintf (
499
-						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'),
500
-						trim( $type, '.' ),
497
+				throw new EE_Error(
498
+					sprintf(
499
+						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'),
500
+						trim($type, '.'),
501 501
 						$class_name,
502
-						'<br />' . implode( ',<br />', $file_paths )
502
+						'<br />'.implode(',<br />', $file_paths)
503 503
 					)
504 504
 				);
505 505
 			}
506 506
 			// get the file
507
-			require_once( $path );
507
+			require_once($path);
508 508
 			// if the class isn't already declared somewhere
509
-			if ( class_exists( $class_name, FALSE ) === FALSE ) {
509
+			if (class_exists($class_name, FALSE) === FALSE) {
510 510
 				// so sorry, not a class
511 511
 				throw new EE_Error(
512 512
 					sprintf(
513
-						__('The %s file %s does not appear to contain the %s Class.','event_espresso'),
513
+						__('The %s file %s does not appear to contain the %s Class.', 'event_espresso'),
514 514
 						$type,
515 515
 						$path,
516 516
 						$class_name
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 				);
519 519
 			}
520 520
 
521
-		} catch ( EE_Error $e ) {
521
+		} catch (EE_Error $e) {
522 522
 			$e->get_error();
523 523
 		}
524 524
 
@@ -526,38 +526,38 @@  discard block
 block discarded – undo
526 526
 		// don't give up! you gotta...
527 527
 		try {
528 528
 			// create reflection
529
-			$reflector = new ReflectionClass( $class_name );
529
+			$reflector = new ReflectionClass($class_name);
530 530
 			// instantiate the class and add to the LIB array for tracking
531 531
 			// EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db)
532
-			if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) {
532
+			if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) {
533 533
 //				$instantiation_mode = 0;
534 534
 				// no constructor = static methods only... nothing to instantiate, loading file was enough
535 535
 				return TRUE;
536
-			} else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) {
536
+			} else if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
537 537
 //				$instantiation_mode = 1;
538
-				$class_obj =  call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments );
539
-			} else if ( method_exists( $class_name, 'new_instance' ) ) {
538
+				$class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
539
+			} else if (method_exists($class_name, 'new_instance')) {
540 540
 //				$instantiation_mode = 2;
541
-				$class_obj =  call_user_func_array( array( $class_name, 'new_instance' ), $arguments );
542
-			} else if ( method_exists( $class_name, 'instance' )) {
541
+				$class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
542
+			} else if (method_exists($class_name, 'instance')) {
543 543
 //				$instantiation_mode = 3;
544
-				$class_obj =  call_user_func_array( array( $class_name, 'instance' ), $arguments );
545
-			} else if ( $reflector->isInstantiable() ) {
544
+				$class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
545
+			} else if ($reflector->isInstantiable()) {
546 546
 //				$instantiation_mode = 4;
547
-				$class_obj =  $reflector->newInstance( $arguments );
548
-			} else if ( ! $load_only ) {
547
+				$class_obj = $reflector->newInstance($arguments);
548
+			} else if ( ! $load_only) {
549 549
 				// heh ? something's not right !
550 550
 //				$instantiation_mode = 5;
551 551
 				throw new EE_Error(
552 552
 					sprintf(
553
-						__('The %s file %s could not be instantiated.','event_espresso'),
553
+						__('The %s file %s could not be instantiated.', 'event_espresso'),
554 554
 						$type,
555 555
 						$class_name
556 556
 					)
557 557
 				);
558 558
 			}
559 559
 
560
-		} catch ( EE_Error $e ) {
560
+		} catch (EE_Error $e) {
561 561
 			$e->get_error();
562 562
 		}
563 563
 
@@ -569,15 +569,15 @@  discard block
 block discarded – undo
569 569
 //	EEH_Debug_Tools::printr( $class_obj, '$class_obj  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
570 570
 
571 571
 
572
-		if ( isset( $class_obj )) {
572
+		if (isset($class_obj)) {
573 573
 			// return newly instantiated class
574
-			if ( isset( $class_abbreviations[ $class_name ] )) {
575
-				$this->$class_abbreviations[ $class_name ] = $class_obj;
576
-			} else if ( EEH_Class_Tools::has_property( $this, $class_name )) {
574
+			if (isset($class_abbreviations[$class_name])) {
575
+				$this->$class_abbreviations[$class_name] = $class_obj;
576
+			} else if (EEH_Class_Tools::has_property($this, $class_name)) {
577 577
 				$this->{$class_name} = $class_obj;
578
-			} else if ( $class_prefix == 'addon' && $cache  ) {
578
+			} else if ($class_prefix == 'addon' && $cache) {
579 579
 				$this->addons->$class_name = $class_obj;
580
-			} else if ( !$from_db && $cache  ) {
580
+			} else if ( ! $from_db && $cache) {
581 581
 				$this->LIB->$class_name = $class_obj;
582 582
 			}
583 583
 			return $class_obj;
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	 * @param $a
603 603
 	 * @param $b
604 604
 	 */
605
-	final function __call($a,$b) {}
605
+	final function __call($a, $b) {}
606 606
 
607 607
 
608 608
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 * @param $a
618 618
 	 * @param $b
619 619
 	 */
620
-	final function __set($a,$b) {}
620
+	final function __set($a, $b) {}
621 621
 
622 622
 
623 623
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 * @param $a
658 658
 	 * @param $b
659 659
 	 */
660
-	final static function __callStatic($a,$b) {}
660
+	final static function __callStatic($a, $b) {}
661 661
 
662 662
 	/**
663 663
 	 * Gets the addon by its name/slug (not classname. For that, just
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 	 * @param string $name
666 666
 	 * @return EE_Addon
667 667
 	 */
668
-	public function get_addon_by_name( $name ){
669
-		foreach($this->addons as $addon){
670
-			if( $addon->name() == $name){
668
+	public function get_addon_by_name($name) {
669
+		foreach ($this->addons as $addon) {
670
+			if ($addon->name() == $name) {
671 671
 				return $addon;
672 672
 			}
673 673
 		}
@@ -678,10 +678,10 @@  discard block
 block discarded – undo
678 678
 	 *
679 679
 	 * @return EE_Addon[] where the KEYS are the addon's name()
680 680
 	 */
681
-	public function get_addons_by_name(){
681
+	public function get_addons_by_name() {
682 682
 		$addons = array();
683
-		foreach($this->addons as $addon){
684
-			$addons[ $addon->name() ] = $addon;
683
+		foreach ($this->addons as $addon) {
684
+			$addons[$addon->name()] = $addon;
685 685
 		}
686 686
 		return $addons;
687 687
 	}
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
 	 * @param string $model_name
693 693
 	 * @return EEM_Base
694 694
 	 */
695
-	public function reset_model( $model_name ){
696
-		$model = $this->load_model( $model_name );
697
-		$model_class_name = get_class( $model );
695
+	public function reset_model($model_name) {
696
+		$model = $this->load_model($model_name);
697
+		$model_class_name = get_class($model);
698 698
 		//get that model reset it and make sure we nuke the old reference to it
699
-		if ( is_callable( array( $model_class_name, 'reset' ))) {
699
+		if (is_callable(array($model_class_name, 'reset'))) {
700 700
 			$this->LIB->$model_class_name = $model::reset();
701
-		}else{
702
-			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
701
+		} else {
702
+			throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name));
703 703
 		}
704 704
 		return $this->LIB->$model_class_name;
705 705
 	}
@@ -715,15 +715,15 @@  discard block
 block discarded – undo
715 715
 	 * currently reinstantiate the singletons at the moment)
716 716
 	 * @return EE_Registry
717 717
 	 */
718
-	public static function reset( $hard = FALSE, $reinstantiate = TRUE ){
718
+	public static function reset($hard = FALSE, $reinstantiate = TRUE) {
719 719
 		$instance = self::instance();
720 720
 		$instance->load_helper('Activation');
721 721
 		EEH_Activation::reset();
722
-		$instance->CFG = EE_Config::reset( $hard, $reinstantiate );
722
+		$instance->CFG = EE_Config::reset($hard, $reinstantiate);
723 723
 		$instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset();
724 724
 		$instance->LIB = new stdClass();
725
-		foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){
726
-			$instance->reset_model( $model_name );
725
+		foreach (array_keys($instance->non_abstract_db_models) as $model_name) {
726
+			$instance->reset_model($model_name);
727 727
 		}
728 728
 		return $instance;
729 729
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -698,7 +698,7 @@
 block discarded – undo
698 698
 		//get that model reset it and make sure we nuke the old reference to it
699 699
 		if ( is_callable( array( $model_class_name, 'reset' ))) {
700 700
 			$this->LIB->$model_class_name = $model::reset();
701
-		}else{
701
+		} else{
702 702
 			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
703 703
 		}
704 704
 		return $this->LIB->$model_class_name;
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -11,25 +11,25 @@  discard block
 block discarded – undo
11 11
 final class EE_Registry {
12 12
 
13 13
 	/**
14
-	* 	EE_Registry Object
15
-	* 	@var EE_Registry $_instance
16
-	* 	@access 	private
17
-	*/
14
+	 * 	EE_Registry Object
15
+	 * 	@var EE_Registry $_instance
16
+	 * 	@access 	private
17
+	 */
18 18
 	private static $_instance = NULL;
19 19
 
20 20
 
21 21
 	/**
22
-	* 	EE_Cart Object
23
-	* 	@access 	public
24
-	*	@var 	EE_Cart $CART
25
-	*/
22
+	 * 	EE_Cart Object
23
+	 * 	@access 	public
24
+	 *	@var 	EE_Cart $CART
25
+	 */
26 26
 	public $CART = NULL;
27 27
 
28 28
 	/**
29
-	* 	EE_Config Object
30
-	* 	@access 	public
31
-	*	@var 	EE_Config $CFG
32
-	*/
29
+	 * 	EE_Config Object
30
+	 * 	@access 	public
31
+	 *	@var 	EE_Config $CFG
32
+	 */
33 33
 	public $CFG = NULL;
34 34
 
35 35
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	/**
47
-	* 	StdClass object for storing library classes in
48
-	* 	@public LIB
49
-	*/
47
+	 * 	StdClass object for storing library classes in
48
+	 * 	@public LIB
49
+	 */
50 50
 	public $LIB = NULL;
51 51
 
52 52
 	/**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	public $REQ = NULL;
58 58
 
59 59
 	/**
60
-	* 	EE_Session Object
61
-	* 	@access 	public
62
-	* 	@var 	EE_Session	 $SSN
63
-	*/
60
+	 * 	EE_Session Object
61
+	 * 	@access 	public
62
+	 * 	@var 	EE_Session	 $SSN
63
+	 */
64 64
 	public $SSN = NULL;
65 65
 
66 66
 
@@ -127,21 +127,21 @@  discard block
 block discarded – undo
127 127
 
128 128
 
129 129
 	/**
130
-	* 	$i18n_js_strings - internationalization for JS strings
131
-	*  	usage:   EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' );
132
-	*  	in js file:  var translatedString = eei18n.string_key;
133
-	*
134
-	* 	@access 	public
135
-	*	@var 	array
136
-	*/
130
+	 * 	$i18n_js_strings - internationalization for JS strings
131
+	 *  	usage:   EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' );
132
+	 *  	in js file:  var translatedString = eei18n.string_key;
133
+	 *
134
+	 * 	@access 	public
135
+	 *	@var 	array
136
+	 */
137 137
 	public static $i18n_js_strings = array();
138 138
 
139 139
 	/**
140
-	* 	$main_file - path to espresso.php
141
-	*
142
-	* 	@access 	public
143
-	*	@var 	array
144
-	*/
140
+	 * 	$main_file - path to espresso.php
141
+	 *
142
+	 * 	@access 	public
143
+	 *	@var 	array
144
+	 */
145 145
 	public $main_file;
146 146
 
147 147
 
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -630,6 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * 	@access public
631 631
 	 * 	@static
632 632
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
633
+	 * @param string $table_name
633 634
 	 * 	@return array of database column names
634 635
 	 */
635 636
 	public static function get_fields_on_table( $table_name = NULL ) {
@@ -699,7 +700,7 @@  discard block
 block discarded – undo
699 700
 	 * @access public
700 701
 	 * @static
701 702
 	 * @throws EE_Error
702
-	 * @return boolean success (whether database is setup properly or not)
703
+	 * @return false|null success (whether database is setup properly or not)
703 704
 	 */
704 705
 	public static function create_database_tables() {
705 706
 		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
Please login to merge, or discard this patch.
Braces   +13 added lines, -9 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
  * Event Espresso
4 6
  *
@@ -217,7 +219,7 @@  discard block
 block discarded – undo
217 219
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
218 220
 		if($post_id){
219 221
 			return get_post($post_id);
220
-		}else{
222
+		} else{
221 223
 			return NULL;
222 224
 		}
223 225
 
@@ -382,7 +384,7 @@  discard block
 block discarded – undo
382 384
 		if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){
383 385
 			if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
384 386
 				$wpdb->query("DROP TABLE IF EXISTS $wp_table_name ");
385
-			}else{
387
+			} else{
386 388
 				//so we should be more cautious rather than just dropping tables so easily
387 389
 				EE_Error::add_persistent_admin_notice(
388 390
 						'bad_table_' . $wp_table_name . '_detected',
@@ -533,13 +535,13 @@  discard block
 block discarded – undo
533 535
 					foreach( $current_data_migration_script->get_errors() as $error ){
534 536
 						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
535 537
 					}
536
-				}else{
538
+				} else{
537 539
 					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
538 540
 				}
539 541
 				return FALSE;
540 542
 			}
541 543
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
542
-		}else{
544
+		} else{
543 545
 			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
544 546
 			return FALSE;
545 547
 		}
@@ -828,7 +830,7 @@  discard block
 block discarded – undo
828 830
 		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
829 831
 			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
830 832
 			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
831
-		}else{
833
+		} else{
832 834
 			EEM_Payment_Method::instance()->verify_button_urls();
833 835
 		}
834 836
 	}
@@ -977,7 +979,9 @@  discard block
 block discarded – undo
977 979
 		//do an initial loop to determine if we need to continue
978 980
 		$def_ms = array();
979 981
 		foreach ( $default_messengers as $msgr ) {
980
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
982
+			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) {
983
+				continue;
984
+			}
981 985
 			$def_ms[] = $msgr;
982 986
 		}
983 987
 
@@ -1303,7 +1307,7 @@  discard block
 block discarded – undo
1303 1307
 				if( ! delete_option( $option_name ) ){
1304 1308
 					$undeleted_options[] = $option_name;
1305 1309
 				}
1306
-			}else{
1310
+			} else{
1307 1311
 				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1308 1312
 				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1309 1313
 					if( ! delete_option( $option_name_from_wildcard ) ){
@@ -1369,7 +1373,7 @@  discard block
 block discarded – undo
1369 1373
 		$EZSQL_ERROR = $ezsql_error_cache;
1370 1374
 		if( empty( $new_error ) ){
1371 1375
 			return TRUE;
1372
-		}else{
1376
+		} else{
1373 1377
 			return FALSE;
1374 1378
 		}
1375 1379
 	}
Please login to merge, or discard this patch.
Spacing   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * be called on plugin activation and reactivation
48 48
 	 * @return boolean success, whether the database and folders are setup properly
49 49
 	 */
50
-	public static function initialize_db_and_folders(){
50
+	public static function initialize_db_and_folders() {
51 51
 		$good_filesystem = EEH_Activation::create_upload_directories();
52 52
 		$good_db = EEH_Activation::create_database_tables();
53 53
 		return $good_filesystem && $good_db;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * upon activation of a new plugin, reactivation, and at the end
60 60
 	 * of running migration scripts
61 61
 	 */
62
-	public static function initialize_db_content(){
62
+	public static function initialize_db_content() {
63 63
 		EEH_Activation::initialize_system_questions();
64 64
 		EEH_Activation::insert_default_status_codes();
65 65
 		EEH_Activation::generate_default_message_templates();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		EEH_Activation::validate_messages_system();
70 70
 		EEH_Activation::insert_default_payment_methods();
71 71
 		//also, check for CAF default db content
72
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
72
+		do_action('AHEE__EEH_Activation__initialize_db_content');
73 73
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
74 74
 		//which users really won't care about on initial activation
75 75
 		EE_Error::overwrite_success();
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public static function CPT_initialization() {
89 89
 		// register Custom Post Types
90
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
90
+		EE_Registry::instance()->load_core('Register_CPTs');
91 91
 		flush_rewrite_rules();
92 92
 	}
93 93
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public static function deactivate_event_espresso() {
105 105
 		// check permissions
106
-		if ( current_user_can( 'activate_plugins' )) {
107
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
106
+		if (current_user_can('activate_plugins')) {
107
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
108 108
 		}
109 109
 	}
110 110
 
@@ -126,79 +126,79 @@  discard block
 block discarded – undo
126 126
 		$critical_pages = array(
127 127
 			array(
128 128
 				'id' =>'reg_page_id',
129
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
129
+				'name' => __('Registration Checkout', 'event_espresso'),
130 130
 				'post' => NULL,
131 131
 				'code' => 'ESPRESSO_CHECKOUT'
132 132
 			),
133 133
 			array(
134 134
 				'id' => 'txn_page_id',
135
-				'name' => __( 'Transactions', 'event_espresso' ),
135
+				'name' => __('Transactions', 'event_espresso'),
136 136
 				'post' => NULL,
137 137
 				'code' => 'ESPRESSO_TXN_PAGE'
138 138
 			),
139 139
 			array(
140 140
 				'id' => 'thank_you_page_id',
141
-				'name' => __( 'Thank You', 'event_espresso' ),
141
+				'name' => __('Thank You', 'event_espresso'),
142 142
 				'post' => NULL,
143 143
 				'code' => 'ESPRESSO_THANK_YOU'
144 144
 			),
145 145
 			array(
146 146
 				'id' => 'cancel_page_id',
147
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
147
+				'name' => __('Registration Cancelled', 'event_espresso'),
148 148
 				'post' => NULL,
149 149
 				'code' => 'ESPRESSO_CANCELLED'
150 150
 			),
151 151
 		);
152 152
 
153
-		foreach ( $critical_pages as $critical_page ) {
153
+		foreach ($critical_pages as $critical_page) {
154 154
 			// is critical page ID set in config ?
155
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
155
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
156 156
 				// attempt to find post by ID
157
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
157
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
158 158
 			}
159 159
 			// no dice?
160
-			if ( $critical_page['post'] == NULL ) {
160
+			if ($critical_page['post'] == NULL) {
161 161
 				// attempt to find post by title
162
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
162
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
163 163
 				// still nothing?
164
-				if ( $critical_page['post'] == NULL ) {
165
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
164
+				if ($critical_page['post'] == NULL) {
165
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
166 166
 					// REALLY? Still nothing ??!?!?
167
-					if ( $critical_page['post'] == NULL ) {
168
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
169
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
167
+					if ($critical_page['post'] == NULL) {
168
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
169
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
170 170
 						break;
171 171
 					}
172 172
 				}
173 173
 			}
174 174
 			// track post_shortcodes
175
-			if ( $critical_page['post'] ) {
176
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
175
+			if ($critical_page['post']) {
176
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
177 177
 			}
178 178
 			// check that Post ID matches critical page ID in config
179
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
179
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
180 180
 				//update Config with post ID
181 181
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
182
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
183
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
184
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
182
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
183
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
184
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
185 185
 				}
186 186
 			}
187 187
 
188
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
188
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
189 189
 
190 190
 		}
191 191
 
192
-		if ( $critical_page_problem ) {
192
+		if ($critical_page_problem) {
193 193
 			$msg = sprintf(
194
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
195
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
194
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
195
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
196 196
 			);
197
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
197
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
198 198
 		}
199 199
 
200
-		if ( EE_Error::has_notices() ) {
201
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
200
+		if (EE_Error::has_notices()) {
201
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
202 202
 		}
203 203
 
204 204
 	}
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 	 * parameter to the shortcode
212 212
 	 * @return WP_Post or NULl
213 213
 	 */
214
-	public static function get_page_by_ee_shortcode($ee_shortcode){
214
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
215 215
 		global $wpdb;
216 216
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
217 217
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
218
-		if($post_id){
218
+		if ($post_id) {
219 219
 			return get_post($post_id);
220
-		}else{
220
+		} else {
221 221
 			return NULL;
222 222
 		}
223 223
 
@@ -234,32 +234,32 @@  discard block
 block discarded – undo
234 234
 	 * @param array $critical_page
235 235
 	 * @return array
236 236
 	 */
237
-	public static function create_critical_page( $critical_page ) {
237
+	public static function create_critical_page($critical_page) {
238 238
 
239 239
 		$post_args = array(
240 240
 			'post_title' => $critical_page['name'],
241 241
 			'post_status' => 'publish',
242 242
 			'post_type' => 'page',
243 243
 			'comment_status' => 'closed',
244
-			'post_content' => '[' . $critical_page['code'] . ']'
244
+			'post_content' => '['.$critical_page['code'].']'
245 245
 		);
246 246
 
247
-		$post_id = wp_insert_post( $post_args );
248
-		if ( ! $post_id ) {
247
+		$post_id = wp_insert_post($post_args);
248
+		if ( ! $post_id) {
249 249
 			$msg = sprintf(
250
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
250
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
251 251
 				$critical_page['name']
252 252
 			);
253
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
253
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
254 254
 			return $critical_page;
255 255
 		}
256 256
 		// get newly created post's details
257
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
257
+		if ( ! $critical_page['post'] = get_post($post_id)) {
258 258
 			$msg = sprintf(
259
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
259
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
260 260
 				$critical_page['name']
261 261
 			);
262
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
262
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
263 263
 		}
264 264
 
265 265
 		return $critical_page;
@@ -278,34 +278,34 @@  discard block
 block discarded – undo
278 278
 	 * @param array $critical_page
279 279
 	 * @return void
280 280
 	 */
281
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
281
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
282 282
 		// check the goods
283
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
283
+		if ( ! $critical_page['post'] instanceof WP_Post) {
284 284
 			$msg = sprintf(
285
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
285
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
286 286
 				$critical_page['name']
287 287
 			);
288
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
288
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
289 289
 			return;
290 290
 		}
291 291
 		// map shortcode to post
292
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
292
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
293 293
 		// and make sure it's NOT added to the WP "Posts Page"
294 294
 		// name of the WP Posts Page
295 295
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
296
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
297
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
296
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
297
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
298 298
 		}
299
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
300
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
299
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
300
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
301 301
 		}
302 302
 		// update post_shortcode CFG
303
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
303
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
304 304
 			$msg = sprintf(
305
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
305
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
306 306
 				$critical_page['name']
307 307
 			);
308
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
308
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
309 309
 		}
310 310
 	}
311 311
 
@@ -323,24 +323,24 @@  discard block
 block discarded – undo
323 323
 	public static function get_default_creator_id() {
324 324
 		global $wpdb;
325 325
 
326
-		if ( ! empty( self::$_default_creator_id ) ) {
326
+		if ( ! empty(self::$_default_creator_id)) {
327 327
 			return self::$_default_creator_id;
328 328
 		}/**/
329 329
 
330
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
330
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
331 331
 
332 332
 		//let's allow pre_filtering for early exits by altenative methods for getting id.  We check for truthy result and if so then exit early.
333
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
334
-		if ( $pre_filtered_id !== false ) {
333
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
334
+		if ($pre_filtered_id !== false) {
335 335
 			return (int) $pre_filtered_id;
336 336
 		}
337 337
 
338
-		$capabilities_key = $wpdb->prefix . 'capabilities';
339
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
340
-		$user_id = $wpdb->get_var( $query );
341
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
342
-		 if ( $user_id && intval( $user_id ) ) {
343
-		 	self::$_default_creator_id =  intval( $user_id );
338
+		$capabilities_key = $wpdb->prefix.'capabilities';
339
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
340
+		$user_id = $wpdb->get_var($query);
341
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
342
+		 if ($user_id && intval($user_id)) {
343
+		 	self::$_default_creator_id = intval($user_id);
344 344
 		 	return self::$_default_creator_id;
345 345
 		 } else {
346 346
 		 	return NULL;
@@ -367,26 +367,26 @@  discard block
 block discarded – undo
367 367
 	 * 	@return void
368 368
 	 * @throws EE_Error if there are database errors
369 369
 	 */
370
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ',$drop_table_if_pre_existed = false ) {
370
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_table_if_pre_existed = false) {
371 371
 //		echo "create table $table_name ". ($drop_table_if_pre_existed? 'but first nuke preexisting one' : 'or update it if it exists') . "<br>";//die;
372
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
372
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
373 373
 			return;
374 374
 		}
375
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
376
-		if ( ! function_exists( 'dbDelta' )) {
377
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
375
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
376
+		if ( ! function_exists('dbDelta')) {
377
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
378 378
 		}
379 379
 		global $wpdb;
380
-		$wp_table_name = $wpdb->prefix . $table_name;
380
+		$wp_table_name = $wpdb->prefix.$table_name;
381 381
 		//		if(in_array(EE_System::instance()->detect_req_type(),array(EE_System::req_type_new_activation,  EE_System::req_t) )
382
-		if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){
383
-			if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
382
+		if ($drop_table_if_pre_existed && EEH_Activation::table_exists($wp_table_name)) {
383
+			if (defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
384 384
 				$wpdb->query("DROP TABLE IF EXISTS $wp_table_name ");
385
-			}else{
385
+			} else {
386 386
 				//so we should be more cautious rather than just dropping tables so easily
387 387
 				EE_Error::add_persistent_admin_notice(
388
-						'bad_table_' . $wp_table_name . '_detected',
389
-						sprintf( __( 'Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
388
+						'bad_table_'.$wp_table_name.'_detected',
389
+						sprintf(__('Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
390 390
 								$wp_table_name,
391 391
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
392 392
 								'<b>wp-config.php</b>',
@@ -397,16 +397,16 @@  discard block
 block discarded – undo
397 397
 		$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
398 398
 		//get $wpdb to echo errors, but buffer them. This way at least WE know an error
399 399
 		//happened. And then we can choose to tell the end user
400
-		$old_show_errors_policy = $wpdb->show_errors( TRUE );
401
-		$old_error_supression_policy = $wpdb->suppress_errors( FALSE );
400
+		$old_show_errors_policy = $wpdb->show_errors(TRUE);
401
+		$old_error_supression_policy = $wpdb->suppress_errors(FALSE);
402 402
 		ob_start();
403
-		dbDelta( $SQL );
403
+		dbDelta($SQL);
404 404
 		$output = ob_get_contents();
405 405
 		ob_end_clean();
406
-		$wpdb->show_errors( $old_show_errors_policy );
407
-		$wpdb->suppress_errors( $old_error_supression_policy );
408
-		if( ! empty( $output ) ){
409
-			throw new EE_Error( $output	);
406
+		$wpdb->show_errors($old_show_errors_policy);
407
+		$wpdb->suppress_errors($old_error_supression_policy);
408
+		if ( ! empty($output)) {
409
+			throw new EE_Error($output);
410 410
 		}
411 411
 	}
412 412
 
@@ -423,15 +423,15 @@  discard block
 block discarded – undo
423 423
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
424 424
 	 * @return bool|int
425 425
 	 */
426
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
427
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
426
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
427
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
428 428
 			return FALSE;
429 429
 		}
430 430
 		global $wpdb;
431
-		$full_table_name=$wpdb->prefix.$table_name;
431
+		$full_table_name = $wpdb->prefix.$table_name;
432 432
 		$fields = self::get_fields_on_table($table_name);
433
-		if (!in_array($column_name, $fields)){
434
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
433
+		if ( ! in_array($column_name, $fields)) {
434
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
435 435
 			//echo "alter query:$alter_query";
436 436
 			return $wpdb->query($alter_query);
437 437
 		}
@@ -450,15 +450,15 @@  discard block
 block discarded – undo
450 450
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
451 451
 	 * 	@return array of database column names
452 452
 	 */
453
-	public static function get_fields_on_table( $table_name = NULL ) {
453
+	public static function get_fields_on_table($table_name = NULL) {
454 454
 		global $wpdb;
455
-		$table_name=$wpdb->prefix.$table_name;
456
-		if ( ! empty( $table_name )) {
455
+		$table_name = $wpdb->prefix.$table_name;
456
+		if ( ! empty($table_name)) {
457 457
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
458 458
 			if ($columns !== FALSE) {
459 459
 				$field_array = array();
460
-				foreach($columns as $column ){
461
-					$field_array[] = $column->Field;;
460
+				foreach ($columns as $column) {
461
+					$field_array[] = $column->Field; ;
462 462
 				}
463 463
 				return $field_array;
464 464
 			}
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
 	 * @param string $table_name
477 477
 	 * @return bool | int
478 478
 	 */
479
-	public static function delete_unused_db_table( $table_name ) {
479
+	public static function delete_unused_db_table($table_name) {
480 480
 		global $wpdb;
481
-		$table_name = strpos( $table_name, $wpdb->prefix ) === FALSE ? $wpdb->prefix . $table_name : $table_name;
482
-		return $wpdb->query( 'DROP TABLE IF EXISTS '. $table_name );
481
+		$table_name = strpos($table_name, $wpdb->prefix) === FALSE ? $wpdb->prefix.$table_name : $table_name;
482
+		return $wpdb->query('DROP TABLE IF EXISTS '.$table_name);
483 483
 	}
484 484
 
485 485
 
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 	 * @param string $index_name
494 494
 	 * @return bool | int
495 495
 	 */
496
-	public static function drop_index( $table_name, $index_name ) {
497
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
496
+	public static function drop_index($table_name, $index_name) {
497
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
498 498
 			return FALSE;
499 499
 		}
500 500
 		global $wpdb;
501
-		$table_name_with_prefix = $wpdb->prefix . $table_name ;
501
+		$table_name_with_prefix = $wpdb->prefix.$table_name;
502 502
 		$index_exists_query = "SHOW INDEX FROM $table_name_with_prefix WHERE Key_name = '$index_name'";
503 503
 		if (
504
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name_with_prefix'" ) == $wpdb->prefix . $table_name
505
-			&& $wpdb->get_var( $index_exists_query ) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name
504
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name_with_prefix'") == $wpdb->prefix.$table_name
505
+			&& $wpdb->get_var($index_exists_query) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name
506 506
 		) {
507
-			return $wpdb->query( "ALTER TABLE $table_name_with_prefix DROP INDEX $index_name" );
507
+			return $wpdb->query("ALTER TABLE $table_name_with_prefix DROP INDEX $index_name");
508 508
 		}
509 509
 		return TRUE;
510 510
 	}
@@ -520,27 +520,27 @@  discard block
 block discarded – undo
520 520
 	 * @return boolean success (whether database is setup properly or not)
521 521
 	 */
522 522
 	public static function create_database_tables() {
523
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
523
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
524 524
 		//find the migration script that sets the database to be compatible with the code
525 525
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
526
-		if( $dms_name ){
527
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
528
-			$current_data_migration_script->set_migrating( FALSE );
526
+		if ($dms_name) {
527
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
528
+			$current_data_migration_script->set_migrating(FALSE);
529 529
 			$current_data_migration_script->schema_changes_before_migration();
530 530
 			$current_data_migration_script->schema_changes_after_migration();
531
-			if( $current_data_migration_script->get_errors() ){
532
-				if( WP_DEBUG ){
533
-					foreach( $current_data_migration_script->get_errors() as $error ){
534
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
531
+			if ($current_data_migration_script->get_errors()) {
532
+				if (WP_DEBUG) {
533
+					foreach ($current_data_migration_script->get_errors() as $error) {
534
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
535 535
 					}
536
-				}else{
537
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
536
+				} else {
537
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
538 538
 				}
539 539
 				return FALSE;
540 540
 			}
541 541
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
542
-		}else{
543
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
542
+		} else {
543
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
544 544
 			return FALSE;
545 545
 		}
546 546
 	}
@@ -559,26 +559,26 @@  discard block
 block discarded – undo
559 559
 	public static function initialize_system_questions() {
560 560
 		// QUESTION GROUPS
561 561
 		global $wpdb;
562
-		$SQL = 'SELECT QSG_system FROM ' . $wpdb->prefix . 'esp_question_group WHERE QSG_system != 0';
562
+		$SQL = 'SELECT QSG_system FROM '.$wpdb->prefix.'esp_question_group WHERE QSG_system != 0';
563 563
 		// what we have
564
-		$question_groups = $wpdb->get_col( $SQL );
564
+		$question_groups = $wpdb->get_col($SQL);
565 565
 		// check the response
566
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
566
+		$question_groups = is_array($question_groups) ? $question_groups : array();
567 567
 		// what we should have
568
-		$QSG_systems = array( 1, 2 );
568
+		$QSG_systems = array(1, 2);
569 569
 		// loop thru what we should have and compare to what we have
570
-		foreach ( $QSG_systems as $QSG_system ) {
570
+		foreach ($QSG_systems as $QSG_system) {
571 571
 			// reset values array
572 572
 			$QSG_values = array();
573 573
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
574
-			if ( ! in_array( "$QSG_system", $question_groups )) {
574
+			if ( ! in_array("$QSG_system", $question_groups)) {
575 575
 				// add it
576
-				switch ( $QSG_system ) {
576
+				switch ($QSG_system) {
577 577
 
578 578
 					case 1:
579 579
 							$QSG_values = array(
580
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
581
-									'QSG_identifier' => 'personal-information-' . time(),
580
+									'QSG_name' => __('Personal Information', 'event_espresso'),
581
+									'QSG_identifier' => 'personal-information-'.time(),
582 582
 									'QSG_desc' => '',
583 583
 									'QSG_order' => 1,
584 584
 									'QSG_show_group_name' => 1,
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 
591 591
 					case 2:
592 592
 							$QSG_values = array(
593
-									'QSG_name' => __( 'Address Information','event_espresso' ),
594
-									'QSG_identifier' => 'address-information-' . time(),
593
+									'QSG_name' => __('Address Information', 'event_espresso'),
594
+									'QSG_identifier' => 'address-information-'.time(),
595 595
 									'QSG_desc' => '',
596 596
 									'QSG_order' => 2,
597 597
 									'QSG_show_group_name' => 1,
@@ -603,14 +603,14 @@  discard block
 block discarded – undo
603 603
 
604 604
 				}
605 605
 				// make sure we have some values before inserting them
606
-				if ( ! empty( $QSG_values )) {
606
+				if ( ! empty($QSG_values)) {
607 607
 					// insert system question
608 608
 					$wpdb->insert(
609
-						$wpdb->prefix . 'esp_question_group',
609
+						$wpdb->prefix.'esp_question_group',
610 610
 						$QSG_values,
611
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
611
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
612 612
 					);
613
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
613
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
614 614
 				}
615 615
 			}
616 616
 		}
@@ -619,9 +619,9 @@  discard block
 block discarded – undo
619 619
 
620 620
 		// QUESTIONS
621 621
 		global $wpdb;
622
-		$SQL = 'SELECT QST_system FROM ' . $wpdb->prefix . "esp_question WHERE QST_system != ''";
622
+		$SQL = 'SELECT QST_system FROM '.$wpdb->prefix."esp_question WHERE QST_system != ''";
623 623
 		// what we have
624
-		$questions = $wpdb->get_col( $SQL );
624
+		$questions = $wpdb->get_col($SQL);
625 625
 		// what we should have
626 626
 		$QST_systems = array(
627 627
 			'fname',
@@ -638,22 +638,22 @@  discard block
 block discarded – undo
638 638
 		$order_for_group_1 = 1;
639 639
 		$order_for_group_2 = 1;
640 640
 		// loop thru what we should have and compare to what we have
641
-		foreach ( $QST_systems as $QST_system ) {
641
+		foreach ($QST_systems as $QST_system) {
642 642
 			// reset values array
643 643
 			$QST_values = array();
644 644
 			// if we don't have what we should have
645
-			if ( ! in_array( $QST_system, $questions )) {
645
+			if ( ! in_array($QST_system, $questions)) {
646 646
 				// add it
647
-				switch ( $QST_system ) {
647
+				switch ($QST_system) {
648 648
 
649 649
 					case 'fname':
650 650
 							$QST_values = array(
651
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
652
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
651
+									'QST_display_text' => __('First Name', 'event_espresso'),
652
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
653 653
 									'QST_system' => 'fname',
654 654
 									'QST_type' => 'TEXT',
655 655
 									'QST_required' => 1,
656
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
656
+									'QST_required_text' => __('This field is required', 'event_espresso'),
657 657
 									'QST_order' => 1,
658 658
 									'QST_admin_only' => 0,
659 659
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -663,12 +663,12 @@  discard block
 block discarded – undo
663 663
 
664 664
 					case 'lname':
665 665
 							$QST_values = array(
666
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
667
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
666
+									'QST_display_text' => __('Last Name', 'event_espresso'),
667
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
668 668
 									'QST_system' => 'lname',
669 669
 									'QST_type' => 'TEXT',
670 670
 									'QST_required' => 1,
671
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
671
+									'QST_required_text' => __('This field is required', 'event_espresso'),
672 672
 									'QST_order' => 2,
673 673
 									'QST_admin_only' => 0,
674 674
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -678,12 +678,12 @@  discard block
 block discarded – undo
678 678
 
679 679
 					case 'email':
680 680
 							$QST_values = array(
681
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
682
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
681
+									'QST_display_text' => __('Email Address', 'event_espresso'),
682
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
683 683
 									'QST_system' => 'email',
684 684
 									'QST_type' => 'TEXT',
685 685
 									'QST_required' => 1,
686
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
686
+									'QST_required_text' => __('This field is required', 'event_espresso'),
687 687
 									'QST_order' => 3,
688 688
 									'QST_admin_only' => 0,
689 689
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
 
694 694
 					case 'address':
695 695
 							$QST_values = array(
696
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
697
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
696
+									'QST_display_text' => __('Address', 'event_espresso'),
697
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
698 698
 									'QST_system' => 'address',
699 699
 									'QST_type' => 'TEXT',
700 700
 									'QST_required' => 0,
701
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
701
+									'QST_required_text' => __('This field is required', 'event_espresso'),
702 702
 									'QST_order' => 4,
703 703
 									'QST_admin_only' => 0,
704 704
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -708,12 +708,12 @@  discard block
 block discarded – undo
708 708
 
709 709
 					case 'address2':
710 710
 							$QST_values = array(
711
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
712
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
711
+									'QST_display_text' => __('Address2', 'event_espresso'),
712
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
713 713
 									'QST_system' => 'address2',
714 714
 									'QST_type' => 'TEXT',
715 715
 									'QST_required' => 0,
716
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
716
+									'QST_required_text' => __('This field is required', 'event_espresso'),
717 717
 									'QST_order' => 5,
718 718
 									'QST_admin_only' => 0,
719 719
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -723,12 +723,12 @@  discard block
 block discarded – undo
723 723
 
724 724
 					case 'city':
725 725
 							$QST_values = array(
726
-									'QST_display_text' => __( 'City', 'event_espresso' ),
727
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
726
+									'QST_display_text' => __('City', 'event_espresso'),
727
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
728 728
 									'QST_system' => 'city',
729 729
 									'QST_type' => 'TEXT',
730 730
 									'QST_required' => 0,
731
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
731
+									'QST_required_text' => __('This field is required', 'event_espresso'),
732 732
 									'QST_order' => 6,
733 733
 									'QST_admin_only' => 0,
734 734
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 
739 739
 					case 'state':
740 740
 							$QST_values = array(
741
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
742
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
741
+									'QST_display_text' => __('State/Province', 'event_espresso'),
742
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
743 743
 									'QST_system' => 'state',
744 744
 									'QST_type' => 'STATE',
745 745
 									'QST_required' => 0,
746
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
746
+									'QST_required_text' => __('This field is required', 'event_espresso'),
747 747
 									'QST_order' => 7,
748 748
 									'QST_admin_only' => 0,
749 749
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -753,12 +753,12 @@  discard block
 block discarded – undo
753 753
 
754 754
 					case 'country' :
755 755
 							$QST_values = array(
756
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
757
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
756
+									'QST_display_text' => __('Country', 'event_espresso'),
757
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
758 758
 									'QST_system' => 'country',
759 759
 									'QST_type' => 'COUNTRY',
760 760
 									'QST_required' => 0,
761
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
761
+									'QST_required_text' => __('This field is required', 'event_espresso'),
762 762
 									'QST_order' => 8,
763 763
 									'QST_admin_only' => 0,
764 764
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -768,12 +768,12 @@  discard block
 block discarded – undo
768 768
 
769 769
 					case 'zip':
770 770
 							$QST_values = array(
771
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
772
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
771
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
772
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
773 773
 									'QST_system' => 'zip',
774 774
 									'QST_type' => 'TEXT',
775 775
 									'QST_required' => 0,
776
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
776
+									'QST_required_text' => __('This field is required', 'event_espresso'),
777 777
 									'QST_order' => 9,
778 778
 									'QST_admin_only' => 0,
779 779
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -783,12 +783,12 @@  discard block
 block discarded – undo
783 783
 
784 784
 					case 'phone':
785 785
 							$QST_values = array(
786
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
787
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
786
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
787
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
788 788
 									'QST_system' => 'phone',
789 789
 									'QST_type' => 'TEXT',
790 790
 									'QST_required' => 0,
791
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
791
+									'QST_required_text' => __('This field is required', 'event_espresso'),
792 792
 									'QST_order' => 10,
793 793
 									'QST_admin_only' => 0,
794 794
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -797,22 +797,22 @@  discard block
 block discarded – undo
797 797
 						break;
798 798
 
799 799
 				}
800
-				if ( ! empty( $QST_values )) {
800
+				if ( ! empty($QST_values)) {
801 801
 					// insert system question
802 802
 					$wpdb->insert(
803
-						$wpdb->prefix . 'esp_question',
803
+						$wpdb->prefix.'esp_question',
804 804
 						$QST_values,
805
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
805
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
806 806
 					);
807 807
 					$QST_ID = $wpdb->insert_id;
808 808
 
809 809
 					// QUESTION GROUP QUESTIONS
810
-					$QSG_ID = in_array( $QST_system, array('fname','lname','email')) ? 1 : 2;
810
+					$QSG_ID = in_array($QST_system, array('fname', 'lname', 'email')) ? 1 : 2;
811 811
 					// add system questions to groups
812 812
 					$wpdb->insert(
813
-						$wpdb->prefix . 'esp_question_group_question',
814
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
815
-						array( '%d', '%d','%d' )
813
+						$wpdb->prefix.'esp_question_group_question',
814
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
815
+						array('%d', '%d', '%d')
816 816
 					);
817 817
 				}
818 818
 			}
@@ -824,11 +824,11 @@  discard block
 block discarded – undo
824 824
 	 * Makes sure the default payment method (Invoice) is active.
825 825
 	 * This used to be done automatically as part of constructing the old gateways config
826 826
 	 */
827
-	public static function insert_default_payment_methods(){
828
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
829
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
830
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
831
-		}else{
827
+	public static function insert_default_payment_methods() {
828
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
829
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
830
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
831
+		} else {
832 832
 			EEM_Payment_Method::instance()->verify_button_urls();
833 833
 		}
834 834
 	}
@@ -844,12 +844,12 @@  discard block
 block discarded – undo
844 844
 
845 845
 		global $wpdb;
846 846
 
847
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
847
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
848 848
 
849
-			$SQL = "DELETE FROM " . EEM_Status::instance()->table() . " WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );";
849
+			$SQL = "DELETE FROM ".EEM_Status::instance()->table()." WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );";
850 850
 			$wpdb->query($SQL);
851 851
 
852
-			$SQL = "INSERT INTO " . EEM_Status::instance()->table() . "
852
+			$SQL = "INSERT INTO ".EEM_Status::instance()->table()."
853 853
 					(STS_ID, STS_code, STS_type, STS_can_edit, STS_desc, STS_open) VALUES
854 854
 					('ACT', 'ACTIVE', 'event', 0, NULL, 1),
855 855
 					('NAC', 'NOT_ACTIVE', 'event', 0, NULL, 0),
@@ -908,26 +908,26 @@  discard block
 block discarded – undo
908 908
 	 * 	@return boolean success of verifying upload directories exist
909 909
 	 */
910 910
 	public static function create_upload_directories() {
911
-		EE_Registry::instance()->load_helper( 'File' );
911
+		EE_Registry::instance()->load_helper('File');
912 912
 		// Create the required folders
913 913
 		$folders = array(
914 914
 				EVENT_ESPRESSO_UPLOAD_DIR,
915 915
 				EVENT_ESPRESSO_TEMPLATE_DIR,
916 916
 				EVENT_ESPRESSO_GATEWAY_DIR,
917
-				EVENT_ESPRESSO_UPLOAD_DIR . '/logs/',
918
-				EVENT_ESPRESSO_UPLOAD_DIR . '/css/',
919
-				EVENT_ESPRESSO_UPLOAD_DIR . '/tickets/'
917
+				EVENT_ESPRESSO_UPLOAD_DIR.'/logs/',
918
+				EVENT_ESPRESSO_UPLOAD_DIR.'/css/',
919
+				EVENT_ESPRESSO_UPLOAD_DIR.'/tickets/'
920 920
 		);
921
-		foreach ( $folders as $folder ) {
921
+		foreach ($folders as $folder) {
922 922
 			try {
923
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
924
-				@ chmod( $folder, 0755 );
925
-			} catch( EE_Error $e ){
923
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
924
+				@ chmod($folder, 0755);
925
+			} catch (EE_Error $e) {
926 926
 				EE_Error::add_error(
927 927
 					sprintf(
928
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
928
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
929 929
 						$folder,
930
-						'<br />' . $e->getMessage()
930
+						'<br />'.$e->getMessage()
931 931
 					),
932 932
 					__FILE__, __FUNCTION__, __LINE__
933 933
 				);
@@ -953,16 +953,16 @@  discard block
 block discarded – undo
953 953
 		$settings = $installed_messengers = $default_messengers = array();
954 954
 
955 955
 		//include our helper
956
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
956
+		EE_Registry::instance()->load_helper('MSG_Template');
957 957
 
958 958
 		//get all installed messenger objects
959 959
 		$installed = EEH_MSG_Template::get_installed_message_objects();
960 960
 
961 961
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
962
-		foreach ( $installed['messengers'] as $msgr ) {
963
-			if ( $msgr instanceof EE_messenger ) {
962
+		foreach ($installed['messengers'] as $msgr) {
963
+			if ($msgr instanceof EE_messenger) {
964 964
 				$installed_messengers[$msgr->name] = $msgr;
965
-				if ( $msgr->activate_on_install ) {
965
+				if ($msgr->activate_on_install) {
966 966
 					$default_messengers[] = $msgr->name;
967 967
 				}
968 968
 			}
@@ -972,36 +972,36 @@  discard block
 block discarded – undo
972 972
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
973 973
 
974 974
 		//things that have already been activated before
975
-		$has_activated = get_option( 'ee_has_activated_messenger' );
975
+		$has_activated = get_option('ee_has_activated_messenger');
976 976
 
977 977
 		//do an initial loop to determine if we need to continue
978 978
 		$def_ms = array();
979
-		foreach ( $default_messengers as $msgr ) {
980
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
979
+		foreach ($default_messengers as $msgr) {
980
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
981 981
 			$def_ms[] = $msgr;
982 982
 		}
983 983
 
984 984
 		//setup the $installed_mts in an array
985
-		foreach ( $installed['message_types'] as $imt ) {
986
-			if ( $imt instanceof EE_message_type ) {
985
+		foreach ($installed['message_types'] as $imt) {
986
+			if ($imt instanceof EE_message_type) {
987 987
 				$installed_mts[$imt->name] = $imt;
988 988
 			}
989 989
 		}
990 990
 
991 991
 		//loop through default array for default messengers (if present)
992
-		if ( ! empty( $def_ms ) ) {
993
-			foreach ( $def_ms as $messenger ) {
992
+		if ( ! empty($def_ms)) {
993
+			foreach ($def_ms as $messenger) {
994 994
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
995
-				if ( ! isset( $installed_messengers[$messenger] )) {
995
+				if ( ! isset($installed_messengers[$messenger])) {
996 996
 					continue;
997 997
 				}
998 998
 				/** @var EE_messenger[] $installed_messengers  */
999 999
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1000 1000
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1001
-				foreach ( $default_mts as $index => $mt ) {
1001
+				foreach ($default_mts as $index => $mt) {
1002 1002
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1003
-					if ( ! isset( $installed_mts[$mt] ) ) {
1004
-						unset( $default_mts[$index] );
1003
+					if ( ! isset($installed_mts[$mt])) {
1004
+						unset($default_mts[$index]);
1005 1005
 						continue;
1006 1006
 					}
1007 1007
 
@@ -1010,41 +1010,41 @@  discard block
 block discarded – undo
1010 1010
 					/** @var EE_message_type[] $installed_mts */
1011 1011
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1012 1012
 					$settings = array();
1013
-					if ( is_array( $settings_fields ) ) {
1014
-						foreach ( $settings_fields as $field => $values ) {
1015
-							if ( isset( $values['default'] ) ) {
1013
+					if (is_array($settings_fields)) {
1014
+						foreach ($settings_fields as $field => $values) {
1015
+							if (isset($values['default'])) {
1016 1016
 								$settings[$field] = $values['default'];
1017 1017
 							}
1018 1018
 						}
1019 1019
 					}
1020 1020
 
1021
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1021
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1022 1022
 					$has_activated[$messenger][] = $mt;
1023 1023
 				}
1024 1024
 
1025 1025
 				//setup any initial settings for the messenger
1026 1026
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1027 1027
 
1028
-				if ( !empty( $msgr_settings ) ) {
1029
-					foreach ( $msgr_settings as $field => $value ) {
1028
+				if ( ! empty($msgr_settings)) {
1029
+					foreach ($msgr_settings as $field => $value) {
1030 1030
 						$active_messengers[$messenger]['settings'][$field] = $value;
1031 1031
 					}
1032 1032
 				}
1033 1033
 
1034 1034
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1035
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1035
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1036 1036
 
1037 1037
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1038
-				if ( !empty( $default_mts ) ) {
1039
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1038
+				if ( ! empty($default_mts)) {
1039
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1040 1040
 				}
1041 1041
 			}
1042 1042
 		} //end check for empty( $def_ms )
1043 1043
 
1044 1044
 		//still need to see if there are any message types to activate for active messengers
1045
-		foreach ( $active_messengers as $messenger => $settings ) {
1045
+		foreach ($active_messengers as $messenger => $settings) {
1046 1046
 			$msg_obj = $settings['obj'];
1047
-			if ( ! $msg_obj instanceof EE_messenger ) {
1047
+			if ( ! $msg_obj instanceof EE_messenger) {
1048 1048
 				continue;
1049 1049
 			}
1050 1050
 
@@ -1052,45 +1052,45 @@  discard block
 block discarded – undo
1052 1052
 			$new_default_mts = array();
1053 1053
 
1054 1054
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1055
-			foreach( $all_default_mts as $index => $mt ) {
1055
+			foreach ($all_default_mts as $index => $mt) {
1056 1056
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1057
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1057
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1058 1058
 					continue;
1059 1059
 				}
1060 1060
 
1061 1061
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1062
-				if ( ! isset( $installed_mts[$mt] ) ) {
1063
-					unset( $all_default_mts[$mt] );
1062
+				if ( ! isset($installed_mts[$mt])) {
1063
+					unset($all_default_mts[$mt]);
1064 1064
 					continue;
1065 1065
 				}
1066 1066
 
1067 1067
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1068 1068
 				$settings = array();
1069
-				if ( is_array( $settings_fields ) ) {
1070
-					foreach ( $settings_fields as $field => $values ) {
1071
-						if ( isset( $values['default'] ) ) {
1069
+				if (is_array($settings_fields)) {
1070
+					foreach ($settings_fields as $field => $values) {
1071
+						if (isset($values['default'])) {
1072 1072
 							$settings[$field] = $values['default'];
1073 1073
 						}
1074 1074
 					}
1075 1075
 				}
1076 1076
 
1077
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1077
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1078 1078
 				$new_default_mts[] = $mt;
1079 1079
 				$has_activated[$messenger][] = $mt;
1080 1080
 			}
1081 1081
 
1082 1082
 
1083
-			if ( ! empty( $new_default_mts ) ) {
1084
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1083
+			if ( ! empty($new_default_mts)) {
1084
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1085 1085
 			}
1086 1086
 
1087 1087
 		}
1088 1088
 
1089 1089
 		//now let's save the settings for this messenger!
1090
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1090
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1091 1091
 
1092 1092
 		//update $has_activated record
1093
-		update_option( 'ee_has_activated_messenger', $has_activated );
1093
+		update_option('ee_has_activated_messenger', $has_activated);
1094 1094
 
1095 1095
 		//that's it!
1096 1096
 		return $success;
@@ -1110,47 +1110,47 @@  discard block
 block discarded – undo
1110 1110
 	 */
1111 1111
 	public static function validate_messages_system() {
1112 1112
 		//include our helper
1113
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1113
+		EE_Registry::instance()->load_helper('MSG_Template');
1114 1114
 
1115 1115
 		//get active and installed  messengers/message types.
1116 1116
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1117 1117
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1118 1118
 		$installed_messengers = $installed_mts = array();
1119 1119
 		//set up the arrays so they can be handled easier.
1120
-		foreach( $installed['messengers'] as $im ) {
1121
-			if ( $im instanceof EE_messenger ) {
1120
+		foreach ($installed['messengers'] as $im) {
1121
+			if ($im instanceof EE_messenger) {
1122 1122
 				$installed_messengers[$im->name] = $im;
1123 1123
 			}
1124 1124
 		}
1125
-		foreach( $installed['message_types'] as $imt ) {
1126
-			if ( $imt instanceof EE_message_type ) {
1125
+		foreach ($installed['message_types'] as $imt) {
1126
+			if ($imt instanceof EE_message_type) {
1127 1127
 				$installed_mts[$imt->name] = $imt;
1128 1128
 			}
1129 1129
 		}
1130 1130
 
1131 1131
 		//now let's loop through the active array and validate
1132
-		foreach( $active_messengers as $messenger => $active_details ) {
1132
+		foreach ($active_messengers as $messenger => $active_details) {
1133 1133
 			//first let's see if this messenger is installed.
1134
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1134
+			if ( ! isset($installed_messengers[$messenger])) {
1135 1135
 				//not set so let's just remove from actives and make sure templates are inactive.
1136
-				unset( $active_messengers[$messenger] );
1137
-				EEH_MSG_Template::update_to_inactive( $messenger );
1136
+				unset($active_messengers[$messenger]);
1137
+				EEH_MSG_Template::update_to_inactive($messenger);
1138 1138
 				continue;
1139 1139
 			}
1140 1140
 
1141 1141
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1142
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1143
-			foreach ( $mts as $mt_name => $mt ) {
1144
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1145
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1146
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1142
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1143
+			foreach ($mts as $mt_name => $mt) {
1144
+				if ( ! isset($installed_mts[$mt_name])) {
1145
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1146
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1147 1147
 				}
1148 1148
 			}
1149 1149
 		}
1150 1150
 
1151 1151
 		//all done! let's update the active_messengers.
1152
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1153
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1152
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1153
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1154 1154
 		return;
1155 1155
 	}
1156 1156
 
@@ -1164,12 +1164,12 @@  discard block
 block discarded – undo
1164 1164
 	 * 	@static
1165 1165
 	 * 	@return void
1166 1166
 	 */
1167
-	public static function create_no_ticket_prices_array(){
1167
+	public static function create_no_ticket_prices_array() {
1168 1168
 		// this creates an array for tracking events that have no active ticket prices created
1169 1169
 		// this allows us to warn admins of the situation so that it can be corrected
1170
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1171
-		if ( ! $espresso_no_ticket_prices ) {
1172
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1170
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1171
+		if ( ! $espresso_no_ticket_prices) {
1172
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1173 1173
 		}
1174 1174
 	}
1175 1175
 
@@ -1191,24 +1191,24 @@  discard block
 block discarded – undo
1191 1191
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1192 1192
 	 * @global wpdb $wpdb
1193 1193
 	 */
1194
-	public static function delete_all_espresso_cpt_data(){
1194
+	public static function delete_all_espresso_cpt_data() {
1195 1195
 		global $wpdb;
1196 1196
 		//get all the CPT post_types
1197 1197
 		$ee_post_types = array();
1198
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1199
-			if ( method_exists( $model_name, 'instance' )) {
1200
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1201
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1202
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1198
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1199
+			if (method_exists($model_name, 'instance')) {
1200
+				$model_obj = call_user_func(array($model_name, 'instance'));
1201
+				if ($model_obj instanceof EEM_CPT_Base) {
1202
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1203 1203
 				}
1204 1204
 			}
1205 1205
 		}
1206 1206
 		//get all our CPTs
1207
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1207
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1208 1208
 		$cpt_ids = $wpdb->get_col($query);
1209 1209
 		//delete each post meta and term relations too
1210
-		foreach($cpt_ids as $post_id){
1211
-			wp_delete_post($post_id,true);
1210
+		foreach ($cpt_ids as $post_id) {
1211
+			wp_delete_post($post_id, true);
1212 1212
 		}
1213 1213
 	}
1214 1214
 
@@ -1222,18 +1222,18 @@  discard block
 block discarded – undo
1222 1222
 	 * @param bool $remove_all
1223 1223
 	 * @return void
1224 1224
 	 */
1225
-	public static function delete_all_espresso_tables_and_data( $remove_all = TRUE ) { // FALSE
1225
+	public static function delete_all_espresso_tables_and_data($remove_all = TRUE) { // FALSE
1226 1226
 		global $wpdb;
1227 1227
 		$undeleted_tables = array();
1228 1228
 
1229 1229
 		// load registry
1230
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1231
-			if ( method_exists( $model_name, 'instance' )) {
1232
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1233
-				if ( $model_obj instanceof EEM_Base ) {
1234
-					foreach ( $model_obj->get_tables() as $table ) {
1235
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1236
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1230
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1231
+			if (method_exists($model_name, 'instance')) {
1232
+				$model_obj = call_user_func(array($model_name, 'instance'));
1233
+				if ($model_obj instanceof EEM_Base) {
1234
+					foreach ($model_obj->get_tables() as $table) {
1235
+						if (strpos($table->get_table_name(), 'esp_')) {
1236
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1237 1237
 								case FALSE :
1238 1238
 									$undeleted_tables[] = $table->get_table_name();
1239 1239
 								break;
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 			'wp_esp_promotion_rule',
1259 1259
 			'wp_esp_rule'
1260 1260
 		);
1261
-		foreach( $tables_without_models as $table ){
1262
-			EEH_Activation::delete_unused_db_table( $table );
1261
+		foreach ($tables_without_models as $table) {
1262
+			EEH_Activation::delete_unused_db_table($table);
1263 1263
 		}
1264 1264
 
1265 1265
 
@@ -1295,51 +1295,51 @@  discard block
 block discarded – undo
1295 1295
 		);
1296 1296
 
1297 1297
 		$undeleted_options = array();
1298
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1298
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1299 1299
 
1300
-			if( $no_wildcard ){
1301
-				if( ! delete_option( $option_name ) ){
1300
+			if ($no_wildcard) {
1301
+				if ( ! delete_option($option_name)) {
1302 1302
 					$undeleted_options[] = $option_name;
1303 1303
 				}
1304
-			}else{
1305
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1306
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1307
-					if( ! delete_option( $option_name_from_wildcard ) ){
1304
+			} else {
1305
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1306
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1307
+					if ( ! delete_option($option_name_from_wildcard)) {
1308 1308
 						$undeleted_options[] = $option_name_from_wildcard;
1309 1309
 					}
1310 1310
 				}
1311 1311
 			}
1312 1312
 		}
1313 1313
 
1314
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1314
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1315 1315
 			$db_update_sans_ee4 = array();
1316
-			foreach($espresso_db_update as $version => $times_activated){
1317
-				if( $version[0] =='3'){//if its NON EE4
1316
+			foreach ($espresso_db_update as $version => $times_activated) {
1317
+				if ($version[0] == '3') {//if its NON EE4
1318 1318
 					$db_update_sans_ee4[$version] = $times_activated;
1319 1319
 				}
1320 1320
 			}
1321
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1321
+			update_option('espresso_db_update', $db_update_sans_ee4);
1322 1322
 		}
1323 1323
 
1324 1324
 		$errors = '';
1325
-		if ( ! empty( $undeleted_tables )) {
1325
+		if ( ! empty($undeleted_tables)) {
1326 1326
 			$errors .= sprintf(
1327
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1327
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1328 1328
 				'<br/>',
1329
-				implode( ',<br/>', $undeleted_tables )
1329
+				implode(',<br/>', $undeleted_tables)
1330 1330
 			);
1331 1331
 		}
1332
-		if ( ! empty( $undeleted_options )) {
1333
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1332
+		if ( ! empty($undeleted_options)) {
1333
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1334 1334
 			$errors .= sprintf(
1335
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1335
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1336 1336
 				'<br/>',
1337
-				implode( ',<br/>', $undeleted_options )
1337
+				implode(',<br/>', $undeleted_options)
1338 1338
 			);
1339 1339
 
1340 1340
 		}
1341
-		if ( $errors != '' ) {
1342
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1341
+		if ($errors != '') {
1342
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1343 1343
 		}
1344 1344
 	}
1345 1345
 
@@ -1349,25 +1349,25 @@  discard block
 block discarded – undo
1349 1349
 	 * @param string $table_name with or without $wpdb->prefix
1350 1350
 	 * @return boolean
1351 1351
 	 */
1352
-	public static function table_exists( $table_name ){
1352
+	public static function table_exists($table_name) {
1353 1353
 		global $wpdb, $EZSQL_ERROR;
1354
-		if(strpos($table_name, $wpdb->prefix) !== 0){
1354
+		if (strpos($table_name, $wpdb->prefix) !== 0) {
1355 1355
 			$table_name = $wpdb->prefix.$table_name;
1356 1356
 		}
1357 1357
 		//ignore if this causes an sql error
1358 1358
 		$old_error = $wpdb->last_error;
1359 1359
 		$old_suppress_errors = $wpdb->suppress_errors();
1360
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1360
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1361 1361
 		$ezsql_error_cache = $EZSQL_ERROR;
1362
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1363
-		$wpdb->show_errors( $old_show_errors_value );
1364
-		$wpdb->suppress_errors( $old_suppress_errors );
1362
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1363
+		$wpdb->show_errors($old_show_errors_value);
1364
+		$wpdb->suppress_errors($old_suppress_errors);
1365 1365
 		$new_error = $wpdb->last_error;
1366 1366
 		$wpdb->last_error = $old_error;
1367 1367
 		$EZSQL_ERROR = $ezsql_error_cache;
1368
-		if( empty( $new_error ) ){
1368
+		if (empty($new_error)) {
1369 1369
 			return TRUE;
1370
-		}else{
1370
+		} else {
1371 1371
 			return FALSE;
1372 1372
 		}
1373 1373
 	}
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 	/**
1376 1376
 	 * Resets the cache on EEH_Activation
1377 1377
 	 */
1378
-	public static function reset(){
1378
+	public static function reset() {
1379 1379
 		self::$_default_creator_id = NULL;
1380 1380
 	}
1381 1381
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Event_Query.helper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@
 block discarded – undo
204 204
 	 *
205 205
 	 * @access    private
206 206
 	 * @param string $sort
207
-	 * @return    array
207
+	 * @return    string
208 208
 	 */
209 209
 	private static function _sort( $sort = 'ASC' ) {
210 210
 		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function add_query_filters() {
87 87
 		//add query filters
88
-		add_action( 'pre_get_posts', array( 'EEH_Event_Query', 'filter_query_parts' ), 10, 1 );
88
+		add_action('pre_get_posts', array('EEH_Event_Query', 'filter_query_parts'), 10, 1);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @param \WP_Query $WP_Query
98 98
 	 * @return bool
99 99
 	 */
100
-	public static function apply_query_filters( WP_Query $WP_Query ) {
101
-		return ( isset( $WP_Query->query, $WP_Query->query['post_type'] ) && $WP_Query->query['post_type'] == 'espresso_events' ) ||  apply_filters( 'FHEE__EEH_Event_Query__apply_query_filters', false ) ? true : false;
100
+	public static function apply_query_filters(WP_Query $WP_Query) {
101
+		return (isset($WP_Query->query, $WP_Query->query['post_type']) && $WP_Query->query['post_type'] == 'espresso_events') || apply_filters('FHEE__EEH_Event_Query__apply_query_filters', false) ? true : false;
102 102
 	}
103 103
 
104 104
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 * @access    public
109 109
 	 * @param \WP_Query $WP_Query
110 110
 	 */
111
-	public static function filter_query_parts( WP_Query $WP_Query ) {
111
+	public static function filter_query_parts(WP_Query $WP_Query) {
112 112
 		//ONLY add our filters if this isn't the main wp_query, because if this is the main wp_query we already have our cpt strategies take care of adding things in.
113
-		if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_main_query() ) {
113
+		if ($WP_Query instanceof WP_Query && ! $WP_Query->is_main_query()) {
114 114
 			// build event list query
115
-			add_filter( 'posts_fields', array( 'EEH_Event_Query', 'posts_fields' ), 10, 2 );
116
-			add_filter( 'posts_join', array( 'EEH_Event_Query', 'posts_join' ), 10, 2 );
117
-			add_filter( 'posts_where', array( 'EEH_Event_Query', 'posts_where' ), 10, 2 );
118
-			add_filter( 'posts_orderby', array( 'EEH_Event_Query', 'posts_orderby' ), 10, 2 );
119
-			add_filter( 'posts_clauses_request', array( 'EEH_Event_Query', 'posts_clauses' ), 10, 2 );
115
+			add_filter('posts_fields', array('EEH_Event_Query', 'posts_fields'), 10, 2);
116
+			add_filter('posts_join', array('EEH_Event_Query', 'posts_join'), 10, 2);
117
+			add_filter('posts_where', array('EEH_Event_Query', 'posts_where'), 10, 2);
118
+			add_filter('posts_orderby', array('EEH_Event_Query', 'posts_orderby'), 10, 2);
119
+			add_filter('posts_clauses_request', array('EEH_Event_Query', 'posts_clauses'), 10, 2);
120 120
 		}
121 121
 	}
122 122
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	 * @param string $orderby
132 132
 	 * @param string $sort
133 133
 	 */
134
-	public static function set_query_params( $month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC' ) {
134
+	public static function set_query_params($month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC') {
135 135
 		self::$_query_params = array();
136
-		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month( $month );
137
-		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug( $category );
138
-		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired( $show_expired );
139
-		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby( $orderby );
140
-		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort( $sort );
136
+		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month($month);
137
+		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug($category);
138
+		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired($show_expired);
139
+		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby($orderby);
140
+		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort($sort);
141 141
 	}
142 142
 
143 143
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param string $month
150 150
 	 * @return    string
151 151
 	 */
152
-	private static function _display_month( $month = '' ) {
153
-		return EE_Registry::instance()->REQ->is_set( 'event_query_month' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_month' ) ) : $month;
152
+	private static function _display_month($month = '') {
153
+		return EE_Registry::instance()->REQ->is_set('event_query_month') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_month')) : $month;
154 154
 	}
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 * @param string $category
163 163
 	 * @return    string
164 164
 	 */
165
-	private static function _event_category_slug( $category = '' ) {
166
-		return EE_Registry::instance()->REQ->is_set( 'event_query_category' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_category' ) ) : $category;
165
+	private static function _event_category_slug($category = '') {
166
+		return EE_Registry::instance()->REQ->is_set('event_query_category') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category')) : $category;
167 167
 	}
168 168
 
169 169
 
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 * @param bool $show_expired
176 176
 	 * @return    boolean
177 177
 	 */
178
-	private static function _show_expired( $show_expired = FALSE ) {
178
+	private static function _show_expired($show_expired = FALSE) {
179 179
 		// override default expired option if set via filter
180
-		$_event_query_show_expired =EE_Registry::instance()->REQ->is_set( 'event_query_show_expired' ) ? EE_Registry::instance()->REQ->get( 'event_query_show_expired' ) : $show_expired;
181
-		return filter_var( $_event_query_show_expired, FILTER_VALIDATE_BOOLEAN );
180
+		$_event_query_show_expired = EE_Registry::instance()->REQ->is_set('event_query_show_expired') ? EE_Registry::instance()->REQ->get('event_query_show_expired') : $show_expired;
181
+		return filter_var($_event_query_show_expired, FILTER_VALIDATE_BOOLEAN);
182 182
 	}
183 183
 
184 184
 
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 * @param    string $orderby
191 191
 	 * @return    array
192 192
 	 */
193
-	private static function _orderby( $orderby = 'start_date' ) {
194
-		$event_query_orderby = EE_Registry::instance()->REQ->is_set( 'event_query_orderby' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_orderby' ) ) : $orderby;
195
-		$event_query_orderby = is_array( $event_query_orderby ) ? $event_query_orderby : explode( ',', $event_query_orderby );
196
-		$event_query_orderby = array_map( 'trim', $event_query_orderby );
193
+	private static function _orderby($orderby = 'start_date') {
194
+		$event_query_orderby = EE_Registry::instance()->REQ->is_set('event_query_orderby') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_orderby')) : $orderby;
195
+		$event_query_orderby = is_array($event_query_orderby) ? $event_query_orderby : explode(',', $event_query_orderby);
196
+		$event_query_orderby = array_map('trim', $event_query_orderby);
197 197
 		return $event_query_orderby;
198 198
 	}
199 199
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 * @param string $sort
207 207
 	 * @return    array
208 208
 	 */
209
-	private static function _sort( $sort = 'ASC' ) {
210
-		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
211
-		return in_array( $sort, array( 'ASC', 'asc', 'DESC', 'desc' )) ? strtoupper( $sort ) : 'ASC';
209
+	private static function _sort($sort = 'ASC') {
210
+		$sort = EE_Registry::instance()->REQ->is_set('event_query_sort') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_sort')) : $sort;
211
+		return in_array($sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($sort) : 'ASC';
212 212
 	}
213 213
 
214 214
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return array   array of clauses
223 223
 	 */
224
-	public static function posts_clauses( $clauses, WP_Query $wp_query ) {
225
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
224
+	public static function posts_clauses($clauses, WP_Query $wp_query) {
225
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
226 226
 			$clauses['distinct'] = "DISTINCT";
227 227
 		}
228 228
 		return $clauses;
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 	 * @param WP_Query $wp_query
239 239
 	 * @return    string
240 240
 	 */
241
-	public static function posts_fields( $SQL, WP_Query $wp_query ) {
242
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
241
+	public static function posts_fields($SQL, WP_Query $wp_query) {
242
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
243 243
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
244
-			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby );
244
+			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby);
245 245
 		}
246 246
 		return $SQL;
247 247
 	}
@@ -256,29 +256,29 @@  discard block
 block discarded – undo
256 256
 	 * @internal  param bool|string $mixed $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
257 257
 	 * @return    string
258 258
 	 */
259
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
260
-		$SQL= '';
261
-		foreach( (array)$orderby_params as $orderby ) {
262
-			switch ( $orderby ) {
259
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
260
+		$SQL = '';
261
+		foreach ((array) $orderby_params as $orderby) {
262
+			switch ($orderby) {
263 263
 
264 264
 				case 'ticket_start' :
265
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ;
265
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date';
266 266
 					break;
267 267
 
268 268
 				case 'ticket_end' :
269
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ;
269
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date';
270 270
 					break;
271 271
 
272 272
 				case 'venue_title' :
273
-					$SQL .= ', Venue.post_title AS venue_title' ;
273
+					$SQL .= ', Venue.post_title AS venue_title';
274 274
 					break;
275 275
 
276 276
 				case 'city' :
277
-					$SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ;
277
+					$SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city';
278 278
 					break;
279 279
 
280 280
 				case 'state' :
281
-					$SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ;
281
+					$SQL .= ', '.EEM_State::instance()->table().'.STA_name';
282 282
 					break;
283 283
 
284 284
 			}
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 	 * @param WP_Query $wp_query
297 297
 	 * @return    string
298 298
 	 */
299
-	public static function posts_join( $SQL = '', WP_Query $wp_query ) {
300
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
299
+	public static function posts_join($SQL = '', WP_Query $wp_query) {
300
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
301 301
 			// Category
302
-			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired );
303
-			$SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category );
304
-			$SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby );
302
+			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired);
303
+			$SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category);
304
+			$SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby);
305 305
 		}
306 306
 		return $SQL;
307 307
 	}
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 * @param    boolean $show_expired if TRUE, then displayed past events
317 317
 	 * @return string
318 318
 	 */
319
-	public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) {
320
-		if ( ! $show_expired ) {
321
-			$join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
322
-			if ( strpos( $SQL, $join ) === FALSE ) {
323
-				$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) ';
319
+	public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) {
320
+		if ( ! $show_expired) {
321
+			$join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
322
+			if (strpos($SQL, $join) === FALSE) {
323
+				$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) ';
324 324
 			}
325 325
 		}
326 326
 		return $SQL;
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @param 	string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
337 337
 	 * @return 	string
338 338
 	 */
339
-	public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) {
340
-		if ( ! empty( $join_terms ) ) {
339
+	public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') {
340
+		if ( ! empty($join_terms)) {
341 341
 			global $wpdb;
342 342
 			$SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
343 343
 			$SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
@@ -357,25 +357,25 @@  discard block
 block discarded – undo
357 357
 	 * @param 	array $orderby_params
358 358
 	 * @return 	string
359 359
 	 */
360
-	public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) {
361
-		foreach ( (array)$orderby_params as $orderby ) {
362
-			switch ( $orderby ) {
360
+	public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) {
361
+		foreach ((array) $orderby_params as $orderby) {
362
+			switch ($orderby) {
363 363
 				case 'ticket_start' :
364 364
 				case 'ticket_end' :
365
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() );
366
-					$SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' = ' . EEM_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' )';
365
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name());
366
+					$SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' = '.EEM_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' )';
367 367
 					break;
368 368
 				case 'venue_title' :
369 369
 				case 'city' :
370
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
370
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
371 371
 					break;
372 372
 				case 'state' :
373
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
374
-					$SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL );
373
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
374
+					$SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL);
375 375
 					break;
376 376
 				case 'start_date' :
377 377
 				default :
378
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' );
378
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID');
379 379
 					break;
380 380
 
381 381
 			}
@@ -393,11 +393,11 @@  discard block
 block discarded – undo
393 393
 	 * @param string $join
394 394
 	 * @return string
395 395
 	 */
396
-	protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) {
397
-		if ( ! empty( $join )) {
398
-			$join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
399
-			if ( strpos( $SQL, $join ) === FALSE ) {
400
-				return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )';
396
+	protected static function _posts_join_for_datetime($SQL = '', $join = '') {
397
+		if ( ! empty($join)) {
398
+			$join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
399
+			if (strpos($SQL, $join) === FALSE) {
400
+				return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )';
401 401
 			}
402 402
 		}
403 403
 		return '';
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 	 * @param string $SQL
413 413
 	 * @return string
414 414
 	 */
415
-	protected static function _posts_join_for_event_venue( $SQL = '' ) {
415
+	protected static function _posts_join_for_event_venue($SQL = '') {
416 416
 		// Event Venue table name
417 417
 		$event_venue_table = EEM_Event_Venue::instance()->table();
418 418
 		// generate conditions for:  Event <=> Event Venue  JOIN clause
419
-		$event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name();
419
+		$event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name();
420 420
 		// don't add joins if they have already been added
421
-		if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) {
421
+		if (strpos($SQL, $event_to_event_venue_join) === FALSE) {
422 422
 			// Venue table name
423 423
 			$venue_table = EEM_Venue::instance()->table();
424 424
 			// Venue table pk
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 			$venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )";
432 432
 			// generate JOIN clause for: Venue <=> Venue Meta
433 433
 			$venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )";
434
-			unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table );
434
+			unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table);
435 435
 			return $venue_SQL;
436 436
 		}
437
-		unset( $event_venue_table, $event_to_event_venue_join );
437
+		unset($event_venue_table, $event_to_event_venue_join);
438 438
 		return '';
439 439
 	}
440 440
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @param string $SQL
448 448
 	 * @return string
449 449
 	 */
450
-	protected static function _posts_join_for_venue_state( $SQL = '' ) {
450
+	protected static function _posts_join_for_venue_state($SQL = '') {
451 451
 		// Venue Meta table name
452 452
 		$venue_meta_table = EEM_Venue::instance()->second_table();
453 453
 		// State table name
@@ -455,16 +455,16 @@  discard block
 block discarded – undo
455 455
 		// State table pk
456 456
 		$state_table_pk = EEM_State::instance()->primary_key_name();
457 457
 		// verify vars
458
-		if ( $venue_meta_table && $state_table && $state_table_pk ) {
458
+		if ($venue_meta_table && $state_table && $state_table_pk) {
459 459
 			// like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID
460 460
 			$join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk";
461 461
 			// don't add join if it has already been added
462
-			if ( strpos( $SQL, $join ) === FALSE ) {
463
-				unset( $state_table_pk, $venue_meta_table, $venue_table_pk );
462
+			if (strpos($SQL, $join) === FALSE) {
463
+				unset($state_table_pk, $venue_meta_table, $venue_table_pk);
464 464
 				return " LEFT JOIN $state_table ON ( $join )";
465 465
 			}
466 466
 		}
467
-		unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk );
467
+		unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk);
468 468
 		return '';
469 469
 	}
470 470
 
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
 	 * @param WP_Query $wp_query
479 479
 	 * @return    string
480 480
 	 */
481
-	public static function posts_where( $SQL = '', WP_Query $wp_query ) {
482
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
481
+	public static function posts_where($SQL = '', WP_Query $wp_query) {
482
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
483 483
 			// Show Expired ?
484
-			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired  );
484
+			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired);
485 485
 			// Category
486
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category  );
486
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category);
487 487
 			// Start Date
488
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month );
488
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month);
489 489
 		}
490 490
 		return $SQL;
491 491
 	}
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	 * @param    boolean $show_expired if TRUE, then displayed past events
500 500
 	 * @return    string
501 501
 	 */
502
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
503
-		return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : '';
502
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
503
+		return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : '';
504 504
 	}
505 505
 
506 506
 
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 	 * @param    boolean $event_category_slug
513 513
 	 * @return    string
514 514
 	 */
515
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
515
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
516 516
 		global $wpdb;
517
-		return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : '';
517
+		return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : '';
518 518
 	}
519 519
 
520 520
 
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
 	 * @param    boolean $month
527 527
 	 * @return    string
528 528
 	 */
529
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
529
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
530 530
 		$SQL = '';
531
-		if ( ! empty( $month ) ) {
531
+		if ( ! empty($month)) {
532 532
 			// event start date is LESS than the end of the month ( so nothing that doesn't start until next month )
533
-			$SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"';
533
+			$SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"';
534 534
 			// event end date is GREATER than the start of the month ( so nothing that ended before this month )
535
-			$SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" ';
535
+			$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" ';
536 536
 		}
537 537
 		return $SQL;
538 538
 	}
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 * @param WP_Query $wp_query
548 548
 	 * @return    string
549 549
 	 */
550
-	public static function posts_orderby( $SQL = '', WP_Query $wp_query ) {
551
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
552
-			$SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort );
550
+	public static function posts_orderby($SQL = '', WP_Query $wp_query) {
551
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
552
+			$SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort);
553 553
 		}
554 554
 		return $SQL;
555 555
 	}
@@ -580,63 +580,63 @@  discard block
 block discarded – undo
580 580
 	 * @param string     $sort
581 581
 	 * @return string
582 582
 	 */
583
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
583
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
584 584
 		global $wpdb;
585 585
 		$SQL = '';
586 586
 		$counter = 0;
587 587
 		//make sure 'orderby' is set in query params
588
-		if ( ! isset( self::$_query_params['orderby'] )) {
588
+		if ( ! isset(self::$_query_params['orderby'])) {
589 589
 			self::$_query_params['orderby'] = array();
590 590
 		}
591 591
 		// loop thru $orderby_params (type cast as array)
592
-		foreach ( (array)$orderby_params as $orderby ) {
592
+		foreach ((array) $orderby_params as $orderby) {
593 593
 			// check if we have already added this param
594
-			if ( isset( self::$_query_params['orderby'][ $orderby ] )) {
594
+			if (isset(self::$_query_params['orderby'][$orderby])) {
595 595
 				// if so then remove from the $orderby_params so that the count() method below is accurate
596
-				unset( $orderby_params[ $orderby ] );
596
+				unset($orderby_params[$orderby]);
597 597
 				// then bump ahead to the next param
598 598
 				continue;
599 599
 			}
600 600
 			// this will ad a comma depending on whether this is the first or last param
601
-			$glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', ';
601
+			$glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', ';
602 602
 			// ok what's we dealing with?
603
-			switch ( $orderby ) {
603
+			switch ($orderby) {
604 604
 				case 'id' :
605 605
 				case 'ID' :
606
-					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
606
+					$SQL .= $glue.$wpdb->posts.'.ID '.$sort;
607 607
 					break;
608 608
 				case 'end_date' :
609
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
609
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort;
610 610
 					break;
611 611
 				case 'event_name' :
612
-					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
612
+					$SQL .= $glue.$wpdb->posts.'.post_title '.$sort;
613 613
 					break;
614 614
 				case 'category_slug' :
615
-					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
615
+					$SQL .= $glue.$wpdb->terms.'.slug '.$sort;
616 616
 					break;
617 617
 				case 'ticket_start' :
618
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
618
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort;
619 619
 					break;
620 620
 				case 'ticket_end' :
621
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
621
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort;
622 622
 					break;
623 623
 				case 'venue_title' :
624
-					$SQL .= $glue . 'venue_title ' . $sort;
624
+					$SQL .= $glue.'venue_title '.$sort;
625 625
 					break;
626 626
 				case 'city' :
627
-					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
627
+					$SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort;
628 628
 					break;
629 629
 				case 'state' :
630
-					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
630
+					$SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort;
631 631
 					break;
632 632
 				case 'start_date' :
633 633
 				default :
634
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort;
634
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_start '.$sort;
635 635
 					break;
636 636
 			}
637 637
 			// add to array of orderby params that have been added
638
-			self::$_query_params['orderby'][ $orderby ] = TRUE;
639
-			$counter ++;
638
+			self::$_query_params['orderby'][$orderby] = TRUE;
639
+			$counter++;
640 640
 		}
641 641
 		return $SQL;
642 642
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @param mixed $opt_group
776 776
 	 * @param mixed $QSOs
777
-	 * @param mixed $answer
777
+	 * @param string $answer
778 778
 	 * @return string
779 779
 	 */
780 780
 	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	/**
1123 1123
 	 * 	prep_required
1124 1124
 	 * @param string|array 	$required
1125
-	 * @return array
1125
+	 * @return string
1126 1126
 	 */
1127 1127
 	static function prep_required( $required = array() ){
1128 1128
 		// make sure required is an array
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
 	/**
1175 1175
 	 * 	_load_system_dropdowns
1176
-	 * @param array 	$QFI
1177
-	 * @return array
1176
+	 * @param EE_Question_Form_Input 	$QFI
1177
+	 * @return EE_Question_Form_Input
1178 1178
 	 */
1179 1179
 	private static function _load_system_dropdowns( $QFI ){
1180 1180
 		$QST_system = $QFI->get('QST_system');
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 	 * @param    string   $nonce_action     - if using nonces
1464 1464
 	 * @param    bool|string $input_only       - whether to print form header and footer. TRUE returns the input without the form
1465 1465
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1466
-	 * @return    void
1466
+	 * @return    string
1467 1467
 	 */
1468 1468
 	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1469 1469
 		$btn = '';
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
 	/**
395 395
 	 * generate_question_groups_html
396
- 	 *
396
+	 *
397 397
 	 * @param string $question_groups
398 398
 	 * @return string HTML
399 399
 	 */
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 	/**
539 539
 	 * generate_form_input
540
- 	 *
540
+	 *
541 541
 	 * @param EE_Question_Form_Input $QFI
542 542
 	 * @return string HTML
543 543
 	 */
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
 	/**
614 614
 	 * generates HTML for a form text input
615
- 	 *
615
+	 *
616 616
 	 * @param string $question 	label content
617 617
 	 * @param string $answer 		form input value attribute
618 618
 	 * @param string $name 			form input name attribute
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 
658 658
 	/**
659 659
 	 * generates HTML for a form textarea
660
- 	 *
660
+	 *
661 661
 	 * @param string $question 		label content
662 662
 	 * @param string $answer 		form input value attribute
663 663
 	 * @param string $name 			form input name attribute
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
 	/**
710 710
 	 * generates HTML for a form select input
711
- 	 *
711
+	 *
712 712
 	 * @param string $question 		label content
713 713
 	 * @param string $answer 		form input value attribute
714 714
 	 * @param array $options			array of answer options where array key = option value and array value = option display text
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
 	/**
887 887
 	 * generates HTML for form checkbox inputs
888
- 	 *
888
+	 *
889 889
 	 * @param string $question 		label content
890 890
 	 * @param string $answer 		form input value attribute
891 891
 	 * @param array $options 			array of options where array key = option value and array value = option display text
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 
967 967
 	/**
968 968
 	 * generates HTML for a form datepicker input
969
- 	 *
969
+	 *
970 970
 	 * @param string $question 	label content
971 971
 	 * @param string $answer 		form input value attribute
972 972
 	 * @param string $name 			form input name attribute
Please login to merge, or discard this patch.
Spacing   +381 added lines, -381 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	 * 	@return string
58 58
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
59 59
 	 */
60
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
60
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
61 61
 
62
-		if ( empty($input_vars) ) {
63
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
62
+		if (empty($input_vars)) {
63
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
64 64
 			return FALSE;
65 65
 		}
66 66
 
@@ -85,22 +85,22 @@  discard block
 block discarded – undo
85 85
 				'tabindex' => ''
86 86
 				);
87 87
 
88
-			$input_value = wp_parse_args( $input_value, $defaults );
88
+			$input_value = wp_parse_args($input_value, $defaults);
89 89
 
90 90
 			// required fields get a *
91 91
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
92 92
 			// and the css class "required"
93
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
94
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
93
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
94
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
95 95
 
96
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
97
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
96
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
97
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
98 98
 
99 99
 			//rows or cols?
100
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
101
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
100
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
101
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
102 102
 
103
-			$output .= (!$close) ? '<ul>' : '';
103
+			$output .= ( ! $close) ? '<ul>' : '';
104 104
 			$output .= '<li>';
105 105
 
106 106
 			// what type of input are we dealing with ?
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 
109 109
 				// text inputs
110 110
 				case 'text' :
111
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
112
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
111
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
112
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
113 113
 					break;
114 114
 
115 115
 				// dropdowns
116 116
 				case 'select' :
117 117
 
118
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
119
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
118
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
119
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
120 120
 
121 121
 					if (is_array($input_value['options'])) {
122 122
 						$options = $input_value['options'];
@@ -125,30 +125,30 @@  discard block
 block discarded – undo
125 125
 					}
126 126
 
127 127
 					foreach ($options as $key => $value) {
128
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
128
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
129 129
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
130
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
130
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
131 131
 					}
132
-					$output .= "\n\t\t\t" . '</select>';
132
+					$output .= "\n\t\t\t".'</select>';
133 133
 
134 134
 					break;
135 135
 
136 136
 				case 'textarea' :
137 137
 
138
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
139
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
138
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
139
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
140 140
 					break;
141 141
 
142 142
 				case 'hidden' :
143 143
 					$close = false;
144 144
 					$output .= "</li></ul>";
145
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
145
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
146 146
 					break;
147 147
 
148 148
 				case 'checkbox' :
149
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
150
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
151
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
149
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
150
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
151
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
152 152
 					break;
153 153
 
154 154
 				case 'wp_editor' :
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 					);
162 162
 					$output .= '</li>';
163 163
 					$output .= '</ul>';
164
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
164
+					$output .= '<h4>'.$input_value['label'].'</h4>';
165 165
 					ob_start();
166
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
166
+					wp_editor($input_value['value'], $field_id, $editor_settings);
167 167
 					$editor = ob_get_contents();
168 168
 					ob_end_clean();
169 169
 					$output .= $editor;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$form_fields = array();
209 209
 		$fields = (array) $fields;
210 210
 
211
-		foreach ( $fields as $field_name => $field_atts ) {
211
+		foreach ($fields as $field_name => $field_atts) {
212 212
 			//defaults:
213 213
 			$defaults = array(
214 214
 				'label' => '',
@@ -226,67 +226,67 @@  discard block
 block discarded – undo
226 226
 				'wpeditor_args' => array()
227 227
 				);
228 228
 			// merge defaults with passed arguments
229
-			$_fields = wp_parse_args( $field_atts, $defaults);
230
-			extract( $_fields );
229
+			$_fields = wp_parse_args($field_atts, $defaults);
230
+			extract($_fields);
231 231
 			// generate label
232
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
232
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
233 233
 			// generate field name
234
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
234
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
235 235
 
236 236
 			//tabindex
237
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
237
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
238 238
 
239 239
 			//we determine what we're building based on the type
240
-			switch ( $type ) {
240
+			switch ($type) {
241 241
 
242 242
 				case 'textarea' :
243
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
243
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
244 244
 						$fld .= $extra_desc;
245 245
 					break;
246 246
 
247 247
 				case 'checkbox' :
248 248
 						$c_input = '';
249
-						if ( is_array($value) ) {
250
-							foreach ( $value as $key => $val ) {
251
-								$c_id = $field_name . '_' . $value;
252
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
253
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
254
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
255
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
249
+						if (is_array($value)) {
250
+							foreach ($value as $key => $val) {
251
+								$c_id = $field_name.'_'.$value;
252
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
253
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
254
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
255
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
256 256
 							}
257 257
 							$fld = $c_input;
258 258
 						} else {
259
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
260
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
259
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
260
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
261 261
 						}
262 262
 					break;
263 263
 
264 264
 				case 'radio' :
265 265
 						$c_input = '';
266
-						if ( is_array($value) ) {
267
-							foreach ( $value as $key => $val ) {
268
-								$c_id = $field_name . '_' . $value;
269
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
270
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
271
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
272
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
266
+						if (is_array($value)) {
267
+							foreach ($value as $key => $val) {
268
+								$c_id = $field_name.'_'.$value;
269
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
270
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
271
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
272
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
273 273
 							}
274 274
 							$fld = $c_input;
275 275
 						} else {
276
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
277
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
276
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
277
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
278 278
 						}
279 279
 					break;
280 280
 
281 281
 				case 'hidden' :
282
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
282
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
283 283
 					break;
284 284
 
285 285
 				case 'select' :
286
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
287
-						foreach ( $value as $key => $val ) {
288
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
289
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
286
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
287
+						foreach ($value as $key => $val) {
288
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
289
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
290 290
 						}
291 291
 						$fld .= '</select>';
292 292
 					break;
@@ -298,21 +298,21 @@  discard block
 block discarded – undo
298 298
 							'editor_class' => $class,
299 299
 							'tabindex' => $tabindex
300 300
 							);
301
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
301
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
302 302
 						ob_start();
303
-						wp_editor( $value, $id, $editor_settings );
303
+						wp_editor($value, $id, $editor_settings);
304 304
 						$editor = ob_get_contents();
305 305
 						ob_end_clean();
306 306
 						$fld = $editor;
307 307
 					break;
308 308
 
309 309
 				default : //'text fields'
310
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
310
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
311 311
 						$fld .= $extra_desc;
312 312
 
313 313
 			}
314 314
 
315
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
315
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
316 316
 		}
317 317
 
318 318
 		return $form_fields;
@@ -341,22 +341,22 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
343 343
 		//if $values was submitted in the wrong format, convert it over
344
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
345
-			$converted_values=array();
346
-			foreach($values as $id=>$text){
347
-				$converted_values[]=array('id'=>$id,'text'=>$text);
344
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
345
+			$converted_values = array();
346
+			foreach ($values as $id=>$text) {
347
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
348 348
 			}
349
-			$values=$converted_values;
349
+			$values = $converted_values;
350 350
 		}
351 351
 		//load formatter helper
352
-		EE_Registry::instance()->load_helper( 'Formatter' );
352
+		EE_Registry::instance()->load_helper('Formatter');
353 353
 		//EE_Registry::instance()->load_helper( 'Formatter' );
354 354
 
355
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
355
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
356 356
 		//Debug
357 357
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
358
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
359
-			$field .= ' ' . $parameters;
358
+		if (EEH_Formatter::ee_tep_not_null($parameters))
359
+			$field .= ' '.$parameters;
360 360
 		if ($autosize) {
361 361
 			$size = 'med';
362 362
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -368,18 +368,18 @@  discard block
 block discarded – undo
368 368
 		} else
369 369
 			$size = '';
370 370
 
371
-		$field .= ' class="' . $class . ' ' . $size . '">';
371
+		$field .= ' class="'.$class.' '.$size.'">';
372 372
 
373 373
 		if (empty($default) && isset($GLOBALS[$name]))
374 374
 			$default = stripslashes($GLOBALS[$name]);
375 375
 
376 376
 
377 377
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
378
-			$field .= '<option value="' . $values[$i]['id'] . '"';
378
+			$field .= '<option value="'.$values[$i]['id'].'"';
379 379
 			if ($default == $values[$i]['id']) {
380 380
 				$field .= ' selected = "selected"';
381 381
 			}
382
-			$field .= '>' . $values[$i]['text'] . '</option>';
382
+			$field .= '>'.$values[$i]['text'].'</option>';
383 383
 		}
384 384
 		$field .= '</select>';
385 385
 
@@ -397,38 +397,38 @@  discard block
 block discarded – undo
397 397
 	 * @param string $question_groups
398 398
 	 * @return string HTML
399 399
 	 */
400
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
400
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
401 401
 
402 402
 		$html = '';
403
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
404
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
403
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
404
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
405 405
 
406
-		if ( ! empty( $question_groups )) {
406
+		if ( ! empty($question_groups)) {
407 407
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
408 408
 			// loop thru question groups
409
-			foreach ( $question_groups as $QSG ) {
409
+			foreach ($question_groups as $QSG) {
410 410
 				// check that questions exist
411
-				if ( ! empty( $QSG['QSG_questions'] )) {
411
+				if ( ! empty($QSG['QSG_questions'])) {
412 412
 					// use fieldsets
413
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
413
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
414 414
 					// group_name
415
-					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : '';
415
+					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : '';
416 416
 					// group_desc
417
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
417
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
418 418
 
419 419
 					$html .= $before_question_group_questions;
420 420
 					// loop thru questions
421
-					foreach ( $QSG['QSG_questions'] as $question ) {
421
+					foreach ($QSG['QSG_questions'] as $question) {
422 422
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
423 423
 						$QFI = new EE_Question_Form_Input(
424 424
 							$question['qst_obj'],
425 425
 							$question['ans_obj'],
426 426
 							$question
427 427
 						);
428
-						$html .= self::generate_form_input( $QFI );
428
+						$html .= self::generate_form_input($QFI);
429 429
 					}
430 430
 					$html .= $after_question_group_questions;
431
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
431
+					$html .= "\n\t".'</'.$group_wrapper.'>';
432 432
 				}
433 433
 			}
434 434
 		}
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 	 * @param string       $group_wrapper
449 449
 	 * @return string HTML
450 450
 	 */
451
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
451
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
452 452
 
453 453
 		$html = '';
454
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
455
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
454
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
455
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
456 456
 
457 457
 		$default_q_meta = array(
458 458
 				'att_nmbr' => 1,
@@ -461,55 +461,55 @@  discard block
 block discarded – undo
461 461
 				'input_id' => '',
462 462
 				'input_class' => ''
463 463
 		);
464
-		$q_meta = array_merge( $default_q_meta, $q_meta );
464
+		$q_meta = array_merge($default_q_meta, $q_meta);
465 465
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
466 466
 
467
-		if ( ! empty( $question_groups )) {
467
+		if ( ! empty($question_groups)) {
468 468
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
469 469
 			// loop thru question groups
470
-			foreach ( $question_groups as $QSG ) {
471
-				if ( $QSG instanceof EE_Question_Group ) {
470
+			foreach ($question_groups as $QSG) {
471
+				if ($QSG instanceof EE_Question_Group) {
472 472
 					// check that questions exist
473 473
 
474
-					$where = array( 'QST_deleted' => 0 );
475
-					if ( ! $from_admin ) {
474
+					$where = array('QST_deleted' => 0);
475
+					if ( ! $from_admin) {
476 476
 						$where['QST_admin_only'] = 0;
477 477
 					}
478
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
479
-					if ( ! empty( $questions )) {
478
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
479
+					if ( ! empty($questions)) {
480 480
 						// use fieldsets
481
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
481
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
482 482
 						// group_name
483
-						if ( $QSG->show_group_name() ) {
484
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
483
+						if ($QSG->show_group_name()) {
484
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
485 485
 						}
486 486
 						// group_desc
487
-						if ( $QSG->show_group_desc() ) {
488
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
487
+						if ($QSG->show_group_desc()) {
488
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
489 489
 						}
490 490
 
491 491
 						$html .= $before_question_group_questions;
492 492
 						// loop thru questions
493
-						foreach ( $questions as $QST ) {
493
+						foreach ($questions as $QST) {
494 494
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
495 495
 
496 496
 							$answer = NULL;
497 497
 
498
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
498
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
499 499
 								// check for answer in $_GET in case we are reprocessing a form after an error
500
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
501
-									$answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] );
500
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
501
+									$answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]);
502 502
 								}
503
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
503
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
504 504
 								//attendee data from the session
505
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
505
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
506 506
 							}
507 507
 
508 508
 
509 509
 
510 510
 							$QFI = new EE_Question_Form_Input(
511 511
 									$QST,
512
-									EE_Answer::new_instance ( array(
512
+									EE_Answer::new_instance(array(
513 513
 											'ANS_ID'=> 0,
514 514
 											'QST_ID'=> 0,
515 515
 											'REG_ID'=> 0,
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 									$q_meta
519 519
 							);
520 520
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
521
-							$html .= self::generate_form_input( $QFI );
521
+							$html .= self::generate_form_input($QFI);
522 522
 						}
523 523
 						$html .= $after_question_group_questions;
524
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
524
+						$html .= "\n\t".'</'.$group_wrapper.'>';
525 525
 					}
526 526
 				}
527 527
 			}
@@ -541,63 +541,63 @@  discard block
 block discarded – undo
541 541
 	 * @param EE_Question_Form_Input $QFI
542 542
 	 * @return string HTML
543 543
 	 */
544
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
545
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
544
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
545
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
546 546
 			return '';
547 547
 		}
548 548
 
549
-		$QFI = self::_load_system_dropdowns( $QFI );
550
-		$QFI = self::_load_specialized_dropdowns( $QFI );
549
+		$QFI = self::_load_system_dropdowns($QFI);
550
+		$QFI = self::_load_specialized_dropdowns($QFI);
551 551
 
552 552
 		//we also need to verify
553 553
 
554 554
 		$display_text = $QFI->get('QST_display_text');
555 555
 		$input_name = $QFI->get('QST_input_name');
556
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
556
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
557 557
 		$input_id = $QFI->get('QST_input_id');
558 558
 		$input_class = $QFI->get('QST_input_class');
559 559
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
560 560
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
561
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
561
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
562 562
 		$QST_required = $QFI->get('QST_required');
563
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
564
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
565
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
566
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
563
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
564
+		$use_html_entities = $QFI->get_meta('htmlentities');
565
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
566
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
567 567
 		$label_class = 'espresso-form-input-lbl';
568
-		$QST_options = $QFI->options(true,$answer);
569
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
568
+		$QST_options = $QFI->options(true, $answer);
569
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
570 570
 		$system_ID = $QFI->get('QST_system');
571
-		$label_b4 = $QFI->get_meta( 'label_b4' );
572
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
571
+		$label_b4 = $QFI->get_meta('label_b4');
572
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
573 573
 
574 574
 
575
-		switch ( $QFI->get('QST_type') ){
575
+		switch ($QFI->get('QST_type')) {
576 576
 
577 577
 			case 'TEXTAREA' :
578
-					return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
578
+					return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
579 579
 				break;
580 580
 
581 581
 			case 'DROPDOWN' :
582
-					return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE );
582
+					return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
583 583
 				break;
584 584
 
585 585
 
586 586
 			case 'RADIO_BTN' :
587
-					return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label );
587
+					return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
588 588
 				break;
589 589
 
590 590
 			case 'CHECKBOX' :
591
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
591
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
592 592
 				break;
593 593
 
594 594
 			case 'DATE' :
595
-					return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
595
+					return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
596 596
 				break;
597 597
 
598 598
 			case 'TEXT' :
599 599
 			default:
600
-					return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
600
+					return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
601 601
 				break;
602 602
 
603 603
 		}
@@ -623,31 +623,31 @@  discard block
 block discarded – undo
623 623
 	 * @param string $disabled 		disabled="disabled" or null
624 624
 	 * @return string HTML
625 625
 	 */
626
-	static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
626
+	static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
627 627
 		// need these
628
-		if ( ! $question || ! $name ) {
628
+		if ( ! $question || ! $name) {
629 629
 			return NULL;
630 630
 		}
631 631
 		// prep the answer
632
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
632
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
633 633
 		// prep the required array
634
-		$required = self::prep_required( $required );
634
+		$required = self::prep_required($required);
635 635
 		// set disabled tag
636
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
636
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
637 637
 		// ya gots ta have style man!!!
638 638
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
639
-		$class = empty( $class ) ? $txt_class : $class;
640
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
641
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
639
+		$class = empty($class) ? $txt_class : $class;
640
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
641
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
642 642
 
643
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
643
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
644 644
 		// filter label but ensure required text comes before it
645
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
645
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
646 646
 
647
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
647
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
648 648
 
649
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
650
-		return  $label_html . $input_html;
649
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
650
+		return  $label_html.$input_html;
651 651
 
652 652
 	}
653 653
 
@@ -669,35 +669,35 @@  discard block
 block discarded – undo
669 669
 	 * @param string $disabled 		disabled="disabled" or null
670 670
 	 * @return string HTML
671 671
 	 */
672
-	static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
672
+	static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
673 673
 		// need these
674
-		if ( ! $question || ! $name ) {
674
+		if ( ! $question || ! $name) {
675 675
 			return NULL;
676 676
 		}
677 677
 		// prep the answer
678
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
678
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
679 679
 		// prep the required array
680
-		$required = self::prep_required( $required );
680
+		$required = self::prep_required($required);
681 681
 		// make sure $dimensions is an array
682
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
682
+		$dimensions = is_array($dimensions) ? $dimensions : array();
683 683
 		// and set some defaults
684
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
684
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
685 685
 		// set disabled tag
686
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
686
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
687 687
 		// ya gots ta have style man!!!
688 688
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
689
-		$class = empty( $class ) ? $txt_class : $class;
690
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
691
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
689
+		$class = empty($class) ? $txt_class : $class;
690
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
691
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
692 692
 
693
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
693
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
694 694
 		// filter label but ensure required text comes before it
695
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
695
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
696 696
 
697
-		$input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>';
697
+		$input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>';
698 698
 
699
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
700
-		return  $label_html . $input_html;
699
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
700
+		return  $label_html.$input_html;
701 701
 
702 702
 	}
703 703
 
@@ -720,47 +720,47 @@  discard block
 block discarded – undo
720 720
 	 * @param string $disabled 		disabled="disabled" or null
721 721
 	 * @return string HTML
722 722
 	 */
723
-	static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) {
723
+	static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) {
724 724
 
725 725
 		// need these
726
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
726
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
727 727
 			return NULL;
728 728
 		}
729 729
 		// prep the answer
730
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer )) : self::prep_answer( $answer, $use_html_entities );
730
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer)) : self::prep_answer($answer, $use_html_entities);
731 731
 		// prep the required array
732
-		$required = self::prep_required( $required );
732
+		$required = self::prep_required($required);
733 733
 		// set disabled tag
734
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
734
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
735 735
 		// ya gots ta have style man!!!
736 736
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
737
-		$class = empty( $class ) ? $txt_class : $class;
738
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
739
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
737
+		$class = empty($class) ? $txt_class : $class;
738
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
739
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
740 740
 
741
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
741
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
742 742
 		// filter label but ensure required text comes before it
743
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
743
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
744 744
 
745
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
745
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
746 746
 		// recursively count array elements, to determine total number of options
747
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
748
-		if ( ! $only_option ) {
747
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
748
+		if ( ! $only_option) {
749 749
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
750 750
 			$selected = $answer === NULL ? ' selected="selected"' : '';
751
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
751
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
752 752
 		}
753
-		foreach ( $options as $key => $value ) {
753
+		foreach ($options as $key => $value) {
754 754
 			// if value is an array, then create option groups, else create regular ol' options
755
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option );
755
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option);
756 756
 		}
757 757
 
758
-		$input_html .= "\n\t\t\t" . '</select>';
758
+		$input_html .= "\n\t\t\t".'</select>';
759 759
 
760
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
760
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
761 761
 
762
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
763
-		return  $label_html . $input_html;
762
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
763
+		return  $label_html.$input_html;
764 764
 
765 765
 	}
766 766
 
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
 	 * @param mixed $answer
778 778
 	 * @return string
779 779
 	 */
780
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
781
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
782
-		foreach ( $QSOs as $QSO ) {
783
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer );
780
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer) {
781
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
782
+		foreach ($QSOs as $QSO) {
783
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer);
784 784
 		}
785
-		$html .= "\n\t\t\t\t" . '</optgroup>';
785
+		$html .= "\n\t\t\t\t".'</optgroup>';
786 786
 		return $html;
787 787
 	}
788 788
 
@@ -796,12 +796,12 @@  discard block
 block discarded – undo
796 796
 	 * @param int $only_option
797 797
 	 * @return string
798 798
 	 */
799
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE ){
800
-		$key = self::prep_answer( $key );
801
-		$value = self::prep_answer( $value );
802
-		$value = ! empty( $value ) ? $value : $key;
803
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
804
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
799
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE) {
800
+		$key = self::prep_answer($key);
801
+		$value = self::prep_answer($value);
802
+		$value = ! empty($value) ? $value : $key;
803
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
804
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
805 805
 	}
806 806
 
807 807
 
@@ -825,56 +825,56 @@  discard block
 block discarded – undo
825 825
 	 * @param bool        $use_desc_4_label
826 826
 	 * @return string HTML
827 827
 	 */
828
-	static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) {
828
+	static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) {
829 829
 		// need these
830
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
830
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
831 831
 			return NULL;
832 832
 		}
833 833
 		// prep the answer
834
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
834
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
835 835
 		// prep the required array
836
-		$required = self::prep_required( $required );
836
+		$required = self::prep_required($required);
837 837
 		// set disabled tag
838
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
838
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
839 839
 		// ya gots ta have style man!!!
840 840
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
841
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
842
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
841
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
842
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
843 843
 
844
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
844
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
845 845
 		// filter label but ensure required text comes before it
846
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
846
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
847 847
 
848
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
848
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
849 849
 
850
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
851
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
850
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
851
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
852 852
 
853
-		foreach ( $options as $OPT ) {
854
-			if ( $OPT instanceof EE_Question_Option ) {
855
-				$value = self::prep_option_value( $OPT->value() );
853
+		foreach ($options as $OPT) {
854
+			if ($OPT instanceof EE_Question_Option) {
855
+				$value = self::prep_option_value($OPT->value());
856 856
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
857
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
858
-				$desc = $OPT->desc();//no self::prep_answer
859
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
860
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
861
-				$opt = '-' . sanitize_key( $value );
862
-
863
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
864
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
865
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
866
-				$input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
867
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
868
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
869
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
870
-				$input_html .= "\n\t\t\t\t" . '</li>';
857
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
858
+				$desc = $OPT->desc(); //no self::prep_answer
859
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
860
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
861
+				$opt = '-'.sanitize_key($value);
862
+
863
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
864
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
865
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
866
+				$input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
867
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
868
+				$input_html .= "\n\t\t\t\t\t".'</label>';
869
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
870
+				$input_html .= "\n\t\t\t\t".'</li>';
871 871
 			}
872 872
 		}
873 873
 
874
-		$input_html .= "\n\t\t\t" . '</ul>';
874
+		$input_html .= "\n\t\t\t".'</ul>';
875 875
 
876
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
877
-		return  $label_html . $input_html;
876
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
877
+		return  $label_html.$input_html;
878 878
 
879 879
 	}
880 880
 
@@ -897,65 +897,65 @@  discard block
 block discarded – undo
897 897
 	 * @param string $disabled 		disabled="disabled" or null
898 898
 	 * @return string HTML
899 899
 	 */
900
-	static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
900
+	static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
901 901
 		// need these
902
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
902
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
903 903
 			return NULL;
904 904
 		}
905
-		$answer = maybe_unserialize( $answer );
905
+		$answer = maybe_unserialize($answer);
906 906
 
907 907
 		// prep the answer(s)
908
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
908
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
909 909
 
910
-		foreach ( $answer as $key => $value ) {
911
-			$key = self::prep_option_value( $key );
912
-			$answer[$key] = self::prep_answer( $value );
910
+		foreach ($answer as $key => $value) {
911
+			$key = self::prep_option_value($key);
912
+			$answer[$key] = self::prep_answer($value);
913 913
 		}
914 914
 
915 915
 		// prep the required array
916
-		$required = self::prep_required( $required );
916
+		$required = self::prep_required($required);
917 917
 		// set disabled tag
918
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
918
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
919 919
 		// ya gots ta have style man!!!
920 920
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
921
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
922
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
921
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
922
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
923 923
 
924
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
924
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
925 925
 		// filter label but ensure required text comes before it
926
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
927
-
928
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
929
-
930
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
931
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
932
-
933
-		foreach ( $options as $OPT ) {
934
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
935
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
936
-			$text = self::prep_answer( $OPT->value() );
937
-			$desc = $OPT->desc() ;
938
-			$opt = '-' . sanitize_key( $value );
939
-
940
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
941
-
942
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
943
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
944
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
945
-			$input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
946
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
947
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
948
-			if ( ! empty( $desc ) && $desc != $text ) {
949
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
926
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
927
+
928
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
929
+
930
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
931
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
932
+
933
+		foreach ($options as $OPT) {
934
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
935
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
936
+			$text = self::prep_answer($OPT->value());
937
+			$desc = $OPT->desc();
938
+			$opt = '-'.sanitize_key($value);
939
+
940
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
941
+
942
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
943
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
944
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
945
+			$input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
946
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
947
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
948
+			if ( ! empty($desc) && $desc != $text) {
949
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
950 950
 			}
951
-			$input_html .= "\n\t\t\t\t" . '</li>';
951
+			$input_html .= "\n\t\t\t\t".'</li>';
952 952
 
953 953
 		}
954 954
 
955
-		$input_html .= "\n\t\t\t" . '</ul>';
955
+		$input_html .= "\n\t\t\t".'</ul>';
956 956
 
957
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
958
-		return  $label_html . $input_html;
957
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
958
+		return  $label_html.$input_html;
959 959
 
960 960
 	}
961 961
 
@@ -977,36 +977,36 @@  discard block
 block discarded – undo
977 977
 	 * @param string $disabled 		disabled="disabled" or null
978 978
 	 * @return string HTML
979 979
 	 */
980
-	static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
980
+	static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
981 981
 		// need these
982
-		if ( ! $question || ! $name ) {
982
+		if ( ! $question || ! $name) {
983 983
 			return NULL;
984 984
 		}
985 985
 		// prep the answer
986
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
986
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
987 987
 		// prep the required array
988
-		$required = self::prep_required( $required );
988
+		$required = self::prep_required($required);
989 989
 		// set disabled tag
990
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
990
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
991 991
 		// ya gots ta have style man!!!
992 992
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
993
-		$class = empty( $class ) ? $txt_class : $class;
994
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
995
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
993
+		$class = empty($class) ? $txt_class : $class;
994
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
995
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
996 996
 
997
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
997
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
998 998
 		// filter label but ensure required text comes before it
999
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
999
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1000 1000
 
1001
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>';
1001
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1002 1002
 
1003 1003
 		// enqueue scripts
1004
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION );
1005
-		wp_enqueue_style( 'espresso-ui-theme');
1006
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1004
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1005
+		wp_enqueue_style('espresso-ui-theme');
1006
+		wp_enqueue_script('jquery-ui-datepicker');
1007 1007
 
1008
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1009
-		return  $label_html . $input_html;
1008
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1009
+		return  $label_html.$input_html;
1010 1010
 
1011 1011
 	}
1012 1012
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 	 * 	@access public
1019 1019
 	 * 	@return 	string
1020 1020
 	 */
1021
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1021
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1022 1022
 		return $required_text;
1023 1023
 	}
1024 1024
 
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
 	 * @param string $value
1033 1033
 	 * @return string HTML
1034 1034
 	 */
1035
-	static function hidden_input( $name, $value, $id = '' ){
1036
-		$id = ! empty( $id ) ? $id : $name;
1037
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1035
+	static function hidden_input($name, $value, $id = '') {
1036
+		$id = ! empty($id) ? $id : $name;
1037
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1038 1038
 	}
1039 1039
 
1040 1040
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	 * @param string $question
1047 1047
 	 * @return string
1048 1048
 	 */
1049
-	static function prep_question( $question ){
1049
+	static function prep_question($question) {
1050 1050
 		return $question;
1051 1051
 //		$link = '';
1052 1052
 //		// does this label have a help link attached ?
@@ -1069,13 +1069,13 @@  discard block
 block discarded – undo
1069 1069
 	 * @param mixed $answer
1070 1070
 	 * @return string
1071 1071
 	 */
1072
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1072
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1073 1073
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1074
-		if ( is_bool( $answer ) ) {
1074
+		if (is_bool($answer)) {
1075 1075
 			$answer = $answer ? 1 : 0;
1076 1076
 		}
1077
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1078
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1077
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1078
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1079 1079
 	}
1080 1080
 
1081 1081
 
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1086 1086
 	 * 	@return array
1087 1087
 	 */
1088
-	public static function prep_answer_options( $QSOs = array() ){
1088
+	public static function prep_answer_options($QSOs = array()) {
1089 1089
 		$prepped_answer_options = array();
1090
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1091
-			foreach( $QSOs as $key => $QSO ) {
1092
-				if ( ! $QSO instanceof EE_Question_Option ) {
1093
-					$QSO = EE_Question_Option::new_instance( array(
1094
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1095
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1090
+		if (is_array($QSOs) && ! empty($QSOs)) {
1091
+			foreach ($QSOs as $key => $QSO) {
1092
+				if ( ! $QSO instanceof EE_Question_Option) {
1093
+					$QSO = EE_Question_Option::new_instance(array(
1094
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1095
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1096 1096
 					));
1097 1097
 				}
1098
-				if ( $QSO->opt_group() ) {
1099
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1098
+				if ($QSO->opt_group()) {
1099
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1100 1100
 				} else {
1101 1101
 					$prepped_answer_options[] = $QSO;
1102 1102
 				}
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
 	 * @param string $option_value
1113 1113
 	 * @return string
1114 1114
 	 */
1115
-	static function prep_option_value( $option_value ){
1116
-		return trim( stripslashes( $option_value ));
1115
+	static function prep_option_value($option_value) {
1116
+		return trim(stripslashes($option_value));
1117 1117
 	}
1118 1118
 
1119 1119
 
@@ -1124,11 +1124,11 @@  discard block
 block discarded – undo
1124 1124
 	 * @param string|array 	$required
1125 1125
 	 * @return array
1126 1126
 	 */
1127
-	static function prep_required( $required = array() ){
1127
+	static function prep_required($required = array()) {
1128 1128
 		// make sure required is an array
1129
-		$required = is_array( $required ) ? $required : array();
1129
+		$required = is_array($required) ? $required : array();
1130 1130
 		// and set some defaults
1131
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1131
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1132 1132
 		return $required;
1133 1133
 	}
1134 1134
 
@@ -1139,30 +1139,30 @@  discard block
 block discarded – undo
1139 1139
 	 * @param string 	$value
1140 1140
 	 * @return string
1141 1141
 	 */
1142
-	static function get_label_size_class( $value = FALSE ){
1143
-			if ( $value === FALSE || $value == '' ) {
1142
+	static function get_label_size_class($value = FALSE) {
1143
+			if ($value === FALSE || $value == '') {
1144 1144
 				return ' class="medium-lbl"';
1145 1145
 			}
1146 1146
 			// determine length of option value
1147
-			$val_size = strlen( $value );
1148
-			switch( $val_size ){
1147
+			$val_size = strlen($value);
1148
+			switch ($val_size) {
1149 1149
 				case $val_size < 3 :
1150
-					$size =  ' class="nano-lbl"';
1150
+					$size = ' class="nano-lbl"';
1151 1151
 					break;
1152 1152
 				case $val_size < 6 :
1153
-					$size =  ' class="micro-lbl"';
1153
+					$size = ' class="micro-lbl"';
1154 1154
 					break;
1155 1155
 				case $val_size < 12 :
1156
-					$size =  ' class="tiny-lbl"';
1156
+					$size = ' class="tiny-lbl"';
1157 1157
 					break;
1158 1158
 				case $val_size < 25 :
1159
-					$size =  ' class="small-lbl"';
1159
+					$size = ' class="small-lbl"';
1160 1160
 					break;
1161 1161
 				case $val_size > 100 :
1162
-					$size =  ' class="big-lbl"';
1162
+					$size = ' class="big-lbl"';
1163 1163
 					break;
1164 1164
 				default:
1165
-					$size =  ' class="medium-lbl"';
1165
+					$size = ' class="medium-lbl"';
1166 1166
 					break;
1167 1167
 			}
1168 1168
 		return $size;
@@ -1176,20 +1176,20 @@  discard block
 block discarded – undo
1176 1176
 	 * @param array 	$QFI
1177 1177
 	 * @return array
1178 1178
 	 */
1179
-	private static function _load_system_dropdowns( $QFI ){
1179
+	private static function _load_system_dropdowns($QFI) {
1180 1180
 		$QST_system = $QFI->get('QST_system');
1181
-		switch ( $QST_system ) {
1181
+		switch ($QST_system) {
1182 1182
 			case 'state' :
1183
-				$QFI = self::generate_state_dropdown( $QFI );
1183
+				$QFI = self::generate_state_dropdown($QFI);
1184 1184
 				break;
1185 1185
 			case 'country' :
1186
-				$QFI = self::generate_country_dropdown( $QFI );
1186
+				$QFI = self::generate_country_dropdown($QFI);
1187 1187
 				break;
1188 1188
 			case 'admin-state' :
1189
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1189
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1190 1190
 				break;
1191 1191
 			case 'admin-country' :
1192
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1192
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1193 1193
 				break;
1194 1194
 		}
1195 1195
 		return $QFI;
@@ -1206,13 +1206,13 @@  discard block
 block discarded – undo
1206 1206
 	 *
1207 1207
 	 * @return EE_Question_Form_Input
1208 1208
 	 */
1209
-	protected static function _load_specialized_dropdowns( $QFI ) {
1210
-		switch( $QFI->get( 'QST_type' ) ) {
1209
+	protected static function _load_specialized_dropdowns($QFI) {
1210
+		switch ($QFI->get('QST_type')) {
1211 1211
 			case 'STATE' :
1212
-				$QFI = self::generate_state_dropdown( $QFI );
1212
+				$QFI = self::generate_state_dropdown($QFI);
1213 1213
 				break;
1214 1214
 			case 'COUNTRY' :
1215
-				$QFI = self::generate_country_dropdown( $QFI );
1215
+				$QFI = self::generate_country_dropdown($QFI);
1216 1216
 				break;
1217 1217
 		}
1218 1218
 		return $QFI;
@@ -1226,23 +1226,23 @@  discard block
 block discarded – undo
1226 1226
 	 * @param bool  $get_all
1227 1227
 	 * @return array
1228 1228
 	 */
1229
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1229
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1230 1230
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1231
-		if ( $states && count( $states ) != count( $QST->options() )) {
1232
-			$QST->set( 'QST_type', 'DROPDOWN' );
1231
+		if ($states && count($states) != count($QST->options())) {
1232
+			$QST->set('QST_type', 'DROPDOWN');
1233 1233
 			// if multiple countries, we'll create option groups within the dropdown
1234
-			foreach ( $states as $state ) {
1235
-				if ( $state instanceof EE_State ) {
1236
-					$QSO = EE_Question_Option::new_instance ( array (
1234
+			foreach ($states as $state) {
1235
+				if ($state instanceof EE_State) {
1236
+					$QSO = EE_Question_Option::new_instance(array(
1237 1237
 						'QSO_value' => $state->ID(),
1238 1238
 						'QSO_desc' => $state->name(),
1239
-						'QST_ID' => $QST->get( 'QST_ID' ),
1239
+						'QST_ID' => $QST->get('QST_ID'),
1240 1240
 						'QSO_deleted' => FALSE
1241 1241
 					));
1242 1242
 					// set option group
1243
-					$QSO->set_opt_group( $state->country()->name() );
1243
+					$QSO->set_opt_group($state->country()->name());
1244 1244
 					// add option to question
1245
-					$QST->add_temp_option( $QSO );
1245
+					$QST->add_temp_option($QSO);
1246 1246
 				}
1247 1247
 			}
1248 1248
 		}
@@ -1258,20 +1258,20 @@  discard block
 block discarded – undo
1258 1258
 	 * @internal param array $question
1259 1259
 	 * @return array
1260 1260
 	 */
1261
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1261
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1262 1262
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1263
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1264
-			$QST->set( 'QST_type', 'DROPDOWN' );
1263
+		if ($countries && count($countries) != count($QST->options())) {
1264
+			$QST->set('QST_type', 'DROPDOWN');
1265 1265
 			// now add countries
1266
-			foreach ( $countries as $country ) {
1267
-				if ( $country instanceof EE_Country ) {
1268
-					$QSO = EE_Question_Option::new_instance ( array (
1266
+			foreach ($countries as $country) {
1267
+				if ($country instanceof EE_Country) {
1268
+					$QSO = EE_Question_Option::new_instance(array(
1269 1269
 						'QSO_value' => $country->ID(),
1270 1270
 						'QSO_desc' => $country->name(),
1271
-						'QST_ID' => $QST->get( 'QST_ID' ),
1271
+						'QST_ID' => $QST->get('QST_ID'),
1272 1272
 						'QSO_deleted' => FALSE
1273 1273
 					));
1274
-					$QST->add_temp_option( $QSO );
1274
+					$QST->add_temp_option($QSO);
1275 1275
 				}
1276 1276
 			}
1277 1277
 		}
@@ -1288,11 +1288,11 @@  discard block
 block discarded – undo
1288 1288
 	 */
1289 1289
 	public static function two_digit_months_dropdown_options() {
1290 1290
 		$options = array();
1291
-		for ( $x = 1; $x <= 12; $x++ ) {
1292
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1293
-			$options[ (string)$mm ] = (string)$mm;
1291
+		for ($x = 1; $x <= 12; $x++) {
1292
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1293
+			$options[(string) $mm] = (string) $mm;
1294 1294
 		}
1295
-		return EEH_Form_Fields::prep_answer_options( $options );
1295
+		return EEH_Form_Fields::prep_answer_options($options);
1296 1296
 	}
1297 1297
 
1298 1298
 
@@ -1307,11 +1307,11 @@  discard block
 block discarded – undo
1307 1307
 		$options = array();
1308 1308
 		$current_year = date('y');
1309 1309
 		$next_decade = $current_year + 10;
1310
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1311
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1312
-			$options[ (string)$yy ] = (string)$yy;
1310
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1311
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1312
+			$options[(string) $yy] = (string) $yy;
1313 1313
 		}
1314
-		return EEH_Form_Fields::prep_answer_options( $options );
1314
+		return EEH_Form_Fields::prep_answer_options($options);
1315 1315
 	}
1316 1316
 
1317 1317
 
@@ -1325,17 +1325,17 @@  discard block
 block discarded – undo
1325 1325
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1326 1326
 	 * @return string                html
1327 1327
 	 */
1328
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1328
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1329 1329
 		$_where = array();
1330
-		if ( !empty( $status ) ) {
1330
+		if ( ! empty($status)) {
1331 1331
 			$_where['STS_ID'] = $status;
1332 1332
 		}
1333 1333
 
1334
-		if ( $evt_category > 0 ) {
1334
+		if ($evt_category > 0) {
1335 1335
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1336 1336
 		}
1337 1337
 
1338
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1338
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1339 1339
 
1340 1340
 		//setup vals for select input helper
1341 1341
 		$options = array(
@@ -1345,15 +1345,15 @@  discard block
 block discarded – undo
1345 1345
 				)
1346 1346
 			);
1347 1347
 
1348
-		foreach ( $regdtts as $regdtt ) {
1349
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1348
+		foreach ($regdtts as $regdtt) {
1349
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1350 1350
 			$options[] = array(
1351 1351
 				'text' => $date,
1352 1352
 				'id' => $date
1353 1353
 				);
1354 1354
 		}
1355 1355
 
1356
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1356
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1357 1357
 	}
1358 1358
 
1359 1359
 
@@ -1367,20 +1367,20 @@  discard block
 block discarded – undo
1367 1367
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1368 1368
 	 * @return string                    html
1369 1369
 	 */
1370
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1370
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1371 1371
 		//what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set!
1372 1372
 
1373 1373
 		//determine what post_status our condition will have for the query.
1374
-		switch ( $status ) {
1374
+		switch ($status) {
1375 1375
 			case 'month' :
1376 1376
 			case 'today' :
1377 1377
 			case NULL :
1378 1378
 			case 'all' :
1379
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1379
+				$where['Event.status'] = array('NOT IN', array('trash'));
1380 1380
 				break;
1381 1381
 
1382 1382
 			case 'draft' :
1383
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1383
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1384 1384
 
1385 1385
 			default :
1386 1386
 				$where['Event.status'] = $status;
@@ -1389,33 +1389,33 @@  discard block
 block discarded – undo
1389 1389
 		//categories?
1390 1390
 
1391 1391
 
1392
-		if ( !empty ( $evt_category ) ) {
1392
+		if ( ! empty ($evt_category)) {
1393 1393
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1394 1394
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1395 1395
 		}
1396 1396
 
1397 1397
 		//what about active status for the event?
1398
-		if ( !empty( $evt_active_status ) ) {
1399
-			switch ( $evt_active_status ) {
1398
+		if ( ! empty($evt_active_status)) {
1399
+			switch ($evt_active_status) {
1400 1400
 				case 'upcoming' :
1401 1401
 					$where['Event.status'] = 'publish';
1402
-					$where['DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time() ) );
1402
+					$where['DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time()));
1403 1403
 					break;
1404 1404
 
1405 1405
 				case 'expired' :
1406
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1407
-					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'AND' => array('Event.status' => 'publish', 'DTT_EVT_end' => array( '<',  date('Y-m-d g:i:s', time() ) ) ) );
1406
+					if (isset($where['Event.status'])) unset($where['Event.status']);
1407
+					$where['OR'] = array('Event.status' => array('!=', 'publish'), 'AND' => array('Event.status' => 'publish', 'DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time()))));
1408 1408
 					break;
1409 1409
 
1410 1410
 				case 'active' :
1411 1411
 					$where['Event.status'] = 'publish';
1412
-					$where['DTT_EVT_start'] = array('>',  date('Y-m-d g:i:s', time() ) );
1413
-					$where['DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time() ) );
1412
+					$where['DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time()));
1413
+					$where['DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time()));
1414 1414
 					break;
1415 1415
 
1416 1416
 				case 'inactive' :
1417
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1418
-					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) );
1417
+					if (isset($where['Event.status'])) unset($where['Event.status']);
1418
+					$where['OR'] = array('Event.status' => array('!=', 'publish'), 'DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time())));
1419 1419
 					break;
1420 1420
 			}
1421 1421
 		}
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
 		//translate month and date
1437 1437
 		global $wp_locale;
1438 1438
 
1439
-		foreach ( $DTTS as $DTT ) {
1440
-			$date = $wp_locale->get_month( date('m', strtotime($DTT->dtt_month)) ) . ' ' . $DTT->dtt_year;
1439
+		foreach ($DTTS as $DTT) {
1440
+			$date = $wp_locale->get_month(date('m', strtotime($DTT->dtt_month))).' '.$DTT->dtt_year;
1441 1441
 			$options[] = array(
1442 1442
 				'text' => $date,
1443 1443
 				'id' => $date
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 		}
1446 1446
 
1447 1447
 
1448
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1448
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1449 1449
 	}
1450 1450
 
1451 1451
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	 * @param  integer $current_cat currently selected category
1457 1457
 	 * @return string               html for dropdown
1458 1458
 	 */
1459
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1459
+	public static function generate_event_category_dropdown($current_cat = -1) {
1460 1460
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1461 1461
 		$options = array(
1462 1462
 			'0' => array(
@@ -1466,14 +1466,14 @@  discard block
 block discarded – undo
1466 1466
 			);
1467 1467
 
1468 1468
 		//setup categories for dropdown
1469
-		foreach ( $categories as $category ) {
1469
+		foreach ($categories as $category) {
1470 1470
 			$options[] = array(
1471 1471
 				'text' => $category->get('name'),
1472 1472
 				'id' => $category->ID()
1473 1473
 				);
1474 1474
 		}
1475 1475
 
1476
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1476
+		return self::select_input('EVT_CAT', $options, $current_cat);
1477 1477
 	}
1478 1478
 
1479 1479
 
@@ -1492,20 +1492,20 @@  discard block
 block discarded – undo
1492 1492
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1493 1493
 	 * @return    void
1494 1494
 	 */
1495
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1495
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1496 1496
 		$btn = '';
1497
-		if ( empty( $url ) || empty( $ID )) {
1497
+		if (empty($url) || empty($ID)) {
1498 1498
 			return $btn;
1499 1499
 		}
1500
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1501
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1502
-		if ( ! $input_only ) {
1503
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1504
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1500
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1501
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1502
+		if ( ! $input_only) {
1503
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1504
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1505 1505
 			$btn_frm .= $btn;
1506 1506
 			$btn_frm .= '</form>';
1507 1507
 			$btn = $btn_frm;
1508
-			unset ( $btn_frm );
1508
+			unset ($btn_frm);
1509 1509
 		}
1510 1510
 		return $btn;
1511 1511
 	}
Please login to merge, or discard this patch.
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -355,23 +355,27 @@  discard block
 block discarded – undo
355 355
 		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
356 356
 		//Debug
357 357
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
358
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
359
-			$field .= ' ' . $parameters;
358
+		if ( EEH_Formatter::ee_tep_not_null($parameters)) {
359
+					$field .= ' ' . $parameters;
360
+		}
360 361
 		if ($autosize) {
361 362
 			$size = 'med';
362 363
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
363 364
 				if ($values[$ii]['text']) {
364
-					if (strlen($values[$ii]['text']) > 5)
365
-						$size = 'wide';
365
+					if (strlen($values[$ii]['text']) > 5) {
366
+											$size = 'wide';
367
+					}
366 368
 				}
367 369
 			}
368
-		} else
369
-			$size = '';
370
+		} else {
371
+					$size = '';
372
+		}
370 373
 
371 374
 		$field .= ' class="' . $class . ' ' . $size . '">';
372 375
 
373
-		if (empty($default) && isset($GLOBALS[$name]))
374
-			$default = stripslashes($GLOBALS[$name]);
376
+		if (empty($default) && isset($GLOBALS[$name])) {
377
+					$default = stripslashes($GLOBALS[$name]);
378
+		}
375 379
 
376 380
 
377 381
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
@@ -1403,7 +1407,9 @@  discard block
 block discarded – undo
1403 1407
 					break;
1404 1408
 
1405 1409
 				case 'expired' :
1406
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1410
+					if ( isset( $where['Event.status'] ) ) {
1411
+						unset( $where['Event.status'] );
1412
+					}
1407 1413
 					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'AND' => array('Event.status' => 'publish', 'DTT_EVT_end' => array( '<',  date('Y-m-d g:i:s', time() ) ) ) );
1408 1414
 					break;
1409 1415
 
@@ -1414,7 +1420,9 @@  discard block
 block discarded – undo
1414 1420
 					break;
1415 1421
 
1416 1422
 				case 'inactive' :
1417
-					if ( isset( $where['Event.status'] ) ) unset( $where['Event.status'] );
1423
+					if ( isset( $where['Event.status'] ) ) {
1424
+						unset( $where['Event.status'] );
1425
+					}
1418 1426
 					$where['OR'] = array( 'Event.status' => array( '!=', 'publish' ), 'DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) );
1419 1427
 					break;
1420 1428
 			}
Please login to merge, or discard this patch.
core/helpers/EEH_Formatter.helper.php 4 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,6 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * [ee_tep_not_null description]
90 90
 	 * @param  string | array $value [description]
91
+	 * @param string $value
91 92
 	 * @return bool       [description]
92 93
 	 */
93 94
 	static public function ee_tep_not_null($value) {
@@ -573,6 +574,8 @@  discard block
 block discarded – undo
573 574
 	 * @param EE_State | string $state
574 575
 	 * @param EE_Country | string $country
575 576
 	 * @param string $zip
577
+	 * @param integer $state
578
+	 * @param string $country
576 579
 	 * @return EE_Generic_Address
577 580
 	 */
578 581
 	public function __construct( $address, $address2, $city, $state, $country, $zip ) {
@@ -660,7 +663,7 @@  discard block
 block discarded – undo
660 663
 
661 664
 
662 665
 	/**
663
-	 * @return \EE_State
666
+	 * @return string
664 667
 	 */
665 668
 	public function state_obj() {
666 669
 		return $this->_state_obj;
@@ -709,7 +712,7 @@  discard block
 block discarded – undo
709 712
 
710 713
 
711 714
 	/**
712
-	 * @return \EE_Country
715
+	 * @return string
713 716
 	 */
714 717
 	public function country_obj() {
715 718
 		return $this->_country_obj;
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 
298 298
 
299 299
 	/**
300
-	* 	_get_formatter - obtain the requester formatter class
301
-	*
302
-	* 	@access private
303
-	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
304
-	* 	@return EEI_Address_Formatter
305
-	*/
300
+	 * 	_get_formatter - obtain the requester formatter class
301
+	 *
302
+	 * 	@access private
303
+	 * 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
304
+	 * 	@return EEI_Address_Formatter
305
+	 */
306 306
 	private static function _get_formatter( $type ) {
307 307
 		switch( $type ) {
308 308
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 
349 349
 
350 350
 	/**
351
-	* 	_schema_formatting
352
-	* 	adds schema.org formatting to an address
353
-	*
354
-	* 	@access private
355
-	* 	@param object EEI_Address_Formatter $formatter
356
-	* 	@param object EEI_Address $obj_with_address
357
-	* 	@return string
358
-	*/
351
+	 * 	_schema_formatting
352
+	 * 	adds schema.org formatting to an address
353
+	 *
354
+	 * 	@access private
355
+	 * 	@param object EEI_Address_Formatter $formatter
356
+	 * 	@param object EEI_Address $obj_with_address
357
+	 * 	@return string
358
+	 */
359 359
 	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
360 360
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
361 361
 		$formatted_address .= $formatter->format(
@@ -396,50 +396,50 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 	/**
399
-	* 	location
400
-	* 	The location of the event, organization or action.
401
-	* 	Should include the Venue name AND schema formatted address info
402
-	*
403
-	* 	@access public
404
-	* 	@param string $location
405
-	* 	@return string
406
-	*/
399
+	 * 	location
400
+	 * 	The location of the event, organization or action.
401
+	 * 	Should include the Venue name AND schema formatted address info
402
+	 *
403
+	 * 	@access public
404
+	 * 	@param string $location
405
+	 * 	@return string
406
+	 */
407 407
 	public static function location ( $location = NULL ) {
408 408
 		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
409 409
 	}
410 410
 
411 411
 	/**
412
-	* 	name
413
-	* 	The name of the Event or Venue.
414
-	*
415
-	* 	@access public
416
-	* 	@param string $name
417
-	* 	@return string
418
-	*/
412
+	 * 	name
413
+	 * 	The name of the Event or Venue.
414
+	 *
415
+	 * 	@access public
416
+	 * 	@param string $name
417
+	 * 	@return string
418
+	 */
419 419
 	public static function name ( $name = NULL ) {
420 420
 		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
421 421
 	}
422 422
 
423 423
 	/**
424
-	* 	streetAddress
425
-	* 	The street address. For example, 1600 Amphitheatre Pkwy.
426
-	*
427
-	* 	@access public
428
-	* 	@param EEI_Address $obj_with_address
429
-	* 	@return string
430
-	*/
424
+	 * 	streetAddress
425
+	 * 	The street address. For example, 1600 Amphitheatre Pkwy.
426
+	 *
427
+	 * 	@access public
428
+	 * 	@param EEI_Address $obj_with_address
429
+	 * 	@return string
430
+	 */
431 431
 	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
432 432
 		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
433 433
 	}
434 434
 
435 435
 	/**
436
-	* 	postOfficeBoxNumber
437
-	* 	The post office box number for PO box addresses.
438
-	*
439
-	* 	@access public
440
-	* 	@param EEI_Address $obj_with_address
441
-	* 	@return string
442
-	*/
436
+	 * 	postOfficeBoxNumber
437
+	 * 	The post office box number for PO box addresses.
438
+	 *
439
+	 * 	@access public
440
+	 * 	@param EEI_Address $obj_with_address
441
+	 * 	@return string
442
+	 */
443 443
 	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
444 444
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
445 445
 		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
@@ -450,25 +450,25 @@  discard block
 block discarded – undo
450 450
 	}
451 451
 
452 452
 	/**
453
-	* 	addressLocality
454
-	* 	The locality (city, town, etc). For example, Mountain View.
455
-	*
456
-	* 	@access public
457
-	* 	@param EEI_Address $obj_with_address
458
-	* 	@return string
459
-	*/
453
+	 * 	addressLocality
454
+	 * 	The locality (city, town, etc). For example, Mountain View.
455
+	 *
456
+	 * 	@access public
457
+	 * 	@param EEI_Address $obj_with_address
458
+	 * 	@return string
459
+	 */
460 460
 	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
461 461
 		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
462 462
 	}
463 463
 
464 464
 	/**
465
-	* 	addressRegion
466
-	* 	The region (state, province, etc). For example, CA.
467
-	*
468
-	* 	@access public
469
-	* 	@param EEI_Address $obj_with_address
470
-	* 	@return string
471
-	*/
465
+	 * 	addressRegion
466
+	 * 	The region (state, province, etc). For example, CA.
467
+	 *
468
+	 * 	@access public
469
+	 * 	@param EEI_Address $obj_with_address
470
+	 * 	@return string
471
+	 */
472 472
 	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
473 473
 		$state = $obj_with_address->state();
474 474
 		if ( ! empty( $state ) ) {
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
 	}
480 480
 
481 481
 	/**
482
-	* 	addressCountry
483
-	* 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
484
-	*
485
-	* 	@access public
486
-	* 	@param EEI_Address $obj_with_address
487
-	* 	@return string
488
-	*/
482
+	 * 	addressCountry
483
+	 * 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
484
+	 *
485
+	 * 	@access public
486
+	 * 	@param EEI_Address $obj_with_address
487
+	 * 	@return string
488
+	 */
489 489
 	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
490 490
 		$country = $obj_with_address->country();
491 491
 		if ( ! empty( $country ) ) {
@@ -496,39 +496,39 @@  discard block
 block discarded – undo
496 496
 	}
497 497
 
498 498
 	/**
499
-	* 	postalCode
500
-	* 	The postal code. For example, 94043.
501
-	*
502
-	* 	@access public
503
-	* 	@param EEI_Address $obj_with_address
504
-	* 	@return string
505
-	*/
499
+	 * 	postalCode
500
+	 * 	The postal code. For example, 94043.
501
+	 *
502
+	 * 	@access public
503
+	 * 	@param EEI_Address $obj_with_address
504
+	 * 	@return string
505
+	 */
506 506
 	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
507 507
 		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
508 508
 	}
509 509
 
510 510
 	/**
511
-	* 	telephone
512
-	* 	The telephone number.
513
-	*
514
-	* 	@access public
515
-	* 	@param string $phone_nmbr
516
-	* 	@return string
517
-	*/
511
+	 * 	telephone
512
+	 * 	The telephone number.
513
+	 *
514
+	 * 	@access public
515
+	 * 	@param string $phone_nmbr
516
+	 * 	@return string
517
+	 */
518 518
 	public static function telephone ( $phone_nmbr = NULL ) {
519 519
 		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
520 520
 	}
521 521
 
522 522
 	/**
523
-	* 	URL
524
-	* 	URL of the item as a clickable link
525
-	*
526
-	* 	@access public
527
-	* 	@param string $url - the URL that the link will resolve to
528
-	* 	@param string $text - the text that will be used for the visible link
529
-	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
530
-	* 	@return string (link)
531
-	*/
523
+	 * 	URL
524
+	 * 	URL of the item as a clickable link
525
+	 *
526
+	 * 	@access public
527
+	 * 	@param string $url - the URL that the link will resolve to
528
+	 * 	@param string $text - the text that will be used for the visible link
529
+	 * 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
530
+	 * 	@return string (link)
531
+	 */
532 532
 	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
533 533
 		$atts = '';
534 534
 		foreach ( $attributes as $attribute => $value ) {
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 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
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param  string $content content to format
40 40
 	 * @return string          formatted content
41 41
 	 */
42
-	static public function admin_format_content($content='') {
42
+	static public function admin_format_content($content = '') {
43 43
 		return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8")));
44 44
 	}
45 45
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string
80 80
 	 */
81 81
 	static public	function ee_tep_parse_input_field_data($data, $parse) {
82
-		return strtr( trim($data), $parse);
82
+		return strtr(trim($data), $parse);
83 83
 	}
84 84
 
85 85
 
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 	 * @return string
117 117
 	 * @deprecated v4.6.21
118 118
 	 */
119
-	static public function event_date_display( $date, $format = '' ) {
119
+	static public function event_date_display($date, $format = '') {
120 120
 		EE_Error::doing_it_wrong(
121 121
 			'EEH_Formatter::event_date_display()',
122
-			__( 'This method is deprecated. If you wish to display an Event date in a theme template, then there are better alternatives such as EEH_Event_View::the_event_date() which can be found in \core\helpers\EEH_Event_View.helper.php', 'event_espresso' ),
122
+			__('This method is deprecated. If you wish to display an Event date in a theme template, then there are better alternatives such as EEH_Event_View::the_event_date() which can be found in \core\helpers\EEH_Event_View.helper.php', 'event_espresso'),
123 123
 			'4.6.21'
124 124
 		);
125
-		if ( empty( $date )) {
125
+		if (empty($date)) {
126 126
 			return '';
127 127
 		} else {
128 128
 			$format = $format == '' ? get_option('date_format') : $format;
129
-			return date_i18n( $format, strtotime( $date ));
129
+			return date_i18n($format, strtotime($date));
130 130
 		}
131 131
 	}
132 132
 
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	 * @param string $zip
164 164
 	 * @return string
165 165
 	 */
166
-	public function format( $address, $address2, $city, $state, $country, $zip ) {
166
+	public function format($address, $address2, $city, $state, $country, $zip) {
167 167
 		$formatted_address = $address;
168
-		$formatted_address .= ! empty( $address2 ) ? '<br/>' . $address2 : '';
169
-		$formatted_address .= ! empty( $city ) ? '<br/>' . $city : '';
170
-		$formatted_address .=  ! empty( $city ) && ! empty( $state ) ? ', ' : '';
171
-		$formatted_address .= ! empty( $state ) ? $state : '';
172
-		$formatted_address .= ! empty( $zip ) ? '<br/>' . $zip : '';
173
-		$formatted_address .= ! empty( $country ) ? '<br/>' . $country : '';
168
+		$formatted_address .= ! empty($address2) ? '<br/>'.$address2 : '';
169
+		$formatted_address .= ! empty($city) ? '<br/>'.$city : '';
170
+		$formatted_address .= ! empty($city) && ! empty($state) ? ', ' : '';
171
+		$formatted_address .= ! empty($state) ? $state : '';
172
+		$formatted_address .= ! empty($zip) ? '<br/>'.$zip : '';
173
+		$formatted_address .= ! empty($country) ? '<br/>'.$country : '';
174 174
 		return $formatted_address;
175 175
 	}
176 176
 }
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
 	 * @param string $zip
203 203
 	 * @return string
204 204
 	 */
205
-	public function format( $address, $address2, $city, $state, $country, $zip ) {
205
+	public function format($address, $address2, $city, $state, $country, $zip) {
206 206
 		$formatted_address = $address;
207
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
208
-		$formatted_address .= ! empty( $address2 ) ? $address2 : '';
209
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
210
-		$formatted_address .= ! empty( $city ) ? $city : '';
211
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
212
-		$formatted_address .= ! empty( $state ) ? $state : '';
213
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
214
-		$formatted_address .= ! empty( $country ) ? $country : '';
215
-		$formatted_address .= substr( $formatted_address, -2 ) != ', ' ? ', ' : '';
216
-		$formatted_address .= ! empty( $zip ) ? $zip : '';
207
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
208
+		$formatted_address .= ! empty($address2) ? $address2 : '';
209
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
210
+		$formatted_address .= ! empty($city) ? $city : '';
211
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
212
+		$formatted_address .= ! empty($state) ? $state : '';
213
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
214
+		$formatted_address .= ! empty($country) ? $country : '';
215
+		$formatted_address .= substr($formatted_address, -2) != ', ' ? ', ' : '';
216
+		$formatted_address .= ! empty($zip) ? $zip : '';
217 217
 		return $formatted_address;
218 218
 	}
219 219
 }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @param string $zip
247 247
 	 * @return string
248 248
 	 */
249
-	public function format( $address, $address2, $city, $state, $country, $zip ) {
249
+	public function format($address, $address2, $city, $state, $country, $zip) {
250 250
 		return NULL;
251 251
 	}
252 252
 }
@@ -282,20 +282,20 @@  discard block
 block discarded – undo
282 282
 	 * @param bool    $add_wrapper
283 283
 	 * @return string
284 284
 	 */
285
-	public static function format ( $obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true ) {
285
+	public static function format($obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true) {
286 286
 		// check that incoming object implements the EEI_Address interface
287
-		if ( ! $obj_with_address instanceof EEI_Address ) {
288
-			$msg = __( 'The address could not be formatted.', 'event_espresso' );
289
-			$dev_msg = __( 'The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso' );
290
-			EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
287
+		if ( ! $obj_with_address instanceof EEI_Address) {
288
+			$msg = __('The address could not be formatted.', 'event_espresso');
289
+			$dev_msg = __('The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso');
290
+			EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
291 291
 			return null;
292 292
 		}
293 293
 		// obtain an address formatter
294
-		$formatter = EEH_Address::_get_formatter( $type );
294
+		$formatter = EEH_Address::_get_formatter($type);
295 295
 		// apply schema.org formatting ?
296 296
 		$use_schema = ! is_admin() ? $use_schema : false;
297
-		$formatted_address = $use_schema ? EEH_Address::_schema_formatting( $formatter, $obj_with_address ) : EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper ) ;
298
-		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">' . $formatted_address . '</div>' : $formatted_address;
297
+		$formatted_address = $use_schema ? EEH_Address::_schema_formatting($formatter, $obj_with_address) : EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
298
+		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">'.$formatted_address.'</div>' : $formatted_address;
299 299
 		// return the formatted address
300 300
 		return $formatted_address;
301 301
 	}
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
310 310
 	* 	@return EEI_Address_Formatter
311 311
 	*/
312
-	private static function _get_formatter( $type ) {
313
-		switch( $type ) {
312
+	private static function _get_formatter($type) {
313
+		switch ($type) {
314 314
 
315 315
 			case 'multiline' :
316 316
 				return new EE_MultiLine_Address_Formatter();
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 * @param bool $add_wrapper
337 337
 	 * @return string
338 338
 	 */
339
-	private static function _regular_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE ){
339
+	private static function _regular_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE) {
340 340
 		$formatted_address = $add_wrapper ? '<div>' : '';
341 341
 		$formatted_address .= $formatter->format(
342 342
 			$obj_with_address->address(),
@@ -362,15 +362,15 @@  discard block
 block discarded – undo
362 362
 	* 	@param object EEI_Address $obj_with_address
363 363
 	* 	@return string
364 364
 	*/
365
-	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
365
+	private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) {
366 366
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
367 367
 		$formatted_address .= $formatter->format(
368
-			EEH_Schema::streetAddress( $obj_with_address ),
369
-			EEH_Schema::postOfficeBoxNumber( $obj_with_address ),
370
-			EEH_Schema::addressLocality( $obj_with_address ),
371
-			EEH_Schema::addressRegion( $obj_with_address ),
372
-			EEH_Schema::addressCountry( $obj_with_address ),
373
-			EEH_Schema::postalCode( $obj_with_address )
368
+			EEH_Schema::streetAddress($obj_with_address),
369
+			EEH_Schema::postOfficeBoxNumber($obj_with_address),
370
+			EEH_Schema::addressLocality($obj_with_address),
371
+			EEH_Schema::addressRegion($obj_with_address),
372
+			EEH_Schema::addressCountry($obj_with_address),
373
+			EEH_Schema::postalCode($obj_with_address)
374 374
 		);
375 375
 		$formatted_address .= '</div>';
376 376
 		// return the formatted address
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
 	* 	@param string $location
411 411
 	* 	@return string
412 412
 	*/
413
-	public static function location ( $location = NULL ) {
414
-		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
413
+	public static function location($location = NULL) {
414
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'.$location.'</div>' : '';
415 415
 	}
416 416
 
417 417
 	/**
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	* 	@param string $name
423 423
 	* 	@return string
424 424
 	*/
425
-	public static function name ( $name = NULL ) {
426
-		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
425
+	public static function name($name = NULL) {
426
+		return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
427 427
 	}
428 428
 
429 429
 	/**
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	* 	@param EEI_Address $obj_with_address
435 435
 	* 	@return string
436 436
 	*/
437
-	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
438
-		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
437
+	public static function streetAddress(EEI_Address $obj_with_address = NULL) {
438
+		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
439 439
 	}
440 440
 
441 441
 	/**
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
 	* 	@param EEI_Address $obj_with_address
447 447
 	* 	@return string
448 448
 	*/
449
-	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
449
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = NULL) {
450 450
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
451
-		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
452
-			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
451
+		if (preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2())) {
452
+			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
453 453
 		} else {
454 454
 			return $obj_with_address->address2();
455 455
 		}
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	* 	@param EEI_Address $obj_with_address
464 464
 	* 	@return string
465 465
 	*/
466
-	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
467
-		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
466
+	public static function addressLocality(EEI_Address $obj_with_address = NULL) {
467
+		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
468 468
 	}
469 469
 
470 470
 	/**
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 	* 	@param EEI_Address $obj_with_address
476 476
 	* 	@return string
477 477
 	*/
478
-	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
478
+	public static function addressRegion(EEI_Address $obj_with_address = NULL) {
479 479
 		$state = $obj_with_address->state();
480
-		if ( ! empty( $state ) ) {
481
-			return '<span itemprop="addressRegion">' . $state . '</span>';
480
+		if ( ! empty($state)) {
481
+			return '<span itemprop="addressRegion">'.$state.'</span>';
482 482
 		} else {
483 483
 			return '';
484 484
 		}
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 	* 	@param EEI_Address $obj_with_address
493 493
 	* 	@return string
494 494
 	*/
495
-	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
495
+	public static function addressCountry(EEI_Address $obj_with_address = NULL) {
496 496
 		$country = $obj_with_address->country();
497
-		if ( ! empty( $country ) ) {
498
-			return '<span itemprop="addressCountry">' . $country . '</span>';
497
+		if ( ! empty($country)) {
498
+			return '<span itemprop="addressCountry">'.$country.'</span>';
499 499
 		} else {
500 500
 			return '';
501 501
 		}
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	* 	@param EEI_Address $obj_with_address
510 510
 	* 	@return string
511 511
 	*/
512
-	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
513
-		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
512
+	public static function postalCode(EEI_Address $obj_with_address = NULL) {
513
+		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'.$obj_with_address->zip().'</span>' : '';
514 514
 	}
515 515
 
516 516
 	/**
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 	* 	@param string $phone_nmbr
522 522
 	* 	@return string
523 523
 	*/
524
-	public static function telephone ( $phone_nmbr = NULL ) {
525
-		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
524
+	public static function telephone($phone_nmbr = NULL) {
525
+		return $phone_nmbr !== NULL && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>' : '';
526 526
 	}
527 527
 
528 528
 	/**
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
536 536
 	* 	@return string (link)
537 537
 	*/
538
-	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
538
+	public static function url($url = NULL, $text = NULL, $attributes = array()) {
539 539
 		$atts = '';
540
-		foreach ( $attributes as $attribute => $value ) {
541
-			$atts .= ' ' . $attribute . '="' . $value . '"';
540
+		foreach ($attributes as $attribute => $value) {
541
+			$atts .= ' '.$attribute.'="'.$value.'"';
542 542
 		}
543 543
 		$text = $text !== NULL && $text !== '' ? $text : $url;
544
-		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>' : '';
544
+		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>' : '';
545 545
 	}
546 546
 
547 547
 
@@ -581,17 +581,17 @@  discard block
 block discarded – undo
581 581
 	 * @param string $zip
582 582
 	 * @return EE_Generic_Address
583 583
 	 */
584
-	public function __construct( $address, $address2, $city, $state, $country, $zip ) {
584
+	public function __construct($address, $address2, $city, $state, $country, $zip) {
585 585
 		$this->_address = $address;
586 586
 		$this->_address2 = $address2;
587 587
 		$this->_city = $city;
588
-		if ( $state instanceof EE_State ) {
588
+		if ($state instanceof EE_State) {
589 589
 			$this->_state_obj = $state;
590 590
 		} else {
591 591
 			$this->_state_ID = $state;
592 592
 			$this->_state_obj = $this->_get_state_obj();
593 593
 		}
594
-		if ( $country instanceof EE_Country ) {
594
+		if ($country instanceof EE_Country) {
595 595
 			$this->_country_obj = $country;
596 596
 		} else {
597 597
 			$this->_country_ID = $country;
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * @return \EE_State
634 634
 	 */
635 635
 	private function _get_state_obj() {
636
-		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $this->_state_ID );
636
+		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model('State')->get_one_by_ID($this->_state_ID);
637 637
 	}
638 638
 
639 639
 
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * @return string
652 652
 	 */
653 653
 	public function state_abbrev() {
654
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
654
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
655 655
 	}
656 656
 
657 657
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * @return string
661 661
 	 */
662 662
 	public function state_name() {
663
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() :  __( 'Unknown', 'event_espresso' );
663
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso');
664 664
 	}
665 665
 
666 666
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	 * @return string
679 679
 	 */
680 680
 	public function state() {
681
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
681
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
682 682
 			return $this->state_obj()->abbrev();
683 683
 		} else {
684 684
 			return $this->state_name();
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @return EE_Country
692 692
 	 */
693 693
 	private function _get_country_obj() {
694
-		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $this->_country_ID );
694
+		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model('Country')->get_one_by_ID($this->_country_ID);
695 695
 	}
696 696
 
697 697
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 * @return string
710 710
 	 */
711 711
 	public function country_name() {
712
-		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() :  __( 'Unknown', 'event_espresso' );
712
+		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso');
713 713
 	}
714 714
 
715 715
 
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 */
729 729
 	public function country() {
730
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
730
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
731 731
 			return $this->country_ID();
732 732
 		} else {
733 733
 			return $this->country_name();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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
Please login to merge, or discard this patch.
core/helpers/EEH_Maps.helper.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,6 @@  discard block
 block discarded – undo
31 31
 
32 32
 	/**
33 33
 	 * google_map - creates a Google Map Link
34
-	 * @param  array $atts aray of attributes required for the map link generation
35 34
 	 * @return string (link to map!)
36 35
 	 */
37 36
 	public static function google_map( $ee_gmaps_opts ){
@@ -116,7 +115,6 @@  discard block
 block discarded – undo
116 115
 
117 116
 	/**
118 117
 	 * creates a Google Map Link
119
-	 * @param  array $atts aray of attributes required for the map link generation
120 118
 	 * @return string (link to map!)
121 119
 	 */
122 120
 	public static function espresso_google_map_js() {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
 	 * @param  array $atts aray of attributes required for the map link generation
35 35
 	 * @return string (link to map!)
36 36
 	 */
37
-	public static function google_map( $ee_gmaps_opts ){
37
+	public static function google_map($ee_gmaps_opts) {
38 38
 
39 39
 		//d( $ee_gmaps_opts );
40 40
 
41
-		$ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300';
42
-		$ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185';
43
-		$ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
44
-		$ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false';
45
-		$ee_map_nav_size =  isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
46
-		$ee_map_type_control =  isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default';
47
-		$static_url =  isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE;
41
+		$ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';
42
+		$ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';
43
+		$ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
44
+		$ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';
45
+		$ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
46
+		$ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default';
47
+		$static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE;
48 48
 
49
-		if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){
50
-			switch( $ee_gmaps_opts['ee_map_align'] ){
49
+		if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) {
50
+			switch ($ee_gmaps_opts['ee_map_align']) {
51 51
 				case "left":
52 52
 					$map_align = 'ee-gmap-align-left left';
53 53
 					break;
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 
69 69
 		// Determine whether user has set a hardoded url to use and
70 70
 		// if so display a Google static iframe map else run V3 api
71
-		if( $static_url ) {
71
+		if ($static_url) {
72 72
 
73
-			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';
74
-			$html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width  .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">';
73
+			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';
74
+			$html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">';
75 75
 			$html .= '</iframe>';
76
-			$html .= '<a href="' . $static_url . '">View Large map</a>';
76
+			$html .= '<a href="'.$static_url.'">View Large map</a>';
77 77
 			$html .= '</div>';
78 78
 			return $html;
79 79
 
80 80
 		 } else {
81 81
 
82
-			EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(
82
+			EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(
83 83
 				'map_ID' => $ee_gmaps_opts['map_ID'],
84 84
 				'ee_map_zoom' => $ee_map_zoom,
85 85
 				'ee_map_nav_display' => $ee_map_nav_display,
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 			);
90 90
 
91 91
 			$html = '<div class="ee-gmap-wrapper '.$map_align.';">';
92
-			$html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>';  //
92
+			$html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; //
93 93
 			$html .= '</div>';
94 94
 
95
-			wp_enqueue_script( 'gmap_api' );
96
-			wp_enqueue_script( 'ee_gmap' );
97
-			add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' ));
95
+			wp_enqueue_script('gmap_api');
96
+			wp_enqueue_script('ee_gmap');
97
+			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script'));
98 98
 
99 99
 			return $html;
100 100
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return void
110 110
 	 */
111 111
 	public static function footer_enqueue_script() {
112
-		wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars );
112
+		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars);
113 113
 	}
114 114
 
115 115
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public static function espresso_google_map_js() {
123 123
 		$scheme = is_ssl() ? 'https://' : 'http://';
124
-		wp_register_script( 'gmap_api', $scheme . 'maps.google.com/maps/api/js?sensor=false', array('jquery'), NULL, TRUE );
125
-		wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE );
124
+		wp_register_script('gmap_api', $scheme.'maps.google.com/maps/api/js?sensor=false', array('jquery'), NULL, TRUE);
125
+		wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE);
126 126
 	}
127 127
 
128 128
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @return string (link to map!)
132 132
 	 */
133 133
 	public static function google_map_link($atts) {
134
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
134
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
135 135
 		extract($atts);
136 136
 
137 137
 		$address = "{$address}";
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 		$id = isset($id) ? $id : 'not_set';
147 147
 		$map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';
148 148
 
149
-		$address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
149
+		$address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : '');
150 150
 
151
-		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string ));
151
+		$google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string));
152 152
 
153 153
 		switch ($type) {
154 154
 			case 'text':
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
 			case 'map':
164 164
 				$scheme = is_ssl() ? 'https://' : 'http://';
165
-				return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode( $address_string ) . '&amp;sensor=false' ) . '" /></a>';
165
+				return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&amp;zoom=14&amp;size='.$map_w.'x'.$map_h.'&amp;markers=color:green|label:|'.urlencode($address_string).'&amp;sensor=false').'" /></a>';
166 166
 		}
167 167
 
168
-		return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
168
+		return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>';
169 169
 	}
170 170
 
171 171
 
Please login to merge, or discard this patch.