Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
68:51 queued 56:46
created
core/helpers/EEH_Template.helper.php 2 patches
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
183 183
 	 * @return mixed
184 184
 	 */
185
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
185
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
186 186
 		// first use WP locate_template to check for template in the current theme folder
187
-		$template_path = locate_template( $templates );
187
+		$template_path = locate_template($templates);
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
189
+		if ($check_if_custom && ! empty($template_path))
190 190
 			return TRUE;
191 191
 
192 192
 		// not in the theme
193
-		if ( empty( $template_path )) {
193
+		if (empty($template_path)) {
194 194
 			// not even a template to look for ?
195
-			if ( empty( $templates )) {
195
+			if (empty($templates)) {
196 196
 				// get post_type
197
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
197
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
198 198
 				// get array of EE Custom Post Types
199 199
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
200 200
 				// build template name based on request
201
-				if ( isset( $EE_CPTs[ $post_type ] )) {
202
-					$archive_or_single =  is_archive() ? 'archive' : '';
203
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
204
-					$templates = $archive_or_single . '-' . $post_type . '.php';
201
+				if (isset($EE_CPTs[$post_type])) {
202
+					$archive_or_single = is_archive() ? 'archive' : '';
203
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
204
+					$templates = $archive_or_single.'-'.$post_type.'.php';
205 205
 				}
206 206
 			}
207 207
 			// currently active EE template theme
@@ -210,81 +210,81 @@  discard block
 block discarded – undo
210 210
 			// array of paths to folders that may contain templates
211 211
 			$template_folder_paths = array(
212 212
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
213
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
213
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
214 214
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
215 215
 				EVENT_ESPRESSO_TEMPLATE_DIR
216 216
 			);
217 217
 
218 218
 			//add core plugin folders for checking only if we're not $check_if_custom
219
-			if ( ! $check_if_custom ) {
219
+			if ( ! $check_if_custom) {
220 220
 				$core_paths = array(
221 221
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
222
-					EE_PUBLIC . $current_theme,
222
+					EE_PUBLIC.$current_theme,
223 223
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
224
-					EE_TEMPLATES . $current_theme,
224
+					EE_TEMPLATES.$current_theme,
225 225
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
226 226
 					EE_PLUGIN_DIR_PATH
227 227
 					);
228
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
228
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
229 229
 			}
230 230
 
231 231
 			// now filter that array
232
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
233
-			$templates = is_array( $templates ) ? $templates : array( $templates );
234
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
232
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
233
+			$templates = is_array($templates) ? $templates : array($templates);
234
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
235 235
 			// array to hold all possible template paths
236 236
 			$full_template_paths = array();
237 237
 
238 238
 			// loop through $templates
239
-			foreach ( $templates as $template ) {
239
+			foreach ($templates as $template) {
240 240
 				// normalize directory separators
241
-				$template = EEH_File::standardise_directory_separators( $template );
242
-				$file_name = basename( $template );
243
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
241
+				$template = EEH_File::standardise_directory_separators($template);
242
+				$file_name = basename($template);
243
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
244 244
 				// while looping through all template folder paths
245
-				foreach ( $template_folder_paths as $template_folder_path ) {
245
+				foreach ($template_folder_paths as $template_folder_path) {
246 246
 					// normalize directory separators
247
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
247
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
248 248
 					// determine if any common base path exists between the two paths
249 249
 					$common_base_path = EEH_Template::_find_common_base_path(
250
-						array( $template_folder_path, $template_path_minus_file_name )
250
+						array($template_folder_path, $template_path_minus_file_name)
251 251
 					);
252
-					if ( $common_base_path !== '' ) {
252
+					if ($common_base_path !== '') {
253 253
 						// both paths have a common base, so just tack the filename onto our search path
254
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
254
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
255 255
 					} else {
256 256
 						// no common base path, so let's just concatenate
257
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
257
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
258 258
 					}
259 259
 					// build up our template locations array by adding our resolved paths
260 260
 					$full_template_paths[] = $resolved_path;
261 261
 				}
262 262
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
263
-				array_unshift( $full_template_paths, $template );
263
+				array_unshift($full_template_paths, $template);
264 264
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
265
-				array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name );
265
+				array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
266 266
 			}
267 267
 			// filter final array of full template paths
268
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
268
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
269 269
 			// now loop through our final array of template location paths and check each location
270
-			foreach ( (array)$full_template_paths as $full_template_path ) {
271
-				if ( is_readable( $full_template_path )) {
272
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
270
+			foreach ((array) $full_template_paths as $full_template_path) {
271
+				if (is_readable($full_template_path)) {
272
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
273 273
 					// hook that can be used to display the full template path that will be used
274
-					do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path );
274
+					do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
275 275
 					break;
276 276
 				}
277 277
 			}
278 278
 		}
279 279
 		// if we got it and you want to see it...
280
-		if ( $template_path && $load && ! $check_if_custom  ) {
281
-			if ( $return_string ) {
282
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
280
+		if ($template_path && $load && ! $check_if_custom) {
281
+			if ($return_string) {
282
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
283 283
 			} else {
284
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
284
+				EEH_Template::display_template($template_path, $template_args, FALSE);
285 285
 			}
286 286
 		}
287
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
287
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
288 288
 	}
289 289
 
290 290
 
@@ -297,21 +297,21 @@  discard block
 block discarded – undo
297 297
 	 * @param array $paths
298 298
 	 * @return string
299 299
 	 */
300
-	protected static function _find_common_base_path( $paths ) {
300
+	protected static function _find_common_base_path($paths) {
301 301
 		$last_offset = 0;
302 302
 		$common_base_path = '';
303
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
303
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
304 304
 			$dir_length = $index - $last_offset + 1;
305
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
306
-			foreach ( $paths as $path ) {
307
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
305
+			$directory = substr($paths[0], $last_offset, $dir_length);
306
+			foreach ($paths as $path) {
307
+				if (substr($path, $last_offset, $dir_length) != $directory) {
308 308
 					return $common_base_path;
309 309
 				}
310 310
 			}
311 311
 			$common_base_path .= $directory;
312 312
 			$last_offset = $index + 1;
313 313
 		}
314
-		return substr( $common_base_path, 0, -1 );
314
+		return substr($common_base_path, 0, -1);
315 315
 	}
316 316
 
317 317
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
324 324
 	 * @return mixed string
325 325
 	 */
326
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
326
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
327 327
 
328 328
 		/**
329 329
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -334,26 +334,26 @@  discard block
 block discarded – undo
334 334
 		 *
335 335
 		 * @since 4.6.0
336 336
 		 */
337
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
338
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
337
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
338
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
339 339
 
340 340
 		// you gimme nuttin - YOU GET NUTTIN !!
341
-		if ( ! $template_path || ! is_readable( $template_path )) {
341
+		if ( ! $template_path || ! is_readable($template_path)) {
342 342
 			return '';
343 343
 		}
344 344
 		// if $template_args are not in an array, then make it so
345
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
346
-			$template_args = array( $template_args );
345
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
346
+			$template_args = array($template_args);
347 347
 		}
348
-		extract( (array) $template_args);
348
+		extract((array) $template_args);
349 349
 
350
-		if ( $return_string ) {
350
+		if ($return_string) {
351 351
 			// because we want to return a string, we are going to capture the output
352 352
 			ob_start();
353
-			include( $template_path );
353
+			include($template_path);
354 354
 			return ob_get_clean();
355 355
 		} else {
356
-			include( $template_path );
356
+			include($template_path);
357 357
 		}
358 358
 		return '';
359 359
 	}
@@ -371,27 +371,27 @@  discard block
 block discarded – undo
371 371
 	 * @param  string $suffix added to the end of the generated class
372 372
 	 * @return string
373 373
 	 */
374
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
374
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
375 375
 		// in the beginning...
376
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
376
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
377 377
 		// da muddle
378 378
 		$class = '';
379 379
 		// the end
380
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
380
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
381 381
 		// is the passed object an EE object ?
382
-		if ( $object instanceof EE_Base_Class ) {
382
+		if ($object instanceof EE_Base_Class) {
383 383
 			// grab the exact type of object
384
-			$obj_class = get_class( $object );
384
+			$obj_class = get_class($object);
385 385
 			// depending on the type of object...
386
-			switch ( $obj_class ) {
386
+			switch ($obj_class) {
387 387
 				// no specifics just yet...
388 388
 				default :
389
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
390
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
389
+					$class = strtolower(str_replace('_', '-', $obj_class));
390
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
391 391
 
392 392
 			}
393 393
 		}
394
-		return $prefix . $class . $suffix;
394
+		return $prefix.$class.$suffix;
395 395
 	}
396 396
 
397 397
 
@@ -407,54 +407,54 @@  discard block
 block discarded – undo
407 407
 	 * @param string      $cur_code_span_class
408 408
 	 * @return string        the html output for the formatted money value
409 409
 	 */
410
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
410
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
411 411
 		// ensure amount was received
412
-		if ( is_null( $amount ) ) {
413
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
414
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
412
+		if (is_null($amount)) {
413
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
414
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
415 415
 			return '';
416 416
 		}
417 417
 		//ensure amount is float
418
-		$amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount );
419
-		$CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount );
418
+		$amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
419
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
420 420
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
421
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
421
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
422 422
 		// still a number or was amount converted to a string like "free" ?
423
-		if ( is_float( $amount_formatted )) {
423
+		if (is_float($amount_formatted)) {
424 424
 			// was a country ISO code passed ? if so generate currency config object for that country
425
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
426 426
 			// verify results
427
-			if ( ! $mny instanceof EE_Currency_Config ) {
427
+			if ( ! $mny instanceof EE_Currency_Config) {
428 428
 				// set default config country currency settings
429 429
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
430 430
 			}
431 431
 			// format float
432
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
433 433
 			// add formatting ?
434
-			if ( ! $return_raw ) {
434
+			if ( ! $return_raw) {
435 435
 				// add currency sign
436
-				if( $mny->sign_b4 ){
437
-					if( $amount >= 0 ){
438
-						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
436
+				if ($mny->sign_b4) {
437
+					if ($amount >= 0) {
438
+						$amount_formatted = $mny->sign.$amount_formatted;
439
+					} else {
440
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
441 441
 					}
442 442
 
443
-				}else{
444
-					$amount_formatted =  $amount_formatted . $mny->sign;
443
+				} else {
444
+					$amount_formatted = $amount_formatted.$mny->sign;
445 445
 				}
446 446
 
447 447
 				// filter to allow global setting of display_code
448
-				$display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code );
448
+				$display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code);
449 449
 
450 450
 				// add currency code ?
451
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
451
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
452 452
 			}
453 453
 			// filter results
454
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
454
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
455 455
 		}
456 456
 		// clean up vars
457
-		unset( $mny );
457
+		unset($mny);
458 458
 		// return formatted currency amount
459 459
 		return $amount_formatted;
460 460
 	}
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
470 470
 	 * @return string             The localized label for the status id.
471 471
 	 */
472
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
472
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
473 473
 		/** @type EEM_Status $EEM_Status */
474
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
475
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
476
-		return $status[ $status_id ];
474
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
475
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
476
+		return $status[$status_id];
477 477
 	}
478 478
 
479 479
 
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 	 * @param string  $icon
487 487
 	 * @return string 	the html output for the button
488 488
 	 */
489
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
490
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
491
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
489
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
490
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
491
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
492 492
 		return $button;
493 493
 	}
494 494
 
@@ -505,21 +505,21 @@  discard block
 block discarded – undo
505 505
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
506 506
 	 * @return string              generated link
507 507
 	 */
508
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
508
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
509 509
 
510
-		if ( ! $page )
511
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
510
+		if ( ! $page)
511
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
512 512
 
513
-		if ( ! $action )
514
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
513
+		if ( ! $action)
514
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
515 515
 
516 516
 		$action = empty($action) ? 'default' : $action;
517 517
 
518 518
 
519
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
520
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
521
-		$help_text = !$help_text ? '' : $help_text;
522
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
519
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
520
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
521
+		$help_text = ! $help_text ? '' : $help_text;
522
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
523 523
 	}
524 524
 
525 525
 
@@ -531,31 +531,31 @@  discard block
 block discarded – undo
531 531
 	 * @param EE_Help_Tour
532 532
 	 * @return string         html
533 533
 	 */
534
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
534
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
535 535
 		$id = $tour->get_slug();
536 536
 		$stops = $tour->get_stops();
537 537
 
538
-		$content = '<ol style="display:none" id="' . $id . '">';
538
+		$content = '<ol style="display:none" id="'.$id.'">';
539 539
 
540
-		foreach ( $stops as $stop ) {
541
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
542
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
540
+		foreach ($stops as $stop) {
541
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
542
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
543 543
 
544 544
 			//if container is set to modal then let's make sure we set the options accordingly
545
-			if ( empty( $data_id ) && empty( $data_class ) ) {
545
+			if (empty($data_id) && empty($data_class)) {
546 546
 				$stop['options']['modal'] = true;
547 547
 				$stop['options']['expose'] = true;
548 548
 			}
549 549
 
550
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
551
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
550
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
551
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
552 552
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
553 553
 
554 554
 			//options
555
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
555
+			if (isset($stop['options']) && is_array($stop['options'])) {
556 556
 				$options = ' data-options="';
557
-				foreach ( $stop['options'] as $option => $value ) {
558
-					$options .= $option . ':' . $value . ';';
557
+				foreach ($stop['options'] as $option => $value) {
558
+					$options .= $option.':'.$value.';';
559 559
 				}
560 560
 				$options .= '"';
561 561
 			} else {
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 			}
564 564
 
565 565
 			//let's put all together
566
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
566
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
567 567
 		}
568 568
 
569 569
 		$content .= '</ol>';
@@ -584,31 +584,31 @@  discard block
 block discarded – undo
584 584
 	 * @throws EE_Error
585 585
 	 * @return string               html structure for status.
586 586
 	 */
587
-	public static function status_legend( $status_array, $active_status = '' ) {
588
-		if ( !is_array( $status_array ) )
589
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
587
+	public static function status_legend($status_array, $active_status = '') {
588
+		if ( ! is_array($status_array))
589
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
590 590
 
591 591
 		$setup_array = array();
592
-		foreach ( $status_array as $item => $status ) {
592
+		foreach ($status_array as $item => $status) {
593 593
 			$setup_array[$item] = array(
594
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
595
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
594
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
595
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
596 596
 					'status' => $status
597 597
 				);
598 598
 		}
599 599
 
600
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
601
-		$content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n";
602
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
603
-		foreach ( $setup_array as $item => $details ) {
600
+		$content = '<div class="ee-list-table-legend-container">'."\n";
601
+		$content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n";
602
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
603
+		foreach ($setup_array as $item => $details) {
604 604
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
605
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
606
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
607
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
608
-			$content .= '</dt>' . "\n";
605
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
606
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
607
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
608
+			$content .= '</dt>'."\n";
609 609
 		}
610
-		$content .= '</dl>' . "\n";
611
-		$content .= '</div>' . "\n";
610
+		$content .= '</dl>'."\n";
611
+		$content .= '</div>'."\n";
612 612
 		return $content;
613 613
 	}
614 614
 
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
 	 * @return string
622 622
 	 */
623 623
 	public static function layout_array_as_table($data) {
624
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
625
-		$data = (array)$data;
624
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
625
+		$data = (array) $data;
626 626
 	}
627 627
 	ob_start();
628 628
 	if (is_array($data)) {
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 						?>
636 636
 						<tr>
637 637
 							<td>
638
-								<?php echo $data_key;?>
638
+								<?php echo $data_key; ?>
639 639
 							</td>
640 640
 							<td>
641
-								<?php echo self::layout_array_as_table($data_values);?>
641
+								<?php echo self::layout_array_as_table($data_values); ?>
642 642
 							</td>
643 643
 						</tr>
644 644
 						<?php
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 			<ul>
653 653
 				<?php
654 654
 				foreach ($data as $datum) {
655
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
655
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
656 656
 				}?>
657 657
 			</ul>
658 658
 			<?php
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	 *
683 683
 	 * @return string
684 684
 	 */
685
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
686
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
685
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
686
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
687 687
 	}
688 688
 
689 689
 
@@ -707,13 +707,13 @@  discard block
 block discarded – undo
707 707
 	 *                                 )
708 708
 	 * @return  string
709 709
 	 */
710
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
710
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
711 711
 		$page_links = array();
712 712
 		$disable_first = $disable_last = '';
713 713
 		$total_items = (int) $total_items;
714 714
 		$per_page = (int) $per_page;
715 715
 		$current = (int) $current;
716
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
716
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
717 717
 
718 718
 		//filter items_label
719 719
 		$items_label = apply_filters(
@@ -721,68 +721,68 @@  discard block
 block discarded – undo
721 721
 			$items_label
722 722
 		);
723 723
 
724
-		if ( empty( $items_label )
725
-		     || ! is_array( $items_label )
726
-		     || ! isset( $items_label['single'] )
727
-		     || ! isset( $items_label['plural'] ) ) {
724
+		if (empty($items_label)
725
+		     || ! is_array($items_label)
726
+		     || ! isset($items_label['single'])
727
+		     || ! isset($items_label['plural'])) {
728 728
 			$items_label = array(
729
-				'single' => __( '1 item', 'event_espresso' ),
730
-				'plural' => __( '%s items', 'event_espresso' )
729
+				'single' => __('1 item', 'event_espresso'),
730
+				'plural' => __('%s items', 'event_espresso')
731 731
 			);
732 732
 		} else {
733 733
 			$items_label = array(
734
-				'single' => '1 ' . esc_html( $items_label['single'] ),
735
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
734
+				'single' => '1 '.esc_html($items_label['single']),
735
+				'plural' => '%s '.esc_html($items_label['plural'])
736 736
 			);
737 737
 		}
738 738
 
739
-		$total_pages = ceil( $total_items / $per_page );
739
+		$total_pages = ceil($total_items / $per_page);
740 740
 
741
-		if ( $total_pages <= 1 )
741
+		if ($total_pages <= 1)
742 742
 			return '';
743 743
 
744
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
744
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
745 745
 
746
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
746
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
747 747
 
748
-		if ( $current === 1 ) {
748
+		if ($current === 1) {
749 749
 			$disable_first = ' disabled';
750 750
 		}
751
-		if ( $current == $total_pages ) {
751
+		if ($current == $total_pages) {
752 752
 			$disable_last = ' disabled';
753 753
 		}
754 754
 
755
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
756
-			'first-page' . $disable_first,
757
-			esc_attr__( 'Go to the first page' ),
758
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
755
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
756
+			'first-page'.$disable_first,
757
+			esc_attr__('Go to the first page'),
758
+			esc_url(remove_query_arg($paged_arg_name, $url)),
759 759
 			'&laquo;'
760 760
 		);
761 761
 
762 762
 		$page_links[] = sprintf(
763 763
 			'<a class="%s" title="%s" href="%s">%s</a>',
764
-			'prev-page' . $disable_first,
765
-			esc_attr__( 'Go to the previous page' ),
766
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
764
+			'prev-page'.$disable_first,
765
+			esc_attr__('Go to the previous page'),
766
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
767 767
 			'&lsaquo;'
768 768
 		);
769 769
 
770
-		if ( ! $show_num_field ) {
770
+		if ( ! $show_num_field) {
771 771
 			$html_current_page = $current;
772 772
 		} else {
773
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
774
-				esc_attr__( 'Current page' ),
773
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
774
+				esc_attr__('Current page'),
775 775
 				$current,
776
-				strlen( $total_pages )
776
+				strlen($total_pages)
777 777
 			);
778 778
 		}
779 779
 
780 780
 		$html_total_pages = sprintf(
781 781
 			'<span class="total-pages">%s</span>',
782
-			number_format_i18n( $total_pages )
782
+			number_format_i18n($total_pages)
783 783
 		);
784 784
 		$page_links[] = sprintf(
785
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
785
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
786 786
 			$html_current_page,
787 787
 			$html_total_pages,
788 788
 			'<span class="paging-input">',
@@ -791,29 +791,29 @@  discard block
 block discarded – undo
791 791
 
792 792
 		$page_links[] = sprintf(
793 793
 			'<a class="%s" title="%s" href="%s">%s</a>',
794
-			'next-page' . $disable_last,
795
-			esc_attr__( 'Go to the next page' ),
796
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
794
+			'next-page'.$disable_last,
795
+			esc_attr__('Go to the next page'),
796
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
797 797
 			'&rsaquo;'
798 798
 		);
799 799
 
800 800
 		$page_links[] = sprintf(
801 801
 			'<a class="%s" title="%s" href="%s">%s</a>',
802
-			'last-page' . $disable_last,
803
-			esc_attr__( 'Go to the last page' ),
804
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
802
+			'last-page'.$disable_last,
803
+			esc_attr__('Go to the last page'),
804
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
805 805
 			'&raquo;'
806 806
 		);
807 807
 
808
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
808
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
809 809
 		// set page class
810
-		if ( $total_pages ) {
810
+		if ($total_pages) {
811 811
 			$page_class = $total_pages < 2 ? ' one-page' : '';
812 812
 		} else {
813 813
 			$page_class = ' no-pages';
814 814
 		}
815 815
 
816
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
816
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
817 817
 	}
818 818
 
819 819
 
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 );
830 830
 
831 831
 
832
-if ( ! function_exists( 'espresso_pagination' ) ) {
832
+if ( ! function_exists('espresso_pagination')) {
833 833
 	/**
834 834
 	 *    espresso_pagination
835 835
 	 *
@@ -841,21 +841,21 @@  discard block
 block discarded – undo
841 841
 		$big = 999999999; // need an unlikely integer
842 842
 		$pagination = paginate_links(
843 843
 		array(
844
-		'base'         => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
844
+		'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
845 845
 		'format'       => '?paged=%#%',
846
-		'current'      => max( 1, get_query_var( 'paged' ) ),
846
+		'current'      => max(1, get_query_var('paged')),
847 847
 		'total'        => $wp_query->max_num_pages,
848 848
 		'show_all'     => true,
849 849
 		'end_size'     => 10,
850 850
 		'mid_size'     => 6,
851 851
 		'prev_next'    => true,
852
-		'prev_text'    => __( '&lsaquo; PREV', 'event_espresso' ),
853
-		'next_text'    => __( 'NEXT &rsaquo;', 'event_espresso' ),
852
+		'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
853
+		'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
854 854
 		'type'         => 'plain',
855 855
 		'add_args'     => false,
856 856
 		'add_fragment' => ''
857 857
 		)
858 858
 		);
859
-		echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
859
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : '';
860 860
 	}
861 861
 }
862 862
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * given two paths, this determines if there is a common base path between the two
296 296
 	 *
297
-	 * @param array $paths
297
+	 * @param string[] $paths
298 298
 	 * @return string
299 299
 	 */
300 300
 	protected static function _find_common_base_path( $paths ) {
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
322 322
 	 * @param  array      $template_args an array of arguments to be extracted for use in the template
323 323
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
324
-	 * @return mixed string
324
+	 * @return string string
325 325
 	 */
326 326
 	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
327 327
 
Please login to merge, or discard this patch.
core/helpers/EEH_Maps.helper.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	 * @param  array $ee_gmaps_opts array of attributes required for the map link generation
22 22
 	 * @return string (link to map!)
23 23
 	 */
24
-	public static function google_map( $ee_gmaps_opts ){
25
-
26
-		$ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300';
27
-		$ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185';
28
-		$ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
29
-		$ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false';
30
-		$ee_map_nav_size =  isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
31
-		$ee_map_type_control =  isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default';
32
-		$static_url =  isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE;
33
-
34
-		if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){
35
-			switch( $ee_gmaps_opts['ee_map_align'] ){
24
+	public static function google_map($ee_gmaps_opts) {
25
+
26
+		$ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';
27
+		$ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';
28
+		$ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
29
+		$ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';
30
+		$ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
31
+		$ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default';
32
+		$static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE;
33
+
34
+		if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) {
35
+			switch ($ee_gmaps_opts['ee_map_align']) {
36 36
 				case "left":
37 37
 					$map_align = 'ee-gmap-align-left left';
38 38
 					break;
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 
54 54
 		// Determine whether user has set a hardoded url to use and
55 55
 		// if so display a Google static iframe map else run V3 api
56
-		if( $static_url ) {
56
+		if ($static_url) {
57 57
 
58
-			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';
59
-			$html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width  .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">';
58
+			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';
59
+			$html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">';
60 60
 			$html .= '</iframe>';
61
-			$html .= '<a href="' . $static_url . '">View Large map</a>';
61
+			$html .= '<a href="'.$static_url.'">View Large map</a>';
62 62
 			$html .= '</div>';
63 63
 			return $html;
64 64
 
65 65
 		 } else {
66 66
 
67
-			EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(
67
+			EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(
68 68
 				'map_ID' => $ee_gmaps_opts['map_ID'],
69 69
 				'ee_map_zoom' => $ee_map_zoom,
70 70
 				'ee_map_nav_display' => $ee_map_nav_display,
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 			);
75 75
 
76 76
 			$html = '<div class="ee-gmap-wrapper '.$map_align.';">';
77
-			$html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>';  //
77
+			$html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; //
78 78
 			$html .= '</div>';
79 79
 
80
-			wp_enqueue_script( 'gmap_api' );
81
-			wp_enqueue_script( 'ee_gmap' );
82
-			add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' ));
80
+			wp_enqueue_script('gmap_api');
81
+			wp_enqueue_script('ee_gmap');
82
+			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script'));
83 83
 
84 84
 			return $html;
85 85
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return void
95 95
 	 */
96 96
 	public static function footer_enqueue_script() {
97
-		wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars );
97
+		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars);
98 98
 	}
99 99
 
100 100
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 	public static function espresso_google_map_js() {
106 106
 		$api_url = sprintf(
107 107
 			"https://maps.googleapis.com/maps/api/js?key=%s",
108
-			apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key )
108
+			apply_filters('FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key)
109 109
 		);
110
-		wp_register_script( 'gmap_api', $api_url, array('jquery'), NULL, TRUE );
111
-		wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE );
110
+		wp_register_script('gmap_api', $api_url, array('jquery'), NULL, TRUE);
111
+		wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE);
112 112
 	}
113 113
 
114 114
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @return string (link to map!)
118 118
 	 */
119 119
 	public static function google_map_link($atts) {
120
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
120
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
121 121
 		extract($atts);
122 122
 		/** @var string $address */
123 123
 		/** @var string $city */
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 		$id = isset($id) ? $id : 'not_set';
137 137
 		$map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';
138 138
 
139
-		$address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
139
+		$address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : '');
140 140
 
141
-		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string ));
141
+		$google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string));
142 142
 
143 143
 		switch ($type) {
144 144
 			case 'text':
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 			case 'map':
154 154
 				$scheme = is_ssl() ? 'https://' : 'http://';
155 155
 
156
-				$api_key = apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_link__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key );
156
+				$api_key = apply_filters('FHEE__EEH_Maps__espresso_google_maps_link__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key);
157 157
 
158
-				return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode( $address_string ) . '&amp;sensor=false&amp;key=' . $api_key ) . '" /></a>';
158
+				return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&amp;zoom=14&amp;size='.$map_w.'x'.$map_h.'&amp;markers=color:green|label:|'.urlencode($address_string).'&amp;sensor=false&amp;key='.$api_key).'" /></a>';
159 159
 		}
160 160
 
161
-		return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
161
+		return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>';
162 162
 	}
163 163
 
164 164
 
Please login to merge, or discard this patch.
admin_pages/venues/templates/google_map.template.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
                     <input type="text" id="ee-google-map-api-key" class="regular-text" name="google_map_api_key" value="<?php echo $map_settings->google_map_api_key; ?>" />
27 27
                     <p class="description">
28 28
                         <?php
29
-                            printf(
30
-                                __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'),
31
-                                '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">',
32
-                                '</a>'
33
-                            );
34
-                        ?>
29
+							printf(
30
+								__('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'),
31
+								'<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">',
32
+								'</a>'
33
+							);
34
+						?>
35 35
                     </p>
36 36
                 </td>
37 37
             </tr>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 				</td>
16 16
 			</tr>
17 17
 			<?php
18
-			if( apply_filters( 'FHEE__google_map__show_api_key_input', true ) ) { ?>
18
+			if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?>
19 19
             <tr>
20 20
                 <th>
21 21
                     <label for="ee-google-map-api-key">
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
 				<td>
111 111
 					<label for="event_details_control_type-default" class="ee-admin-radio-lbl">
112 112
 						<?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?>
113
-						<input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/>
113
+						<input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/>
114 114
 						<?php _e(' Default', 'event_espresso') ?>
115 115
 					</label>
116 116
 
117 117
 					<label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl">
118 118
 						<?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?>
119
-						<input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/>
119
+						<input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/>
120 120
 						<?php _e(' Horizontal', 'event_espresso') ?>
121 121
 					</label>
122 122
 
123 123
 					<label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl">
124 124
 						<?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?>
125
-						<input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/>
125
+						<input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/>
126 126
 						<?php _e(' Dropdown', 'event_espresso') ?>
127 127
 					</label>
128 128
 				</td>
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 				<td>
136 136
 					<label for="event_details_map_align-none" class="ee-admin-radio-lbl">
137 137
 						<?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?>
138
-						<input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/>
138
+						<input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/>
139 139
 						<?php _e(' None', 'event_espresso') ?>
140 140
 					</label>
141 141
 
142 142
 					<label for="event_details_map_align-left" class="ee-admin-radio-lbl">
143 143
 						<?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?>
144
-						<input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/>
144
+						<input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/>
145 145
 						<?php _e(' Align Left', 'event_espresso') ?>
146 146
 					</label>
147 147
 
148 148
 					<label for="event_details_map_align-center" class="ee-admin-radio-lbl">
149 149
 						<?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?>
150
-						<input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/>
150
+						<input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/>
151 151
 						<?php _e(' Align Center', 'event_espresso') ?>
152 152
 					</label>
153 153
 
154 154
 					<label for="event_details_map_align-right" class="ee-admin-radio-lbl">
155 155
 						<?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?>
156
-						<input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/>
156
+						<input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/>
157 157
 						<?php _e(' Align Right', 'event_espresso') ?>
158 158
 					</label>
159 159
 				</td>
@@ -228,19 +228,19 @@  discard block
 block discarded – undo
228 228
 				<td>
229 229
 					<label for="event_list_control_type-default" class="ee-admin-radio-lbl">
230 230
 						<?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?>
231
-						<input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/>
231
+						<input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/>
232 232
 						<?php _e(' Default', 'event_espresso') ?>
233 233
 					</label>
234 234
 
235 235
 					<label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl">
236 236
 						<?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?>
237
-						<input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/>
237
+						<input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/>
238 238
 						<?php _e(' Horizontal', 'event_espresso') ?>
239 239
 					</label>
240 240
 
241 241
 					<label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl">
242 242
 						<?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?>
243
-						<input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/>
243
+						<input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/>
244 244
 						<?php _e(' Dropdown', 'event_espresso') ?>
245 245
 					</label>
246 246
 
@@ -254,25 +254,25 @@  discard block
 block discarded – undo
254 254
 				<td>
255 255
 					<label for="event_list_map_align-none" class="ee-admin-radio-lbl">
256 256
 						<?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?>
257
-						<input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/>
257
+						<input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/>
258 258
 						<?php _e(' None', 'event_espresso') ?>
259 259
 					</label>
260 260
 
261 261
 					<label for="event_list_map_align-left" class="ee-admin-radio-lbl">
262 262
 						<?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?>
263
-						<input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/>
263
+						<input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/>
264 264
 						<?php _e(' Align Left', 'event_espresso') ?>
265 265
 					</label>
266 266
 
267 267
 					<label for="event_list_map_align-center" class="ee-admin-radio-lbl">
268 268
 						<?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?>
269
-						<input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/>
269
+						<input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/>
270 270
 						<?php _e(' Align Center', 'event_espresso') ?>
271 271
 					</label>
272 272
 
273 273
 					<label for="event_list_map_align-right" class="ee-admin-radio-lbl">
274 274
 						<?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?>
275
-						<input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/>
275
+						<input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/>
276 276
 						<?php _e(' Align Right', 'event_espresso') ?>
277 277
 					</label>
278 278
 
Please login to merge, or discard this patch.
widgets/upcoming_events/EEW_Upcoming_Events.widget.php 2 patches
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	function __construct() {
31 31
 		parent::__construct(
32 32
 			'ee-upcoming-events-widget',
33
-			__( 'Event Espresso Upcoming Events', 'event_espresso' ),
34
-			 array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )),
33
+			__('Event Espresso Upcoming Events', 'event_espresso'),
34
+			 array('description' => __('A widget to display your upcoming events.', 'event_espresso')),
35 35
 			array(
36 36
 				'width' => 300,
37 37
 				'height' => 350,
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param array $instance Previously saved values from database.
50 50
 	 * @return string|void
51 51
 	 */
52
-	public function form( $instance ) {
52
+	public function form($instance) {
53 53
 
54
-		EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE );
54
+		EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
55 55
 		// Set up some default widget settings.
56 56
 		$defaults = array(
57 57
 			'title' => __('Upcoming Events', 'event_espresso'),
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 			'image_size' => 'medium'
67 67
 		);
68 68
 
69
-		$instance = wp_parse_args( (array) $instance, $defaults );
69
+		$instance = wp_parse_args((array) $instance, $defaults);
70 70
 		// don't add HTML labels for EE_Form_Fields generated inputs
71
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' );
71
+		add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
72 72
 		$yes_no_values = array(
73
-			EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))),
74
-			EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso')))
73
+			EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))),
74
+			EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso')))
75 75
 		);
76 76
 
77 77
 	?>
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			<label for="<?php echo $this->get_field_id('title'); ?>">
83 83
 				<?php _e('Title:', 'event_espresso'); ?>
84 84
 			</label>
85
-			<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" />
85
+			<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" />
86 86
 		</p>
87 87
 		<p>
88 88
 			<label for="<?php echo $this->get_field_id('category_name'); ?>">
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 			<?php
92 92
 			$event_categories = array();
93 93
 			/** @type EEM_Term $EEM_Term */
94
-			$EEM_Term = EE_Registry::instance()->load_model( 'Term' );
95
-			$categories = $EEM_Term->get_all_ee_categories( TRUE );
96
-			if ( $categories ) {
97
-				foreach ( $categories as $category ) {
98
-					if ( $category instanceof EE_Term ) {
99
-						$event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' )));
94
+			$EEM_Term = EE_Registry::instance()->load_model('Term');
95
+			$categories = $EEM_Term->get_all_ee_categories(TRUE);
96
+			if ($categories) {
97
+				foreach ($categories as $category) {
98
+					if ($category instanceof EE_Term) {
99
+						$event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name')));
100 100
 					}
101 101
 				}
102 102
 			}
103
-			array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
103
+			array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
104 104
 			echo EEH_Form_Fields::select(
105 105
 				 __('Event Category:', 'event_espresso'),
106 106
 				$instance['category_name'],
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
 			<?php
138 138
 			$image_sizes = array();
139 139
 			$sizes = get_intermediate_image_sizes();
140
-			if ( $sizes ) {
140
+			if ($sizes) {
141 141
 				// loop thru images and create option objects out of them
142
-				foreach ( $sizes as $image_size ) {
143
-					$image_size = trim( $image_size );
142
+				foreach ($sizes as $image_size) {
143
+					$image_size = trim($image_size);
144 144
 					// no big images plz
145
-					if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) {
146
-						$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size ));
145
+					if ( ! in_array($image_size, array('large', 'post-thumbnail'))) {
146
+						$image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size));
147 147
 					}
148 148
 				}
149
-				$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' =>  __('don\'t show images', 'event_espresso') ));
149
+				$image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' =>  __('don\'t show images', 'event_espresso')));
150 150
 			}
151 151
 			echo EEH_Form_Fields::select(
152 152
 				 __('Image Size:', 'event_espresso'),
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			<label for="<?php echo $this->get_field_id('date_limit'); ?>">
205 205
 				<?php _e('Number of Dates to Display:', 'event_espresso'); ?>
206 206
 			</label>
207
-			<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" />
207
+			<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" />
208 208
 		</p>
209 209
 		<p>
210 210
 			<label for="<?php echo $this->get_field_id('date_range'); ?>">
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return array Updated safe values to be saved.
238 238
 	 */
239
-	public function update( $new_instance, $old_instance ) {
239
+	public function update($new_instance, $old_instance) {
240 240
 		$instance = $old_instance;
241
-		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
241
+		$instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
242 242
 		$instance['category_name'] = $new_instance['category_name'];
243 243
 		$instance['show_expired'] = $new_instance['show_expired'];
244 244
 		$instance['limit'] = $new_instance['limit'];
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 * @param array $args     Widget arguments.
262 262
 	 * @param array $instance Saved values from database.
263 263
 	 */
264
-	public function widget( $args, $instance ) {
264
+	public function widget($args, $instance) {
265 265
 
266 266
 		global $post;
267 267
 		// make sure there is some kinda post object
268
-		if ( $post instanceof WP_Post ) {
268
+		if ($post instanceof WP_Post) {
269 269
 			$before_widget = '';
270 270
 			$before_title = '';
271 271
 			$after_title = '';
272 272
 			$after_widget = '';
273 273
 			// but NOT an events archives page, cuz that would be like two event lists on the same page
274
-			$show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE;
275
-			if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) {
274
+			$show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE;
275
+			if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
276 276
 				// let's use some of the event helper functions'
277 277
 				// make separate vars out of attributes
278 278
 
@@ -291,81 +291,81 @@  discard block
 block discarded – undo
291 291
 				// Before widget (defined by themes).
292 292
 				echo $before_widget;
293 293
 				// Display the widget title if one was input (before and after defined by themes).
294
-				if ( ! empty( $title )) {
295
-					echo $before_title . $title . $after_title;
294
+				if ( ! empty($title)) {
295
+					echo $before_title.$title.$after_title;
296 296
 				}
297 297
 				// grab widget settings
298
-				$category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE;
299
-				$show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE;
300
-				$image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium';
301
-				$show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE;
302
-				$show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE;
303
-				$date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL;
304
-				$date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE;
298
+				$category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE;
299
+				$show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE;
300
+				$image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium';
301
+				$show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE;
302
+				$show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE;
303
+				$date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL;
304
+				$date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE;
305 305
 				// start to build our where clause
306 306
 				$where = array(
307 307
 //					'Datetime.DTT_is_primary' => 1,
308 308
 					'status' => 'publish'
309 309
 				);
310 310
 				// add category
311
-				if ( $category ) {
311
+				if ($category) {
312 312
 					$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
313 313
 					$where['Term_Taxonomy.Term.slug'] = $category;
314 314
 				}
315 315
 				// if NOT expired then we want events that start today or in the future
316
-				if ( ! $show_expired ) {
317
-					$where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
316
+				if ( ! $show_expired) {
317
+					$where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
318 318
 				}
319 319
 				// run the query
320
-				$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array(
320
+				$events = EE_Registry::instance()->load_model('Event')->get_all(array(
321 321
 					$where,
322
-					'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10',
322
+					'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10',
323 323
 					'order_by' => 'Datetime.DTT_EVT_start',
324 324
 					'order' => 'ASC',
325 325
 					'group_by' => 'EVT_ID'
326 326
 				));
327 327
 
328
-				if ( ! empty( $events )) {
328
+				if ( ! empty($events)) {
329 329
 					echo '<ul class="ee-upcoming-events-widget-ul">';
330
-					foreach ( $events as $event ) {
331
-						if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) {
330
+					foreach ($events as $event) {
331
+						if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) {
332 332
 							//printr( $event, '$event  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
333
-							echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">';
333
+							echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">';
334 334
 							// how big is the event name ?
335
-							$name_length = strlen( $event->name() );
336
-							switch( $name_length ) {
335
+							$name_length = strlen($event->name());
336
+							switch ($name_length) {
337 337
 								case $name_length > 70 :
338
-									$len_class =  ' three-line';
338
+									$len_class = ' three-line';
339 339
 									break;
340 340
 								case $name_length > 35 :
341
-									$len_class =  ' two-line';
341
+									$len_class = ' two-line';
342 342
 									break;
343 343
 								default :
344
-									$len_class =  ' one-line';
344
+									$len_class = ' one-line';
345 345
 							}
346
-							$event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event );
347
-							echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>';
348
-							if ( post_password_required( $event->ID() ) ) {
349
-								$pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event );
346
+							$event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event);
347
+							echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>';
348
+							if (post_password_required($event->ID())) {
349
+								$pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event);
350 350
 								echo $pswd_form;
351 351
 							} else {
352
-								if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) {
353
-									echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>';
352
+								if (has_post_thumbnail($event->ID()) && $image_size != 'none') {
353
+									echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>';
354 354
 								}
355
-								$desc = $event->short_description( 25 );
356
-								if ( $show_dates ) {
357
-									$date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' ));
358
-									$time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' ));
359
-									$single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' ));
360
-									$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' ));
361
-									if ( $date_range == TRUE ) {
362
-										echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() );
363
-									}else{
364
-										echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit );
355
+								$desc = $event->short_description(25);
356
+								if ($show_dates) {
357
+									$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format'));
358
+									$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format'));
359
+									$single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format'));
360
+									$single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format'));
361
+									if ($date_range == TRUE) {
362
+										echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID());
363
+									} else {
364
+										echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit);
365 365
 									}
366 366
 								}
367
-								if ( $show_desc && $desc ) {
368
-									echo '<p style="margin-top: .5em">' . $desc . '</p>';
367
+								if ($show_desc && $desc) {
368
+									echo '<p style="margin-top: .5em">'.$desc.'</p>';
369 369
 								}
370 370
 							}
371 371
 							echo '</li>';
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @return string
390 390
 	 */
391 391
 	public function make_the_title_a_link($title) {
392
-	    return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
392
+	    return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>';
393 393
 	}
394 394
 
395 395
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -360,7 +362,7 @@  discard block
 block discarded – undo
360 362
 									$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' ));
361 363
 									if ( $date_range == TRUE ) {
362 364
 										echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() );
363
-									}else{
365
+									} else{
364 366
 										echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit );
365 367
 									}
366 368
 								}
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EE_PMT_Paypal_Pro.pm.php 2 patches
Spacing   +30 added lines, -30 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
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Paypal_Pro extends EE_PMT_Base{
28
+class EE_PMT_Paypal_Pro extends EE_PMT_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param EE_Payment_Method $pm_instance
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		require_once($this->file_folder().'EEG_Paypal_Pro.gateway.php');
36 36
 		$this->_gateway = new EEG_Paypal_Pro();
37 37
 		$this->_pretty_name = __("Paypal Pro", 'event_espresso');
38
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
38
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
39 39
 		$this->_requires_https = true;
40 40
 		parent::__construct($pm_instance);
41 41
 	}
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 			'extra_meta_inputs'=>array(
52 52
 //				'paypal_email'=>new EE_Email_Input(), not actually used
53 53
 				'username'=>new EE_Text_Input(array(
54
-					'html_label_text'=>  sprintf(__("Paypal API Username %s", "event_espresso"),$this->get_help_tab_link()),
54
+					'html_label_text'=>  sprintf(__("Paypal API Username %s", "event_espresso"), $this->get_help_tab_link()),
55 55
 					'required' => true
56 56
 				)),
57 57
 				'password'=>new EE_Text_Input(array(
58
-					'html_label_text'=>  sprintf(__("Paypal API Password %s", "event_espresso"),$this->get_help_tab_link()),
58
+					'html_label_text'=>  sprintf(__("Paypal API Password %s", "event_espresso"), $this->get_help_tab_link()),
59 59
 					'required' => true
60 60
 				)),
61 61
 				'signature'=>new EE_Text_Input(array(
62
-					'html_label_text'=>  sprintf(__("Paypal API Signature %s", "event_espresso"),$this->get_help_tab_link()),
62
+					'html_label_text'=>  sprintf(__("Paypal API Signature %s", "event_espresso"), $this->get_help_tab_link()),
63 63
 					'required' => true
64 64
 				)),
65 65
 				'credit_card_types'=>new EE_Checkbox_Multi_Input(
66 66
 						$this->card_types_supported(),
67 67
 						array(
68
-							'html_label_text' => __( 'Card Types Supported', 'event_espresso' ),
68
+							'html_label_text' => __('Card Types Supported', 'event_espresso'),
69 69
 							'required' => true )),
70 70
 				)
71 71
 			)
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 * @throws \EE_Error
80 80
 	 * @return EE_Billing_Info_Form
81 81
 	 */
82
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
83
-		$allowed_types = $this->_pm_instance->get_extra_meta( 'credit_card_types', TRUE );
82
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
83
+		$allowed_types = $this->_pm_instance->get_extra_meta('credit_card_types', TRUE);
84 84
 		//if allowed types is a string or empty array or null...
85
-		if( empty( $allowed_types )) {
85
+		if (empty($allowed_types)) {
86 86
 			$allowed_types = array();
87 87
 		}
88 88
 
@@ -93,26 +93,26 @@  discard block
 block discarded – undo
93 93
 //				'html_id'=> 'ee-Paypal_Pro-billing-form',
94 94
 				'subsections'=>array(
95 95
 					'credit_card'=>new EE_Credit_Card_Input(
96
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Number', 'event_espresso' ))
96
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Number', 'event_espresso'))
97 97
 					),
98 98
 					'credit_card_type'=>new EE_Select_Input(
99 99
 						//the options are set dynamically
100
-						array_intersect_key( EE_PMT_Paypal_Pro::card_types_supported(), array_flip( $allowed_types )),
101
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Type', 'event_espresso' ))
100
+						array_intersect_key(EE_PMT_Paypal_Pro::card_types_supported(), array_flip($allowed_types)),
101
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Type', 'event_espresso'))
102 102
 					),
103 103
 					'exp_month'=>new EE_Credit_Card_Month_Input(
104
-						TRUE, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' =>  __( 'Expiry Month', 'event_espresso' )  )
104
+						TRUE, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' =>  __('Expiry Month', 'event_espresso'))
105 105
 					),
106 106
 					'exp_year'=>new EE_Credit_Card_Year_Input(
107
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Year', 'event_espresso' )  )
107
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Year', 'event_espresso'))
108 108
 					),
109 109
 					'cvv'=>new EE_CVV_Input(
110
-						array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'CVV', 'event_espresso' ) )
110
+						array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('CVV', 'event_espresso'))
111 111
 					),
112 112
 				)
113 113
 			)
114 114
 		);
115
-		return $this->apply_billing_form_debug_settings( $billing_form );
115
+		return $this->apply_billing_form_debug_settings($billing_form);
116 116
 	}
117 117
 
118 118
 
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 	 * @param \EE_Billing_Info_Form $billing_form
125 125
 	 * @return \EE_Billing_Info_Form
126 126
 	 */
127
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
128
-		if ( $this->_pm_instance->debug_mode() ) {
127
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
128
+		if ($this->_pm_instance->debug_mode()) {
129 129
 			$billing_form->add_subsections(
130
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
130
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
131 131
 				'credit_card'
132 132
 			);
133 133
 			$billing_form->add_subsections(
134
-				array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php' )),
134
+				array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php')),
135 135
 				'first_name'
136 136
 			);
137
-			$billing_form->get_input( 'credit_card_type' )->set_default( 'Visa' );
138
-			$billing_form->get_input( 'exp_year' )->set_default( 2018);
139
-			$billing_form->get_input( 'cvv' )->set_default( '115' );
137
+			$billing_form->get_input('credit_card_type')->set_default('Visa');
138
+			$billing_form->get_input('exp_year')->set_default(2018);
139
+			$billing_form->get_input('cvv')->set_default('115');
140 140
 		}
141 141
 		return $billing_form;
142 142
 	}
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * Keys are their values, values are their pretty names.
149 149
 	 * @return array
150 150
 	 */
151
-	public static function card_types_supported(){
151
+	public static function card_types_supported() {
152 152
 		return array(
153 153
 			'Visa'=>  __("Visa", 'event_espresso'),
154 154
 			'MasterCard'=>  __("MasterCard", 'event_espresso'),
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * @see EE_PMT_Base::help_tabs_config()
165 165
 	 * @return array
166 166
 	 */
167
-	public function help_tabs_config(){
167
+	public function help_tabs_config() {
168 168
 		return array(
169 169
 			$this->get_help_tab_name() => array(
170 170
 						'title' => __('PayPal Pro Settings', 'event_espresso'),
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 * @param EE_Billing_Info_Form $billing_form
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _get_billing_values_from_form( $billing_form ){
183
-		$billing_values = parent::_get_billing_values_from_form( $billing_form );
184
-		$billing_values[ 'country' ] = $billing_form->get_input_value( 'country' );
185
-		$billing_values[ 'credit_card_type' ] = $billing_form->get_input_value( 'credit_card_type' );
182
+	protected function _get_billing_values_from_form($billing_form) {
183
+		$billing_values = parent::_get_billing_values_from_form($billing_form);
184
+		$billing_values['country'] = $billing_form->get_input_value('country');
185
+		$billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type');
186 186
 		return $billing_values;
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 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 7
 /**
7 8
  * Event Espresso
Please login to merge, or discard this patch.
templates/reg_admin_details_main_meta_box_attendees.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,35 +3,35 @@
 block discarded – undo
3 3
 	<br/>
4 4
 <?php //echo EEH_Debug_Tools::printr( $event_attendees, 'event_attendees' ); ?>
5 5
 <?php echo $attendee_notice; ?>
6
-<?php if ( !empty($attendees) ) : ?>
6
+<?php if ( ! empty($attendees)) : ?>
7 7
 	<div class="admin-primary-mbox-tbl-wrap">
8 8
 		<table class="admin-primary-mbox-tbl">
9 9
 			<thead>
10 10
 				<tr>
11
-					<th class="jst-left"><?php _e( '#', 'event_espresso' );?></th>
12
-					<th class="jst-left"><?php _e( 'Event Name', 'event_espresso' );?></th>
13
-					<th class="jst-left"><?php _e( 'Attendee', 'event_espresso' );?></th>
14
-					<th class="jst-rght"><?php _e( 'Price Paid', 'event_espresso' );?></th>
15
-					<th class="jst-left"><?php _e( 'Email', 'event_espresso' );?></th>
16
-					<th class="jst-left"><?php _e( 'Address', 'event_espresso' );?></th>
17
-					<!--<th class="jst-cntr"><?php _e( 'Actions', 'event_espresso' );?></th>-->
11
+					<th class="jst-left"><?php _e('#', 'event_espresso'); ?></th>
12
+					<th class="jst-left"><?php _e('Event Name', 'event_espresso'); ?></th>
13
+					<th class="jst-left"><?php _e('Attendee', 'event_espresso'); ?></th>
14
+					<th class="jst-rght"><?php _e('Price Paid', 'event_espresso'); ?></th>
15
+					<th class="jst-left"><?php _e('Email', 'event_espresso'); ?></th>
16
+					<th class="jst-left"><?php _e('Address', 'event_espresso'); ?></th>
17
+					<!--<th class="jst-cntr"><?php _e('Actions', 'event_espresso'); ?></th>-->
18 18
 				</tr>
19 19
 			</thead>
20 20
 			<tbody>
21 21
 
22
-			<?php foreach ( $attendees as $att_nmbr => $attendee ) : ?>
22
+			<?php foreach ($attendees as $att_nmbr => $attendee) : ?>
23 23
 
24 24
 				<tr>
25
-					<td class="jst-left"><?php echo $att_nmbr;?></td>
26
-					<td class="jst-left"><?php echo $attendee['event_name'];?></td>
25
+					<td class="jst-left"><?php echo $att_nmbr; ?></td>
26
+					<td class="jst-left"><?php echo $attendee['event_name']; ?></td>
27 27
 					<td class="jst-left">
28
-						<a href="<?php echo $attendee['att_link']; ?>" title="<?php esc_attr_e( 'View details for this attendee', 'event_espresso' );?>">
29
-							<?php echo $attendee['fname'] . ' ' . $attendee['lname'];?>
28
+						<a href="<?php echo $attendee['att_link']; ?>" title="<?php esc_attr_e('View details for this attendee', 'event_espresso'); ?>">
29
+							<?php echo $attendee['fname'].' '.$attendee['lname']; ?>
30 30
 						</a>
31 31
 					</td>
32
-					<td class="jst-rght"><?php echo $currency_sign . ' ' . number_format( $attendee['final_price'], 2 );?></td>
33
-					<td class="jst-left"><?php echo $attendee['email'];?></td>
34
-					<td class="jst-left"><?php echo $attendee['address'];?></td>
32
+					<td class="jst-rght"><?php echo $currency_sign.' '.number_format($attendee['final_price'], 2); ?></td>
33
+					<td class="jst-left"><?php echo $attendee['email']; ?></td>
34
+					<td class="jst-left"><?php echo $attendee['address']; ?></td>
35 35
 					<!--<th class="jst-cntr">view</th>-->
36 36
 				</tr>
37 37
 
Please login to merge, or discard this patch.
modules/core_rest_api/EED_Core_Rest_Api.module.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields;
3 3
 
4
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		self::$_field_calculator = new Calculated_Model_Fields();
38
-		return parent::get_instance( __CLASS__ );
38
+		return parent::get_instance(__CLASS__);
39 39
 	}
40 40
 
41 41
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
 	public static function set_hooks_both() {
68
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 );
69
-		add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 );
70
-		add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 );
71
-		add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) );
68
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10);
69
+		add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5);
70
+		add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2);
71
+		add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index'));
72 72
 		EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change();
73 73
 	}
74 74
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Loads all the hooks which make requests to old versions of the API
88 88
 	 * appear the same as they always did
89 89
 	 */
90
-	public static function set_hooks_for_changes(){
90
+	public static function set_hooks_for_changes() {
91 91
 		self::_set_hooks_for_changes();
92 92
 	}
93 93
 
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
 	 * replace it with application passwords.
98 98
 	 */
99 99
 	public static function maybe_notify_of_basic_auth_removal() {
100
-		if( ! isset( $_SERVER['PHP_AUTH_USER'] )
101
-			&& ! isset( $_SERVER['HTTP_AUTHORIZATION'] ) ) {
100
+		if ( ! isset($_SERVER['PHP_AUTH_USER'])
101
+			&& ! isset($_SERVER['HTTP_AUTHORIZATION'])) {
102 102
 			//sure it's a WP API request, but they aren't using basic auth, so don't bother them
103 103
 			return;
104 104
 		}
105 105
 		//ok they're using the WP API with Basic Auth
106 106
 		$message = sprintf(
107
-			__( 'We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso' ),
107
+			__('We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso'),
108 108
 			'<a href="https://wordpress.org/plugins/application-passwords/">',
109 109
 			'</a>',
110 110
 			'<a href="https://eventespresso.com/wiki/ee4-event-apps/#authentication">',
111 111
 			'<br/>'
112 112
 		);
113
-		EE_Error::add_persistent_admin_notice( 'using_basic_auth', $message );
114
-		if( ! get_option( 'ee_notified_admin_on_basic_auth_removal', false ) ) {
115
-			add_option( 'ee_notified_admin_on_basic_auth_removal', true );
113
+		EE_Error::add_persistent_admin_notice('using_basic_auth', $message);
114
+		if ( ! get_option('ee_notified_admin_on_basic_auth_removal', false)) {
115
+			add_option('ee_notified_admin_on_basic_auth_removal', true);
116 116
 			//piggy back off EE_Error::set_content_type, which sets the content type to HTML
117
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
117
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
118 118
 			//and send the message to the site admin too
119
-			wp_mail( get_option( 'admin_email' ), __( 'Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso' ), $message );
120
-			remove_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
+			wp_mail(get_option('admin_email'), __('Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso'), $message);
120
+			remove_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
121 121
 		}
122 122
 	}
123 123
 	/**
@@ -125,16 +125,16 @@  discard block
 block discarded – undo
125 125
 	 * appear the same as they always did
126 126
 	 */
127 127
 	protected static function _set_hooks_for_changes() {
128
-		$folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false );
129
-		foreach( $folder_contents as $classname_in_namespace => $filepath ) {
128
+		$folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false);
129
+		foreach ($folder_contents as $classname_in_namespace => $filepath) {
130 130
 			//ignore the base parent class
131
-			if( $classname_in_namespace === 'Changes_In_Base' ) {
131
+			if ($classname_in_namespace === 'Changes_In_Base') {
132 132
 				continue;
133 133
 			}
134
-			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace;
135
-			if ( class_exists( $full_classname )) {
134
+			$full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace;
135
+			if (class_exists($full_classname)) {
136 136
 				$instance_of_class = new $full_classname;
137
-				if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) {
137
+				if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) {
138 138
 					$instance_of_class->set_hooks();
139 139
 				}
140 140
 			}
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
 	 * so we actually prefer to only do it when an EE plugin is activated or upgraded
148 148
 	 */
149 149
 	public static function register_routes() {
150
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
151
-			foreach( $relative_urls as $endpoint => $routes ) {
152
-				foreach( $routes as $route ) {
150
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
151
+			foreach ($relative_urls as $endpoint => $routes) {
152
+				foreach ($routes as $route) {
153 153
 					register_rest_route(
154 154
 						$namespace,
155 155
 						$endpoint,
156 156
 						array(
157
-							'callback' => $route[ 'callback' ],
158
-							'methods' => $route[ 'methods' ],
159
-							'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(),
157
+							'callback' => $route['callback'],
158
+							'methods' => $route['methods'],
159
+							'args' => isset($route['args']) ? $route['args'] : array(),
160 160
 						)
161 161
 					);
162 162
 				}
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	 * next time the WP API is used
171 171
 	 */
172 172
 	public static function invalidate_cached_route_data_on_version_change() {
173
-		if( EE_System::instance()->detect_req_type() != EE_System::req_type_normal ) {
173
+		if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) {
174 174
 			EED_Core_Rest_Api::invalidate_cached_route_data();
175 175
 		}
176
-		foreach( EE_Registry::instance()->addons as $addon ){
177
-			if( $addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal ) {
176
+		foreach (EE_Registry::instance()->addons as $addon) {
177
+			if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) {
178 178
 				EED_Core_Rest_Api::invalidate_cached_route_data();
179 179
 			}
180 180
 		}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public static function invalidate_cached_route_data() {
187 187
 		//delete the saved EE REST API routes
188
-		delete_option( EED_Core_Rest_Api::saved_routes_option_names );
188
+		delete_option(EED_Core_Rest_Api::saved_routes_option_names);
189 189
 	}
190 190
 
191 191
 	/**
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public static function get_ee_route_data() {
200 200
 		$ee_routes = array();
201
-		foreach( self::versions_served() as $version => $hidden_endpoints ) {
202
-			$ee_routes[  self::ee_api_namespace . $version ] = self::_get_ee_route_data_for_version( $version, $hidden_endpoints );
201
+		foreach (self::versions_served() as $version => $hidden_endpoints) {
202
+			$ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version, $hidden_endpoints);
203 203
 		}
204 204
 		return $ee_routes;
205 205
 	}
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	 * @param boolean $hidden_endpoints
212 212
 	 * @return array
213 213
 	 */
214
-	protected static function _get_ee_route_data_for_version( $version, $hidden_endpoints = false ) {
215
-		$ee_routes = get_option( self::saved_routes_option_names . $version , null );
216
-		if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){
217
-			$ee_routes = self::_save_ee_route_data_for_version( $version, $hidden_endpoints );
214
+	protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) {
215
+		$ee_routes = get_option(self::saved_routes_option_names.$version, null);
216
+		if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) {
217
+			$ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints);
218 218
 		}
219 219
 		return $ee_routes;
220 220
 	}
@@ -228,18 +228,18 @@  discard block
 block discarded – undo
228 228
 	 * @param boolean $hidden_endpoints
229 229
 	 * @return mixed|null|void
230 230
 	 */
231
-	protected static function _save_ee_route_data_for_version( $version, $hidden_endpoints = false ) {
231
+	protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) {
232 232
 		$instance = self::instance();
233 233
 		$routes = apply_filters(
234 234
 			'EED_Core_Rest_Api__save_ee_route_data_for_version__routes',
235 235
 			array_replace_recursive(
236
-				$instance->_get_config_route_data_for_version( $version, $hidden_endpoints ),
237
-				$instance->_get_meta_route_data_for_version( $version, $hidden_endpoints ),
238
-				$instance->_get_model_route_data_for_version( $version, $hidden_endpoints ),
239
-				$instance->_get_rpc_route_data_for_version( $version, $hidden_endpoints )
236
+				$instance->_get_config_route_data_for_version($version, $hidden_endpoints),
237
+				$instance->_get_meta_route_data_for_version($version, $hidden_endpoints),
238
+				$instance->_get_model_route_data_for_version($version, $hidden_endpoints),
239
+				$instance->_get_rpc_route_data_for_version($version, $hidden_endpoints)
240 240
 			)
241 241
 		);
242
-		update_option( self::saved_routes_option_names . $version, $routes, true );
242
+		update_option(self::saved_routes_option_names.$version, $routes, true);
243 243
 		return $routes;
244 244
 	}
245 245
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @return void
251 251
 	 */
252 252
 	public static function save_ee_routes() {
253
-		if( EE_Maintenance_Mode::instance()->models_can_query() ){
253
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
254 254
 			$instance = self::instance();
255 255
 			$routes = apply_filters(
256 256
 				'EED_Core_Rest_Api__save_ee_routes__routes',
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 					$instance->_register_rpc_routes()
262 262
 				)
263 263
 			);
264
-			update_option( self::saved_routes_option_names, $routes, true );
264
+			update_option(self::saved_routes_option_names, $routes, true);
265 265
 		}
266 266
 	}
267 267
 
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	protected function _register_model_routes() {
274 274
 		$model_routes = array( );
275
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
276
-			$model_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint );
275
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
276
+			$model_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
277 277
 		}
278 278
 		return $model_routes;
279 279
 	}
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param boolean $hidden_endpoint
285 285
 	 * @return array
286 286
 	 */
287
-	protected function _get_model_route_data_for_version( $version, $hidden_endpoint = false ) {
288
-		$model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info( $version );
287
+	protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) {
288
+		$model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info($version);
289 289
 		$models_to_register = apply_filters(
290 290
 			'FHEE__EED_Core_REST_API___register_model_routes',
291 291
 			$model_version_info->models_for_requested_version()
@@ -294,21 +294,21 @@  discard block
 block discarded – undo
294 294
 		unset($models_to_register['Extra_Meta']);
295 295
 		unset($models_to_register['Extra_Join']);
296 296
 		$model_routes = array();
297
-		foreach ( $models_to_register as $model_name => $model_classname ) {
298
-			$model = \EE_Registry::instance()->load_model( $model_name );
297
+		foreach ($models_to_register as $model_name => $model_classname) {
298
+			$model = \EE_Registry::instance()->load_model($model_name);
299 299
 			//yes we could just register one route for ALL models, but then they wouldn't show up in the index
300
-			$plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name );
301
-			$singular_model_route = $plural_model_route . '/(?P<id>\d+)' ;
302
-			$model_routes[ $plural_model_route ] = array(
300
+			$plural_model_route = EEH_Inflector::pluralize_and_lower($model_name);
301
+			$singular_model_route = $plural_model_route.'/(?P<id>\d+)';
302
+			$model_routes[$plural_model_route] = array(
303 303
 					array(
304 304
 						'callback' => array(
305 305
 							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
306 306
 							'handle_request_get_all' ),
307 307
 						'methods' => WP_REST_Server::READABLE,
308 308
 						'hidden_endpoint' => $hidden_endpoint,
309
-						'args' => $this->_get_read_query_params( $model, $version ),
309
+						'args' => $this->_get_read_query_params($model, $version),
310 310
 						'_links' => array(
311
-							'self' => rest_url( EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route ),
311
+							'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route),
312 312
 						)
313 313
 					),
314 314
 //						array(
@@ -319,14 +319,14 @@  discard block
 block discarded – undo
319 319
 //							'hidden_endpoint' => $hidden_endpoint
320 320
 //						)
321 321
 				);
322
-			$model_routes[ $singular_model_route ] = array(
322
+			$model_routes[$singular_model_route] = array(
323 323
 					array(
324 324
 						'callback' => array(
325 325
 							'EventEspresso\core\libraries\rest_api\controllers\model\Read',
326 326
 							'handle_request_get_one' ),
327 327
 						'methods' => WP_REST_Server::READABLE,
328 328
 						'hidden_endpoint' => $hidden_endpoint,
329
-						'args' => $this->_get_response_selection_query_params( $model, $version)
329
+						'args' => $this->_get_response_selection_query_params($model, $version)
330 330
 					),
331 331
 //						array(
332 332
 //							'callback' => array(
@@ -337,19 +337,19 @@  discard block
 block discarded – undo
337 337
 //							),
338 338
 			);
339 339
 			//@todo: also handle  DELETE for a single item
340
-			foreach ( $model->relation_settings() as $relation_name => $relation_obj ) {
340
+			foreach ($model->relation_settings() as $relation_name => $relation_obj) {
341 341
 				$related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name(
342 342
 					$relation_name,
343 343
 					$relation_obj
344 344
 				);
345
-				$model_routes[ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array(
345
+				$model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array(
346 346
 						array(
347 347
 							'callback' => array(
348 348
 								'EventEspresso\core\libraries\rest_api\controllers\model\Read',
349 349
 								'handle_request_get_related' ),
350 350
 							'methods' => WP_REST_Server::READABLE,
351 351
 							'hidden_endpoint' => $hidden_endpoint,
352
-							'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ),
352
+							'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version),
353 353
 						),
354 354
 //							array(
355 355
 //								'callback' => array(
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	protected function _register_rpc_routes() {
374 374
 		$routes = array();
375
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
376
-			$routes[ self::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( $version, $hidden_endpoint );
375
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
376
+			$routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version, $hidden_endpoint);
377 377
 		}
378 378
 		return $routes;
379 379
 	}
@@ -384,10 +384,10 @@  discard block
 block discarded – undo
384 384
 	 * @param boolean $hidden_endpoint
385 385
 	 * @return array
386 386
 	 */
387
-	protected function _get_rpc_route_data_for_version( $version, $hidden_endpoint = false ) {
387
+	protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) {
388 388
 		$this_versions_routes = array();
389 389
 			//checkin endpoint
390
-			$this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array(
390
+			$this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array(
391 391
 				array(
392 392
 					'callback' => array(
393 393
 						'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin',
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 						'force' => array(
399 399
 							'required' => false,
400 400
 							'default' => false,
401
-							'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' )
401
+							'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso')
402 402
 						)
403 403
 					)
404 404
 				)
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 * @param string $version
418 418
 	 * @return array
419 419
 	 */
420
-	protected function _get_response_selection_query_params( \EEM_Base $model, $version ) {
420
+	protected function _get_response_selection_query_params(\EEM_Base $model, $version) {
421 421
 		return apply_filters(
422 422
 			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
423 423
 			array(
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 				'calculate' => array(
429 429
 					'required' => false,
430 430
 					'default' => '',
431
-					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model )
431
+					'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model)
432 432
 				)
433 433
 			),
434 434
 			$model,
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
 	 * @return array    describing the args acceptable when querying this model
447 447
 	 * @throws \EE_Error
448 448
 	 */
449
-	protected function _get_read_query_params( \EEM_Base $model, $version ) {
449
+	protected function _get_read_query_params(\EEM_Base $model, $version) {
450 450
 		$default_orderby = array();
451
-		foreach( $model->get_combined_primary_key_fields() as $key_field ) {
452
-			$default_orderby[ $key_field->get_name() ] = 'ASC';
451
+		foreach ($model->get_combined_primary_key_fields() as $key_field) {
452
+			$default_orderby[$key_field->get_name()] = 'ASC';
453 453
 		}
454 454
 		return array_merge(
455
-			$this->_get_response_selection_query_params( $model, $version ),
455
+			$this->_get_response_selection_query_params($model, $version),
456 456
 			array(
457 457
 				'where' => array(
458 458
 					'required' => false,
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 	 */
490 490
 	protected function _register_config_routes() {
491 491
 		$config_routes = array();
492
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
493
-			$config_routes[ self::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version,	$hidden_endpoint );
492
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
493
+			$config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint);
494 494
 		}
495 495
 		return $config_routes;
496 496
 	}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 * @param boolean $hidden_endpoint
502 502
 	 * @return array
503 503
 	 */
504
-	protected function _get_config_route_data_for_version( $version, $hidden_endpoint ) {
504
+	protected function _get_config_route_data_for_version($version, $hidden_endpoint) {
505 505
 		return array(
506 506
 			'config' => array(
507 507
 				array(
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	protected function _register_meta_routes() {
524 524
 		$meta_routes = array();
525
-		foreach( self::versions_served() as $version => $hidden_endpoint ) {
526
-			$meta_routes[ self::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( $version, $hidden_endpoint );
525
+		foreach (self::versions_served() as $version => $hidden_endpoint) {
526
+			$meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version, $hidden_endpoint);
527 527
 		}
528 528
 		return $meta_routes;
529 529
 	}
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @param boolean $hidden_endpoint
535 535
 	 * @return array
536 536
 	 */
537
-	protected function _get_meta_route_data_for_version( $version, $hidden_endpoint = false ) {
537
+	protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) {
538 538
 		return array(
539 539
 			'resources'  => array(
540 540
 				array(
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 	 * @param array $route_data
557 557
 	 * @return array
558 558
 	 */
559
-	public static function hide_old_endpoints( $route_data ) {
559
+	public static function hide_old_endpoints($route_data) {
560 560
 		//allow API clients to override which endpoints get hidden, in case
561 561
 		//they want to discover particular endpoints
562 562
 		//also, we don't have access to the request so we have to just grab it from the superglobal
563 563
 		$force_show_ee_namespace = ltrim(
564
-			EEH_Array::is_set( $_REQUEST, 'force_show_ee_namespace', '' ),
564
+			EEH_Array::is_set($_REQUEST, 'force_show_ee_namespace', ''),
565 565
 			'/'
566 566
 		);
567 567
 		
568
-		foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) {
569
-			foreach( $relative_urls as $endpoint => $routes ) {
570
-				foreach( $routes as $route ) {
568
+		foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) {
569
+			foreach ($relative_urls as $endpoint => $routes) {
570
+				foreach ($routes as $route) {
571 571
 					//by default, hide "hidden_endpoint"s, unless the request indicates
572 572
 					//to $force_show_ee_namespace, in which case only show that one
573 573
 					//namespace's endpoints (and hide all others)
574
-					if( ( $route[ 'hidden_endpoint' ] && $force_show_ee_namespace === '' )
575
-						|| ( $force_show_ee_namespace !== null && $force_show_ee_namespace !== $namespace ) ) {
576
-						$full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' );
577
-						unset( $route_data[ $full_route ] );
574
+					if (($route['hidden_endpoint'] && $force_show_ee_namespace === '')
575
+						|| ($force_show_ee_namespace !== null && $force_show_ee_namespace !== $namespace)) {
576
+						$full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/');
577
+						unset($route_data[$full_route]);
578 578
 					}
579 579
 				}
580 580
 			}
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	public static function latest_rest_api_version() {
615 615
 		$versions_served = \EED_Core_Rest_Api::versions_served();
616
-		$versions_served_keys = array_keys( $versions_served );
617
-		return end( $versions_served_keys );
616
+		$versions_served_keys = array_keys($versions_served);
617
+		return end($versions_served_keys);
618 618
 	}
619 619
 
620 620
 	/**
@@ -628,32 +628,32 @@  discard block
 block discarded – undo
628 628
 	public static function versions_served() {
629 629
 		$versions_served = array();
630 630
 		$possibly_served_versions = EED_Core_Rest_Api::version_compatibilities();
631
-		$lowest_compatible_version = end( $possibly_served_versions);
632
-		reset( $possibly_served_versions );
633
-		$versions_served_historically = array_keys( $possibly_served_versions );
634
-		$latest_version = end( $versions_served_historically );
635
-		reset( $versions_served_historically );
631
+		$lowest_compatible_version = end($possibly_served_versions);
632
+		reset($possibly_served_versions);
633
+		$versions_served_historically = array_keys($possibly_served_versions);
634
+		$latest_version = end($versions_served_historically);
635
+		reset($versions_served_historically);
636 636
 		//for each version of core we have ever served:
637
-		foreach ( $versions_served_historically as $key_versioned_endpoint ) {
637
+		foreach ($versions_served_historically as $key_versioned_endpoint) {
638 638
 			//if it's not above the current core version, and it's compatible with the current version of core
639
-			if( $key_versioned_endpoint == $latest_version ) {
639
+			if ($key_versioned_endpoint == $latest_version) {
640 640
 				//don't hide the latest version in the index
641
-				$versions_served[ $key_versioned_endpoint ] = false;
642
-			} else if(
641
+				$versions_served[$key_versioned_endpoint] = false;
642
+			} else if (
643 643
 				$key_versioned_endpoint < EED_Core_Rest_Api::core_version()
644 644
 				&& $key_versioned_endpoint >= $lowest_compatible_version
645 645
 			) {
646 646
 				//include, but hide, previous versions which are still supported
647
-				$versions_served[ $key_versioned_endpoint ] = true;
648
-			} elseif(
647
+				$versions_served[$key_versioned_endpoint] = true;
648
+			} elseif (
649 649
 				apply_filters(
650 650
 					'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions',
651 651
 					false,
652 652
 					$possibly_served_versions
653 653
 				)
654
-			){
654
+			) {
655 655
 				//if a version is no longer supported, don't include it in index or list of versions served
656
-				$versions_served[ $key_versioned_endpoint ] = true;
656
+				$versions_served[$key_versioned_endpoint] = true;
657 657
 			}
658 658
 		}
659 659
 		return $versions_served;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	 * @return string
667 667
 	 */
668 668
 	public static function core_version() {
669
-		return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) );
669
+		return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3)));
670 670
 	}
671 671
 
672 672
 	/**
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @param  WP $WP
692 692
 	 * @return    void
693 693
 	 */
694
-	public function run( $WP ) {
694
+	public function run($WP) {
695 695
 
696 696
 	}
697 697
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Resource_Manager.lib.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @return void
881 881
 	 */
882 882
 	public function deactivate_messenger( $messenger_name ) {
883
-        $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
883
+		$this->_initialize_collections();
884
+		if ( $messenger_name instanceof EE_messenger ) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887 887
 		unset( $this->_active_messengers[ $messenger_name ] );
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899 899
 	public function deactivate_message_type( $message_type_name ) {
900
-        $this->_initialize_collections();
900
+		$this->_initialize_collections();
901 901
 		if ( $message_type_name instanceof EE_message_type ) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929 929
 	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
930
-        $this->_initialize_collections();
930
+		$this->_initialize_collections();
931 931
 		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932 932
 			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
933 933
 		}
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @return void
135 135
 	 */
136 136
 	protected function _initialize_collections() {
137
-		if ( $this->_initialized ) {
137
+		if ($this->_initialized) {
138 138
 			return;
139 139
 		}
140 140
 		$this->_initialized = true;
141 141
 		$this->_messenger_collection_loader->load_messengers_from_folder();
142 142
 		$this->_message_type_collection_loader->load_message_types_from_folder();
143
-		$this->get_has_activated_messengers_option( true );
143
+		$this->get_has_activated_messengers_option(true);
144 144
 		$this->_set_active_messengers_and_message_types();
145 145
 	}
146 146
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @param string $messenger_name
171 171
 	 * @return \EE_messenger
172 172
 	 */
173
-	public function get_messenger( $messenger_name ) {
174
-		return $this->messenger_collection()->get_by_info( $messenger_name );
173
+	public function get_messenger($messenger_name) {
174
+		return $this->messenger_collection()->get_by_info($messenger_name);
175 175
 	}
176 176
 
177 177
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 	 * @param string $messenger
183 183
 	 * @return EE_messenger | null
184 184
 	 */
185
-	public function get_active_messenger( $messenger ) {
185
+	public function get_active_messenger($messenger) {
186 186
 		$this->_initialize_collections();
187
-		return ! empty( $this->_active_messengers[ $messenger ] ) ? $this->_active_messengers[ $messenger ] : null;
187
+		return ! empty($this->_active_messengers[$messenger]) ? $this->_active_messengers[$messenger] : null;
188 188
 	}
189 189
 
190 190
 
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 * @return \EE_messenger[]
194 194
 	 */
195 195
 	public function installed_messengers() {
196
-		if ( empty( $this->_installed_messengers ) ) {
196
+		if (empty($this->_installed_messengers)) {
197 197
 			$this->_installed_messengers = array();
198 198
 			$this->messenger_collection()->rewind();
199
-			while ( $this->messenger_collection()->valid() ) {
200
-				$this->_installed_messengers[ $this->messenger_collection()->current()->name ] = $this->messenger_collection()->current();
199
+			while ($this->messenger_collection()->valid()) {
200
+				$this->_installed_messengers[$this->messenger_collection()->current()->name] = $this->messenger_collection()->current();
201 201
 				$this->messenger_collection()->next();
202 202
 			}
203 203
 		}
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 * @return \EE_messenger
212 212
 	 * @throws \EE_Error
213 213
 	 */
214
-	public function valid_messenger( $messenger_name ) {
215
-		$messenger = $this->get_messenger( $messenger_name );
216
-		if ( $messenger instanceof EE_messenger ) {
214
+	public function valid_messenger($messenger_name) {
215
+		$messenger = $this->get_messenger($messenger_name);
216
+		if ($messenger instanceof EE_messenger) {
217 217
 			return $messenger;
218 218
 		}
219 219
 		throw new EE_Error(
220 220
 			sprintf(
221
-				__( 'The "%1$s" messenger is either invalid or not installed', 'event_espresso' ),
221
+				__('The "%1$s" messenger is either invalid or not installed', 'event_espresso'),
222 222
 				$messenger_name
223 223
 			)
224 224
 		);
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param string $message_type_name
251 251
 	 * @return \EE_message_type
252 252
 	 */
253
-	public function get_message_type( $message_type_name ) {
254
-		return $this->message_type_collection()->get_by_info( $message_type_name );
253
+	public function get_message_type($message_type_name) {
254
+		return $this->message_type_collection()->get_by_info($message_type_name);
255 255
 	}
256 256
 
257 257
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	 * @param string $message_type_name
264 264
 	 * @return \EE_message_type|null
265 265
 	 */
266
-	public function get_active_message_type_for_messenger( $messenger_name, $message_type_name ) {
267
-		return $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
268
-			? $this->get_message_type( $message_type_name )
266
+	public function get_active_message_type_for_messenger($messenger_name, $message_type_name) {
267
+		return $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)
268
+			? $this->get_message_type($message_type_name)
269 269
 			: null;
270 270
 	}
271 271
 
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return bool
281 281
 	 */
282
-	public function is_message_type_active_for_messenger( $messenger_name, $message_type_name ) {
282
+	public function is_message_type_active_for_messenger($messenger_name, $message_type_name) {
283 283
 		$this->_initialize_collections();
284
-		return ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
284
+		return ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
285 285
 	}
286 286
 
287 287
 
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param string $messenger_name  the name of the messenger to check if active.
293 293
 	 * @return bool
294 294
 	 */
295
-	public function is_messenger_active( $messenger_name ) {
295
+	public function is_messenger_active($messenger_name) {
296 296
 		$this->_initialize_collections();
297
-		return ! empty( $this->_active_message_types[ $messenger_name ] );
297
+		return ! empty($this->_active_message_types[$messenger_name]);
298 298
 	}
299 299
 
300 300
 
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	 * @param string $message_type_name  The slug of the message type getting the settings for.
306 306
 	 * @return array
307 307
 	 */
308
-	public function get_message_type_settings_for_messenger( $messenger_name, $message_type_name ) {
308
+	public function get_message_type_settings_for_messenger($messenger_name, $message_type_name) {
309 309
 		$settings = array();
310
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
311
-			$settings =  isset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] )
312
-				? $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings']
310
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
311
+			$settings = isset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'])
312
+				? $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings']
313 313
 				: array();
314 314
 		}
315 315
 		return $settings;
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
 	 * @param string $messenger_name
325 325
 	 * @return bool
326 326
 	 */
327
-	public function messenger_has_active_message_types( $messenger_name ) {
327
+	public function messenger_has_active_message_types($messenger_name) {
328 328
 		$this->_initialize_collections();
329 329
 		return
330
-			! empty( $this->_active_message_types[ $messenger_name ] )
331
-			&& ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ] );
330
+			! empty($this->_active_message_types[$messenger_name])
331
+			&& ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types']);
332 332
 	}
333 333
 
334 334
 
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
 	 * @param string $messenger_name The messenger being checked
342 342
 	 * @return EE_message_type[]|array    (empty array if no active_message_types)
343 343
 	 */
344
-	public function get_active_message_types_for_messenger( $messenger_name ) {
344
+	public function get_active_message_types_for_messenger($messenger_name) {
345 345
 		$message_types = array();
346
-		if ( ! $this->messenger_has_active_message_types( $messenger_name ) ) {
346
+		if ( ! $this->messenger_has_active_message_types($messenger_name)) {
347 347
 			return $message_types;
348 348
 		}
349 349
 		$installed_message_types = $this->installed_message_types();
350
-		foreach ( $installed_message_types as $message_type_name => $message_type ) {
351
-			if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
352
-				$message_types[ $message_type_name ] = $message_type;
350
+		foreach ($installed_message_types as $message_type_name => $message_type) {
351
+			if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
352
+				$message_types[$message_type_name] = $message_type;
353 353
 			}
354 354
 		}
355 355
 		return $message_types;
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 	public function list_of_active_message_types() {
368 368
 		$active_message_type_names = array();
369 369
 		$this->_initialize_collections();
370
-		foreach ( $this->_active_message_types as $messenger => $messenger_settings ) {
371
-			if ( ! isset( $messenger_settings['settings'][ $messenger . '-message_types' ] ) ) {
370
+		foreach ($this->_active_message_types as $messenger => $messenger_settings) {
371
+			if ( ! isset($messenger_settings['settings'][$messenger.'-message_types'])) {
372 372
 				continue;
373 373
 			}
374
-			foreach ( $messenger_settings['settings'][ $messenger . '-message_types' ] as $message_type_name => $message_type_config ) {
375
-				if ( ! in_array( $message_type_name, $active_message_type_names ) ) {
374
+			foreach ($messenger_settings['settings'][$messenger.'-message_types'] as $message_type_name => $message_type_config) {
375
+				if ( ! in_array($message_type_name, $active_message_type_names)) {
376 376
 					$active_message_type_names[] = $message_type_name;
377 377
 				}
378 378
 			}
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 		$active_message_types = array();
393 393
 		$installed_message_types = $this->installed_message_types();
394 394
 		$active_message_type_names = $this->list_of_active_message_types();
395
-		foreach ( $active_message_type_names as $active_message_type_name ) {
396
-			if ( isset( $installed_message_types[ $active_message_type_name ] ) ) {
397
-				$active_message_types[ $active_message_type_name ] = $installed_message_types[ $active_message_type_name ];
395
+		foreach ($active_message_type_names as $active_message_type_name) {
396
+			if (isset($installed_message_types[$active_message_type_name])) {
397
+				$active_message_types[$active_message_type_name] = $installed_message_types[$active_message_type_name];
398 398
 			}
399 399
 		}
400 400
 		return $active_message_types;
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 	 * @return \EE_message_type[]
407 407
 	 */
408 408
 	public function installed_message_types() {
409
-		if ( empty( $this->_installed_message_types ) ) {
409
+		if (empty($this->_installed_message_types)) {
410 410
 			$this->message_type_collection()->rewind();
411
-			while ( $this->message_type_collection()->valid() ) {
412
-				$this->_installed_message_types[ $this->message_type_collection()->current()->name ] = $this->message_type_collection()->current();
411
+			while ($this->message_type_collection()->valid()) {
412
+				$this->_installed_message_types[$this->message_type_collection()->current()->name] = $this->message_type_collection()->current();
413 413
 				$this->message_type_collection()->next();
414 414
 			}
415 415
 		}
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 	 * @return \EE_message_type
423 423
 	 * @throws \EE_Error
424 424
 	 */
425
-	public function valid_message_type( $message_type_name ) {
426
-		$message_type = $this->get_message_type( $message_type_name );
427
-		if ( $message_type instanceof EE_message_type ) {
425
+	public function valid_message_type($message_type_name) {
426
+		$message_type = $this->get_message_type($message_type_name);
427
+		if ($message_type instanceof EE_message_type) {
428 428
 			return $message_type;
429 429
 		}
430 430
 		throw new EE_Error(
431 431
 			sprintf(
432
-				__( 'The "%1$s" message type is either invalid or not installed', 'event_espresso' ),
432
+				__('The "%1$s" message type is either invalid or not installed', 'event_espresso'),
433 433
 				$message_type_name
434 434
 			)
435 435
 		);
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
 	 * @return boolean
446 446
 	 * @throws \EE_Error
447 447
 	 */
448
-	public function valid_message_type_for_messenger( EE_messenger $messenger, $message_type_name ) {
448
+	public function valid_message_type_for_messenger(EE_messenger $messenger, $message_type_name) {
449 449
 		$valid_message_types = $messenger->get_valid_message_types();
450
-		if ( ! in_array( $message_type_name, $valid_message_types ) ) {
450
+		if ( ! in_array($message_type_name, $valid_message_types)) {
451 451
 			throw new EE_Error(
452 452
 				sprintf(
453 453
 					__(
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return array
476 476
 	 */
477
-	public function get_active_messengers_option( $reset = false) {
478
-		if ( $reset ) {
479
-			$this->_active_message_types = get_option( 'ee_active_messengers', array() );
477
+	public function get_active_messengers_option($reset = false) {
478
+		if ($reset) {
479
+			$this->_active_message_types = get_option('ee_active_messengers', array());
480 480
 		}
481 481
 		return $this->_active_message_types;
482 482
 	}
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 *                                 representing this data is used.
491 491
 	 * @return bool FALSE if not updated, TRUE if updated.
492 492
 	 */
493
-	public function update_active_messengers_option( $active_messenger_settings = array() ) {
494
-		$active_messenger_settings = empty( $active_messenger_settings ) ? $this->_active_message_types : $active_messenger_settings;
493
+	public function update_active_messengers_option($active_messenger_settings = array()) {
494
+		$active_messenger_settings = empty($active_messenger_settings) ? $this->_active_message_types : $active_messenger_settings;
495 495
 		//make sure _active_message_types is updated (this is the internal cache for the settings).
496 496
 		$this->_active_message_types = $active_messenger_settings;
497
-		return update_option( 'ee_active_messengers', $active_messenger_settings );
497
+		return update_option('ee_active_messengers', $active_messenger_settings);
498 498
 	}
499 499
 
500 500
 
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @return array
511 511
 	 */
512
-	public function get_has_activated_messengers_option( $reset = false ) {
513
-		if ( $reset || empty( $this->_has_activated_messengers_and_message_types ) ) {
514
-			$this->_has_activated_messengers_and_message_types = get_option( 'ee_has_activated_messenger', array() );
512
+	public function get_has_activated_messengers_option($reset = false) {
513
+		if ($reset || empty($this->_has_activated_messengers_and_message_types)) {
514
+			$this->_has_activated_messengers_and_message_types = get_option('ee_has_activated_messenger', array());
515 515
 		}
516 516
 		return $this->_has_activated_messengers_and_message_types;
517 517
 	}
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @return bool FALSE if not updated, TRUE if updated.
528 528
 	 */
529
-	public function update_has_activated_messengers_option( $has_activated_messengers = array() ) {
529
+	public function update_has_activated_messengers_option($has_activated_messengers = array()) {
530 530
 		//make sure the option has been retrieved from first so we don't overwrite it accidentally.
531
-		if ( empty( $has_activated_messengers ) && empty( $this->_has_activated_messengers_and_message_types ) ) {
531
+		if (empty($has_activated_messengers) && empty($this->_has_activated_messengers_and_message_types)) {
532 532
 			$this->get_has_activated_messengers_option();
533 533
 		}
534
-		$has_activated_messengers = empty( $has_activated_messengers )
534
+		$has_activated_messengers = empty($has_activated_messengers)
535 535
 			? $this->_has_activated_messengers_and_message_types
536 536
 			: $has_activated_messengers;
537
-		return update_option( 'ee_has_activated_messenger', $has_activated_messengers );
537
+		return update_option('ee_has_activated_messenger', $has_activated_messengers);
538 538
 	}
539 539
 
540 540
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 		//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n";
557 557
 		// list of activated messengers as set via the admin
558 558
 		// note calling `get_active_messengers_options` also initializes the _active_message_types property.
559
-		$this->get_active_messengers_option( true );
560
-		$this->ensure_messengers_are_active( array(), false, true );
559
+		$this->get_active_messengers_option(true);
560
+		$this->ensure_messengers_are_active(array(), false, true);
561 561
 		$this->update_active_messengers_option();
562 562
 		$this->update_has_activated_messengers_option();
563 563
 	}
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
 	 * @param bool   $update_option  Whether to update the option in the db or not.
576 576
 	 * @return boolean true if either already active or successfully activated.
577 577
 	 */
578
-	public function ensure_messenger_is_active( $messenger_name, $update_option = true ) {
579
-		if ( ! isset( $this->_active_messengers[ $messenger_name ] ) ) {
578
+	public function ensure_messenger_is_active($messenger_name, $update_option = true) {
579
+		if ( ! isset($this->_active_messengers[$messenger_name])) {
580 580
 			try {
581
-				$this->activate_messenger( $messenger_name, array(), $update_option );
582
-			} catch( EE_Error $e ) {
581
+				$this->activate_messenger($messenger_name, array(), $update_option);
582
+			} catch (EE_Error $e) {
583 583
 				EE_Error::add_error(
584 584
 					$e->getMessage(),
585 585
 					__FILE__,
@@ -606,25 +606,25 @@  discard block
 block discarded – undo
606 606
 	 *                                and a messenger is indicated as active, but is NOT installed, then it will automatically be
607 607
 	 *                                deactivated.
608 608
 	 */
609
-	public function ensure_messengers_are_active( $messenger_names = array(), $update_option = true, $verify = false ) {
610
-		$messenger_names = empty( $messenger_names ) ? array_keys( $this->_active_message_types ) : $messenger_names;
609
+	public function ensure_messengers_are_active($messenger_names = array(), $update_option = true, $verify = false) {
610
+		$messenger_names = empty($messenger_names) ? array_keys($this->_active_message_types) : $messenger_names;
611 611
 
612 612
 		$not_installed = array();
613
-		foreach( $messenger_names as $messenger_name ) {
614
-			if ( $verify && ! $this->messenger_collection()->has_by_name( $messenger_name ) ) {
613
+		foreach ($messenger_names as $messenger_name) {
614
+			if ($verify && ! $this->messenger_collection()->has_by_name($messenger_name)) {
615 615
 				$not_installed[] = $messenger_name;
616
-				$this->deactivate_messenger( $messenger_name );
616
+				$this->deactivate_messenger($messenger_name);
617 617
 				continue;
618 618
 			}
619
-			$this->ensure_messenger_is_active( $messenger_name, $update_option );
619
+			$this->ensure_messenger_is_active($messenger_name, $update_option);
620 620
 		}
621 621
 
622
-		if ( ! empty( $not_installed_messenger ) ) {
622
+		if ( ! empty($not_installed_messenger)) {
623 623
 			EE_Error::add_error(
624 624
 				sprintf(
625
-					__( 'The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso' ),
625
+					__('The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso'),
626 626
 					'<br />',
627
-					implode( ', ', $not_installed_messenger )
627
+					implode(', ', $not_installed_messenger)
628 628
 				),
629 629
 				__FILE__, __FUNCTION__, __LINE__
630 630
 			);
@@ -643,18 +643,18 @@  discard block
 block discarded – undo
643 643
 	 * @return bool  Returns true if already is active or if was activated successfully.
644 644
 	 * @throws \EE_Error
645 645
 	 */
646
-	public function ensure_message_type_is_active( $message_type_name, $messenger_name, $update_option = true ) {
646
+	public function ensure_message_type_is_active($message_type_name, $messenger_name, $update_option = true) {
647 647
 		// grab the messenger to work with.
648
-		$messenger = $this->valid_messenger( $messenger_name );
649
-		if ( $this->valid_message_type_for_messenger( $messenger, $message_type_name ) ) {
648
+		$messenger = $this->valid_messenger($messenger_name);
649
+		if ($this->valid_message_type_for_messenger($messenger, $message_type_name)) {
650 650
 			//ensure messenger is active (that's an inherent coupling between active message types and the
651 651
 			//messenger they are being activated for.
652 652
 			try {
653
-				if ( ! $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
653
+				if ( ! $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
654 654
 					//all is good so let's just get it active
655
-					$this->activate_messenger( $messenger_name, array( $message_type_name ), $update_option );
655
+					$this->activate_messenger($messenger_name, array($message_type_name), $update_option);
656 656
 				}
657
-			} catch( EE_Error $e ) {
657
+			} catch (EE_Error $e) {
658 658
 				EE_Error::add_error(
659 659
 					$e->getMessage(),
660 660
 					__FILE__,
@@ -678,14 +678,14 @@  discard block
 block discarded – undo
678 678
 	 * @param string $messenger_name      The name of the messenger that the message types are to be activated on.
679 679
 	 * @param bool   $update_option       Whether to persist the activation to the database or not (default true).
680 680
 	 */
681
-	public function ensure_message_types_are_active( $message_type_names, $messenger_name, $update_option = true ) {
681
+	public function ensure_message_types_are_active($message_type_names, $messenger_name, $update_option = true) {
682 682
 		$message_type_names = (array) $message_type_names;
683
-		foreach ( $message_type_names as $message_type_name ) {
683
+		foreach ($message_type_names as $message_type_name) {
684 684
 			// note, intentionally not updating option here because we're in a loop.
685 685
 			// We'll follow the instructions of the incoming $update_option argument after the loop.
686
-			$this->ensure_message_type_is_active( $message_type_name, $messenger_name, false );
686
+			$this->ensure_message_type_is_active($message_type_name, $messenger_name, false);
687 687
 		}
688
-		if ( $update_option ) {
688
+		if ($update_option) {
689 689
 			$this->update_active_messengers_option();
690 690
 			$this->update_has_activated_messengers_option();
691 691
 		}
@@ -712,24 +712,24 @@  discard block
 block discarded – undo
712 712
 	) {
713 713
 		$templates = array();
714 714
 		// grab the messenger to work with.
715
-		$messenger = $this->messenger_collection()->get_by_info( $messenger_name );
715
+		$messenger = $this->messenger_collection()->get_by_info($messenger_name);
716 716
 		// it's inactive. Activate it.
717
-		if ( $messenger instanceof EE_messenger ) {
718
-			$this->_active_messengers[ $messenger->name ] = $messenger;
717
+		if ($messenger instanceof EE_messenger) {
718
+			$this->_active_messengers[$messenger->name] = $messenger;
719 719
 			//activate incoming message types set to be activated with messenger.
720
-			$message_type_names = $this->_activate_message_types( $messenger, $message_type_names );
720
+			$message_type_names = $this->_activate_message_types($messenger, $message_type_names);
721 721
 			// setup any initial settings for the messenger if necessary.
722
-			$this->add_settings_for_messenger( $messenger->name );
723
-			if ( $update_active_messengers_option ) {
722
+			$this->add_settings_for_messenger($messenger->name);
723
+			if ($update_active_messengers_option) {
724 724
 				$this->update_active_messengers_option();
725 725
 				$this->update_has_activated_messengers_option();
726 726
 			}
727 727
 			//generate new templates if necessary and ensure all related templates that are already in the database are
728 728
 			//marked active.  Note, this will also deactivate a message type for a messenger if the template
729 729
 			//cannot be successfully created during its attempt (only happens for global template attempts).
730
-			if ( ! empty( $message_type_names ) ) {
731
-				$templates = EEH_MSG_Template::generate_new_templates( $messenger->name, $message_type_names, 0, true );
732
-				EEH_MSG_Template::update_to_active( array( $messenger->name ), $message_type_names );
730
+			if ( ! empty($message_type_names)) {
731
+				$templates = EEH_MSG_Template::generate_new_templates($messenger->name, $message_type_names, 0, true);
732
+				EEH_MSG_Template::update_to_active(array($messenger->name), $message_type_names);
733 733
 			}
734 734
 		}
735 735
 		return $templates;
@@ -748,29 +748,29 @@  discard block
 block discarded – undo
748 748
 	 *
749 749
 	 * @return array
750 750
 	 */
751
-	protected function _activate_message_types( EE_messenger $messenger, $message_type_names = array() ) {
751
+	protected function _activate_message_types(EE_messenger $messenger, $message_type_names = array()) {
752 752
 		//If $message_type_names is empty, AND $this->_active_message_types is empty, then that means
753 753
 		//things have never been initialized (which should happen on EEH_Activation::generate_message_templates).
754 754
 		//So ONLY then do we need to actually grab defaults and cycle through them.  Otherwise we
755 755
 		//only override _active_message_types when an explicit array of $message_type_names has been provided.
756
-		$message_type_names = empty( $message_type_names ) && ! isset( $this->_active_message_types[ $messenger->name ] )
756
+		$message_type_names = empty($message_type_names) && ! isset($this->_active_message_types[$messenger->name])
757 757
 			? $messenger->get_default_message_types()
758 758
 			: (array) $message_type_names;
759 759
 
760 760
 		//now we ALWAYS need to make sure that the messenger is active for the message types we're activating!
761
-		if ( ! isset( $this->_active_message_types[ $messenger->name ] ) ) {
762
-			$this->_active_message_types[ $messenger->name ]['settings'] = array();
761
+		if ( ! isset($this->_active_message_types[$messenger->name])) {
762
+			$this->_active_message_types[$messenger->name]['settings'] = array();
763 763
 		}
764 764
 
765
-		if ( $message_type_names ) {
765
+		if ($message_type_names) {
766 766
 			// cycle thru message types
767
-			foreach ( $message_type_names as $message_type_name ) {
767
+			foreach ($message_type_names as $message_type_name) {
768 768
 				//only register the message type as active IF it isn't already active
769 769
 				//and if its actually installed.
770 770
 				if (
771
-					! $this->is_message_type_active_for_messenger( $messenger->name, $message_type_name )
771
+					! $this->is_message_type_active_for_messenger($messenger->name, $message_type_name)
772 772
 				) {
773
-					$this->add_settings_for_message_type( $messenger->name, $message_type_name );
773
+					$this->add_settings_for_message_type($messenger->name, $message_type_name);
774 774
 					$this->_set_messenger_has_activated_message_type(
775 775
 						$messenger,
776 776
 						$message_type_name
@@ -793,24 +793,24 @@  discard block
 block discarded – undo
793 793
 	 * @param  string       $message_type_name The name of the message type adding the settings for
794 794
 	 * @param  array        $new_settings     Any new settings being set for the message type and messenger
795 795
 	 */
796
-	public function add_settings_for_message_type( $messenger_name, $message_type_name, $new_settings = array() ) {
796
+	public function add_settings_for_message_type($messenger_name, $message_type_name, $new_settings = array()) {
797 797
 		// get installed message type from collection
798
-		$message_type = $this->message_type_collection()->get_by_info( $message_type_name );
799
-		$existing_settings = $this->get_message_type_settings_for_messenger( $messenger_name, $message_type_name );
798
+		$message_type = $this->message_type_collection()->get_by_info($message_type_name);
799
+		$existing_settings = $this->get_message_type_settings_for_messenger($messenger_name, $message_type_name);
800 800
 		//we need to setup any initial settings for message types
801
-		if ( $message_type instanceof EE_message_type ) {
801
+		if ($message_type instanceof EE_message_type) {
802 802
 			$default_settings = $message_type->get_admin_settings_fields();
803
-			foreach ( $default_settings as $field => $values ) {
804
-				if ( isset( $new_settings[ $field ] ) ) {
805
-					$existing_settings[ $field ] = $new_settings[ $field ];
803
+			foreach ($default_settings as $field => $values) {
804
+				if (isset($new_settings[$field])) {
805
+					$existing_settings[$field] = $new_settings[$field];
806 806
 					continue;
807 807
 				}
808
-				if ( ! isset( $existing_settings[ $field ] ) ) {
809
-					$existing_settings[ $field ] = $values['default'];
808
+				if ( ! isset($existing_settings[$field])) {
809
+					$existing_settings[$field] = $values['default'];
810 810
 				}
811 811
 			}
812 812
 		}
813
-		$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] = $existing_settings;
813
+		$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'] = $existing_settings;
814 814
 	}
815 815
 
816 816
 
@@ -823,20 +823,20 @@  discard block
 block discarded – undo
823 823
 	 * @param \EE_messenger $messenger
824 824
 	 * @param string        $message_type_name
825 825
 	 */
826
-	protected function _set_messenger_has_activated_message_type( EE_messenger $messenger, $message_type_name ) {
826
+	protected function _set_messenger_has_activated_message_type(EE_messenger $messenger, $message_type_name) {
827 827
 
828 828
 		//if _has_activated_messengers_and_message_types is empty then lets ensure its initialized
829
-		if ( empty( $this->_has_activated_messengers_and_message_types ) ) {
829
+		if (empty($this->_has_activated_messengers_and_message_types)) {
830 830
 			$this->get_has_activated_messengers_option();
831 831
 		}
832 832
 
833 833
 		// make sure this messenger has a record in the has_activated array
834
-		if ( ! isset( $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
835
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ] = array();
834
+		if ( ! isset($this->_has_activated_messengers_and_message_types[$messenger->name])) {
835
+			$this->_has_activated_messengers_and_message_types[$messenger->name] = array();
836 836
 		}
837 837
 		// check if message type has already been added
838
-		if ( ! in_array( $message_type_name, $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) {
839
-			$this->_has_activated_messengers_and_message_types[ $messenger->name ][] = $message_type_name;
838
+		if ( ! in_array($message_type_name, $this->_has_activated_messengers_and_message_types[$messenger->name])) {
839
+			$this->_has_activated_messengers_and_message_types[$messenger->name][] = $message_type_name;
840 840
 		}
841 841
 	}
842 842
 
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 	 * @param string        $messenger_name The name of the messenger the settings is being added for.
852 852
 	 * @param array         $new_settings   An array of settings to update the existing settings.
853 853
 	 */
854
-	public function add_settings_for_messenger( $messenger_name, $new_settings = array() ) {
855
-		$messenger = $this->get_messenger( $messenger_name );
856
-		if ( $messenger instanceof EE_messenger ) {
854
+	public function add_settings_for_messenger($messenger_name, $new_settings = array()) {
855
+		$messenger = $this->get_messenger($messenger_name);
856
+		if ($messenger instanceof EE_messenger) {
857 857
 			$msgr_settings = $messenger->get_admin_settings_fields();
858
-			if ( ! empty( $msgr_settings ) ) {
859
-				foreach ( $msgr_settings as $field => $value ) {
858
+			if ( ! empty($msgr_settings)) {
859
+				foreach ($msgr_settings as $field => $value) {
860 860
 					//is there a new setting for this?
861
-					if ( isset( $new_settings[ $field ] ) ) {
862
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $new_settings[ $field ];
861
+					if (isset($new_settings[$field])) {
862
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $new_settings[$field];
863 863
 						continue;
864 864
 					}
865 865
 					//only set the default if it isn't already set.
866
-					if ( ! isset( $this->_active_message_types[ $messenger->name ]['settings'][ $field ] ) ) {
867
-						$this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $value;
866
+					if ( ! isset($this->_active_message_types[$messenger->name]['settings'][$field])) {
867
+						$this->_active_message_types[$messenger->name]['settings'][$field] = $value;
868 868
 					}
869 869
 				}
870 870
 			}
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 	 * @param  string|EE_messenger $messenger_name name of messenger
880 880
 	 * @return void
881 881
 	 */
882
-	public function deactivate_messenger( $messenger_name ) {
882
+	public function deactivate_messenger($messenger_name) {
883 883
         $this->_initialize_collections();
884
-        if ( $messenger_name instanceof EE_messenger ) {
884
+        if ($messenger_name instanceof EE_messenger) {
885 885
 			$messenger_name = $messenger_name->name;
886 886
 		}
887
-		unset( $this->_active_messengers[ $messenger_name ] );
888
-		unset( $this->_active_message_types[ $messenger_name ] );
889
-		$this->_message_template_group_model->deactivate_message_template_groups_for( $messenger_name );
887
+		unset($this->_active_messengers[$messenger_name]);
888
+		unset($this->_active_message_types[$messenger_name]);
889
+		$this->_message_template_group_model->deactivate_message_template_groups_for($messenger_name);
890 890
 		$this->update_active_messengers_option();
891 891
 	}
892 892
 
@@ -896,22 +896,22 @@  discard block
 block discarded – undo
896 896
 	 *
897 897
 	 * @param  string $message_type_name name of message type being deactivated
898 898
 	 */
899
-	public function deactivate_message_type( $message_type_name ) {
899
+	public function deactivate_message_type($message_type_name) {
900 900
         $this->_initialize_collections();
901
-		if ( $message_type_name instanceof EE_message_type ) {
901
+		if ($message_type_name instanceof EE_message_type) {
902 902
 			$message_type_name = $message_type_name->name;
903 903
 		}
904
-		foreach ( $this->_active_message_types as $messenger_name => $settings ) {
904
+		foreach ($this->_active_message_types as $messenger_name => $settings) {
905 905
 			unset(
906
-				$this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]
906
+				$this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]
907 907
 			);
908 908
 
909 909
 			//we always record (even on deactivation) that a message type has been activated because there should at
910 910
 			//least be a record in the "has_activated" option that it WAS active at one point.
911
-			$messenger = $this->get_messenger( $messenger_name );
912
-			$this->_set_messenger_has_activated_message_type( $messenger, $message_type_name );
911
+			$messenger = $this->get_messenger($messenger_name);
912
+			$this->_set_messenger_has_activated_message_type($messenger, $message_type_name);
913 913
 		}
914
-		$this->_message_template_group_model->deactivate_message_template_groups_for( '', $message_type_name );
914
+		$this->_message_template_group_model->deactivate_message_template_groups_for('', $message_type_name);
915 915
 		$this->update_active_messengers_option();
916 916
 		$this->update_has_activated_messengers_option();
917 917
 	}
@@ -926,12 +926,12 @@  discard block
 block discarded – undo
926 926
 	 * @param string $message_type_name  Name of message type being deactivated.
927 927
 	 * @param string $messenger_name     Name of messenger the message type is being deactivated for.
928 928
 	 */
929
-	public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) {
929
+	public function deactivate_message_type_for_messenger($message_type_name, $messenger_name) {
930 930
         $this->_initialize_collections();
931
-		if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
932
-			unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] );
931
+		if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
932
+			unset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]);
933 933
 		}
934
-		$this->_message_template_group_model->deactivate_message_template_groups_for( array( $messenger_name ), array( $message_type_name ) );
934
+		$this->_message_template_group_model->deactivate_message_template_groups_for(array($messenger_name), array($message_type_name));
935 935
 		$this->update_active_messengers_option();
936 936
 	}
937 937
 
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 	 *
949 949
 	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
950 950
 	 */
951
-	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
951
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) {
952 952
 		//get the $messengers the message type says it can be used with.
953
-		foreach ( $message_type->with_messengers() as $generating_messenger => $secondary_messengers ) {
953
+		foreach ($message_type->with_messengers() as $generating_messenger => $secondary_messengers) {
954 954
 			if (
955 955
 				$messenger->name === $generating_messenger
956
-				&& $this->is_message_type_active_for_messenger( $messenger->name, $message_type->name )
956
+				&& $this->is_message_type_active_for_messenger($messenger->name, $message_type->name)
957 957
 			) {
958 958
 				return true;
959 959
 			}
@@ -990,25 +990,25 @@  discard block
 block discarded – undo
990 990
 	 *                           or all contexts indexed by message type.
991 991
 	 * @return array
992 992
 	 */
993
-	public function get_all_contexts( $slugs_only = true ) {
993
+	public function get_all_contexts($slugs_only = true) {
994 994
 		$key = $slugs_only ? 'slugs' : 'all';
995 995
 		// check if contexts has been setup yet.
996
-		if ( empty( $this->_contexts[ $key ] ) ) {
996
+		if (empty($this->_contexts[$key])) {
997 997
 			// So let's get all active message type objects and loop through to get all unique contexts
998
-			foreach ( $this->get_active_message_type_objects() as $message_type ) {
999
-				if ( $message_type instanceof EE_message_type ) {
998
+			foreach ($this->get_active_message_type_objects() as $message_type) {
999
+				if ($message_type instanceof EE_message_type) {
1000 1000
 					$message_type_contexts = $message_type->get_contexts();
1001
-					if ( $slugs_only ) {
1002
-						foreach ( $message_type_contexts as $context => $context_details ) {
1003
-							$this->_contexts[ $key ][ $context ] = $context_details[ 'label' ];
1001
+					if ($slugs_only) {
1002
+						foreach ($message_type_contexts as $context => $context_details) {
1003
+							$this->_contexts[$key][$context] = $context_details['label'];
1004 1004
 						}
1005 1005
 					} else {
1006
-						$this->_contexts[ $key ][ $message_type->name ] = $message_type_contexts;
1006
+						$this->_contexts[$key][$message_type->name] = $message_type_contexts;
1007 1007
 					}
1008 1008
 				}
1009 1009
 			}
1010 1010
 		}
1011
-		return ! empty( $this->_contexts[ $key ] ) ? $this->_contexts[ $key ] : array();
1011
+		return ! empty($this->_contexts[$key]) ? $this->_contexts[$key] : array();
1012 1012
 	}
1013 1013
 
1014 1014
 
@@ -1027,9 +1027,9 @@  discard block
 block discarded – undo
1027 1027
 		$installed_message_types = $this->installed_message_types();
1028 1028
 		$all_message_types_valid = true;
1029 1029
 		//loop through list of active message types and verify they are installed.
1030
-		foreach( $list_of_active_message_type_names as $message_type_name ) {
1031
-			if ( ! isset( $installed_message_types[$message_type_name] ) ) {
1032
-				$this->deactivate_message_type( $message_type_name );
1030
+		foreach ($list_of_active_message_type_names as $message_type_name) {
1031
+			if ( ! isset($installed_message_types[$message_type_name])) {
1032
+				$this->deactivate_message_type($message_type_name);
1033 1033
 				$all_message_types_valid = false;
1034 1034
 			}
1035 1035
 		}
@@ -1048,10 +1048,10 @@  discard block
 block discarded – undo
1048 1048
 	 * @param $messenger_name
1049 1049
 	 * @return bool
1050 1050
 	 */
1051
-	public function has_message_type_been_activated_for_messenger( $message_type_name, $messenger_name ) {
1051
+	public function has_message_type_been_activated_for_messenger($message_type_name, $messenger_name) {
1052 1052
 		$has_activated = $this->get_has_activated_messengers_option();
1053
-		return isset( $has_activated[ $messenger_name ] )
1054
-			&& in_array( $message_type_name, $has_activated[ $messenger_name ] );
1053
+		return isset($has_activated[$messenger_name])
1054
+			&& in_array($message_type_name, $has_activated[$messenger_name]);
1055 1055
 	}
1056 1056
 }
1057 1057
 // End of file EE_Message_Resource_Manager.lib.php
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 
42
-    /**
43
-     * EE_Attendee_Shortcodes constructor.
44
-     */
45
-    public function __construct() {
42
+	/**
43
+	 * EE_Attendee_Shortcodes constructor.
44
+	 */
45
+	public function __construct() {
46 46
 		parent::__construct();
47 47
 	}
48 48
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 
73 73
 
74 74
 
75
-    /**
76
-     * handles shortcode parsing
77
-     *
78
-     * @access protected
79
-     * @param  string $shortcode the shortcode to be parsed.
80
-     * @return string
81
-     * @throws \EE_Error
82
-     */
83
-    protected function _parser( $shortcode ) {
75
+	/**
76
+	 * handles shortcode parsing
77
+	 *
78
+	 * @access protected
79
+	 * @param  string $shortcode the shortcode to be parsed.
80
+	 * @return string
81
+	 * @throws \EE_Error
82
+	 */
83
+	protected function _parser( $shortcode ) {
84 84
 
85 85
 
86 86
 		$this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 		if ( ! $registration instanceof EE_Registration ) {
92 92
 			//let's attempt to get the txn_id for the error message.
93 93
 			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' );
94
-            $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
95
-                    'event_espresso');
96
-            $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id);
94
+			$msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
95
+					'event_espresso');
96
+			$dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id);
97 97
 			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
98 98
 		}
99 99
 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 		$attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ?  $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ;
102 102
 
103 103
 		if ( ! $attendee instanceof EE_Attendee ) {
104
-            $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
105
-                'event_espresso');
106
-            $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'),
107
-                $registration->ID());
104
+			$msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
105
+				'event_espresso');
106
+			$dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'),
107
+				$registration->ID());
108 108
 			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
109 109
 		}
110 110
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 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
 /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			'[ADDRESS2]' => __('Whatever was in the address 2 field for the registration.', 'event_espresso'),
66 66
 			'[CITY]' => __('The city for the registration.', 'event_espresso'),
67 67
 			'[ZIP_PC]' => __('The ZIP (or Postal) Code for the Registration.', 'event_espresso'),
68
-			'[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso' ),
68
+			'[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso'),
69 69
 			'[COUNTRY]' => __('The country for the registration.', 'event_espresso')
70 70
 			);
71 71
 	}
@@ -80,27 +80,27 @@  discard block
 block discarded – undo
80 80
      * @return string
81 81
      * @throws \EE_Error
82 82
      */
83
-    protected function _parser( $shortcode ) {
83
+    protected function _parser($shortcode) {
84 84
 
85 85
 
86
-		$this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
86
+		$this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL;
87 87
 
88 88
 		//incoming object should only be a registration object.
89 89
 		$registration = ! $this->_data instanceof EE_Registration ? NULL : $this->_data;
90 90
 
91
-		if ( ! $registration instanceof EE_Registration ) {
91
+		if ( ! $registration instanceof EE_Registration) {
92 92
 			//let's attempt to get the txn_id for the error message.
93
-			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' );
93
+			$txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso');
94 94
             $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.',
95 95
                     'event_espresso');
96 96
             $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id);
97
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
97
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
98 98
 		}
99 99
 
100 100
 		//attendee obj for this registration
101
-		$attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ?  $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ;
101
+		$attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null;
102 102
 
103
-		if ( ! $attendee instanceof EE_Attendee ) {
103
+		if ( ! $attendee instanceof EE_Attendee) {
104 104
             $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.',
105 105
                 'event_espresso');
106 106
             $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'),
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
109 109
 		}
110 110
 
111
-		switch ( $shortcode ) {
111
+		switch ($shortcode) {
112 112
 
113 113
 			case '[FNAME]' :
114 114
 				return $attendee->fname();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.