Completed
Branch FET-10724-event-editor-cleanup (e53107)
by
unknown
91:14 queued 79:43
created
core/helpers/EEH_MSG_Template.helper.php 4 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * Updates all message templates matching the incoming messengers and message types to active status.
144 144
 	 *
145 145
 	 * @static
146
-	 * @param  array  $messenger_names     Messenger slug
146
+	 * @param  string[]  $messenger_names     Messenger slug
147 147
 	 * @param  array  $message_type_names  Message type slug
148 148
 	 * @return  int 						count of updated records.
149 149
 	 */
@@ -454,6 +454,7 @@  discard block
 block discarded – undo
454 454
 	 * @param EE_Registration | null $registration  The registration object must be included if this
455 455
 	 *                                              is going to be a registration trigger url.
456 456
 	 * @param string $sending_messenger             The (optional) sending messenger for the url.
457
+	 * @param EE_Registration $registration
457 458
 	 *
458 459
 	 * @return string
459 460
 	 * @throws EE_Error
@@ -1008,8 +1009,8 @@  discard block
 block discarded – undo
1008 1009
 	/**
1009 1010
 	 * @param \EE_messenger    $messenger
1010 1011
 	 * @param \EE_message_type $message_type
1011
-	 * @param                  $GRP_ID
1012
-	 * @param                  $global
1012
+	 * @param                  integer $GRP_ID
1013
+	 * @param                  boolean $global
1013 1014
 	 * @return array|mixed
1014 1015
 	 */
