Completed
Branch FET-10304-welcome-to-vue (2869cd)
by
unknown
12:52
created
core/EE_Config.core.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public static function reset( $hard_reset = false, $reinstantiate = true ) {
157 157
 		if ( self::$_instance instanceof EE_Config ) {
158
-            if ($hard_reset) {
159
-                self::$_instance->_addon_option_names = array();
160
-                self::$_instance->_initialize_config();
161
-                self::$_instance->update_espresso_config();
162
-            }
163
-            self::$_instance->update_addon_option_names();
158
+			if ($hard_reset) {
159
+				self::$_instance->_addon_option_names = array();
160
+				self::$_instance->_initialize_config();
161
+				self::$_instance->update_espresso_config();
162
+			}
163
+			self::$_instance->update_addon_option_names();
164 164
 		}
165 165
 		self::$_instance = null;
166 166
 		//we don't need to reset the static properties imo because those should
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
 		$table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true );
2212 2212
 		// get country code from organization settings or use default
2213 2213
 		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization )
2214
-		           && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2214
+				   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2215 2215
 			? EE_Registry::instance()->CFG->organization->CNT_ISO
2216 2216
 			: '';
2217 2217
 		// but override if requested
@@ -2521,12 +2521,12 @@  discard block
 block discarded – undo
2521 2521
 	public $help_tour_activation;
2522 2522
 
2523 2523
 	/**
2524
-     * adds extra layer of encoding to session data to prevent serialization errors
2525
-     * but is incompatible with some server configuration errors
2526
-     * if you get "500 internal server errors" during registration, try turning this on
2527
-     * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2528
-     *
2529
-     * @var boolean $encode_session_data
2524
+	 * adds extra layer of encoding to session data to prevent serialization errors
2525
+	 * but is incompatible with some server configuration errors
2526
+	 * if you get "500 internal server errors" during registration, try turning this on
2527
+	 * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2528
+	 *
2529
+	 * @var boolean $encode_session_data
2530 2530
 	 */
2531 2531
 	private $encode_session_data = false;
2532 2532
 
@@ -2591,21 +2591,21 @@  discard block
 block discarded – undo
2591 2591
 
2592 2592
 
2593 2593
 
2594
-    /**
2595
-     * @return boolean
2596
-     */
2597
-    public function encode_session_data() {
2598
-        return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN );
2599
-    }
2594
+	/**
2595
+	 * @return boolean
2596
+	 */
2597
+	public function encode_session_data() {
2598
+		return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN );
2599
+	}
2600 2600
 
2601 2601
 
2602 2602
 
2603
-    /**
2604
-     * @param boolean $encode_session_data
2605
-     */
2606
-    public function set_encode_session_data( $encode_session_data ) {
2607
-        $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN );
2608
-    }
2603
+	/**
2604
+	 * @param boolean $encode_session_data
2605
+	 */
2606
+	public function set_encode_session_data( $encode_session_data ) {
2607
+		$this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN );
2608
+	}
2609 2609
 
2610 2610
 
2611 2611
 
@@ -2649,13 +2649,13 @@  discard block
 block discarded – undo
2649 2649
 	public $current_espresso_theme;
2650 2650
 
2651 2651
 	/**
2652
-	* @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2653
-	*/
2652
+	 * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2653
+	 */
2654 2654
 	public $EED_Ticket_Selector;
2655 2655
 
2656 2656
 	/**
2657
-	* @var EE_Event_Single_Config $EED_Event_Single
2658
-	*/
2657
+	 * @var EE_Event_Single_Config $EED_Event_Single
2658
+	 */
2659 2659
 	public $EED_Event_Single;
2660 2660
 
2661 2661
 	/**
@@ -2981,8 +2981,8 @@  discard block
 block discarded – undo
2981 2981
 	 */
