Completed
Branch BUG-8698-ticket-sellouts (4c4ee4)
by
unknown
658:40 queued 641:39
created
core/middleware/EE_Recommended_Versions.core.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,34 +22,34 @@  discard block
 block discarded – undo
22 22
 	 * @param 	EE_Response $response
23 23
 	 * @return 	EE_Response
24 24
 	 */
25
-	public function handle_request( EE_Request $request, EE_Response $response ) {
25
+	public function handle_request(EE_Request $request, EE_Response $response) {
26 26
 		$this->_request = $request;
27 27
 		$this->_response = $response;
28 28
 		//$this->_response->add_output( "\n\t IN >>  " . __CLASS__ );
29 29
 		//$this->_response->set_notice( 1, 'hey look at this' );
30 30
 		// check required WP version
31
-		if ( ! $this->_minimum_wp_version_required() ) {
32
-			$this->_request->un_set( 'activate', true );
33
-			add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 );
31
+		if ( ! $this->_minimum_wp_version_required()) {
32
+			$this->_request->un_set('activate', true);
33
+			add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1);
34 34
 			//$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' );
35 35
 			$this->_response->terminate_request();
36 36
 		}
37 37
 		// check required PHP version
38
-		if ( ! $this->_minimum_php_version_required() ) {
39
-			$this->_request->un_set( 'activate', true );
40
-			add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 );
38
+		if ( ! $this->_minimum_php_version_required()) {
39
+			$this->_request->un_set('activate', true);
40
+			add_action('admin_notices', array($this, 'minimum_php_version_error'), 1);
41 41
 			//$this->_response->add_output( "\n<br />" . 'minimum_php_version_error' );
42 42
 			$this->_response->terminate_request();
43 43
 		}
44 44
 		// check recommended WP version
45
-		if ( ! $this->_minimum_wp_version_recommended() ) {
45
+		if ( ! $this->_minimum_wp_version_recommended()) {
46 46
 			$this->_display_minimum_recommended_wp_version_notice();
47 47
 		}
48 48
 		// check recommended PHP version
49
-		if ( ! $this->_minimum_php_version_recommended() ) {
49
+		if ( ! $this->_minimum_php_version_recommended()) {
50 50
 			$this->_display_minimum_recommended_php_version_notice();
51 51
 		}
52
-		$this->_response = $this->process_request_stack( $this->_request, $this->_response );
52
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
53 53
 		//$this->_response->add_output( "\n\t OUT << " . __CLASS__ );
54 54
 		return $this->_response;
55 55
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 * @param string $min_version
64 64
 	 * @return boolean
65 65
 	 */
66
-	private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) {
66
+	private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) {
67 67
 		global $wp_version;
68
-		return version_compare( $wp_version, $min_version, '>=' ) ? true : false;
68
+		return version_compare($wp_version, $min_version, '>=') ? true : false;
69 69
 	}
70 70
 
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @return boolean
78 78
 	 */
79 79
 	private function _minimum_wp_version_required() {
80
-		return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED );
80
+		return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED);
81 81
 	}
82 82
 
83 83
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return boolean
90 90
 	 */
91 91
 	private function _minimum_wp_version_recommended() {
92
-		return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED );
92
+		return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED);
93 93
 	}
94 94
 
95 95
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 	 * @param string $min_version
102 102
 	 * @return boolean
103 103
 	 */
104
-	private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) {
105
-		return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false;
104
+	private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) {
105
+		return version_compare(PHP_VERSION, $min_version, '>=') ? true : false;
106 106
 	}
107 107
 
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @return boolean
115 115
 	 */
116 116
 	private function _minimum_php_version_required() {
117
-		return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED );
117
+		return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED);
118 118
 	}
119 119
 
120 120
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return boolean
127 127
 	 */
128 128
 	private function _minimum_php_version_recommended() {
129
-		return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED );
129
+		return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED);
130 130
 	}
131 131
 
132 132
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			<p>
144 144
 				<?php