1015 1016
 	protected static function _create_new_templates( EE_messenger $messenger, EE_message_type $message_type, $GRP_ID, $global ) {
Please login to merge, or discard this patch.
Spacing   +197 added lines, -197 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
 /**
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
 	 *                was not a new generated template but just reactivated (which only happens for global templates that
60 60
 	 *                already exist in the database.
61 61
 	 */
62
-	public static function generate_new_templates( $messenger, $message_types, $GRP_ID = 0, $global = false ) {
62
+	public static function generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) {
63 63
 		//make sure message_type is an array.
64 64
 		$message_types = (array) $message_types;
65 65
 		$templates = array();
66 66
 
67
-		if ( empty( $messenger ) ) {
68
-			throw new EE_Error( __('We need a messenger to generate templates!', 'event_espresso') );
67
+		if (empty($messenger)) {
68
+			throw new EE_Error(__('We need a messenger to generate templates!', 'event_espresso'));
69 69
 		}
70 70
 
71 71
 		//if we STILL have empty $message_types then we need to generate an error message b/c we NEED message types to do the template files.
72
-		if ( empty( $message_types ) ) {
73
-			throw new EE_Error( __('We need at least one message type to generate templates!', 'event_espresso') );
72
+		if (empty($message_types)) {
73
+			throw new EE_Error(__('We need at least one message type to generate templates!', 'event_espresso'));
74 74
 		}
75 75
 
76 76
 		EEH_MSG_Template::_set_autoloader();
77
-		foreach ( $message_types as $message_type ) {
77
+		foreach ($message_types as $message_type) {
78 78
 			//if global then let's attempt to get the GRP_ID for this combo IF GRP_ID is empty.
79
-			if ( $global && empty( $GRP_ID ) ) {
79
+			if ($global && empty($GRP_ID)) {
80 80
 				$GRP_ID = EEM_Message_Template_Group::instance()->get_one(
81 81
 					array(
82 82
 						array(
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			// if this is global template generation.
92 92
 			// First let's determine if we already HAVE global templates for this messenger and message_type combination.
93 93
 			//  If we do then NO generation!!
94
-			if ( $global && EEH_MSG_Template::already_generated( $messenger, $message_type, $GRP_ID ) ) {
94
+			if ($global && EEH_MSG_Template::already_generated($messenger, $message_type, $GRP_ID)) {
95 95
 				$templates[] = array(
96 96
 					'GRP_ID' => $GRP_ID,
97 97
 					'MTP_context' => '',
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 				//we already have generated templates for this so let's go to the next message type.
100 100
 				continue;
101 101
 			}
102
-			$new_message_template_group = EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $global );
102
+			$new_message_template_group = EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $global);
103 103
 
104
-			if ( ! $new_message_template_group ) {
104
+			if ( ! $new_message_template_group) {
105 105
 				continue;
106 106
 			}
107 107
 			$templates[] = $new_message_template_group;
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	 * @param  int $GRP_ID        GRP ID ( if a custom template) (if not provided then we're just doing global template check)
119 119
 	 * @return bool                true = generated, false = hasn't been generated.
120 120
 	 */
121
-	public static function already_generated( $messenger, $message_type, $GRP_ID = 0 ) {
121
+	public static function already_generated($messenger, $message_type, $GRP_ID = 0) {
122 122
 		EEH_MSG_Template::_set_autoloader();
123 123
 		//what method we use depends on whether we have an GRP_ID or not
124
-		$count = empty( $GRP_ID )
124
+		$count = empty($GRP_ID)
125 125
 			? EEM_Message_Template::instance()->count(
126 126
 				array(
127 127
 					array(
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 					)
132 132
 				)
133 133
 			)
134
-			: EEM_Message_Template::instance()->count( array( array( 'GRP_ID' => $GRP_ID ) ) );
134
+			: EEM_Message_Template::instance()->count(array(array('GRP_ID' => $GRP_ID)));
135 135
 
136 136
 		return $count > 0;
137 137
 	}
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 	 * @param  array  $message_type_names  Message type slug
148 148
 	 * @return  int 						count of updated records.
149 149
 	 */
150
-	public static function update_to_active( $messenger_names, $message_type_names ) {
151
-		$messenger_names = is_array( $messenger_names ) ? $messenger_names : array( $messenger_names );
152
-		$message_type_names = is_array( $message_type_names ) ? $message_type_names : array( $message_type_names );
150
+	public static function update_to_active($messenger_names, $message_type_names) {
151
+		$messenger_names = is_array($messenger_names) ? $messenger_names : array($messenger_names);
152
+		$message_type_names = is_array($message_type_names) ? $message_type_names : array($message_type_names);
153 153
 		return EEM_Message_Template_Group::instance()->update(
154
-			array( 'MTP_is_active' => 1 ),
154
+			array('MTP_is_active' => 1),
155 155
 			array(
156 156
 				array(
157
-					'MTP_messenger' 	=> array( 'IN', $messenger_names ),
158
-					'MTP_message_type'  => array( 'IN', $message_type_names )
157
+					'MTP_messenger' 	=> array('IN', $messenger_names),
158
+					'MTP_message_type'  => array('IN', $message_type_names)
159 159
 				)
160 160
 			)
161 161
 		);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return int  count of updated records.
178 178
 	 */
179
-	public static function update_to_inactive( $messenger_names = array(), $message_type_names = array() ) {
179
+	public static function update_to_inactive($messenger_names = array(), $message_type_names = array()) {
180 180
 		return EEM_Message_Template_Group::instance()->deactivate_message_template_groups_for(
181 181
 			$messenger_names,
182 182
 			$message_type_names
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 	 * @param string $type
194 194
 	 * @return array array consisting of installed messenger objects and installed message type objects.
195 195
 	 */
196
-	public static function get_installed_message_objects( $type = 'all' ) {
196
+	public static function get_installed_message_objects($type = 'all') {
197 197
 		self::_set_autoloader();
198
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
198
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
199 199
 		return array(
200 200
 			'messenger' => $message_resource_manager->installed_messengers(),
201 201
 			'message_type' => $message_resource_manager->installed_message_types()
@@ -231,74 +231,74 @@  discard block
 block discarded – undo
231 231
 		$context = 'admin',
232 232
 		$merged = false
233 233
 	) {
234
-		$messenger_name = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $messenger ) ) );
235
-		$mt_name = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $message_type ) ) );
234
+		$messenger_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $messenger)));
235
+		$mt_name = str_replace(' ', '_', ucwords(str_replace('_', ' ', $message_type)));
236 236
 		/** @var EE_Message_Resource_Manager $message_resource_manager */
237
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
237
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
238 238
 		//convert slug to object
239
-		$messenger = $message_resource_manager->get_messenger( $messenger );
239
+		$messenger = $message_resource_manager->get_messenger($messenger);
240 240
 
241 241
 		//if messenger isn't a EE_messenger resource then bail.
242
-		if ( ! $messenger instanceof EE_messenger ) {
242
+		if ( ! $messenger instanceof EE_messenger) {
243 243
 			return array();
244 244
 		}
245 245
 
246 246
 		//validate class for getting our list of shortcodes
247
-		$classname = 'EE_Messages_' . $messenger_name . '_' . $mt_name . '_Validator';
248
-		if ( ! class_exists( $classname ) ) {
249
-			$msg[] = __( 'The Validator class was unable to load', 'event_espresso' );
247
+		$classname = 'EE_Messages_'.$messenger_name.'_'.$mt_name.'_Validator';
248
+		if ( ! class_exists($classname)) {
249
+			$msg[] = __('The Validator class was unable to load', 'event_espresso');
250 250
 			$msg[] = sprintf(
251
-				__( 'The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso' ),
251
+				__('The class name compiled was %s. Please check and make sure the spelling and case is correct for the class name and that there is an autoloader in place for this class', 'event_espresso'),
252 252
 				$classname
253 253
 			);
254
-			throw new EE_Error( implode( '||', $msg ) );
254
+			throw new EE_Error(implode('||', $msg));
255 255
 		}
256 256
 
257 257
 		/** @type EE_Messages_Validator $_VLD */
258
-		$_VLD = new $classname( array(), $context );
258
+		$_VLD = new $classname(array(), $context);
259 259
 		$valid_shortcodes = $_VLD->get_validators();
260 260
 
261 261
 		//let's make sure we're only getting the shortcode part of the validators
262 262
 		$shortcodes = array();
263
-		foreach ( $valid_shortcodes as $field => $validators ) {
264
-			$shortcodes[ $field ] = $validators['shortcodes'];
263
+		foreach ($valid_shortcodes as $field => $validators) {
264
+			$shortcodes[$field] = $validators['shortcodes'];
265 265
 		}
266 266
 		$valid_shortcodes = $shortcodes;
267 267
 
268 268
 		//if not all fields let's make sure we ONLY include the shortcodes for the specified fields.
269
-		if ( ! empty( $fields ) ) {
269
+		if ( ! empty($fields)) {
270 270
 			$specified_shortcodes = array();
271
-			foreach ( $fields as $field ) {
272
-				if ( isset( $valid_shortcodes[ $field ] ) ) {
273
-					$specified_shortcodes[ $field ] = $valid_shortcodes[ $field ];
271
+			foreach ($fields as $field) {
272
+				if (isset($valid_shortcodes[$field])) {
273
+					$specified_shortcodes[$field] = $valid_shortcodes[$field];
274 274
 				}
275 275
 			}
276 276
 			$valid_shortcodes = $specified_shortcodes;
277 277
 		}
278 278
 
279 279
 		//if not merged then let's replace the fields with the localized fields
280
-		if ( ! $merged ) {
280
+		if ( ! $merged) {
281 281
 			//let's get all the fields for the set messenger so that we can get the localized label and use that in the returned array.
282 282
 			$field_settings = $messenger->get_template_fields();
283 283
 			$localized = array();
284
-			foreach ( $valid_shortcodes as $field => $shortcodes ) {
284
+			foreach ($valid_shortcodes as $field => $shortcodes) {
285 285
 				//get localized field label
286
-				if ( isset( $field_settings[ $field ] ) ) {
286
+				if (isset($field_settings[$field])) {
287 287
 					//possible that this is used as a main field.
288
-					if ( empty( $field_settings[ $field ] ) ) {
289
-						if ( isset( $field_settings['extra'][ $field ] ) ) {
290
-							$_field = $field_settings['extra'][ $field ]['main']['label'];
288
+					if (empty($field_settings[$field])) {
289
+						if (isset($field_settings['extra'][$field])) {
290
+							$_field = $field_settings['extra'][$field]['main']['label'];
291 291
 						} else {
292 292
 							$_field = $field;
293 293
 						}
294 294
 					} else {
295
-						$_field = $field_settings[ $field ]['label'];
295
+						$_field = $field_settings[$field]['label'];
296 296
 					}
297
-				} else if ( isset( $field_settings['extra'] ) ) {
297
+				} else if (isset($field_settings['extra'])) {
298 298
 					//loop through extra "main fields" and see if any of their children have our field
299
-					foreach ( $field_settings['extra'] as $main_field => $fields ) {
300
-						if ( isset( $fields[ $field ] ) ) {
301
-							$_field = $fields[ $field ]['label'];
299
+					foreach ($field_settings['extra'] as $main_field => $fields) {
300
+						if (isset($fields[$field])) {
301
+							$_field = $fields[$field]['label'];
302 302
 						} else {
303 303
 							$_field = $field;
304 304
 						}
@@ -306,22 +306,22 @@  discard block
 block discarded – undo
306 306
 				} else {
307 307
 					$_field = $field;
308 308
 				}
309
-				if ( isset( $_field ) ) {
310
-					$localized[ $_field ] = $shortcodes;
309
+				if (isset($_field)) {
310
+					$localized[$_field] = $shortcodes;
311 311
 				}
312 312
 			}
313 313
 			$valid_shortcodes = $localized;
314 314
 		}
315 315
 
316 316
 		//if $merged then let's merge all the shortcodes into one list NOT indexed by field.
317
-		if ( $merged ) {
317
+		if ($merged) {
318 318
 			$merged_codes = array();
319
-			foreach ( $valid_shortcodes as $field => $shortcode ) {
320
-				foreach ( $shortcode as $code => $label ) {
321
-					if ( isset( $merged_codes[ $code ] ) ) {
319
+			foreach ($valid_shortcodes as $field => $shortcode) {
320
+				foreach ($shortcode as $code => $label) {
321
+					if (isset($merged_codes[$code])) {
322 322
 						continue;
323 323
 					} else {
324
-						$merged_codes[ $code ] = $label;
324
+						$merged_codes[$code] = $label;
325 325
 					}
326 326
 				}
327 327
 			}
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 	 * @throws \EE_Error
342 342
 	 * @return EE_messenger
343 343
 	 */
344
-	public static function messenger_obj( $messenger ) {
344
+	public static function messenger_obj($messenger) {
345 345
 		/** @type EE_Message_Resource_Manager $Message_Resource_Manager */
346
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
347
-		return $Message_Resource_Manager->get_messenger( $messenger );
346
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
347
+		return $Message_Resource_Manager->get_messenger($messenger);
348 348
 	}
349 349
 
350 350
 
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * @throws \EE_Error
358 358
 	 * @return EE_message_type
359 359
 	 */
360
-	public static function message_type_obj( $message_type ) {
360
+	public static function message_type_obj($message_type) {
361 361
 		/** @type EE_Message_Resource_Manager $Message_Resource_Manager */
362
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
363
-		return $Message_Resource_Manager->get_message_type( $message_type );
362
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
363
+		return $Message_Resource_Manager->get_message_type($message_type);
364 364
 	}
365 365
 
366 366
 
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
 	 * @param  string   $message_type message type to check for.
375 375
 	 * @return boolean
376 376
 	 */
377
-	public static function is_mt_active( $message_type ) {
377
+	public static function is_mt_active($message_type) {
378 378
 		/** @type EE_Message_Resource_Manager $Message_Resource_Manager */
379
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
379
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
380 380
 		$active_mts = $Message_Resource_Manager->list_of_active_message_types();
381
-		return in_array( $message_type, $active_mts );
381
+		return in_array($message_type, $active_mts);
382 382
 	}
383 383
 
384 384
 
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
 	 * @param  string  $messenger slug for messenger to check.
392 392
 	 * @return boolean
393 393
 	 */
394
-	public static function is_messenger_active( $messenger ) {
394
+	public static function is_messenger_active($messenger) {
395 395
 		/** @type EE_Message_Resource_Manager $Message_Resource_Manager */
396
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
397
-		$active_messenger = $Message_Resource_Manager->get_active_messenger( $messenger );
396
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
397
+		$active_messenger = $Message_Resource_Manager->get_active_messenger($messenger);
398 398
 		return $active_messenger instanceof EE_messenger ? true : false;
399 399
 	}
400 400
 
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	public static function get_active_messengers_in_db() {
413 413
 		EE_Error::doing_it_wrong(
414 414
 			__METHOD__,
415
-			__( 'Please use EE_Message_Resource_Manager::get_active_messengers_option() instead.', 'event_espresso' ),
415
+			__('Please use EE_Message_Resource_Manager::get_active_messengers_option() instead.', 'event_espresso'),
416 416
 			'4.9.0'
417 417
 		);
418 418
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
419
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
419
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
420 420
 		return $Message_Resource_Manager->get_active_messengers_option();
421 421
 	}
422 422
 
@@ -433,15 +433,15 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 * @return bool FALSE if not updated, TRUE if updated.
435 435
 	 */
436
-	public static function update_active_messengers_in_db( $data_to_save ) {
436
+	public static function update_active_messengers_in_db($data_to_save) {
437 437
 		EE_Error::doing_it_wrong(
438 438
 			__METHOD__,
439
-			__( 'Please use EE_Message_Resource_Manager::update_active_messengers_option() instead.', 'event_espresso' ),
439
+			__('Please use EE_Message_Resource_Manager::update_active_messengers_option() instead.', 'event_espresso'),
440 440
 			'4.9.0'
441 441
 		);
442 442
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
443
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
444
-		return $Message_Resource_Manager->update_active_messengers_option( $data_to_save );
443
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
444
+		return $Message_Resource_Manager->update_active_messengers_option($data_to_save);
445 445
 	}
446 446
 
447 447
 
@@ -465,34 +465,34 @@  discard block
 block discarded – undo
465 465
 		$sending_messenger = ''
466 466
 	) {
467 467
 		//first determine if the url can be to the EE_Message object.
468
-		if ( ! $message_type->always_generate() ) {
469
-			return EEH_MSG_Template::generate_browser_trigger( $message );
468
+		if ( ! $message_type->always_generate()) {
469
+			return EEH_MSG_Template::generate_browser_trigger($message);
470 470
 		}
471 471
 
472 472
 		//if $registration object is not valid then exit early because there's nothing that can be generated.
473
-		if ( ! $registration instanceof EE_Registration ) {
473
+		if ( ! $registration instanceof EE_Registration) {
474 474
 			throw new EE_Error(
475
-				__( 'Incoming value for registration is not a valid EE_Registration object.', 'event_espresso' )
475
+				__('Incoming value for registration is not a valid EE_Registration object.', 'event_espresso')
476 476
 			);
477 477
 		}
478 478
 
479 479
 		//validate given context
480 480
 		$contexts = $message_type->get_contexts();
481
-		if ( $message->context() !== '' && ! isset( $contexts[$message->context()] ) ) {
481
+		if ($message->context() !== '' && ! isset($contexts[$message->context()])) {
482 482
 			throw new EE_Error(
483 483
 				sprintf(
484
-					__( 'The context %s is not a valid context for %s.', 'event_espresso' ),
484
+					__('The context %s is not a valid context for %s.', 'event_espresso'),
485 485
 					$message->context(),
486
-					get_class( $message_type )
486
+					get_class($message_type)
487 487
 				)
488 488
 			);
489 489
 		}
490 490
 
491 491
 		//valid sending messenger but only if sending messenger set.  Otherwise generating messenger is used.
492
-		if ( ! empty( $sending_messenger ) ) {
492
+		if ( ! empty($sending_messenger)) {
493 493
 			$with_messengers = $message_type->with_messengers();
494
-			if ( ! isset( $with_messengers[$message->messenger()] )
495
-			     || ! in_array( $sending_messenger, $with_messengers[$message->messenger()] ) ) {
494
+			if ( ! isset($with_messengers[$message->messenger()])
495
+			     || ! in_array($sending_messenger, $with_messengers[$message->messenger()])) {
496 496
 				throw new EE_Error(
497 497
 					sprintf(
498 498
 						__(
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 							'event_espresso'
501 501
 						),
502 502
 						$sending_messenger,
503
-						get_class( $message_type )
503
+						get_class($message_type)
504 504
 					)
505 505
 				);
506 506
 			}
@@ -523,14 +523,14 @@  discard block
 block discarded – undo
523 523
 	 * @param EE_Message $message
524 524
 	 * @return string.
525 525
 	 */
526
-	public static function generate_browser_trigger( EE_Message $message ) {
526
+	public static function generate_browser_trigger(EE_Message $message) {
527 527
 		$query_args = array(
528 528
 			'ee' => 'msg_browser_trigger',
529 529
 			'token' => $message->MSG_token()
530 530
 		);
531 531
 		return apply_filters(
532 532
 			'FHEE__EEH_MSG_Template__generate_browser_trigger',
533
-			add_query_arg( $query_args, site_url() ),
533
+			add_query_arg($query_args, site_url()),
534 534
 			$message
535 535
 		);
536 536
 	}
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * @param EE_Message $message
546 546
 	 * @return string
547 547
 	 */
548
-	public static function generate_error_display_trigger( EE_Message $message ) {
548
+	public static function generate_error_display_trigger(EE_Message $message) {
549 549
 		return apply_filters(
550 550
 			'FHEE__EEH_MSG_Template__generate_error_display_trigger',
551 551
 			add_query_arg(
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 			'GRP_ID' => $message_template_group,
596 596
 			'id' => $data_id
597 597
 			);
598
-		$url = add_query_arg( $query_args, get_home_url() );
598
+		$url = add_query_arg($query_args, get_home_url());
599 599
 
600 600
 		//made it here so now we can just get the url and filter it.  Filtered globally and by message type.
601 601
 		$url = apply_filters(
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 	 * @param string $type  What action to return.
624 624
 	 * @return string
625 625
 	 */
626
-	public static function get_message_action_icon( $type ) {
626
+	public static function get_message_action_icon($type) {
627 627
 		$action_icons = self::get_message_action_icons();
628
-		return isset( $action_icons[ $type ] ) ? $action_icons[ $type ] : '';
628
+		return isset($action_icons[$type]) ? $action_icons[$type] : '';
629 629
 	}
630 630
 
631 631
 
@@ -637,34 +637,34 @@  discard block
 block discarded – undo
637 637
 	 * @return array
638 638
 	 */
639 639
 	public static function get_message_action_icons() {
640
-		return apply_filters( 'FHEE__EEH_MSG_Template__message_action_icons',
640
+		return apply_filters('FHEE__EEH_MSG_Template__message_action_icons',
641 641
 			array(
642 642
 				'view' => array(
643
-					'label' => __( 'View Message', 'event_espresso' ),
643
+					'label' => __('View Message', 'event_espresso'),
644 644
 					'css_class' => 'dashicons dashicons-welcome-view-site',
645 645
 				),
646 646
 				'error' => array(
647
-					'label' => __( 'View Error Message', 'event_espresso' ),
647
+					'label' => __('View Error Message', 'event_espresso'),
648 648
 					'css_class' => 'dashicons dashicons-info',
649 649
 				),
650 650
 				'see_notifications_for' => array(
651
-					'label' => __( 'View Related Messages', 'event_espresso' ),
651
+					'label' => __('View Related Messages', 'event_espresso'),
652 652
 					'css_class' => 'dashicons dashicons-megaphone',
653 653
 				),
654 654
 				'generate_now' => array(
655
-					'label' => __( 'Generate the message now.', 'event_espresso' ),
655
+					'label' => __('Generate the message now.', 'event_espresso'),
656 656
 					'css_class' => 'dashicons dashicons-admin-tools',
657 657
 				),
658 658
 				'send_now' => array(
659
-					'label' => __( 'Send Immediately', 'event_espresso' ),
659
+					'label' => __('Send Immediately', 'event_espresso'),
660 660
 					'css_class' => 'dashicons dashicons-controls-forward',
661 661
 				),
662 662
 				'queue_for_resending' => array(
663
-					'label' => __( 'Queue for Resending', 'event_espresso' ),
663
+					'label' => __('Queue for Resending', 'event_espresso'),
664 664
 					'css_class' => 'dashicons dashicons-controls-repeat',
665 665
 				),
666 666
 				'view_transaction' => array(
667
-					'label' => __( 'View related Transaction', 'event_espresso' ),
667
+					'label' => __('View related Transaction', 'event_espresso'),
668 668
 					'css_class' => 'dashicons dashicons-cart',
669 669
 				)
670 670
 			)
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 	 *
684 684
 	 * @return string
685 685
 	 */
686
-	public static function get_message_action_url( $type, EE_Message $message = null, $query_params = array() ) {
687
-		$action_urls = self::get_message_action_urls( $message, $query_params );
688
-		return isset( $action_urls[ $type ] )  ? $action_urls[ $type ] : '';
686
+	public static function get_message_action_url($type, EE_Message $message = null, $query_params = array()) {
687
+		$action_urls = self::get_message_action_urls($message, $query_params);
688
+		return isset($action_urls[$type]) ? $action_urls[$type] : '';
689 689
 	}
690 690
 
691 691
 
@@ -700,15 +700,15 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @return array
702 702
 	 */
703
-	public static function get_message_action_urls( EE_Message $message = null, $query_params = array() ) {
704
-		EE_Registry::instance()->load_helper( 'URL' );
703
+	public static function get_message_action_urls(EE_Message $message = null, $query_params = array()) {
704
+		EE_Registry::instance()->load_helper('URL');
705 705
 		//if $message is not an instance of EE_Message then let's just do a dummy.
706
-		$message = empty( $message ) ? EE_Message_Factory::create() : $message;
707
-		$action_urls =  apply_filters(
706
+		$message = empty($message) ? EE_Message_Factory::create() : $message;
707
+		$action_urls = apply_filters(
708 708
 			'FHEE__EEH_MSG_Template__get_message_action_url',
709 709
 			array(
710
-				'view' => EEH_MSG_Template::generate_browser_trigger( $message ),
711
-				'error' => EEH_MSG_Template::generate_error_display_trigger( $message ),
710
+				'view' => EEH_MSG_Template::generate_browser_trigger($message),
711
+				'error' => EEH_MSG_Template::generate_error_display_trigger($message),
712 712
 				'see_notifications_for' => EEH_URL::add_query_args_and_nonce(
713 713
 					array_merge(
714 714
 						array(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 						),
719 719
 						$query_params
720 720
 					),
721
-					admin_url( 'admin.php' )
721
+					admin_url('admin.php')
722 722
 				),
723 723
 				'generate_now' => EEH_URL::add_query_args_and_nonce(
724 724
 					array(
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 						'action' => 'generate_now',
727 727
 						'MSG_ID' => $message->ID()
728 728
 					),
729
-					admin_url( 'admin.php' )
729
+					admin_url('admin.php')
730 730
 				),
731 731
 				'send_now' => EEH_URL::add_query_args_and_nonce(
732 732
 					array(
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 						'action' => 'send_now',
735 735
 						'MSG_ID' => $message->ID()
736 736
 					),
737
-					admin_url( 'admin.php' )
737
+					admin_url('admin.php')
738 738
 				),
739 739
 				'queue_for_resending' => EEH_URL::add_query_args_and_nonce(
740 740
 					array(
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 						'action' => 'queue_for_resending',
743 743
 						'MSG_ID' => $message->ID()
744 744
 					),
745
-					admin_url( 'admin.php' )
745
+					admin_url('admin.php')
746 746
 				),
747 747
 			)
748 748
 		);
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 					'action' => 'view_transaction',
761 761
 					'TXN_ID' => $message->TXN_ID()
762 762
 				),
763
-				admin_url( 'admin.php' )
763
+				admin_url('admin.php')
764 764
 			);
765 765
 		} else {
766 766
 			$action_urls['view_transaction'] = '';
@@ -781,26 +781,26 @@  discard block
 block discarded – undo
781 781
 	 *
782 782
 	 * @return string
783 783
 	 */
784
-	public static function get_message_action_link( $type, EE_Message $message = null, $query_params = array() ) {
785
-		$url = EEH_MSG_Template::get_message_action_url( $type, $message, $query_params );
786
-		$icon_css = EEH_MSG_Template::get_message_action_icon( $type );
787
-		$title = isset( $icon_css['label'] ) ? 'title="' . $icon_css['label'] . '"' : '';
784
+	public static function get_message_action_link($type, EE_Message $message = null, $query_params = array()) {
785
+		$url = EEH_MSG_Template::get_message_action_url($type, $message, $query_params);
786
+		$icon_css = EEH_MSG_Template::get_message_action_icon($type);
787
+		$title = isset($icon_css['label']) ? 'title="'.$icon_css['label'].'"' : '';
788 788
 
789
-		if ( empty( $url ) || empty( $icon_css ) || ! isset( $icon_css['css_class'] ) ) {
789
+		if (empty($url) || empty($icon_css) || ! isset($icon_css['css_class'])) {
790 790
 			return '';
791 791
 		}
792 792
 
793 793
 		$icon_css['css_class'] .= esc_attr(
794 794
 			apply_filters(
795 795
 				'FHEE__EEH_MSG_Template__get_message_action_link__icon_css_class',
796
-				' js-ee-message-action-link ee-message-action-link-' . $type,
796
+				' js-ee-message-action-link ee-message-action-link-'.$type,
797 797
 				$type,
798 798
 				$message,
799 799
 				$query_params
800 800
 			)
801 801
 		);
802 802
 
803
-		return '<a href="' . $url . '"' . $title . '><span class="' . esc_attr( $icon_css['css_class'] ) . '"></span></a>';
803
+		return '<a href="'.$url.'"'.$title.'><span class="'.esc_attr($icon_css['css_class']).'"></span></a>';
804 804
 
805 805
 	}
806 806
 
@@ -838,9 +838,9 @@  discard block
 block discarded – undo
838 838
 	 * @param $reg_status
839 839
 	 * @return string
840 840
 	 */
841
-	public static function convert_reg_status_to_message_type( $reg_status ) {
841
+	public static function convert_reg_status_to_message_type($reg_status) {
842 842
 		$reg_status_array = self::reg_status_to_message_type_array();
843
-		return isset( $reg_status_array[$reg_status] ) ? $reg_status_array[$reg_status] : '';
843
+		return isset($reg_status_array[$reg_status]) ? $reg_status_array[$reg_status] : '';
844 844
 	}
845 845
 
846 846
 
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
 	 * @param $payment_status
875 875
 	 * @return string
876 876
 	 */
877
-	public static function convert_payment_status_to_message_type( $payment_status ) {
877
+	public static function convert_payment_status_to_message_type($payment_status) {
878 878
 		$payment_status_array = self::payment_status_to_message_type_array();
879
-		return isset( $payment_status_array[$payment_status] ) ? $payment_status_array[$payment_status] : '';
879
+		return isset($payment_status_array[$payment_status]) ? $payment_status_array[$payment_status] : '';
880 880
 	}
881 881
 
882 882
 
@@ -887,32 +887,32 @@  discard block
 block discarded – undo
887 887
 	 *
888 888
 	 * @return EE_Messages_Template_Pack
889 889
 	 */
890
-	public static function get_template_pack( $template_pack_name ) {
891
-		if ( ! self::$_template_pack_collection instanceof EE_Object_Collection ) {
890
+	public static function get_template_pack($template_pack_name) {
891
+		if ( ! self::$_template_pack_collection instanceof EE_Object_Collection) {
892 892
 			self::$_template_pack_collection = new EE_Messages_Template_Pack_Collection();
893 893
 		}
894 894
 
895 895
 		//first see if in collection already
896
-		$template_pack = self::$_template_pack_collection->get_by_name( $template_pack_name );
896
+		$template_pack = self::$_template_pack_collection->get_by_name($template_pack_name);
897 897
 
898
-		if ( $template_pack instanceof EE_Messages_Template_Pack ) {
898
+		if ($template_pack instanceof EE_Messages_Template_Pack) {
899 899
 			return $template_pack;
900 900
 		}
901 901
 
902 902
 		//nope...let's get it.
903 903
 		//not set yet so let's attempt to get it.
904
-		$pack_class_name = 'EE_Messages_Template_Pack_' . str_replace(
904
+		$pack_class_name = 'EE_Messages_Template_Pack_'.str_replace(
905 905
 				' ',
906 906
 				'_',
907 907
 				ucwords(
908
-					str_replace( '_', ' ', $template_pack_name )
908
+					str_replace('_', ' ', $template_pack_name)
909 909
 				)
910 910
 			);
911
-		if ( ! class_exists( $pack_class_name ) && $template_pack_name !== 'default' ) {
912
-			return self::get_template_pack( 'default' );
911
+		if ( ! class_exists($pack_class_name) && $template_pack_name !== 'default') {
912
+			return self::get_template_pack('default');
913 913
 		} else {
914 914
 			$template_pack = new $pack_class_name;
915
-			self::$_template_pack_collection->add( $template_pack );
915
+			self::$_template_pack_collection->add($template_pack);
916 916
 			return $template_pack;
917 917
 		}
918 918
 	}
@@ -930,26 +930,26 @@  discard block
 block discarded – undo
930 930
 	 */
931 931
 	public static function get_template_pack_collection() {
932 932
 		$new_collection = false;
933
-		if ( ! self::$_template_pack_collection instanceof EE_Messages_Template_Pack_Collection ) {
933
+		if ( ! self::$_template_pack_collection instanceof EE_Messages_Template_Pack_Collection) {
934 934
 			self::$_template_pack_collection = new EE_Messages_Template_Pack_Collection();
935 935
 			$new_collection = true;
936 936
 		}
937 937
 
938 938
 		//glob the defaults directory for messages
939
-		$templates = glob( EE_LIBRARIES . 'messages/defaults/*', GLOB_ONLYDIR );
940
-		foreach( $templates as $template_path ) {
939
+		$templates = glob(EE_LIBRARIES.'messages/defaults/*', GLOB_ONLYDIR);
940
+		foreach ($templates as $template_path) {
941 941
 			//grab folder name
942
-			$template = basename( $template_path );
942
+			$template = basename($template_path);
943 943
 
944
-			if ( ! $new_collection ) {
944
+			if ( ! $new_collection) {
945 945
 				//already have it?
946
-				if ( self::$_template_pack_collection->get_by_name( $template ) instanceof EE_Messages_Template_Pack ) {
946
+				if (self::$_template_pack_collection->get_by_name($template) instanceof EE_Messages_Template_Pack) {
947 947
 					continue;
948 948
 				}
949 949
 			}
950 950
 
951 951
 			//setup classname.
952
-			$template_pack_class_name = 'EE_Messages_Template_Pack_' . str_replace(
952
+			$template_pack_class_name = 'EE_Messages_Template_Pack_'.str_replace(
953 953
 					' ',
954 954
 					'_',
955 955
 					ucwords(
@@ -960,20 +960,20 @@  discard block
 block discarded – undo
960 960
 						)
961 961
 					)
962 962
 				);
963
-			if ( ! class_exists( $template_pack_class_name ) ) {
963
+			if ( ! class_exists($template_pack_class_name)) {
964 964
 				continue;
965 965
 			}
966
-			self::$_template_pack_collection->add( new $template_pack_class_name );
966
+			self::$_template_pack_collection->add(new $template_pack_class_name);
967 967
 		}
968 968
 
969 969
 		/**
970 970
 		 * Filter for plugins to add in any additional template packs
971 971
 		 * Note the filter name here is for backward compat, this used to be found in EED_Messages.
972 972
 		 */
973
-		$additional_template_packs = apply_filters( 'FHEE__EED_Messages__get_template_packs__template_packs', array() );
974
-		foreach ( (array) $additional_template_packs as $template_pack ) {
975
-			if ( ! self::$_template_pack_collection->contains($template_pack ) ) {
976
-				self::$_template_pack_collection->add( $template_pack );
973
+		$additional_template_packs = apply_filters('FHEE__EED_Messages__get_template_packs__template_packs', array());
974
+		foreach ((array) $additional_template_packs as $template_pack) {
975
+			if ( ! self::$_template_pack_collection->contains($template_pack)) {
976
+				self::$_template_pack_collection->add($template_pack);
977 977
 			}
978 978
 		}
979 979
 		return self::$_template_pack_collection;
@@ -991,16 +991,16 @@  discard block
 block discarded – undo
991 991
 	 * @return array
992 992
 	 * @throws \EE_Error
993 993
 	 */
994
-	public static function create_new_templates( $messenger_name, $message_type_name, $GRP_ID = 0, $global = false ) {
994
+	public static function create_new_templates($messenger_name, $message_type_name, $GRP_ID = 0, $global = false) {
995 995
 		/** @type EE_Message_Resource_Manager $Message_Resource_Manager */
996
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
997
-		$messenger = $Message_Resource_Manager->valid_messenger( $messenger_name );
998
-		$message_type = $Message_Resource_Manager->valid_message_type( $message_type_name );
999
-		if ( ! EEH_MSG_Template::message_type_has_active_templates_for_messenger( $messenger, $message_type, $global ) ) {
996
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
997
+		$messenger = $Message_Resource_Manager->valid_messenger($messenger_name);
998
+		$message_type = $Message_Resource_Manager->valid_message_type($message_type_name);
999
+		if ( ! EEH_MSG_Template::message_type_has_active_templates_for_messenger($messenger, $message_type, $global)) {
1000 1000
 			return array();
1001 1001
 		}
1002 1002
 		//whew made it this far!  Okay, let's go ahead and create the templates then
1003
-		return EEH_MSG_Template::_create_new_templates( $messenger, $message_type, $GRP_ID, $global );
1003
+		return EEH_MSG_Template::_create_new_templates($messenger, $message_type, $GRP_ID, $global);
1004 1004
 	}
1005 1005
 
1006 1006
 
@@ -1012,15 +1012,15 @@  discard block
 block discarded – undo
1012 1012
 	 * @param                  $global
1013 1013
 	 * @return array|mixed
1014 1014
 	 */
1015
-	protected static function _create_new_templates( EE_messenger $messenger, EE_message_type $message_type, $GRP_ID, $global ) {
1015
+	protected static function _create_new_templates(EE_messenger $messenger, EE_message_type $message_type, $GRP_ID, $global) {
1016 1016
 		//if we're creating a custom template then we don't need to use the defaults class
1017
-		if ( ! $global ) {
1018
-			return EEH_MSG_Template::_create_custom_template_group( $messenger, $message_type, $GRP_ID );
1017
+		if ( ! $global) {
1018
+			return EEH_MSG_Template::_create_custom_template_group($messenger, $message_type, $GRP_ID);
1019 1019
 		}
1020 1020
 		/** @type EE_Messages_Template_Defaults $Message_Template_Defaults */
1021 1021
 		$Message_Template_Defaults = EE_Registry::factory(
1022 1022
 			'EE_Messages_Template_Defaults',
1023
-			array( $messenger, $message_type, $GRP_ID )
1023
+			array($messenger, $message_type, $GRP_ID)
1024 1024
 		);
1025 1025
 		//generate templates
1026 1026
 		$success = $Message_Template_Defaults->create_new_templates();
@@ -1028,10 +1028,10 @@  discard block
 block discarded – undo
1028 1028
 		//if creating the template failed.  Then we should deactivate the related message_type for the messenger because
1029 1029
 		//its not active if it doesn't have a template.  Note this is only happening for GLOBAL template creation
1030 1030
 		//attempts.
1031
-		if ( ! $success ) {
1031
+		if ( ! $success) {
1032 1032
 			/** @var EE_Message_Resource_Manager $message_resource_manager */
1033
-			$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1034
-			$message_resource_manager->deactivate_message_type_for_messenger( $message_type->name, $messenger->name );
1033
+			$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1034
+			$message_resource_manager->deactivate_message_type_for_messenger($message_type->name, $messenger->name);
1035 1035
 		}
1036 1036
 
1037 1037
 		/**
@@ -1059,11 +1059,11 @@  discard block
 block discarded – undo
1059 1059
 	 * 										)
1060 1060
 	 * @access private
1061 1061
 	 */
1062
-	private static function _create_custom_template_group( EE_messenger $messenger, EE_message_type $message_type, $GRP_ID ) {
1062
+	private static function _create_custom_template_group(EE_messenger $messenger, EE_message_type $message_type, $GRP_ID) {
1063 1063
 		//defaults
1064
-		$success = array( 'GRP_ID' => null, 'MTP_context' => '' );
1064
+		$success = array('GRP_ID' => null, 'MTP_context' => '');
1065 1065
 		//get the template group to use as a template from the db.  If $GRP_ID is empty then we'll assume the base will be the global template matching the messenger and message type.
1066
-		$Message_Template_Group = empty( $GRP_ID )
1066
+		$Message_Template_Group = empty($GRP_ID)
1067 1067
 			? EEM_Message_Template_Group::instance()->get_one(
1068 1068
 				array(
1069 1069
 					array(
@@ -1073,9 +1073,9 @@  discard block
 block discarded – undo
1073 1073
 					)
1074 1074
 				)
1075 1075
 			)
1076
-			: EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1076
+			: EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1077 1077
 		//if we don't have a mtg at this point then we need to bail.
1078
-		if ( ! $Message_Template_Group instanceof EE_Message_Template_Group ) {
1078
+		if ( ! $Message_Template_Group instanceof EE_Message_Template_Group) {
1079 1079
 			EE_Error::add_error(
1080 1080
 				sprintf(
1081 1081
 					__(
@@ -1094,42 +1094,42 @@  discard block
 block discarded – undo
1094 1094
 		$message_templates = $Message_Template_Group->message_templates();
1095 1095
 		//now we have what we need to setup the new template
1096 1096
 		$new_mtg = clone $Message_Template_Group;
1097
-		$new_mtg->set( 'GRP_ID', 0 );
1098
-		$new_mtg->set( 'MTP_is_global', false );
1099
-		$template_name = defined( 'DOING_AJAX' ) && ! empty( $_POST[ 'templateName' ] )
1100
-			? $_POST[ 'templateName' ]
1097
+		$new_mtg->set('GRP_ID', 0);
1098
+		$new_mtg->set('MTP_is_global', false);
1099
+		$template_name = defined('DOING_AJAX') && ! empty($_POST['templateName'])
1100
+			? $_POST['templateName']
1101 1101
 			: __(
1102 1102
 				'New Custom Template',
1103 1103
 				'event_espresso'
1104 1104
 			);
1105
-		$template_description = defined( "DOING_AJAX" ) && ! empty( $_POST[ 'templateDescription' ] )
1106
-			? $_POST[ 'templateDescription' ]
1105
+		$template_description = defined("DOING_AJAX") && ! empty($_POST['templateDescription'])
1106
+			? $_POST['templateDescription']
1107 1107
 			: sprintf(
1108 1108
 				__(
1109 1109
 					'This is a custom template that was created for the %s messenger and %s message type.',
1110 1110
 					'event_espresso'
1111 1111
 				),
1112
-				$new_mtg->messenger_obj()->label[ 'singular' ],
1113
-				$new_mtg->message_type_obj()->label[ 'singular' ]
1112
+				$new_mtg->messenger_obj()->label['singular'],
1113
+				$new_mtg->message_type_obj()->label['singular']
1114 1114
 			);
1115
-		$new_mtg->set( 'MTP_name', $template_name );
1116
-		$new_mtg->set( 'MTP_description', $template_description );
1115
+		$new_mtg->set('MTP_name', $template_name);
1116
+		$new_mtg->set('MTP_description', $template_description);
1117 1117
 		//remove ALL relations on this template group so they don't get saved!
1118
-		$new_mtg->_remove_relations( 'Message_Template' );
1118
+		$new_mtg->_remove_relations('Message_Template');
1119 1119
 		$new_mtg->save();
1120
-		$success[ 'GRP_ID' ] = $new_mtg->ID();
1121
-		$success[ 'template_name' ] = $template_name;
1120
+		$success['GRP_ID'] = $new_mtg->ID();
1121
+		$success['template_name'] = $template_name;
1122 1122
 		//add new message templates and add relation to.
1123
-		foreach ( $message_templates as $message_template ) {
1124
-			if ( ! $message_template instanceof EE_Message_Template ) {
1123
+		foreach ($message_templates as $message_template) {
1124
+			if ( ! $message_template instanceof EE_Message_Template) {
1125 1125
 				continue;
1126 1126
 			}
1127 1127
 			$new_message_template = clone $message_template;
1128
-			$new_message_template->set( 'MTP_ID', 0 );
1129
-			$new_message_template->set( 'GRP_ID', $new_mtg->ID() ); //relation
1128
+			$new_message_template->set('MTP_ID', 0);
1129
+			$new_message_template->set('GRP_ID', $new_mtg->ID()); //relation
1130 1130
 			$new_message_template->save();
1131
-			if ( empty( $success[ 'MTP_context' ] ) ) {
1132
-				$success[ 'MTP_context' ] = $new_message_template->get( 'MTP_context' );
1131
+			if (empty($success['MTP_context'])) {
1132
+				$success['MTP_context'] = $new_message_template->get('MTP_context');
1133 1133
 			}
1134 1134
 		}
1135 1135
 		return $success;
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 		$global = false
1152 1152
 	) {
1153 1153
 		//is given message_type valid for given messenger (if this is not a global save)
1154
-		if ( $global ) {
1154
+		if ($global) {
1155 1155
 			return true;
1156 1156
 		}
1157 1157
 		$active_templates = EEM_Message_Template_Group::instance()->count(
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 				)
1164 1164
 			)
1165 1165
 		);
1166
-		if ( $active_templates > 0 ) {
1166
+		if ($active_templates > 0) {
1167 1167
 			return true;
1168 1168
 		}
1169 1169
 		EE_Error::add_error(
@@ -1192,24 +1192,24 @@  discard block
 block discarded – undo
1192 1192
 	 * @param  string $message_type_name name of EE_message_type
1193 1193
 	 * @return array
1194 1194
 	 */
1195
-	public static function get_fields( $messenger_name, $message_type_name ) {
1195
+	public static function get_fields($messenger_name, $message_type_name) {
1196 1196
 		$template_fields = array();
1197 1197
 		/** @type EE_Message_Resource_Manager $Message_Resource_Manager */
1198
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1199
-		$messenger = $Message_Resource_Manager->valid_messenger( $messenger_name );
1200
-		$message_type = $Message_Resource_Manager->valid_message_type( $message_type_name );
1201
-		if ( ! EEH_MSG_Template::message_type_has_active_templates_for_messenger( $messenger, $message_type ) ) {
1198
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1199
+		$messenger = $Message_Resource_Manager->valid_messenger($messenger_name);
1200
+		$message_type = $Message_Resource_Manager->valid_message_type($message_type_name);
1201
+		if ( ! EEH_MSG_Template::message_type_has_active_templates_for_messenger($messenger, $message_type)) {
1202 1202
 			return array();
1203 1203
 		}
1204 1204
 		//okay now let's assemble an array with the messenger template fields added to the message_type contexts.
1205
-		foreach ( $message_type->get_contexts() as $context => $details ) {
1206
-			foreach ( $messenger->get_template_fields() as $field => $value ) {
1207
-				$template_fields[ $context ][ $field ] = $value;
1205
+		foreach ($message_type->get_contexts() as $context => $details) {
1206
+			foreach ($messenger->get_template_fields() as $field => $value) {
1207
+				$template_fields[$context][$field] = $value;
1208 1208
 			}
1209 1209
 		}
1210
-		if ( empty( $template_fields ) ) {
1210
+		if (empty($template_fields)) {
1211 1211
 			EE_Error::add_error(
1212
-				__( 'Something went wrong and we couldn\'t get any templates assembled', 'event_espresso' ),
1212
+				__('Something went wrong and we couldn\'t get any templates assembled', 'event_espresso'),
1213 1213
 				__FILE__,
1214 1214
 				__FUNCTION__,
1215 1215
 				__LINE__
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -492,7 +492,7 @@
 block discarded – undo
492 492
 		if ( ! empty( $sending_messenger ) ) {
493 493
 			$with_messengers = $message_type->with_messengers();
494 494
 			if ( ! isset( $with_messengers[$message->messenger()] )
495
-			     || ! in_array( $sending_messenger, $with_messengers[$message->messenger()] ) ) {
495
+				 || ! in_array( $sending_messenger, $with_messengers[$message->messenger()] ) ) {
496 496
 				throw new EE_Error(
497 497
 					sprintf(
498 498
 						__(
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
core/admin/templates/admin_list_wrapper.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 /** @var string $after_list_table */
10 10
 ?>
11 11
 <?php echo $before_list_table; ?>
12
-<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url;?>" method="get">
13
-	<?php $list_table->search_box( $search['btn_label'], $current_page ); ?><br />
12
+<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url; ?>" method="get">
13
+	<?php $list_table->search_box($search['btn_label'], $current_page); ?><br />
14 14
 	<?php echo $sortable_list_table_form_fields; ?>
15 15
 	<?php $list_table->display_views(); ?>
16 16
 	<?php $list_table->display(); ?>
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Select_Input.input.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php  if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); }
1
+<?php  if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Class EE_Select_Input
4 4
  *
@@ -10,22 +10,22 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Select_Input extends EE_Form_Input_With_Options_Base{
13
+class EE_Select_Input extends EE_Form_Input_With_Options_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param array $answer_options
17 17
 	 * @param array $input_settings
18 18
 	 */
19
-	public function __construct( $answer_options, $input_settings = array() ) {
20
-		$this->_set_display_strategy( new EE_Select_Display_Strategy( $answer_options ) );
19
+	public function __construct($answer_options, $input_settings = array()) {
20
+		$this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options));
21 21
 		$this->_add_validation_strategy(
22 22
 			new EE_Enum_Validation_Strategy(
23
-				isset( $input_settings['validation_error_message'] )
23
+				isset($input_settings['validation_error_message'])
24 24
 					? $input_settings['validation_error_message']
25 25
 					: null
26 26
 			)
27 27
 		);
28
-		parent::__construct( $answer_options, $input_settings );
28
+		parent::__construct($answer_options, $input_settings);
29 29
 	}
30 30
 
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
strategies/validation/EE_Required_Validation_Strategy.strategy.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
  * @since 				4.6
9 9
  *
10 10
  */
11
-class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Required_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 
14 14
 
15 15
 	/**
16 16
 	 * @param string $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = null ) {
19
-		if( ! $validation_error_message ){
18
+	public function __construct($validation_error_message = null) {
19
+		if ( ! $validation_error_message) {
20 20
 			$validation_error_message = __("This field is required.", "event_espresso");
21 21
 		}
22
-		parent::__construct( $validation_error_message );
22
+		parent::__construct($validation_error_message);
23 23
 	}
24 24
 
25 25
 
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 	 * @throws \EE_Validation_Error
35 35
 	 */
36 36
 	public function validate($normalized_value) {
37
-		if(
37
+		if (
38 38
 			$normalized_value === ''
39 39
 			|| $normalized_value === null
40 40
 			|| $normalized_value === array()
41 41
 		) {
42
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'required');
43
-		}else{
42
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
43
+		} else {
44 44
 			return true;
45 45
 		}
46 46
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return array
52 52
 	 * @throws \EE_Error
53 53
 	 */
54
-	public function get_jquery_validation_rule_array(){
54
+	public function get_jquery_validation_rule_array() {
55 55
 		return array(
56 56
 			'required'=> true,
57 57
 			'messages' => array(
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 			|| $normalized_value === array()
41 41
 		) {
42 42
 			throw new EE_Validation_Error( $this->get_validation_error_message(), 'required');
43
-		}else{
43
+		} else{
44 44
 			return true;
45 45
 		}
46 46
 	}
Please login to merge, or discard this patch.
admin/new/pricing/templates/event_tickets_datetime_edit_row.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
 		</div>
42 42
 		<span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $clone_icon; ?> clickable"></span>
43 43
 		<span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="<?php echo $trash_icon; ?> clickable"<?php echo $show_trash; ?>></span>
44
-		<?php if ( $reg_list_url !== '' ) : ?>
45
-		<a href="<?php echo $reg_list_url; ?>" title="<?php _e( 'View registrations for this datetime.', 'event_espresso' );?>" style="text-decoration: none;">
44
+		<?php if ($reg_list_url !== '') : ?>
45
+		<a href="<?php echo $reg_list_url; ?>" title="<?php _e('View registrations for this datetime.', 'event_espresso'); ?>" style="text-decoration: none;">
46 46
 			<span data-context="datetime" data-datetime-row="<?php echo $dtt_row; ?>" class="dashicons dashicons-groups clickable"></span>
47 47
 		</a>
48 48
 		<?php endif; ?>
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_EE_Registrations_List_Table.class.php 3 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 	/**
32 32
 	 * 		REG_date
33
-	*/
33
+	 */
34 34
 	function column_REG_date(EE_Registration $item){
35 35
 
36 36
 		//Build row actions
@@ -60,60 +60,60 @@  discard block
 block discarded – undo
60 60
 		$remove_defaults = array('default_where_conditions' => 'none');
61 61
 		$ticket = $item->ticket();
62 62
 		$datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
63
-	    $EVT_ID = $item->event_ID();
64
-	    $datetime_string = '';
65
-	    foreach( $datetimes as $datetime ){
66
-		    if (
67
-			    EE_Registry::instance()->CAP->current_user_can(
68
-				    'ee_read_checkin',
69
-				    'espresso_registrations_registration_checkins',
70
-				    $item->ID()
71
-			    )
72
-		    ) {
73
-			    // open "a" tag and "href"
74
-			    $datetime_string .= '<a href="';
75
-			    // checkin URL
76
-			    $datetime_string .= EE_Admin_Page::add_query_args_and_nonce(
77
-				    array(
78
-					    'action'   => 'event_registrations',
79
-					    'event_id' => $EVT_ID,
80
-					    'DTT_ID'   => $datetime->ID(),
81
-				    ),
82
-				    REG_ADMIN_URL
83
-			    );
84
-			    // close "href"
85
-			    $datetime_string .= '"';
86
-			    // open "title" tag
87
-			    $datetime_string .= ' title="';
88
-			    // link title text
89
-			    $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' );
90
-			    // close "title" tag and end of "a" tag opening
91
-			    $datetime_string .= '">';
92
-			    // link text
93
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
94
-			    // close "a" tag
95
-			    $datetime_string .= '</a>';
96
-		    } else {
97
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
98
-		    }
99
-		    // add a "View Registrations" link that filters list by event AND datetime
100
-		    $datetime_string .= $this->row_actions(
101
-			    array(
102
-				    'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
103
-						    array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ),
104
-						    REG_ADMIN_URL
105
-					    ) . '" title="' . sprintf(
106
-						    esc_attr__(
107
-							    'Filter this list to only show registrations for this datetime %s',
108
-							    'event_espresso'
109
-						    ),
110
-						    $datetime->name()
111
-					    ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>'
112
-			    )
113
-		    );
63
+		$EVT_ID = $item->event_ID();
64
+		$datetime_string = '';
65
+		foreach( $datetimes as $datetime ){
66
+			if (
67
+				EE_Registry::instance()->CAP->current_user_can(
68
+					'ee_read_checkin',
69
+					'espresso_registrations_registration_checkins',
70
+					$item->ID()
71
+				)
72
+			) {
73
+				// open "a" tag and "href"
74
+				$datetime_string .= '<a href="';
75
+				// checkin URL
76
+				$datetime_string .= EE_Admin_Page::add_query_args_and_nonce(
77
+					array(
78
+						'action'   => 'event_registrations',
79
+						'event_id' => $EVT_ID,
80
+						'DTT_ID'   => $datetime->ID(),
81
+					),
82
+					REG_ADMIN_URL
83
+				);
84
+				// close "href"
85
+				$datetime_string .= '"';
86
+				// open "title" tag
87
+				$datetime_string .= ' title="';
88
+				// link title text
89
+				$datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' );
90
+				// close "title" tag and end of "a" tag opening
91
+				$datetime_string .= '">';
92
+				// link text
93
+				$datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
94
+				// close "a" tag
95
+				$datetime_string .= '</a>';
96
+			} else {
97
+				$datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
98
+			}
99
+			// add a "View Registrations" link that filters list by event AND datetime
100
+			$datetime_string .= $this->row_actions(
101
+				array(
102
+					'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
103
+							array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ),
104
+							REG_ADMIN_URL
105
+						) . '" title="' . sprintf(
106
+							esc_attr__(
107
+								'Filter this list to only show registrations for this datetime %s',
108
+								'event_espresso'
109
+							),
110
+							$datetime->name()
111
+						) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>'
112
+				)
113
+			);
114 114
 		}
115 115
 		return $datetime_string;
116
-    }
116
+	}
117 117
 
118 118
 
119 119
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * 		REG_date
33 33
 	*/
34
-	function column_REG_date(EE_Registration $item){
34
+	function column_REG_date(EE_Registration $item) {
35 35
 
36 36
 		//Build row actions
37 37
 		$actions = array();
38 38
 
39 39
 		//Build row actions
40
-		$check_in_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$item->event_ID() ), REG_ADMIN_URL );
41
-		$actions['check_in'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID() ) ? '
42
-			<a href="'.$check_in_url.'" title="' . esc_attr__( 'The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso' ) . '">' . __( 'View Check-ins', 'event_espresso' ) . '</a>' : __( 'View Check-ins', 'event_espresso' );
40
+		$check_in_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$item->event_ID()), REG_ADMIN_URL);
41
+		$actions['check_in'] = EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $item->ID()) ? '
42
+			<a href="'.$check_in_url.'" title="'.esc_attr__('The Check-In List allows you to easily toggle check-in status for this event', 'event_espresso').'">'.__('View Check-ins', 'event_espresso').'</a>' : __('View Check-ins', 'event_espresso');
43 43
 
44
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID() ), TXN_ADMIN_URL );
45
-		$REG_date = EE_Regisry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . $item->get_i18n_datetime( 'REG_date' ) . '</a>' : $item->get_i18n_datetime( 'REG_date' );
44
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction()->ID()), TXN_ADMIN_URL);
45
+		$REG_date = EE_Regisry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.$item->get_i18n_datetime('REG_date').'</a>' : $item->get_i18n_datetime('REG_date');
46 46
 
47
-		return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions) );
47
+		return sprintf('%1$s %2$s', $REG_date, $this->row_actions($actions));
48 48
 
49 49
 	}
50 50
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param \EE_Registration $item
57 57
 	 * @return string
58 58
 	 */
59
-   	public function column_DTT_EVT_start(EE_Registration $item){
59
+   	public function column_DTT_EVT_start(EE_Registration $item) {
60 60
 		$remove_defaults = array('default_where_conditions' => 'none');
61 61
 		$ticket = $item->ticket();
62 62
 		$datetimes = $ticket instanceof EE_Ticket ? $ticket->datetimes($remove_defaults) : array();
63 63
 	    $EVT_ID = $item->event_ID();
64 64
 	    $datetime_string = '';
65
-	    foreach( $datetimes as $datetime ){
65
+	    foreach ($datetimes as $datetime) {
66 66
 		    if (
67 67
 			    EE_Registry::instance()->CAP->current_user_can(
68 68
 				    'ee_read_checkin',
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 			    // open "title" tag
87 87
 			    $datetime_string .= ' title="';
88 88
 			    // link title text
89
-			    $datetime_string .= esc_attr__( 'View Checkins for this Event', 'event_espresso' );
89
+			    $datetime_string .= esc_attr__('View Checkins for this Event', 'event_espresso');
90 90
 			    // close "title" tag and end of "a" tag opening
91 91
 			    $datetime_string .= '">';
92 92
 			    // link text
93
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
93
+			    $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start');
94 94
 			    // close "a" tag
95 95
 			    $datetime_string .= '</a>';
96 96
 		    } else {
97
-			    $datetime_string .= $datetime->get_i18n_datetime( 'DTT_EVT_start' );
97
+			    $datetime_string .= $datetime->get_i18n_datetime('DTT_EVT_start');
98 98
 		    }
99 99
 		    // add a "View Registrations" link that filters list by event AND datetime
100 100
 		    $datetime_string .= $this->row_actions(
101 101
 			    array(
102
-				    'event_datetime_filter' => '<a href="' . EE_Admin_Page::add_query_args_and_nonce(
103
-						    array( 'event_id' => $EVT_ID, 'datetime_id' => $datetime->ID() ),
102
+				    'event_datetime_filter' => '<a href="'.EE_Admin_Page::add_query_args_and_nonce(
103
+						    array('event_id' => $EVT_ID, 'datetime_id' => $datetime->ID()),
104 104
 						    REG_ADMIN_URL
105
-					    ) . '" title="' . sprintf(
105
+					    ).'" title="'.sprintf(
106 106
 						    esc_attr__(
107 107
 							    'Filter this list to only show registrations for this datetime %s',
108 108
 							    'event_espresso'
109 109
 						    ),
110 110
 						    $datetime->name()
111
-					    ) . '">' . __( 'View Registrations', 'event_espresso' ) . '</a>'
111
+					    ).'">'.__('View Registrations', 'event_espresso').'</a>'
112 112
 			    )
113 113
 		    );
114 114
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
strategies/validation/EE_Simple_HTML_Validation_Strategy.strategy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{
13
+class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param null $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = NULL ) {
19
-		if( ! $validation_error_message ){
18
+	public function __construct($validation_error_message = NULL) {
19
+		if ( ! $validation_error_message) {
20 20
 			$allowedtags = $this->_get_allowed_tags();
21
-			$validation_error_message = sprintf( __( "Only simple HTML tags are allowed. Eg, %s", "event_espresso" ), implode( ",", array_keys( $allowedtags ) ) );
21
+			$validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags)));
22 22
 		}
23
-		parent::__construct( $validation_error_message );
23
+		parent::__construct($validation_error_message);
24 24
 	}
25 25
 
26 26
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function get_list_of_allowed_tags() {
45 45
 		$allowed_tags = $this->_get_allowed_tags();
46
-		ksort( $allowed_tags );
47
-		return implode( ', ', array_keys( $allowed_tags ) );
46
+		ksort($allowed_tags);
47
+		return implode(', ', array_keys($allowed_tags));
48 48
 	}
49 49
 
50 50
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function validate($normalized_value) {
57 57
 		$allowedtags = $this->_get_allowed_tags();
58
-		parent::validate( $normalized_value );
59
-		$normalized_value_sans_tags =  wp_kses( "$normalized_value",$allowedtags );
60
-		if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) {
61
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' );
58
+		parent::validate($normalized_value);
59
+		$normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags);
60
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
61
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
62 62
 		}
63 63
 	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
shortcodes/espresso_txn_page/EES_Espresso_Txn_Page.shortcode.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
 				$gateway = $payment_method->type_obj()->get_gateway();
97 97
 				if (
98 98
 					$gateway instanceof EE_Offsite_Gateway
99
-				    && $gateway->handle_IPN_in_this_request(
99
+					&& $gateway->handle_IPN_in_this_request(
100 100
 						\EE_Registry::instance()->REQ->params(),
101 101
 						true
102 102
 					)
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * EES_Espresso_Txn_Page
4 4
  *
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *  @return 	void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 );
30
+		add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2);
31 31
 	}
32 32
 
33 33
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *  @return 	void
49 49
 	 */
50 50
 	public static function set_definitions() {
51
-		define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
52
-		define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
51
+		define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
52
+		define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53 53
 	}
54 54
 
55 55
 
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	 * @throws \Exception
67 67
 	 * @throws \EE_Error
68 68
 	 */
69
-	public function run( WP $WP ) {
69
+	public function run(WP $WP) {
70 70
 		$this->_current_txn = null;
71
-		if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){
71
+		if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
72 72
 			/** @var EEM_Transaction $EEM_Transaction */
73
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
73
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
74 74
 			$this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link();
75 75
 		}
76
-		if ( $this->_current_txn instanceof EE_Transaction ) {
76
+		if ($this->_current_txn instanceof EE_Transaction) {
77 77
 			$payment_method = null;
78
-			$payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null );
79
-			if( $payment_method_slug ) {
80
-				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug );
78
+			$payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null);
79
+			if ($payment_method_slug) {
80
+				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug);
81 81
 			}
82 82
 
83
-			if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) {
83
+			if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) {
84 84
 				$gateway = $payment_method->type_obj()->get_gateway();
85 85
 				if (
86 86
 					$gateway instanceof EE_Offsite_Gateway
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 					)
91 91
 				) {
92 92
 					/** @type EE_Payment_Processor $payment_processor */
93
-					$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
94
-					$payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method );
93
+					$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
94
+					$payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method);
95 95
 				}
96 96
 			}
97 97
 			//allow gateways to add a filter to stop rendering the page
98
-			if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){
98
+			if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) {
99 99
 				exit;
100 100
 			}
101 101
 		}
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 *  @param		array 	$attributes
113 113
 	 *  @return 	string
114 114
 	 */
115
-	public function process_shortcode( $attributes = array() ) {
116
-		return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' );
115
+	public function process_shortcode($attributes = array()) {
116
+		return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
117 117
 	}
118 118
 
119 119
 
Please login to merge, or discard this patch.
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
  * @author				Mike Nelson
15 15
  *
16 16
  */
17
-class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{
17
+class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form {
18 18
 
19 19
 	/**
20 20
 	 *
21 21
 	 * @param EE_Payment_Method $payment_method
22 22
 	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
23 23
 	 */
24
-	public function __construct( EE_Payment_Method $payment_method, $options_array= array()){
24
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array()) {
25 25
 		$options_array['subsections'] = array_merge(
26 26
 			array(
27
-				'first_name' 	=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ),
28
-				'last_name'		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ),
29
-				'email'				=> new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ),
30
-				'address'			=> new EE_Text_Input( array( 'html_label_text'=>  __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
31
-				'address2'		=> new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
32
-				'city'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ),
33
-				'state' 				=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ),
34
-				'country' 			=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ),
35
-				'zip'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ),
36
-				'phone'			=> new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )),
27
+				'first_name' 	=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))),
28
+				'last_name'		=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))),
29
+				'email'				=> new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))),
30
+				'address'			=> new EE_Text_Input(array('html_label_text'=>  __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')),
31
+				'address2'		=> new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')),
32
+				'city'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))),
33
+				'state' 				=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))),
34
+				'country' 			=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))),
35
+				'zip'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))),
36
+				'phone'			=> new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))),
37 37
 			),
38
-			isset( $options_array['subsections'] ) ? $options_array['subsections'] : array()
38
+			isset($options_array['subsections']) ? $options_array['subsections'] : array()
39 39
 		);
40 40
 
41
-		parent::__construct( $payment_method, $options_array );
41
+		parent::__construct($payment_method, $options_array);
42 42
 
43 43
 	}
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	 * Sets the defaults for the billing form according to the attendee's details
47 47
 	 * @param EE_Attendee $attendee
48 48
 	 */
49
-	public function populate_from_attendee( $attendee ){
49
+	public function populate_from_attendee($attendee) {
50 50
 		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
51 51
 		/** @var $attendee EE_Attendee */
52 52
 		$this->populate_defaults( 
53
-			apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
53
+			apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
54 54
 				array(
55 55
 					'first_name'=>$attendee->fname(),
56 56
 					'last_name'=>$attendee->lname(),
@@ -78,48 +78,48 @@  discard block
 block discarded – undo
78 78
 	 * @param \EE_Attendee $attendee - the attendee object to copy details to
79 79
 	 * @return \EE_Attendee
80 80
 	 */
81
-	public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){
81
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) {
82 82
 		// grab billing form data
83 83
 		$data = $this->valid_data();
84 84
 		// copy first_name
85
-		if ( ! empty( $data['first_name'] )) {
86
-			$attendee->set_fname( $data['first_name'] );
85
+		if ( ! empty($data['first_name'])) {
86
+			$attendee->set_fname($data['first_name']);
87 87
 		}
88 88
 		// copy last_name
89
-		if ( ! empty( $data['last_name'] )) {
90
-			$attendee->set_lname( $data['last_name'] );
89
+		if ( ! empty($data['last_name'])) {
90
+			$attendee->set_lname($data['last_name']);
91 91
 		}
92 92
 		// copy email
93
-		if ( ! empty( $data['email'] )) {
94
-			$attendee->set_email( $data['email'] );
93
+		if ( ! empty($data['email'])) {
94
+			$attendee->set_email($data['email']);
95 95
 		}
96 96
 		// copy address
97
-		if ( ! empty( $data['address'] )) {
98
-			$attendee->set_address( $data['address'] );
97
+		if ( ! empty($data['address'])) {
98
+			$attendee->set_address($data['address']);
99 99
 		}
100 100
 		// copy address2
101
-		if ( ! empty( $data['address2'] )) {
102
-			$attendee->set_address2( $data['address2'] );
101
+		if ( ! empty($data['address2'])) {
102
+			$attendee->set_address2($data['address2']);
103 103
 		}
104 104
 		// copy city
105
-		if ( ! empty( $data['city'] )) {
106
-			$attendee->set_city( $data['city'] );
105
+		if ( ! empty($data['city'])) {
106
+			$attendee->set_city($data['city']);
107 107
 		}
108 108
 		// copy state
109
-		if ( ! empty( $data['state'] )) {
110
-			$attendee->set_state( $data['state'] );
109
+		if ( ! empty($data['state'])) {
110
+			$attendee->set_state($data['state']);
111 111
 		}
112 112
 		// copy country
113
-		if ( ! empty( $data['country'] )) {
114
-			$attendee->set_country( $data['country'] );
113
+		if ( ! empty($data['country'])) {
114
+			$attendee->set_country($data['country']);
115 115
 		}
116 116
 		// copy zip
117
-		if ( ! empty( $data['zip'] )) {
118
-			$attendee->set_zip( $data['zip'] );
117
+		if ( ! empty($data['zip'])) {
118
+			$attendee->set_zip($data['zip']);
119 119
 		}
120 120
 		// copy phone
121
-		if ( ! empty( $data['phone'] )) {
122
-			$attendee->set_phone( $data['phone'] );
121
+		if ( ! empty($data['phone'])) {
122
+			$attendee->set_phone($data['phone']);
123 123
 		}
124 124
 		return $attendee;
125 125
 	}
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
 	 * uses info from the billing form to create a new attendee
131 131
 	 * @return \EE_Attendee
132 132
 	 */
133
-	public function create_attendee_from_billing_form_data(){
133
+	public function create_attendee_from_billing_form_data() {
134 134
 		// grab billing form data
135 135
 		$data = $this->valid_data();
136
-		return EE_Attendee::new_instance( array(
137
-			'ATT_fname' 		=> ! empty( $data['first_name'] ) ? $data['first_name'] : '',
138
-			'ATT_lname' 		=> ! empty( $data['last_name'] ) ? $data['last_name'] : '',
139
-			'ATT_email' 		=> ! empty( $data['email'] ) ? $data['email'] : '',
140
-			'ATT_address' 		=> ! empty( $data['address'] ) ? $data['address'] : '',
141
-			'ATT_address2' 	=> ! empty( $data['address2'] ) ? $data['address2'] : '',
142
-			'ATT_city' 			=> ! empty( $data['city'] ) ? $data['city'] : '',
143
-			'STA_ID' 				=> ! empty( $data['state'] ) ? $data['state'] : '',
144
-			'CNT_ISO' 			=> ! empty( $data['country'] ) ? $data['country'] : '',
145
-			'ATT_zip' 				=> ! empty( $data['zip'] ) ? $data['zip'] : '',
146
-			'ATT_phone' 		=> ! empty( $data['phone'] ) ? $data['phone'] : '',
136
+		return EE_Attendee::new_instance(array(
137
+			'ATT_fname' 		=> ! empty($data['first_name']) ? $data['first_name'] : '',
138
+			'ATT_lname' 		=> ! empty($data['last_name']) ? $data['last_name'] : '',
139
+			'ATT_email' 		=> ! empty($data['email']) ? $data['email'] : '',
140
+			'ATT_address' 		=> ! empty($data['address']) ? $data['address'] : '',
141
+			'ATT_address2' 	=> ! empty($data['address2']) ? $data['address2'] : '',
142
+			'ATT_city' 			=> ! empty($data['city']) ? $data['city'] : '',
143
+			'STA_ID' 				=> ! empty($data['state']) ? $data['state'] : '',
144
+			'CNT_ISO' 			=> ! empty($data['country']) ? $data['country'] : '',
145
+			'ATT_zip' 				=> ! empty($data['zip']) ? $data['zip'] : '',
146
+			'ATT_phone' 		=> ! empty($data['phone']) ? $data['phone'] : '',
147 147
 		));
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.