2982 2982
 	public function max_input_vars_limit_check( $input_count = 0 ) {
2983 2983
 		if ( ! empty( $this->php->max_input_vars )
2984
-		     && ( $input_count >= $this->php->max_input_vars )
2985
-		     && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 )
2984
+			 && ( $input_count >= $this->php->max_input_vars )
2985
+			 && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 )
2986 2986
 		) {
2987 2987
 			return sprintf(
2988 2988
 				__(
@@ -3026,22 +3026,22 @@  discard block
 block discarded – undo
3026 3026
 class EE_Tax_Config extends EE_Config_Base
3027 3027
 {
3028 3028
 
3029
-    /*
3029
+	/*
3030 3030
      * flag to indicate whether or not to display ticket prices with the taxes included
3031 3031
      *
3032 3032
      * @var boolean $prices_displayed_including_taxes
3033 3033
      */
3034
-    public $prices_displayed_including_taxes;
3034
+	public $prices_displayed_including_taxes;
3035 3035
 
3036 3036
 
3037 3037
 
3038
-    /**
3039
-     *    class constructor
3040
-     */
3041
-    public function __construct()
3042
-    {
3043
-        $this->prices_displayed_including_taxes = true;
3044
-    }
3038
+	/**
3039
+	 *    class constructor
3040
+	 */
3041
+	public function __construct()
3042
+	{
3043
+		$this->prices_displayed_including_taxes = true;
3044
+	}
3045 3045
 }
3046 3046
 
3047 3047
 
Please login to merge, or discard this patch.
Spacing   +398 added lines, -398 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
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public static function instance() {
135 135
 		// check if class object is instantiated, and instantiated properly
136
-		if ( ! self::$_instance instanceof EE_Config ) {
136
+		if ( ! self::$_instance instanceof EE_Config) {
137 137
 			self::$_instance = new self();
138 138
 		}
139 139
 		return self::$_instance;
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 *                               site was put into maintenance mode)
154 154
 	 * @return EE_Config
155 155
 	 */
156
-	public static function reset( $hard_reset = false, $reinstantiate = true ) {
157
-		if ( self::$_instance instanceof EE_Config ) {
156
+	public static function reset($hard_reset = false, $reinstantiate = true) {
157
+		if (self::$_instance instanceof EE_Config) {
158 158
             if ($hard_reset) {
159 159
                 self::$_instance->_addon_option_names = array();
160 160
                 self::$_instance->_initialize_config();
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		//we don't need to reset the static properties imo because those should
167 167
 		//only change when a module is added or removed. Currently we don't
168 168
 		//support removing a module during a request when it previously existed
169
-		if ( $reinstantiate ) {
169
+		if ($reinstantiate) {
170 170
 			return self::instance();
171 171
 		} else {
172 172
 			return null;
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @access    private
182 182
 	 */
183 183
 	private function __construct() {
184
-		do_action( 'AHEE__EE_Config__construct__begin', $this );
185
-		EE_Config::$_logging_enabled = apply_filters( 'FHEE__EE_Config___construct__logging_enabled', false );
184
+		do_action('AHEE__EE_Config__construct__begin', $this);
185
+		EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
186 186
 		// setup empty config classes
187 187
 		$this->_initialize_config();
188 188
 		// load existing EE site settings
@@ -192,17 +192,17 @@  discard block
 block discarded – undo
192 192
 		//  register shortcodes and modules
193 193
 		add_action(
194 194
 			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
195
-			array( $this, 'register_shortcodes_and_modules' ),
195
+			array($this, 'register_shortcodes_and_modules'),
196 196
 			999
197 197
 		);
198 198
 		//  initialize shortcodes and modules
199
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) );
199
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
200 200
 		// register widgets
201
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
201
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
202 202
 		// shutdown
203
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
203
+		add_action('shutdown', array($this, 'shutdown'), 10);
204 204
 		// construct__end hook
205
-		do_action( 'AHEE__EE_Config__construct__end', $this );
205
+		do_action('AHEE__EE_Config__construct__end', $this);
206 206
 		// hardcoded hack
207 207
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
208 208
 	}
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 * @return string current theme set.
225 225
 	 */
226 226
 	public static function get_current_theme() {
227
-		return isset( self::$_instance->template_settings->current_espresso_theme )
227
+		return isset(self::$_instance->template_settings->current_espresso_theme)
228 228
 			? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
229 229
 	}
230 230
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	private function _initialize_config() {
240 240
 		EE_Config::trim_log();
241 241
 		//set defaults
242
-		$this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() );
242
+		$this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
243 243
 		$this->addons = new stdClass();
244 244
 		// set _module_route_map
245 245
 		EE_Config::$_module_route_map = array();
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	private function _load_core_config() {
261 261
 		// load_core_config__start hook
262
-		do_action( 'AHEE__EE_Config___load_core_config__start', $this );
262
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
263 263
 		$espresso_config = $this->get_espresso_config();
264
-		foreach ( $espresso_config as $config => $settings ) {
264
+		foreach ($espresso_config as $config => $settings) {
265 265
 			// load_core_config__start hook
266 266
 			$settings = apply_filters(
267 267
 				'FHEE__EE_Config___load_core_config__config_settings',
@@ -269,22 +269,22 @@  discard block
 block discarded – undo
269 269
 				$config,
270 270
 				$this
271 271
 			);
272
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
273
-				$this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
272
+			if (is_object($settings) && property_exists($this, $config)) {
273
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
274 274
 				//call configs populate method to ensure any defaults are set for empty values.
275
-				if ( method_exists( $settings, 'populate' ) ) {
275
+				if (method_exists($settings, 'populate')) {
276 276
 					$this->{$config}->populate();
277 277
 				}
278
-				if ( method_exists( $settings, 'do_hooks' ) ) {
278
+				if (method_exists($settings, 'do_hooks')) {
279 279
 					$this->{$config}->do_hooks();
280 280
 				}
281 281
 			}
282 282
 		}
283
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) {
283
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) {
284 284
 			$this->update_espresso_config();
285 285
 		}
286 286
 		// load_core_config__end hook
287
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
287
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
288 288
 	}
289 289
 
290 290
 
@@ -299,23 +299,23 @@  discard block
 block discarded – undo
299 299
 		$this->core = $this->core instanceof EE_Core_Config
300 300
 			? $this->core
301 301
 			: new EE_Core_Config();
302
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
302
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
303 303
 		$this->organization = $this->organization instanceof EE_Organization_Config
304 304
 			? $this->organization
305 305
 			: new EE_Organization_Config();
306
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
306
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
307 307
 		$this->currency = $this->currency instanceof EE_Currency_Config
308 308
 			? $this->currency
309 309
 			: new EE_Currency_Config();
310
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
310
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
311 311
 		$this->registration = $this->registration instanceof EE_Registration_Config
312 312
 			? $this->registration
313 313
 			: new EE_Registration_Config();
314
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
314
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
315 315
 		$this->admin = $this->admin instanceof EE_Admin_Config
316 316
 			? $this->admin
317 317
 			: new EE_Admin_Config();
318
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
318
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
319 319
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
320 320
 			? $this->template_settings
321 321
 			: new EE_Template_Config();
@@ -326,19 +326,19 @@  discard block
 block discarded – undo
326 326
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
327 327
 			? $this->map_settings
328 328
 			: new EE_Map_Config();
329
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
329
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
330 330
 		$this->environment = $this->environment instanceof EE_Environment_Config
331 331
 			? $this->environment
332 332
 			: new EE_Environment_Config();
333
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
333
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
334 334
 		$this->tax_settings = $this->tax_settings instanceof EE_Tax_Config
335 335
 			? $this->tax_settings
336 336
 			: new EE_Tax_Config();
337
-		$this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings );
337
+		$this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings);
338 338
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
339 339
 			? $this->gateway
340 340
 			: new EE_Gateway_Config();
341
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
341
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
342 342
 	}
343 343
 
344 344
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		// grab espresso configuration
354 354
 		return apply_filters(
355 355
 			'FHEE__EE_Config__get_espresso_config__CFG',
356
-			get_option( EE_Config::OPTION_NAME, array() )
356
+			get_option(EE_Config::OPTION_NAME, array())
357 357
 		);
358 358
 	}
359 359
 
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	 * @param        $old_value
368 368
 	 * @param        $value
369 369
 	 */
370
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
370
+	public function double_check_config_comparison($option = '', $old_value, $value) {
371 371
 		// make sure we're checking the ee config
372
-		if ( $option === EE_Config::OPTION_NAME ) {
372
+		if ($option === EE_Config::OPTION_NAME) {
373 373
 			// run a loose comparison of the old value against the new value for type and properties,
374 374
 			// but NOT exact instance like WP update_option does (ie: NOT type safe comparison)
375
-			if ( $value != $old_value ) {
375
+			if ($value != $old_value) {
376 376
 				// if they are NOT the same, then remove the hook,
377 377
 				// which means the subsequent update results will be based solely on the update query results
378 378
 				// the reason we do this is because, as stated above,
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				// the string it sees in the db looks the same as the new one it has been passed!!!
388 388
 				// This results in the query returning an "affected rows" value of ZERO,
389 389
 				// which gets returned immediately by WP update_option and looks like an error.
390
-				remove_action( 'update_option', array( $this, 'check_config_updated' ) );
390
+				remove_action('update_option', array($this, 'check_config_updated'));
391 391
 			}
392 392
 		}
393 393
 	}
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	protected function _reset_espresso_addon_config() {
403 403
 		$this->_addon_option_names = array();
404
-		foreach ( $this->addons as $addon_name => $addon_config_obj ) {
405
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
406
-			$config_class = get_class( $addon_config_obj );
407
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
408
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, false );
404
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
405
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
406
+			$config_class = get_class($addon_config_obj);
407
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
408
+				$this->update_config('addons', $addon_name, $addon_config_obj, false);
409 409
 			}
410 410
 			$this->addons->{$addon_name} = null;
411 411
 		}
@@ -421,22 +421,22 @@  discard block
 block discarded – undo
421 421
 	 * @param   bool $add_error
422 422
 	 * @return   bool
423 423
 	 */
424
-	public function update_espresso_config( $add_success = false, $add_error = true ) {
424
+	public function update_espresso_config($add_success = false, $add_error = true) {
425 425
 		// don't allow config updates during WP heartbeats
426
-		if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) {
426
+		if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') {
427 427
 			return false;
428 428
 		}
429 429
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
430 430
 		//$clone = clone( self::$_instance );
431 431
 		//self::$_instance = NULL;
432
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this );
432
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
433 433
 		$this->_reset_espresso_addon_config();
434 434
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
435 435
 		// but BEFORE the actual update occurs
436
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
436
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
437 437
 		// now update "ee_config"
438
-		$saved = update_option( EE_Config::OPTION_NAME, $this );
439
-		EE_Config::log( EE_Config::OPTION_NAME );
438
+		$saved = update_option(EE_Config::OPTION_NAME, $this);
439
+		EE_Config::log(EE_Config::OPTION_NAME);
440 440
 		// if not saved... check if the hook we just added still exists;
441 441
 		// if it does, it means one of two things:
442 442
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -447,17 +447,17 @@  discard block
 block discarded – undo
447 447
 		// but just means no update occurred, so don't display an error to the user.
448 448
 		// BUT... if update_option returns FALSE, AND the hook is missing,
449 449
 		// then it means that something truly went wrong
450
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved;
450
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
451 451
 		// remove our action since we don't want it in the system anymore
452
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
453
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
452
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
453
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
454 454
 		//self::$_instance = $clone;
455 455
 		//unset( $clone );
456 456
 		// if config remains the same or was updated successfully
457
-		if ( $saved ) {
458
-			if ( $add_success ) {
457
+		if ($saved) {
458
+			if ($add_success) {
459 459
 				EE_Error::add_success(
460
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
460
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
461 461
 					__FILE__,
462 462
 					__FUNCTION__,
463 463
 					__LINE__
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 			}
466 466
 			return true;
467 467
 		} else {
468
-			if ( $add_error ) {
468
+			if ($add_error) {
469 469
 				EE_Error::add_error(
470
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
470
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
471 471
 					__FILE__,
472 472
 					__FUNCTION__,
473 473
 					__LINE__
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
 		$name = '',
497 497
 		$config_class = '',
498 498
 		$config_obj = null,
499
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
499
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
500 500
 		$display_errors = true
501 501
 	) {
502 502
 		try {
503
-			foreach ( $tests_to_run as $test ) {
504
-				switch ( $test ) {
503
+			foreach ($tests_to_run as $test) {
504
+				switch ($test) {
505 505
 					// TEST #1 : check that section was set
506 506
 					case 1 :
507
-						if ( empty( $section ) ) {
508
-							if ( $display_errors ) {
507
+						if (empty($section)) {
508
+							if ($display_errors) {
509 509
 								throw new EE_Error(
510 510
 									sprintf(
511 511
 										__(
@@ -521,11 +521,11 @@  discard block
 block discarded – undo
521 521
 						break;
522 522
 					// TEST #2 : check that settings section exists
523 523
 					case 2 :
524
-						if ( ! isset( $this->{$section} ) ) {
525
-							if ( $display_errors ) {
524
+						if ( ! isset($this->{$section} )) {
525
+							if ($display_errors) {
526 526
 								throw new EE_Error(
527 527
 									sprintf(
528
-										__( 'The "%s" configuration section does not exist.', 'event_espresso' ),
528
+										__('The "%s" configuration section does not exist.', 'event_espresso'),
529 529
 										$section
530 530
 									)
531 531
 								);
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 					// TEST #3 : check that section is the proper format
537 537
 					case 3 :
538 538
 						if (
539
-						! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
539
+						! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
540 540
 						) {
541
-							if ( $display_errors ) {
541
+							if ($display_errors) {
542 542
 								throw new EE_Error(
543 543
 									sprintf(
544 544
 										__(
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 						break;
555 555
 					// TEST #4 : check that config section name has been set
556 556
 					case 4 :
557
-						if ( empty( $name ) ) {
558
-							if ( $display_errors ) {
557
+						if (empty($name)) {
558
+							if ($display_errors) {
559 559
 								throw new EE_Error(
560 560
 									__(
561 561
 										'No name has been provided for the specific configuration section.',
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 						break;
569 569
 					// TEST #5 : check that a config class name has been set
570 570
 					case 5 :
571
-						if ( empty( $config_class ) ) {
572
-							if ( $display_errors ) {
571
+						if (empty($config_class)) {
572
+							if ($display_errors) {
573 573
 								throw new EE_Error(
574 574
 									__(
575 575
 										'No class name has been provided for the specific configuration section.',
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 						break;
583 583
 					// TEST #6 : verify config class is accessible
584 584
 					case 6 :
585
-						if ( ! class_exists( $config_class ) ) {
586
-							if ( $display_errors ) {
585
+						if ( ! class_exists($config_class)) {
586
+							if ($display_errors) {
587 587
 								throw new EE_Error(
588 588
 									sprintf(
589 589
 										__(
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
 						break;
600 600
 					// TEST #7 : check that config has even been set
601 601
 					case 7 :
602
-						if ( ! isset( $this->{$section}->{$name} ) ) {
603
-							if ( $display_errors ) {
602
+						if ( ! isset($this->{$section}->{$name} )) {
603
+							if ($display_errors) {
604 604
 								throw new EE_Error(
605 605
 									sprintf(
606
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
606
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
607 607
 										$section,
608 608
 										$name
609 609
 									)
@@ -612,13 +612,13 @@  discard block
 block discarded – undo
612 612
 							return false;
613 613
 						} else {
614 614
 							// and make sure it's not serialized
615
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
615
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
616 616
 						}
617 617
 						break;
618 618
 					// TEST #8 : check that config is the requested type
619 619
 					case 8 :
620
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
621
-							if ( $display_errors ) {
620
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
621
+							if ($display_errors) {
622 622
 								throw new EE_Error(
623 623
 									sprintf(
624 624
 										__(
@@ -636,12 +636,12 @@  discard block
 block discarded – undo
636 636
 						break;
637 637
 					// TEST #9 : verify config object
638 638
 					case 9 :
639
-						if ( ! $config_obj instanceof EE_Config_Base ) {
640
-							if ( $display_errors ) {
639
+						if ( ! $config_obj instanceof EE_Config_Base) {
640
+							if ($display_errors) {
641 641
 								throw new EE_Error(
642 642
 									sprintf(
643
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
644
-										print_r( $config_obj, true )
643
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
644
+										print_r($config_obj, true)
645 645
 									)
646 646
 								);
647 647
 							}
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 						break;
651 651
 				}
652 652
 			}
653
-		} catch ( EE_Error $e ) {
653
+		} catch (EE_Error $e) {
654 654
 			$e->get_error();
655 655
 		}
656 656
 		// you have successfully run the gauntlet
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	 * @param        string $name
668 668
 	 * @return        string
669 669
 	 */
670
-	private function _generate_config_option_name( $section = '', $name = '' ) {
671
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
670
+	private function _generate_config_option_name($section = '', $name = '') {
671
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
672 672
 	}
673 673
 
674 674
 
@@ -682,10 +682,10 @@  discard block
 block discarded – undo
682 682
 	 * @param    string $name
683 683
 	 * @return    string
684 684
 	 */
685
-	private function _set_config_class( $config_class = '', $name = '' ) {
686
-		return ! empty( $config_class )
685
+	private function _set_config_class($config_class = '', $name = '') {
686
+		return ! empty($config_class)
687 687
 			? $config_class
688
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
688
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
689 689
 	}
690 690
 
691 691
 
@@ -700,36 +700,36 @@  discard block
 block discarded – undo
700 700
 	 * @param    EE_Config_Base $config_obj
701 701
 	 * @return    EE_Config_Base
702 702
 	 */
703
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
703
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
704 704
 		// ensure config class is set to something
705
-		$config_class = $this->_set_config_class( $config_class, $name );
705
+		$config_class = $this->_set_config_class($config_class, $name);
706 706
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
707
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) {
707
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
708 708
 			return null;
709 709
 		}
710
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
710
+		$config_option_name = $this->_generate_config_option_name($section, $name);
711 711
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
712
-		if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) {
713
-			$this->_addon_option_names[ $config_option_name ] = $config_class;
712
+		if ( ! isset($this->_addon_option_names[$config_option_name])) {
713
+			$this->_addon_option_names[$config_option_name] = $config_class;
714 714
 			$this->update_addon_option_names();
715 715
 		}
716 716
 		// verify the incoming config object but suppress errors
717
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) {
717
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
718 718
 			$config_obj = new $config_class();
719 719
 		}
720
-		if ( get_option( $config_option_name ) ) {
721
-			EE_Config::log( $config_option_name );
722
-			update_option( $config_option_name, $config_obj );
720
+		if (get_option($config_option_name)) {
721
+			EE_Config::log($config_option_name);
722
+			update_option($config_option_name, $config_obj);
723 723
 			$this->{$section}->{$name} = $config_obj;
724 724
 			return $this->{$section}->{$name};
725 725
 		} else {
726 726
 			// create a wp-option for this config
727
-			if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) {
728
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
727
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
728
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
729 729
 				return $this->{$section}->{$name};
730 730
 			} else {
731 731
 				EE_Error::add_error(
732
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
732
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
733 733
 					__FILE__,
734 734
 					__FUNCTION__,
735 735
 					__LINE__
@@ -752,46 +752,46 @@  discard block
 block discarded – undo
752 752
 	 * @param    bool                  $throw_errors
753 753
 	 * @return    bool
754 754
 	 */
755
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
755
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
756 756
 		// don't allow config updates during WP heartbeats
757
-		if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) {
757
+		if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') {
758 758
 			return false;
759 759
 		}
760
-		$config_obj = maybe_unserialize( $config_obj );
760
+		$config_obj = maybe_unserialize($config_obj);
761 761
 		// get class name of the incoming object
762
-		$config_class = get_class( $config_obj );
762
+		$config_class = get_class($config_obj);
763 763
 		// run tests 1-5 and 9 to verify config
764 764
 		if ( ! $this->_verify_config_params(
765 765
 			$section,
766 766
 			$name,
767 767
 			$config_class,
768 768
 			$config_obj,
769
-			array( 1, 2, 3, 4, 7, 9 )
769
+			array(1, 2, 3, 4, 7, 9)
770 770
 		)
771 771
 		) {
772 772
 			return false;
773 773
 		}
774
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
774
+		$config_option_name = $this->_generate_config_option_name($section, $name);
775 775
 		// check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
776
-		if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) {
776
+		if ( ! isset($this->_addon_option_names[$config_option_name])) {
777 777
 			// save new config to db
778
-			if( $this->set_config( $section, $name, $config_class, $config_obj ) ) {
778
+			if ($this->set_config($section, $name, $config_class, $config_obj)) {
779 779
 				return true;
780 780
 			}
781 781
 		} else {
782 782
 			// first check if the record already exists
783
-			$existing_config = get_option( $config_option_name );
784
-			$config_obj = serialize( $config_obj );
783
+			$existing_config = get_option($config_option_name);
784
+			$config_obj = serialize($config_obj);
785 785
 			// just return if db record is already up to date (NOT type safe comparison)
786
-			if ( $existing_config == $config_obj ) {
786
+			if ($existing_config == $config_obj) {
787 787
 				$this->{$section}->{$name} = $config_obj;
788 788
 				return true;
789
-			} else if ( update_option( $config_option_name, $config_obj ) ) {
790
-				EE_Config::log( $config_option_name );
789
+			} else if (update_option($config_option_name, $config_obj)) {
790
+				EE_Config::log($config_option_name);
791 791
 				// update wp-option for this config class
792 792
 				$this->{$section}->{$name} = $config_obj;
793 793
 				return true;
794
-			} elseif ( $throw_errors ) {
794
+			} elseif ($throw_errors) {
795 795
 				EE_Error::add_error(
796 796
 					sprintf(
797 797
 						__(
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 							'event_espresso'
800 800
 						),
801 801
 						$config_class,
802
-						'EE_Config->' . $section . '->' . $name
802
+						'EE_Config->'.$section.'->'.$name
803 803
 					),
804 804
 					__FILE__,
805 805
 					__FUNCTION__,
@@ -821,34 +821,34 @@  discard block
 block discarded – undo
821 821
 	 * @param    string $config_class
822 822
 	 * @return    mixed EE_Config_Base | NULL
823 823
 	 */
824
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
824
+	public function get_config($section = '', $name = '', $config_class = '') {
825 825
 		// ensure config class is set to something
826
-		$config_class = $this->_set_config_class( $config_class, $name );
826
+		$config_class = $this->_set_config_class($config_class, $name);
827 827
 		// run tests 1-4, 6 and 7 to verify that all params have been set
828
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) {
828
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
829 829
 			return null;
830 830
 		}
831 831
 		// now test if the requested config object exists, but suppress errors
832
-		if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) {
832
+		if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) {
833 833
 			// config already exists, so pass it back
834 834
 			return $this->{$section}->{$name};
835 835
 		}
836 836
 		// load config option from db if it exists
837
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) );
837
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
838 838
 		// verify the newly retrieved config object, but suppress errors
839
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) {
839
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
840 840
 			// config is good, so set it and pass it back
841 841
 			$this->{$section}->{$name} = $config_obj;
842 842
 			return $this->{$section}->{$name};
843 843
 		}
844 844
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
845
-		$config_obj = $this->set_config( $section, $name, $config_class );
845
+		$config_obj = $this->set_config($section, $name, $config_class);
846 846
 		// verify the newly created config object
847
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) {
847
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
848 848
 			return $this->{$section}->{$name};
849 849
 		} else {
850 850
 			EE_Error::add_error(
851
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
851
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
852 852
 				__FILE__,
853 853
 				__FUNCTION__,
854 854
 				__LINE__
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
 	 * @param    string $config_option_name
867 867
 	 * @return    mixed EE_Config_Base | FALSE
868 868
 	 */
869
-	public function get_config_option( $config_option_name = '' ) {
869
+	public function get_config_option($config_option_name = '') {
870 870
 		// retrieve the wp-option for this config class.
871
-		$config_option = maybe_unserialize( get_option( $config_option_name, array() ) );
872
-		if ( empty( $config_option ) ) {
873
-			EE_Config::log( $config_option_name . '-NOT-FOUND' );
871
+		$config_option = maybe_unserialize(get_option($config_option_name, array()));
872
+		if (empty($config_option)) {
873
+			EE_Config::log($config_option_name.'-NOT-FOUND');
874 874
 		}
875 875
 		return $config_option;
876 876
 	}
@@ -882,17 +882,17 @@  discard block
 block discarded – undo
882 882
 	 *
883 883
 	 * @param string $config_option_name
884 884
 	 */
885
-	public static function log( $config_option_name = '' ) {
886
-		if ( EE_Config::logging_enabled() && ! empty( $config_option_name ) ) {
887
-			$config_log = get_option( EE_Config::LOG_NAME, array() );
885
+	public static function log($config_option_name = '') {
886
+		if (EE_Config::logging_enabled() && ! empty($config_option_name)) {
887
+			$config_log = get_option(EE_Config::LOG_NAME, array());
888 888
 			//copy incoming $_REQUEST and sanitize it so we can save it
889 889
 			$_request = $_REQUEST;
890
-			array_walk_recursive( $_request, 'sanitize_text_field' );
891
-			$config_log[ (string) microtime( true ) ] = array(
890
+			array_walk_recursive($_request, 'sanitize_text_field');
891
+			$config_log[(string) microtime(true)] = array(
892 892
 				'config_name' => $config_option_name,
893 893
 				'request'     => $_request,
894 894
 			);
895
-			update_option( EE_Config::LOG_NAME, $config_log );
895
+			update_option(EE_Config::LOG_NAME, $config_log);
896 896
 		}
897 897
 	}
898 898
 
@@ -903,15 +903,15 @@  discard block
 block discarded – undo
903 903
 	 * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH
904 904
 	 */
905 905
 	public static function trim_log() {
906
-		if ( ! EE_Config::logging_enabled() ) {
906
+		if ( ! EE_Config::logging_enabled()) {
907 907
 			return;
908 908
 		}
909
-		$config_log = maybe_unserialize( get_option( EE_Config::LOG_NAME, array() ) );
910
-		$log_length = count( $config_log );
911
-		if ( $log_length > EE_Config::LOG_LENGTH ) {
912
-			ksort( $config_log );
913
-			$config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true );
914
-			update_option( EE_Config::LOG_NAME, $config_log );
909
+		$config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array()));
910
+		$log_length = count($config_log);
911
+		if ($log_length > EE_Config::LOG_LENGTH) {
912
+			ksort($config_log);
913
+			$config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true);
914
+			update_option(EE_Config::LOG_NAME, $config_log);
915 915
 		}
916 916
 	}
917 917
 
@@ -926,14 +926,14 @@  discard block
 block discarded – undo
926 926
 	 * @return    string
927 927
 	 */
928 928
 	public static function get_page_for_posts() {
929
-		$page_for_posts = get_option( 'page_for_posts' );
930
-		if ( ! $page_for_posts ) {
929
+		$page_for_posts = get_option('page_for_posts');
930
+		if ( ! $page_for_posts) {
931 931
 			return 'posts';
932 932
 		}
933 933
 		/** @type WPDB $wpdb */
934 934
 		global $wpdb;
935 935
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
936
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) );
936
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
937 937
 	}
938 938
 
939 939
 
@@ -989,17 +989,17 @@  discard block
 block discarded – undo
989 989
 			)
990 990
 		) {
991 991
 			// grab list of installed widgets
992
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
992
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
993 993
 			// filter list of modules to register
994 994
 			$widgets_to_register = apply_filters(
995 995
 				'FHEE__EE_Config__register_widgets__widgets_to_register',
996 996
 				$widgets_to_register
997 997
 			);
998
-			if ( ! empty( $widgets_to_register ) ) {
998
+			if ( ! empty($widgets_to_register)) {
999 999
 				// cycle thru widget folders
1000
-				foreach ( $widgets_to_register as $widget_path ) {
1000
+				foreach ($widgets_to_register as $widget_path) {
1001 1001
 					// add to list of installed widget modules
1002
-					EE_Config::register_ee_widget( $widget_path );
1002
+					EE_Config::register_ee_widget($widget_path);
1003 1003
 				}
1004 1004
 			}
1005 1005
 			// filter list of installed modules
@@ -1019,57 +1019,57 @@  discard block
 block discarded – undo
1019 1019
 	 * @param    string $widget_path - full path up to and including widget folder
1020 1020
 	 * @return    void
1021 1021
 	 */
1022
-	public static function register_ee_widget( $widget_path = null ) {
1023
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
1022
+	public static function register_ee_widget($widget_path = null) {
1023
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
1024 1024
 		$widget_ext = '.widget.php';
1025 1025
 		// make all separators match
1026
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
1026
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
1027 1027
 		// does the file path INCLUDE the actual file name as part of the path ?
1028
-		if ( strpos( $widget_path, $widget_ext ) !== false ) {
1028
+		if (strpos($widget_path, $widget_ext) !== false) {
1029 1029
 			// grab and shortcode file name from directory name and break apart at dots
1030
-			$file_name = explode( '.', basename( $widget_path ) );
1030
+			$file_name = explode('.', basename($widget_path));
1031 1031
 			// take first segment from file name pieces and remove class prefix if it exists
1032
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
1032
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
1033 1033
 			// sanitize shortcode directory name
1034
-			$widget = sanitize_key( $widget );
1034
+			$widget = sanitize_key($widget);
1035 1035
 			// now we need to rebuild the shortcode path
1036
-			$widget_path = explode( DS, $widget_path );
1036
+			$widget_path = explode(DS, $widget_path);
1037 1037
 			// remove last segment
1038
-			array_pop( $widget_path );
1038
+			array_pop($widget_path);
1039 1039
 			// glue it back together
1040
-			$widget_path = implode( DS, $widget_path );
1040
+			$widget_path = implode(DS, $widget_path);
1041 1041
 		} else {
1042 1042
 			// grab and sanitize widget directory name
1043
-			$widget = sanitize_key( basename( $widget_path ) );
1043
+			$widget = sanitize_key(basename($widget_path));
1044 1044
 		}
1045 1045
 		// create classname from widget directory name
1046
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) );
1046
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1047 1047
 		// add class prefix
1048
-		$widget_class = 'EEW_' . $widget;
1048
+		$widget_class = 'EEW_'.$widget;
1049 1049
 		// does the widget exist ?
1050
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) {
1050
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
1051 1051
 			$msg = sprintf(
1052 1052
 				__(
1053 1053
 					'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1054 1054
 					'event_espresso'
1055 1055
 				),
1056 1056
 				$widget_class,
1057
-				$widget_path . DS . $widget_class . $widget_ext
1057
+				$widget_path.DS.$widget_class.$widget_ext
1058 1058
 			);
1059
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1059
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1060 1060
 			return;
1061 1061
 		}
1062 1062
 		// load the widget class file
1063
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
1063
+		require_once($widget_path.DS.$widget_class.$widget_ext);
1064 1064
 		// verify that class exists
1065
-		if ( ! class_exists( $widget_class ) ) {
1066
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
1067
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1065
+		if ( ! class_exists($widget_class)) {
1066
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1067
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1068 1068
 			return;
1069 1069
 		}
1070
-		register_widget( $widget_class );
1070
+		register_widget($widget_class);
1071 1071
 		// add to array of registered widgets
1072
-		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
1072
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
1073 1073
 	}
1074 1074
 
1075 1075
 
@@ -1082,17 +1082,17 @@  discard block
 block discarded – undo
1082 1082
 	 */
1083 1083
 	private function _register_shortcodes() {
1084 1084
 		// grab list of installed shortcodes
1085
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
1085
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
1086 1086
 		// filter list of modules to register
1087 1087
 		$shortcodes_to_register = apply_filters(
1088 1088
 			'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
1089 1089
 			$shortcodes_to_register
1090 1090
 		);
1091
-		if ( ! empty( $shortcodes_to_register ) ) {
1091
+		if ( ! empty($shortcodes_to_register)) {
1092 1092
 			// cycle thru shortcode folders
1093
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
1093
+			foreach ($shortcodes_to_register as $shortcode_path) {
1094 1094
 				// add to list of installed shortcode modules
1095
-				EE_Config::register_shortcode( $shortcode_path );
1095
+				EE_Config::register_shortcode($shortcode_path);
1096 1096
 			}
1097 1097
 		}
1098 1098
 		// filter list of installed modules
@@ -1111,64 +1111,64 @@  discard block
 block discarded – undo
1111 1111
 	 * @param    string $shortcode_path - full path up to and including shortcode folder
1112 1112
 	 * @return    bool
1113 1113
 	 */
1114
-	public static function register_shortcode( $shortcode_path = null ) {
1115
-		do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path );
1114
+	public static function register_shortcode($shortcode_path = null) {
1115
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
1116 1116
 		$shortcode_ext = '.shortcode.php';
1117 1117
 		// make all separators match
1118
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
1118
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
1119 1119
 		// does the file path INCLUDE the actual file name as part of the path ?
1120
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) {
1120
+		if (strpos($shortcode_path, $shortcode_ext) !== false) {
1121 1121
 			// grab shortcode file name from directory name and break apart at dots
1122
-			$shortcode_file = explode( '.', basename( $shortcode_path ) );
1122
+			$shortcode_file = explode('.', basename($shortcode_path));
1123 1123
 			// take first segment from file name pieces and remove class prefix if it exists
1124
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0
1125
-				? substr( $shortcode_file[0], 4 )
1124
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0
1125
+				? substr($shortcode_file[0], 4)
1126 1126
 				: $shortcode_file[0];
1127 1127
 			// sanitize shortcode directory name
1128
-			$shortcode = sanitize_key( $shortcode );
1128
+			$shortcode = sanitize_key($shortcode);
1129 1129
 			// now we need to rebuild the shortcode path
1130
-			$shortcode_path = explode( DS, $shortcode_path );
1130
+			$shortcode_path = explode(DS, $shortcode_path);
1131 1131
 			// remove last segment
1132
-			array_pop( $shortcode_path );
1132
+			array_pop($shortcode_path);
1133 1133
 			// glue it back together
1134
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
1134
+			$shortcode_path = implode(DS, $shortcode_path).DS;
1135 1135
 		} else {
1136 1136
 			// we need to generate the filename based off of the folder name
1137 1137
 			// grab and sanitize shortcode directory name
1138
-			$shortcode = sanitize_key( basename( $shortcode_path ) );
1139
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
1138
+			$shortcode = sanitize_key(basename($shortcode_path));
1139
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
1140 1140
 		}
1141 1141
 		// create classname from shortcode directory or file name
1142
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) );
1142
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1143 1143
 		// add class prefix
1144
-		$shortcode_class = 'EES_' . $shortcode;
1144
+		$shortcode_class = 'EES_'.$shortcode;
1145 1145
 		// does the shortcode exist ?
1146
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) {
1146
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1147 1147
 			$msg = sprintf(
1148 1148
 				__(
1149 1149
 					'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s',
1150 1150
 					'event_espresso'
1151 1151
 				),
1152 1152
 				$shortcode_class,
1153
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1153
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1154 1154
 			);
1155
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1155
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1156 1156
 			return false;
1157 1157
 		}
1158 1158
 		// load the shortcode class file
1159
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1159
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1160 1160
 		// verify that class exists
1161
-		if ( ! class_exists( $shortcode_class ) ) {
1161
+		if ( ! class_exists($shortcode_class)) {
1162 1162
 			$msg = sprintf(
1163
-				__( 'The requested %s shortcode class does not exist.', 'event_espresso' ),
1163
+				__('The requested %s shortcode class does not exist.', 'event_espresso'),
1164 1164
 				$shortcode_class
1165 1165
 			);
1166
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1166
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1167 1167
 			return false;
1168 1168
 		}
1169
-		$shortcode = strtoupper( $shortcode );
1169
+		$shortcode = strtoupper($shortcode);
1170 1170
 		// add to array of registered shortcodes
1171
-		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1171
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1172 1172
 		return true;
1173 1173
 	}
1174 1174
 
@@ -1182,22 +1182,22 @@  discard block
 block discarded – undo
1182 1182
 	 */
1183 1183
 	private function _register_modules() {
1184 1184
 		// grab list of installed modules
1185
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1185
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1186 1186
 		// filter list of modules to register
1187 1187
 		$modules_to_register = apply_filters(
1188 1188
 			'FHEE__EE_Config__register_modules__modules_to_register',
1189 1189
 			$modules_to_register
1190 1190
 		);
1191
-		if ( ! empty( $modules_to_register ) ) {
1191
+		if ( ! empty($modules_to_register)) {
1192 1192
 			// loop through folders
1193
-			foreach ( $modules_to_register as $module_path ) {
1193
+			foreach ($modules_to_register as $module_path) {
1194 1194
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1195 1195
 				if (
1196
-					$module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1197
-					&& $module_path !== EE_MODULES . 'gateways'
1196
+					$module_path !== EE_MODULES.'zzz-copy-this-module-template'
1197
+					&& $module_path !== EE_MODULES.'gateways'
1198 1198
 				) {
1199 1199
 					// add to list of installed modules
1200
-					EE_Config::register_module( $module_path );
1200
+					EE_Config::register_module($module_path);
1201 1201
 				}
1202 1202
 			}
1203 1203
 		}
@@ -1217,39 +1217,39 @@  discard block
 block discarded – undo
1217 1217
 	 * @param    string $module_path - full path up to and including module folder
1218 1218
 	 * @return    bool
1219 1219
 	 */
1220
-	public static function register_module( $module_path = null ) {
1221
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1220
+	public static function register_module($module_path = null) {
1221
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1222 1222
 		$module_ext = '.module.php';
1223 1223
 		// make all separators match
1224
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1224
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1225 1225
 		// does the file path INCLUDE the actual file name as part of the path ?
1226
-		if ( strpos( $module_path, $module_ext ) !== false ) {
1226
+		if (strpos($module_path, $module_ext) !== false) {
1227 1227
 			// grab and shortcode file name from directory name and break apart at dots
1228
-			$module_file = explode( '.', basename( $module_path ) );
1228
+			$module_file = explode('.', basename($module_path));
1229 1229
 			// now we need to rebuild the shortcode path
1230
-			$module_path = explode( DS, $module_path );
1230
+			$module_path = explode(DS, $module_path);
1231 1231
 			// remove last segment
1232
-			array_pop( $module_path );
1232
+			array_pop($module_path);
1233 1233
 			// glue it back together
1234
-			$module_path = implode( DS, $module_path ) . DS;
1234
+			$module_path = implode(DS, $module_path).DS;
1235 1235
 			// take first segment from file name pieces and sanitize it
1236
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1236
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1237 1237
 			// ensure class prefix is added
1238
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1238
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1239 1239
 		} else {
1240 1240
 			// we need to generate the filename based off of the folder name
1241 1241
 			// grab and sanitize module name
1242
-			$module = strtolower( basename( $module_path ) );
1243
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module );
1242
+			$module = strtolower(basename($module_path));
1243
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1244 1244
 			// like trailingslashit()
1245
-			$module_path = rtrim( $module_path, DS ) . DS;
1245
+			$module_path = rtrim($module_path, DS).DS;
1246 1246
 			// create classname from module directory name
1247
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) );
1247
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1248 1248
 			// add class prefix
1249
-			$module_class = 'EED_' . $module;
1249
+			$module_class = 'EED_'.$module;
1250 1250
 		}
1251 1251
 		// does the module exist ?
1252
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) {
1252
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1253 1253
 			$msg = sprintf(
1254 1254
 				__(
1255 1255
 					'The requested %s module file could not be found or is not readable due to file permissions.',
@@ -1257,19 +1257,19 @@  discard block
 block discarded – undo
1257 1257
 				),
1258 1258
 				$module
1259 1259
 			);
1260
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1260
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return false;
1262 1262
 		}
1263 1263
 		// load the module class file
1264
-		require_once( $module_path . $module_class . $module_ext );
1264
+		require_once($module_path.$module_class.$module_ext);
1265 1265
 		// verify that class exists
1266
-		if ( ! class_exists( $module_class ) ) {
1267
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1268
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1266
+		if ( ! class_exists($module_class)) {
1267
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1268
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1269 1269
 			return false;
1270 1270
 		}
1271 1271
 		// add to array of registered modules
1272
-		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1272
+		EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1273 1273
 		do_action(
1274 1274
 			'AHEE__EE_Config__register_module__complete',
1275 1275
 			$module_class,
@@ -1289,26 +1289,26 @@  discard block
 block discarded – undo
1289 1289
 	 */
1290 1290
 	private function _initialize_shortcodes() {
1291 1291
 		// cycle thru shortcode folders
1292
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1292
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1293 1293
 			// add class prefix
1294
-			$shortcode_class = 'EES_' . $shortcode;
1294
+			$shortcode_class = 'EES_'.$shortcode;
1295 1295
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1296 1296
 			// which set hooks ?
1297
-			if ( is_admin() ) {
1297
+			if (is_admin()) {
1298 1298
 				// fire immediately
1299
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ) );
1299
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1300 1300
 			} else {
1301 1301
 				// delay until other systems are online
1302 1302
 				add_action(
1303 1303
 					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1304
-					array( $shortcode_class, 'set_hooks' )
1304
+					array($shortcode_class, 'set_hooks')
1305 1305
 				);
1306 1306
 				// convert classname to UPPERCASE and create WP shortcode.
1307
-				$shortcode_tag = strtoupper( $shortcode );
1307
+				$shortcode_tag = strtoupper($shortcode);
1308 1308
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1309
-				if ( ! shortcode_exists( $shortcode_tag ) ) {
1309
+				if ( ! shortcode_exists($shortcode_tag)) {
1310 1310
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1311
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) );
1311
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1312 1312
 				}
1313 1313
 			}
1314 1314
 		}
@@ -1325,17 +1325,17 @@  discard block
 block discarded – undo
1325 1325
 	 */
1326 1326
 	private function _initialize_modules() {
1327 1327
 		// cycle thru shortcode folders
1328
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1328
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1329 1329
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1330 1330
 			// which set hooks ?
1331
-			if ( is_admin() ) {
1331
+			if (is_admin()) {
1332 1332
 				// fire immediately
1333
-				call_user_func( array( $module_class, 'set_hooks_admin' ) );
1333
+				call_user_func(array($module_class, 'set_hooks_admin'));
1334 1334
 			} else {
1335 1335
 				// delay until other systems are online
1336 1336
 				add_action(
1337 1337
 					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1338
-					array( $module_class, 'set_hooks' )
1338
+					array($module_class, 'set_hooks')
1339 1339
 				);
1340 1340
 			}
1341 1341
 		}
@@ -1353,29 +1353,29 @@  discard block
 block discarded – undo
1353 1353
 	 * @param    string $key         - url param key indicating a route is being called
1354 1354
 	 * @return    bool
1355 1355
 	 */
1356
-	public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) {
1357
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1358
-		$module = str_replace( 'EED_', '', $module );
1359
-		$module_class = 'EED_' . $module;
1360
-		if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) {
1361
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1362
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1356
+	public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') {
1357
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1358
+		$module = str_replace('EED_', '', $module);
1359
+		$module_class = 'EED_'.$module;
1360
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) {
1361
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1362
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1363 1363
 			return false;
1364 1364
 		}
1365
-		if ( empty( $route ) ) {
1366
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1367
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1365
+		if (empty($route)) {
1366
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1367
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1368 1368
 			return false;
1369 1369
 		}
1370
-		if ( ! method_exists( 'EED_' . $module, $method_name ) ) {
1370
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1371 1371
 			$msg = sprintf(
1372
-				__( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ),
1372
+				__('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1373 1373
 				$route
1374 1374
 			);
1375
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1375
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1376 1376
 			return false;
1377 1377
 		}
1378
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1378
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1379 1379
 		return true;
1380 1380
 	}
1381 1381
 
@@ -1389,11 +1389,11 @@  discard block
 block discarded – undo
1389 1389
 	 * @param    string $key   - url param key indicating a route is being called
1390 1390
 	 * @return    string
1391 1391
 	 */
1392
-	public static function get_route( $route = null, $key = 'ee' ) {
1393
-		do_action( 'AHEE__EE_Config__get_route__begin', $route );
1394
-		$route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route );
1395
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) {
1396
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1392
+	public static function get_route($route = null, $key = 'ee') {
1393
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1394
+		$route = (string) apply_filters('FHEE__EE_Config__get_route', $route);
1395
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1396
+			return EE_Config::$_module_route_map[$key][$route];
1397 1397
 		}
1398 1398
 		return null;
1399 1399
 	}
@@ -1423,49 +1423,49 @@  discard block
 block discarded – undo
1423 1423
 	 * @param    string       $key     - url param key indicating a route is being called
1424 1424
 	 * @return    bool
1425 1425
 	 */
1426
-	public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) {
1427
-		do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward );
1428
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) {
1426
+	public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') {
1427
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1428
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1429 1429
 			$msg = sprintf(
1430
-				__( 'The module route %s for this forward has not been registered.', 'event_espresso' ),
1430
+				__('The module route %s for this forward has not been registered.', 'event_espresso'),
1431 1431
 				$route
1432 1432
 			);
1433
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1433
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1434 1434
 			return false;
1435 1435
 		}
1436
-		if ( empty( $forward ) ) {
1437
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1438
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1436
+		if (empty($forward)) {
1437
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1438
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1439 1439
 			return false;
1440 1440
 		}
1441
-		if ( is_array( $forward ) ) {
1442
-			if ( ! isset( $forward[1] ) ) {
1441
+		if (is_array($forward)) {
1442
+			if ( ! isset($forward[1])) {
1443 1443
 				$msg = sprintf(
1444
-					__( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ),
1444
+					__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1445 1445
 					$route
1446 1446
 				);
1447
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1447
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1448 1448
 				return false;
1449 1449
 			}
1450
-			if ( ! method_exists( $forward[0], $forward[1] ) ) {
1450
+			if ( ! method_exists($forward[0], $forward[1])) {
1451 1451
 				$msg = sprintf(
1452
-					__( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ),
1452
+					__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1453 1453
 					$forward[1],
1454 1454
 					$route
1455 1455
 				);
1456
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1456
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1457 1457
 				return false;
1458 1458
 			}
1459
-		} else if ( ! function_exists( $forward ) ) {
1459
+		} else if ( ! function_exists($forward)) {
1460 1460
 			$msg = sprintf(
1461
-				__( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ),
1461
+				__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1462 1462
 				$forward,
1463 1463
 				$route
1464 1464
 			);
1465
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1465
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1466 1466
 			return false;
1467 1467
 		}
1468
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1468
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1469 1469
 		return true;
1470 1470
 	}
1471 1471
 
@@ -1481,12 +1481,12 @@  discard block
 block discarded – undo
1481 1481
 	 * @param    string  $key    - url param key indicating a route is being called
1482 1482
 	 * @return    string
1483 1483
 	 */
1484
-	public static function get_forward( $route = null, $status = 0, $key = 'ee' ) {
1485
-		do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status );
1486
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) {
1484
+	public static function get_forward($route = null, $status = 0, $key = 'ee') {
1485
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1486
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1487 1487
 			return apply_filters(
1488 1488
 				'FHEE__EE_Config__get_forward',
1489
-				EE_Config::$_module_forward_map[ $key ][ $route ][ $status ],
1489
+				EE_Config::$_module_forward_map[$key][$route][$status],
1490 1490
 				$route,
1491 1491
 				$status
1492 1492
 			);
@@ -1508,17 +1508,17 @@  discard block
 block discarded – undo
1508 1508
 	 * @param    string  $key    - url param key indicating a route is being called
1509 1509
 	 * @return    bool
1510 1510
 	 */
1511
-	public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) {
1512
-		do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view );
1513
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) {
1511
+	public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') {
1512
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1513
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1514 1514
 			$msg = sprintf(
1515
-				__( 'The module route %s for this view has not been registered.', 'event_espresso' ),
1515
+				__('The module route %s for this view has not been registered.', 'event_espresso'),
1516 1516
 				$route
1517 1517
 			);
1518
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1518
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1519 1519
 			return false;
1520 1520
 		}
1521
-		if ( ! is_readable( $view ) ) {
1521
+		if ( ! is_readable($view)) {
1522 1522
 			$msg = sprintf(
1523 1523
 				__(
1524 1524
 					'The %s view file could not be found or is not readable due to file permissions.',
@@ -1526,10 +1526,10 @@  discard block
 block discarded – undo
1526 1526
 				),
1527 1527
 				$view
1528 1528
 			);
1529
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1529
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1530 1530
 			return false;
1531 1531
 		}
1532
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1532
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1533 1533
 		return true;
1534 1534
 	}
1535 1535
 
@@ -1545,12 +1545,12 @@  discard block
 block discarded – undo
1545 1545
 	 * @param    string  $key    - url param key indicating a route is being called
1546 1546
 	 * @return    string
1547 1547
 	 */
1548
-	public static function get_view( $route = null, $status = 0, $key = 'ee' ) {
1549
-		do_action( 'AHEE__EE_Config__get_view__begin', $route, $status );
1550
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) {
1548
+	public static function get_view($route = null, $status = 0, $key = 'ee') {
1549
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1550
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1551 1551
 			return apply_filters(
1552 1552
 				'FHEE__EE_Config__get_view',
1553
-				EE_Config::$_module_view_map[ $key ][ $route ][ $status ],
1553
+				EE_Config::$_module_view_map[$key][$route][$status],
1554 1554
 				$route,
1555 1555
 				$status
1556 1556
 			);
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 
1562 1562
 
1563 1563
 	public function update_addon_option_names() {
1564
-		update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names );
1564
+		update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names);
1565 1565
 	}
1566 1566
 
1567 1567
 
@@ -1589,22 +1589,22 @@  discard block
 block discarded – undo
1589 1589
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1590 1590
 	 * @throws \EE_Error
1591 1591
 	 */
1592
-	public function get_pretty( $property ) {
1593
-		if ( ! property_exists( $this, $property ) ) {
1592
+	public function get_pretty($property) {
1593
+		if ( ! property_exists($this, $property)) {
1594 1594
 			throw new EE_Error(
1595 1595
 				sprintf(
1596 1596
 					__(
1597 1597
 						'%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.',
1598 1598
 						'event_espresso'
1599 1599
 					),
1600
-					get_class( $this ),
1600
+					get_class($this),
1601 1601
 					$property
1602 1602
 				)
1603 1603
 			);
1604 1604
 		}
1605 1605
 		//just handling escaping of strings for now.
1606
-		if ( is_string( $this->{$property} ) ) {
1607
-			return stripslashes( $this->{$property} );
1606
+		if (is_string($this->{$property} )) {
1607
+			return stripslashes($this->{$property} );
1608 1608
 		}
1609 1609
 		return $this->{$property};
1610 1610
 	}
@@ -1613,17 +1613,17 @@  discard block
 block discarded – undo
1613 1613
 
1614 1614
 	public function populate() {
1615 1615
 		//grab defaults via a new instance of this class.
1616
-		$class_name = get_class( $this );
1616
+		$class_name = get_class($this);
1617 1617
 		$defaults = new $class_name;
1618 1618
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1619 1619
 		//default from our $defaults object.
1620
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1621
-			if ( $this->{$property} === null ) {
1620
+		foreach (get_object_vars($defaults) as $property => $value) {
1621
+			if ($this->{$property} === null) {
1622 1622
 				$this->{$property} = $value;
1623 1623
 			}
1624 1624
 		}
1625 1625
 		//cleanup
1626
-		unset( $defaults );
1626
+		unset($defaults);
1627 1627
 	}
1628 1628
 
1629 1629
 
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 	 * @param $a
1640 1640
 	 * @return bool
1641 1641
 	 */
1642
-	public function __isset( $a ) {
1642
+	public function __isset($a) {
1643 1643
 		return false;
1644 1644
 	}
1645 1645
 
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 	 * @param $a
1652 1652
 	 * @return bool
1653 1653
 	 */
1654
-	public function __unset( $a ) {
1654
+	public function __unset($a) {
1655 1655
 		return false;
1656 1656
 	}
1657 1657
 
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 		$this->current_blog_id = get_current_blog_id();
1762 1762
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1763 1763
 		$this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1764
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true;
1764
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1765 1765
 		$this->post_shortcodes = array();
1766 1766
 		$this->module_route_map = array();
1767 1767
 		$this->module_forward_map = array();
@@ -1777,9 +1777,9 @@  discard block
 block discarded – undo
1777 1777
 		$this->thank_you_page_url = '';
1778 1778
 		$this->cancel_page_url = '';
1779 1779
 		//cpt slugs
1780
-		$this->event_cpt_slug = __( 'events', 'event_espresso' );
1780
+		$this->event_cpt_slug = __('events', 'event_espresso');
1781 1781
 		//ueip constant check
1782
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1782
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1783 1783
 			$this->ee_ueip_optin = false;
1784 1784
 			$this->ee_ueip_has_notified = true;
1785 1785
 		}
@@ -1822,11 +1822,11 @@  discard block
 block discarded – undo
1822 1822
 	 * @return    string
1823 1823
 	 */
1824 1824
 	public function reg_page_url() {
1825
-		if ( ! $this->reg_page_url ) {
1825
+		if ( ! $this->reg_page_url) {
1826 1826
 			$this->reg_page_url = add_query_arg(
1827
-				array( 'uts' => time() ),
1828
-				get_permalink( $this->reg_page_id )
1829
-			) . '#checkout';
1827
+				array('uts' => time()),
1828
+				get_permalink($this->reg_page_id)
1829
+			).'#checkout';
1830 1830
 		}
1831 1831
 		return $this->reg_page_url;
1832 1832
 	}
@@ -1841,12 +1841,12 @@  discard block
 block discarded – undo
1841 1841
 	 * @access    public
1842 1842
 	 * @return    string
1843 1843
 	 */
1844
-	public function txn_page_url( $query_args = array() ) {
1845
-		if ( ! $this->txn_page_url ) {
1846
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1844
+	public function txn_page_url($query_args = array()) {
1845
+		if ( ! $this->txn_page_url) {
1846
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1847 1847
 		}
1848
-		if ( $query_args ) {
1849
-			return add_query_arg( $query_args, $this->txn_page_url );
1848
+		if ($query_args) {
1849
+			return add_query_arg($query_args, $this->txn_page_url);
1850 1850
 		} else {
1851 1851
 			return $this->txn_page_url;
1852 1852
 		}
@@ -1862,12 +1862,12 @@  discard block
 block discarded – undo
1862 1862
 	 * @access    public
1863 1863
 	 * @return    string
1864 1864
 	 */
1865
-	public function thank_you_page_url( $query_args = array() ) {
1866
-		if ( ! $this->thank_you_page_url ) {
1867
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1865
+	public function thank_you_page_url($query_args = array()) {
1866
+		if ( ! $this->thank_you_page_url) {
1867
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1868 1868
 		}
1869
-		if ( $query_args ) {
1870
-			return add_query_arg( $query_args, $this->thank_you_page_url );
1869
+		if ($query_args) {
1870
+			return add_query_arg($query_args, $this->thank_you_page_url);
1871 1871
 		} else {
1872 1872
 			return $this->thank_you_page_url;
1873 1873
 		}
@@ -1882,8 +1882,8 @@  discard block
 block discarded – undo
1882 1882
 	 * @return    string
1883 1883
 	 */
1884 1884
 	public function cancel_page_url() {
1885
-		if ( ! $this->cancel_page_url ) {
1886
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1885
+		if ( ! $this->cancel_page_url) {
1886
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1887 1887
 		}
1888 1888
 		return $this->cancel_page_url;
1889 1889
 	}
@@ -1912,22 +1912,22 @@  discard block
 block discarded – undo
1912 1912
 	 */
1913 1913
 	protected function _get_main_ee_ueip_optin() {
1914 1914
 		//if this is the main site then we can just bypass our direct query.
1915
-		if ( is_main_site() ) {
1916
-			return get_option( 'ee_ueip_optin', false );
1915
+		if (is_main_site()) {
1916
+			return get_option('ee_ueip_optin', false);
1917 1917
 		}
1918 1918
 
1919 1919
 		//is this already cached for this request?  If so use it.
1920
-		if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) {
1920
+		if ( ! empty(EE_Core_Config::$ee_ueip_option)) {
1921 1921
 			return EE_Core_Config::$ee_ueip_option;
1922 1922
 		}
1923 1923
 
1924 1924
 		global $wpdb;
1925 1925
 		$current_network_main_site = is_multisite() ? get_current_site() : null;
1926
-		$current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1926
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1927 1927
 		$option = 'ee_ueip_optin';
1928 1928
 
1929 1929
 		//set correct table for query
1930
-		$table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options';
1930
+		$table_name = $wpdb->get_blog_prefix($current_main_site_id).'options';
1931 1931
 
1932 1932
 
1933 1933
 		//rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
@@ -1935,20 +1935,20 @@  discard block
 block discarded – undo
1935 1935
 		//re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1936 1936
 		//this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1937 1937
 		//for the purpose of caching.
1938
-		$pre = apply_filters( 'pre_option_' . $option, false, $option );
1939
-		if ( false !== $pre ) {
1938
+		$pre = apply_filters('pre_option_'.$option, false, $option);
1939
+		if (false !== $pre) {
1940 1940
 			EE_Core_Config::$ee_ueip_option = $pre;
1941 1941
 			return EE_Core_Config::$ee_ueip_option;
1942 1942
 		}
1943 1943
 
1944
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) );
1945
-		if ( is_object( $row ) ) {
1944
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option));
1945
+		if (is_object($row)) {
1946 1946
 			$value = $row->option_value;
1947 1947
 		} else { //option does not exist so use default.
1948
-			return apply_filters( 'default_option_' . $option, false, $option );
1948
+			return apply_filters('default_option_'.$option, false, $option);
1949 1949
 		}
1950 1950
 
1951
-		EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option );
1951
+		EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option);
1952 1952
 		return EE_Core_Config::$ee_ueip_option;
1953 1953
 	}
1954 1954
 
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 		//reset all url properties
1965 1965
 		$this->_reset_urls();
1966 1966
 		//return what to save to db
1967
-		return array_keys( get_object_vars( $this ) );
1967
+		return array_keys(get_object_vars($this));
1968 1968
 	}
1969 1969
 
1970 1970
 }
@@ -2111,14 +2111,14 @@  discard block
 block discarded – undo
2111 2111
 	 */
2112 2112
 	public function __construct() {
2113 2113
 		// set default organization settings
2114
-		$this->name = get_bloginfo( 'name' );
2114
+		$this->name = get_bloginfo('name');
2115 2115
 		$this->address_1 = '123 Onna Road';
2116 2116
 		$this->address_2 = 'PO Box 123';
2117 2117
 		$this->city = 'Inna City';
2118 2118
 		$this->STA_ID = 4;
2119 2119
 		$this->CNT_ISO = 'US';
2120 2120
 		$this->zip = '12345';
2121
-		$this->email = get_bloginfo( 'admin_email' );
2121
+		$this->email = get_bloginfo('admin_email');
2122 2122
 		$this->phone = '';
2123 2123
 		$this->vat = '123456789';
2124 2124
 		$this->logo_url = '';
@@ -2206,46 +2206,46 @@  discard block
 block discarded – undo
2206 2206
 	 * @param string $CNT_ISO
2207 2207
 	 * @throws \EE_Error
2208 2208
 	 */
2209
-	public function __construct( $CNT_ISO = '' ) {
2209
+	public function __construct($CNT_ISO = '') {
2210 2210
 		/** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */
2211
-		$table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true );
2211
+		$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
2212 2212
 		// get country code from organization settings or use default
2213
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization )
2213
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2214 2214
 		           && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2215 2215
 			? EE_Registry::instance()->CFG->organization->CNT_ISO
2216 2216
 			: '';
2217 2217
 		// but override if requested
2218
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
2218
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2219 2219
 		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
2220 2220
 		if (
2221
-			! empty( $CNT_ISO )
2221
+			! empty($CNT_ISO)
2222 2222
 			&& EE_Maintenance_Mode::instance()->models_can_query()
2223
-			&& $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() )
2223
+			&& $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())
2224 2224
 		) {
2225 2225
 			// retrieve the country settings from the db, just in case they have been customized
2226
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
2227
-			if ( $country instanceof EE_Country ) {
2228
-				$this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2229
-				$this->name = $country->currency_name_single();    // Dollar
2230
-				$this->plural = $country->currency_name_plural();    // Dollars
2231
-				$this->sign = $country->currency_sign();            // currency sign: $
2232
-				$this->sign_b4 = $country->currency_sign_before();        // currency sign before or after: $TRUE  or  FALSE$
2233
-				$this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2234
-				$this->dec_mrk = $country->currency_decimal_mark();    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2235
-				$this->thsnds = $country->currency_thousands_separator();    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2226
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2227
+			if ($country instanceof EE_Country) {
2228
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
2229
+				$this->name = $country->currency_name_single(); // Dollar
2230
+				$this->plural = $country->currency_name_plural(); // Dollars
2231
+				$this->sign = $country->currency_sign(); // currency sign: $
2232
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
2233
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
2234
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2235
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2236 2236
 			}
2237 2237
 		}
2238 2238
 		// fallback to hardcoded defaults, in case the above failed
2239
-		if ( empty( $this->code ) ) {
2239
+		if (empty($this->code)) {
2240 2240
 			// set default currency settings
2241
-			$this->code = 'USD';    // currency code: USD, CAD, EUR
2242
-			$this->name = __( 'Dollar', 'event_espresso' );    // Dollar
2243
-			$this->plural = __( 'Dollars', 'event_espresso' );    // Dollars
2244
-			$this->sign = '$';    // currency sign: $
2245
-			$this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2246
-			$this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2247
-			$this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2248
-			$this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2241
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
2242
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
2243
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
2244
+			$this->sign = '$'; // currency sign: $
2245
+			$this->sign_b4 = true; // currency sign before or after: $TRUE  or  FALSE$
2246
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
2247
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2248
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2249 2249
 		}
2250 2250
 	}
2251 2251
 }
@@ -2414,7 +2414,7 @@  discard block
 block discarded – undo
2414 2414
 	 * @since 4.8.8.rc.019
2415 2415
 	 */
2416 2416
 	public function do_hooks() {
2417
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) );
2417
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2418 2418
 	}
2419 2419
 
2420 2420
 
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 	 * @return void
2424 2424
 	 */
2425 2425
 	public function set_default_reg_status_on_EEM_Event() {
2426
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2426
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2427 2427
 	}
2428 2428
 
2429 2429
 
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
 	/**
2441 2441
 	 * @param boolean $track_invalid_checkout_access
2442 2442
 	 */
2443
-	public function set_track_invalid_checkout_access( $track_invalid_checkout_access ) {
2443
+	public function set_track_invalid_checkout_access($track_invalid_checkout_access) {
2444 2444
 		$this->track_invalid_checkout_access = filter_var(
2445 2445
 			$track_invalid_checkout_access,
2446 2446
 			FILTER_VALIDATE_BOOLEAN
@@ -2558,10 +2558,10 @@  discard block
 block discarded – undo
2558 2558
 	 * @param bool $reset
2559 2559
 	 * @return string
2560 2560
 	 */
2561
-	public function log_file_name( $reset = false ) {
2562
-		if ( empty( $this->log_file_name ) || $reset ) {
2563
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt';
2564
-			EE_Config::instance()->update_espresso_config( false, false );
2561
+	public function log_file_name($reset = false) {
2562
+		if (empty($this->log_file_name) || $reset) {
2563
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt';
2564
+			EE_Config::instance()->update_espresso_config(false, false);
2565 2565
 		}
2566 2566
 		return $this->log_file_name;
2567 2567
 	}
@@ -2572,10 +2572,10 @@  discard block
 block discarded – undo
2572 2572
 	 * @param bool $reset
2573 2573
 	 * @return string
2574 2574
 	 */
2575
-	public function debug_file_name( $reset = false ) {
2576
-		if ( empty( $this->debug_file_name ) || $reset ) {
2577
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt';
2578
-			EE_Config::instance()->update_espresso_config( false, false );
2575
+	public function debug_file_name($reset = false) {
2576
+		if (empty($this->debug_file_name) || $reset) {
2577
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt';
2578
+			EE_Config::instance()->update_espresso_config(false, false);
2579 2579
 		}
2580 2580
 		return $this->debug_file_name;
2581 2581
 	}
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
 	 * @return string
2587 2587
 	 */
2588 2588
 	public function affiliate_id() {
2589
-		return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default';
2589
+		return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2590 2590
 	}
2591 2591
 
2592 2592
 
@@ -2595,7 +2595,7 @@  discard block
 block discarded – undo
2595 2595
      * @return boolean
2596 2596
      */
2597 2597
     public function encode_session_data() {
2598
-        return filter_var( $this->encode_session_data, FILTER_VALIDATE_BOOLEAN );
2598
+        return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2599 2599
     }
2600 2600
 
2601 2601
 
@@ -2603,8 +2603,8 @@  discard block
 block discarded – undo
2603 2603
     /**
2604 2604
      * @param boolean $encode_session_data
2605 2605
      */
2606
-    public function set_encode_session_data( $encode_session_data ) {
2607
-        $this->encode_session_data = filter_var( $encode_session_data, FILTER_VALIDATE_BOOLEAN );
2606
+    public function set_encode_session_data($encode_session_data) {
2607
+        $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2608 2608
     }
2609 2609
 
2610 2610
 
@@ -2784,21 +2784,21 @@  discard block
 block discarded – undo
2784 2784
 		$this->use_google_maps = true;
2785 2785
 		$this->google_map_api_key = '';
2786 2786
 		// for event details pages (reg page)
2787
-		$this->event_details_map_width = 585;            // ee_map_width_single
2788
-		$this->event_details_map_height = 362;            // ee_map_height_single
2789
-		$this->event_details_map_zoom = 14;            // ee_map_zoom_single
2790
-		$this->event_details_display_nav = true;            // ee_map_nav_display_single
2791
-		$this->event_details_nav_size = false;            // ee_map_nav_size_single
2792
-		$this->event_details_control_type = 'default';        // ee_map_type_control_single
2793
-		$this->event_details_map_align = 'center';            // ee_map_align_single
2787
+		$this->event_details_map_width = 585; // ee_map_width_single
2788
+		$this->event_details_map_height = 362; // ee_map_height_single
2789
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2790
+		$this->event_details_display_nav = true; // ee_map_nav_display_single
2791
+		$this->event_details_nav_size = false; // ee_map_nav_size_single
2792
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2793
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2794 2794
 		// for event list pages
2795
-		$this->event_list_map_width = 300;            // ee_map_width
2796
-		$this->event_list_map_height = 185;        // ee_map_height
2797
-		$this->event_list_map_zoom = 12;            // ee_map_zoom
2798
-		$this->event_list_display_nav = false;        // ee_map_nav_display
2799
-		$this->event_list_nav_size = true;            // ee_map_nav_size
2800
-		$this->event_list_control_type = 'dropdown';        // ee_map_type_control
2801
-		$this->event_list_map_align = 'center';            // ee_map_align
2795
+		$this->event_list_map_width = 300; // ee_map_width
2796
+		$this->event_list_map_height = 185; // ee_map_height
2797
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2798
+		$this->event_list_display_nav = false; // ee_map_nav_display
2799
+		$this->event_list_nav_size = true; // ee_map_nav_size
2800
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2801
+		$this->event_list_map_align = 'center'; // ee_map_align
2802 2802
 	}
2803 2803
 
2804 2804
 }
@@ -2960,7 +2960,7 @@  discard block
 block discarded – undo
2960 2960
 	 * @return void
2961 2961
 	 */
2962 2962
 	protected function _set_php_values() {
2963
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2963
+		$this->php->max_input_vars = ini_get('max_input_vars');
2964 2964
 		$this->php->version = phpversion();
2965 2965
 	}
2966 2966
 
@@ -2979,10 +2979,10 @@  discard block
 block discarded – undo
2979 2979
 	 * @type string $msg         Any message to be displayed.
2980 2980
 	 *                           }
2981 2981
 	 */
2982
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2983
-		if ( ! empty( $this->php->max_input_vars )
2984
-		     && ( $input_count >= $this->php->max_input_vars )
2985
-		     && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 )
2982
+	public function max_input_vars_limit_check($input_count = 0) {
2983
+		if ( ! empty($this->php->max_input_vars)
2984
+		     && ($input_count >= $this->php->max_input_vars)
2985
+		     && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)
2986 2986
 		) {
2987 2987
 			return sprintf(
2988 2988
 				__(
@@ -3078,7 +3078,7 @@  discard block
 block discarded – undo
3078 3078
 	 */
3079 3079
 	public function __construct() {
3080 3080
 		$this->payment_settings = array();
3081
-		$this->active_gateways = array( 'Invoice' => false );
3081
+		$this->active_gateways = array('Invoice' => false);
3082 3082
 	}
3083 3083
 }
3084 3084
 
Please login to merge, or discard this patch.
core/helpers/EEH_File.helper.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -325,8 +325,8 @@
 block discarded – undo
325 325
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
326 326
 		//parent folder, "/var/something/"
327 327
 		$ds = strlen($file_or_folder_path) > 1
328
-            ? strrpos($file_or_folder_path, DS, -2)
329
-            : strlen($file_or_folder_path);
328
+			? strrpos($file_or_folder_path, DS, -2)
329
+			: strlen($file_or_folder_path);
330 330
 		return substr($file_or_folder_path, 0, $ds + 1);
331 331
 	}
332 332
 
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
  * @ version		 	4.0
13 13
  *
14 14
  */
15
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
16
-require_once( EE_INTERFACES . 'EEI_Interfaces.php' );
15
+require_once(EE_HELPERS.'EEH_Base.helper.php');
16
+require_once(EE_INTERFACES.'EEI_Interfaces.php');
17 17
 /**
18 18
  *
19 19
  * Class EEH_File
@@ -52,30 +52,30 @@  discard block
 block discarded – undo
52 52
 	 * @throws EE_Error if filesystem credentials are required
53 53
 	 * @return WP_Filesystem_Base
54 54
 	 */
55
-	private static function _get_wp_filesystem( $filepath = null) {
56
-		if( apply_filters(
55
+	private static function _get_wp_filesystem($filepath = null) {
56
+		if (apply_filters(
57 57
 				'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct',
58
-				$filepath && EEH_File::is_in_uploads_folder( $filepath ),
59
-				$filepath ) ) {
60
-			if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) {
61
-				require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
58
+				$filepath && EEH_File::is_in_uploads_folder($filepath),
59
+				$filepath )) {
60
+			if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) {
61
+				require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php');
62 62
 				$method = 'direct';
63
-				$wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
63
+				$wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
64 64
 				//check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem()
65
-				if ( ! defined('FS_CHMOD_DIR') ) {
66
-					define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
65
+				if ( ! defined('FS_CHMOD_DIR')) {
66
+					define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755));
67 67
 				}
68
-				if ( ! defined('FS_CHMOD_FILE') ) {
69
-					define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
68
+				if ( ! defined('FS_CHMOD_FILE')) {
69
+					define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644));
70 70
 				}
71
-				require_once( $wp_filesystem_direct_file );
72
-				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() );
71
+				require_once($wp_filesystem_direct_file);
72
+				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array());
73 73
 			}
74 74
 			return EEH_File::$_wp_filesystem_direct;
75 75
 		}
76 76
 		global $wp_filesystem;
77 77
 		// no filesystem setup ???
78
-		if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
78
+		if ( ! $wp_filesystem instanceof WP_Filesystem_Base) {
79 79
 			// if some eager beaver's just trying to get in there too early...
80 80
 			// let them do it, because we are one of those eager beavers! :P
81 81
 			/**
@@ -88,34 +88,34 @@  discard block
 block discarded – undo
88 88
 			 * and there may be troubles if the WP files are owned by a different user
89 89
 			 * than the server user. But both of these issues should exist in 4.4 and earlier too
90 90
 			 */
91
-			if ( FALSE && ! did_action( 'wp_loaded' )) {
91
+			if (FALSE && ! did_action('wp_loaded')) {
92 92
 				$msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso');
93
-				if ( WP_DEBUG ) {
94
-					$msg .= '<br />' .  __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
93
+				if (WP_DEBUG) {
94
+					$msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
95 95
 				}
96
-				throw new EE_Error( $msg );
96
+				throw new EE_Error($msg);
97 97
 			} else {
98 98
 				// should be loaded if we are past the wp_loaded hook...
99
-				if ( ! function_exists( 'WP_Filesystem' )) {
100
-					require_once( ABSPATH . 'wp-admin/includes/file.php' );
101
-					require_once( ABSPATH . 'wp-admin/includes/template.php' );
99
+				if ( ! function_exists('WP_Filesystem')) {
100
+					require_once(ABSPATH.'wp-admin/includes/file.php');
101
+					require_once(ABSPATH.'wp-admin/includes/template.php');
102 102
 				}
103 103
 				// turn on output buffering so that we can capture the credentials form
104 104
 				ob_start();
105
-				$credentials = request_filesystem_credentials( '' );
105
+				$credentials = request_filesystem_credentials('');
106 106
 				// store credentials form for the time being
107 107
 				EEH_File::$_credentials_form = ob_get_clean();
108 108
 				// basically check for direct or previously configured access
109
-				if ( ! WP_Filesystem( $credentials ) ) {
109
+				if ( ! WP_Filesystem($credentials)) {
110 110
 					// if credentials do NOT exist
111
-					if ( $credentials === FALSE ) {
112
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
113
-						throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
114
-					} elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
115
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
111
+					if ($credentials === FALSE) {
112
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
113
+						throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
114
+					} elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
115
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
116 116
 						throw new EE_Error(
117 117
 								sprintf(
118
-										__( 'WP Filesystem Error: $1%s', 'event_espresso' ),
118
+										__('WP Filesystem Error: $1%s', 'event_espresso'),
119 119
 										$wp_filesystem->errors->get_error_message() ) );
120 120
 					}
121 121
 				}
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 * display_request_filesystem_credentials_form
129 129
 	 */
130 130
 	public static function display_request_filesystem_credentials_form() {
131
-		if ( ! empty( EEH_File::$_credentials_form )) {
132
-			echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>';
131
+		if ( ! empty(EEH_File::$_credentials_form)) {
132
+			echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>';
133 133
 		}
134 134
 	}
135 135
 
@@ -147,29 +147,29 @@  discard block
 block discarded – undo
147 147
 	 * @throws EE_Error if filesystem credentials are required
148 148
 	 * @return bool
149 149
 	 */
150
-	public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) {
150
+	public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') {
151 151
 		// load WP_Filesystem and set file permissions
152
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
153
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
154
-		if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) {
155
-			$file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name;
156
-			$file_name .= ! empty( $file_ext ) ? ' file' : ' folder';
152
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
153
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
154
+		if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
155
+			$file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name;
156
+			$file_name .= ! empty($file_ext) ? ' file' : ' folder';
157 157
 			$msg = sprintf(
158
-				__( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ),
158
+				__('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'),
159 159
 				$file_name,
160 160
 				'<br />'
161 161
 			);
162
-			if ( EEH_File::exists( $full_file_path )) {
163
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file );
162
+			if (EEH_File::exists($full_file_path)) {
163
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file);
164 164
 			} else {
165 165
 				// no file permissions means the file was not found
166 166
 				$msg .= sprintf(
167
-					__( 'Please ensure the following path is correct: "%s".', 'event_espresso' ),
167
+					__('Please ensure the following path is correct: "%s".', 'event_espresso'),
168 168
 					$full_file_path
169 169
 				);
170 170
 			}
171
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
172
-				throw new EE_Error( $msg . '||' . $msg );
171
+			if (defined('WP_DEBUG') && WP_DEBUG) {
172
+				throw new EE_Error($msg.'||'.$msg);
173 173
 			}
174 174
 			return FALSE;
175 175
 		}
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
 	 * @throws EE_Error if filesystem credentials are required
188 188
 	 * @return string
189 189
 	 */
190
-	private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){
190
+	private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') {
191 191
 		// load WP_Filesystem and set file permissions
192
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
192
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
193 193
 		// check file permissions
194
-		$perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
195
-		if ( $perms ) {
194
+		$perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
195
+		if ($perms) {
196 196
 			// file permissions exist, but way be set incorrectly
197
-			$type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : '';
198
-			$type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder';
197
+			$type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : '';
198
+			$type_of_file .= ! empty($type_of_file) ? 'file' : 'folder';
199 199
 			return sprintf(
200
-				__( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ),
200
+				__('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'),
201 201
 				$type_of_file,
202 202
 				$perms
203 203
 			);
204 204
 		} else {
205 205
 			// file exists but file permissions could not be read ?!?!
206 206
 			return sprintf(
207
-				__( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ),
207
+				__('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'),
208 208
 				$full_file_path
209 209
 			);
210 210
 		}
@@ -222,35 +222,35 @@  discard block
 block discarded – undo
222 222
 	 * can't write to it
223 223
 	 * @return bool false if folder isn't writable; true if it exists and is writeable,
224 224
 	 */
225
-	public static function ensure_folder_exists_and_is_writable( $folder = '' ){
226
-		if ( empty( $folder )) {
225
+	public static function ensure_folder_exists_and_is_writable($folder = '') {
226
+		if (empty($folder)) {
227 227
 			return false;
228 228
 		}
229 229
 		// remove ending DS
230
-		$folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' ));
231
-		$parent_folder = EEH_File::get_parent_folder( $folder );
230
+		$folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\'));
231
+		$parent_folder = EEH_File::get_parent_folder($folder);
232 232
 		// add DS to folder
233
-		$folder = EEH_File::end_with_directory_separator( $folder );
234
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $folder );
235
-		if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) {
233
+		$folder = EEH_File::end_with_directory_separator($folder);
234
+		$wp_filesystem = EEH_File::_get_wp_filesystem($folder);
235
+		if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
236 236
 			//ok so it doesn't exist. Does its parent? Can we write to it?
237
-			if(	! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
237
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
238 238
 				return false;
239 239
 			}
240
-			if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) {
240
+			if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) {
241 241
 				return false;
242 242
 			} else {
243
-				if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath(  $folder ) ) ) {
244
-					if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
245
-						$msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder );
246
-						$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder );
247
-						throw new EE_Error( $msg );
243
+				if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
244
+					if (defined('WP_DEBUG') && WP_DEBUG) {
245
+						$msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder);
246
+						$msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder);
247
+						throw new EE_Error($msg);
248 248
 					}
249 249
 					return false;
250 250
 				}
251
-				EEH_File::add_index_file( $folder );
251
+				EEH_File::add_index_file($folder);
252 252
 			}
253
-		} elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
253
+		} elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) {
254 254
 			return false;
255 255
 		}
256 256
 		return true;
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 	 * @throws EE_Error if filesystem credentials are required
266 266
 	 * @return bool
267 267
 	 */
268
-	public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){
268
+	public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') {
269 269
 		// load WP_Filesystem and set file permissions
270
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_path );
271
-		$full_path = EEH_File::standardise_directory_separators( $full_path );
272
-		if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) {
273
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
274
-				$msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder );
275
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path );
276
-				throw new EE_Error( $msg );
270
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_path);
271
+		$full_path = EEH_File::standardise_directory_separators($full_path);
272
+		if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) {
273
+			if (defined('WP_DEBUG') && WP_DEBUG) {
274
+				$msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder);
275
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path);
276
+				throw new EE_Error($msg);
277 277
 			}
278 278
 			return FALSE;
279 279
 		}
@@ -290,25 +290,25 @@  discard block
 block discarded – undo
290 290
 	 * @throws EE_Error if filesystem credentials are required
291 291
 	 * @return bool
292 292
 	 */
293
-	public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) {
293
+	public static function ensure_file_exists_and_is_writable($full_file_path = '') {
294 294
 		// load WP_Filesystem and set file permissions
295
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
296
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
297
-		$parent_folder = EEH_File::get_parent_folder( $full_file_path );
298
-		if ( ! EEH_File::exists( $full_file_path )) {
299
-			if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
295
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
296
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
297
+		$parent_folder = EEH_File::get_parent_folder($full_file_path);
298
+		if ( ! EEH_File::exists($full_file_path)) {
299
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
300 300
 				return false;
301 301
 			}
302
-			if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) {
303
-				if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
304
-					$msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path );
305
-					$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
306
-					throw new EE_Error( $msg );
302
+			if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
303
+				if (defined('WP_DEBUG') && WP_DEBUG) {
304
+					$msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path);
305
+					$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
306
+					throw new EE_Error($msg);
307 307
 				}
308 308
 				return false;
309 309
 			}
310 310
 		}
311
-		if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) {
311
+		if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) {
312 312
 			return false;
313 313
 		}
314 314
 		return true;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * @param string $file_or_folder_path
321 321
 	 * @return string parent folder, ENDING with a directory separator
322 322
 	 */
323
-	public static function get_parent_folder( $file_or_folder_path ) {
323
+	public static function get_parent_folder($file_or_folder_path) {
324 324
 		//find the last DS, ignoring a DS on the very end
325 325
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
326 326
 		//parent folder, "/var/something/"
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 	 * @throws EE_Error if filesystem credentials are required
343 343
 	 * @return string
344 344
 	 */
345
-	public static function get_file_contents( $full_file_path = '' ){
346
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
347
-		if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) {
345
+	public static function get_file_contents($full_file_path = '') {
346
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
347
+		if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) {
348 348
 			// load WP_Filesystem and set file permissions
349
-			$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
350
-			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
349
+			$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
350
+			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
351 351
 		}
352 352
 		return '';
353 353
 	}
@@ -362,26 +362,26 @@  discard block
 block discarded – undo
362 362
 	 * @throws EE_Error if filesystem credentials are required
363 363
 	 * @return bool
364 364
 	 */
365
-	public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){
366
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
367
-		$file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : '';
368
-		$folder = EEH_File::remove_filename_from_filepath( $full_file_path );
369
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
370
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
371
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path );
372
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
373
-				throw new EE_Error( $msg );
365
+	public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') {
366
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
367
+		$file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : '';
368
+		$folder = EEH_File::remove_filename_from_filepath($full_file_path);
369
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
370
+			if (defined('WP_DEBUG') && WP_DEBUG) {
371
+				$msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path);
372
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
373
+				throw new EE_Error($msg);
374 374
 			}
375 375
 			return FALSE;
376 376
 		}
377 377
 		// load WP_Filesystem and set file permissions
378
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
378
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
379 379
 		// write the file
380
-		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) {
381
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
382
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path );
383
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' );
384
-				throw new EE_Error( $msg );
380
+		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) {
381
+			if (defined('WP_DEBUG') && WP_DEBUG) {
382
+				$msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path);
383
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f');
384
+				throw new EE_Error($msg);
385 385
 			}
386 386
 			return FALSE;
387 387
 		}
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 	 * @throws EE_Error if filesystem credentials are required
398 398
 	 * @return boolean
399 399
 	 */
400
-	public static function delete( $filepath, $recursive = false, $type = false ) {
400
+	public static function delete($filepath, $recursive = false, $type = false) {
401 401
 		$wp_filesystem = EEH_File::_get_wp_filesystem();
402
-		return $wp_filesystem->delete( $filepath, $recursive, $type ) ? TRUE : FALSE;
402
+		return $wp_filesystem->delete($filepath, $recursive, $type) ? TRUE : FALSE;
403 403
 	}
404 404
 
405 405
 
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
 	 * @throws EE_Error if filesystem credentials are required
412 412
 	 * @return bool
413 413
 	 */
414
-	public static function exists( $full_file_path = '' ) {
415
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
416
-		return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE;
414
+	public static function exists($full_file_path = '') {
415
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
416
+		return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE;
417 417
 	}
418 418
 
419 419
 
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 	 * @throws EE_Error if filesystem credentials are required
427 427
 	 * @return bool
428 428
 	 */
429
-	public static function is_readable( $full_file_path = '' ) {
430
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
431
-		if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath(  $full_file_path ) ) ) {
429
+	public static function is_readable($full_file_path = '') {
430
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
431
+		if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
432 432
 			return true;
433 433
 		} else {
434 434
 			return false;
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param string $full_file_path
445 445
 	 * @return string
446 446
 	 */
447
-	public static function remove_filename_from_filepath( $full_file_path = '' ) {
448
-		return pathinfo( $full_file_path, PATHINFO_DIRNAME );
447
+	public static function remove_filename_from_filepath($full_file_path = '') {
448
+		return pathinfo($full_file_path, PATHINFO_DIRNAME);
449 449
 	}
450 450
 
451 451
 
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param string $full_file_path
456 456
 	 * @return string
457 457
 	 */
458
-	public static function get_filename_from_filepath( $full_file_path = '' ) {
459
-		return pathinfo( $full_file_path, PATHINFO_BASENAME );
458
+	public static function get_filename_from_filepath($full_file_path = '') {
459
+		return pathinfo($full_file_path, PATHINFO_BASENAME);
460 460
 	}
461 461
 
462 462
 
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param string $full_file_path
467 467
 	 * @return string
468 468
 	 */
469
-	public static function get_file_extension( $full_file_path = '' ) {
470
-		return pathinfo( $full_file_path, PATHINFO_EXTENSION );
469
+	public static function get_file_extension($full_file_path = '') {
470
+		return pathinfo($full_file_path, PATHINFO_EXTENSION);
471 471
 	}
472 472
 
473 473
 
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 	 * @throws EE_Error if filesystem credentials are required
479 479
 	 * @return bool
480 480
 	 */
481
-	public static function add_htaccess_deny_from_all( $folder = '' ) {
482
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
483
-		if ( ! EEH_File::exists( $folder . '.htaccess' ) ) {
484
-			if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) {
481
+	public static function add_htaccess_deny_from_all($folder = '') {
482
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
483
+		if ( ! EEH_File::exists($folder.'.htaccess')) {
484
+			if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) {
485 485
 				return FALSE;
486 486
 			}
487 487
 		}
@@ -495,10 +495,10 @@  discard block
 block discarded – undo
495 495
 	 * @throws EE_Error if filesystem credentials are required
496 496
 	 * @return boolean
497 497
 	 */
498
-	public static function add_index_file( $folder ) {
499
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
500
-		if ( ! EEH_File::exists( $folder . 'index.php' ) ) {
501
-			if ( ! EEH_File::write_to_file( $folder . 'index.php', 'You are not permitted to read from this folder', '.php' )) {
498
+	public static function add_index_file($folder) {
499
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
500
+		if ( ! EEH_File::exists($folder.'index.php')) {
501
+			if ( ! EEH_File::write_to_file($folder.'index.php', 'You are not permitted to read from this folder', '.php')) {
502 502
 				return false;
503 503
 			}
504 504
 		}
@@ -513,11 +513,11 @@  discard block
 block discarded – undo
513 513
 	 * @param string $file_path
514 514
 	 * @return string
515 515
 	 */
516
-	public static function get_classname_from_filepath_with_standard_filename( $file_path ){
516
+	public static function get_classname_from_filepath_with_standard_filename($file_path) {
517 517
 		//extract file from path
518
-		$filename = basename( $file_path );
518
+		$filename = basename($file_path);
519 519
 		//now remove the first period and everything after
520
-		$pos_of_first_period = strpos( $filename,'.' );
520
+		$pos_of_first_period = strpos($filename, '.');
521 521
 		return substr($filename, 0, $pos_of_first_period);
522 522
 	}
523 523
 
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 	 * @param string $file_path
530 530
 	 * @return string
531 531
 	 */
532
-	public static function standardise_directory_separators( $file_path ){
533
-		return str_replace( array( '\\', '/' ), DS, $file_path );
532
+	public static function standardise_directory_separators($file_path) {
533
+		return str_replace(array('\\', '/'), DS, $file_path);
534 534
 	}
535 535
 
536 536
 
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 * @param string $file_path
542 542
 	 * @return string
543 543
 	 */
544
-	public static function end_with_directory_separator( $file_path ){
545
-		return rtrim( $file_path, '/\\' ) . DS;
544
+	public static function end_with_directory_separator($file_path) {
545
+		return rtrim($file_path, '/\\').DS;
546 546
 	}
547 547
 
548 548
 
@@ -552,8 +552,8 @@  discard block
 block discarded – undo
552 552
 	 * @param $file_path
553 553
 	 * @return string
554 554
 	 */
555
-	public static function standardise_and_end_with_directory_separator( $file_path ){
556
-		return self::end_with_directory_separator( self::standardise_directory_separators( $file_path ));
555
+	public static function standardise_and_end_with_directory_separator($file_path) {
556
+		return self::end_with_directory_separator(self::standardise_directory_separators($file_path));
557 557
 	}
558 558
 
559 559
 
@@ -570,21 +570,21 @@  discard block
 block discarded – undo
570 570
 	 *		if $index_numerically == FALSE (Default) keys are what the class names SHOULD be;
571 571
 	 *		 and values are their filepaths
572 572
 	 */
573
-	public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){
573
+	public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) {
574 574
 		$class_to_folder_path = array();
575
-		foreach( $folder_paths as $folder_path ){
576
-			$folder_path = self::standardise_and_end_with_directory_separator( $folder_path );
575
+		foreach ($folder_paths as $folder_path) {
576
+			$folder_path = self::standardise_and_end_with_directory_separator($folder_path);
577 577
 			// load WP_Filesystem and set file permissions
578
-			$files_in_folder = glob( $folder_path . '*' );
578
+			$files_in_folder = glob($folder_path.'*');
579 579
 			$class_to_folder_path = array();
580
-			if ( $files_in_folder ) {
581
-				foreach( $files_in_folder as $file_path ){
580
+			if ($files_in_folder) {
581
+				foreach ($files_in_folder as $file_path) {
582 582
 					//only add files, not folders
583
-					if ( ! is_dir( $file_path )) {
584
-						if ( $index_numerically ) {
583
+					if ( ! is_dir($file_path)) {
584
+						if ($index_numerically) {
585 585
 							$class_to_folder_path[] = $file_path;
586 586
 						} else {
587
-							$classname = self::get_classname_from_filepath_with_standard_filename( $file_path );
587
+							$classname = self::get_classname_from_filepath_with_standard_filename($file_path);
588 588
 							$class_to_folder_path[$classname] = $file_path;
589 589
 						}
590 590
 					}
@@ -604,39 +604,39 @@  discard block
 block discarded – undo
604 604
 	 * @throws EE_Error if filesystem credentials are required
605 605
 	 * @return boolean success
606 606
 	 */
607
-	public static function copy( $source_file, $destination_file, $overwrite = FALSE ){
608
-		$full_source_path = EEH_File::standardise_directory_separators( $source_file );
609
-		if( ! EEH_File::exists( $full_source_path ) ){
610
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
611
-				$msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path );
612
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path );
613
-				throw new EE_Error( $msg );
607
+	public static function copy($source_file, $destination_file, $overwrite = FALSE) {
608
+		$full_source_path = EEH_File::standardise_directory_separators($source_file);
609
+		if ( ! EEH_File::exists($full_source_path)) {
610
+			if (defined('WP_DEBUG') && WP_DEBUG) {
611
+				$msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path);
612
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path);
613
+				throw new EE_Error($msg);
614 614
 			}
615 615
 			return FALSE;
616 616
 		}
617 617
 
618
-		$full_dest_path = EEH_File::standardise_directory_separators( $destination_file );
619
-		$folder = EEH_File::remove_filename_from_filepath( $full_dest_path );
620
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
621
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
622
-				$msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path );
623
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path );
624
-				throw new EE_Error( $msg );
618
+		$full_dest_path = EEH_File::standardise_directory_separators($destination_file);
619
+		$folder = EEH_File::remove_filename_from_filepath($full_dest_path);
620
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
621
+			if (defined('WP_DEBUG') && WP_DEBUG) {
622
+				$msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path);
623
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path);
624
+				throw new EE_Error($msg);
625 625
 			}
626 626
 			return FALSE;
627 627
 		}
628 628
 
629 629
 		// load WP_Filesystem and set file permissions
630
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file );
630
+		$wp_filesystem = EEH_File::_get_wp_filesystem($destination_file);
631 631
 		// write the file
632 632
 		if ( ! $wp_filesystem->copy(
633
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ),
634
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ),
633
+						EEH_File::convert_local_filepath_to_remote_filepath($full_source_path),
634
+						EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path),
635 635
 						$overwrite )) {
636
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
637
-				$msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path );
638
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' );
639
-				throw new EE_Error( $msg );
636
+			if (defined('WP_DEBUG') && WP_DEBUG) {
637
+				$msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path);
638
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f');
639
+				throw new EE_Error($msg);
640 640
 			}
641 641
 			return FALSE;
642 642
 		}
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
 	 * @param string $filepath
649 649
 	 * @return boolean
650 650
 	 */
651
-	public static function is_in_uploads_folder( $filepath ) {
651
+	public static function is_in_uploads_folder($filepath) {
652 652
 		$uploads = wp_upload_dir();
653
-		return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false;
653
+		return strpos($filepath, $uploads['basedir']) === 0 ? true : false;
654 654
 	}
655 655
 
656 656
 	/**
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg
666 666
 	 * ftp or ssh, will use to access the folder
667 667
 	 */
668
-	public static function convert_local_filepath_to_remote_filepath( $local_filepath ) {
669
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath );
670
-		return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath );
668
+	public static function convert_local_filepath_to_remote_filepath($local_filepath) {
669
+		$wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath);
670
+		return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath);
671 671
 	}
672 672
 }
673 673
 // End of file EEH_File.helper.php
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 2 patches
Indentation   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119 119
 		$timezone_string = $timezone_string !== false
120
-            ? $timezone_string
121
-            : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
120
+			? $timezone_string
121
+			: EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
122 122
 		return $timezone_string;
123 123
 	}
124 124
 
@@ -819,7 +819,6 @@  discard block
 block discarded – undo
819 819
 
820 820
 
821 821
 	/**
822
-
823 822
 	 *
824 823
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
825 824
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
Spacing   +142 added lines, -143 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
 /**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 * @throws \EE_Error
55 55
 	 */
56
-	public static function get_valid_timezone_string( $timezone_string = '' ) {
56
+	public static function get_valid_timezone_string($timezone_string = '') {
57 57
 		// if passed a value, then use that, else get WP option
58
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
58
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
59 59
 		// value from above exists, use that, else get timezone string from gmt_offset
60
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
-		EEH_DTT_Helper::validate_timezone( $timezone_string );
60
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
+		EEH_DTT_Helper::validate_timezone($timezone_string);
62 62
 		return $timezone_string;
63 63
 	}
64 64
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 * @return bool
75 75
 	 * @throws \EE_Error
76 76
 	 */
77
-	public static function validate_timezone( $timezone_string, $throw_error = true ) {
77
+	public static function validate_timezone($timezone_string, $throw_error = true) {
78 78
 		// easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it
79 79
 		try {
80
-			new DateTimeZone( $timezone_string );
81
-		} catch ( Exception $e ) {
80
+			new DateTimeZone($timezone_string);
81
+		} catch (Exception $e) {
82 82
 			// sometimes we take exception to exceptions
83
-			if ( ! $throw_error ) {
83
+			if ( ! $throw_error) {
84 84
 				return false;
85 85
 			}
86 86
 			throw new EE_Error(
87 87
 				sprintf(
88
-					__( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
88
+					__('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
89 89
 					$timezone_string,
90 90
 					'<a href="http://www.php.net/manual/en/timezones.php">',
91 91
 					'</a>'
@@ -104,21 +104,21 @@  discard block
 block discarded – undo
104 104
 	 * @param string $gmt_offset
105 105
 	 * @return string
106 106
 	 */
107
-	public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) {
107
+	public static function get_timezone_string_from_gmt_offset($gmt_offset = '') {
108 108
 		$timezone_string = 'UTC';
109
-		$gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' );
110
-		if ( $gmt_offset !== '' ) {
109
+		$gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset');
110
+		if ($gmt_offset !== '') {
111 111
 			// convert GMT offset to seconds
112 112
 			$gmt_offset = $gmt_offset * HOUR_IN_SECONDS;
113 113
 			// account for WP offsets that aren't valid UTC
114
-			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset );
114
+			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset);
115 115
 			// although we don't know the TZ abbreviation, we know the UTC offset
116
-			$timezone_string = timezone_name_from_abbr( null, $gmt_offset );
116
+			$timezone_string = timezone_name_from_abbr(null, $gmt_offset);
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119 119
 		$timezone_string = $timezone_string !== false
120 120
             ? $timezone_string
121
-            : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
121
+            : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset);
122 122
 		return $timezone_string;
123 123
 	}
124 124
 
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @return int seconds offset
130 130
 	 */
131 131
 	public static function get_site_timezone_gmt_offset() {
132
-		$timezone_string = get_option( 'timezone_string' );
133
-		if ( $timezone_string ) {
132
+		$timezone_string = get_option('timezone_string');
133
+		if ($timezone_string) {
134 134
 			try {
135
-				$timezone = new DateTimeZone( $timezone_string );
136
-				return $timezone->getOffset( new DateTime() ); //in WordPress DateTime defaults to UTC
137
-			} catch( Exception $e ){}
135
+				$timezone = new DateTimeZone($timezone_string);
136
+				return $timezone->getOffset(new DateTime()); //in WordPress DateTime defaults to UTC
137
+			} catch (Exception $e) {}
138 138
 		}
139
-		$offset = get_option( 'gmt_offset' );
140
-		return (int) ( $offset * HOUR_IN_SECONDS );
139
+		$offset = get_option('gmt_offset');
140
+		return (int) ($offset * HOUR_IN_SECONDS);
141 141
 	}
142 142
 
143 143
 
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 	 * @param int $gmt_offset
150 150
 	 * @return int
151 151
 	 */
152
-	public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) {
152
+	public static function adjust_invalid_gmt_offsets($gmt_offset = 0) {
153 153
 		//make sure $gmt_offset is int
154 154
 		$gmt_offset = (int) $gmt_offset;
155
-		switch ( $gmt_offset ) {
155
+		switch ($gmt_offset) {
156 156
 
157 157
 			//			case -30600 :
158 158
 			//				$gmt_offset = -28800;
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 	 * @return string
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) {
207
+	public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) {
208 208
 		$abbreviations = timezone_abbreviations_list();
209
-		foreach ( $abbreviations as $abbreviation ) {
210
-			foreach ( $abbreviation as $city ) {
211
-				if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) {
209
+		foreach ($abbreviations as $abbreviation) {
210
+			foreach ($abbreviation as $city) {
211
+				if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) {
212 212
 					// check if the timezone is valid but don't throw any errors if it isn't
213
-					if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) {
213
+					if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) {
214 214
 						return $city['timezone_id'];
215 215
 					}
216 216
 				}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		}
219 219
 		throw new EE_Error(
220 220
 			sprintf(
221
-				__( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
221
+				__('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
222 222
 				$gmt_offset,
223 223
 				'<a href="http://www.php.net/manual/en/timezones.php">',
224 224
 				'</a>'
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
 	 * @access public
233 233
 	 * @param string $timezone_string
234 234
 	 */
235
-	public static function timezone_select_input( $timezone_string = '' ) {
235
+	public static function timezone_select_input($timezone_string = '') {
236 236
 		// get WP date time format
237
-		$datetime_format = get_option('date_format') . ' '  . get_option('time_format');
237
+		$datetime_format = get_option('date_format').' '.get_option('time_format');
238 238
 		// if passed a value, then use that, else get WP option
239
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
239
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
240 240
 		// check if the timezone is valid but don't throw any errors if it isn't
241
-		$timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false );
241
+		$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
242 242
 		$gmt_offset = get_option('gmt_offset');
243 243
 
244 244
 		$check_zone_info = true;
245
-		if ( empty( $timezone_string )) {
245
+		if (empty($timezone_string)) {
246 246
 			// Create a UTC+- zone if no timezone string exists
247 247
 			$check_zone_info = false;
248
-			if ( $gmt_offset > 0 ) {
249
-				$timezone_string = 'UTC+' . $gmt_offset;
250
-			} elseif ( $gmt_offset < 0 ) {
251
-				$timezone_string = 'UTC' . $gmt_offset;
248
+			if ($gmt_offset > 0) {
249
+				$timezone_string = 'UTC+'.$gmt_offset;
250
+			} elseif ($gmt_offset < 0) {
251
+				$timezone_string = 'UTC'.$gmt_offset;
252 252
 			} else {
253 253
 				$timezone_string = 'UTC';
254 254
 			}
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 					__('%1$sUTC%2$s time is %3$s'),
271 271
 					'<abbr title="Coordinated Universal Time">',
272 272
 					'</abbr>',
273
-					'<code>' . date_i18n( $datetime_format , false, true ) . '</code>'
273
+					'<code>'.date_i18n($datetime_format, false, true).'</code>'
274 274
 				);
275 275
 				?></span>
276
-			<?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?>
277
-				<br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span>
276
+			<?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?>
277
+				<br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span>
278 278
 		<?php endif; ?>
279 279
 
280 280
 				<?php if ($check_zone_info && $timezone_string) : ?>
@@ -306,10 +306,9 @@  discard block
 block discarded – undo
306 306
 
307 307
 						if ($found) {
308 308
 							$message = $tr['isdst'] ?
309
-											__(' Daylight saving time begins on: %s.' ) :
310
-											__(' Standard time begins  on: %s.');
309
+											__(' Daylight saving time begins on: %s.') : __(' Standard time begins  on: %s.');
311 310
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
312
-							printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' );
311
+							printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >');
313 312
 						} else {
314 313
 							_e('This timezone does not observe daylight saving time.');
315 314
 						}
@@ -339,14 +338,14 @@  discard block
 block discarded – undo
339 338
 	 *
340 339
 	 * @return int      $unix_timestamp with the offset applied for the given timezone.
341 340
 	 */
342
-	public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) {
341
+	public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') {
343 342
 		$unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp;
344
-		$timezone_string = self::get_valid_timezone_string( $timezone_string );
345
-		$TimeZone = new DateTimeZone( $timezone_string );
343
+		$timezone_string = self::get_valid_timezone_string($timezone_string);
344
+		$TimeZone = new DateTimeZone($timezone_string);
346 345
 
347
-		$DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone );
348
-		$offset = timezone_offset_get( $TimeZone, $DateTime );
349
-		return (int)$DateTime->format( 'U' ) + (int)$offset;
346
+		$DateTime = new DateTime('@'.$unix_timestamp, $TimeZone);
347
+		$offset = timezone_offset_get($TimeZone, $DateTime);
348
+		return (int) $DateTime->format('U') + (int) $offset;
350 349
 	}
351 350
 
352 351
 
@@ -361,17 +360,17 @@  discard block
 block discarded – undo
361 360
 	 * @param  string					$datetime_field_name 	the datetime fieldname to be manipulated
362 361
 	 * @return 	EE_Base_Class
363 362
 	 */
364
-	protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) {
363
+	protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) {
365 364
 		// grab current datetime format
366 365
 		$current_format = $obj->get_format();
367 366
 		// set new full timestamp format
368
-		$obj->set_date_format( EE_Datetime_Field::mysql_date_format );
369
-		$obj->set_time_format( EE_Datetime_Field::mysql_time_format );
367
+		$obj->set_date_format(EE_Datetime_Field::mysql_date_format);
368
+		$obj->set_time_format(EE_Datetime_Field::mysql_time_format);
370 369
 		// set the new date value using a full timestamp format so that no data is lost
371
-		$obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) );
370
+		$obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format));
372 371
 		// reset datetime formats
373
-		$obj->set_date_format( $current_format[0] );
374
-		$obj->set_time_format( $current_format[1] );
372
+		$obj->set_date_format($current_format[0]);
373
+		$obj->set_time_format($current_format[1]);
375 374
 		return $obj;
376 375
 	}
377 376
 
@@ -388,11 +387,11 @@  discard block
 block discarded – undo
388 387
 	 * @param  integer 	$value    what you want to increment the time by
389 388
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
390 389
 	 */
391
-	public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
390
+	public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
392 391
 		//get the raw UTC date.
393
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
394
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value );
395
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
392
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
393
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value);
394
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
396 395
 	}
397 396
 
398 397
 
@@ -407,11 +406,11 @@  discard block
 block discarded – undo
407 406
 	 * @param int            $value
408 407
 	 * @return \EE_Base_Class
409 408
 	 */
410
-	public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
409
+	public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
411 410
 		//get the raw UTC date
412
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
413
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' );
414
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
411
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
412
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-');
413
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
415 414
 	}
416 415
 
417 416
 
@@ -424,44 +423,44 @@  discard block
 block discarded – undo
424 423
 	 * @return \DateTime return whatever type came in.
425 424
 	 * @throws \EE_Error
426 425
 	 */
427
-	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
428
-		if ( ! $DateTime instanceof DateTime ) {
426
+	protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') {
427
+		if ( ! $DateTime instanceof DateTime) {
429 428
 			throw new EE_Error(
430 429
 				sprintf(
431
-					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
432
-					print_r( $DateTime, true )
430
+					__('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'),
431
+					print_r($DateTime, true)
433 432
 				)
434 433
 			);
435 434
 		}
436
-		switch ( $period ) {
435
+		switch ($period) {
437 436
 			case 'years' :
438
-				$value = 'P' . $value . 'Y';
437
+				$value = 'P'.$value.'Y';
439 438
 				break;
440 439
 			case 'months' :
441
-				$value = 'P' . $value . 'M';
440
+				$value = 'P'.$value.'M';
442 441
 				break;
443 442
 			case 'weeks' :
444
-				$value = 'P' . $value . 'W';
443
+				$value = 'P'.$value.'W';
445 444
 				break;
446 445
 			case 'days' :
447
-				$value = 'P' . $value . 'D';
446
+				$value = 'P'.$value.'D';
448 447
 				break;
449 448
 			case 'hours' :
450
-				$value = 'PT' . $value . 'H';
449
+				$value = 'PT'.$value.'H';
451 450
 				break;
452 451
 			case 'minutes' :
453
-				$value = 'PT' . $value . 'M';
452
+				$value = 'PT'.$value.'M';
454 453
 				break;
455 454
 			case 'seconds' :
456
-				$value = 'PT' . $value . 'S';
455
+				$value = 'PT'.$value.'S';
457 456
 				break;
458 457
 		}
459
-		switch ( $operand ) {
458
+		switch ($operand) {
460 459
 			case '+':
461
-				$DateTime->add( new DateInterval( $value ) );
460
+				$DateTime->add(new DateInterval($value));
462 461
 				break;
463 462
 			case '-':
464
-				$DateTime->sub( new DateInterval( $value ) );
463
+				$DateTime->sub(new DateInterval($value));
465 464
 				break;
466 465
 		}
467 466
 		return $DateTime;
@@ -477,16 +476,16 @@  discard block
 block discarded – undo
477 476
 	 * @return \DateTime return whatever type came in.
478 477
 	 * @throws \EE_Error
479 478
 	 */
480
-	protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) {
481
-		if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) {
479
+	protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') {
480
+		if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) {
482 481
 			throw new EE_Error(
483 482
 				sprintf(
484
-					__( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ),
485
-					print_r( $timestamp, true )
483
+					__('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'),
484
+					print_r($timestamp, true)
486 485
 				)
487 486
 			);
488 487
 		}
489
-		switch ( $period ) {
488
+		switch ($period) {
490 489
 			case 'years' :
491 490
 				$value = YEAR_IN_SECONDS * $value;
492 491
 				break;
@@ -506,9 +505,9 @@  discard block
 block discarded – undo
506 505
 				$value = MINUTE_IN_SECONDS * $value;
507 506
 				break;
508 507
 		}
509
-		switch ( $operand ) {
508
+		switch ($operand) {
510 509
 			case '+':
511
-				$timestamp  += $value;
510
+				$timestamp += $value;
512 511
 				break;
513 512
 			case '-':
514 513
 				$timestamp -= $value;
@@ -528,11 +527,11 @@  discard block
 block discarded – undo
528 527
 	 * @param  string  $operand What operand you wish to use for the calculation
529 528
 	 * @return mixed string|DateTime          return whatever type came in.
530 529
 	 */
531
-	public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) {
532
-		if ( $DateTime_or_timestamp instanceof DateTime ) {
533
-			return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand );
534
-		} else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) {
535
-			return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand );
530
+	public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') {
531
+		if ($DateTime_or_timestamp instanceof DateTime) {
532
+			return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand);
533
+		} else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) {
534
+			return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand);
536 535
 		} else {
537 536
 			//error
538 537
 			return $DateTime_or_timestamp;
@@ -562,24 +561,24 @@  discard block
 block discarded – undo
562 561
 	 * 			'moment' => //date and time format.
563 562
 	 * 		)
564 563
 	 */
565
-	public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) {
566
-		if ( $date_format_string === null ) {
567
-			$date_format_string = get_option( 'date_format' );
564
+	public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) {
565
+		if ($date_format_string === null) {
566
+			$date_format_string = get_option('date_format');
568 567
 		}
569 568
 
570
-		if ( $time_format_string === null ) {
571
-			$time_format_string = get_option( 'time_format' );
569
+		if ($time_format_string === null) {
570
+			$time_format_string = get_option('time_format');
572 571
 		}
573 572
 
574
-		$date_format = self::_php_to_js_moment_converter( $date_format_string );
575
-		$time_format = self::_php_to_js_moment_converter( $time_format_string );
573
+		$date_format = self::_php_to_js_moment_converter($date_format_string);
574
+		$time_format = self::_php_to_js_moment_converter($time_format_string);
576 575
 
577 576
 		return array(
578 577
 			'js' => array(
579 578
 				'date' => $date_format['js'],
580 579
 				'time' => $time_format['js']
581 580
 				),
582
-			'moment' => $date_format['moment'] . ' ' . $time_format['moment' ]
581
+			'moment' => $date_format['moment'].' '.$time_format['moment']
583 582
 			);
584 583
 	}
585 584
 
@@ -593,7 +592,7 @@  discard block
 block discarded – undo
593 592
 	 *
594 593
 	 * @return array js and moment formats.
595 594
 	 */
596
-	protected static function _php_to_js_moment_converter( $format_string ) {
595
+	protected static function _php_to_js_moment_converter($format_string) {
597 596
 		/**
598 597
 		 * This is a map of symbols for formats.
599 598
 		 * The index is the php symbol, the equivalent values are in the array.
@@ -750,15 +749,15 @@  discard block
 block discarded – undo
750 749
 		$jquery_ui_format = "";
751 750
 		$moment_format = "";
752 751
 		$escaping = false;
753
-		for ( $i = 0; $i < strlen($format_string); $i++ ) {
752
+		for ($i = 0; $i < strlen($format_string); $i++) {
754 753
 			$char = $format_string[$i];
755
-			if ( $char === '\\' )  { // PHP date format escaping character
754
+			if ($char === '\\') { // PHP date format escaping character
756 755
 				$i++;
757
-				if ( $escaping ) {
756
+				if ($escaping) {
758 757
 					$jquery_ui_format .= $format_string[$i];
759 758
 					$moment_format .= $format_string[$i];
760 759
 				} else {
761
-					$jquery_ui_format .= '\'' . $format_string[$i];
760
+					$jquery_ui_format .= '\''.$format_string[$i];
762 761
 					$moment_format .= $format_string[$i];
763 762
 				}
764 763
 				$escaping = true;
@@ -777,7 +776,7 @@  discard block
 block discarded – undo
777 776
 				}
778 777
 			}
779 778
 		}
780
-		return array( 'js' => $jquery_ui_format, 'moment' => $moment_format );
779
+		return array('js' => $jquery_ui_format, 'moment' => $moment_format);
781 780
 	}
782 781
 
783 782
 
@@ -792,25 +791,25 @@  discard block
 block discarded – undo
792 791
 	 *                           		errors is returned.  So for client code calling, check for is_array() to
793 792
 	 *                           		indicate failed validations.
794 793
 	 */
795
-	public static function validate_format_string( $format_string ) {
794
+	public static function validate_format_string($format_string) {
796 795
 		$error_msg = array();
797 796
 		//time format checks
798
-		switch ( true ) {
799
-			case   strpos( $format_string, 'h' )  !== false  :
800
-			case   strpos( $format_string, 'g' ) !== false :
797
+		switch (true) {
798
+			case   strpos($format_string, 'h') !== false  :
799
+			case   strpos($format_string, 'g') !== false :
801 800
 				/**
802 801
 				 * if the time string has a lowercase 'h' which == 12 hour time format and there
803 802
 				 * is not any ante meridiem format ('a' or 'A').  Then throw an error because its
804 803
 				 * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am.
805 804
 				 */
806
-				if ( strpos( strtoupper( $format_string ), 'A' )  === false ) {
807
-					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' );
805
+				if (strpos(strtoupper($format_string), 'A') === false) {
806
+					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso');
808 807
 				}
809 808
 				break;
810 809
 
811 810
 		}
812 811
 
813
-		return empty( $error_msg ) ? true : $error_msg;
812
+		return empty($error_msg) ? true : $error_msg;
814 813
 	}
815 814
 
816 815
 
@@ -832,11 +831,11 @@  discard block
 block discarded – undo
832 831
 	 * @param mixed $date_2
833 832
 	 * @return bool
834 833
 	 */
835
-	public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) {
834
+	public static function dates_represent_one_24_hour_date($date_1, $date_2) {
836 835
 
837 836
 		if (
838
-			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) ||
839
-			( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' )
837
+			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) ||
838
+			($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00')
840 839
 		) {
841 840
 			return false;
842 841
 		}
@@ -853,11 +852,11 @@  discard block
 block discarded – undo
853 852
 	 * @param string $field_for_interval  The Database field that is the interval is applied to in the query.
854 853
 	 * @return string
855 854
 	 */
856
-	public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) {
855
+	public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) {
857 856
 		try {
858 857
 			/** need to account for timezone offset on the selects */
859
-			$DateTimeZone = new DateTimeZone( $timezone_string );
860
-		} catch ( Exception $e ) {
858
+			$DateTimeZone = new DateTimeZone($timezone_string);
859
+		} catch (Exception $e) {
861 860
 			$DateTimeZone = null;
862 861
 		}
863 862
 
@@ -865,10 +864,10 @@  discard block
 block discarded – undo
865 864
 		 * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds.
866 865
 		 * Hence we do the calc for DateTimeZone::getOffset.
867 866
 		 */
868
-		$offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' );
867
+		$offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset');
869 868
 		$query_interval = $offset < 0
870
-			? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)'
871
-			: 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)';
869
+			? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)'
870
+			: 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)';
872 871
 		return $query_interval;
873 872
 	}
874 873
 
@@ -880,47 +879,47 @@  discard block
 block discarded – undo
880 879
 	 * @return string
881 880
 	 */
882 881
 	public static function get_timezone_string_for_display() {
883
-		$pretty_timezone = apply_filters( 'FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '' );
884
-		if( ! empty( $pretty_timezone ) ) {
885
-			return esc_html( $pretty_timezone );
882
+		$pretty_timezone = apply_filters('FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '');
883
+		if ( ! empty($pretty_timezone)) {
884
+			return esc_html($pretty_timezone);
886 885
 		}
887
-		$timezone_string = get_option( 'timezone_string' );
888
-		if( $timezone_string ) {
886
+		$timezone_string = get_option('timezone_string');
887
+		if ($timezone_string) {
889 888
 			static $mo_loaded = false;
890 889
 			// Load translations for continents and cities just like wp_timezone_choice does
891
-			if ( ! $mo_loaded ) {
890
+			if ( ! $mo_loaded) {
892 891
 				$locale = get_locale();
893
-				$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
894
-				load_textdomain( 'continents-cities', $mofile );
892
+				$mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo';
893
+				load_textdomain('continents-cities', $mofile);
895 894
 				$mo_loaded = true;
896 895
 			}
897 896
 			//well that was easy.
898
-			$parts = explode('/', $timezone_string );
897
+			$parts = explode('/', $timezone_string);
899 898
 			//remove the continent
900
-			unset( $parts[0] );
899
+			unset($parts[0]);
901 900
 			$t_parts = array();
902
-			foreach( $parts as $part ) {
903
-				$t_parts[] = translate( str_replace( '_', ' ', $part ), 'continents-cities' );
901
+			foreach ($parts as $part) {
902
+				$t_parts[] = translate(str_replace('_', ' ', $part), 'continents-cities');
904 903
 			}
905
-			return implode( ' - ', $t_parts );
904
+			return implode(' - ', $t_parts);
906 905
 		}
907 906
 		//they haven't set the timezone string, so let's return a string like "UTC+1"
908
-		$gmt_offset = get_option( 'gmt_offset' );
909
-		if( intval( $gmt_offset ) >= 0 ) {
907
+		$gmt_offset = get_option('gmt_offset');
908
+		if (intval($gmt_offset) >= 0) {
910 909
 			$prefix = '+';
911 910
 		} else {
912 911
 			$prefix = '';
913 912
 		}
914
-		$parts = explode( '.', (string) $gmt_offset );
915
-		if( count( $parts ) === 1 ) {
913
+		$parts = explode('.', (string) $gmt_offset);
914
+		if (count($parts) === 1) {
916 915
 			$parts[1] = '00';
917 916
 		} else {
918 917
 			//convert the part after the decimal, eg "5" (from x.5) or "25" (from x.25)
919 918
 			//to minutes, eg 30 or 15, respectively
920
-			$hour_fraction = (float)( '0.' . $parts[1] );
921
-			$parts[1] = (string)$hour_fraction * 60;
919
+			$hour_fraction = (float) ('0.'.$parts[1]);
920
+			$parts[1] = (string) $hour_fraction * 60;
922 921
 		}
923
-		return sprintf( __( 'UTC%1$s', 'event_espresso' ), $prefix . implode( ':', $parts ) );
922
+		return sprintf(__('UTC%1$s', 'event_espresso'), $prefix.implode(':', $parts));
924 923
 	}
925 924
 
926 925
 
Please login to merge, or discard this patch.
core/libraries/rest_api/Model_Data_Translator.php 2 patches
Indentation   +481 added lines, -481 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\libraries\rest_api;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -26,485 +26,485 @@  discard block
 block discarded – undo
26 26
 class Model_Data_Translator
27 27
 {
28 28
 
29
-    /**
30
-     * We used to use -1 for infinity in the rest api, but that's ambiguous for
31
-     * fields that COULD contain -1; so we use null
32
-     */
33
-    const ee_inf_in_rest = null;
34
-
35
-
36
-
37
-    /**
38
-     * Prepares a possible array of input values from JSON for use by the models
39
-     *
40
-     * @param \EE_Model_Field_Base $field_obj
41
-     * @param mixed                $original_value_maybe_array
42
-     * @param string               $requested_version
43
-     * @param string               $timezone_string treat values as being in this timezone
44
-     * @return mixed
45
-     * @throws \DomainException
46
-     */
47
-    public static function prepare_field_values_from_json(
48
-        $field_obj,
49
-        $original_value_maybe_array,
50
-        $requested_version,
51
-        $timezone_string = 'UTC'
52
-    ) {
53
-        if (is_array($original_value_maybe_array)) {
54
-            $new_value_maybe_array = array();
55
-            foreach ($original_value_maybe_array as $array_key => $array_item) {
56
-                $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_from_json(
57
-                    $field_obj,
58
-                    $array_item,
59
-                    $requested_version,
60
-                    $timezone_string
61
-                );
62
-            }
63
-        } else {
64
-            $new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json(
65
-                $field_obj,
66
-                $original_value_maybe_array,
67
-                $requested_version,
68
-                $timezone_string
69
-            );
70
-        }
71
-        return $new_value_maybe_array;
72
-    }
73
-
74
-
75
-
76
-    /**
77
-     * Prepares an array of field values FOR use in JSON/REST API
78
-     *
79
-     * @param \EE_Model_Field_Base $field_obj
80
-     * @param mixed                $original_value_maybe_array
81
-     * @param string               $request_version (eg 4.8.36)
82
-     * @return array
83
-     */
84
-    public static function prepare_field_values_for_json($field_obj, $original_value_maybe_array, $request_version)
85
-    {
86
-        if (is_array($original_value_maybe_array)) {
87
-            $new_value_maybe_array = array();
88
-            foreach ($original_value_maybe_array as $array_key => $array_item) {
89
-                $new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_for_json(
90
-                    $field_obj,
91
-                    $array_item,
92
-                    $request_version
93
-                );
94
-            }
95
-        } else {
96
-            $new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json(
97
-                $field_obj,
98
-                $original_value_maybe_array,
99
-                $request_version
100
-            );
101
-        }
102
-        return $new_value_maybe_array;
103
-    }
104
-
105
-
106
-
107
-    /**
108
-     * Prepares incoming data from the json or $_REQUEST parameters for the models'
109
-     * "$query_params".
110
-     *
111
-     * @param \EE_Model_Field_Base $field_obj
112
-     * @param mixed                $original_value
113
-     * @param string               $requested_version
114
-     * @param string               $timezone_string treat values as being in this timezone
115
-     * @return mixed
116
-     * @throws \DomainException
117
-     */
118
-    public static function prepare_field_value_from_json(
119
-        $field_obj,
120
-        $original_value,
121
-        $requested_version,
122
-        $timezone_string = 'UTC' // UTC
123
-    )
124
-    {
125
-        $timezone_string = $timezone_string !== '' ? $timezone_string : get_option('timezone_string', '');
126
-        $new_value = null;
127
-        if ($field_obj instanceof \EE_Infinite_Integer_Field
128
-            && in_array($original_value, array(null, ''), true)
129
-        ) {
130
-            $new_value = EE_INF;
131
-        } elseif ($field_obj instanceof \EE_Datetime_Field) {
132
-            list($offset_sign, $offset_secs) = Model_Data_Translator::parse_timezone_offset(
133
-                $field_obj->get_timezone_offset(
134
-                    new \DateTimeZone($timezone_string)
135
-                )
136
-            );
137
-            $offset_string =
138
-                str_pad(
139
-                    floor($offset_secs / HOUR_IN_SECONDS),
140
-                    2,
141
-                    '0',
142
-                    STR_PAD_LEFT
143
-                )
144
-                . ':'
145
-                . str_pad(
146
-                    ($offset_secs % HOUR_IN_SECONDS) / MINUTE_IN_SECONDS,
147
-                    2,
148
-                    '0',
149
-                    STR_PAD_LEFT
150
-                );
151
-            $new_value = rest_parse_date($original_value . $offset_sign . $offset_string);
152
-        } else {
153
-            $new_value = $original_value;
154
-        }
155
-        return $new_value;
156
-    }
157
-
158
-
159
-
160
-    /**
161
-     * determines what's going on with them timezone strings
162
-     *
163
-     * @param int $timezone_offset
164
-     * @return array
165
-     */
166
-    private static function parse_timezone_offset($timezone_offset)
167
-    {
168
-        $first_char = substr((string)$timezone_offset, 0, 1);
169
-        if ($first_char === '+' || $first_char === '-') {
170
-            $offset_sign = $first_char;
171
-            $offset_secs = substr((string)$timezone_offset, 1);
172
-        } else {
173
-            $offset_sign = '+';
174
-            $offset_secs = $timezone_offset;
175
-        }
176
-        return array($offset_sign, $offset_secs);
177
-    }
178
-
179
-
180
-
181
-    /**
182
-     * Prepares a field's value for display in the API
183
-     *
184
-     * @param \EE_Model_Field_Base $field_obj
185
-     * @param mixed                $original_value
186
-     * @param string               $requested_version
187
-     * @return mixed
188
-     */
189
-    public static function prepare_field_value_for_json($field_obj, $original_value, $requested_version)
190
-    {
191
-        if ($original_value === EE_INF) {
192
-            $new_value = Model_Data_Translator::ee_inf_in_rest;
193
-        } elseif ($field_obj instanceof \EE_Datetime_Field) {
194
-            if ($original_value instanceof \DateTime) {
195
-                $new_value = $original_value->format('Y-m-d H:i:s');
196
-            } elseif (is_int($original_value)) {
197
-                $new_value = date('Y-m-d H:i:s', $original_value);
198
-            } else {
199
-                $new_value = $original_value;
200
-            }
201
-            $new_value = mysql_to_rfc3339($new_value);
202
-        } else {
203
-            $new_value = $original_value;
204
-        }
205
-        return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api',
206
-            $new_value,
207
-            $field_obj,
208
-            $original_value,
209
-            $requested_version
210
-        );
211
-    }
212
-
213
-
214
-
215
-    /**
216
-     * Prepares condition-query-parameters (like what's in where and having) from
217
-     * the format expected in the API to use in the models
218
-     *
219
-     * @param array     $inputted_query_params_of_this_type
220
-     * @param \EEM_Base $model
221
-     * @param string    $requested_version
222
-     * @return array
223
-     * @throws \DomainException
224
-     * @throws \EE_Error
225
-     */
226
-    public static function prepare_conditions_query_params_for_models(
227
-        $inputted_query_params_of_this_type,
228
-        \EEM_Base $model,
229
-        $requested_version
230
-    ) {
231
-        $query_param_for_models = array();
232
-        foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) {
233
-            $query_param_sans_stars = Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key);
234
-            $field = Model_Data_Translator::deduce_field_from_query_param(
235
-                $query_param_sans_stars,
236
-                $model
237
-            );
238
-            //double-check is it a *_gmt field?
239
-            if ( ! $field instanceof \EE_Model_Field_Base
240
-                 && Model_Data_Translator::is_gmt_date_field_name($query_param_sans_stars)
241
-            ) {
242
-                //yep, take off '_gmt', and find the field
243
-                $query_param_key = Model_Data_Translator::remove_gmt_from_field_name($query_param_sans_stars);
244
-                $field = Model_Data_Translator::deduce_field_from_query_param(
245
-                    $query_param_key,
246
-                    $model
247
-                );
248
-                $timezone = 'UTC';
249
-            } else {
250
-                //so it's not a GMT field. Set the timezone on the model to the default
251
-                $timezone = \EEH_DTT_Helper::get_valid_timezone_string();
252
-            }
253
-            if ($field instanceof \EE_Model_Field_Base) {
254
-                //did they specify an operator?
255
-                if (is_array($query_param_value)) {
256
-                    $op = $query_param_value[0];
257
-                    $translated_value = array($op);
258
-                    if (isset($query_param_value[1])) {
259
-                        $value = $query_param_value[1];
260
-                        $translated_value[1] = Model_Data_Translator::prepare_field_values_from_json($field, $value,
261
-                            $requested_version, $timezone);
262
-                    }
263
-                } else {
264
-                    $translated_value = Model_Data_Translator::prepare_field_value_from_json($field, $query_param_value,
265
-                        $requested_version, $timezone);
266
-                }
267
-                $query_param_for_models[$query_param_key] = $translated_value;
268
-            } else {
269
-                //so it's not for a field, assume it's a logic query param key
270
-                $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_models($query_param_value,
271
-                    $model, $requested_version);
272
-            }
273
-        }
274
-        return $query_param_for_models;
275
-    }
276
-
277
-
278
-
279
-    /**
280
-     * Mostly checks if the last 4 characters are "_gmt", indicating its a
281
-     * gmt date field name
282
-     *
283
-     * @param string $field_name
284
-     * @return boolean
285
-     */
286
-    public static function is_gmt_date_field_name($field_name)
287
-    {
288
-        return substr(
289
-                   Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($field_name),
290
-                   -4,
291
-                   4
292
-               ) === '_gmt';
293
-    }
294
-
295
-
296
-
297
-    /**
298
-     * Removes the last "_gmt" part of a field name (and if there is no "_gmt" at the end, leave it alone)
299
-     *
300
-     * @param string $field_name
301
-     * @return string
302
-     */
303
-    public static function remove_gmt_from_field_name($field_name)
304
-    {
305
-        if ( ! Model_Data_Translator::is_gmt_date_field_name($field_name)) {
306
-            return $field_name;
307
-        }
308
-        $query_param_sans_stars = Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($field_name);
309
-        $query_param_sans_gmt_and_sans_stars = substr(
310
-            $query_param_sans_stars,
311
-            0,
312
-            strrpos(
313
-                $field_name,
314
-                '_gmt'
315
-            )
316
-        );
317
-        return str_replace($query_param_sans_stars, $query_param_sans_gmt_and_sans_stars, $field_name);
318
-    }
319
-
320
-
321
-
322
-    /**
323
-     * Takes a field name from the REST API and prepares it for the model querying
324
-     *
325
-     * @param string $field_name
326
-     * @return string
327
-     */
328
-    public static function prepare_field_name_from_json($field_name)
329
-    {
330
-        if (Model_Data_Translator::is_gmt_date_field_name($field_name)) {
331
-            return Model_Data_Translator::remove_gmt_from_field_name($field_name);
332
-        }
333
-        return $field_name;
334
-    }
335
-
336
-
337
-
338
-    /**
339
-     * Takes array of field names from REST API and prepares for models
340
-     *
341
-     * @param array $field_names
342
-     * @return array of field names (possibly include model prefixes)
343
-     */
344
-    public static function prepare_field_names_from_json(array $field_names)
345
-    {
346
-        $new_array = array();
347
-        foreach ($field_names as $key => $field_name) {
348
-            $new_array[$key] = Model_Data_Translator::prepare_field_name_from_json($field_name);
349
-        }
350
-        return $new_array;
351
-    }
352
-
353
-
354
-
355
-    /**
356
-     * Takes array where array keys are field names (possibly with model path prefixes)
357
-     * from the REST API and prepares them for model querying
358
-     *
359
-     * @param array $field_names_as_keys
360
-     * @return array
361
-     */
362
-    public static function prepare_field_names_in_array_keys_from_json(array $field_names_as_keys)
363
-    {
364
-        $new_array = array();
365
-        foreach ($field_names_as_keys as $field_name => $value) {
366
-            $new_array[Model_Data_Translator::prepare_field_name_from_json($field_name)] = $value;
367
-        }
368
-        return $new_array;
369
-    }
370
-
371
-
372
-
373
-    /**
374
-     * Prepares an array of model query params for use in the REST API
375
-     *
376
-     * @param array     $model_query_params
377
-     * @param \EEM_Base $model
378
-     * @param string    $requested_version eg "4.8.36". If null is provided, defaults to the latest release of the EE4
379
-     *                                     REST API
380
-     * @return array which can be passed into the EE4 REST API when querying a model resource
381
-     * @throws \EE_Error
382
-     */
383
-    public static function prepare_query_params_for_rest_api(
384
-        array $model_query_params,
385
-        \EEM_Base $model,
386
-        $requested_version = null
387
-    ) {
388
-        if ($requested_version === null) {
389
-            $requested_version = \EED_Core_Rest_Api::latest_rest_api_version();
390
-        }
391
-        $rest_query_params = $model_query_params;
392
-        if (isset($model_query_params[0])) {
393
-            $rest_query_params['where'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api(
394
-                $model_query_params[0],
395
-                $model,
396
-                $requested_version
397
-            );
398
-            unset($rest_query_params[0]);
399
-        }
400
-        if (isset($model_query_params['having'])) {
401
-            $rest_query_params['having'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api(
402
-                $model_query_params['having'],
403
-                $model,
404
-                $requested_version
405
-            );
406
-        }
407
-        return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api',
408
-            $rest_query_params, $model_query_params, $model, $requested_version);
409
-    }
410
-
411
-
412
-
413
-    /**
414
-     * Prepares all the sub-conditions query parameters (eg having or where conditions) for use in the rest api
415
-     *
416
-     * @param array     $inputted_query_params_of_this_type eg like the "where" or "having" conditions query params
417
-     *                                                      passed into EEM_Base::get_all()
418
-     * @param \EEM_Base $model
419
-     * @param string    $requested_version                  eg "4.8.36"
420
-     * @return array ready for use in the rest api query params
421
-     * @throws \EE_Error
422
-     */
423
-    public static function prepare_conditions_query_params_for_rest_api(
424
-        $inputted_query_params_of_this_type,
425
-        \EEM_Base $model,
426
-        $requested_version
427
-    ) {
428
-        $query_param_for_models = array();
429
-        foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) {
430
-            $field = Model_Data_Translator::deduce_field_from_query_param(
431
-                Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key),
432
-                $model
433
-            );
434
-            if ($field instanceof \EE_Model_Field_Base) {
435
-                //did they specify an operator?
436
-                if (is_array($query_param_value)) {
437
-                    $op = $query_param_value[0];
438
-                    $translated_value = array($op);
439
-                    if (isset($query_param_value[1])) {
440
-                        $value = $query_param_value[1];
441
-                        $translated_value[1] = Model_Data_Translator::prepare_field_values_for_json($field, $value,
442
-                            $requested_version);
443
-                    }
444
-                } else {
445
-                    $translated_value = Model_Data_Translator::prepare_field_value_for_json($field, $query_param_value,
446
-                        $requested_version);
447
-                }
448
-                $query_param_for_models[$query_param_key] = $translated_value;
449
-            } else {
450
-                //so it's not for a field, assume it's a logic query param key
451
-                $query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api($query_param_value,
452
-                    $model, $requested_version);
453
-            }
454
-        }
455
-        return $query_param_for_models;
456
-    }
457
-
458
-
459
-
460
-    /**
461
-     * @param $condition_query_param_key
462
-     * @return string
463
-     */
464
-    public static function remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key)
465
-    {
466
-        $pos_of_star = strpos($condition_query_param_key, '*');
467
-        if ($pos_of_star === false) {
468
-            return $condition_query_param_key;
469
-        } else {
470
-            $condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star);
471
-            return $condition_query_param_sans_star;
472
-        }
473
-    }
474
-
475
-
476
-
477
-    /**
478
-     * Takes the input parameter and finds the model field that it indicates.
479
-     *
480
-     * @param string    $query_param_name like Registration.Transaction.TXN_ID, Event.Datetime.start_time, or REG_ID
481
-     * @param \EEM_Base $model
482
-     * @return \EE_Model_Field_Base
483
-     * @throws \EE_Error
484
-     */
485
-    public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model)
486
-    {
487
-        //ok, now proceed with deducing which part is the model's name, and which is the field's name
488
-        //which will help us find the database table and column
489
-        $query_param_parts = explode('.', $query_param_name);
490
-        if (empty($query_param_parts)) {
491
-            throw new \EE_Error(sprintf(__('_extract_column_name is empty when trying to extract column and table name from %s',
492
-                'event_espresso'), $query_param_name));
493
-        }
494
-        $number_of_parts = count($query_param_parts);
495
-        $last_query_param_part = $query_param_parts[count($query_param_parts) - 1];
496
-        if ($number_of_parts === 1) {
497
-            $field_name = $last_query_param_part;
498
-        } else {// $number_of_parts >= 2
499
-            //the last part is the column name, and there are only 2parts. therefore...
500
-            $field_name = $last_query_param_part;
501
-            $model = \EE_Registry::instance()->load_model($query_param_parts[$number_of_parts - 2]);
502
-        }
503
-        try {
504
-            return $model->field_settings_for($field_name);
505
-        } catch (\EE_Error $e) {
506
-            return null;
507
-        }
508
-    }
29
+	/**
30
+	 * We used to use -1 for infinity in the rest api, but that's ambiguous for
31
+	 * fields that COULD contain -1; so we use null
32
+	 */
33
+	const ee_inf_in_rest = null;
34
+
35
+
36
+
37
+	/**
38
+	 * Prepares a possible array of input values from JSON for use by the models
39
+	 *
40
+	 * @param \EE_Model_Field_Base $field_obj
41
+	 * @param mixed                $original_value_maybe_array
42
+	 * @param string               $requested_version
43
+	 * @param string               $timezone_string treat values as being in this timezone
44
+	 * @return mixed
45
+	 * @throws \DomainException
46
+	 */
47
+	public static function prepare_field_values_from_json(
48
+		$field_obj,
49
+		$original_value_maybe_array,
50
+		$requested_version,
51
+		$timezone_string = 'UTC'
52
+	) {
53
+		if (is_array($original_value_maybe_array)) {
54
+			$new_value_maybe_array = array();
55
+			foreach ($original_value_maybe_array as $array_key => $array_item) {
56
+				$new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_from_json(
57
+					$field_obj,
58
+					$array_item,
59
+					$requested_version,
60
+					$timezone_string
61
+				);
62
+			}
63
+		} else {
64
+			$new_value_maybe_array = Model_Data_Translator::prepare_field_value_from_json(
65
+				$field_obj,
66
+				$original_value_maybe_array,
67
+				$requested_version,
68
+				$timezone_string
69
+			);
70
+		}
71
+		return $new_value_maybe_array;
72
+	}
73
+
74
+
75
+
76
+	/**
77
+	 * Prepares an array of field values FOR use in JSON/REST API
78
+	 *
79
+	 * @param \EE_Model_Field_Base $field_obj
80
+	 * @param mixed                $original_value_maybe_array
81
+	 * @param string               $request_version (eg 4.8.36)
82
+	 * @return array
83
+	 */
84
+	public static function prepare_field_values_for_json($field_obj, $original_value_maybe_array, $request_version)
85
+	{
86
+		if (is_array($original_value_maybe_array)) {
87
+			$new_value_maybe_array = array();
88
+			foreach ($original_value_maybe_array as $array_key => $array_item) {
89
+				$new_value_maybe_array[$array_key] = Model_Data_Translator::prepare_field_value_for_json(
90
+					$field_obj,
91
+					$array_item,
92
+					$request_version
93
+				);
94
+			}
95
+		} else {
96
+			$new_value_maybe_array = Model_Data_Translator::prepare_field_value_for_json(
97
+				$field_obj,
98
+				$original_value_maybe_array,
99
+				$request_version
100
+			);
101
+		}
102
+		return $new_value_maybe_array;
103
+	}
104
+
105
+
106
+
107
+	/**
108
+	 * Prepares incoming data from the json or $_REQUEST parameters for the models'
109
+	 * "$query_params".
110
+	 *
111
+	 * @param \EE_Model_Field_Base $field_obj
112
+	 * @param mixed                $original_value
113
+	 * @param string               $requested_version
114
+	 * @param string               $timezone_string treat values as being in this timezone
115
+	 * @return mixed
116
+	 * @throws \DomainException
117
+	 */
118
+	public static function prepare_field_value_from_json(
119
+		$field_obj,
120
+		$original_value,
121
+		$requested_version,
122
+		$timezone_string = 'UTC' // UTC
123
+	)
124
+	{
125
+		$timezone_string = $timezone_string !== '' ? $timezone_string : get_option('timezone_string', '');
126
+		$new_value = null;
127
+		if ($field_obj instanceof \EE_Infinite_Integer_Field
128
+			&& in_array($original_value, array(null, ''), true)
129
+		) {
130
+			$new_value = EE_INF;
131
+		} elseif ($field_obj instanceof \EE_Datetime_Field) {
132
+			list($offset_sign, $offset_secs) = Model_Data_Translator::parse_timezone_offset(
133
+				$field_obj->get_timezone_offset(
134
+					new \DateTimeZone($timezone_string)
135
+				)
136
+			);
137
+			$offset_string =
138
+				str_pad(
139
+					floor($offset_secs / HOUR_IN_SECONDS),
140
+					2,
141
+					'0',
142
+					STR_PAD_LEFT
143
+				)
144
+				. ':'
145
+				. str_pad(
146
+					($offset_secs % HOUR_IN_SECONDS) / MINUTE_IN_SECONDS,
147
+					2,
148
+					'0',
149
+					STR_PAD_LEFT
150
+				);
151
+			$new_value = rest_parse_date($original_value . $offset_sign . $offset_string);
152
+		} else {
153
+			$new_value = $original_value;
154
+		}
155
+		return $new_value;
156
+	}
157
+
158
+
159
+
160
+	/**
161
+	 * determines what's going on with them timezone strings
162
+	 *
163
+	 * @param int $timezone_offset
164
+	 * @return array
165
+	 */
166
+	private static function parse_timezone_offset($timezone_offset)
167
+	{
168
+		$first_char = substr((string)$timezone_offset, 0, 1);
169
+		if ($first_char === '+' || $first_char === '-') {
170
+			$offset_sign = $first_char;
171
+			$offset_secs = substr((string)$timezone_offset, 1);
172
+		} else {
173
+			$offset_sign = '+';
174
+			$offset_secs = $timezone_offset;
175
+		}
176
+		return array($offset_sign, $offset_secs);
177
+	}
178
+
179
+
180
+
181
+	/**
182
+	 * Prepares a field's value for display in the API
183
+	 *
184
+	 * @param \EE_Model_Field_Base $field_obj
185
+	 * @param mixed                $original_value
186
+	 * @param string               $requested_version
187
+	 * @return mixed
188
+	 */
189
+	public static function prepare_field_value_for_json($field_obj, $original_value, $requested_version)
190
+	{
191
+		if ($original_value === EE_INF) {
192
+			$new_value = Model_Data_Translator::ee_inf_in_rest;
193
+		} elseif ($field_obj instanceof \EE_Datetime_Field) {
194
+			if ($original_value instanceof \DateTime) {
195
+				$new_value = $original_value->format('Y-m-d H:i:s');
196
+			} elseif (is_int($original_value)) {
197
+				$new_value = date('Y-m-d H:i:s', $original_value);
198
+			} else {
199
+				$new_value = $original_value;
200
+			}
201
+			$new_value = mysql_to_rfc3339($new_value);
202
+		} else {
203
+			$new_value = $original_value;
204
+		}
205
+		return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api',
206
+			$new_value,
207
+			$field_obj,
208
+			$original_value,
209
+			$requested_version
210
+		);
211
+	}
212
+
213
+
214
+
215
+	/**
216
+	 * Prepares condition-query-parameters (like what's in where and having) from
217
+	 * the format expected in the API to use in the models
218
+	 *
219
+	 * @param array     $inputted_query_params_of_this_type
220
+	 * @param \EEM_Base $model
221
+	 * @param string    $requested_version
222
+	 * @return array
223
+	 * @throws \DomainException
224
+	 * @throws \EE_Error
225
+	 */
226
+	public static function prepare_conditions_query_params_for_models(
227
+		$inputted_query_params_of_this_type,
228
+		\EEM_Base $model,
229
+		$requested_version
230
+	) {
231
+		$query_param_for_models = array();
232
+		foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) {
233
+			$query_param_sans_stars = Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key);
234
+			$field = Model_Data_Translator::deduce_field_from_query_param(
235
+				$query_param_sans_stars,
236
+				$model
237
+			);
238
+			//double-check is it a *_gmt field?
239
+			if ( ! $field instanceof \EE_Model_Field_Base
240
+				 && Model_Data_Translator::is_gmt_date_field_name($query_param_sans_stars)
241
+			) {
242
+				//yep, take off '_gmt', and find the field
243
+				$query_param_key = Model_Data_Translator::remove_gmt_from_field_name($query_param_sans_stars);
244
+				$field = Model_Data_Translator::deduce_field_from_query_param(
245
+					$query_param_key,
246
+					$model
247
+				);
248
+				$timezone = 'UTC';
249
+			} else {
250
+				//so it's not a GMT field. Set the timezone on the model to the default
251
+				$timezone = \EEH_DTT_Helper::get_valid_timezone_string();
252
+			}
253
+			if ($field instanceof \EE_Model_Field_Base) {
254
+				//did they specify an operator?
255
+				if (is_array($query_param_value)) {
256
+					$op = $query_param_value[0];
257
+					$translated_value = array($op);
258
+					if (isset($query_param_value[1])) {
259
+						$value = $query_param_value[1];
260
+						$translated_value[1] = Model_Data_Translator::prepare_field_values_from_json($field, $value,
261
+							$requested_version, $timezone);
262
+					}
263
+				} else {
264
+					$translated_value = Model_Data_Translator::prepare_field_value_from_json($field, $query_param_value,
265
+						$requested_version, $timezone);
266
+				}
267
+				$query_param_for_models[$query_param_key] = $translated_value;
268
+			} else {
269
+				//so it's not for a field, assume it's a logic query param key
270
+				$query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_models($query_param_value,
271
+					$model, $requested_version);
272
+			}
273
+		}
274
+		return $query_param_for_models;
275
+	}
276
+
277
+
278
+
279
+	/**
280
+	 * Mostly checks if the last 4 characters are "_gmt", indicating its a
281
+	 * gmt date field name
282
+	 *
283
+	 * @param string $field_name
284
+	 * @return boolean
285
+	 */
286
+	public static function is_gmt_date_field_name($field_name)
287
+	{
288
+		return substr(
289
+				   Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($field_name),
290
+				   -4,
291
+				   4
292
+			   ) === '_gmt';
293
+	}
294
+
295
+
296
+
297
+	/**
298
+	 * Removes the last "_gmt" part of a field name (and if there is no "_gmt" at the end, leave it alone)
299
+	 *
300
+	 * @param string $field_name
301
+	 * @return string
302
+	 */
303
+	public static function remove_gmt_from_field_name($field_name)
304
+	{
305
+		if ( ! Model_Data_Translator::is_gmt_date_field_name($field_name)) {
306
+			return $field_name;
307
+		}
308
+		$query_param_sans_stars = Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($field_name);
309
+		$query_param_sans_gmt_and_sans_stars = substr(
310
+			$query_param_sans_stars,
311
+			0,
312
+			strrpos(
313
+				$field_name,
314
+				'_gmt'
315
+			)
316
+		);
317
+		return str_replace($query_param_sans_stars, $query_param_sans_gmt_and_sans_stars, $field_name);
318
+	}
319
+
320
+
321
+
322
+	/**
323
+	 * Takes a field name from the REST API and prepares it for the model querying
324
+	 *
325
+	 * @param string $field_name
326
+	 * @return string
327
+	 */
328
+	public static function prepare_field_name_from_json($field_name)
329
+	{
330
+		if (Model_Data_Translator::is_gmt_date_field_name($field_name)) {
331
+			return Model_Data_Translator::remove_gmt_from_field_name($field_name);
332
+		}
333
+		return $field_name;
334
+	}
335
+
336
+
337
+
338
+	/**
339
+	 * Takes array of field names from REST API and prepares for models
340
+	 *
341
+	 * @param array $field_names
342
+	 * @return array of field names (possibly include model prefixes)
343
+	 */
344
+	public static function prepare_field_names_from_json(array $field_names)
345
+	{
346
+		$new_array = array();
347
+		foreach ($field_names as $key => $field_name) {
348
+			$new_array[$key] = Model_Data_Translator::prepare_field_name_from_json($field_name);
349
+		}
350
+		return $new_array;
351
+	}
352
+
353
+
354
+
355
+	/**
356
+	 * Takes array where array keys are field names (possibly with model path prefixes)
357
+	 * from the REST API and prepares them for model querying
358
+	 *
359
+	 * @param array $field_names_as_keys
360
+	 * @return array
361
+	 */
362
+	public static function prepare_field_names_in_array_keys_from_json(array $field_names_as_keys)
363
+	{
364
+		$new_array = array();
365
+		foreach ($field_names_as_keys as $field_name => $value) {
366
+			$new_array[Model_Data_Translator::prepare_field_name_from_json($field_name)] = $value;
367
+		}
368
+		return $new_array;
369
+	}
370
+
371
+
372
+
373
+	/**
374
+	 * Prepares an array of model query params for use in the REST API
375
+	 *
376
+	 * @param array     $model_query_params
377
+	 * @param \EEM_Base $model
378
+	 * @param string    $requested_version eg "4.8.36". If null is provided, defaults to the latest release of the EE4
379
+	 *                                     REST API
380
+	 * @return array which can be passed into the EE4 REST API when querying a model resource
381
+	 * @throws \EE_Error
382
+	 */
383
+	public static function prepare_query_params_for_rest_api(
384
+		array $model_query_params,
385
+		\EEM_Base $model,
386
+		$requested_version = null
387
+	) {
388
+		if ($requested_version === null) {
389
+			$requested_version = \EED_Core_Rest_Api::latest_rest_api_version();
390
+		}
391
+		$rest_query_params = $model_query_params;
392
+		if (isset($model_query_params[0])) {
393
+			$rest_query_params['where'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api(
394
+				$model_query_params[0],
395
+				$model,
396
+				$requested_version
397
+			);
398
+			unset($rest_query_params[0]);
399
+		}
400
+		if (isset($model_query_params['having'])) {
401
+			$rest_query_params['having'] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api(
402
+				$model_query_params['having'],
403
+				$model,
404
+				$requested_version
405
+			);
406
+		}
407
+		return apply_filters('FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_query_params_for_rest_api',
408
+			$rest_query_params, $model_query_params, $model, $requested_version);
409
+	}
410
+
411
+
412
+
413
+	/**
414
+	 * Prepares all the sub-conditions query parameters (eg having or where conditions) for use in the rest api
415
+	 *
416
+	 * @param array     $inputted_query_params_of_this_type eg like the "where" or "having" conditions query params
417
+	 *                                                      passed into EEM_Base::get_all()
418
+	 * @param \EEM_Base $model
419
+	 * @param string    $requested_version                  eg "4.8.36"
420
+	 * @return array ready for use in the rest api query params
421
+	 * @throws \EE_Error
422
+	 */
423
+	public static function prepare_conditions_query_params_for_rest_api(
424
+		$inputted_query_params_of_this_type,
425
+		\EEM_Base $model,
426
+		$requested_version
427
+	) {
428
+		$query_param_for_models = array();
429
+		foreach ($inputted_query_params_of_this_type as $query_param_key => $query_param_value) {
430
+			$field = Model_Data_Translator::deduce_field_from_query_param(
431
+				Model_Data_Translator::remove_stars_and_anything_after_from_condition_query_param_key($query_param_key),
432
+				$model
433
+			);
434
+			if ($field instanceof \EE_Model_Field_Base) {
435
+				//did they specify an operator?
436
+				if (is_array($query_param_value)) {
437
+					$op = $query_param_value[0];
438
+					$translated_value = array($op);
439
+					if (isset($query_param_value[1])) {
440
+						$value = $query_param_value[1];
441
+						$translated_value[1] = Model_Data_Translator::prepare_field_values_for_json($field, $value,
442
+							$requested_version);
443
+					}
444
+				} else {
445
+					$translated_value = Model_Data_Translator::prepare_field_value_for_json($field, $query_param_value,
446
+						$requested_version);
447
+				}
448
+				$query_param_for_models[$query_param_key] = $translated_value;
449
+			} else {
450
+				//so it's not for a field, assume it's a logic query param key
451
+				$query_param_for_models[$query_param_key] = Model_Data_Translator::prepare_conditions_query_params_for_rest_api($query_param_value,
452
+					$model, $requested_version);
453
+			}
454
+		}
455
+		return $query_param_for_models;
456
+	}
457
+
458
+
459
+
460
+	/**
461
+	 * @param $condition_query_param_key
462
+	 * @return string
463
+	 */
464
+	public static function remove_stars_and_anything_after_from_condition_query_param_key($condition_query_param_key)
465
+	{
466
+		$pos_of_star = strpos($condition_query_param_key, '*');
467
+		if ($pos_of_star === false) {
468
+			return $condition_query_param_key;
469
+		} else {
470
+			$condition_query_param_sans_star = substr($condition_query_param_key, 0, $pos_of_star);
471
+			return $condition_query_param_sans_star;
472
+		}
473
+	}
474
+
475
+
476
+
477
+	/**
478
+	 * Takes the input parameter and finds the model field that it indicates.
479
+	 *
480
+	 * @param string    $query_param_name like Registration.Transaction.TXN_ID, Event.Datetime.start_time, or REG_ID
481
+	 * @param \EEM_Base $model
482
+	 * @return \EE_Model_Field_Base
483
+	 * @throws \EE_Error
484
+	 */
485
+	public static function deduce_field_from_query_param($query_param_name, \EEM_Base $model)
486
+	{
487
+		//ok, now proceed with deducing which part is the model's name, and which is the field's name
488
+		//which will help us find the database table and column
489
+		$query_param_parts = explode('.', $query_param_name);
490
+		if (empty($query_param_parts)) {
491
+			throw new \EE_Error(sprintf(__('_extract_column_name is empty when trying to extract column and table name from %s',
492
+				'event_espresso'), $query_param_name));
493
+		}
494
+		$number_of_parts = count($query_param_parts);
495
+		$last_query_param_part = $query_param_parts[count($query_param_parts) - 1];
496
+		if ($number_of_parts === 1) {
497
+			$field_name = $last_query_param_part;
498
+		} else {// $number_of_parts >= 2
499
+			//the last part is the column name, and there are only 2parts. therefore...
500
+			$field_name = $last_query_param_part;
501
+			$model = \EE_Registry::instance()->load_model($query_param_parts[$number_of_parts - 2]);
502
+		}
503
+		try {
504
+			return $model->field_settings_for($field_name);
505
+		} catch (\EE_Error $e) {
506
+			return null;
507
+		}
508
+	}
509 509
 
510 510
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                     '0',
149 149
                     STR_PAD_LEFT
150 150
                 );
151
-            $new_value = rest_parse_date($original_value . $offset_sign . $offset_string);
151
+            $new_value = rest_parse_date($original_value.$offset_sign.$offset_string);
152 152
         } else {
153 153
             $new_value = $original_value;
154 154
         }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private static function parse_timezone_offset($timezone_offset)
167 167
     {
168
-        $first_char = substr((string)$timezone_offset, 0, 1);
168
+        $first_char = substr((string) $timezone_offset, 0, 1);
169 169
         if ($first_char === '+' || $first_char === '-') {
170 170
             $offset_sign = $first_char;
171
-            $offset_secs = substr((string)$timezone_offset, 1);
171
+            $offset_secs = substr((string) $timezone_offset, 1);
172 172
         } else {
173 173
             $offset_sign = '+';
174 174
             $offset_secs = $timezone_offset;
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 
168 168
 
169 169
 	/**
170
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
171
-	*
172
-	* @access public
173
-	* @return void
174
-	*/
170
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
171
+	 *
172
+	 * @access public
173
+	 * @return void
174
+	 */
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177 177
 		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 
457 457
 
458 458
 	/**
459
-	* admin_init
460
-	*
461
-	* @access public
462
-	* @return void
463
-	*/
459
+	 * admin_init
460
+	 *
461
+	 * @access public
462
+	 * @return void
463
+	 */
464 464
 	public function admin_init() {
465 465
 
466 466
 		/**
@@ -612,24 +612,24 @@  discard block
 block discarded – undo
612 612
 
613 613
 
614 614
 	/**
615
-	* 	dismiss_persistent_admin_notice
616
-	*
617
-	*	@access 	public
618
-	* 	@return 		void
619
-	*/
615
+	 * 	dismiss_persistent_admin_notice
616
+	 *
617
+	 *	@access 	public
618
+	 * 	@return 		void
619
+	 */
620 620
 	public function dismiss_ee_nag_notice_callback() {
621 621
 		EE_Error::dismiss_persistent_admin_notice();
622 622
 	}
623 623
 
624 624
 
625 625
 
626
-    /**
627
-     * @param array $elements
628
-     * @return array
629
-     * @throws \EE_Error
630
-     */
626
+	/**
627
+	 * @param array $elements
628
+	 * @return array
629
+	 * @throws \EE_Error
630
+	 */
631 631
 	public function dashboard_glance_items($elements) {
632
-        $elements = is_array($elements) ? $elements : array($elements);
632
+		$elements = is_array($elements) ? $elements : array($elements);
633 633
 		$events = EEM_Event::instance()->count();
634 634
 		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
635 635
 		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
Please login to merge, or discard this patch.
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public static function instance() {
42 42
 		// check if class object is instantiated
43
-		if (  ! self::$_instance instanceof EE_Admin ) {
43
+		if ( ! self::$_instance instanceof EE_Admin) {
44 44
 			self::$_instance = new self();
45 45
 		}
46 46
 		return self::$_instance;
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 		// define global EE_Admin constants
58 58
 		$this->_define_all_constants();
59 59
 		// set autoloaders for our admin page classes based on included path information
60
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
60
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
61 61
 		// admin hooks
62
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
62
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
63 63
 		// load EE_Request_Handler early
64
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
65
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
64
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
65
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
66 66
 		// post shortcode tracking
67 67
 		add_action(
68 68
 			'AHEE__EE_System__initialize_last',
69
-			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' )
69
+			array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin')
70 70
 		);
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin === $main_file ) {
122
+		 if ($plugin === $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -174,31 +174,31 @@  discard block
 block discarded – undo
174 174
 	*/
175 175
 	public function init() {
176 176
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
177
-		if ( EE_Maintenance_Mode::instance()->models_can_query() ){
177
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
178 178
 			//ok so we want to enable the entire admin
179
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
180
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
179
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
180
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
181
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
182 182
 			//at a glance dashboard widget
183
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 );
183
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
184 184
 			//filter for get_edit_post_link used on comments for custom post types
185
-			add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 );
185
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2);
186 186
 		}
187 187
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
188
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
188
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
189 189
 			try {
190 190
 				//this loads the controller for the admin pages which will setup routing etc
191
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
192
-			} catch ( EE_Error $e ) {
191
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
192
+			} catch (EE_Error $e) {
193 193
 				$e->get_error();
194 194
 			}
195 195
 		}
196
-		add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
196
+		add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
197 197
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
198
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
199
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
198
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
199
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
200 200
 		//exclude EE critical pages from all nav menus and wp_list_pages
201
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
201
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
202 202
 	}
203 203
 
204 204
 
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @param  object $post_type WP post type object
212 212
 	 * @return object            WP post type object
213 213
 	 */
214
-	public function remove_pages_from_nav_menu( $post_type ) {
214
+	public function remove_pages_from_nav_menu($post_type) {
215 215
 		//if this isn't the "pages" post type let's get out
216
-		if ( $post_type->name !== 'page' ) {
216
+		if ($post_type->name !== 'page') {
217 217
 			return $post_type;
218 218
 		}
219 219
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function enable_hidden_ee_nav_menu_metaboxes() {
235 235
 		global $wp_meta_boxes, $pagenow;
236
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
236
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
237 237
 			return;
238 238
 		}
239 239
 		$user = wp_get_current_user();
240 240
 		//has this been done yet?
241
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
241
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
242 242
 			return;
243 243
 		}
244 244
 
245
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
246
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
245
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
246
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
247 247
 
248
-		if ( is_array( $hidden_meta_boxes ) ) {
249
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
250
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
251
-					unset( $hidden_meta_boxes[ $key ] );
248
+		if (is_array($hidden_meta_boxes)) {
249
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
250
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
251
+					unset($hidden_meta_boxes[$key]);
252 252
 				}
253 253
 			}
254 254
 		}
255 255
 
256
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
257
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
256
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
257
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
258 258
 	}
259 259
 
260 260
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return void
274 274
 	 */
275 275
 	public function register_custom_nav_menu_boxes() {
276
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
276
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
277 277
 	}
278 278
 
279 279
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string  the (maybe) modified link
291 291
 	 */
292
-	public function modify_edit_post_link( $link, $id ) {
293
-		if ( ! $post = get_post( $id ) ){
292
+	public function modify_edit_post_link($link, $id) {
293
+		if ( ! $post = get_post($id)) {
294 294
 			return $link;
295 295
 		}
296
-		if ( $post->post_type === 'espresso_attendees' ) {
296
+		if ($post->post_type === 'espresso_attendees') {
297 297
 			$query_args = array(
298 298
 				'action' => 'edit_attendee',
299 299
 				'post' => $id
300 300
 			);
301
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
301
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
302 302
 		}
303 303
 		return $link;
304 304
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		global $nav_menu_selected_id;
311 311
 
312 312
 		$db_fields = false;
313
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
313
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
314 314
 		$current_tab = 'event-archives';
315 315
 
316 316
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 		?>
330 330
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
331 331
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
332
-				<li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>>
333
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
334
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
332
+				<li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>>
333
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
334
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
335 335
 					</a>
336 336
 				</li>
337 337
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
  			<?php */ ?>
350 350
 
351 351
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
352
-			echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
352
+			echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
353 353
 			?>">
354 354
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
355 355
 					<?php
356 356
 					$pages = $this->_get_extra_nav_menu_pages_items();
357 357
 					$args['walker'] = $walker;
358
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
358
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
359 359
 					?>
360 360
 				</ul>
361 361
 			</div><!-- /.tabs-panel -->
@@ -363,18 +363,18 @@  discard block
 block discarded – undo
363 363
 			<p class="button-controls">
364 364
 				<span class="list-controls">
365 365
 					<a href="<?php
366
-						echo esc_url( add_query_arg(
366
+						echo esc_url(add_query_arg(
367 367
 							array(
368 368
 								'extra-nav-menu-pages-tab' => 'event-archives',
369 369
 								'selectall' => 1,
370 370
 							),
371
-							remove_query_arg( $removed_args )
371
+							remove_query_arg($removed_args)
372 372
 						));
373 373
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
374 374
 				</span>
375 375
 
376 376
 				<span class="add-to-menu">
377
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
377
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
378 378
 					<span class="spinner"></span>
379 379
 				</span>
380 380
 			</p>
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 	private function _get_extra_nav_menu_pages_items() {
396 396
 		$menuitems[] = array(
397 397
 			'title' => __('Event List', 'event_espresso'),
398
-			'url' => get_post_type_archive_link( 'espresso_events' ),
398
+			'url' => get_post_type_archive_link('espresso_events'),
399 399
 			'description' => __('Archive page for all events.', 'event_espresso')
400 400
 		);
401
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
401
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
402 402
 	}
403 403
 
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @param $menu_item_values
411 411
 	 * @return stdClass
412 412
 	 */
413
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
413
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
414 414
 		$menu_item = new stdClass();
415 415
 		$keys = array(
416 416
 			'ID' => 0,
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			'xfn' => ''
431 431
 		);
432 432
 
433
-		foreach ( $keys as $key => $value) {
434
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
433
+		foreach ($keys as $key => $value) {
434
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
435 435
 		}
436 436
 		return $menu_item;
437 437
 	}
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 		 * - check if doing post processing of one of EE CPTs
471 471
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
472 472
 		 */
473
-		if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) {
474
-			EE_Registry::instance()->load_core( 'Register_CPTs' );
475
-			EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
473
+		if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
474
+			EE_Registry::instance()->load_core('Register_CPTs');
475
+			EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
476 476
 		}
477 477
 
478 478
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
482 482
 		 */
483 483
 		global $pagenow;
484
-		if ( $pagenow === 'options-reading.php' ) {
485
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
484
+		if ($pagenow === 'options-reading.php') {
485
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
486 486
 		}
487 487
 
488 488
 	}
@@ -494,25 +494,25 @@  discard block
 block discarded – undo
494 494
 	 * @param string $output  Current output.
495 495
 	 * @return string
496 496
 	 */
497
-	public function modify_dropdown_pages( $output ) {
497
+	public function modify_dropdown_pages($output) {
498 498
 		//get critical pages
499 499
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
500 500
 
501 501
 		//split current output by line break for easier parsing.
502
-		$split_output = explode( "\n", $output );
502
+		$split_output = explode("\n", $output);
503 503
 
504 504
 		//loop through to remove any critical pages from the array.
505
-		foreach ( $critical_pages as $page_id ) {
506
-			$needle = 'value="' . $page_id . '"';
507
-			foreach( $split_output as $key => $haystack ) {
508
-				if( strpos( $haystack, $needle ) !== false ) {
509
-					unset( $split_output[$key] );
505
+		foreach ($critical_pages as $page_id) {
506
+			$needle = 'value="'.$page_id.'"';
507
+			foreach ($split_output as $key => $haystack) {
508
+				if (strpos($haystack, $needle) !== false) {
509
+					unset($split_output[$key]);
510 510
 				}
511 511
 			}
512 512
 		}
513 513
 
514 514
 		//replace output with the new contents
515
-		return implode( "\n", $split_output );
515
+		return implode("\n", $split_output);
516 516
 	}
517 517
 
518 518
 
@@ -526,36 +526,36 @@  discard block
 block discarded – undo
526 526
 	public function enqueue_admin_scripts() {
527 527
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
528 528
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
529
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
529
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
530 530
 		// register cookie script for future dependencies
531
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
531
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
532 532
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
533
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
533
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
534 534
 			// register jQuery Validate
535
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
535
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
536 536
 		}
537 537
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
538
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
538
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
539 539
 			//joyride style
540
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
541
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
542
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
540
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
541
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
542
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
543 543
 			//joyride JS
544
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
544
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
545 545
 			// wanna go for a joyride?
546 546
 			wp_enqueue_style('ee-joyride-css');
547 547
 			wp_enqueue_script('jquery-joyride');
548 548
 		}
549 549
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
550
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
550
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
551 551
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
552 552
 		}
553 553
 		//accounting.js library
554 554
 		// @link http://josscrowcroft.github.io/accounting.js/
555
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
556
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
557
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
558
-			wp_enqueue_script( 'ee-accounting' );
555
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
556
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
557
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
558
+			wp_enqueue_script('ee-accounting');
559 559
 			// array of settings to get converted to JSON array via wp_localize_script
560 560
 			$currency_config = array(
561 561
 				'currency' => array(
@@ -602,11 +602,11 @@  discard block
 block discarded – undo
602 602
 	public function get_persistent_admin_notices() {
603 603
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
604 604
 		$args = array(
605
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
606
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
605
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
606
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
607 607
 		);
608
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
609
-		echo EE_Error::get_persistent_admin_notices( $return_url );
608
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
609
+		echo EE_Error::get_persistent_admin_notices($return_url);
610 610
 	}
611 611
 
612 612
 
@@ -631,24 +631,24 @@  discard block
 block discarded – undo
631 631
 	public function dashboard_glance_items($elements) {
632 632
         $elements = is_array($elements) ? $elements : array($elements);
633 633
 		$events = EEM_Event::instance()->count();
634
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
635
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
634
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
635
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
636 636
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
637 637
 		$registrations = EEM_Registration::instance()->count(
638 638
 			array(
639 639
 				array(
640
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
640
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
641 641
 				)
642 642
 			)
643 643
 		);
644
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
645
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
644
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
645
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
646 646
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
647 647
 
648
-		$items = (array) apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
648
+		$items = (array) apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
649 649
 
650
-		foreach ( $items as $type => $item_properties ) {
651
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
650
+		foreach ($items as $type => $item_properties) {
651
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
652 652
 		}
653 653
 		return $elements;
654 654
 	}
@@ -665,31 +665,31 @@  discard block
 block discarded – undo
665 665
 	 * @throws EE_Error
666 666
 	 * @return    string
667 667
 	 */
668
-	public function check_for_invalid_datetime_formats( $value, $option ) {
668
+	public function check_for_invalid_datetime_formats($value, $option) {
669 669
 		// check for date_format or time_format
670
-		switch ( $option ) {
670
+		switch ($option) {
671 671
 			case 'date_format' :
672
-				$date_time_format = $value . ' ' . get_option('time_format');
672
+				$date_time_format = $value.' '.get_option('time_format');
673 673
 				break;
674 674
 			case 'time_format' :
675
-				$date_time_format = get_option('date_format') . ' ' . $value;
675
+				$date_time_format = get_option('date_format').' '.$value;
676 676
 				break;
677 677
 			default :
678 678
 				$date_time_format = FALSE;
679 679
 		}
680 680
 		// do we have a date_time format to check ?
681
-		if ( $date_time_format ) {
682
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
681
+		if ($date_time_format) {
682
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
683 683
 
684
-			if ( is_array( $error_msg ) ) {
685
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
684
+			if (is_array($error_msg)) {
685
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
686 686
 
687 687
 
688
-				foreach ( $error_msg as $error ) {
689
-					$msg .= '<li>' . $error . '</li>';
688
+				foreach ($error_msg as $error) {
689
+					$msg .= '<li>'.$error.'</li>';
690 690
 				}
691 691
 
692
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
692
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
693 693
 
694 694
 				// trigger WP settings error
695 695
 				add_settings_error(
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 				);
700 700
 
701 701
 				// set format to something valid
702
-				switch ( $option ) {
702
+				switch ($option) {
703 703
 					case 'date_format' :
704 704
 						$value = 'F j, Y';
705 705
 						break;
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 	 * @param $content
722 722
 	 * @return    string
723 723
 	 */
724
-	public function its_eSpresso( $content ) {
725
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
724
+	public function its_eSpresso($content) {
725
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
726 726
 	}
727 727
 
728 728
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	 *  @return 	string
735 735
 	 */
736 736
 	public function espresso_admin_footer() {
737
-		return \EEH_Template::powered_by_event_espresso( 'aln-cntr', '', array( 'utm_content' => 'admin_footer' ));
737
+		return \EEH_Template::powered_by_event_espresso('aln-cntr', '', array('utm_content' => 'admin_footer'));
738 738
 	}
739 739
 
740 740
 
@@ -753,12 +753,12 @@  discard block
 block discarded – undo
753 753
 	 * @param array $config
754 754
 	 * @return void
755 755
 	 */
756
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
757
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
758
-		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
756
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
757
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
758
+		if (class_exists('EE_Register_Admin_Page')) {
759 759
 			$config['page_path'] = $page_path;
760 760
 		}
761
-		EE_Register_Admin_Page::register( $page_basename, $config );
761
+		EE_Register_Admin_Page::register($page_basename, $config);
762 762
 
763 763
 	}
764 764
 
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	 * @param  \WP_Post $post
772 772
 	 * @return void
773 773
 	 */
774
-	public static function parse_post_content_on_save( $post_ID, $post ) {
774
+	public static function parse_post_content_on_save($post_ID, $post) {
775 775
 		EE_Error::doing_it_wrong(
776 776
 			__METHOD__,
777 777
 			__(
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 			),
781 781
 			'4.8.41'
782 782
 		);
783
-		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post );
783
+		EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post);
784 784
 	}
785 785
 
786 786
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 	 * @param  $value
794 794
 	 * @return void
795 795
 	 */
796
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
796
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
797 797
 		EE_Error::doing_it_wrong(
798 798
 			__METHOD__,
799 799
 			__(
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 			),
803 803
 			'4.8.41'
804 804
 		);
805
-		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value );
805
+		EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value);
806 806
 	}
807 807
 
808 808
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Field_With_Model_Name.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * Returns the name of the model(s) pointed to
36 36
      *
37 37
      * @deprecated since version 4.6.7
38
-     * @return mixed string or array of strings
38
+     * @return string string or array of strings
39 39
      */
40 40
     function get_model_name_pointed_to()
41 41
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,10 +70,10 @@
 block discarded – undo
70 70
         $model_names = array();
71 71
         if (is_array($this->_model_name_pointed_to)) {
72 72
             foreach ($this->_model_name_pointed_to as $model_name) {
73
-                $model_names[] = "EE_" . $model_name;
73
+                $model_names[] = "EE_".$model_name;
74 74
             }
75 75
         } else {
76
-            $model_names = array("EE_" . $this->_model_name_pointed_to);
76
+            $model_names = array("EE_".$this->_model_name_pointed_to);
77 77
         }
78 78
         return $model_names;
79 79
     }
Please login to merge, or discard this patch.
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -8,99 +8,99 @@
 block discarded – undo
8 8
  */
9 9
 abstract class EE_Field_With_Model_Name extends EE_Model_Field_Base
10 10
 {
11
-    /**
12
-     * Usually the name of a single model. However, as in the case for custom post types,
13
-     * it can actually be an array of models
14
-     *
15
-     * @var string or array
16
-     */
17
-    protected $_model_name_pointed_to;
11
+	/**
12
+	 * Usually the name of a single model. However, as in the case for custom post types,
13
+	 * it can actually be an array of models
14
+	 *
15
+	 * @var string or array
16
+	 */
17
+	protected $_model_name_pointed_to;
18 18
 
19
-    /**
20
-     * @param string  $table_column  name fo column for field
21
-     * @param string  $nicename      should eb internationalized with __('blah','event_espresso')
22
-     * @param boolean $nullable
23
-     * @param mixed   $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul
24
-     *                               dbe a string
25
-     * @param string  $model_name    eg 'Event','Answer','Term', etc. Basically its the model class's name without the
26
-     *                               "EEM_"
27
-     */
28
-    function __construct($table_column, $nicename, $nullable, $default_value, $model_name)
29
-    {
30
-        $this->_model_name_pointed_to = $model_name;
31
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
32
-    }
19
+	/**
20
+	 * @param string  $table_column  name fo column for field
21
+	 * @param string  $nicename      should eb internationalized with __('blah','event_espresso')
22
+	 * @param boolean $nullable
23
+	 * @param mixed   $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul
24
+	 *                               dbe a string
25
+	 * @param string  $model_name    eg 'Event','Answer','Term', etc. Basically its the model class's name without the
26
+	 *                               "EEM_"
27
+	 */
28
+	function __construct($table_column, $nicename, $nullable, $default_value, $model_name)
29
+	{
30
+		$this->_model_name_pointed_to = $model_name;
31
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
32
+	}
33 33
 
34
-    /**
35
-     * Returns the name of the model(s) pointed to
36
-     *
37
-     * @deprecated since version 4.6.7
38
-     * @return mixed string or array of strings
39
-     */
40
-    function get_model_name_pointed_to()
41
-    {
42
-        EE_Error::doing_it_wrong('get_model_name_pointed_to',
43
-            __('This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array',
44
-                'event_espresso'), '4.6.7');
45
-        return $this->_model_name_pointed_to;
46
-    }
34
+	/**
35
+	 * Returns the name of the model(s) pointed to
36
+	 *
37
+	 * @deprecated since version 4.6.7
38
+	 * @return mixed string or array of strings
39
+	 */
40
+	function get_model_name_pointed_to()
41
+	{
42
+		EE_Error::doing_it_wrong('get_model_name_pointed_to',
43
+			__('This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array',
44
+				'event_espresso'), '4.6.7');
45
+		return $this->_model_name_pointed_to;
46
+	}
47 47
 
48
-    /**
49
-     * Gets the model names pointed to by this field, always as an array
50
-     * (even if there's only one)
51
-     *
52
-     * @return array of model names pointed to by this field
53
-     */
54
-    function get_model_names_pointed_to()
55
-    {
56
-        if (is_array($this->_model_name_pointed_to)) {
57
-            return $this->_model_name_pointed_to;
58
-        } else {
59
-            return array($this->_model_name_pointed_to);
60
-        }
61
-    }
48
+	/**
49
+	 * Gets the model names pointed to by this field, always as an array
50
+	 * (even if there's only one)
51
+	 *
52
+	 * @return array of model names pointed to by this field
53
+	 */
54
+	function get_model_names_pointed_to()
55
+	{
56
+		if (is_array($this->_model_name_pointed_to)) {
57
+			return $this->_model_name_pointed_to;
58
+		} else {
59
+			return array($this->_model_name_pointed_to);
60
+		}
61
+	}
62 62
 
63
-    /**
64
-     * Returns the model's classname (eg EE_Event instead of just Event)
65
-     *
66
-     * @return array
67
-     */
68
-    function get_model_class_names_pointed_to()
69
-    {
70
-        $model_names = array();
71
-        if (is_array($this->_model_name_pointed_to)) {
72
-            foreach ($this->_model_name_pointed_to as $model_name) {
73
-                $model_names[] = "EE_" . $model_name;
74
-            }
75
-        } else {
76
-            $model_names = array("EE_" . $this->_model_name_pointed_to);
77
-        }
78
-        return $model_names;
79
-    }
63
+	/**
64
+	 * Returns the model's classname (eg EE_Event instead of just Event)
65
+	 *
66
+	 * @return array
67
+	 */
68
+	function get_model_class_names_pointed_to()
69
+	{
70
+		$model_names = array();
71
+		if (is_array($this->_model_name_pointed_to)) {
72
+			foreach ($this->_model_name_pointed_to as $model_name) {
73
+				$model_names[] = "EE_" . $model_name;
74
+			}
75
+		} else {
76
+			$model_names = array("EE_" . $this->_model_name_pointed_to);
77
+		}
78
+		return $model_names;
79
+	}
80 80
 
81
-    function is_model_obj_of_type_pointed_to($model_obj_or_ID)
82
-    {
83
-        foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) {
84
-            if ($model_obj_or_ID instanceof $model_obj_classname) {
85
-                return true;
86
-            }
87
-        }
88
-        return false;
89
-    }
81
+	function is_model_obj_of_type_pointed_to($model_obj_or_ID)
82
+	{
83
+		foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) {
84
+			if ($model_obj_or_ID instanceof $model_obj_classname) {
85
+				return true;
86
+			}
87
+		}
88
+		return false;
89
+	}
90 90
 
91
-    /**
92
-     * This returns any elements used to represent this field in the json schema.
93
-     * Note: It is expected this will only return field specific elements such as "type" or "format".  Other details
94
-     * will have to be inferred from the other data injected into the object on construct (title, description etc).
95
-     *
96
-     * @link http://json-schema.org/
97
-     * @return array
98
-     */
99
-    public function get_schema()
100
-    {
101
-        return array(
102
-            'description' => $this->get_nicename(),
103
-            'type' => 'string'
104
-        );
105
-    }
91
+	/**
92
+	 * This returns any elements used to represent this field in the json schema.
93
+	 * Note: It is expected this will only return field specific elements such as "type" or "format".  Other details
94
+	 * will have to be inferred from the other data injected into the object on construct (title, description etc).
95
+	 *
96
+	 * @link http://json-schema.org/
97
+	 * @return array
98
+	 */
99
+	public function get_schema()
100
+	{
101
+		return array(
102
+			'description' => $this->get_nicename(),
103
+			'type' => 'string'
104
+		);
105
+	}
106 106
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Model_Field_Base.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
     protected $_model_name;
31 31
 
32 32
     /**
33
-     * @param      $table_column
33
+     * @param      string $table_column
34 34
      * @param      $nicename
35
-     * @param      $nullable
35
+     * @param      boolean $nullable
36 36
      * @param null $default_value
37 37
      */
38 38
     function __construct($table_column, $nicename, $nullable, $default_value = null)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     function get_qualified_column()
141 141
     {
142
-        return $this->get_table_alias() . "." . $this->get_table_column();
142
+        return $this->get_table_alias().".".$this->get_table_column();
143 143
     }
144 144
 
145 145
     /**
Please login to merge, or discard this patch.
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -20,223 +20,223 @@  discard block
 block discarded – undo
20 20
  */
21 21
 abstract class EE_Model_Field_Base
22 22
 {
23
-    var $_table_alias;
24
-    var $_table_column;
25
-    var $_name;
26
-    var $_nicename;
27
-    var $_nullable;
28
-    var $_default_value;
29
-    var $_other_config;
30
-    protected $_model_name;
31
-
32
-    /**
33
-     * @param      $table_column
34
-     * @param      $nicename
35
-     * @param      $nullable
36
-     * @param null $default_value
37
-     */
38
-    function __construct($table_column, $nicename, $nullable, $default_value = null)
39
-    {
40
-        $this->_table_column  = $table_column;
41
-        $this->_nicename      = $nicename;
42
-        $this->_nullable      = $nullable;
43
-        $this->_default_value = $default_value;
44
-    }
45
-
46
-
47
-    /**
48
-     * @param $table_alias
49
-     * @param $name
50
-     * @param $model_name
51
-     */
52
-    function _construct_finalize($table_alias, $name, $model_name)
53
-    {
54
-        $this->_table_alias = $table_alias;
55
-        $this->_name        = $name;
56
-        $this->_model_name  = $model_name;
57
-        /**
58
-         * allow for changing the defaults
59
-         */
60
-        $this->_nicename      = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___nicename',
61
-            $this->_nicename, $this);
62
-        $this->_default_value = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___default_value',
63
-            $this->_default_value, $this);
64
-    }
65
-
66
-    function get_table_alias()
67
-    {
68
-        return $this->_table_alias;
69
-    }
70
-
71
-    function get_table_column()
72
-    {
73
-        return $this->_table_column;
74
-    }
75
-
76
-    /**
77
-     * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime'
78
-     *
79
-     * @return string
80
-     */
81
-    function get_model_name()
82
-    {
83
-        return $this->_model_name;
84
-    }
85
-
86
-    /**
87
-     * @throws \EE_Error
88
-     * @return string
89
-     */
90
-    function get_name()
91
-    {
92
-        if ($this->_name) {
93
-            return $this->_name;
94
-        } else {
95
-            throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?",
96
-                "event_espresso"), get_class($this)));
97
-        }
98
-    }
99
-
100
-    function get_nicename()
101
-    {
102
-        return $this->_nicename;
103
-    }
104
-
105
-    function is_nullable()
106
-    {
107
-        return $this->_nullable;
108
-    }
109
-
110
-    /**
111
-     * returns whether this field is an auto-increment field or not. If it is, then
112
-     * on insertion it can be null. However, on updates it must be present.
113
-     *
114
-     * @return boolean
115
-     */
116
-    function is_auto_increment()
117
-    {
118
-        return false;
119
-    }
120
-
121
-    /**
122
-     * The default value in the model object's value domain. See lengthy comment about
123
-     * value domains at the top of EEM_Base
124
-     *
125
-     * @return mixed
126
-     */
127
-    function get_default_value()
128
-    {
129
-        return $this->_default_value;
130
-    }
131
-
132
-    /**
133
-     * Returns the table alias joined to the table column, however this isn't the right
134
-     * table alias if the aliased table is being joined to. In that case, you can use
135
-     * EE_Model_Parser::extract_table_alias_model_relation_chain_prefix() to find the table's current alias
136
-     * in the current query
137
-     *
138
-     * @return string
139
-     */
140
-    function get_qualified_column()
141
-    {
142
-        return $this->get_table_alias() . "." . $this->get_table_column();
143
-    }
144
-
145
-    /**
146
-     * When get() is called on a model object (eg EE_Event), before returning its value,
147
-     * call this function on it, allowing us to customize the returned value based on
148
-     * the field's type. Eg, we may want ot serialize it, strip tags, etc. By default,
149
-     * we simply return it.
150
-     *
151
-     * @param mixed $value_of_field_on_model_object
152
-     * @return mixed
153
-     */
154
-    function prepare_for_get($value_of_field_on_model_object)
155
-    {
156
-        return $value_of_field_on_model_object;
157
-    }
158
-
159
-    /**
160
-     * When inserting or updating a field on a model object, run this function on each
161
-     * value to prepare it for insertion into the db. We may want to add slashes, serialize it, etc.
162
-     * By default, we do nothing.
163
-     *
164
-     * @param mixed $value_of_field_on_model_object
165
-     * @return mixed
166
-     */
167
-    function prepare_for_use_in_db($value_of_field_on_model_object)
168
-    {
169
-        return $value_of_field_on_model_object;
170
-    }
171
-
172
-    /**
173
-     * When creating a brand-new model object, or setting a particular value for one of its fields, this function
174
-     * is called before setting it on the model object. We may want to strip slashes, unserialize the value, etc.
175
-     * By default, we do nothing.
176
-     *
177
-     * @param mixed $value_inputted_for_field_on_model_object
178
-     * @return mixed
179
-     */
180
-    function prepare_for_set($value_inputted_for_field_on_model_object)
181
-    {
182
-        return $value_inputted_for_field_on_model_object;
183
-    }
184
-
185
-
186
-    /**
187
-     * When instantiating a model object from DB results, this function is called before setting each field.
188
-     * We may want to serialize the value, etc. By default, we return the value using prepare_for_set() method as that
189
-     * is the one child classes will most often define.
190
-     *
191
-     * @param mixed $value_found_in_db_for_model_object
192
-     * @return mixed
193
-     */
194
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
195
-    {
196
-        return $this->prepare_for_set($value_found_in_db_for_model_object);
197
-    }
198
-
199
-    /**
200
-     * When echoing a field's value on a model object, this function is run to prepare the value for presentation in a
201
-     * webpage. For example, we may want to output floats with 2 decimal places by default, dates as "Monday Jan 12,
202
-     * 2013, at 3:23pm" instead of
203
-     * "8765678632", or any other modifications to how the value should be displayed, but not modified itself.
204
-     *
205
-     * @param mixed $value_on_field_to_be_outputted
206
-     * @return mixed
207
-     */
208
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted)
209
-    {
210
-        return $value_on_field_to_be_outputted;
211
-    }
212
-
213
-    /**
214
-     * Return `%d`, `%s` or `%f` to indicate the data type for the field.
215
-     * @return string
216
-     */
217
-    abstract function get_wpdb_data_type();
218
-
219
-
220
-    /**
221
-     * This returns elements used to represent this field in the json schema.
222
-     *
223
-     * @link http://json-schema.org/
224
-     * @return array
225
-     */
226
-    abstract public function get_schema();
227
-
228
-    /**
229
-     * Some fields are in the database-only, (ie, used in queries etc), but shouldn't necessarily be part
230
-     * of the model objects (ie, client code shouldn't care to ever see their value... if client code does
231
-     * want to see their value, then they shouldn't be db-only fields!)
232
-     * Eg, when doing events as custom post types, querying the post_type is essential, but
233
-     * post_type is irrelevant for EE_Event objects (because they will ALL be of post_type 'esp_event').
234
-     * By default, all fields aren't db-only.
235
-     *
236
-     * @return boolean
237
-     */
238
-    function is_db_only_field()
239
-    {
240
-        return false;
241
-    }
23
+	var $_table_alias;
24
+	var $_table_column;
25
+	var $_name;
26
+	var $_nicename;
27
+	var $_nullable;
28
+	var $_default_value;
29
+	var $_other_config;
30
+	protected $_model_name;
31
+
32
+	/**
33
+	 * @param      $table_column
34
+	 * @param      $nicename
35
+	 * @param      $nullable
36
+	 * @param null $default_value
37
+	 */
38
+	function __construct($table_column, $nicename, $nullable, $default_value = null)
39
+	{
40
+		$this->_table_column  = $table_column;
41
+		$this->_nicename      = $nicename;
42
+		$this->_nullable      = $nullable;
43
+		$this->_default_value = $default_value;
44
+	}
45
+
46
+
47
+	/**
48
+	 * @param $table_alias
49
+	 * @param $name
50
+	 * @param $model_name
51
+	 */
52
+	function _construct_finalize($table_alias, $name, $model_name)
53
+	{
54
+		$this->_table_alias = $table_alias;
55
+		$this->_name        = $name;
56
+		$this->_model_name  = $model_name;
57
+		/**
58
+		 * allow for changing the defaults
59
+		 */
60
+		$this->_nicename      = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___nicename',
61
+			$this->_nicename, $this);
62
+		$this->_default_value = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___default_value',
63
+			$this->_default_value, $this);
64
+	}
65
+
66
+	function get_table_alias()
67
+	{
68
+		return $this->_table_alias;
69
+	}
70
+
71
+	function get_table_column()
72
+	{
73
+		return $this->_table_column;
74
+	}
75
+
76
+	/**
77
+	 * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime'
78
+	 *
79
+	 * @return string
80
+	 */
81
+	function get_model_name()
82
+	{
83
+		return $this->_model_name;
84
+	}
85
+
86
+	/**
87
+	 * @throws \EE_Error
88
+	 * @return string
89
+	 */
90
+	function get_name()
91
+	{
92
+		if ($this->_name) {
93
+			return $this->_name;
94
+		} else {
95
+			throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?",
96
+				"event_espresso"), get_class($this)));
97
+		}
98
+	}
99
+
100
+	function get_nicename()
101
+	{
102
+		return $this->_nicename;
103
+	}
104
+
105
+	function is_nullable()
106
+	{
107
+		return $this->_nullable;
108
+	}
109
+
110
+	/**
111
+	 * returns whether this field is an auto-increment field or not. If it is, then
112
+	 * on insertion it can be null. However, on updates it must be present.
113
+	 *
114
+	 * @return boolean
115
+	 */
116
+	function is_auto_increment()
117
+	{
118
+		return false;
119
+	}
120
+
121
+	/**
122
+	 * The default value in the model object's value domain. See lengthy comment about
123
+	 * value domains at the top of EEM_Base
124
+	 *
125
+	 * @return mixed
126
+	 */
127
+	function get_default_value()
128
+	{
129
+		return $this->_default_value;
130
+	}
131
+
132
+	/**
133
+	 * Returns the table alias joined to the table column, however this isn't the right
134
+	 * table alias if the aliased table is being joined to. In that case, you can use
135
+	 * EE_Model_Parser::extract_table_alias_model_relation_chain_prefix() to find the table's current alias
136
+	 * in the current query
137
+	 *
138
+	 * @return string
139
+	 */
140
+	function get_qualified_column()
141
+	{
142
+		return $this->get_table_alias() . "." . $this->get_table_column();
143
+	}
144
+
145
+	/**
146
+	 * When get() is called on a model object (eg EE_Event), before returning its value,
147
+	 * call this function on it, allowing us to customize the returned value based on
148
+	 * the field's type. Eg, we may want ot serialize it, strip tags, etc. By default,
149
+	 * we simply return it.
150
+	 *
151
+	 * @param mixed $value_of_field_on_model_object
152
+	 * @return mixed
153
+	 */
154
+	function prepare_for_get($value_of_field_on_model_object)
155
+	{
156
+		return $value_of_field_on_model_object;
157
+	}
158
+
159
+	/**
160
+	 * When inserting or updating a field on a model object, run this function on each
161
+	 * value to prepare it for insertion into the db. We may want to add slashes, serialize it, etc.
162
+	 * By default, we do nothing.
163
+	 *
164
+	 * @param mixed $value_of_field_on_model_object
165
+	 * @return mixed
166
+	 */
167
+	function prepare_for_use_in_db($value_of_field_on_model_object)
168
+	{
169
+		return $value_of_field_on_model_object;
170
+	}
171
+
172
+	/**
173
+	 * When creating a brand-new model object, or setting a particular value for one of its fields, this function
174
+	 * is called before setting it on the model object. We may want to strip slashes, unserialize the value, etc.
175
+	 * By default, we do nothing.
176
+	 *
177
+	 * @param mixed $value_inputted_for_field_on_model_object
178
+	 * @return mixed
179
+	 */
180
+	function prepare_for_set($value_inputted_for_field_on_model_object)
181
+	{
182
+		return $value_inputted_for_field_on_model_object;
183
+	}
184
+
185
+
186
+	/**
187
+	 * When instantiating a model object from DB results, this function is called before setting each field.
188
+	 * We may want to serialize the value, etc. By default, we return the value using prepare_for_set() method as that
189
+	 * is the one child classes will most often define.
190
+	 *
191
+	 * @param mixed $value_found_in_db_for_model_object
192
+	 * @return mixed
193
+	 */
194
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
195
+	{
196
+		return $this->prepare_for_set($value_found_in_db_for_model_object);
197
+	}
198
+
199
+	/**
200
+	 * When echoing a field's value on a model object, this function is run to prepare the value for presentation in a
201
+	 * webpage. For example, we may want to output floats with 2 decimal places by default, dates as "Monday Jan 12,
202
+	 * 2013, at 3:23pm" instead of
203
+	 * "8765678632", or any other modifications to how the value should be displayed, but not modified itself.
204
+	 *
205
+	 * @param mixed $value_on_field_to_be_outputted
206
+	 * @return mixed
207
+	 */
208
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted)
209
+	{
210
+		return $value_on_field_to_be_outputted;
211
+	}
212
+
213
+	/**
214
+	 * Return `%d`, `%s` or `%f` to indicate the data type for the field.
215
+	 * @return string
216
+	 */
217
+	abstract function get_wpdb_data_type();
218
+
219
+
220
+	/**
221
+	 * This returns elements used to represent this field in the json schema.
222
+	 *
223
+	 * @link http://json-schema.org/
224
+	 * @return array
225
+	 */
226
+	abstract public function get_schema();
227
+
228
+	/**
229
+	 * Some fields are in the database-only, (ie, used in queries etc), but shouldn't necessarily be part
230
+	 * of the model objects (ie, client code shouldn't care to ever see their value... if client code does
231
+	 * want to see their value, then they shouldn't be db-only fields!)
232
+	 * Eg, when doing events as custom post types, querying the post_type is essential, but
233
+	 * post_type is irrelevant for EE_Event objects (because they will ALL be of post_type 'esp_event').
234
+	 * By default, all fields aren't db-only.
235
+	 *
236
+	 * @return boolean
237
+	 */
238
+	function is_db_only_field()
239
+	{
240
+		return false;
241
+	}
242 242
 }
243 243
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_Field_Base.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -7,6 +7,7 @@
 block discarded – undo
7 7
      *
8 8
      * @param string $table_column
9 9
      * @param string $nicename
10
+     * @param integer|null $default
10 11
      */
11 12
     public function __construct($table_column, $nicename, $default)
12 13
     {
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -2,32 +2,32 @@
 block discarded – undo
2 2
 
3 3
 abstract class EE_Primary_Key_Field_Base extends EE_Field_With_Model_Name
4 4
 {
5
-    /**
6
-     * Overrides parent so it doesn't need to provide so many non-applicable fields
7
-     *
8
-     * @param string $table_column
9
-     * @param string $nicename
10
-     */
11
-    public function __construct($table_column, $nicename, $default)
12
-    {
13
-        parent::__construct($table_column, $nicename, false, $default, null);
14
-    }
5
+	/**
6
+	 * Overrides parent so it doesn't need to provide so many non-applicable fields
7
+	 *
8
+	 * @param string $table_column
9
+	 * @param string $nicename
10
+	 */
11
+	public function __construct($table_column, $nicename, $default)
12
+	{
13
+		parent::__construct($table_column, $nicename, false, $default, null);
14
+	}
15 15
 
16
-    /**
17
-     * @param $table_alias
18
-     * @param $name
19
-     */
20
-    function _construct_finalize($table_alias, $name, $model_name)
21
-    {
22
-        $this->_model_name_pointed_to = $model_name;
23
-        parent::_construct_finalize($table_alias, $name, $model_name);
24
-    }
16
+	/**
17
+	 * @param $table_alias
18
+	 * @param $name
19
+	 */
20
+	function _construct_finalize($table_alias, $name, $model_name)
21
+	{
22
+		$this->_model_name_pointed_to = $model_name;
23
+		parent::_construct_finalize($table_alias, $name, $model_name);
24
+	}
25 25
 
26 26
 
27
-    public function get_schema()
28
-    {
29
-        $schema = parent::get_schema();
30
-        $schema['primary_key'] = true;
31
-        return $schema;
32
-    }
27
+	public function get_schema()
28
+	{
29
+		$schema = parent::get_schema();
30
+		$schema['primary_key'] = true;
31
+		return $schema;
32
+	}
33 33
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_String_Field.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -8,6 +8,9 @@
 block discarded – undo
8 8
         return '%s';
9 9
     }
10 10
 
11
+    /**
12
+     * @param string $table_column
13
+     */
11 14
     public function __construct($table_column, $nicename)
12 15
     {
13 16
         parent::__construct($table_column, $nicename, null);
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -3,27 +3,27 @@
 block discarded – undo
3 3
 
4 4
 class EE_Primary_Key_String_Field extends EE_Primary_Key_Field_Base
5 5
 {
6
-    function get_wpdb_data_type()
7
-    {
8
-        return '%s';
9
-    }
6
+	function get_wpdb_data_type()
7
+	{
8
+		return '%s';
9
+	}
10 10
 
11
-    public function __construct($table_column, $nicename)
12
-    {
13
-        parent::__construct($table_column, $nicename, null);
14
-    }
11
+	public function __construct($table_column, $nicename)
12
+	{
13
+		parent::__construct($table_column, $nicename, null);
14
+	}
15 15
 
16
-    /**
17
-     * removes all tags when setting
18
-     *
19
-     * @param string $value_inputted_for_field_on_model_object
20
-     * @return string
21
-     */
22
-    function prepare_for_set($value_inputted_for_field_on_model_object)
23
-    {
24
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
25
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
26
-        }
27
-        return wp_strip_all_tags($value_inputted_for_field_on_model_object);
28
-    }
16
+	/**
17
+	 * removes all tags when setting
18
+	 *
19
+	 * @param string $value_inputted_for_field_on_model_object
20
+	 * @return string
21
+	 */
22
+	function prepare_for_set($value_inputted_for_field_on_model_object)
23
+	{
24
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
25
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
26
+		}
27
+		return wp_strip_all_tags($value_inputted_for_field_on_model_object);
28
+	}
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.