145 145
 				printf(
146
-					__( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
146
+					__('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
147 147
 					EE_MIN_WP_VER_REQUIRED,
148 148
 					$wp_version,
149 149
 					'<br/>',
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			<p>
169 169
 				<?php
170 170
 				printf(
171
-					__( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
171
+					__('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
172 172
 					EE_MIN_PHP_VER_REQUIRED,
173 173
 					PHP_VERSION,
174 174
 					'<br/>',
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 	private function _display_minimum_recommended_wp_version_notice() {
192 192
 		global $wp_version;
193 193
 		EE_Error::add_persistent_admin_notice(
194
-			'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended',
194
+			'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended',
195 195
 			sprintf(
196
-				__( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
196
+				__('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
197 197
 				EE_MIN_WP_VER_RECOMMENDED,
198 198
 				$wp_version,
199 199
 				'<br/>',
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	private function _display_minimum_recommended_php_version_notice() {
214 214
 		EE_Error::add_persistent_admin_notice(
215
-			'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended',
215
+			'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended',
216 216
 			sprintf(
217
-				__( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
217
+				__('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
218 218
 				EE_MIN_PHP_VER_RECOMMENDED,
219 219
 				PHP_VERSION,
220 220
 				'<br/>',
Please login to merge, or discard this patch.
core/EE_Config.core.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 *    update_espresso_config
364 364
 	 *
365 365
 	 * @access   public
366
-	 * @return   bool
366
+	 * @return   boolean|null
367 367
 	 */
368 368
 	protected function  _reset_espresso_addon_config() {
369 369
 		$this->_config_option_names = array();
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 * @param    string                $name
444 444
 	 * @param    string                $config_class
445 445
 	 * @param    EE_Config_Base 	$config_obj
446
-	 * @param    array                 $tests_to_run
446
+	 * @param    integer[]                 $tests_to_run
447 447
 	 * @param    bool                  $display_errors
448 448
 	 * @return    bool    TRUE on success, FALSE on fail
449 449
 	 */
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 
1593 1593
 
1594 1594
 	/**
1595
-	 * @return array
1595
+	 * @return integer[]
1596 1596
 	 */
1597 1597
 	public function get_critical_pages_array() {
1598 1598
 		return array(
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 
1606 1606
 
1607 1607
 	/**
1608
-	 * @return array
1608
+	 * @return string[]
1609 1609
 	 */
1610 1610
 	public function get_critical_pages_shortcodes_array() {
1611 1611
 		return array(
@@ -1928,7 +1928,7 @@  discard block
 block discarded – undo
1928 1928
 	 *    class constructor
1929 1929
 	 *
1930 1930
 	 * @access    public
1931
-	 * @param null $CNT_ISO
1931
+	 * @param string $CNT_ISO
1932 1932
 	 * @return \EE_Currency_Config
1933 1933
 	 */
1934 1934
 	public function __construct( $CNT_ISO = NULL ) {
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 	 *
2568 2568
 	 * @param int $input_count the count of input vars.
2569 2569
 	 *
2570
-	 * @return array {
2570
+	 * @return string {
2571 2571
 	 *         An array that represents whether available space and if no available space the error message.
2572 2572
 	 *         @type bool $has_space		whether more inputs can be added.
2573 2573
 	 *         @type string $msg 		Any message to be displayed.
Please login to merge, or discard this patch.
Spacing   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public static function instance() {
130 130
 		// check if class object is instantiated, and instantiated properly
131
-		if ( ! self::$_instance instanceof EE_Config ) {
131
+		if ( ! self::$_instance instanceof EE_Config) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 	 * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode)
146 146
 	 * @return EE_Config
147 147
 	 */
148
-	public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){
149
-		if ( $hard_reset ) {
148
+	public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) {
149
+		if ($hard_reset) {
150 150
 			self::$_instance->_config_option_names = array();
151 151
 			self::$_instance->_initialize_config();
152 152
 			self::$_instance->update_espresso_config();
153 153
 		}
154
-		if( self::$_instance instanceof EE_Config ){
154
+		if (self::$_instance instanceof EE_Config) {
155 155
 			self::$_instance->shutdown();
156 156
 		}
157 157
 		self::$_instance = NULL;
158 158
 		//we don't need to reset the static properties imo because those should
159 159
 		//only change when a module is added or removed. Currently we don't
160 160
 		//support removing a module during a request when it previously existed
161
-		if( $reinstantiate ){
161
+		if ($reinstantiate) {
162 162
 			return self::instance();
163
-		}else{
163
+		} else {
164 164
 			return NULL;
165 165
 		}
166 166
 	}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @return \EE_Config
175 175
 	 */
176 176
 	private function __construct() {
177
-		do_action( 'AHEE__EE_Config__construct__begin',$this );
178
-		$this->_config_option_names = get_option( 'ee_config_option_names', array() );
177
+		do_action('AHEE__EE_Config__construct__begin', $this);
178
+		$this->_config_option_names = get_option('ee_config_option_names', array());
179 179
 		// setup empty config classes
180 180
 		$this->_initialize_config();
181 181
 		// load existing EE site settings
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 		// confirm everything loaded correctly and set filtered defaults if not
184 184
 		$this->_verify_config();
185 185
 		//  register shortcodes and modules
186
-		add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 );
186
+		add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999);
187 187
 		//  initialize shortcodes and modules
188
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ));
188
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
189 189
 		// register widgets
190
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
190
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
191 191
 		// shutdown
192
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
192
+		add_action('shutdown', array($this, 'shutdown'), 10);
193 193
 		// construct__end hook
194
-		do_action( 'AHEE__EE_Config__construct__end',$this );
194
+		do_action('AHEE__EE_Config__construct__end', $this);
195 195
 		// hardcoded hack
196 196
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
197 197
 	}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return string current theme set.
205 205
 	 */
206 206
 	public static function get_current_theme() {
207
-		return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
207
+		return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
208 208
 	}
209 209
 
210 210
 
@@ -238,27 +238,27 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	private function _load_core_config() {
240 240
 		// load_core_config__start hook
241
-		do_action( 'AHEE__EE_Config___load_core_config__start', $this );
241
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
242 242
 		$espresso_config = $this->get_espresso_config();
243
-		foreach ( $espresso_config as $config => $settings ) {
243
+		foreach ($espresso_config as $config => $settings) {
244 244
 			// load_core_config__start hook
245
-			$settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this );
246
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
247
-				$this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
245
+			$settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this);
246
+			if (is_object($settings) && property_exists($this, $config)) {
247
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
248 248
 				//call configs populate method to ensure any defaults are set for empty values.
249
-				if ( method_exists( $settings, 'populate' ) ) {
249
+				if (method_exists($settings, 'populate')) {
250 250
 					$this->{$config}->populate();
251 251
 				}
252
-				if ( method_exists( $settings, 'do_hooks' ) ) {
252
+				if (method_exists($settings, 'do_hooks')) {
253 253
 					$this->{$config}->do_hooks();
254 254
 				}
255 255
 			}
256 256
 		}
257
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) {
257
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) {
258 258
 			$this->update_espresso_config();
259 259
 		}
260 260
 		// load_core_config__end hook
261
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
261
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
262 262
 	}
263 263
 
264 264
 
@@ -272,40 +272,40 @@  discard block
 block discarded – undo
272 272
 	protected function _verify_config() {
273 273
 
274 274
 		$this->core = $this->core instanceof EE_Core_Config
275
-			? $this->core  : new EE_Core_Config();
276
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
275
+			? $this->core : new EE_Core_Config();
276
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
277 277
 
278 278
 		$this->organization = $this->organization instanceof EE_Organization_Config
279
-			? $this->organization  : new EE_Organization_Config();
280
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
279
+			? $this->organization : new EE_Organization_Config();
280
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
281 281
 
282 282
 		$this->currency = $this->currency instanceof EE_Currency_Config
283 283
 			? $this->currency : new EE_Currency_Config();
284
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
284
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
285 285
 
286 286
 		$this->registration = $this->registration instanceof EE_Registration_Config
287 287
 			? $this->registration : new EE_Registration_Config();
288
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
288
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
289 289
 
290 290
 		$this->admin = $this->admin instanceof EE_Admin_Config
291 291
 			? $this->admin : new EE_Admin_Config();
292
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
292
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
293 293
 
294 294
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
295 295
 			? $this->template_settings : new EE_Template_Config();
296
-		$this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings );
296
+		$this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings);
297 297
 
298 298
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
299 299
 			? $this->map_settings : new EE_Map_Config();
300
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
300
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
301 301
 
302 302
 		$this->environment = $this->environment instanceof EE_Environment_Config
303 303
 			? $this->environment : new EE_Environment_Config();
304
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
304
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
305 305
 
306 306
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
307 307
 			? $this->gateway : new EE_Gateway_Config();
308
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
308
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
309 309
 
310 310
 	}
311 311
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	public function get_espresso_config() {
321 321
 		// grab espresso configuration
322
-		return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() ));
322
+		return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array()));
323 323
 	}
324 324
 
325 325
 
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 * @param        $old_value
333 333
 	 * @param        $value
334 334
 	 */
335
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
335
+	public function double_check_config_comparison($option = '', $old_value, $value) {
336 336
 		// make sure we're checking the ee config
337
-		if ( $option == 'ee_config' ) {
337
+		if ($option == 'ee_config') {
338 338
 			// run a loose comparison of the old value against the new value for type and properties,
339 339
 			// but NOT exact instance like WP update_option does
340
-			if ( $value != $old_value ) {
340
+			if ($value != $old_value) {
341 341
 				// if they are NOT the same, then remove the hook,
342 342
 				// which means the subsequent update results will be based solely on the update query results
343 343
 				// the reason we do this is because, as stated above,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				// the string it sees in the db looks the same as the new one it has been passed!!!
353 353
 				// This results in the query returning an "affected rows" value of ZERO,
354 354
 				// which gets returned immediately by WP update_option and looks like an error.
355
-				remove_action( 'update_option', array( $this, 'check_config_updated' ));
355
+				remove_action('update_option', array($this, 'check_config_updated'));
356 356
 			}
357 357
 		}
358 358
 	}
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	protected function  _reset_espresso_addon_config() {
369 369
 		$this->_config_option_names = array();
370
-		foreach( $this->addons as $addon_name => $addon_config_obj ) {
371
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
372
-			$config_class = get_class( $addon_config_obj );
373
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
374
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE );
370
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
371
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
372
+			$config_class = get_class($addon_config_obj);
373
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
374
+				$this->update_config('addons', $addon_name, $addon_config_obj, FALSE);
375 375
 			}
376 376
 			$this->addons->{$addon_name} = NULL;
377 377
 		}
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
 	 * @param   bool $add_error
388 388
 	 * @return   bool
389 389
 	 */
390
-	public function  update_espresso_config( $add_success = FALSE, $add_error = TRUE ) {
390
+	public function  update_espresso_config($add_success = FALSE, $add_error = TRUE) {
391 391
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
392 392
 		//$clone = clone( self::$_instance );
393 393
 		//self::$_instance = NULL;
394
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this );
394
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
395 395
 		$this->_reset_espresso_addon_config();
396 396
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
397 397
 		// but BEFORE the actual update occurs
398
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
398
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
399 399
 		// now update "ee_config"
400
-		$saved = update_option( 'ee_config', $this );
400
+		$saved = update_option('ee_config', $this);
401 401
 		// if not saved... check if the hook we just added still exists;
402 402
 		// if it does, it means one of two things:
403 403
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 		// but just means no update occurred, so don't display an error to the user.
409 409
 		// BUT... if update_option returns FALSE, AND the hook is missing,
410 410
 		// then it means that something truly went wrong
411
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved;
411
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
412 412
 		// remove our action since we don't want it in the system anymore
413
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
414
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
413
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
414
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
415 415
 		//self::$_instance = $clone;
416 416
 		//unset( $clone );
417 417
 		// if config remains the same or was updated successfully
418
-		if ( $saved ) {
419
-			if ( $add_success ) {
418
+		if ($saved) {
419
+			if ($add_success) {
420 420
 				EE_Error::add_success(
421
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
421
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
422 422
 					__FILE__, __FUNCTION__, __LINE__
423 423
 				);
424 424
 			}
425 425
 			return TRUE;
426 426
 		} else {
427
-			if ( $add_error ) {
427
+			if ($add_error) {
428 428
 				EE_Error::add_error(
429
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
429
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
430 430
 					__FILE__, __FUNCTION__, __LINE__
431 431
 				);
432 432
 			}
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 		$name = '',
453 453
 		$config_class = '',
454 454
 		$config_obj = NULL,
455
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
455
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
456 456
 		$display_errors = TRUE
457 457
 	) {
458 458
 		try {
459
-			foreach ( $tests_to_run as $test ) {
460
-				switch ( $test ) {
459
+			foreach ($tests_to_run as $test) {
460
+				switch ($test) {
461 461
 
462 462
 					// TEST #1 : check that section was set
463 463
 					case 1 :
464
-						if ( empty( $section ) ) {
465
-							if ( $display_errors ) {
464
+						if (empty($section)) {
465
+							if ($display_errors) {
466 466
 								throw new EE_Error(
467 467
 									sprintf(
468
-										__( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ),
468
+										__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'),
469 469
 										$config_class
470 470
 									)
471 471
 								);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 					// TEST #2 : check that settings section exists
478 478
 					case 2 :
479
-						if ( ! isset( $this->{$section} ) ) {
480
-							if ( $display_errors ) {
479
+						if ( ! isset($this->{$section} )) {
480
+							if ($display_errors) {
481 481
 								throw new EE_Error(
482
-									sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ),
483
-											 $section )
482
+									sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'),
483
+											 $section)
484 484
 								);
485 485
 							}
486 486
 							return false;
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 					// TEST #3 : check that section is the proper format
491 491
 					case 3 :
492 492
 						if (
493
-							! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
493
+							! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
494 494
 						) {
495
-							if ( $display_errors ) {
495
+							if ($display_errors) {
496 496
 								throw new EE_Error(
497 497
 									sprintf(
498
-										__( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ),
498
+										__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'),
499 499
 										$section
500 500
 									)
501 501
 								);
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 
507 507
 					// TEST #4 : check that config section name has been set
508 508
 					case 4 :
509
-						if ( empty( $name ) ) {
510
-							if ( $display_errors ) {
509
+						if (empty($name)) {
510
+							if ($display_errors) {
511 511
 								throw new EE_Error(
512
-									__( 'No name has been provided for the specific configuration section.', 'event_espresso' )
512
+									__('No name has been provided for the specific configuration section.', 'event_espresso')
513 513
 								);
514 514
 							}
515 515
 							return false;
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 
519 519
 					// TEST #5 : check that a config class name has been set
520 520
 					case 5 :
521
-						if ( empty( $config_class ) ) {
522
-							if ( $display_errors ) {
521
+						if (empty($config_class)) {
522
+							if ($display_errors) {
523 523
 								throw new EE_Error(
524
-									__( 'No class name has been provided for the specific configuration section.', 'event_espresso' )
524
+									__('No class name has been provided for the specific configuration section.', 'event_espresso')
525 525
 								);
526 526
 							}
527 527
 							return false;
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 
531 531
 					// TEST #6 : verify config class is accessible
532 532
 					case 6 :
533
-						if ( ! class_exists( $config_class ) ) {
534
-							if ( $display_errors ) {
533
+						if ( ! class_exists($config_class)) {
534
+							if ($display_errors) {
535 535
 								throw new EE_Error(
536 536
 									sprintf(
537
-										__( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ),
537
+										__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'),
538 538
 										$config_class
539 539
 									)
540 540
 								);
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 
546 546
 					// TEST #7 : check that config has even been set
547 547
 					case 7 :
548
-						if ( ! isset( $this->{$section}->{$name} ) ) {
549
-							if ( $display_errors ) {
548
+						if ( ! isset($this->{$section}->{$name} )) {
549
+							if ($display_errors) {
550 550
 								throw new EE_Error(
551 551
 									sprintf(
552
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
552
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
553 553
 										$section,
554 554
 										$name
555 555
 									)
@@ -558,17 +558,17 @@  discard block
 block discarded – undo
558 558
 							return false;
559 559
 						} else {
560 560
 							// and make sure it's not serialized
561
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
561
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
562 562
 						}
563 563
 						break;
564 564
 
565 565
 					// TEST #8 : check that config is the requested type
566 566
 					case 8 :
567
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
568
-							if ( $display_errors ) {
567
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
568
+							if ($display_errors) {
569 569
 								throw new EE_Error(
570 570
 									sprintf(
571
-										__( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ),
571
+										__('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'),
572 572
 										$section,
573 573
 										$name,
574 574
 										$config_class
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 
582 582
 					// TEST #9 : verify config object
583 583
 					case 9 :
584
-						if ( ! $config_obj instanceof EE_Config_Base ) {
585
-							if ( $display_errors ) {
584
+						if ( ! $config_obj instanceof EE_Config_Base) {
585
+							if ($display_errors) {
586 586
 								throw new EE_Error(
587 587
 									sprintf(
588
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
589
-										print_r( $config_obj, true )
588
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
589
+										print_r($config_obj, true)
590 590
 									)
591 591
 								);
592 592
 							}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 			}
599 599
 
600
-		} catch( EE_Error $e ) {
600
+		} catch (EE_Error $e) {
601 601
 			$e->get_error();
602 602
 		}
603 603
 		// you have successfully run the gauntlet
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
 	 * @param        string          $name
615 615
 	 * @return        string
616 616
 	 */
617
-	private function _generate_config_option_name( $section = '', $name = '' ) {
618
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
617
+	private function _generate_config_option_name($section = '', $name = '') {
618
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
619 619
 	}
620 620
 
621 621
 
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
 	 * @param 	string $name
630 630
 	 * @return 	string
631 631
 	 */
632
-	private function _set_config_class( $config_class = '', $name = '' ) {
633
-		return ! empty( $config_class )
632
+	private function _set_config_class($config_class = '', $name = '') {
633
+		return ! empty($config_class)
634 634
 			? $config_class
635
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
635
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
636 636
 	}
637 637
 
638 638
 
@@ -646,34 +646,34 @@  discard block
 block discarded – undo
646 646
 	 * @param 	EE_Config_Base $config_obj
647 647
 	 * @return 	EE_Config_Base
648 648
 	 */
649
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
649
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
650 650
 		// ensure config class is set to something
651
-		$config_class = $this->_set_config_class( $config_class, $name );
651
+		$config_class = $this->_set_config_class($config_class, $name);
652 652
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
653
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) {
653
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
654 654
 			return null;
655 655
 		}
656
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
656
+		$config_option_name = $this->_generate_config_option_name($section, $name);
657 657
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
658
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
659
-			$this->_config_option_names[ $config_option_name ] = $config_class;
658
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
659
+			$this->_config_option_names[$config_option_name] = $config_class;
660 660
 		}
661 661
 		// verify the incoming config object but suppress errors
662
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) {
662
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
663 663
 			$config_obj = new $config_class();
664 664
 		}
665
-		if ( get_option( $config_option_name ) ) {
666
-			update_option( $config_option_name, $config_obj );
665
+		if (get_option($config_option_name)) {
666
+			update_option($config_option_name, $config_obj);
667 667
 			$this->{$section}->{$name} = $config_obj;
668 668
 			return $this->{$section}->{$name};
669 669
 		} else {
670 670
 			// create a wp-option for this config
671
-			if ( add_option( $config_option_name, $config_obj, '', 'no' )) {
672
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
671
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
672
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
673 673
 				return $this->{$section}->{$name};
674 674
 			} else {
675 675
 				EE_Error::add_error(
676
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
676
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
677 677
 					__FILE__, __FUNCTION__, __LINE__
678 678
 				);
679 679
 				return null;
@@ -694,37 +694,37 @@  discard block
 block discarded – undo
694 694
 	 * @param 	bool 					$throw_errors
695 695
 	 * @return 	bool
696 696
 	 */
697
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
698
-		$config_obj = maybe_unserialize( $config_obj );
697
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
698
+		$config_obj = maybe_unserialize($config_obj);
699 699
 		// get class name of the incoming object
700
-		$config_class = get_class( $config_obj );
700
+		$config_class = get_class($config_obj);
701 701
 		// run tests 1-5 and 9 to verify config
702
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) {
702
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) {
703 703
 			return false;
704 704
 		}
705
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
705
+		$config_option_name = $this->_generate_config_option_name($section, $name);
706 706
 		// check if config object has been added to db by seeing if config option name is in $this->_config_option_names array
707
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
707
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
708 708
 			// save new config to db
709
-			return $this->set_config( $section, $name, $config_class, $config_obj );
709
+			return $this->set_config($section, $name, $config_class, $config_obj);
710 710
 		} else {
711 711
 			// first check if the record already exists
712
-			$existing_config = get_option( $config_option_name );
713
-			$config_obj = serialize( $config_obj );
712
+			$existing_config = get_option($config_option_name);
713
+			$config_obj = serialize($config_obj);
714 714
 			// just return if db record is already up to date
715
-			if ( $existing_config == $config_obj ) {
715
+			if ($existing_config == $config_obj) {
716 716
 				$this->{$section}->{$name} = $config_obj;
717 717
 				return true;
718
-			} else if ( update_option( $config_option_name, $config_obj )) {
718
+			} else if (update_option($config_option_name, $config_obj)) {
719 719
 				// update wp-option for this config class
720 720
 				$this->{$section}->{$name} = $config_obj;
721 721
 				return true;
722
-			} elseif ( $throw_errors ) {
722
+			} elseif ($throw_errors) {
723 723
 				EE_Error::add_error(
724 724
 					sprintf(
725
-						__( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ),
725
+						__('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'),
726 726
 						$config_class,
727
-						'EE_Config->' . $section . '->' . $name
727
+						'EE_Config->'.$section.'->'.$name
728 728
 					),
729 729
 					__FILE__, __FUNCTION__, __LINE__
730 730
 				);
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param 	string 	$config_class
745 745
 	 * @return 	mixed EE_Config_Base | NULL
746 746
 	 */
747
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
747
+	public function get_config($section = '', $name = '', $config_class = '') {
748 748
 		// ensure config class is set to something
749
-		$config_class = $this->_set_config_class( $config_class, $name );
749
+		$config_class = $this->_set_config_class($config_class, $name);
750 750
 		// run tests 1-4, 6 and 7 to verify that all params have been set
751
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
751
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
752 752
 			return NULL;
753 753
 		}
754 754
 		// now test if the requested config object exists, but suppress errors
755
-		if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) {
755
+		if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) {
756 756
 			// config already exists, so pass it back
757 757
 			return $this->{$section}->{$name};
758 758
 		}
759 759
 		// load config option from db if it exists
760
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ));
760
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
761 761
 		// verify the newly retrieved config object, but suppress errors
762
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
762
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
763 763
 			// config is good, so set it and pass it back
764 764
 			$this->{$section}->{$name} = $config_obj;
765 765
 			return $this->{$section}->{$name};
766 766
 		}
767 767
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
768
-		$config_obj =$this->set_config( $section, $name, $config_class );
768
+		$config_obj = $this->set_config($section, $name, $config_class);
769 769
 		// verify the newly created config object
770
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) {
770
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
771 771
 			return $this->{$section}->{$name};
772 772
 		} else {
773 773
 			EE_Error::add_error(
774
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
774
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
775 775
 				__FILE__, __FUNCTION__, __LINE__
776 776
 			);
777 777
 		}
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * @param 	string 	$config_option_name
787 787
 	 * @return 	mixed EE_Config_Base | FALSE
788 788
 	 */
789
-	public function get_config_option( $config_option_name = '' ) {
789
+	public function get_config_option($config_option_name = '') {
790 790
 		// retrieve the wp-option for this config class.
791
-		return maybe_unserialize( get_option( $config_option_name ));
791
+		return maybe_unserialize(get_option($config_option_name));
792 792
 	}
793 793
 
794 794
 
@@ -803,14 +803,14 @@  discard block
 block discarded – undo
803 803
 	 *  @return 	string
804 804
 	 */
805 805
 	public static function get_page_for_posts() {
806
-		$page_for_posts = get_option( 'page_for_posts' );
807
-		if ( ! $page_for_posts ) {
806
+		$page_for_posts = get_option('page_for_posts');
807
+		if ( ! $page_for_posts) {
808 808
 			return 'posts';
809 809
 		}
810 810
 		/** @type WPDB $wpdb */
811 811
 		global $wpdb;
812 812
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
813
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ));
813
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
814 814
 	}
815 815
 
816 816
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	public function register_shortcodes_and_modules() {
829 829
 		// allow shortcodes to register with WP and to set hooks for the rest of the system
830
-		EE_Registry::instance()->shortcodes =$this->_register_shortcodes();
830
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
831 831
 		// allow modules to set hooks for the rest of the system
832 832
 		EE_Registry::instance()->modules = $this->_register_modules();
833 833
 	}
@@ -859,21 +859,21 @@  discard block
 block discarded – undo
859 859
 	public function widgets_init() {
860 860
 		//only init widgets on admin pages when not in complete maintenance, and
861 861
 		//on frontend when not in any maintenance mode
862
-		if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance)  || ! EE_Maintenance_Mode::instance()->level() ) {
862
+		if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) {
863 863
 			// grab list of installed widgets
864
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
864
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
865 865
 			// filter list of modules to register
866
-			$widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register );
866
+			$widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register);
867 867
 
868
-			if ( ! empty( $widgets_to_register ) ) {
868
+			if ( ! empty($widgets_to_register)) {
869 869
 				// cycle thru widget folders
870
-				foreach ( $widgets_to_register as $widget_path ) {
870
+				foreach ($widgets_to_register as $widget_path) {
871 871
 					// add to list of installed widget modules
872
-					EE_Config::register_ee_widget( $widget_path );
872
+					EE_Config::register_ee_widget($widget_path);
873 873
 				}
874 874
 			}
875 875
 			// filter list of installed modules
876
-			EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets );
876
+			EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets);
877 877
 		}
878 878
 	}
879 879
 
@@ -886,54 +886,54 @@  discard block
 block discarded – undo
886 886
 	 *  @param 	string 	$widget_path - full path up to and including widget folder
887 887
 	 *  @return 	void
888 888
 	 */
889
-	public static function register_ee_widget( $widget_path = NULL ) {
890
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
889
+	public static function register_ee_widget($widget_path = NULL) {
890
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
891 891
 		$widget_ext = '.widget.php';
892 892
 		// make all separators match
893
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
893
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
894 894
 		// does the file path INCLUDE the actual file name as part of the path ?
895
-		if ( strpos( $widget_path, $widget_ext ) !== FALSE ) {
895
+		if (strpos($widget_path, $widget_ext) !== FALSE) {
896 896
 			// grab and shortcode file name from directory name and break apart at dots
897
-			$file_name = explode( '.', basename( $widget_path ));
897
+			$file_name = explode('.', basename($widget_path));
898 898
 			// take first segment from file name pieces and remove class prefix if it exists
899
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
899
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
900 900
 			// sanitize shortcode directory name
901
-			$widget = sanitize_key( $widget );
901
+			$widget = sanitize_key($widget);
902 902
 			// now we need to rebuild the shortcode path
903
-			$widget_path = explode( DS, $widget_path );
903
+			$widget_path = explode(DS, $widget_path);
904 904
 			// remove last segment
905
-			array_pop( $widget_path );
905
+			array_pop($widget_path);
906 906
 			// glue it back together
907
-			$widget_path = implode( DS, $widget_path );
907
+			$widget_path = implode(DS, $widget_path);
908 908
 		} else {
909 909
 			// grab and sanitize widget directory name
910
-			$widget = sanitize_key( basename( $widget_path ));
910
+			$widget = sanitize_key(basename($widget_path));
911 911
 		}
912 912
 		// create classname from widget directory name
913
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget )));
913
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
914 914
 		// add class prefix
915
-		$widget_class = 'EEW_' . $widget;
915
+		$widget_class = 'EEW_'.$widget;
916 916
 		// does the widget exist ?
917
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) {
917
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
918 918
 			$msg = sprintf(
919
-				__( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ),
919
+				__('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'),
920 920
 				$widget_class,
921
-				$widget_path . DS . $widget_class . $widget_ext
921
+				$widget_path.DS.$widget_class.$widget_ext
922 922
 			);
923
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
923
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
924 924
 			return;
925 925
 		}
926 926
 		// load the widget class file
927
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
927
+		require_once($widget_path.DS.$widget_class.$widget_ext);
928 928
 		// verify that class exists
929
-		if ( ! class_exists( $widget_class )) {
930
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
931
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
929
+		if ( ! class_exists($widget_class)) {
930
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
931
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
932 932
 			return;
933 933
 		}
934
-		register_widget( $widget_class );
934
+		register_widget($widget_class);
935 935
 		// add to array of registered widgets
936
-		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
936
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
937 937
 	}
938 938
 
939 939
 
@@ -946,18 +946,18 @@  discard block
 block discarded – undo
946 946
 	 */
947 947
 	private function _register_shortcodes() {
948 948
 		// grab list of installed shortcodes
949
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
949
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
950 950
 		// filter list of modules to register
951
-		$shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register );
952
-		if ( ! empty( $shortcodes_to_register ) ) {
951
+		$shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register);
952
+		if ( ! empty($shortcodes_to_register)) {
953 953
 			// cycle thru shortcode folders
954
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
954
+			foreach ($shortcodes_to_register as $shortcode_path) {
955 955
 				// add to list of installed shortcode modules
956
-				EE_Config::register_shortcode( $shortcode_path );
956
+				EE_Config::register_shortcode($shortcode_path);
957 957
 			}
958 958
 		}
959 959
 		// filter list of installed modules
960
-		return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes );
960
+		return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes);
961 961
 	}
962 962
 
963 963
 
@@ -969,56 +969,56 @@  discard block
 block discarded – undo
969 969
 	 *  @param 	string 		$shortcode_path - full path up to and including shortcode folder
970 970
 	 *  @return 	bool
971 971
 	 */
972
-	public static function register_shortcode( $shortcode_path = NULL ) {
973
-		do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path );
972
+	public static function register_shortcode($shortcode_path = NULL) {
973
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
974 974
 		$shortcode_ext = '.shortcode.php';
975 975
 		// make all separators match
976
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
976
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
977 977
 		// does the file path INCLUDE the actual file name as part of the path ?
978
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) {
978
+		if (strpos($shortcode_path, $shortcode_ext) !== FALSE) {
979 979
 			// grab shortcode file name from directory name and break apart at dots
980
-			$shortcode_file = explode( '.', basename( $shortcode_path ));
980
+			$shortcode_file = explode('.', basename($shortcode_path));
981 981
 			// take first segment from file name pieces and remove class prefix if it exists
982
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0];
982
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0];
983 983
 			// sanitize shortcode directory name
984
-			$shortcode = sanitize_key( $shortcode );
984
+			$shortcode = sanitize_key($shortcode);
985 985
 			// now we need to rebuild the shortcode path
986
-			$shortcode_path = explode( DS, $shortcode_path );
986
+			$shortcode_path = explode(DS, $shortcode_path);
987 987
 			// remove last segment
988
-			array_pop( $shortcode_path );
988
+			array_pop($shortcode_path);
989 989
 			// glue it back together
990
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
990
+			$shortcode_path = implode(DS, $shortcode_path).DS;
991 991
 		} else {
992 992
 			// we need to generate the filename based off of the folder name
993 993
 			// grab and sanitize shortcode directory name
994
-			$shortcode = sanitize_key( basename( $shortcode_path ));
995
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
994
+			$shortcode = sanitize_key(basename($shortcode_path));
995
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
996 996
 		}
997 997
 		// create classname from shortcode directory or file name
998
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode )));
998
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
999 999
 		// add class prefix
1000
-		$shortcode_class = 'EES_' . $shortcode;
1000
+		$shortcode_class = 'EES_'.$shortcode;
1001 1001
 		// does the shortcode exist ?
1002
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) {
1002
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1003 1003
 			$msg = sprintf(
1004
-				__( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ),
1004
+				__('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'),
1005 1005
 				$shortcode_class,
1006
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1006
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1007 1007
 			);
1008
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1008
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1009 1009
 			return FALSE;
1010 1010
 		}
1011 1011
 		// load the shortcode class file
1012
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1012
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1013 1013
 		// verify that class exists
1014
-		if ( ! class_exists( $shortcode_class )) {
1015
-			$msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class );
1016
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1014
+		if ( ! class_exists($shortcode_class)) {
1015
+			$msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class);
1016
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1017 1017
 			return FALSE;
1018 1018
 		}
1019
-		$shortcode = strtoupper( $shortcode );
1019
+		$shortcode = strtoupper($shortcode);
1020 1020
 		// add to array of registered shortcodes
1021
-		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1021
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1022 1022
 		return TRUE;
1023 1023
 	}
1024 1024
 
@@ -1033,23 +1033,23 @@  discard block
 block discarded – undo
1033 1033
 	 */
1034 1034
 	private function _register_modules() {
1035 1035
 		// grab list of installed modules
1036
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1036
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1037 1037
 		// filter list of modules to register
1038
-		$modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register );
1038
+		$modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register);
1039 1039
 
1040 1040
 
1041
-		if ( ! empty( $modules_to_register ) ) {
1041
+		if ( ! empty($modules_to_register)) {
1042 1042
 			// loop through folders
1043
-			foreach ( $modules_to_register as $module_path ) {
1043
+			foreach ($modules_to_register as $module_path) {
1044 1044
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1045
-				if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) {
1045
+				if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') {
1046 1046
 					// add to list of installed modules
1047
-					EE_Config::register_module( $module_path );
1047
+					EE_Config::register_module($module_path);
1048 1048
 				}
1049 1049
 			}
1050 1050
 		}
1051 1051
 		// filter list of installed modules
1052
-		return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules );
1052
+		return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules);
1053 1053
 	}
1054 1054
 
1055 1055
 
@@ -1062,54 +1062,54 @@  discard block
 block discarded – undo
1062 1062
 	 *  @param 	string 		$module_path - full path up to and including module folder
1063 1063
 	 *  @return 	bool
1064 1064
 	 */
1065
-	public static function register_module( $module_path = NULL ) {
1066
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1065
+	public static function register_module($module_path = NULL) {
1066
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1067 1067
 		$module_ext = '.module.php';
1068 1068
 		// make all separators match
1069
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1069
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1070 1070
 		// does the file path INCLUDE the actual file name as part of the path ?
1071
-		if ( strpos( $module_path, $module_ext ) !== FALSE ) {
1071
+		if (strpos($module_path, $module_ext) !== FALSE) {
1072 1072
 			// grab and shortcode file name from directory name and break apart at dots
1073
-			$module_file = explode( '.', basename( $module_path ));
1073
+			$module_file = explode('.', basename($module_path));
1074 1074
 			// now we need to rebuild the shortcode path
1075
-			$module_path = explode( DS, $module_path );
1075
+			$module_path = explode(DS, $module_path);
1076 1076
 			// remove last segment
1077
-			array_pop( $module_path );
1077
+			array_pop($module_path);
1078 1078
 			// glue it back together
1079
-			$module_path = implode( DS, $module_path ) . DS;
1079
+			$module_path = implode(DS, $module_path).DS;
1080 1080
 			// take first segment from file name pieces and sanitize it
1081
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1081
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1082 1082
 			// ensure class prefix is added
1083
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1083
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1084 1084
 		} else {
1085 1085
 			// we need to generate the filename based off of the folder name
1086 1086
 			// grab and sanitize module name
1087
-			$module = strtolower( basename( $module_path ));
1088
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module);
1087
+			$module = strtolower(basename($module_path));
1088
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1089 1089
 			// like trailingslashit()
1090
-			$module_path = rtrim( $module_path, DS ) . DS;
1090
+			$module_path = rtrim($module_path, DS).DS;
1091 1091
 			// create classname from module directory name
1092
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module )));
1092
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1093 1093
 			// add class prefix
1094
-			$module_class = 'EED_' . $module;
1094
+			$module_class = 'EED_'.$module;
1095 1095
 		}
1096 1096
 		// does the module exist ?
1097
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) {
1098
-			$msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
1099
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1097
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1098
+			$msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
1099
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1100 1100
 			return FALSE;
1101 1101
 		}
1102 1102
 		// load the module class file
1103
-		require_once( $module_path . $module_class . $module_ext );
1103
+		require_once($module_path.$module_class.$module_ext);
1104 1104
 		// verify that class exists
1105
-		if ( ! class_exists( $module_class )) {
1106
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1107
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1105
+		if ( ! class_exists($module_class)) {
1106
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1107
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1108 1108
 			return FALSE;
1109 1109
 		}
1110 1110
 		// add to array of registered modules
1111
-		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1112
-		do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1111
+		EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1112
+		do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1113 1113
 		return TRUE;
1114 1114
 	}
1115 1115
 
@@ -1123,23 +1123,23 @@  discard block
 block discarded – undo
1123 1123
 	 */
1124 1124
 	private function _initialize_shortcodes() {
1125 1125
 		// cycle thru shortcode folders
1126
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1126
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1127 1127
 			// add class prefix
1128
-			$shortcode_class = 'EES_' . $shortcode;
1128
+			$shortcode_class = 'EES_'.$shortcode;
1129 1129
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1130 1130
 			// which set hooks ?
1131
-			if ( is_admin() ) {
1131
+			if (is_admin()) {
1132 1132
 				// fire immediately
1133
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ));
1133
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1134 1134
 			} else {
1135 1135
 				// delay until other systems are online
1136
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' ));
1136
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks'));
1137 1137
 				// convert classname to UPPERCASE and create WP shortcode.
1138
-				$shortcode_tag = strtoupper( $shortcode );
1138
+				$shortcode_tag = strtoupper($shortcode);
1139 1139
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1140
-				if ( ! shortcode_exists( $shortcode_tag )) {
1140
+				if ( ! shortcode_exists($shortcode_tag)) {
1141 1141
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1142
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ));
1142
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1143 1143
 				}
1144 1144
 			}
1145 1145
 		}
@@ -1156,15 +1156,15 @@  discard block
 block discarded – undo
1156 1156
 	 */
1157 1157
 	private function _initialize_modules() {
1158 1158
 		// cycle thru shortcode folders
1159
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1159
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1160 1160
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1161 1161
 			// which set hooks ?
1162
-			if ( is_admin() ) {
1162
+			if (is_admin()) {
1163 1163
 				// fire immediately
1164
-				call_user_func( array( $module_class, 'set_hooks_admin' ));
1164
+				call_user_func(array($module_class, 'set_hooks_admin'));
1165 1165
 			} else {
1166 1166
 				// delay until other systems are online
1167
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' ));
1167
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks'));
1168 1168
 			}
1169 1169
 		}
1170 1170
 	}
@@ -1182,26 +1182,26 @@  discard block
 block discarded – undo
1182 1182
 	 *  @param 	string 		$key - url param key indicating a route is being called
1183 1183
 	 *  @return 	bool
1184 1184
 	 */
1185
-	public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) {
1186
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1187
-		$module = str_replace( 'EED_', '', $module );
1188
-		$module_class = 'EED_' . $module;
1189
-		if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) {
1190
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1191
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1185
+	public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') {
1186
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1187
+		$module = str_replace('EED_', '', $module);
1188
+		$module_class = 'EED_'.$module;
1189
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) {
1190
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1191
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1192 1192
 			return FALSE;
1193 1193
 		}
1194
-		if ( empty( $route )) {
1195
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1196
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1194
+		if (empty($route)) {
1195
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1196
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1197 1197
 			return FALSE;
1198 1198
 		}
1199
-		if ( ! method_exists ( 'EED_' . $module, $method_name )) {
1200
-			$msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route );
1201
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1199
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1200
+			$msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route);
1201
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1202 1202
 			return FALSE;
1203 1203
 		}
1204
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1204
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1205 1205
 		return TRUE;
1206 1206
 	}
1207 1207
 
@@ -1215,11 +1215,11 @@  discard block
 block discarded – undo
1215 1215
 	 *  @param 	string 		$key - url param key indicating a route is being called
1216 1216
 	 *  @return 	string
1217 1217
 	 */
1218
-	public static function get_route( $route = NULL, $key = 'ee' ) {
1219
-		do_action( 'AHEE__EE_Config__get_route__begin',$route );
1220
-		$route = apply_filters( 'FHEE__EE_Config__get_route',$route );
1221
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) {
1222
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1218
+	public static function get_route($route = NULL, $key = 'ee') {
1219
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1220
+		$route = apply_filters('FHEE__EE_Config__get_route', $route);
1221
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1222
+			return EE_Config::$_module_route_map[$key][$route];
1223 1223
 		}
1224 1224
 		return NULL;
1225 1225
 	}
@@ -1248,35 +1248,35 @@  discard block
 block discarded – undo
1248 1248
 	 * @param    string 		$key - url param key indicating a route is being called
1249 1249
 	 * @return    bool
1250 1250
 	 */
1251
-	public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) {
1252
-		do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward );
1253
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1254
-			$msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route );
1255
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1251
+	public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') {
1252
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1253
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1254
+			$msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route);
1255
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return FALSE;
1257 1257
 		}
1258
-		if ( empty( $forward )) {
1259
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1260
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1258
+		if (empty($forward)) {
1259
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1260
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return FALSE;
1262 1262
 		}
1263
-		if ( is_array( $forward )) {
1264
-			if ( ! isset( $forward[1] )) {
1265
-				$msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route );
1266
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1263
+		if (is_array($forward)) {
1264
+			if ( ! isset($forward[1])) {
1265
+				$msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route);
1266
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1267 1267
 				return FALSE;
1268 1268
 			}
1269
-			if ( ! method_exists( $forward[0], $forward[1] )) {
1270
-				$msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route );
1271
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1269
+			if ( ! method_exists($forward[0], $forward[1])) {
1270
+				$msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route);
1271
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1272 1272
 				return FALSE;
1273 1273
 			}
1274
-		} else if ( ! function_exists( $forward )) {
1275
-			$msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route );
1276
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1274
+		} else if ( ! function_exists($forward)) {
1275
+			$msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route);
1276
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1277 1277
 			return FALSE;
1278 1278
 		}
1279
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1279
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1280 1280
 		return TRUE;
1281 1281
 	}
1282 1282
 
@@ -1291,10 +1291,10 @@  discard block
 block discarded – undo
1291 1291
 	 *  @param    string 		$key - url param key indicating a route is being called
1292 1292
 	 *  @return 	string
1293 1293
 	 */
1294
-	public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) {
1295
-		do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status );
1296
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) {
1297
-			return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status );
1294
+	public static function get_forward($route = NULL, $status = 0, $key = 'ee') {
1295
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1296
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1297
+			return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status);
1298 1298
 		}
1299 1299
 		return NULL;
1300 1300
 	}
@@ -1311,19 +1311,19 @@  discard block
 block discarded – undo
1311 1311
 	 * @param    string 		$key - url param key indicating a route is being called
1312 1312
 	 * @return    bool
1313 1313
 	 */
1314
-	public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) {
1315
-		do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view );
1316
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1317
-			$msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route );
1318
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1314
+	public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') {
1315
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1316
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1317
+			$msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route);
1318
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1319 1319
 			return FALSE;
1320 1320
 		}
1321
-		if ( ! is_readable( $view )) {
1322
-			$msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view );
1323
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1321
+		if ( ! is_readable($view)) {
1322
+			$msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view);
1323
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1324 1324
 			return FALSE;
1325 1325
 		}
1326
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1326
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1327 1327
 		return TRUE;
1328 1328
 	}
1329 1329
 
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 	 *  @param    string 		$key - url param key indicating a route is being called
1341 1341
 	 *  @return 	string
1342 1342
 	 */
1343
-	public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) {
1344
-		do_action( 'AHEE__EE_Config__get_view__begin',$route,$status );
1345
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) {
1346
-			return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status );
1343
+	public static function get_view($route = NULL, $status = 0, $key = 'ee') {
1344
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1345
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1346
+			return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status);
1347 1347
 		}
1348 1348
 		return NULL;
1349 1349
 	}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
 
1353 1353
 	public function shutdown() {
1354
-		update_option( 'ee_config_option_names', $this->_config_option_names );
1354
+		update_option('ee_config_option_names', $this->_config_option_names);
1355 1355
 	}
1356 1356
 
1357 1357
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
  * magic functions in use, except we'll allow them to magically set and get stuff...
1368 1368
  * basically, they should just be well-defined stdClasses
1369 1369
  */
1370
-class EE_Config_Base{
1370
+class EE_Config_Base {
1371 1371
 
1372 1372
 	/**
1373 1373
 	 * Utility function for escaping the value of a property and returning.
@@ -1376,13 +1376,13 @@  discard block
 block discarded – undo
1376 1376
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1377 1377
 	 * @throws \EE_Error
1378 1378
 	 */
1379
-	public function get_pretty( $property ) {
1380
-		if ( ! property_exists( $this, $property ) ) {
1381
-			throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) );
1379
+	public function get_pretty($property) {
1380
+		if ( ! property_exists($this, $property)) {
1381
+			throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property));
1382 1382
 		}
1383 1383
 		//just handling escaping of strings for now.
1384
-		if ( is_string( $this->{$property} ) ) {
1385
-			return stripslashes( $this->{$property} );
1384
+		if (is_string($this->{$property} )) {
1385
+			return stripslashes($this->{$property} );
1386 1386
 		}
1387 1387
 		return $this->{$property};
1388 1388
 	}
@@ -1391,19 +1391,19 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
 	public function populate() {
1393 1393
 		//grab defaults via a new instance of this class.
1394
-		$class_name = get_class( $this );
1394
+		$class_name = get_class($this);
1395 1395
 		$defaults = new $class_name;
1396 1396
 
1397 1397
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1398 1398
 		//default from our $defaults object.
1399
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1400
-			if ( is_null( $this->{$property} ) ) {
1399
+		foreach (get_object_vars($defaults) as $property => $value) {
1400
+			if (is_null($this->{$property} )) {
1401 1401
 				$this->{$property} = $value;
1402 1402
 			}
1403 1403
 		}
1404 1404
 
1405 1405
 		//cleanup
1406
-		unset( $defaults );
1406
+		unset($defaults);
1407 1407
 	}
1408 1408
 
1409 1409
 
@@ -1495,12 +1495,12 @@  discard block
 block discarded – undo
1495 1495
 	 */
1496 1496
 	public function __construct() {
1497 1497
 		$current_network_main_site = is_multisite() ? get_current_site() : NULL;
1498
-		$current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1498
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1499 1499
 		// set default organization settings
1500 1500
 		$this->current_blog_id = get_current_blog_id();
1501 1501
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1502
-		$this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE );
1503
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE;
1502
+		$this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE);
1503
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE;
1504 1504
 		$this->post_shortcodes = array();
1505 1505
 		$this->module_route_map = array();
1506 1506
 		$this->module_forward_map = array();
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 		$this->event_cpt_slug = __('events', 'event_espresso');
1520 1520
 
1521 1521
 		//ueip constant check
1522
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1522
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1523 1523
 			$this->ee_ueip_optin = FALSE;
1524 1524
 			$this->ee_ueip_has_notified = TRUE;
1525 1525
 		}
@@ -1559,8 +1559,8 @@  discard block
 block discarded – undo
1559 1559
 	 *  @return 	string
1560 1560
 	 */
1561 1561
 	public function reg_page_url() {
1562
-		if ( ! $this->reg_page_url ) {
1563
-			$this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout';
1562
+		if ( ! $this->reg_page_url) {
1563
+			$this->reg_page_url = get_permalink($this->reg_page_id).'#checkout';
1564 1564
 		}
1565 1565
 		return $this->reg_page_url;
1566 1566
 	}
@@ -1573,12 +1573,12 @@  discard block
 block discarded – undo
1573 1573
 	 *  @return 	string
1574 1574
 	 */
1575 1575
 	public function txn_page_url($query_args = array()) {
1576
-		if ( ! $this->txn_page_url ) {
1577
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1576
+		if ( ! $this->txn_page_url) {
1577
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1578 1578
 		}
1579
-		if($query_args){
1580
-			return add_query_arg($query_args,$this->txn_page_url);
1581
-		}else{
1579
+		if ($query_args) {
1580
+			return add_query_arg($query_args, $this->txn_page_url);
1581
+		} else {
1582 1582
 			return $this->txn_page_url;
1583 1583
 		}
1584 1584
 	}
@@ -1590,12 +1590,12 @@  discard block
 block discarded – undo
1590 1590
 	 *  @return 	string
1591 1591
 	 */
1592 1592
 	public function thank_you_page_url($query_args = array()) {
1593
-		if ( ! $this->thank_you_page_url ) {
1594
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1593
+		if ( ! $this->thank_you_page_url) {
1594
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1595 1595
 		}
1596
-		if($query_args){
1597
-			return add_query_arg($query_args,$this->thank_you_page_url);
1598
-		}else{
1596
+		if ($query_args) {
1597
+			return add_query_arg($query_args, $this->thank_you_page_url);
1598
+		} else {
1599 1599
 			return $this->thank_you_page_url;
1600 1600
 		}
1601 1601
 	}
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
 	 *  @return 	string
1607 1607
 	 */
1608 1608
 	public function cancel_page_url() {
1609
-		if ( ! $this->cancel_page_url ) {
1610
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1609
+		if ( ! $this->cancel_page_url) {
1610
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1611 1611
 		}
1612 1612
 		return $this->cancel_page_url;
1613 1613
 	}
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 		//reset all url properties
1636 1636
 		$this->_reset_urls();
1637 1637
 		//return what to save to db
1638
-		return array_keys( get_object_vars( $this ) );
1638
+		return array_keys(get_object_vars($this));
1639 1639
 	}
1640 1640
 
1641 1641
 }
@@ -1867,39 +1867,39 @@  discard block
 block discarded – undo
1867 1867
 	 * @param null $CNT_ISO
1868 1868
 	 * @return \EE_Currency_Config
1869 1869
 	 */
1870
-	public function __construct( $CNT_ISO = NULL ) {
1870
+	public function __construct($CNT_ISO = NULL) {
1871 1871
 
1872 1872
 		// get country code from organization settings or use default
1873
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1873
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1874 1874
 		// but override if requested
1875
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
1876
-		EE_Registry::instance()->load_helper( 'Activation' );
1875
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
1876
+		EE_Registry::instance()->load_helper('Activation');
1877 1877
 		// 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
1878
-		if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) {
1878
+		if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) {
1879 1879
 			// retrieve the country settings from the db, just in case they have been customized
1880
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
1881
-			if ( $country instanceof EE_Country ) {
1882
-				$this->code = $country->currency_code(); 	// currency code: USD, CAD, EUR
1883
-				$this->name = $country->currency_name_single();	// Dollar
1884
-				$this->plural = $country->currency_name_plural(); 	// Dollars
1885
-				$this->sign =  $country->currency_sign(); 			// currency sign: $
1886
-				$this->sign_b4 = $country->currency_sign_before(); 		// currency sign before or after: $TRUE  or  FALSE$
1887
-				$this->dec_plc = $country->currency_decimal_places();	// decimal places: 2 = 0.00  3 = 0.000
1888
-				$this->dec_mrk = $country->currency_decimal_mark();	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1889
-				$this->thsnds = $country->currency_thousands_separator();	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1880
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
1881
+			if ($country instanceof EE_Country) {
1882
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
1883
+				$this->name = $country->currency_name_single(); // Dollar
1884
+				$this->plural = $country->currency_name_plural(); // Dollars
1885
+				$this->sign = $country->currency_sign(); // currency sign: $
1886
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
1887
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
1888
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1889
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1890 1890
 			}
1891 1891
 		}
1892 1892
 		// fallback to hardcoded defaults, in case the above failed
1893
-		if ( empty( $this->code )) {
1893
+		if (empty($this->code)) {
1894 1894
 			// set default currency settings
1895
-			$this->code = 'USD'; 	// currency code: USD, CAD, EUR
1896
-			$this->name = __( 'Dollar', 'event_espresso' ); 	// Dollar
1897
-			$this->plural = __( 'Dollars', 'event_espresso' ); 	// Dollars
1898
-			$this->sign =  '$'; 	// currency sign: $
1899
-			$this->sign_b4 = TRUE; 	// currency sign before or after: $TRUE  or  FALSE$
1900
-			$this->dec_plc = 2; 	// decimal places: 2 = 0.00  3 = 0.000
1901
-			$this->dec_mrk = '.'; 	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1902
-			$this->thsnds = ','; 	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1895
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
1896
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
1897
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
1898
+			$this->sign = '$'; // currency sign: $
1899
+			$this->sign_b4 = TRUE; // currency sign before or after: $TRUE  or  FALSE$
1900
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
1901
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1902
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1903 1903
 		}
1904 1904
 	}
1905 1905
 }
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
 	 * @since 4.8.8.rc.019
2049 2049
 	 */
2050 2050
 	public function do_hooks() {
2051
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ));
2051
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2052 2052
 	}
2053 2053
 
2054 2054
 
@@ -2056,7 +2056,7 @@  discard block
 block discarded – undo
2056 2056
 	 * @return void
2057 2057
 	 */
2058 2058
 	public function set_default_reg_status_on_EEM_Event() {
2059
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2059
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2060 2060
 	}
2061 2061
 
2062 2062
 
@@ -2161,10 +2161,10 @@  discard block
 block discarded – undo
2161 2161
 	 * @param bool $reset
2162 2162
 	 * @return string
2163 2163
 	 */
2164
-	public function log_file_name( $reset = FALSE ) {
2165
-		if ( empty( $this->log_file_name ) || $reset ) {
2166
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt';
2167
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2164
+	public function log_file_name($reset = FALSE) {
2165
+		if (empty($this->log_file_name) || $reset) {
2166
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt';
2167
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2168 2168
 		}
2169 2169
 		return $this->log_file_name;
2170 2170
 	}
@@ -2176,10 +2176,10 @@  discard block
 block discarded – undo
2176 2176
 	 * @param bool $reset
2177 2177
 	 * @return string
2178 2178
 	 */
2179
-	public function debug_file_name( $reset = FALSE ) {
2180
-		if ( empty( $this->debug_file_name ) || $reset ) {
2181
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt';
2182
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2179
+	public function debug_file_name($reset = FALSE) {
2180
+		if (empty($this->debug_file_name) || $reset) {
2181
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt';
2182
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2183 2183
 		}
2184 2184
 		return $this->debug_file_name;
2185 2185
 	}
@@ -2352,21 +2352,21 @@  discard block
 block discarded – undo
2352 2352
 		// set default map settings
2353 2353
 		$this->use_google_maps = TRUE;
2354 2354
 		// for event details pages (reg page)
2355
-		$this->event_details_map_width = 585; 			// ee_map_width_single
2356
-		$this->event_details_map_height = 362; 			// ee_map_height_single
2357
-		$this->event_details_map_zoom = 14; 			// ee_map_zoom_single
2358
-		$this->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
2359
-		$this->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
2360
-		$this->event_details_control_type = 'default'; 		// ee_map_type_control_single
2361
-		$this->event_details_map_align = 'center'; 			// ee_map_align_single
2355
+		$this->event_details_map_width = 585; // ee_map_width_single
2356
+		$this->event_details_map_height = 362; // ee_map_height_single
2357
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2358
+		$this->event_details_display_nav = TRUE; // ee_map_nav_display_single
2359
+		$this->event_details_nav_size = FALSE; // ee_map_nav_size_single
2360
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2361
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2362 2362
 		// for event list pages
2363
-		$this->event_list_map_width = 300; 			// ee_map_width
2364
-		$this->event_list_map_height = 185; 		// ee_map_height
2365
-		$this->event_list_map_zoom = 12; 			// ee_map_zoom
2366
-		$this->event_list_display_nav = FALSE; 		// ee_map_nav_display
2367
-		$this->event_list_nav_size = TRUE; 			// ee_map_nav_size
2368
-		$this->event_list_control_type = 'dropdown'; 		// ee_map_type_control
2369
-		$this->event_list_map_align = 'center'; 			// ee_map_align
2363
+		$this->event_list_map_width = 300; // ee_map_width
2364
+		$this->event_list_map_height = 185; // ee_map_height
2365
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2366
+		$this->event_list_display_nav = FALSE; // ee_map_nav_display
2367
+		$this->event_list_nav_size = TRUE; // ee_map_nav_size
2368
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2369
+		$this->event_list_map_align = 'center'; // ee_map_align
2370 2370
 	}
2371 2371
 
2372 2372
 }
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
 /**
2378 2378
  * stores Events_Archive settings
2379 2379
  */
2380
-class EE_Events_Archive_Config extends EE_Config_Base{
2380
+class EE_Events_Archive_Config extends EE_Config_Base {
2381 2381
 
2382 2382
 	public $display_status_banner;
2383 2383
 	public $display_description;
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
 	/**
2397 2397
 	 *	class constructor
2398 2398
 	 */
2399
-	public function __construct(){
2399
+	public function __construct() {
2400 2400
 		$this->display_status_banner = 0;
2401 2401
 		$this->display_description = 1;
2402 2402
 		$this->display_ticket_selector = 0;
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
 /**
2417 2417
  * Stores Event_Single_Config settings
2418 2418
  */
2419
-class EE_Event_Single_Config extends EE_Config_Base{
2419
+class EE_Event_Single_Config extends EE_Config_Base {
2420 2420
 
2421 2421
 	public $display_status_banner_single;
2422 2422
 	public $display_venue;
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
 /**
2446 2446
  * Stores Ticket_Selector_Config settings
2447 2447
  */
2448
-class EE_Ticket_Selector_Config extends EE_Config_Base{
2448
+class EE_Ticket_Selector_Config extends EE_Config_Base {
2449 2449
 	public $show_ticket_sale_columns;
2450 2450
 	public $show_ticket_details;
2451 2451
 	public $show_expired_tickets;
@@ -2499,7 +2499,7 @@  discard block
 block discarded – undo
2499 2499
 	 * @return void
2500 2500
 	 */
2501 2501
 	protected function _set_php_values() {
2502
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2502
+		$this->php->max_input_vars = ini_get('max_input_vars');
2503 2503
 		$this->php->version = phpversion();
2504 2504
 	}
2505 2505
 
@@ -2518,9 +2518,9 @@  discard block
 block discarded – undo
2518 2518
 	 *         @type string $msg 		Any message to be displayed.
2519 2519
 	 * }
2520 2520
 	 */
2521
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2522
-		if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) {
2523
-			return  sprintf( __('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2521
+	public function max_input_vars_limit_check($input_count = 0) {
2522
+		if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) {
2523
+			return  sprintf(__('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2524 2524
 		} else {
2525 2525
 			return '';
2526 2526
 		}
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
  * stores payment gateway info
2556 2556
  * @deprecated
2557 2557
  */
2558
-class EE_Gateway_Config extends EE_Config_Base{
2558
+class EE_Gateway_Config extends EE_Config_Base {
2559 2559
 
2560 2560
 	/**
2561 2561
 	 * Array with keys that are payment gateways slugs, and values are arrays
@@ -2577,9 +2577,9 @@  discard block
 block discarded – undo
2577 2577
 	 *	class constructor
2578 2578
 	 * @deprecated
2579 2579
 	 */
2580
-	public function __construct(){
2580
+	public function __construct() {
2581 2581
 		$this->payment_settings = array();
2582
-		$this->active_gateways = array( 'Invoice' => FALSE );
2582
+		$this->active_gateways = array('Invoice' => FALSE);
2583 2583
 	}
2584 2584
 }
2585 2585
 
Please login to merge, or discard this patch.
modules/messages/EED_Messages.module.php 1 patch
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @return EED_Module
59 59
 	 */
60 60
 	public static function instance() {
61
-		return parent::get_instance( __CLASS__ );
61
+		return parent::get_instance(__CLASS__);
62 62
 	}
63 63
 
64 64
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function set_hooks() {
75 75
 		//actions
76
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
77
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 );
76
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
77
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2);
78 78
 		//filters
79
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
80
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
79
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
80
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
81 81
 		//register routes
82 82
 		self::_register_routes();
83 83
 	}
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public static function set_hooks_admin() {
92 92
 		//actions
93
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
94
-		add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder'), 10 );
95
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 );
96
-		add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message'), 10, 2 );
97
-		add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 );
93
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
94
+		add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10);
95
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3);
96
+		add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2);
97
+		add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10);
98 98
 		//filters
99
-		add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', array( 'EED_Messages', 'process_admin_payment'), 10, 2 );
100
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
101
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
99
+		add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', array('EED_Messages', 'process_admin_payment'), 10, 2);
100
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
101
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
102 102
 	}
103 103
 
104 104
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @return void
113 113
 	 */
114 114
 	protected static function _register_routes() {
115
-		EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' );
116
-		do_action( 'AHEE__EED_Messages___register_routes' );
115
+		EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
116
+		do_action('AHEE__EED_Messages___register_routes');
117 117
 	}
118 118
 
119 119
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @throws EE_Error
127 127
 	 * @return    void
128 128
 	 */
129
-	public function run( $WP ) {
129
+	public function run($WP) {
130 130
 
131 131
 		$sending_messenger = EE_Registry::instance()->REQ->is_set('snd_msgr') ? EE_Registry::instance()->REQ->get('snd_msgr') : '';
132 132
 		$generating_messenger = EE_Registry::instance()->REQ->is_set('gen_msgr') ? EE_Registry::instance()->REQ->get('gen_msgr') : '';
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 		$data_id = EE_Registry::instance()->REQ->is_set('id') ? (int) EE_Registry::instance()->REQ->get('id') : 0;
137 137
 
138 138
 		//verify the needed params are present.
139
-		if ( empty( $sending_messenger ) || empty( $generating_messenger ) || empty( $message_type ) || empty( $context ) || empty( $token ) ) {
140
-			EE_Error::add_error( __( 'The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
139
+		if (empty($sending_messenger) || empty($generating_messenger) || empty($message_type) || empty($context) || empty($token)) {
140
+			EE_Error::add_error(__('The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
141 141
 			return;
142 142
 		}
143 143
 		//get the registration: the token will always be the unique REG_url_link saved with a registration.  We use that to make sure we retrieve the correct data for the given registration.
144
-		$registration = EEM_Registration::instance()->get_one( array( array( 'REG_url_link' => $token ) ) );
144
+		$registration = EEM_Registration::instance()->get_one(array(array('REG_url_link' => $token)));
145 145
 		//if no registration then bail early.
146
-		if ( ! $registration instanceof EE_Registration ) {
147
-			EE_Error::add_error( __( 'Unable to complete the request because the token is invalid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
146
+		if ( ! $registration instanceof EE_Registration) {
147
+			EE_Error::add_error(__('Unable to complete the request because the token is invalid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
148 148
 			return;
149 149
 		}
150 150
 		//ensure controller is loaded
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 			// retrieve the data via the handler
155 155
 			//  Depending on the context and the message type data handler, the data_id will correspond to the specific data handler item we need to retrieve for specific messages
156 156
 			// (i.e. a specific payment or specific refund).
157
-			$data = $this->_get_messages_data_from_url( $generating_messenger, $message_type, $registration, $data_id, $context );
157
+			$data = $this->_get_messages_data_from_url($generating_messenger, $message_type, $registration, $data_id, $context);
158 158
 			//make sure we drop generating messenger if both sending and generating are the same.
159 159
 			$generating_messenger = $sending_messenger != $generating_messenger ? $generating_messenger : NULL;
160 160
 			//now we can trigger the actual sending of the message via the message type.
161
-			self::$_EEMSG->send_message( $message_type, $data, $sending_messenger, $generating_messenger, $context );
162
-		} catch ( EE_Error $e ) {
163
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
161
+			self::$_EEMSG->send_message($message_type, $data, $sending_messenger, $generating_messenger, $context);
162
+		} catch (EE_Error $e) {
163
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
164 164
 			// add specific message for developers if WP_DEBUG in on
165
-			$error_msg .= '||' . $e->getMessage();
166
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
165
+			$error_msg .= '||'.$e->getMessage();
166
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
167 167
 		}
168 168
 	}
169 169
 
@@ -178,17 +178,17 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @return EE_Messages_Template_Pack
180 180
 	 */
181
-	public static function get_template_pack( $template_pack_name ) {
182
-		if ( isset( self::$_TMP_PACKS[$template_pack_name] ) ) {
181
+	public static function get_template_pack($template_pack_name) {
182
+		if (isset(self::$_TMP_PACKS[$template_pack_name])) {
183 183
 			return self::$_TMP_PACKS[$template_pack_name];
184 184
 		}
185 185
 
186 186
 		//not set yet so let's attempt to get it.
187
-		$pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template_pack_name ) ) );
187
+		$pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template_pack_name)));
188 188
 
189
-		if ( ! class_exists( $pack_class ) ) {
189
+		if ( ! class_exists($pack_class)) {
190 190
 			$pack_class = 'EE_Messages_Template_Pack_Default';
191
-			self::$_TMP_PACKS['default'] = empty( self::$_TMP_PACKS['default'] ) ? new $pack_class : self::$_TMP_PACKS['default'];
191
+			self::$_TMP_PACKS['default'] = empty(self::$_TMP_PACKS['default']) ? new $pack_class : self::$_TMP_PACKS['default'];
192 192
 			return self::$_TMP_PACKS['default'];
193 193
 		} else {
194 194
 			$pack = new $pack_class;
@@ -208,27 +208,27 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public static function get_template_packs() {
210 210
 		//glob the defaults directory for messages
211
-		$templates = glob( EE_LIBRARIES . 'messages/defaults/*', GLOB_ONLYDIR );
211
+		$templates = glob(EE_LIBRARIES.'messages/defaults/*', GLOB_ONLYDIR);
212 212
 		$template_packs = array();
213
-		foreach( $templates as $template_path ) {
213
+		foreach ($templates as $template_path) {
214 214
 			//grab folder name
215
-			$template = basename( $template_path );
215
+			$template = basename($template_path);
216 216
 
217 217
 			//is this already set?
218
-			if ( isset( self::$_TMP_PACKS[$template] ) )
218
+			if (isset(self::$_TMP_PACKS[$template]))
219 219
 				continue;
220 220
 
221 221
 			//setup classname.
222
-			$pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) );
222
+			$pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template)));
223 223
 
224
-			if ( ! class_exists( $pack_class ) )
224
+			if ( ! class_exists($pack_class))
225 225
 				continue;
226 226
 
227 227
 			$template_packs[$template] = new $pack_class;
228 228
 		}
229 229
 
230
-		$template_packs = apply_filters( 'FHEE__EED_Messages__get_template_packs__template_packs', $template_packs );
231
-		self::$_TMP_PACKS = array_merge( self::$_TMP_PACKS, $template_packs );
230
+		$template_packs = apply_filters('FHEE__EED_Messages__get_template_packs__template_packs', $template_packs);
231
+		self::$_TMP_PACKS = array_merge(self::$_TMP_PACKS, $template_packs);
232 232
 		return self::$_TMP_PACKS;
233 233
 	}
234 234
 
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @return mixed  (EE_Base_Class||EE_Base_Class[])
252 252
 	 */
253
-	protected function _get_messages_data_from_url( $generating_messenger, $message_type, EE_Registration $registration, $data_id, $context ) {
253
+	protected function _get_messages_data_from_url($generating_messenger, $message_type, EE_Registration $registration, $data_id, $context) {
254 254
 		//get message type object then get the correct data setup for that message type.
255
-		$message_type = self::$_EEMSG->get_active_message_type( $generating_messenger, $message_type );
255
+		$message_type = self::$_EEMSG->get_active_message_type($generating_messenger, $message_type);
256 256
 		//if no message type then it likely isn't active for this messenger.
257
-		if ( ! $message_type instanceof EE_message_type ) {
258
-			throw new EE_Error( sprintf( __('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger ) );
257
+		if ( ! $message_type instanceof EE_message_type) {
258
+			throw new EE_Error(sprintf(__('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger));
259 259
 		}
260 260
 		//get data according to data handler requirements
261
-		return $message_type->get_data_for_context( $context, $registration, $data_id );
261
+		return $message_type->get_data_for_context($context, $registration, $data_id);
262 262
 	}
263 263
 
264 264
 
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 	 * @return void
272 272
 	 */
273 273
 	public static function set_autoloaders() {
274
-		if ( empty( self::$_MSG_PATHS ) ) {
274
+		if (empty(self::$_MSG_PATHS)) {
275 275
 			self::_set_messages_paths();
276 276
 			EE_Registry::instance()->load_helper('Autoloader');
277
-			foreach ( self::$_MSG_PATHS as $path ) {
278
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path );
277
+			foreach (self::$_MSG_PATHS as $path) {
278
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
279 279
 			}
280 280
 		}
281 281
 	}
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 			'shortcodes'
306 306
 			);
307 307
 		$paths = array();
308
-		foreach ( $dir_ref as $index => $dir ) {
309
-			$paths[$index] = EE_LIBRARIES . $dir;
308
+		foreach ($dir_ref as $index => $dir) {
309
+			$paths[$index] = EE_LIBRARIES.$dir;
310 310
 		}
311
-		self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths );
311
+		self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths);
312 312
 	}
313 313
 
314 314
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * @return void
321 321
 	 */
322 322
 	protected static function _load_controller() {
323
-		if ( ! self::$_EEMSG instanceof EE_messages ) {
323
+		if ( ! self::$_EEMSG instanceof EE_messages) {
324 324
 			self::set_autoloaders();
325 325
 			self::$_EEMSG = new EE_messages();
326 326
 		}
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 	/**
332 332
 	 * @param EE_Transaction $transaction
333 333
 	 */
334
-	public static function payment_reminder( EE_Transaction $transaction ) {
334
+	public static function payment_reminder(EE_Transaction $transaction) {
335 335
 		self::_load_controller();
336
-		$data = array( $transaction, null );
337
-		if ( self::$_EEMSG->send_message( 'payment_reminder', $data ) ) {
336
+		$data = array($transaction, null);
337
+		if (self::$_EEMSG->send_message('payment_reminder', $data)) {
338 338
 			//self::log(
339 339
 			//	__CLASS__, __FUNCTION__, __LINE__,
340 340
 			//	$transaction,
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 	 * @param  EE_Payment object
356 356
 	 * @return void
357 357
 	 */
358
-	public static function payment( EE_Transaction $transaction, EE_Payment $payment ) {
358
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment) {
359 359
 		self::_load_controller();
360
-		$data = array( $transaction, $payment );
360
+		$data = array($transaction, $payment);
361 361
 
362
-		$message_type = self::_get_payment_message_type( $payment->STS_ID() );
362
+		$message_type = self::_get_payment_message_type($payment->STS_ID());
363 363
 
364 364
 		//if payment amount is less than 0 then switch to payment_refund message type.
365 365
 		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -367,15 +367,15 @@  discard block
 block discarded – undo
367 367
 		//verify this message type is present and active.  If it isn't then no message is sent.
368 368
 		$active_mts = self::$_EEMSG->get_active_message_types();
369 369
 
370
-		$message_type = in_array( $message_type, $active_mts ) ? $message_type : false;
371
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, current_time( 'mysql' ), 'delivered' );
372
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $message_type, '$message_type' );
373
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' );
374
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $payment->status(), '$payment->status()' );
375
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, print_r( $active_mts, true ), '$active_mts' );
370
+		$message_type = in_array($message_type, $active_mts) ? $message_type : false;
371
+		do_action('AHEE_log', __FILE__, __FUNCTION__, current_time('mysql'), 'delivered');
372
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $message_type, '$message_type');
373
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()');
374
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $payment->status(), '$payment->status()');
375
+		do_action('AHEE_log', __FILE__, __FUNCTION__, print_r($active_mts, true), '$active_mts');
376 376
 
377
-		if ( $message_type ) {
378
-			if ( self::$_EEMSG->send_message( $message_type, $data ) ) {
377
+		if ($message_type) {
378
+			if (self::$_EEMSG->send_message($message_type, $data)) {
379 379
 				//self::log(
380 380
 				//	__CLASS__, __FUNCTION__, __LINE__,
381 381
 				//	$transaction,
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
 	/**
396 396
 	 * @param EE_Transaction $transaction
397 397
 	 */
398
-	public static function cancelled_registration( EE_Transaction $transaction ) {
398
+	public static function cancelled_registration(EE_Transaction $transaction) {
399 399
 		self::_load_controller();
400 400
 
401
-		$data = array( $transaction, NULL );
401
+		$data = array($transaction, NULL);
402 402
 
403 403
 		$active_mts = self::$_EEMSG->get_active_message_types();
404 404
 
405
-		if ( in_array( 'cancelled_registration', $active_mts ) ) {
406
-			self::$_EEMSG->send_message( 'cancelled_registration', $data );
405
+		if (in_array('cancelled_registration', $active_mts)) {
406
+			self::$_EEMSG->send_message('cancelled_registration', $data);
407 407
 		}
408 408
 		return;
409 409
 	}
@@ -418,15 +418,15 @@  discard block
 block discarded – undo
418 418
 	 * @param array $extra_details
419 419
 	 * @return void
420 420
 	 */
421
-	public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) {
421
+	public static function maybe_registration(EE_Registration $registration, $extra_details = array()) {
422 422
 
423
-		if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) {
423
+		if ( ! self::_verify_registration_notification_send($registration, $extra_details)) {
424 424
 			//no messages please
425 425
 			return;
426 426
 		}
427 427
 
428 428
 
429
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
429
+		EE_Registry::instance()->load_helper('MSG_Template');
430 430
 
431 431
 		//get all registrations so we make sure we send messages for the right status.
432 432
 		$all_registrations = $registration->transaction()->registrations();
@@ -435,19 +435,19 @@  discard block
 block discarded – undo
435 435
 		$statuses_sent = array();
436 436
 
437 437
 		//loop through registrations and trigger messages once per status.
438
-		foreach ( $all_registrations as $reg ) {
438
+		foreach ($all_registrations as $reg) {
439 439
 
440 440
 			//already triggered?
441
-			if ( in_array( $reg->status_ID(), $statuses_sent ) ) {
441
+			if (in_array($reg->status_ID(), $statuses_sent)) {
442 442
 				continue;
443 443
 			}
444 444
 
445
-			$message_type = self::_get_reg_status_array( $reg->status_ID() );
446
-			if ( EEH_MSG_Template::is_mt_active( $message_type ) ) {
445
+			$message_type = self::_get_reg_status_array($reg->status_ID());
446
+			if (EEH_MSG_Template::is_mt_active($message_type)) {
447 447
 				self::_load_controller();
448 448
 
449 449
 				//send away, send away, uhhuh
450
-				if ( self::$_EEMSG->send_message( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ) ) {
450
+				if (self::$_EEMSG->send_message($message_type, array($registration->transaction(), null, $reg->status_ID()))) {
451 451
 					// DEBUG LOG
452 452
 					// self::log(
453 453
 					// 	__CLASS__, __FUNCTION__, __LINE__,
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 		}
467 467
 
468 468
 		//now send summary (registration_summary) if active
469
-		if ( EEH_MSG_Template::is_mt_active( 'registration_summary' ) ) {
469
+		if (EEH_MSG_Template::is_mt_active('registration_summary')) {
470 470
 			self::_load_controller();
471
-			if ( self::$_EEMSG->send_message( 'registration_summary', array( $registration->transaction(), null ) ) ) {
471
+			if (self::$_EEMSG->send_message('registration_summary', array($registration->transaction(), null))) {
472 472
 					// DEBUG LOG
473 473
 					// self::log(
474 474
 					// 	__CLASS__, __FUNCTION__, __LINE__,
@@ -494,18 +494,18 @@  discard block
 block discarded – undo
494 494
 	 *
495 495
 	 * @return bool          true = send away, false = nope halt the presses.
496 496
 	 */
497
-	protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) {
497
+	protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) {
498 498
 		 //self::log(
499 499
 		 //	__CLASS__, __FUNCTION__, __LINE__,
500 500
 		 //	$registration->transaction(),
501 501
 		 //	array( '$extra_details' => $extra_details )
502 502
 		 //);
503 503
 		// currently only using this to send messages for the primary registrant
504
-		if ( ! $registration->is_primary_registrant() ) {
504
+		if ( ! $registration->is_primary_registrant()) {
505 505
 			return false;
506 506
 		}
507 507
 		if (
508
-			! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) &&
508
+			! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) &&
509 509
 			$registration->status_ID() !== EEM_Registration::status_id_not_approved
510 510
 		) {
511 511
 			return false;
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 * @param string $reg_status
523 523
 	 * @return array
524 524
 	 */
525
-	protected static function _get_reg_status_array( $reg_status = '' ) {
525
+	protected static function _get_reg_status_array($reg_status = '') {
526 526
 		$reg_status_array = array(
527 527
 			EEM_Registration::status_id_approved => 'registration',
528 528
 			EEM_Registration::status_id_pending_payment => 'pending_approval',
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 			EEM_Registration::status_id_cancelled => 'cancelled_registration',
531 531
 			EEM_Registration::status_id_declined => 'declined_registration'
532 532
 		);
533
-		return isset( $reg_status_array[ $reg_status ] ) ? $reg_status_array[ $reg_status ] : $reg_status_array;
533
+		return isset($reg_status_array[$reg_status]) ? $reg_status_array[$reg_status] : $reg_status_array;
534 534
 	}
535 535
 
536 536
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 	 *
543 543
 	 * @return string|bool The payment message type slug matching the status or false if no match.
544 544
 	 */
545
-	protected static function _get_payment_message_type( $payment_status ) {
545
+	protected static function _get_payment_message_type($payment_status) {
546 546
 		$matches = array(
547 547
 			EEM_Payment::status_id_approved => 'payment',
548 548
 			EEM_Payment::status_id_pending => 'payment_pending',
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			EEM_Payment::status_id_failed => 'payment_failed'
552 552
 			);
553 553
 
554
-		return isset( $matches[$payment_status] ) ? $matches[$payment_status] : false;
554
+		return isset($matches[$payment_status]) ? $matches[$payment_status] : false;
555 555
 	}
556 556
 
557 557
 
@@ -564,22 +564,22 @@  discard block
 block discarded – undo
564 564
 	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
565 565
 	 * @return bool          success/fail
566 566
 	 */
567
-	public static function process_resend( $req_data ) {
567
+	public static function process_resend($req_data) {
568 568
 		$regs_to_send = array();
569 569
 
570 570
 		//first let's make sure we have the reg id (needed for resending!);
571
-		if ( ! isset( $req_data['_REG_ID'] ) ) {
572
-			EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
571
+		if ( ! isset($req_data['_REG_ID'])) {
572
+			EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
573 573
 			return false;
574 574
 		}
575 575
 
576 576
 		//if $req_data['_REG_ID'] is an array then let's group the registrations by transaction and reg status
577 577
 		// so we can only trigger messages per group.
578
-		if ( is_array( $req_data['_REG_ID'] ) ) {
579
-			foreach ( $req_data['_REG_ID'] as $reg_id ) {
580
-				$reg = EE_Registry::instance()->load_model( 'Registration' )->get_one_by_ID( $reg_id );
581
-				if ( ! $reg instanceof EE_Registration ) {
582
-					EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) );
578
+		if (is_array($req_data['_REG_ID'])) {
579
+			foreach ($req_data['_REG_ID'] as $reg_id) {
580
+				$reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($reg_id);
581
+				if ( ! $reg instanceof EE_Registration) {
582
+					EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID']));
583 583
 					return false;
584 584
 				}
585 585
 				$regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg;
@@ -587,11 +587,11 @@  discard block
 block discarded – undo
587 587
 		} else {
588 588
 			//we have a single registration id, so let's see if we can get a EE_Registration from it, and if so set it up for sending.
589 589
 			//get reg object from reg_id
590
-			$reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID( $req_data['_REG_ID'] );
590
+			$reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($req_data['_REG_ID']);
591 591
 
592 592
 			//if no reg object then send error
593
-			if ( ! $reg instanceof EE_Registration ) {
594
-				EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) );
593
+			if ( ! $reg instanceof EE_Registration) {
594
+				EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID']));
595 595
 				return false;
596 596
 			}
597 597
 
@@ -603,26 +603,26 @@  discard block
 block discarded – undo
603 603
 		$active_mts = self::$_EEMSG->get_active_message_types();
604 604
 		$success = false;
605 605
 		//loop through and send!
606
-		foreach( $regs_to_send as $status_group ) {
607
-			foreach ( $status_group as $status_id => $registrations ) {
608
-				if ( ! in_array( $status_match_array[ $status_id ], $active_mts ) ) {
606
+		foreach ($regs_to_send as $status_group) {
607
+			foreach ($status_group as $status_id => $registrations) {
608
+				if ( ! in_array($status_match_array[$status_id], $active_mts)) {
609 609
 					EE_Error::add_error(
610 610
 						sprintf(
611 611
 							__('Cannot resend the message for this registration because the corresponding message type (%1$s) is not active.  If you wish to send messages for this message type then please activate it by visiting the %2$sMessages Admin Page%3$s.', 'event_espresso'),
612
-							$status_match_array[ $reg->status_ID() ],
613
-							'<a href="' . admin_url('admin.php?page=espresso_messages&action=settings') . '">',
612
+							$status_match_array[$reg->status_ID()],
613
+							'<a href="'.admin_url('admin.php?page=espresso_messages&action=settings').'">',
614 614
 							'</a>'
615 615
 						)
616 616
 					);
617 617
 					return false;
618 618
 				}
619 619
 
620
-				if ( self::$_EEMSG->send_message( $status_match_array[$status_id], array( $registrations, $status_id ) ) ) {
620
+				if (self::$_EEMSG->send_message($status_match_array[$status_id], array($registrations, $status_id))) {
621 621
 					EE_Error::overwrite_success();
622
-					EE_Error::add_success( __('The message for this registration has been re-sent', 'event_espresso') );
622
+					EE_Error::add_success(__('The message for this registration has been re-sent', 'event_espresso'));
623 623
 					$success = true;
624 624
 				} else {
625
-					EE_Error::add_error( __('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
625
+					EE_Error::add_error(__('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
626 626
 				}
627 627
 			}
628 628
 		}
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
 	 * @param  EE_Payment $payment EE_payment object
645 645
 	 * @return bool              success/fail
646 646
 	 */
647
-	public static function process_admin_payment( $success = TRUE, EE_Payment $payment ) {
647
+	public static function process_admin_payment($success = TRUE, EE_Payment $payment) {
648 648
 		//we need to get the transaction object
649 649
 		$transaction = $payment->transaction();
650
-		if ( $transaction instanceof EE_Transaction ) {
651
-			$data = array( $transaction, $payment );
652
-			$message_type = self::_get_payment_message_type( $payment->STS_ID() );
650
+		if ($transaction instanceof EE_Transaction) {
651
+			$data = array($transaction, $payment);
652
+			$message_type = self::_get_payment_message_type($payment->STS_ID());
653 653
 
654 654
 			//if payment amount is less than 0 then switch to payment_refund message type.
655 655
 			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -660,18 +660,18 @@  discard block
 block discarded – undo
660 660
 			self::_load_controller();
661 661
 			//verify this message type is present and active.  If it isn't then no message is sent.
662 662
 			$active_mts = self::$_EEMSG->get_active_message_types();
663
-			$message_type = in_array( $message_type, $active_mts ) ? $message_type : false;
663
+			$message_type = in_array($message_type, $active_mts) ? $message_type : false;
664 664
 
665 665
 
666
-			if ( $message_type ) {
666
+			if ($message_type) {
667 667
 
668
-				$success = self::$_EEMSG->send_message( $message_type, $data );
669
-				if ( ! $success ) {
670
-					EE_Error::add_error( __('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
668
+				$success = self::$_EEMSG->send_message($message_type, $data);
669
+				if ( ! $success) {
670
+					EE_Error::add_error(__('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
671 671
 				}
672 672
 
673 673
 			} else {
674
-				EE_Error::add_error( __('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
674
+				EE_Error::add_error(__('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
675 675
 			}
676 676
 
677 677
 		}
@@ -689,12 +689,12 @@  discard block
 block discarded – undo
689 689
 	 * @param  int      	      $grp_id     a specific message template group id.
690 690
 	 * @return void
691 691
 	 */
692
-	public static function send_newsletter_message( $registrations, $grp_id ) {
692
+	public static function send_newsletter_message($registrations, $grp_id) {
693 693
 		//make sure mtp is id and set it in the EE_Request Handler later messages setup.
694
-		EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id );
694
+		EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id);
695 695
 
696 696
 		self::_load_controller();
697
-		self::$_EEMSG->send_message( 'newsletter', $registrations );
697
+		self::$_EEMSG->send_message('newsletter', $registrations);
698 698
 	}
699 699
 
700 700
 
@@ -709,10 +709,10 @@  discard block
 block discarded – undo
709 709
 	 * @param string 	$message_type
710 710
 	 * @return 	string
711 711
 	 */
712
-	public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) {
712
+	public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') {
713 713
 		EE_Registry::instance()->load_helper('MSG_Template');
714 714
 		// whitelist $messenger
715
-		switch ( $messenger ) {
715
+		switch ($messenger) {
716 716
 			case 'pdf' :
717 717
 				$sending_messenger = 'pdf';
718 718
 				$generating_messenger = 'html';
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 				break;
725 725
 		}
726 726
 		// whitelist $message_type
727
-		switch ( $message_type ) {
727
+		switch ($message_type) {
728 728
 			case 'receipt' :
729 729
 				$message_type = 'receipt';
730 730
 				break;
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 				break;
735 735
 		}
736 736
 		// verify that both the messenger AND the message type are active
737
-		if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type )) {
737
+		if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) {
738 738
 			//need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
739 739
 			$template_query_params = array(
740 740
 				'MTP_is_active' => TRUE,
@@ -743,16 +743,16 @@  discard block
 block discarded – undo
743 743
 				'Event.EVT_ID' => $registration->event_ID()
744 744
 			);
745 745
 			//get the message template group.
746
-			$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ));
746
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
747 747
 			//if we don't have an EE_Message_Template_Group then return
748
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
748
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
749 749
 				// remove EVT_ID from query params so that global templates get picked up
750
-				unset( $template_query_params[ 'Event.EVT_ID' ] );
750
+				unset($template_query_params['Event.EVT_ID']);
751 751
 				//get global template as the fallback
752
-				$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ));
752
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
753 753
 			}
754 754
 			//if we don't have an EE_Message_Template_Group then return
755
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
755
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
756 756
 				return '';
757 757
 			}
758 758
 			// generate the URL
@@ -782,17 +782,17 @@  discard block
 block discarded – undo
782 782
 	 * @param array $info
783 783
 	 * @param bool $display_request
784 784
 	 */
785
-	protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
785
+	protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
786 786
 		EE_Registry::instance()->load_helper('Debug_Tools');
787
-		if ( WP_DEBUG && false ) {
788
-			if ( $transaction instanceof EE_Transaction ) {
787
+		if (WP_DEBUG && false) {
788
+			if ($transaction instanceof EE_Transaction) {
789 789
 				// don't serialize objects
790
-				$info = EEH_Debug_Tools::strip_objects( $info );
791
-				$info[ 'TXN_status' ] = $transaction->status_ID();
792
-				$info[ 'TXN_reg_steps' ] = $transaction->reg_steps();
793
-				if ( $transaction->ID() ) {
794
-					$index = 'EE_Transaction: ' . $transaction->ID();
795
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
790
+				$info = EEH_Debug_Tools::strip_objects($info);
791
+				$info['TXN_status'] = $transaction->status_ID();
792
+				$info['TXN_reg_steps'] = $transaction->reg_steps();
793
+				if ($transaction->ID()) {
794
+					$index = 'EE_Transaction: '.$transaction->ID();
795
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
796 796
 				}
797 797
 			}
798 798
 		}
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function __construct() {
24 24
 		$this->name = 'newsletter';
25
-		$this->description = __( 'Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso' );
25
+		$this->description = __('Newsletter message types are triggered manually by the admin for sending mass email to select groups of registrants.', 'event_espresso');
26 26
 		$this->label = array(
27
-			'singular' => __( 'newsletter', 'event_espresso' ),
28
-			'plural' => __( 'newsletters', 'event_espresso' )
27
+			'singular' => __('newsletter', 'event_espresso'),
28
+			'plural' => __('newsletters', 'event_espresso')
29 29
 			);
30 30
 		$this->_master_templates = array(
31 31
 			'email' => 'registration',
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 
52
-	protected function _get_data_for_context( $context, EE_Registration $registration, $id ) {
52
+	protected function _get_data_for_context($context, EE_Registration $registration, $id) {
53 53
 		//newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
54
-		return array( $registration );
54
+		return array($registration);
55 55
 	}
56 56
 
57 57
 
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 
65 65
 	protected function _set_contexts() {
66 66
 		$this->_context_label = array(
67
-			'label' => __( 'recipient', 'event_espresso' ),
68
-			'plural' => __( 'recipients', 'event_espresso' ),
69
-			'description' => __( 'Recipient\'s are who will receive the message.', 'event_espresso' )
67
+			'label' => __('recipient', 'event_espresso'),
68
+			'plural' => __('recipients', 'event_espresso'),
69
+			'description' => __('Recipient\'s are who will receive the message.', 'event_espresso')
70 70
 			);
71 71
 
72 72
 		$this->_contexts = array(
73 73
 			'attendee' => array(
74
-				'label' => __( 'Registrant', 'event_espresso' ),
75
-				'description' => __( 'This template goes to selected registrants.', 'event_espresso' )
74
+				'label' => __('Registrant', 'event_espresso'),
75
+				'description' => __('This template goes to selected registrants.', 'event_espresso')
76 76
 				)
77 77
 			);
78 78
 	}
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 			'newsletter',
99 99
 			);
100 100
 
101
-		foreach ( $this->_valid_shortcodes as $context => $shortcodes ) {
102
-			foreach ( $shortcodes as $key => $shortcode ) {
103
-				if ( ! in_array( $shortcode, $included_shortcodes ) ) {
104
-					unset( $this->_valid_shortcodes[ $context ][ $key ] );
101
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
102
+			foreach ($shortcodes as $key => $shortcode) {
103
+				if ( ! in_array($shortcode, $included_shortcodes)) {
104
+					unset($this->_valid_shortcodes[$context][$key]);
105 105
 				}
106 106
 			}
107
-			$this->_valid_shortcodes[ $context ][] = 'newsletter';
107
+			$this->_valid_shortcodes[$context][] = 'newsletter';
108 108
 		}
109 109
 
110 110
 	}
@@ -118,44 +118,44 @@  discard block
 block discarded – undo
118 118
 		$addressee = array();
119 119
 
120 120
 		//looping through registrations
121
-		foreach ( $this->_data->registrations as $reg_id => $details ) {
121
+		foreach ($this->_data->registrations as $reg_id => $details) {
122 122
 			//set $attendee array to blank on each loop
123 123
 			$aee = array();
124 124
 
125 125
 			//need to get the attendee from this registration.
126
-			$attendee = isset( $details['att_obj'] ) && $details['att_obj'] instanceof EE_Attendee
126
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
127 127
 				? $details['att_obj']
128 128
 				: null;
129 129
 
130
-			if ( ! $attendee instanceof EE_Attendee ) {
130
+			if ( ! $attendee instanceof EE_Attendee) {
131 131
 				continue;
132 132
 			}
133 133
 
134 134
 			//set $aee from attendee object
135 135
 			$aee['att_obj'] = $attendee;
136
-			$aee['reg_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['reg_objs'] )
137
-				? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
136
+			$aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
137
+				? $this->_data->attendees[$attendee->ID()]['reg_objs']
138 138
 				: array();
139 139
 			$aee['attendee_email'] = $attendee->email();
140
-			$aee['tkt_objs'] = isset( $this->_data->attendees[ $attendee->ID() ]['tkt_objs'] )
141
-				? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
140
+			$aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
141
+				? $this->_data->attendees[$attendee->ID()]['tkt_objs']
142 142
 				: array();
143 143
 
144
-			if ( isset( $this->_data->attendees[ $attendee->ID() ]['evt_objs'] ) ) {
145
-				$aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
146
-				$aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
144
+			if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
145
+				$aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
146
+				$aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
147 147
 			} else {
148 148
 				$aee['evt_objs'] = $aee['events'] = array();
149 149
 			}
150 150
 
151
-			$aee['reg_obj'] = isset( $details['reg_obj'] )
151
+			$aee['reg_obj'] = isset($details['reg_obj'])
152 152
 				? $details['reg_obj']
153 153
 				: null;
154 154
 			$aee['attendees'] = $this->_data->attendees;
155 155
 
156 156
 			//merge in the primary attendee data
157
-			$aee = array_merge( $this->_default_addressee_data, $aee );
158
-			$addressee[] = new EE_Messages_Addressee( $aee );
157
+			$aee = array_merge($this->_default_addressee_data, $aee);
158
+			$addressee[] = new EE_Messages_Addressee($aee);
159 159
 		}
160 160
 		return $addressee;
161 161
 	}
Please login to merge, or discard this patch.
messages/data_class/EE_Messages_Registrations_incoming_data.class.php 2 patches
Spacing   +5 added lines, -5 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' ) ) exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3 3
 
4 4
 /**
5 5
  * This prepares data for message types that send messages for multiple registrations (that could span multiple transactions)
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	 * @throws EE_Error
21 21
 	 * @access protected
22 22
 	 */
23
-	public function __construct( $data = array() ) {
23
+	public function __construct($data = array()) {
24 24
 
25 25
 		//validate that the first element in the array is an EE_Registration object.
26
-		if ( ! reset( $data ) instanceof EE_Registration ) {
27
-			throw new EE_Error( __( 'The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso' ) );
26
+		if ( ! reset($data) instanceof EE_Registration) {
27
+			throw new EE_Error(__('The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso'));
28 28
 		}
29
-		parent::__construct( $data );
29
+		parent::__construct($data);
30 30
 	}
31 31
 
32 32
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) exit( 'No direct script access allowed' );
2
+if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
+	exit( 'No direct script access allowed' );
4
+}
3 5
 
4 6
 /**
5 7
  * This prepares data for message types that send messages for multiple registrations (that could span multiple transactions)
Please login to merge, or discard this patch.
core/libraries/messages/data_class/EE_Messages_incoming_data.core.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -347,7 +347,7 @@
 block discarded – undo
347 347
 				$total_ticket_count++;
348 348
 				$tickets[ $ticket->ID() ]['ticket'] = $ticket;
349 349
 				$tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] )
350
-				                                     && isset( $tickets[ $ticket->ID() ]['count'] )
350
+													 && isset( $tickets[ $ticket->ID() ]['count'] )
351 351
 					? $tickets[ $ticket->ID() ]['count'] + 1
352 352
 					: 1;
353 353
 				$tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @param mixed $data incoming data object|array.  Suggested that child classes use type hinting for expected
287 287
 	 * data object.  But here parent will be generic because we don't know what's coming in.
288 288
 	 */
289
-	public function __construct( $data ) {
289
+	public function __construct($data) {
290 290
 		$this->_data = $data;
291 291
 		$this->_setup_data();
292 292
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	protected function _assemble_data() {
322 322
 		//verify that reg_objs is set
323 323
 		if (
324
-			! is_array( $this->reg_objs )
325
-			&& ! reset( $this->reg_objs ) instanceof EE_Registration
324
+			! is_array($this->reg_objs)
325
+			&& ! reset($this->reg_objs) instanceof EE_Registration
326 326
 		) {
327 327
 			throw new EE_Error(
328 328
 				__(
@@ -337,82 +337,82 @@  discard block
 block discarded – undo
337 337
 		$answers = $questions = $attendees = $line_items = $registrations = array();
338 338
 		$total_ticket_count = 0;
339 339
 
340
-		if ( ! empty( $this->reg_objs ) ) {
340
+		if ( ! empty($this->reg_objs)) {
341 341
 			$event_attendee_count = array();
342
-			foreach ( $this->reg_objs as $reg ) {
342
+			foreach ($this->reg_objs as $reg) {
343 343
 				//account for filtered registrations by status.
344
-				if ( ! empty( $this->filtered_reg_status ) && $this->filtered_reg_status !== $reg->status_ID() ) {
344
+				if ( ! empty($this->filtered_reg_status) && $this->filtered_reg_status !== $reg->status_ID()) {
345 345
 					continue;
346 346
 				}
347 347
 
348 348
 				$evt_id = $reg->event_ID();
349 349
 				/** @type EE_Ticket $ticket */
350
-				$ticket = $reg->get_first_related( 'Ticket' );
350
+				$ticket = $reg->get_first_related('Ticket');
351 351
 				$relateddatetime = $ticket->datetimes();
352 352
 				$total_ticket_count++;
353
-				$tickets[ $ticket->ID() ]['ticket'] = $ticket;
354
-				$tickets[ $ticket->ID() ]['count'] = is_array( $tickets[ $ticket->ID() ] )
355
-				                                     && isset( $tickets[ $ticket->ID() ]['count'] )
356
-					? $tickets[ $ticket->ID() ]['count'] + 1
353
+				$tickets[$ticket->ID()]['ticket'] = $ticket;
354
+				$tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()])
355
+				                                     && isset($tickets[$ticket->ID()]['count'])
356
+					? $tickets[$ticket->ID()]['count'] + 1
357 357
 					: 1;
358
-				$tickets[ $ticket->ID() ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee();
359
-				$tickets[ $ticket->ID() ]['dtt_objs'] = $relateddatetime;
360
-				$tickets[ $ticket->ID() ]['reg_objs'][ $reg->ID() ] = $reg;
358
+				$tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee();
359
+				$tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime;
360
+				$tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg;
361 361
 				$event = $reg->event();
362
-				$tickets[ $ticket->ID() ]['EE_Event'] = $event;
363
-				$evtcache[ $evt_id ] = $event;
364
-				$eventsetup[ $evt_id ]['reg_objs'][ $reg->ID() ] = $reg;
365
-				$eventsetup[ $evt_id ]['tkt_objs'][ $ticket->ID() ] = $ticket;
366
-				$eventsetup[ $evt_id ]['att_objs'][ $reg->attendee_ID() ] = $reg->attendee();
367
-				$event_attendee_count[ $evt_id ] = isset( $event_attendee_count[ $evt_id ] )
368
-					? $event_attendee_count[ $evt_id ] + 1
362
+				$tickets[$ticket->ID()]['EE_Event'] = $event;
363
+				$evtcache[$evt_id] = $event;
364
+				$eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg;
365
+				$eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket;
366
+				$eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee();
367
+				$event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id])
368
+					? $event_attendee_count[$evt_id] + 1
369 369
 					: 0;
370
-				$attendees[ $reg->attendee_ID() ]['line_ref'][] = $evt_id;
371
-				$attendees[ $reg->attendee_ID() ]['att_obj'] = $reg->attendee();
372
-				$attendees[ $reg->attendee_ID() ]['reg_objs'][ $reg->ID() ] = $reg;
370
+				$attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id;
371
+				$attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee();
372
+				$attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg;
373 373
 				//$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID();
374
-				$attendees[ $reg->attendee_ID() ]['attendee_email'] = $reg->attendee() instanceof EE_Attendee
374
+				$attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee
375 375
 					? $reg->attendee()->email()
376 376
 					: '';
377
-				$attendees[ $reg->attendee_ID() ]['tkt_objs'][ $ticket->ID() ] = $ticket;
378
-				$attendees[ $reg->attendee_ID() ]['evt_objs'][ $evt_id ] = $event;
377
+				$attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket;
378
+				$attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event;
379 379
 
380 380
 				//registrations
381
-				$registrations[ $reg->ID() ]['tkt_obj'] = $ticket;
382
-				$registrations[ $reg->ID() ]['evt_obj'] = $event;
383
-				$registrations[ $reg->ID() ]['reg_obj'] = $reg;
384
-				$registrations[ $reg->ID() ]['att_obj'] = $reg->attendee();
381
+				$registrations[$reg->ID()]['tkt_obj'] = $ticket;
382
+				$registrations[$reg->ID()]['evt_obj'] = $event;
383
+				$registrations[$reg->ID()]['reg_obj'] = $reg;
384
+				$registrations[$reg->ID()]['att_obj'] = $reg->attendee();
385 385
 
386 386
 				//set up answer objects
387
-				$rel_ans = $reg->get_many_related( 'Answer' );
388
-				foreach ( $rel_ans as $ansid => $answer ) {
389
-					if ( ! isset( $questions[ $ansid ] ) ) {
390
-						$questions[ $ansid ] = $answer->get_first_related( 'Question' );
387
+				$rel_ans = $reg->get_many_related('Answer');
388
+				foreach ($rel_ans as $ansid => $answer) {
389
+					if ( ! isset($questions[$ansid])) {
390
+						$questions[$ansid] = $answer->get_first_related('Question');
391 391
 					}
392
-					$answers[ $ansid ] = $answer;
393
-					$registrations[ $reg->ID() ]['ans_objs'][ $ansid ] = $answer;
392
+					$answers[$ansid] = $answer;
393
+					$registrations[$reg->ID()]['ans_objs'][$ansid] = $answer;
394 394
 				}
395 395
 
396
-				foreach ( $relateddatetime as $dtt_id => $datetime ) {
397
-					$eventsetup[ $evt_id ]['dtt_objs'][ $dtt_id ] = $datetime;
398
-					$registrations[ $reg->ID() ]['dtt_objs'][ $dtt_id ] = $datetime;
396
+				foreach ($relateddatetime as $dtt_id => $datetime) {
397
+					$eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime;
398
+					$registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime;
399 399
 
400
-					if ( isset( $datetimes[ $dtt_id ] ) ) {
400
+					if (isset($datetimes[$dtt_id])) {
401 401
 						continue; //already have this info in the datetimes array.
402 402
 					}
403 403
 
404
-					$datetimes[ $dtt_id ]['tkt_objs'][] = $ticket;
405
-					$datetimes[ $dtt_id ]['datetime'] = $datetime;
406
-					$datetimes[ $dtt_id ]['evt_objs'][ $evt_id ] = $event;
407
-					$datetimes[ $dtt_id ]['reg_objs'][ $reg->ID() ] = $reg;
404
+					$datetimes[$dtt_id]['tkt_objs'][] = $ticket;
405
+					$datetimes[$dtt_id]['datetime'] = $datetime;
406
+					$datetimes[$dtt_id]['evt_objs'][$evt_id] = $event;
407
+					$datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg;
408 408
 				}
409 409
 			}
410 410
 
411 411
 			//let's loop through the unique event=>reg items and setup data on them
412 412
 
413
-			if ( ! empty( $eventsetup ) ) {
414
-				foreach ( $eventsetup as $evt_id => $items ) {
415
-					if ( $this->txn instanceof EE_Transaction ) {
413
+			if ( ! empty($eventsetup)) {
414
+				foreach ($eventsetup as $evt_id => $items) {
415
+					if ($this->txn instanceof EE_Transaction) {
416 416
 						$ticket_line_items_for_event = EEM_Line_Item::instance()->get_all(
417 417
 							array(
418 418
 								array(
@@ -425,25 +425,25 @@  discard block
 block discarded – undo
425 425
 					} else {
426 426
 						$ticket_line_items_for_event = array();
427 427
 					}
428
-					$events[ $evt_id ] = array(
428
+					$events[$evt_id] = array(
429 429
 						'ID' => $evt_id,
430
-						'event' => $evtcache[ $evt_id ],
431
-						'name' => $evtcache[ $evt_id ] instanceof EE_Event ? $evtcache[ $evt_id ]->name() : '',
432
-						'total_attendees' => $event_attendee_count[ $evt_id ],
430
+						'event' => $evtcache[$evt_id],
431
+						'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '',
432
+						'total_attendees' => $event_attendee_count[$evt_id],
433 433
 						'reg_objs' => $items['reg_objs'],
434 434
 						'tkt_objs' => $items['tkt_objs'],
435 435
 						'att_objs' => $items['att_objs'],
436
-						'dtt_objs' => isset( $items['dtt_objs'] ) ? $items['dtt_objs'] : array(),
436
+						'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(),
437 437
 						'line_items' => $ticket_line_items_for_event,
438 438
 					);
439 439
 
440 440
 					//make sure the tickets have the line items setup for them.
441
-					foreach ( $ticket_line_items_for_event as $line_id => $line_item ) {
442
-						if ( $line_item instanceof EE_Line_Item ) {
443
-							$tickets[ $line_item->ticket()->ID() ]['line_item'] = $line_item;
444
-							$tickets[ $line_item->ticket()->ID() ]['sub_line_items'] = $line_item->children();
445
-							$line_items[ $line_item->ID() ]['children'] = $line_item->children();
446
-							$line_items[ $line_item->ID() ]['EE_Ticket'] = $line_item->ticket();
441
+					foreach ($ticket_line_items_for_event as $line_id => $line_item) {
442
+						if ($line_item instanceof EE_Line_Item) {
443
+							$tickets[$line_item->ticket()->ID()]['line_item'] = $line_item;
444
+							$tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children();
445
+							$line_items[$line_item->ID()]['children'] = $line_item->children();
446
+							$line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket();
447 447
 						}
448 448
 					}
449 449
 				}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		$this->total_ticket_count = $total_ticket_count;
466 466
 		$this->registrations = $registrations;
467 467
 
468
-		if ( $this->txn instanceof EE_Transaction ) {
468
+		if ($this->txn instanceof EE_Transaction) {
469 469
 			$this->tax_line_items        = $this->txn->tax_items();
470 470
 			$this->additional_line_items = $this->txn->non_ticket_line_items();
471 471
 			$this->payments              = $this->txn->payments();
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 			//let's get just the primary_attendee_data!  First we get the primary registration object.
476 476
 			$primary_reg = $this->txn->primary_registration();
477 477
 			// verify
478
-			if ( $primary_reg instanceof EE_Registration ) {
478
+			if ($primary_reg instanceof EE_Registration) {
479 479
 
480 480
 				// get attendee object
481
-				if ( $primary_reg->attendee() instanceof EE_Attendee ) {
481
+				if ($primary_reg->attendee() instanceof EE_Attendee) {
482 482
 
483 483
 					//now we can setup the primary_attendee_data array
484 484
 					$this->primary_attendee_data = array(
Please login to merge, or discard this patch.
core/libraries/messages/EE_message_type.lib.php 1 patch
Spacing   +102 added lines, -102 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
 /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @param  bool   $preview indicate whether a preview is being generated or not.
272 272
 	 * @return void
273 273
 	 */
274
-	public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) {
274
+	public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) {
275 275
 
276 276
 		$this->_active_messenger = $active_messenger;
277 277
 
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 
281 281
 		//this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send).
282 282
 		$exit = $this->_trigger_exit();
283
-		if ( $exit && ! $this->_preview ) return FALSE;
283
+		if ($exit && ! $this->_preview) return FALSE;
284 284
 
285 285
 		//todo: need to move require into registration hook but for now we'll require here.
286
-		EE_Registry::instance()->load_helper( 'Parse_Shortcodes' );
286
+		EE_Registry::instance()->load_helper('Parse_Shortcodes');
287 287
 		//get shortcode_replace instance- set when _get_messages is called in child...
288 288
 		$this->_shortcode_replace = new EEH_Parse_Shortcodes();
289 289
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 		$this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview';
295 295
 
296 296
 		//if there is an incoming context then this is a preview so let's ONLY show the given context!
297
-		if ( !empty( $context ) ) {
298
-			$cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : '';
299
-			if ( ! empty( $cntxt )  ) {
297
+		if ( ! empty($context)) {
298
+			$cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : '';
299
+			if ( ! empty($cntxt)) {
300 300
 				$this->_contexts = array();
301 301
 				$this->_contexts[$context] = $cntxt;
302 302
 			}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		$exit = $this->_init_data();
306 306
 
307 307
 		//final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated.
308
-		if ( $exit ) return FALSE;
308
+		if ($exit) return FALSE;
309 309
 
310 310
 		$this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database.
311 311
 		$this->_assemble_messages();
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @param int      $id 		Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object
342 342
 	 * @return mixed ( EE_Base_Class||EE_Base_Class[] )
343 343
 	 */
344
-	abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id );
344
+	abstract protected function _get_data_for_context($context, EE_Registration $registration, $id);
345 345
 
346 346
 
347 347
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 *
374 374
 	 * @return int
375 375
 	 */
376
-	protected function _get_id_for_msg_url( $context, EE_Registration $registration ) {
376
+	protected function _get_id_for_msg_url($context, EE_Registration $registration) {
377 377
 		return 0;
378 378
 	}
379 379
 
@@ -406,28 +406,28 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @return string          generated url
408 408
 	 */
409
-	public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) {
409
+	public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) {
410 410
 
411 411
 		//validate context
412 412
 		//valid context?
413
-		if ( !isset( $this->_contexts[$context] ) ) {
414
-			throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) );
413
+		if ( ! isset($this->_contexts[$context])) {
414
+			throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this)));
415 415
 		}
416 416
 
417 417
 		//valid sending_messenger?
418 418
 		$not_valid_msgr = FALSE;
419
-		foreach ( $this->_with_messengers as $generating => $sendings ) {
420
-			if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) {
419
+		foreach ($this->_with_messengers as $generating => $sendings) {
420
+			if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) {
421 421
 				$not_valid_msgr = TRUE;
422 422
 			}
423 423
 		}
424 424
 
425
-		if ( $not_valid_msgr ) {
426
-			throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s.  If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) );
425
+		if ($not_valid_msgr) {
426
+			throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s.  If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this)));
427 427
 		}
428 428
 
429 429
 		EE_Registry::instance()->load_helper('MSG_Template');
430
-		return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) );
430
+		return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration));
431 431
 	}
432 432
 
433 433
 
@@ -448,19 +448,19 @@  discard block
 block discarded – undo
448 448
 	 *
449 449
 	 * @return mixed (EE_Base_Class||EE_Base_Class[])
450 450
 	 */
451
-	public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) {
451
+	public function get_data_for_context($context, EE_Registration $registration, $id = 0) {
452 452
 		//valid context?
453
-		if ( !isset( $this->_contexts[$context] ) ) {
454
-			throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) );
453
+		if ( ! isset($this->_contexts[$context])) {
454
+			throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this)));
455 455
 		}
456 456
 
457 457
 		//get data and apply global and class specific filters on it.
458
-		$data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this );
459
-		$data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this );
458
+		$data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this);
459
+		$data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this);
460 460
 
461 461
 		//if empty then something went wrong!
462
-		if ( empty( $data ) ) {
463
-			throw new EE_Error( sprintf(  __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) );
462
+		if (empty($data)) {
463
+			throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name));
464 464
 		}
465 465
 
466 466
 		return $data;
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 */
496 496
 	public function with_messengers() {
497 497
 
498
-		return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers);
498
+		return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers);
499 499
 	}
500 500
 
501 501
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @access public
514 514
 	 * @return void
515 515
 	 */
516
-	public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) {
516
+	public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) {
517 517
 		//we can also further refine the context by action (if present).
518
-		return $this->_get_admin_page_content( $page, $action, $extra, $messengers );
518
+		return $this->_get_admin_page_content($page, $action, $extra, $messengers);
519 519
 	}
520 520
 
521 521
 
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 */
560 560
 	public function get_master_templates() {
561 561
 		//first class specific filter then filter that by the global filter.
562
-		$master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates );
563
-		return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this );
562
+		$master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates);
563
+		return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this);
564 564
 	}
565 565
 
566 566
 
@@ -579,31 +579,31 @@  discard block
 block discarded – undo
579 579
 		/**
580 580
 		 * first let's make sure that incoming data isn't empty!
581 581
 		 */
582
-		if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) {
583
-			$msg = sprintf( __( '"%s" message type incoming data is empty.  There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] );
584
-			throw new EE_Error( $msg );
582
+		if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) {
583
+			$msg = sprintf(__('"%s" message type incoming data is empty.  There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']);
584
+			throw new EE_Error($msg);
585 585
 		}
586 586
 
587
-		if ( empty( $this->_data_handler) ) {
588
-			$msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ );
589
-			throw new EE_Error( $msg );
587
+		if (empty($this->_data_handler)) {
588
+			$msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__);
589
+			throw new EE_Error($msg);
590 590
 		}
591 591
 
592 592
 
593 593
 		//setup class name for the data handler
594
-		$classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data';
594
+		$classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data';
595 595
 
596 596
 		//check that the class exists
597
-		if ( !class_exists( $classname ) ) {
597
+		if ( ! class_exists($classname)) {
598 598
 
599 599
 			$msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso');
600
-			$msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class").  Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname );
601
-			throw new EE_error( implode('||', $msg) );
600
+			$msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class").  Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname);
601
+			throw new EE_error(implode('||', $msg));
602 602
 		}
603 603
 
604 604
 		//k lets get the prepared data object and replace existing data property with it.
605
-		$a = new ReflectionClass( $classname );
606
-		$this->_data = $a->newInstance( $this->_data );
605
+		$a = new ReflectionClass($classname);
606
+		$this->_data = $a->newInstance($this->_data);
607 607
 
608 608
 		$this->_set_default_addressee_data();
609 609
 		return $this->_process_data();
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 	protected function _process_data() {
620 620
 		//at a minimum, we NEED EE_Attendee objects.
621 621
 
622
-		if ( empty( $this->_data->attendees ) )
623
-			return TRUE;  //EXIT!
622
+		if (empty($this->_data->attendees))
623
+			return TRUE; //EXIT!
624 624
 
625 625
 		//process addressees for each context.  Child classes will have to have methods for each context defined to handle the processing of the data object within them
626
-		foreach ( $this->_contexts as $context => $details ) {
627
-			$xpctd_method = '_' . $context . '_addressees';
628
-			if ( !method_exists( $this, $xpctd_method ) )
629
-				throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
630
-			 $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) );
626
+		foreach ($this->_contexts as $context => $details) {
627
+			$xpctd_method = '_'.$context.'_addressees';
628
+			if ( ! method_exists($this, $xpctd_method))
629
+				throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method));
630
+			 $this->_addressees[$context] = call_user_func(array($this, $xpctd_method));
631 631
 		}
632 632
 		return FALSE; //DON'T EXIT
633 633
 	}
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 			'total_ticket_count' => $this->_data->total_ticket_count
663 663
 			);
664 664
 
665
-		if ( is_array( $this->_data->primary_attendee_data ) ) {
666
-			$this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data );
665
+		if (is_array($this->_data->primary_attendee_data)) {
666
+			$this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data);
667 667
 			$this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj'];
668 668
 			$this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj'];
669 669
 		}
@@ -681,26 +681,26 @@  discard block
 block discarded – undo
681 681
 	 * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default).
682 682
 	 */
683 683
 	protected function _set_valid_shortcodes() {
684
-		$all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' );
684
+		$all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger');
685 685
 		$contexts = $this->get_contexts();
686
-		foreach ( $contexts as $context => $details ) {
686
+		foreach ($contexts as $context => $details) {
687 687
 			$this->_valid_shortcodes[$context] = $all_shortcodes;
688 688
 
689 689
 			//make sure non admin context does not include the event_author shortcodes
690
-			if ( $context != 'admin' ) {
691
-				if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) {
690
+			if ($context != 'admin') {
691
+				if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) {
692 692
 					unset($this->_valid_shortcodes[$context][$key]);
693 693
 				}
694 694
 			}
695 695
 		}
696 696
 
697 697
 		//make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context.
698
-		if ( !empty( $this->_valid_shortcodes['admin'] ) ) {
699
-			if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) {
698
+		if ( ! empty($this->_valid_shortcodes['admin'])) {
699
+			if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) {
700 700
 					unset($this->_valid_shortcodes['admin'][$key]);
701 701
 				}
702 702
 			//make sure admin context does not include the recipient_details shortcodes
703
-			if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) {
703
+			if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) {
704 704
 					unset($this->_valid_shortcodes['admin'][$key]);
705 705
 				}
706 706
 		}
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 	 * @param  array  $new_config array of valid shortcodes (by context)
714 714
 	 * @return void               sets valid_shortcodes property
715 715
 	 */
716
-	public function reset_valid_shortcodes_config( $new_config ) {
717
-		foreach ( $new_config as $context => $shortcodes ) {
716
+	public function reset_valid_shortcodes_config($new_config) {
717
+		foreach ($new_config as $context => $shortcodes) {
718 718
 			$this->_valid_shortcodes[$context] = $shortcodes;
719 719
 		}
720 720
 	}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$addressees = array();
735 735
 
736 736
 		//first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user.
737
-		foreach ( $this->_data->events as $line_ref => $event ) {
737
+		foreach ($this->_data->events as $line_ref => $event) {
738 738
 			$admin_id = $this->_get_event_admin_id($event['ID']);
739 739
 			//get the user_id for the event
740 740
 			$admin_ids[] = $admin_id;
@@ -746,14 +746,14 @@  discard block
 block discarded – undo
746 746
 		$admin_ids = array_unique($admin_ids);
747 747
 
748 748
 		//k now we can loop through the event_admins and setup the addressee data.
749
-		foreach ( $admin_ids as $event_admin ) {
749
+		foreach ($admin_ids as $event_admin) {
750 750
 			$aee = array(
751 751
 				'user_id' => $event_admin,
752 752
 				'events' => $admin_events[$event_admin],
753 753
 				'attendees' => $this->_data->attendees
754 754
 				);
755
-			$aee = array_merge( $this->_default_addressee_data, $aee );
756
-			$addressees[] = new EE_Messages_Addressee( $aee );
755
+			$aee = array_merge($this->_default_addressee_data, $aee);
756
+			$addressees[] = new EE_Messages_Addressee($aee);
757 757
 		}
758 758
 
759 759
 		return $addressees;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		$aee['attendees'] = $this->_data->attendees;
774 774
 
775 775
 		//great now we can instantiate the $addressee object and return (as an array);
776
-		$add[] = new EE_Messages_Addressee( $aee );
776
+		$add[] = new EE_Messages_Addressee($aee);
777 777
 		return $add;
778 778
 	}
779 779
 
@@ -792,38 +792,38 @@  discard block
 block discarded – undo
792 792
 		//use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we?
793 793
 		$already_processed = array();
794 794
 
795
-		foreach ( $this->_data->attendees as $att_id => $details ) {
795
+		foreach ($this->_data->attendees as $att_id => $details) {
796 796
 			//set the attendee array to blank on each loop;
797 797
 			$aee = array();
798 798
 
799
-			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue;
799
+			if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue;
800 800
 
801 801
 			//is $this->_regs_for_sending present?  If so, let's make sure we ONLY generate addressee for registrations in that array.
802
-			if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) {
803
-				$regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] );
804
-				if ( empty( $regs_allowed ) ) {
802
+			if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) {
803
+				$regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']);
804
+				if (empty($regs_allowed)) {
805 805
 					continue;
806 806
 				}
807 807
 			}
808 808
 
809 809
 			if (
810
-				in_array( $details['attendee_email'], $already_processed )
811
-				&& apply_filters( 'FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $this->_data, $this )
810
+				in_array($details['attendee_email'], $already_processed)
811
+				&& apply_filters('FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $this->_data, $this)
812 812
 			) {
813 813
 				continue;
814 814
 			}
815 815
 
816 816
 			$already_processed[] = $details['attendee_email'];
817 817
 
818
-			foreach ( $details as $item => $value ) {
818
+			foreach ($details as $item => $value) {
819 819
 				$aee[$item] = $value;
820
-				if ( $item == 'line_ref' ) {
821
-					foreach ( $value as $event_id ) {
820
+				if ($item == 'line_ref') {
821
+					foreach ($value as $event_id) {
822 822
 						$aee['events'][$event_id] = $this->_data->events[$event_id];
823 823
 					}
824 824
 				}
825 825
 
826
-				if ( $item == 'attendee_email' ) {
826
+				if ($item == 'attendee_email') {
827 827
 					$aee['attendee_email'] = $value;
828 828
 				}
829 829
 
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
 			$aee['attendees'] = $this->_data->attendees;
839 839
 
840 840
 			//merge in the primary attendee data
841
-			$aee = array_merge( $this->_default_addressee_data, $aee );
842
-			$add[] = new EE_Messages_Addressee( $aee );
841
+			$aee = array_merge($this->_default_addressee_data, $aee);
842
+			$add[] = new EE_Messages_Addressee($aee);
843 843
 		}
844 844
 
845 845
 		return $add;
@@ -864,46 +864,46 @@  discard block
 block discarded – undo
864 864
 		);
865 865
 
866 866
 		//in vanilla EE we're assuming there's only one event.  However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems).
867
-		if ( count($this->_data->events) === 1 ) {
868
-			foreach ( $this->_data->events as $event ) {
867
+		if (count($this->_data->events) === 1) {
868
+			foreach ($this->_data->events as $event) {
869 869
 				$EVT_ID = $event['ID'];
870 870
 			}
871 871
 		}
872 872
 		// is there a Group ID in the incoming request?
873
-		EE_Registry::instance()->load_core( 'Request_Handler' );
873
+		EE_Registry::instance()->load_core('Request_Handler');
874 874
 		// if not, set a default value of false
875
-		$GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false );
875
+		$GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false);
876 876
 		//if this is a preview then we just get whatever message group is for the preview and skip this part!
877
-		if ( $this->_preview && $GRP_ID ) {
878
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
877
+		if ($this->_preview && $GRP_ID) {
878
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
879 879
 		} else {
880 880
 			//not a preview or test send so lets continue on our way!
881 881
 			//is there an evt_id?  If so let's get that. template.
882
-			if ( !empty( $EVT_ID )  ) {
882
+			if ( ! empty($EVT_ID)) {
883 883
 				$evt_qa = array(
884 884
 					'Event.EVT_ID' => $EVT_ID
885 885
 				);
886
-				$qa = array_merge( $template_qa, $evt_qa );
887
-				$mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) );
886
+				$qa = array_merge($template_qa, $evt_qa);
887
+				$mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa));
888 888
 			}
889 889
 
890 890
 			//is there a 'GRP_ID' ? if so let's get that.
891 891
 
892 892
 			//if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested.
893
-			if ( $GRP_ID ) {
894
-				$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
893
+			if ($GRP_ID) {
894
+				$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
895 895
 			}
896 896
 
897 897
 
898 898
 			$template_qa['MTP_is_global'] = TRUE;
899 899
 
900 900
 			//this gets the current global template (message template group) for the active messenger and message type.
901
-			$global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
901
+			$global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
902 902
 
903
-			$mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg;
903
+			$mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg;
904 904
 		}
905 905
 
906
-		if ( ! $mtpg instanceof EE_Message_Template_Group ) {
906
+		if ( ! $mtpg instanceof EE_Message_Template_Group) {
907 907
 			//get out because we can't process anything, there are no message template groups
908 908
 			// and thus some sort of bad setup issues.
909 909
 			return false;
@@ -919,8 +919,8 @@  discard block
 block discarded – undo
919 919
 
920 920
 
921 921
 
922
-		foreach ( $templates as $context => $template_fields ) {
923
-			foreach( $template_fields as $template_field=> $template_obj ) {
922
+		foreach ($templates as $context => $template_fields) {
923
+			foreach ($template_fields as $template_field=> $template_obj) {
924 924
 				$this->_templates[$template_field][$context] = $template_obj->get('MTP_content');
925 925
 			}
926 926
 		}
@@ -935,11 +935,11 @@  discard block
 block discarded – undo
935 935
 	protected function _assemble_messages() {
936 936
 		//make sure any set messages object is cleared
937 937
 		$this->messages = array();
938
-		foreach ( $this->_addressees as $context => $addressees ) {
939
-			foreach ( $addressees as $addressee ) {
938
+		foreach ($this->_addressees as $context => $addressees) {
939
+			foreach ($addressees as $addressee) {
940 940
 				$message = $this->_setup_message_object($context, $addressee);
941 941
 				//only assign message if everything went okay
942
-				if ( $message ) {
942
+				if ($message) {
943 943
 					$message->template_pack = $this->_template_pack;
944 944
 					$message->variation = $this->_variation;
945 945
 					$this->messages[] = $message;
@@ -963,22 +963,22 @@  discard block
 block discarded – undo
963 963
 		$m_shortcodes = $this->_active_messenger->get_valid_shortcodes();
964 964
 
965 965
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing
966
-		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview )
966
+		if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview)
967 967
 			return false;
968 968
 
969
-		if ( empty( $this->_templates ) ) {
969
+		if (empty($this->_templates)) {
970 970
 			//unable to setup any messages because there are no templates.  Some sort of catastrophic setup
971 971
 			//issue exists
972 972
 			return false;
973 973
 		}
974 974
 
975
-		foreach ( $this->_templates as $field => $ctxt ) {
975
+		foreach ($this->_templates as $field => $ctxt) {
976 976
 			//let's setup the valid shortcodes for the incoming context.
977 977
 			$valid_shortcodes = $mt_shortcodes[$context];
978 978
 			//merge in valid shortcodes for the field.
979 979
 			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
980
-			if ( isset( $this->_templates[$field][$context] ) ) {
981
-				$message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID );
980
+			if (isset($this->_templates[$field][$context])) {
981
+				$message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID);
982 982
 			}
983 983
 		}
984 984
 		return $message;
Please login to merge, or discard this patch.
core/db_models/EEM_Payment_Method.model.php 2 patches
Spacing   +93 added lines, -93 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
  *
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 	 * @access   protected
38 38
 	 * @return EEM_Payment_Method
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singlular_item = __( 'Payment Method', 'event_espresso' );
42
-		$this->plural_item = __( 'Payment Methods', 'event_espresso' );
43
-		$this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) );
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singlular_item = __('Payment Method', 'event_espresso');
42
+		$this->plural_item = __('Payment Methods', 'event_espresso');
43
+		$this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'));
44 44
 		$this->_fields = array(
45 45
 			'Payment_Method' => array(
46
-				'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ),
47
-				'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ),
48
-				'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ),
49
-				'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ),
50
-				'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ),
51
-				'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ),
52
-				'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ),
53
-				'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ),
54
-				'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ),
55
-				'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ),
56
-				'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ),
57
-				'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API'
46
+				'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')),
47
+				'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'),
48
+				'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE),
49
+				'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''),
50
+				'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE),
51
+				'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE),
52
+				'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE),
53
+				'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0),
54
+				'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE),
55
+				'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE),
56
+				'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''),
57
+				'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API'
58 58
 		) );
59 59
 		$this->_model_relations = array(
60 60
  //			'Event'=>new EE_HABTM_Relation('Event_Payment_Method'),
61 61
 			'Payment' => new EE_Has_Many_Relation(),
62
-			'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ),
62
+			'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'),
63 63
 			'Transaction' => new EE_Has_Many_Relation(),
64 64
 			'WP_User' => new EE_Belongs_To_Relation(),
65 65
 		);
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param string $slug
74 74
 	 * @return EE_Payment_Method
75 75
 	 */
76
-	public function get_one_by_slug( $slug ) {
77
-		return $this->get_one( array( array( 'PMD_slug' => $slug ) ) );
76
+	public function get_one_by_slug($slug) {
77
+		return $this->get_one(array(array('PMD_slug' => $slug)));
78 78
 	}
79 79
 
80 80
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return apply_filters(
89 89
 			'FHEE__EEM_Payment_Method__scopes',
90 90
 			array(
91
-				self::scope_cart 		=> __( "Front-end Registration Page", 'event_espresso' ),
92
-				self::scope_admin 	=> __( "Admin Registration Page (no online processing)", 'event_espresso' )
91
+				self::scope_cart 		=> __("Front-end Registration Page", 'event_espresso'),
92
+				self::scope_admin 	=> __("Admin Registration Page (no online processing)", 'event_espresso')
93 93
 			)
94 94
 		);
95 95
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string $scope like one of EEM_Payment_Method::instance()->scopes()
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function is_valid_scope( $scope ) {
104
+	public function is_valid_scope($scope) {
105 105
 		$scopes = $this->scopes();
106
-		if ( isset( $scopes[ $scope ] ) ) {
106
+		if (isset($scopes[$scope])) {
107 107
 			return TRUE;
108 108
 		} else {
109 109
 			return FALSE;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @throws EE_Error
120 120
 	 * @return EE_Payment_Method[]
121 121
 	 */
122
-	public function get_all_active( $scope = NULL, $query_params = array() ) {
123
-		if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) {
124
-			$query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) );
122
+	public function get_all_active($scope = NULL, $query_params = array()) {
123
+		if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) {
124
+			$query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC'));
125 125
 		}
126
-		return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) );
126
+		return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params));
127 127
 	}
128 128
 
129 129
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param array $query_params
133 133
 	 * @return int
134 134
 	 */
135
-	public function count_active( $scope = NULL, $query_params = array() ){
136
-		return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) );
135
+	public function count_active($scope = NULL, $query_params = array()) {
136
+		return $this->count($this->_get_query_params_for_all_active($scope, $query_params));
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 	 * @return array like param of EEM_Base::get_all()
145 145
 	 * @throws EE_Error
146 146
 	 */
147
-	protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){
148
-		if ( $scope ) {
149
-			if ( $this->is_valid_scope( $scope ) ) {
150
-				return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params );
147
+	protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) {
148
+		if ($scope) {
149
+			if ($this->is_valid_scope($scope)) {
150
+				return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params);
151 151
 			} else {
152
-				throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) );
152
+				throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope));
153 153
 			}
154 154
 		} else {
155 155
 			$acceptable_scopes = array();
156 156
 			$count = 0;
157
-			foreach ( $this->scopes() as $scope_name => $desc ) {
157
+			foreach ($this->scopes() as $scope_name => $desc) {
158 158
 				$count++;
159
-				$acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' );
159
+				$acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%');
160 160
 			}
161
-			return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params );
161
+			return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params);
162 162
 		}
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @return array like param of EEM_Base::get_all()
171 171
 	 * @throws EE_Error
172 172
 	 */
173
-	public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) {
174
-		return $this->_get_query_params_for_all_active( $scope, $query_params );
173
+	public function get_query_params_for_all_active($scope = NULL, $query_params = array()) {
174
+		return $this->_get_query_params_for_all_active($scope, $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param array  $query_params
182 182
 	 * @return EE_Payment_Method
183 183
 	 */
184
-	public function get_one_active( $scope = NULL, $query_params = array() ) {
185
-		return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) );
184
+	public function get_one_active($scope = NULL, $query_params = array()) {
185
+		return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params));
186 186
 	}
187 187
 
188 188
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $type
193 193
 	 * @return EE_Payment_Method
194 194
 	 */
195
-	public function get_one_of_type( $type ) {
196
-		return $this->get_one( array( array( 'PMD_type' => $type ) ) );
195
+	public function get_one_of_type($type) {
196
+		return $this->get_one(array(array('PMD_type' => $type)));
197 197
 	}
198 198
 
199 199
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
208 208
 	 */
209
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) {
209
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
210 210
 		//first: check if it's a slug
211
-		if( is_string( $base_class_obj_or_id ) ) {
212
-			$obj = $this->get_one_by_slug( $base_class_obj_or_id );
213
-			if( $obj ) {
211
+		if (is_string($base_class_obj_or_id)) {
212
+			$obj = $this->get_one_by_slug($base_class_obj_or_id);
213
+			if ($obj) {
214 214
 				return $obj;
215 215
 			}
216 216
 		}
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219
-			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
219
+			return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db);
220 220
 		}
221
-		catch ( EE_Error $e ) {
221
+		catch (EE_Error $e) {
222 222
 			//handle it outside the catch
223 223
 		}
224
-		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
224
+		throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id));
225 225
 	}
226 226
 
227 227
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 	 * @param mixed $base_obj_or_id_or_slug
233 233
 	 * @return int
234 234
 	 */
235
-	function ensure_is_ID( $base_obj_or_id_or_slug ) {
236
-		if ( is_string( $base_obj_or_id_or_slug ) ) {
235
+	function ensure_is_ID($base_obj_or_id_or_slug) {
236
+		if (is_string($base_obj_or_id_or_slug)) {
237 237
 			//assume it's a slug
238
-			$base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug );
238
+			$base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug);
239 239
 		}
240
-		return parent::ensure_is_ID( $base_obj_or_id_or_slug );
240
+		return parent::ensure_is_ID($base_obj_or_id_or_slug);
241 241
 	}
242 242
 
243 243
 
@@ -246,37 +246,37 @@  discard block
 block discarded – undo
246 246
 	 * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default.
247 247
 	 * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart
248 248
 	 */
249
-	function verify_button_urls( $payment_methods = NULL ) {
250
-		EE_Registry::instance()->load_helper( 'URL' );
251
-		$payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
252
-		foreach ( $payment_methods as $payment_method ) {
249
+	function verify_button_urls($payment_methods = NULL) {
250
+		EE_Registry::instance()->load_helper('URL');
251
+		$payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
252
+		foreach ($payment_methods as $payment_method) {
253 253
 			try {
254 254
 				$current_button_url = $payment_method->button_url();
255
-				$buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
256
-					'current_ssl' => str_replace( "http://", "https://", $current_button_url ),
257
-					'current' => str_replace( "https://", "http://", $current_button_url ),
258
-					'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ),
259
-					'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ),
260
-				) );
261
-				foreach( $buttons_urls_to_try as $button_url_to_try ) {
262
-					if(
255
+				$buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
256
+					'current_ssl' => str_replace("http://", "https://", $current_button_url),
257
+					'current' => str_replace("https://", "http://", $current_button_url),
258
+					'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()),
259
+					'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()),
260
+				));
261
+				foreach ($buttons_urls_to_try as $button_url_to_try) {
262
+					if (
263 263
 							(//this is the current url and it exists, regardless of SSL issues
264 264
 								$button_url_to_try == $current_button_url &&
265 265
 								EEH_URL::remote_file_exists(
266 266
 										$button_url_to_try,
267 267
 										array(
268 268
 											'sslverify' => false,
269
-											'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
269
+											'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
270 270
 											) )
271 271
 							)
272 272
 							||
273 273
 							(//this is NOT the current url and it exists with a working SSL cert
274 274
 								$button_url_to_try != $current_button_url &&
275
-								EEH_URL::remote_file_exists( $button_url_to_try )
275
+								EEH_URL::remote_file_exists($button_url_to_try)
276 276
 							) ) {
277
-						if( $current_button_url != $button_url_to_try ){
278
-							$payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) );
279
-							EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) );
277
+						if ($current_button_url != $button_url_to_try) {
278
+							$payment_method->save(array('PMD_button_url' => $button_url_to_try));
279
+							EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try));
280 280
 						}
281 281
 						//this image exists. So if wasn't set before, now it is;
282 282
 						//or if it was already set, we have nothing to do
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 					}
285 285
 				}
286 286
 			}
287
-			catch ( EE_Error $e ) {
288
-				$payment_method->set_active( FALSE );
287
+			catch (EE_Error $e) {
288
+				$payment_method->set_active(FALSE);
289 289
 			}
290 290
 		}
291 291
 	}
@@ -299,24 +299,24 @@  discard block
 block discarded – undo
299 299
 	 * @param array $rows
300 300
 	 * @return EE_Payment_Method[]
301 301
 	 */
302
-	protected function _create_objects( $rows = array() ) {
303
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
304
-		$payment_methods = parent::_create_objects( $rows );
302
+	protected function _create_objects($rows = array()) {
303
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
304
+		$payment_methods = parent::_create_objects($rows);
305 305
 		/* @var $payment_methods EE_Payment_Method[] */
306 306
 		$usable_payment_methods = array();
307
-		foreach ( $payment_methods as $key => $payment_method ) {
308
-			if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $payment_method->type() ) ) {
309
-				$usable_payment_methods[ $key ] = $payment_method;
307
+		foreach ($payment_methods as $key => $payment_method) {
308
+			if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) {
309
+				$usable_payment_methods[$key] = $payment_method;
310 310
 			} else {				
311 311
 				$payment_method->deactivate();
312 312
 				$payment_method->save();
313 313
 				EE_Error::add_persistent_admin_notice(
314
-					'auto-deactivated-' . $payment_method->type(),
314
+					'auto-deactivated-'.$payment_method->type(),
315 315
 					sprintf(
316
-						__( 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso' ),
316
+						__('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'),
317 317
 						$payment_method->admin_name(),
318 318
 						'<br />',
319
-						'<a href="' . admin_url('plugins.php') . '">',
319
+						'<a href="'.admin_url('plugins.php').'">',
320 320
 						'</a>'
321 321
 					),
322 322
 					true
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
 	 * @param string 	$scope @see EEM_Payment_Method::get_all_for_events
337 337
 	 * @return EE_Payment_Method[]
338 338
 	 */
339
-	public function get_all_for_transaction( $transaction, $scope ) {
339
+	public function get_all_for_transaction($transaction, $scope) {
340 340
 		//@todo take relations between events and payment methods into account, once that relation exists
341
-		if ( $transaction instanceof EE_Transaction ) {
341
+		if ($transaction instanceof EE_Transaction) {
342 342
 			//@todo take the relation between transaction and currencies into account
343 343
 		}
344
-		$currencies_for_events = array( EE_Config::instance()->currency->code );
344
+		$currencies_for_events = array(EE_Config::instance()->currency->code);
345 345
 		//give addons a chance to override what payment methods are chosen based on the transaction
346 346
 		return apply_filters(
347 347
 			'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods',
348
-			$this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ),
348
+			$this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))),
349 349
 			$transaction,
350 350
 			$scope
351 351
 		);
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 	 * @param EE_Registration|int $registration_or_reg_id  Either the EE_Registration object or the id for the registration.
362 362
 	 * @return EE_Payment|null
363 363
 	 */
364
-	public function get_last_used_for_registration( $registration_or_reg_id ) {
365
-		$registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id );
364
+	public function get_last_used_for_registration($registration_or_reg_id) {
365
+		$registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id);
366 366
 
367 367
 		$query_params = array(
368 368
 			0 => array(
369 369
 				'Payment.Registration.REG_ID' => $registration_id,
370 370
 			),
371
-			'order_by' => array( 'Payment.PAY_ID' => 'DESC' )
371
+			'order_by' => array('Payment.PAY_ID' => 'DESC')
372 372
 		);
373
-		return $this->get_one( $query_params );
373
+		return $this->get_one($query_params);
374 374
 	}
375 375
 
376 376
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -217,8 +217,7 @@  discard block
 block discarded – undo
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219 219
 			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
220
-		}
221
-		catch ( EE_Error $e ) {
220
+		} catch ( EE_Error $e ) {
222 221
 			//handle it outside the catch
223 222
 		}
224 223
 		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
@@ -283,8 +282,7 @@  discard block
 block discarded – undo
283 282
 						break;
284 283
 					}
285 284
 				}
286
-			}
287
-			catch ( EE_Error $e ) {
285
+			} catch ( EE_Error $e ) {
288 286
 				$payment_method->set_active( FALSE );
289 287
 			}
290 288
 		}
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public static function instance() {
63 63
 		// check if class object is instantiated, and instantiated properly
64
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof  EE_Front_Controller )) {
64
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof  EE_Front_Controller)) {
65 65
 			self::$_instance = new self();
66 66
 		}
67 67
 		return self::$_instance;
@@ -79,37 +79,37 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	private function __construct() {
81 81
 		// make sure template tags are loaded immediately so that themes don't break
82
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 );
82
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
83 83
 		// determine how to integrate WP_Query with the EE models
84
-		add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' ));
84
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
85 85
 		// load other resources and begin to actually run shortcodes and modules
86
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 );
86
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
87 87
 		// analyse the incoming WP request
88
-		add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 );
88
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
89 89
 		// process any content shortcodes
90
-		add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 );
90
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
91 91
 		// process request with module factory
92
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 );
92
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
93 93
 		// before headers sent
94
-		add_action( 'wp', array( $this, 'wp' ), 5 );
94
+		add_action('wp', array($this, 'wp'), 5);
95 95
 		// load css and js
96
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 );
96
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
97 97
 		// header
98
-		add_action('wp_head', array( $this, 'header_meta_tag' ), 5 );
99
-		add_filter( 'template_include', array( $this, 'template_include' ), 1 );
98
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
99
+		add_filter('template_include', array($this, 'template_include'), 1);
100 100
 		// display errors
101
-		add_action('loop_start', array( $this, 'display_errors' ), 2 );
101
+		add_action('loop_start', array($this, 'display_errors'), 2);
102 102
 		// the content
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
103
+		add_filter('the_content', array($this, 'the_content'), 5, 1);
104 104
 		//exclude our private cpt comments
105
-		add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 );
105
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
106 106
 		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
107
-		add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 );
107
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
108 108
 		// action hook EE
109
-		do_action( 'AHEE__EE_Front_Controller__construct__done',$this );
109
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
110 110
 		// for checking that browser cookies are enabled
111
-		if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) {
112
-			setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' );
111
+		if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
112
+			setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
113 113
 		}
114 114
 	}
115 115
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * 	@return void
130 130
 	 */
131 131
 	public function load_espresso_template_tags() {
132
-		if ( is_readable( EE_PUBLIC . 'template_tags.php' )) {
133
-			require_once( EE_PUBLIC . 'template_tags.php' );
132
+		if (is_readable(EE_PUBLIC.'template_tags.php')) {
133
+			require_once(EE_PUBLIC.'template_tags.php');
134 134
 		}
135 135
 	}
136 136
 
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
146 146
 	 * @return array array of comment clauses with modifications.
147 147
 	 */
148
-	public function filter_wp_comments( $clauses ) {
148
+	public function filter_wp_comments($clauses) {
149 149
 		global $wpdb;
150
-		if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) {
150
+		if (strpos($clauses['join'], $wpdb->posts) !== FALSE) {
151 151
 			$cpts = EE_Register_CPTs::get_private_CPTs();
152
-			foreach ( $cpts as $cpt => $details ) {
153
-				$clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt );
152
+			foreach ($cpts as $cpt => $details) {
153
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
154 154
 			}
155 155
 		}
156 156
 		return $clauses;
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 *  @return 	void
168 168
 	 */
169 169
 	public function employ_CPT_Strategy() {
170
-		if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){
171
-			EE_Registry::instance()->load_core( 'CPT_Strategy' );
170
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
171
+			EE_Registry::instance()->load_core('CPT_Strategy');
172 172
 		}
173 173
 	}
174 174
 
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
 	 * @param  string $url    incoming url
181 181
 	 * @return string         final assembled url
182 182
 	 */
183
-	public function maybe_force_admin_ajax_ssl( $url ) {
184
-		if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) {
185
-			$url = str_replace( 'http://', 'https://', $url );
183
+	public function maybe_force_admin_ajax_ssl($url) {
184
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
185
+			$url = str_replace('http://', 'https://', $url);
186 186
 		}
187 187
 		return $url;
188 188
 	}
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
 	 * @param WP $WP
220 220
 	 * @return void
221 221
 	 */
222
-	public function get_request( WP $WP ) {
223
-		do_action( 'AHEE__EE_Front_Controller__get_request__start' );
222
+	public function get_request(WP $WP) {
223
+		do_action('AHEE__EE_Front_Controller__get_request__start');
224 224
 		/** @var EE_Request_Handler $Request_Handler */
225
-		$Request_Handler = EE_Registry::instance()->load_core( 'Request_Handler' );
226
-		$Request_Handler->parse_request( $WP );
227
-		do_action( 'AHEE__EE_Front_Controller__get_request__complete' );
225
+		$Request_Handler = EE_Registry::instance()->load_core('Request_Handler');
226
+		$Request_Handler->parse_request($WP);
227
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
228 228
 	}
229 229
 
230 230
 
@@ -236,18 +236,18 @@  discard block
 block discarded – undo
236 236
 	 * @param WP $WP
237 237
 	 * @return    void
238 238
 	 */
239
-	public function _initialize_shortcodes( WP $WP ) {
240
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this );
239
+	public function _initialize_shortcodes(WP $WP) {
240
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
241 241
 		// grab post_name from request
242
-		$current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' ));
242
+		$current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name'));
243 243
 		// if it's not set, then check if frontpage is blog
244
-		if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) {
244
+		if (empty($current_post) && get_option('show_on_front') == 'posts') {
245 245
 			// yup.. this is the posts page, prepare to load all shortcode modules
246 246
 			$current_post = 'posts';
247
-		} else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) {
247
+		} else if (empty($current_post) && get_option('show_on_front') == 'page') {
248 248
 			// some other page is set as the homepage
249
-			$page_on_front = get_option( 'page_on_front' );
250
-			if ( $page_on_front ) {
249
+			$page_on_front = get_option('page_on_front');
250
+			if ($page_on_front) {
251 251
 				// k now we need to find the post_name for this page
252 252
 				global $wpdb;
253 253
 				$page_on_front = $wpdb->get_var(
@@ -263,22 +263,22 @@  discard block
 block discarded – undo
263 263
 		// where are posts being displayed ?
264 264
 		$page_for_posts = EE_Config::get_page_for_posts();
265 265
 		// in case $current_post is hierarchical like: /parent-page/current-page
266
-		$current_post = basename( $current_post );
266
+		$current_post = basename($current_post);
267 267
 		// are we on a category page?
268
-		$term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars );
268
+		$term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars);
269 269
 		// make sure shortcodes are set
270
-		if ( isset( EE_Registry::CFG()->core->post_shortcodes )) {
271
-			if ( ! isset( EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
272
-				EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
270
+		if (isset(EE_Registry::CFG()->core->post_shortcodes)) {
271
+			if ( ! isset(EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) {
272
+				EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
273 273
 			}
274 274
 			// cycle thru all posts with shortcodes set
275
-			foreach ( EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
275
+			foreach (EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
276 276
 				// filter shortcodes so
277
-				$post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes );
277
+				$post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes);
278 278
 				// now cycle thru shortcodes
279
-				foreach ( $post_shortcodes as $shortcode_class => $post_id ) {
279
+				foreach ($post_shortcodes as $shortcode_class => $post_id) {
280 280
 					// are we on this page, or on the blog page, or an EE CPT category page ?
281
-					if ( $current_post == $post_name || $term_exists ) {
281
+					if ($current_post == $post_name || $term_exists) {
282 282
 						// maybe init the shortcode
283 283
 						$this->initialize_shortcode_if_active_on_page(
284 284
 							$shortcode_class,
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
 					// but the shortcode is not being tracked for this page
294 294
 					} else if (
295 295
 						$post_name != $page_for_posts
296
-						&& isset( EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] )
297
-						&& ! isset( EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )
296
+						&& isset(EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])
297
+						&& ! isset(EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])
298 298
 					) {
299 299
 						// then remove the "fallback" shortcode processor
300
-						remove_shortcode( $shortcode_class );
300
+						remove_shortcode($shortcode_class);
301 301
 					}
302 302
 				}
303 303
 			}
304 304
 		}
305
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this );
305
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
306 306
 	}
307 307
 
308 308
 
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 		$WP
325 325
 	) {
326 326
 		// verify shortcode is in list of registered shortcodes
327
-		if ( ! isset( EE_Registry::instance()->shortcodes->{$shortcode_class} ) ) {
328
-			if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id ) ) {
327
+		if ( ! isset(EE_Registry::instance()->shortcodes->{$shortcode_class} )) {
328
+			if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) {
329 329
 				EE_Error::add_error(
330 330
 					sprintf(
331 331
 						__(
@@ -338,23 +338,23 @@  discard block
 block discarded – undo
338 338
 					__FUNCTION__,
339 339
 					__LINE__
340 340
 				);
341
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
341
+				add_filter('FHEE_run_EE_the_content', '__return_true');
342 342
 			}
343
-			add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) );
343
+			add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
344 344
 			return;
345 345
 		}
346 346
 		// is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
347 347
 		if (
348
-			isset( EE_Registry::CFG()->core->post_shortcodes[ $current_post ] )
348
+			isset(EE_Registry::CFG()->core->post_shortcodes[$current_post])
349 349
 			|| $term_exists
350 350
 			|| $current_post == $page_for_posts
351 351
 		) {
352 352
 			// let's pause to reflect on this...
353
-			$sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class );
353
+			$sc_reflector = new ReflectionClass('EES_'.$shortcode_class);
354 354
 			// ensure that class is actually a shortcode
355 355
 			if (
356
-				! $sc_reflector->isSubclassOf( 'EES_Shortcode' )
357
-				&& defined( 'WP_DEBUG' )
356
+				! $sc_reflector->isSubclassOf('EES_Shortcode')
357
+				&& defined('WP_DEBUG')
358 358
 				&& WP_DEBUG === true
359 359
 			) {
360 360
 				EE_Error::add_error(
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
 					__FUNCTION__,
370 370
 					__LINE__
371 371
 				);
372
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
372
+				add_filter('FHEE_run_EE_the_content', '__return_true');
373 373
 				return;
374 374
 			}
375 375
 			// and pass the request object to the run method
376 376
 			EE_Registry::instance()->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
377 377
 			// fire the shortcode class's run method, so that it can activate resources
378
-			EE_Registry::instance()->shortcodes->{$shortcode_class}->run( $WP );
378
+			EE_Registry::instance()->shortcodes->{$shortcode_class}->run($WP);
379 379
 		}
380 380
 	}
381 381
 
@@ -388,20 +388,20 @@  discard block
 block discarded – undo
388 388
 	 * @param   WP_Query    $WP_Query
389 389
 	 * @return    void
390 390
 	 */
391
-	public function pre_get_posts( $WP_Query ) {
391
+	public function pre_get_posts($WP_Query) {
392 392
 		// only load Module_Request_Router if this is the main query
393
-		if ( $WP_Query->is_main_query() ) {
393
+		if ($WP_Query->is_main_query()) {
394 394
 			// load module request router
395
-			$Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' );
395
+			$Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router');
396 396
 			// verify object
397
-			if ( $Module_Request_Router instanceof EE_Module_Request_Router ) {
397
+			if ($Module_Request_Router instanceof EE_Module_Request_Router) {
398 398
 				// cycle thru module routes
399
-				while ( $route = $Module_Request_Router->get_route( $WP_Query )) {
399
+				while ($route = $Module_Request_Router->get_route($WP_Query)) {
400 400
 					// determine module and method for route
401
-					$module = $Module_Request_Router->resolve_route( $route[0], $route[1] );
402
-					if( $module instanceof EED_Module ) {
401
+					$module = $Module_Request_Router->resolve_route($route[0], $route[1]);
402
+					if ($module instanceof EED_Module) {
403 403
 						// get registered view for route
404
-						$this->_template_path = $Module_Request_Router->get_view( $route );
404
+						$this->_template_path = $Module_Request_Router->get_view($route);
405 405
 						// grab module name
406 406
 						$module_name = $module->module_name();
407 407
 						// map the module to the module objects
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 *  @return 	void
429 429
 	 */
430 430
 	public function wp() {
431
-		EE_Registry::instance()->load_helper( 'Template' );
431
+		EE_Registry::instance()->load_helper('Template');
432 432
 	}
433 433
 
434 434
 
@@ -446,30 +446,30 @@  discard block
 block discarded – undo
446 446
 	public function wp_enqueue_scripts() {
447 447
 
448 448
 		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
449
-		if ( apply_filters( 'FHEE_load_css', TRUE ) ) {
449
+		if (apply_filters('FHEE_load_css', TRUE)) {
450 450
 
451 451
 			EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE;
452 452
 			//Load the ThemeRoller styles if enabled
453
-			if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) {
453
+			if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) {
454 454
 
455 455
 				//Load custom style sheet if available
456
-				if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) {
457
-					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION );
456
+				if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) {
457
+					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION);
458 458
 					wp_enqueue_style('espresso_custom_css');
459 459
 				}
460 460
 
461
-				EE_Registry::instance()->load_helper( 'File' );
462
-				if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) {
463
-					wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
461
+				EE_Registry::instance()->load_helper('File');
462
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) {
463
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
464 464
 				} else {
465
-					wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
465
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
466 466
 				}
467 467
 				wp_enqueue_style('espresso_default');
468 468
 
469
-				if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) {
470
-					wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
469
+				if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) {
470
+					wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
471 471
 				} else {
472
-					wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
472
+					wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
473 473
 				}
474 474
 
475 475
 			}
@@ -477,29 +477,29 @@  discard block
 block discarded – undo
477 477
 		}
478 478
 
479 479
 		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
480
-		if ( apply_filters( 'FHEE_load_js', TRUE ) ) {
480
+		if (apply_filters('FHEE_load_js', TRUE)) {
481 481
 
482
-			wp_enqueue_script( 'jquery' );
482
+			wp_enqueue_script('jquery');
483 483
 			//let's make sure that all required scripts have been setup
484
-			if ( function_exists( 'wp_script_is' )) {
485
-				if ( ! wp_script_is( 'jquery' )) {
484
+			if (function_exists('wp_script_is')) {
485
+				if ( ! wp_script_is('jquery')) {
486 486
 					$msg = sprintf(
487
-						__( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ),
487
+						__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'),
488 488
 						'<em><br />',
489 489
 						'</em>'
490 490
 					);
491
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
491
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
492 492
 				}
493 493
 			}
494 494
 			// load core js
495
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
496
-			wp_enqueue_script( 'espresso_core' );
497
-			wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
495
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
496
+			wp_enqueue_script('espresso_core');
497
+			wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
498 498
 
499 499
 		}
500 500
 
501 501
 		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
502
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
502
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
503 503
 			EE_Registry::instance()->load_helper('Qtip_Loader');
504 504
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
505 505
 		}
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 
508 508
 		//accounting.js library
509 509
 		// @link http://josscrowcroft.github.io/accounting.js/
510
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
511
-			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
512
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
513
-			wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE );
514
-			wp_enqueue_script( 'ee-accounting' );
510
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
511
+			$acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js';
512
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
513
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE);
514
+			wp_enqueue_script('ee-accounting');
515 515
 
516 516
 			$currency_config = array(
517 517
 				'currency' => array(
@@ -534,21 +534,21 @@  discard block
 block discarded – undo
534 534
 			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
535 535
 		}
536 536
 
537
-		if ( ! function_exists( 'wp_head' )) {
537
+		if ( ! function_exists('wp_head')) {
538 538
 			$msg = sprintf(
539
-				__( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
539
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
540 540
 				'<em><br />',
541 541
 				'</em>'
542 542
 			);
543
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
543
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
544 544
 		}
545
-		if ( ! function_exists( 'wp_footer' )) {
545
+		if ( ! function_exists('wp_footer')) {
546 546
 			$msg = sprintf(
547
-				__( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
547
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
548 548
 				'<em><br />',
549 549
 				'</em>'
550 550
 			);
551
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
551
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
552 552
 		}
553 553
 
554 554
 	}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 *  @return 	void
563 563
 	 */
564 564
 	public function header_meta_tag() {
565
-		print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />"));
565
+		print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />"));
566 566
 	}
567 567
 
568 568
 
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
 	 * @param   $the_content
577 577
 	 * @return    string
578 578
 	 */
579
-	public function the_content( $the_content ) {
579
+	public function the_content($the_content) {
580 580
 		// nothing gets loaded at this point unless other systems turn this hookpoint on by using:  add_filter( 'FHEE_run_EE_the_content', '__return_true' );
581
-		if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) {
581
+		if (apply_filters('FHEE_run_EE_the_content', FALSE)) {
582 582
 		}
583 583
 		return $the_content;
584 584
 	}
@@ -603,9 +603,9 @@  discard block
 block discarded – undo
603 603
 	 */
604 604
 	public function display_errors() {
605 605
 		static $shown_already = FALSE;
606
-		do_action( 'AHEE__EE_Front_Controller__display_errors__begin' );
606
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
607 607
 		if (
608
-			apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE )
608
+			apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE)
609 609
 			&& ! $shown_already
610 610
 			&& is_main_query()
611 611
 			&& ! is_feed()
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
 		) {
615 615
 			echo EE_Error::get_notices();
616 616
 			$shown_already = TRUE;
617
-			EE_Registry::instance()->load_helper( 'Template' );
618
-			EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' );
617
+			EE_Registry::instance()->load_helper('Template');
618
+			EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
619 619
 		}
620
-		do_action( 'AHEE__EE_Front_Controller__display_errors__end' );
620
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
621 621
 	}
622 622
 
623 623
 
@@ -632,12 +632,12 @@  discard block
 block discarded – undo
632 632
 	 * @param   string $template_include_path
633 633
 	 * @return    string
634 634
 	 */
635
-	public function template_include( $template_include_path = NULL ) {
636
-		if ( EE_Registry::instance()->REQ->is_espresso_page() ) {
637
-			$this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path );
638
-			$template_path = EEH_Template::locate_template( $this->_template_path, array(), false );
639
-			$this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path;
640
-			$this->_template = basename( $this->_template_path );
635
+	public function template_include($template_include_path = NULL) {
636
+		if (EE_Registry::instance()->REQ->is_espresso_page()) {
637
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
638
+			$template_path = EEH_Template::locate_template($this->_template_path, array(), false);
639
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
640
+			$this->_template = basename($this->_template_path);
641 641
 			return $this->_template_path;
642 642
 		}
643 643
 		return $template_include_path;
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 * @param bool $with_path
653 653
 	 * @return    string
654 654
 	 */
655
-	public function get_selected_template( $with_path = FALSE ) {
655
+	public function get_selected_template($with_path = FALSE) {
656 656
 		return $with_path ? $this->_template_path : $this->_template;
657 657
 	}
658 658
 
Please login to merge, or discard this patch.