Completed
Branch BUG-8957-add-countries (49f36b)
by
unknown
33:27 queued 16:54
created
core/libraries/messages/EE_Messages_Processor.lib.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -410,7 +410,7 @@
 block discarded – undo
410 410
 	/**
411 411
 	 * This simply loops through all active messengers and takes care of setting up the
412 412
 	 * EE_Message_To_Generate objects.
413
-	 * @param $message_type
413
+	 * @param string $message_type
414 414
 	 * @param $data
415 415
 	 *
416 416
 	 * @return EE_Message_To_Generate[]
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param EE_Message_Resource_Manager $message_resource_manager
37 37
 	 */
38
-	public function __construct( EE_Message_Resource_Manager $message_resource_manager ) {
38
+	public function __construct(EE_Message_Resource_Manager $message_resource_manager) {
39 39
 		$this->_message_resource_manager = $message_resource_manager;
40 40
 		$this->_init_queue_and_generator();
41 41
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * - $_generator = holds the messages generator
51 51
 	 */
52 52
 	protected function _init_queue_and_generator() {
53
-		$this->_generator = EE_Registry::factory( 'EE_Messages_Generator' );
53
+		$this->_generator = EE_Registry::factory('EE_Messages_Generator');
54 54
 		$this->_queue = $this->_generator->generation_queue();
55 55
 	}
56 56
 
@@ -75,31 +75,31 @@  discard block
 block discarded – undo
75 75
 	 * @param EE_Messages_Queue $queue_to_process
76 76
 	 * @return bool  true for success false for error.
77 77
 	 */
78
-	public function process_immediately_from_queue( EE_Messages_Queue $queue_to_process ) {
78
+	public function process_immediately_from_queue(EE_Messages_Queue $queue_to_process) {
79 79
 		$success = false;
80 80
 		$messages_to_send = array();
81 81
 		$messages_to_generate = array();
82 82
 		//loop through and setup the various messages from the queue so we know what is being processed
83 83
 		$queue_to_process->get_message_repository()->rewind();
84
-		foreach ( $queue_to_process->get_message_repository() as $message ) {
85
-			if ( $message->STS_ID() === EEM_Message::status_incomplete ) {
84
+		foreach ($queue_to_process->get_message_repository() as $message) {
85
+			if ($message->STS_ID() === EEM_Message::status_incomplete) {
86 86
 				$messages_to_generate[] = $message;
87 87
 				continue;
88 88
 			}
89 89
 
90
-			if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) {
90
+			if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) {
91 91
 				$messages_to_send[] = $message;
92 92
 				continue;
93 93
 			}
94 94
 		}
95 95
 
96 96
 		//do generation/sends
97
-		if ( $messages_to_generate ) {
98
-			$success = $this->batch_generate_from_queue( $messages_to_generate, true );
97
+		if ($messages_to_generate) {
98
+			$success = $this->batch_generate_from_queue($messages_to_generate, true);
99 99
 		}
100 100
 
101
-		if ( $messages_to_send ) {
102
-			$sent = $this->batch_send_from_queue( $messages_to_send, true );
101
+		if ($messages_to_send) {
102
+			$sent = $this->batch_send_from_queue($messages_to_send, true);
103 103
 			//if there was messages to generate and it failed, then we override any success value for the sending process
104 104
 			//otherwise we just use the return from batch send.  The intent is that there is a simple response for success/fail.
105 105
 			//Either everything was successful or we consider it a fail.  To be clear, this is a limitation of doing
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	 * @return bool|EE_Messages_Queue return false if nothing generated.  This returns a new EE_Message_Queue with
120 120
 	 *                                   generated messages.
121 121
 	 */
122
-	public function batch_generate_from_queue( $messages = array(), $clear_queue = false ) {
123
-		if ( $this->_build_queue_for_generation( $messages, $clear_queue ) ) {
122
+	public function batch_generate_from_queue($messages = array(), $clear_queue = false) {
123
+		if ($this->_build_queue_for_generation($messages, $clear_queue)) {
124 124
 			$new_queue = $this->_generator->generate();
125
-			if ( $new_queue instanceof EE_Messages_Queue ) {
125
+			if ($new_queue instanceof EE_Messages_Queue) {
126 126
 				//unlock queue
127 127
 				$this->_queue->unlock_queue();
128
-				$new_queue->initiate_request_by_priority( 'send' );
128
+				$new_queue->initiate_request_by_priority('send');
129 129
 				return $new_queue;
130 130
 			}
131 131
 		}
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return bool true means queue prepped, false means there was a lock so no generation please.
148 148
 	 */
149
-	protected function _build_queue_for_generation( $messages = array(), $clear_queue = false ) {
149
+	protected function _build_queue_for_generation($messages = array(), $clear_queue = false) {
150 150
 
151
-		if ( $clear_queue ) {
151
+		if ($clear_queue) {
152 152
 			$this->_init_queue_and_generator();
153 153
 		}
154 154
 
155
-		if ( $messages ) {
155
+		if ($messages) {
156 156
 			//if generation is locked then get out now because that means processing is already happening.
157
-			if ( $this->_queue->is_locked() ) {
157
+			if ($this->_queue->is_locked()) {
158 158
 				return false;
159 159
 			}
160 160
 
161 161
 			$this->_queue->lock_queue();
162
-			$messages = is_array( $messages ) ? $messages : array( $messages );
163
-			foreach ( $messages as $message ) {
164
-				if ( $message instanceof EE_Message ) {
162
+			$messages = is_array($messages) ? $messages : array($messages);
163
+			foreach ($messages as $message) {
164
+				if ($message instanceof EE_Message) {
165 165
 					$data = $message->all_extra_meta_array();
166
-					$this->_queue->add( $message, $data );
166
+					$this->_queue->add($message, $data);
167 167
 				}
168 168
 			}
169 169
 			return true;
@@ -181,22 +181,22 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return bool true means queue prepped, false means there was a lock so no queue prepped.
183 183
 	 */
184
-	protected function _build_queue_for_sending( $messages, $clear_queue = false ) {
184
+	protected function _build_queue_for_sending($messages, $clear_queue = false) {
185 185
 		//if sending is locked then get out now because that means processing is already happening.
186
-		if ( $this->_queue->is_locked( EE_Messages_Queue::action_sending ) ) {
186
+		if ($this->_queue->is_locked(EE_Messages_Queue::action_sending)) {
187 187
 			return false;
188 188
 		}
189 189
 
190
-		$this->_queue->lock_queue( EE_Messages_Queue::action_sending );
190
+		$this->_queue->lock_queue(EE_Messages_Queue::action_sending);
191 191
 
192
-		if ( $clear_queue ) {
192
+		if ($clear_queue) {
193 193
 			$this->_init_queue_and_generator();
194 194
 		}
195 195
 
196
-		$messages = is_array( $messages ) ? $messages : array( $messages );
196
+		$messages = is_array($messages) ? $messages : array($messages);
197 197
 
198
-		foreach ( $messages as $message ) {
199
-			$this->_queue->add( $message );
198
+		foreach ($messages as $message) {
199
+			$this->_queue->add($message);
200 200
 		}
201 201
 		return true;
202 202
 	}
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return EE_Messages_Queue
214 214
 	 */
215
-	public function batch_send_from_queue( $messages = array(), $clear_queue = false ) {
215
+	public function batch_send_from_queue($messages = array(), $clear_queue = false) {
216 216
 
217
-		if ( $messages && $this->_build_queue_for_sending( $messages, $clear_queue ) ) {
217
+		if ($messages && $this->_build_queue_for_sending($messages, $clear_queue)) {
218 218
 			$this->_queue->execute();
219
-			$this->_queue->unlock_queue( EE_Messages_Queue::action_sending );
219
+			$this->_queue->unlock_queue(EE_Messages_Queue::action_sending);
220 220
 		} else {
221 221
 			//get messages to send and execute.
222 222
 			$this->_queue->get_to_send_batch_and_send();
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param EE_Message_To_Generate[] $messages_to_generate
240 240
 	 * @return EE_Messages_Queue
241 241
 	 */
242
-	public function generate_and_return(  $messages_to_generate ) {
242
+	public function generate_and_return($messages_to_generate) {
243 243
 		$this->_init_queue_and_generator();
244
-		$this->_queue_for_generation_loop( $messages_to_generate );
245
-		return $this->_generator->generate( false );
244
+		$this->_queue_for_generation_loop($messages_to_generate);
245
+		return $this->_generator->generate(false);
246 246
 	}
247 247
 
248 248
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 * @param  bool     $persist    Indicate whether to instruct the generator to persist the generated queue (true) or not (false).
254 254
 	 * @return EE_Messages_Queue
255 255
 	 */
256
-	public function generate_queue( $persist = true ) {
257
-		return $this->_generator->generate( $persist );
256
+	public function generate_queue($persist = true) {
257
+		return $this->_generator->generate($persist);
258 258
 	}
259 259
 
260 260
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 	 * @param bool                   $test_send             Whether this item is for a test send or not.
268 268
 	 * @return  EE_Messages_Queue
269 269
 	 */
270
-	public function queue_for_generation( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
271
-		if ( $message_to_generate->valid() ) {
272
-			$this->_generator->create_and_add_message_to_queue( $message_to_generate, $test_send );
270
+	public function queue_for_generation(EE_Message_To_Generate $message_to_generate, $test_send = false) {
271
+		if ($message_to_generate->valid()) {
272
+			$this->_generator->create_and_add_message_to_queue($message_to_generate, $test_send);
273 273
 		}
274 274
 	}
275 275
 
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @param EE_Message_To_Generate[] $messages_to_generate
287 287
 	 */
288
-	public function batch_queue_for_generation_and_persist( $messages_to_generate ) {
288
+	public function batch_queue_for_generation_and_persist($messages_to_generate) {
289 289
 		$this->_init_queue_and_generator();
290
-		$this->_queue_for_generation_loop( $messages_to_generate );
290
+		$this->_queue_for_generation_loop($messages_to_generate);
291 291
 		$this->_queue->save();
292 292
 	}
293 293
 
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @param EE_Message_To_Generate[]  $messages_to_generate
305 305
 	 */
306
-	public function batch_queue_for_generation_no_persist( $messages_to_generate ) {
306
+	public function batch_queue_for_generation_no_persist($messages_to_generate) {
307 307
 		$this->_init_queue_and_generator();
308
-		$this->_queue_for_generation_loop( $messages_to_generate );
308
+		$this->_queue_for_generation_loop($messages_to_generate);
309 309
 	}
310 310
 
311 311
 
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @param EE_Message_To_Generate[] $messages_to_generate
319 319
 	 */
320
-	protected function _queue_for_generation_loop( $messages_to_generate ) {
320
+	protected function _queue_for_generation_loop($messages_to_generate) {
321 321
 		//make sure is in an array.
322
-		if ( ! is_array( $messages_to_generate ) ) {
323
-			$messages_to_generate = array( $messages_to_generate );
322
+		if ( ! is_array($messages_to_generate)) {
323
+			$messages_to_generate = array($messages_to_generate);
324 324
 		}
325 325
 
326
-		foreach ( $messages_to_generate as $message_to_generate ) {
327
-			if ( $message_to_generate instanceof EE_Message_To_Generate && $message_to_generate->valid() ) {
328
-				$this->queue_for_generation( $message_to_generate );
326
+		foreach ($messages_to_generate as $message_to_generate) {
327
+			if ($message_to_generate instanceof EE_Message_To_Generate && $message_to_generate->valid()) {
328
+				$this->queue_for_generation($message_to_generate);
329 329
 			}
330 330
 		}
331 331
 	}
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 	 * @param  EE_Message_To_Generate[]
341 341
 	 * @return EE_Messages_Queue
342 342
 	 */
343
-	public function generate_and_queue_for_sending( $messages_to_generate ) {
343
+	public function generate_and_queue_for_sending($messages_to_generate) {
344 344
 		$this->_init_queue_and_generator();
345
-		$this->_queue_for_generation_loop( $messages_to_generate );
346
-		return $this->_generator->generate( true );
345
+		$this->_queue_for_generation_loop($messages_to_generate);
346
+		return $this->_generator->generate(true);
347 347
 	}
348 348
 
349 349
 
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * @param   bool                   $test_send                Whether this is a test send or not.
358 358
 	 * @return  EE_Messages_Queue | bool   false if unable to generate otherwise the generated queue.
359 359
 	 */
360
-	public function generate_for_preview( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
361
-		if ( ! $message_to_generate->valid() ) {
360
+	public function generate_for_preview(EE_Message_To_Generate $message_to_generate, $test_send = false) {
361
+		if ( ! $message_to_generate->valid()) {
362 362
 			EE_Error::add_error(
363
-				__( 'Unable to generate preview because of invalid data', 'event_espresso' ),
363
+				__('Unable to generate preview because of invalid data', 'event_espresso'),
364 364
 				__FILE__,
365 365
 				__FUNCTION__,
366 366
 				__LINE__
@@ -368,14 +368,14 @@  discard block
 block discarded – undo
368 368
 			return false;
369 369
 		}
370 370
 		//just make sure preview is set on the $message_to_generate (in case client forgot)
371
-		$message_to_generate->set_preview( true );
371
+		$message_to_generate->set_preview(true);
372 372
 		$this->_init_queue_and_generator();
373
-		$this->queue_for_generation( $message_to_generate, $test_send );
374
-		$generated_queue = $this->_generator->generate( false );
375
-		if ( $generated_queue->execute( false ) ) {
373
+		$this->queue_for_generation($message_to_generate, $test_send);
374
+		$generated_queue = $this->_generator->generate(false);
375
+		if ($generated_queue->execute(false)) {
376 376
 			//the first queue item should be the preview
377 377
 			$generated_queue->get_message_repository()->rewind();
378
-			if ( ! $generated_queue->get_message_repository()->valid() ) {
378
+			if ( ! $generated_queue->get_message_repository()->valid()) {
379 379
 				return $generated_queue;
380 380
 			}
381 381
 			return $generated_queue->get_message_repository()->is_test_send() ? true : $generated_queue;
@@ -392,15 +392,15 @@  discard block
 block discarded – undo
392 392
 	 * @param EE_Message_To_Generate $message_to_generate
393 393
 	 * @return bool true or false for success.
394 394
 	 */
395
-	public function queue_for_sending( EE_Message_To_Generate $message_to_generate ) {
396
-		if ( ! $message_to_generate->valid() ) {
395
+	public function queue_for_sending(EE_Message_To_Generate $message_to_generate) {
396
+		if ( ! $message_to_generate->valid()) {
397 397
 			return false;
398 398
 		}
399 399
 		$this->_init_queue_and_generator();
400 400
 		$message = $message_to_generate->get_EE_Message();
401
-		$this->_queue->add( $message );
402
-		if ( $message->send_now() ) {
403
-			$this->_queue->execute( false );
401
+		$this->_queue->add($message);
402
+		if ($message->send_now()) {
403
+			$this->_queue->execute(false);
404 404
 		} else {
405 405
 			$this->_queue->save();
406 406
 		}
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
 	 * @param EE_Message_To_Generate $message_to_generate
414 414
 	 * @return EE_Messages_Queue | null
415 415
 	 */
416
-	public function generate_and_send_now( EE_Message_To_Generate $message_to_generate ) {
417
-		if ( ! $message_to_generate->valid() ) {
416
+	public function generate_and_send_now(EE_Message_To_Generate $message_to_generate) {
417
+		if ( ! $message_to_generate->valid()) {
418 418
 			return null;
419 419
 		}
420 420
 		// is there supposed to be a sending messenger for this message?
421
-		if ( $message_to_generate instanceof EEI_Has_Sending_Messenger ) {
421
+		if ($message_to_generate instanceof EEI_Has_Sending_Messenger) {
422 422
 			// make sure it's valid, but if it's not,
423 423
 			// then set the value of $sending_messenger to an EE_Error object
424 424
 			// so that downstream code can easily see that things went wrong.
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
 			$sending_messenger = null;
435 435
 		}
436 436
 
437
-		if ( $message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_idle ) {
437
+		if ($message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_idle) {
438 438
 			$this->_init_queue_and_generator();
439
-			$this->_queue->add( $message_to_generate->get_EE_Message() );
440
-			$this->_queue->execute( false, $sending_messenger );
439
+			$this->_queue->add($message_to_generate->get_EE_Message());
440
+			$this->_queue->execute(false, $sending_messenger);
441 441
 			return $this->_queue;
442
-		} elseif ( $message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_incomplete ) {
443
-			$generated_queue = $this->generate_and_return( array( $message_to_generate ) );
444
-			$generated_queue->execute( false, $sending_messenger );
442
+		} elseif ($message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_incomplete) {
443
+			$generated_queue = $this->generate_and_return(array($message_to_generate));
444
+			$generated_queue->execute(false, $sending_messenger);
445 445
 			return $generated_queue;
446 446
 		}
447 447
 		return null;
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 	 * @param mixed  $data   The data being used for generation.
459 459
 	 * @param bool   $persist   Whether to persist the queued messages to the db or not.
460 460
 	 */
461
-	public function generate_for_all_active_messengers( $message_type, $data, $persist = true ) {
462
-		$messages_to_generate = $this->setup_mtgs_for_all_active_messengers( $message_type, $data );
463
-		if ( $persist ) {
464
-			$this->batch_queue_for_generation_and_persist( $messages_to_generate );
461
+	public function generate_for_all_active_messengers($message_type, $data, $persist = true) {
462
+		$messages_to_generate = $this->setup_mtgs_for_all_active_messengers($message_type, $data);
463
+		if ($persist) {
464
+			$this->batch_queue_for_generation_and_persist($messages_to_generate);
465 465
 			$this->_queue->initiate_request_by_priority();
466 466
 		} else {
467
-			$this->batch_queue_for_generation_no_persist( $messages_to_generate );
467
+			$this->batch_queue_for_generation_no_persist($messages_to_generate);
468 468
 		}
469 469
 	}
470 470
 
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return EE_Message_To_Generate[]
481 481
 	 */
482
-	public function setup_mtgs_for_all_active_messengers( $message_type, $data ) {
482
+	public function setup_mtgs_for_all_active_messengers($message_type, $data) {
483 483
 		$messages_to_generate = array();
484
-		foreach ( $this->_message_resource_manager->active_messengers() as $messenger_slug => $messenger_object  ) {
485
-			$message_to_generate = new EE_Message_To_Generate( $messenger_slug, $message_type, $data );
486
-			if ( $message_to_generate->valid() ) {
484
+		foreach ($this->_message_resource_manager->active_messengers() as $messenger_slug => $messenger_object) {
485
+			$message_to_generate = new EE_Message_To_Generate($messenger_slug, $message_type, $data);
486
+			if ($message_to_generate->valid()) {
487 487
 				$messages_to_generate[] = $message_to_generate;
488 488
 			}
489 489
 		}
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
 	 * and send.
499 499
 	 * @param array $message_ids
500 500
 	 */
501
-	public function setup_messages_from_ids_and_send( $message_ids ) {
501
+	public function setup_messages_from_ids_and_send($message_ids) {
502 502
 		$this->_init_queue_and_generator();
503
-		$messages = EEM_Message::instance()->get_all( array(
503
+		$messages = EEM_Message::instance()->get_all(array(
504 504
 			array(
505
-				'MSG_ID' => array( 'IN', $message_ids ),
505
+				'MSG_ID' => array('IN', $message_ids),
506 506
 				'STS_ID' => array(
507 507
 					'IN',
508 508
 					array_merge(
509 509
 						EEM_Message::instance()->stati_indicating_sent(),
510
-						array( EEM_Message::status_retry )
510
+						array(EEM_Message::status_retry)
511 511
 					),
512 512
 				),
513 513
 			),
514 514
 		));
515 515
 		//set the Messages to resend.
516
-		foreach ( $messages as $message ) {
517
-			if ( $message instanceof EE_Message ) {
518
-				$message->set_STS_ID( EEM_Message::status_resend );
519
-				$this->_queue->add( $message );
516
+		foreach ($messages as $message) {
517
+			if ($message instanceof EE_Message) {
518
+				$message->set_STS_ID(EEM_Message::status_resend);
519
+				$this->_queue->add($message);
520 520
 			}
521 521
 		}
522 522
 
523
-		$this->_queue->initiate_request_by_priority( 'send' );
523
+		$this->_queue->initiate_request_by_priority('send');
524 524
 	}
525 525
 
526 526
 
@@ -534,23 +534,23 @@  discard block
 block discarded – undo
534 534
 	 *
535 535
 	 * @return EE_Message_To_Generate[]
536 536
 	 */
537
-	public function setup_messages_to_generate_from_registration_ids_in_request( $registration_ids_key = '_REG_ID' ) {
538
-		EE_Registry::instance()->load_core( 'Request_Handler' );
539
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
537
+	public function setup_messages_to_generate_from_registration_ids_in_request($registration_ids_key = '_REG_ID') {
538
+		EE_Registry::instance()->load_core('Request_Handler');
539
+		EE_Registry::instance()->load_helper('MSG_Template');
540 540
 		$regs_to_send = array();
541
-		$regIDs = EE_Registry::instance()->REQ->get( $registration_ids_key );
542
-		if ( empty( $regIDs ) ) {
543
-			EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
541
+		$regIDs = EE_Registry::instance()->REQ->get($registration_ids_key);
542
+		if (empty($regIDs)) {
543
+			EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
544 544
 			return false;
545 545
 		}
546 546
 
547 547
 		//make sure is an array
548
-		$regIDs = is_array( $regIDs ) ? $regIDs : array( $regIDs );
548
+		$regIDs = is_array($regIDs) ? $regIDs : array($regIDs);
549 549
 
550
-		foreach( $regIDs as $regID ) {
551
-			$reg = EEM_Registration::instance()->get_one_by_ID( $regID );
552
-			if ( ! $reg instanceof EE_Registration ) {
553
-				EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $regID ) );
550
+		foreach ($regIDs as $regID) {
551
+			$reg = EEM_Registration::instance()->get_one_by_ID($regID);
552
+			if ( ! $reg instanceof EE_Registration) {
553
+				EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $regID));
554 554
 				return false;
555 555
 			}
556 556
 			$regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg;
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 
559 559
 		$messages_to_generate = array();
560 560
 
561
-		foreach ( $regs_to_send as $status_group ) {
562
-			foreach ( $status_group as $status_id => $registrations ) {
561
+		foreach ($regs_to_send as $status_group) {
562
+			foreach ($status_group as $status_id => $registrations) {
563 563
 				$messages_to_generate = array_merge(
564 564
 					$messages_to_generate,
565 565
 					$this->setup_mtgs_for_all_active_messengers(
566
-						EEH_MSG_Template::convert_reg_status_to_message_type( $status_id ),
567
-						array( $registrations, $status_id )
566
+						EEH_MSG_Template::convert_reg_status_to_message_type($status_id),
567
+						array($registrations, $status_id)
568 568
 					)
569 569
 				);
570 570
 			}
Please login to merge, or discard this patch.
admin_pages/events/qtips/EE_Event_List_Table_Tips.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 			0 => array(
34 34
 				'content_id' => 'attendee-column-tip',
35 35
 				'target' => '.column-attendees .dashicons-groups',
36
-				'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ),
36
+				'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')),
37 37
 				'options' => array( 
38 38
 					'position' => array(
39 39
 						'my' => 'bottom left',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @param  EE_Datetime constant $status What status is set (by class)
125 125
 	 * @return string         The status legend with the related status highlighted
126 126
 	 */
127
-	private function _event_status_legend( $status ) {
127
+	private function _event_status_legend($status) {
128 128
 
129 129
 		$status_array = array(
130 130
 			'active_status' => EE_Datetime::active,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			'inactive_status' => EE_Datetime::inactive
137 137
 		);
138 138
 
139
-		return EEH_Template::status_legend( $status_array, $status );
139
+		return EEH_Template::status_legend($status_array, $status);
140 140
 	}
141 141
 
142 142
 }
143 143
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Admin_Page.core.php 4 patches
Braces   +2 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1849,8 +1849,7 @@  discard block
 block discarded – undo
1849 1849
 		$MTP = EEM_Message_Template_Group::instance();
1850 1850
 
1851 1851
 		if ( empty($GRP_ID) )
1852
-			{$this->_message_template_group = $MTP->create_default_object();}
1853
-		else
1852
+			{$this->_message_template_group = $MTP->create_default_object();} else
1854 1853
 			{$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );}
1855 1854
 
1856 1855
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
@@ -2977,9 +2976,7 @@  discard block
 block discarded – undo
2977 2976
 				}
2978 2977
 			}
2979 2978
 			$this->_active_messengers[$messenger]['settings'] = $settings;
2980
-		}
2981
-
2982
-		else if ( $this->_req_data['type'] == 'message_type' ) {
2979
+		} else if ( $this->_req_data['type'] == 'message_type' ) {
2983 2980
 			$settings = $this->_req_data['message_type_settings'];
2984 2981
 			$messenger = $settings['messenger'];
2985 2982
 			$message_type = $settings['message_type'];
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
 	 * @param  int    $GRP_ID The group being deleted
2431 2431
 	 * @param  bool $include_group whether to delete the Message Template Group as well.
2432 2432
 	 *
2433
-	 * @return bool        boolean to indicate the success of the deletes or not.
2433
+	 * @return integer        boolean to indicate the success of the deletes or not.
2434 2434
 	 */
2435 2435
 	private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) {
2436 2436
 		$success = 1;
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
 	 * This just prepares the content for the message type settings
2566 2566
 	 *
2567 2567
 	 * @param  object  $message_type The message type object
2568
-	 * @param  object  $messenger    The messenger object
2568
+	 * @param  EE_messenger|null  $messenger    The messenger object
2569 2569
 	 * @param  boolean $active       Whether the message type is active or not
2570 2570
 	 *
2571 2571
 	 * @return string                html output for the content
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 *
103 103
 	 * @throws EE_Error
104
-	*/
104
+	 */
105 105
 	protected function _load_message_resource_manager() {
106 106
 		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
107 107
 	}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	public function get_messengers_select_input( $messenger_options ) {
203 203
 		//if empty or just one value then just return an empty string
204 204
 		if ( empty( $messenger_options )
205
-		     || ! is_array( $messenger_options )
206
-		     ||  count( $messenger_options ) === 1
205
+			 || ! is_array( $messenger_options )
206
+			 ||  count( $messenger_options ) === 1
207 207
 		) {
208 208
 			return '';
209 209
 		}
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 
334 334
 	/**
335 335
 	 * 		an array for storing key => value pairs of request actions and their corresponding methods
336
-	*		@access protected
337
-	*		@return void
338
-	*/
336
+	 *		@access protected
337
+	 *		@return void
338
+	 */
339 339
 	protected function _set_page_routes() {
340 340
 		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] )
341 341
 			? $this->_req_data['GRP_ID']
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
 	protected function _add_screen_options_global_mtps() {
645 645
 		/**
646 646
 		 * Note: the reason for the value swap here on $this->_admin_page_title is because $this->_per_page_screen_options
647
-         * uses the $_admin_page_title property and we want different outputs in the different spots.
648
-         */
647
+		 * uses the $_admin_page_title property and we want different outputs in the different spots.
648
+		 */
649 649
 		$page_title = $this->_admin_page_title;
650 650
 		$this->_admin_page_title = __('Global Message Templates', 'event_espresso');
651 651
 		$this->_per_page_screen_option();
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
849 849
 			? array(
850 850
 				'generate_now' => __( 'Generate Now', 'event_espresso' ),
851
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
852
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
853
-		        'send_now' => __( 'Send Now', 'event_espresso' )
851
+				'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
852
+				'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
853
+				'send_now' => __( 'Send Now', 'event_espresso' )
854 854
 				)
855 855
 			: array();
856 856
 
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 
862 862
 		$this->_views = array(
863 863
 			 'all' => array(
864
-			    'slug' => 'all',
865
-			    'label' => __( 'All', 'event_espresso' ),
866
-			    'count' => 0,
867
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
864
+				'slug' => 'all',
865
+				'label' => __( 'All', 'event_espresso' ),
866
+				'count' => 0,
867
+				'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
868 868
 			 )
869 869
 		);
870 870
 
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 																			&& in_array($extra_field, $v_fields)
1255 1255
 																			&&
1256 1256
 																			(
1257
-								                                                is_array($validators[$extra_field] )
1257
+																				is_array($validators[$extra_field] )
1258 1258
 																				&& isset( $validators[$extra_field]['msg'] )
1259
-							                                                )
1259
+																			)
1260 1260
 								? 'validate-error ' . $css_class
1261 1261
 								: $css_class;
1262 1262
 
@@ -1541,8 +1541,8 @@  discard block
 block discarded – undo
1541 1541
 			 $GRP_ID,
1542 1542
 			 false,
1543 1543
 			 add_query_arg(
1544
-			    array( 'action' => 'global_mtps' ),
1545
-			    $this->_admin_base_url
1544
+				array( 'action' => 'global_mtps' ),
1545
+				$this->_admin_base_url
1546 1546
 			 )
1547 1547
 		);
1548 1548
 
@@ -2017,14 +2017,14 @@  discard block
 block discarded – undo
2017 2017
 
2018 2018
 
2019 2019
 	/**
2020
-     * This returns the shortcode selector skeleton for a given context and field.
2021
-     *
2022
-     * @since 4.9.rc.000
2023
-     *
2020
+	 * This returns the shortcode selector skeleton for a given context and field.
2021
+	 *
2022
+	 * @since 4.9.rc.000
2023
+	 *
2024 2024
 	 * @param string $field  The name of the field retrieving shortcodes for.
2025
-     * @param string $linked_input_id The css id of the input that the shortcodes get added to.
2026
-     * @return string
2027
-    */
2025
+	 * @param string $linked_input_id The css id of the input that the shortcodes get added to.
2026
+	 * @return string
2027
+	 */
2028 2028
 	protected function _get_shortcode_selector( $field, $linked_input_id ) {
2029 2029
 		$template_args = array(
2030 2030
 			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
@@ -2622,9 +2622,9 @@  discard block
 block discarded – undo
2622 2622
 
2623 2623
 	/**
2624 2624
 	 * 	_learn_more_about_message_templates_link
2625
-	*	@access protected
2626
-	*	@return string
2627
-	*/
2625
+	 *	@access protected
2626
+	 *	@return string
2627
+	 */
2628 2628
 	protected function _learn_more_about_message_templates_link() {
2629 2629
 		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2630 2630
 	}
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
 			/** @var EE_message_type $message_type */
3269 3269
 			$message_type = $this->_message_resource_manager->get_message_type( $message_type_name );
3270 3270
 			if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
3271
-			     && $message_type instanceof EE_message_type
3271
+				 && $message_type instanceof EE_message_type
3272 3272
 			) {
3273 3273
 				$this->_template_args['data']['active_mts'][] = $message_type_name;
3274 3274
 				if ( $message_type->get_admin_settings_fields() ) {
@@ -3604,10 +3604,10 @@  discard block
 block discarded – undo
3604 3604
 
3605 3605
 	/**
3606 3606
 	 * This immediately generates any EE_Message ID's that are selected that are EEM_Message::status_incomplete
3607
-     * However, this does not send immediately, it just queues for sending.
3608
-     *
3609
-     * @since 4.9.0
3610
-     */
3607
+	 * However, this does not send immediately, it just queues for sending.
3608
+	 *
3609
+	 * @since 4.9.0
3610
+	 */
3611 3611
 	protected function _generate_now() {
3612 3612
 		$msg_ids = $this->_get_msg_ids_from_request();
3613 3613
 		EED_Messages::generate_now( $msg_ids );
@@ -3618,11 +3618,11 @@  discard block
 block discarded – undo
3618 3618
 
3619 3619
 	/**
3620 3620
 	 * This immediately generates AND sends any EE_Message's selected that are EEM_Message::status_incomplete or that are
3621
-     * EEM_Message::status_resend or EEM_Message::status_idle
3622
-     *
3623
-     * @since 4.9.0
3624
-     *
3625
-     */
3621
+	 * EEM_Message::status_resend or EEM_Message::status_idle
3622
+	 *
3623
+	 * @since 4.9.0
3624
+	 *
3625
+	 */
3626 3626
 	protected function _generate_and_send_now() {
3627 3627
 		$this->_generate_now();
3628 3628
 		$this->_send_now();
@@ -3635,9 +3635,9 @@  discard block
 block discarded – undo
3635 3635
 
3636 3636
 	/**
3637 3637
 	 * This queues any EEM_Message::status_sent EE_Message ids in the request for resending.
3638
-     *
3639
-     * @since 4.9.0
3640
-     */
3638
+	 *
3639
+	 * @since 4.9.0
3640
+	 */
3641 3641
 	protected function _queue_for_resending() {
3642 3642
 		$msg_ids = $this->_get_msg_ids_from_request();
3643 3643
 		EED_Messages::queue_for_resending( $msg_ids );
@@ -3649,9 +3649,9 @@  discard block
 block discarded – undo
3649 3649
 
3650 3650
 	/**
3651 3651
 	 *  This sends immediately any EEM_Message::status_idle or EEM_Message::status_resend messages in the queue
3652
-     *
3653
-     *  @since 4.9.0
3654
-     */
3652
+	 *
3653
+	 *  @since 4.9.0
3654
+	 */
3655 3655
 	protected function _send_now() {
3656 3656
 		$msg_ids = $this->_get_msg_ids_from_request();
3657 3657
 		EED_Messages::send_now( $msg_ids );
@@ -3663,9 +3663,9 @@  discard block
 block discarded – undo
3663 3663
 
3664 3664
 	/**
3665 3665
 	 * Deletes EE_messages for IDs in the request.
3666
-     *
3667
-     * @since 4.9.0
3668
-     */
3666
+	 *
3667
+	 * @since 4.9.0
3668
+	 */
3669 3669
 	protected function _delete_ee_messages() {
3670 3670
 		$msg_ids = $this->_get_msg_ids_from_request();
3671 3671
 		$deleted_count = 0;
@@ -3694,9 +3694,9 @@  discard block
 block discarded – undo
3694 3694
 
3695 3695
 	/**
3696 3696
 	 *  This looks for 'MSG_ID' key in the request and returns an array of MSG_ID's if present.
3697
-     *  @since 4.9.0
3698
-     *  @return array
3699
-     */
3697
+	 *  @since 4.9.0
3698
+	 *  @return array
3699
+	 */
3700 3700
 	protected function _get_msg_ids_from_request() {
3701 3701
 		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3702 3702
 			return array();
Please login to merge, or discard this patch.
Spacing   +655 added lines, -655 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION') )
2
-	{exit('NO direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2
+	{exit('NO direct script access allowed'); }
3 3
 
4 4
 /**
5 5
  *
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	/**
75 75
 	 * @param bool $routing
76 76
 	 */
77
-	public function __construct( $routing = true ) {
77
+	public function __construct($routing = true) {
78 78
 		//make sure messages autoloader is running
79 79
 		EED_Messages::set_autoloaders();
80
-		parent::__construct( $routing );
80
+		parent::__construct($routing);
81 81
 	}
82 82
 
83 83
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array();
93 93
 
94
-		$this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null;
94
+		$this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null;
95 95
 		$this->_load_message_resource_manager();
96 96
 	}
97 97
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @throws EE_Error
106 106
 	*/
107 107
 	protected function _load_message_resource_manager() {
108
-		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
108
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
109 109
 	}
110 110
 
111 111
 
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
 	public function get_messengers_for_list_table() {
117 117
 		EE_Error::doing_it_wrong(
118 118
 			__METHOD__,
119
-			__( 'This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
119
+			__('This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
120 120
 			values for use in creating a messenger filter dropdown which is now generated differently via
121
-			 Messages_Admin_Page::get_messengers_select_input', 'event_espresso' ),
121
+			 Messages_Admin_Page::get_messengers_select_input', 'event_espresso'),
122 122
 			'4.9.9.rc.014'
123 123
 		);
124 124
 
125 125
 		$m_values = array();
126
-		$active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) );
126
+		$active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
127 127
 		//setup messengers for selects
128 128
 		$i = 1;
129
-		foreach ( $active_messengers as $active_messenger ) {
130
-			if ( $active_messenger instanceof EE_Message ) {
131
-				$m_values[ $i ]['id']   = $active_messenger->messenger();
132
-				$m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() );
133
-				$i ++;
129
+		foreach ($active_messengers as $active_messenger) {
130
+			if ($active_messenger instanceof EE_Message) {
131
+				$m_values[$i]['id']   = $active_messenger->messenger();
132
+				$m_values[$i]['text'] = ucwords($active_messenger->messenger_label());
133
+				$i++;
134 134
 			}
135 135
 		}
136 136
 		return $m_values;
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
 	public function get_message_types_for_list_table() {
145 145
 		EE_Error::doing_it_wrong(
146 146
 			__METHOD__,
147
-			__( 'This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
147
+			__('This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
148 148
 			values for use in creating a message type filter dropdown which is now generated differently via
149
-			 Messages_Admin_Page::get_message_types_select_input', 'event_espresso' ),
149
+			 Messages_Admin_Page::get_message_types_select_input', 'event_espresso'),
150 150
 			'4.9.9.rc.014'
151 151
 		);
152 152
 
153 153
 		$mt_values = array();
154
-		$active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) );
154
+		$active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type'));
155 155
 		$i = 1;
156
-		foreach ( $active_messages as $active_message ) {
157
-			if ( $active_message instanceof EE_Message ) {
158
-				$mt_values[ $i ]['id']   = $active_message->message_type();
159
-				$mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() );
160
-				$i ++;
156
+		foreach ($active_messages as $active_message) {
157
+			if ($active_message instanceof EE_Message) {
158
+				$mt_values[$i]['id']   = $active_message->message_type();
159
+				$mt_values[$i]['text'] = ucwords($active_message->message_type_label());
160
+				$i++;
161 161
 			}
162 162
 		}
163 163
 		return $mt_values;
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 	public function get_contexts_for_message_types_for_list_table() {
172 172
 		EE_Error::doing_it_wrong(
173 173
 			__METHOD__,
174
-			__( 'This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
174
+			__('This method is no longer in use.  There is no replacement for it. The method was used to generate a set of
175 175
 			values for use in creating a message type context filter dropdown which is now generated differently via
176
-			 Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso' ),
176
+			 Messages_Admin_Page::get_contexts_for_message_types_select_input', 'event_espresso'),
177 177
 			'4.9.9.rc.014'
178 178
 		);
179 179
 
180 180
 		$contexts = array();
181
-		$active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) );
182
-		foreach ( $active_message_contexts as $active_message ) {
183
-			if ( $active_message instanceof EE_Message ) {
181
+		$active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
182
+		foreach ($active_message_contexts as $active_message) {
183
+			if ($active_message instanceof EE_Message) {
184 184
 				$message_type = $active_message->message_type_object();
185
-				if ( $message_type instanceof EE_message_type ) {
185
+				if ($message_type instanceof EE_message_type) {
186 186
 					$message_type_contexts = $message_type->get_contexts();
187
-					foreach ( $message_type_contexts as $context => $context_details ) {
188
-						$contexts[ $context ] = $context_details['label'];
187
+					foreach ($message_type_contexts as $context => $context_details) {
188
+						$contexts[$context] = $context_details['label'];
189 189
 					}
190 190
 				}
191 191
 			}
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return string
203 203
 	 */
204
-	public function get_messengers_select_input( $messenger_options ) {
204
+	public function get_messengers_select_input($messenger_options) {
205 205
 		//if empty or just one value then just return an empty string
206
-		if ( empty( $messenger_options )
207
-		     || ! is_array( $messenger_options )
208
-		     ||  count( $messenger_options ) === 1
206
+		if (empty($messenger_options)
207
+		     || ! is_array($messenger_options)
208
+		     ||  count($messenger_options) === 1
209 209
 		) {
210 210
 			return '';
211 211
 		}
212 212
 		//merge in default
213 213
 		$messenger_options = array_merge(
214
-			array( 'none_selected' => __( 'Show All Messengers', 'event_espresso' ) ),
214
+			array('none_selected' => __('Show All Messengers', 'event_espresso')),
215 215
 			$messenger_options
216 216
 		);
217 217
 		$input = new EE_Select_Input(
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 				'html_name'  => 'ee_messenger_filter_by',
221 221
 				'html_id'    => 'ee_messenger_filter_by',
222 222
 				'html_class' => 'wide',
223
-				'default'    => isset( $this->_req_data['ee_messenger_filter_by'] )
224
-					? sanitize_title( $this->_req_data['ee_messenger_filter_by'] )
223
+				'default'    => isset($this->_req_data['ee_messenger_filter_by'])
224
+					? sanitize_title($this->_req_data['ee_messenger_filter_by'])
225 225
 					: 'none_selected'
226 226
 			)
227 227
 		);
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return string
239 239
 	 */
240
-	public function get_message_types_select_input( $message_type_options ) {
240
+	public function get_message_types_select_input($message_type_options) {
241 241
 		//if empty or count of options is 1 then just return an empty string
242
-		if ( empty( $message_type_options )
243
-			|| ! is_array( $message_type_options )
244
-			|| count( $message_type_options ) === 1
242
+		if (empty($message_type_options)
243
+			|| ! is_array($message_type_options)
244
+			|| count($message_type_options) === 1
245 245
 		) {
246 246
 			return '';
247 247
 		}
248 248
 		//merge in default
249 249
 		$message_type_options = array_merge(
250
-			array( 'none_selected' => __( 'Show All Message Types', 'event_espresso' ) ),
250
+			array('none_selected' => __('Show All Message Types', 'event_espresso')),
251 251
 			$message_type_options
252 252
 		);
253 253
 		$input = new EE_Select_Input(
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 				'html_name'  => 'ee_message_type_filter_by',
257 257
 				'html_id'    => 'ee_message_type_filter_by',
258 258
 				'html_class' => 'wide',
259
-				'default'    => isset( $this->_req_data['ee_message_type_filter_by'] )
260
-					? sanitize_title( $this->_req_data['ee_message_type_filter_by'] )
259
+				'default'    => isset($this->_req_data['ee_message_type_filter_by'])
260
+					? sanitize_title($this->_req_data['ee_message_type_filter_by'])
261 261
 					: 'none_selected',
262 262
 			)
263 263
 		);
@@ -273,17 +273,17 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return string
275 275
 	 */
276
-	public function get_contexts_for_message_types_select_input( $context_options ) {
276
+	public function get_contexts_for_message_types_select_input($context_options) {
277 277
 		//if empty or count of options is one then just return empty string
278
-		if ( empty( $context_options )
279
-			|| ! is_array( $context_options )
280
-			|| count( $context_options ) === 1
278
+		if (empty($context_options)
279
+			|| ! is_array($context_options)
280
+			|| count($context_options) === 1
281 281
 		) {
282 282
 			return '';
283 283
 		}
284 284
 		//merge in default
285 285
 		$context_options = array_merge(
286
-			array( 'none_selected' => __( 'Show all Contexts', 'event_espresso' ) ),
286
+			array('none_selected' => __('Show all Contexts', 'event_espresso')),
287 287
 			$context_options
288 288
 		);
289 289
 		$input = new EE_Select_Input(
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 				'html_name'  => 'ee_context_filter_by',
293 293
 				'html_id'    => 'ee_context_filter_by',
294 294
 				'html_class' => 'wide',
295
-				'default'    => isset( $this->_req_data['ee_context_filter_by'] )
296
-					? sanitize_title( $this->_req_data['ee_context_filter_by'] )
295
+				'default'    => isset($this->_req_data['ee_context_filter_by'])
296
+					? sanitize_title($this->_req_data['ee_context_filter_by'])
297 297
 					: 'none_selected',
298 298
 			)
299 299
 		);
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 
304 304
 
305 305
 	protected function _ajax_hooks() {
306
-		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) );
307
-		add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') );
308
-		add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') );
309
-		add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) );
310
-		add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) );
306
+		add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle'));
307
+		add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle'));
308
+		add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings'));
309
+		add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form'));
310
+		add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack'));
311 311
 	}
312 312
 
313 313
 
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 	*		@return void
340 340
 	*/
341 341
 	protected function _set_page_routes() {
342
-		$grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] )
342
+		$grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID'])
343 343
 			? $this->_req_data['GRP_ID']
344 344
 			: 0;
345
-		$grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] )
345
+		$grp_id = empty($grp_id) && ! empty($this->_req_data['id'])
346 346
 			? $this->_req_data['id']
347 347
 			: $grp_id;
348
-		$msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] )
348
+		$msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID'])
349 349
 			? $this->_req_data['MSG_ID']
350 350
 			: 0;
351 351
 
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
 			'insert_message_template' => array(
388 388
 				'func' => '_insert_or_update_message_template',
389 389
 				'capability' => 'ee_edit_messages',
390
-				'args' => array( 'new_template' => true ),
390
+				'args' => array('new_template' => true),
391 391
 				'noheader' => true
392 392
 			 ),
393 393
 			'update_message_template' => array(
394 394
 				'func' => '_insert_or_update_message_template',
395 395
 				'capability' => 'ee_edit_message',
396 396
 				'obj_id' => $grp_id,
397
-				'args' => array( 'new_template' => false ),
397
+				'args' => array('new_template' => false),
398 398
 				'noheader' => true
399 399
 			),
400 400
 			'trash_message_template' => array(
401 401
 				'func' => '_trash_or_restore_message_template',
402 402
 				'capability' => 'ee_delete_message',
403 403
 				'obj_id' => $grp_id,
404
-				'args' => array( 'trash' => true, 'all' => true ),
404
+				'args' => array('trash' => true, 'all' => true),
405 405
 				'noheader' => true
406 406
 			),
407 407
 			'trash_message_template_context' => array(
408 408
 				'func' => '_trash_or_restore_message_template',
409 409
 				'capability' => 'ee_delete_message',
410 410
 				'obj_id' => $grp_id,
411
-				'args' => array( 'trash' => true ),
411
+				'args' => array('trash' => true),
412 412
 				'noheader' => true
413 413
 			),
414 414
 			'restore_message_template' => array(
415 415
 				'func' => '_trash_or_restore_message_template',
416 416
 				'capability' => 'ee_delete_message',
417 417
 				'obj_id' => $grp_id,
418
-				'args' => array( 'trash' => false, 'all' => true ),
418
+				'args' => array('trash' => false, 'all' => true),
419 419
 				'noheader' => true
420 420
 			),
421 421
 			'restore_message_template_context' => array(
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 						'filename' => 'messages_overview_other',
535 535
 					),
536 536
 				),
537
-				'help_tour' => array( 'Messages_Overview_Help_Tour' ),
537
+				'help_tour' => array('Messages_Overview_Help_Tour'),
538 538
 				'require_nonce' => false
539 539
 			),
540 540
 			'custom_mtps' => array(
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 				),
570 570
 				'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'),
571 571
 				'has_metaboxes' => true,
572
-				'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ),
572
+				'help_tour' => array('Message_Templates_Edit_Help_Tour'),
573 573
 				'help_tabs' => array(
574 574
 					'edit_message_template' => array(
575 575
 						'title' => __('Message Template Editor', 'event_espresso'),
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 						'filename' => 'messages_settings_messengers'
626 626
 					),
627 627
 				),
628
-				'help_tour' => array( 'Messages_Settings_Help_Tour' ),
628
+				'help_tour' => array('Messages_Settings_Help_Tour'),
629 629
 				'require_nonce' => false
630 630
 			)
631 631
 		);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
 
660 660
 	protected function _add_screen_options_default() {
661
-		$this->_admin_page_title = __( 'Message Activity', 'event_espresso' );
661
+		$this->_admin_page_title = __('Message Activity', 'event_espresso');
662 662
 		$this->_per_page_screen_option();
663 663
 	}
664 664
 
@@ -680,37 +680,37 @@  discard block
 block discarded – undo
680 680
 
681 681
 
682 682
 	public function messages_help_tab() {
683
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' );
683
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php');
684 684
 	}
685 685
 
686 686
 
687 687
 	public function messengers_help_tab() {
688
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' );
688
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php');
689 689
 	}
690 690
 
691 691
 
692 692
 	public function message_types_help_tab() {
693
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' );
693
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php');
694 694
 	}
695 695
 
696 696
 
697 697
 	public function messages_overview_help_tab() {
698
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' );
698
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php');
699 699
 	}
700 700
 
701 701
 
702 702
 	public function message_templates_help_tab() {
703
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' );
703
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php');
704 704
 	}
705 705
 
706 706
 
707 707
 	public function edit_message_template_help_tab() {
708
-		$args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />';
709
-		$args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />';
710
-		$args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />';
711
-		$args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />';
712
-		$args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />';
713
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args);
708
+		$args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />';
709
+		$args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />';
710
+		$args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />';
711
+		$args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />';
712
+		$args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />';
713
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args);
714 714
 	}
715 715
 
716 716
 
@@ -718,22 +718,22 @@  discard block
 block discarded – undo
718 718
 	public function message_template_shortcodes_help_tab() {
719 719
 		$this->_set_shortcodes();
720 720
 		$args['shortcodes'] = $this->_shortcodes;
721
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args );
721
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args);
722 722
 	}
723 723
 
724 724
 
725 725
 
726 726
 	public function preview_message_help_tab() {
727
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' );
727
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php');
728 728
 	}
729 729
 
730 730
 
731 731
 	public function settings_help_tab() {
732
-		$args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />';
733
-		$args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />';
732
+		$args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />';
733
+		$args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />';
734 734
 		$args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>';
735 735
 		$args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>';
736
-		EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args);
736
+		EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args);
737 737
 	}
738 738
 
739 739
 
@@ -741,31 +741,31 @@  discard block
 block discarded – undo
741 741
 
742 742
 
743 743
 	public function load_scripts_styles() {
744
-		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION );
744
+		wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION);
745 745
 		wp_enqueue_style('espresso_ee_msg');
746 746
 
747
-		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true );
748
-		wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION );
747
+		wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true);
748
+		wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION);
749 749
 	}
750 750
 
751 751
 
752 752
 
753 753
 	public function load_scripts_styles_default() {
754
-		wp_enqueue_script( 'ee-msg-list-table-js' );
754
+		wp_enqueue_script('ee-msg-list-table-js');
755 755
 	}
756 756
 
757 757
 
758 758
 
759 759
 
760 760
 
761
-	public function wp_editor_css( $mce_css ) {
761
+	public function wp_editor_css($mce_css) {
762 762
 		//if we're on the edit_message_template route
763
-		if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger  ) {
763
+		if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) {
764 764
 			$message_type_name = $this->_active_message_type_name;
765 765
 
766 766
 			//we're going to REPLACE the existing mce css
767 767
 			//we need to get the css file location from the active messenger
768
-			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation );
768
+			$mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation);
769 769
 		}
770 770
 
771 771
 		return $mce_css;
@@ -783,15 +783,15 @@  discard block
 block discarded – undo
783 783
 			$this->_message_template_group->messenger_obj()->label['singular'],
784 784
 			$this->_message_template_group->message_type_obj()->label['singular']
785 785
 		);
786
-		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' );
786
+		EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded.  Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso');
787 787
 
788
-		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION );
788
+		wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION);
789 789
 
790 790
 		wp_enqueue_script('ee_admin_js');
791 791
 		wp_enqueue_script('ee_msgs_edit_js');
792 792
 
793 793
 		//add in special css for tiny_mce
794
-		add_filter( 'mce_css', array( $this, 'wp_editor_css' ) );
794
+		add_filter('mce_css', array($this, 'wp_editor_css'));
795 795
 	}
796 796
 
797 797
 
@@ -800,22 +800,22 @@  discard block
 block discarded – undo
800 800
 
801 801
 		$this->_set_message_template_group();
802 802
 
803
-		if ( isset( $this->_req_data['messenger'] ) ) {
804
-			$this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
803
+		if (isset($this->_req_data['messenger'])) {
804
+			$this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
805 805
 		}
806 806
 
807
-		$message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : '';
807
+		$message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : '';
808 808
 
809 809
 
810
-		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) );
810
+		wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation));
811 811
 	}
812 812
 
813 813
 
814 814
 
815 815
 	public function load_scripts_styles_settings() {
816
-		wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION );
817
-		wp_enqueue_style( 'ee-text-links' );
818
-		wp_enqueue_style( 'ee-message-settings' );
816
+		wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION);
817
+		wp_enqueue_style('ee-text-links');
818
+		wp_enqueue_style('ee-message-settings');
819 819
 
820 820
 		wp_enqueue_script('ee-messages-settings');
821 821
 	}
@@ -845,40 +845,40 @@  discard block
 block discarded – undo
845 845
 	 * set views array for message queue list table
846 846
 	 */
847 847
 	public function _set_list_table_views_default() {
848
-		EE_Registry::instance()->load_helper( 'Template' );
848
+		EE_Registry::instance()->load_helper('Template');
849 849
 
850
-		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' )
850
+		$common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions')
851 851
 			? array(
852
-				'generate_now' => __( 'Generate Now', 'event_espresso' ),
853
-		        'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ),
854
-		        'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ),
855
-		        'send_now' => __( 'Send Now', 'event_espresso' )
852
+				'generate_now' => __('Generate Now', 'event_espresso'),
853
+		        'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'),
854
+		        'queue_for_resending' => __('Queue for Resending', 'event_espresso'),
855
+		        'send_now' => __('Send Now', 'event_espresso')
856 856
 				)
857 857
 			: array();
858 858
 
859
-		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' )
860
-			? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) )
859
+		$delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions')
860
+			? array('delete_ee_messages' => __('Delete Messages', 'event_espresso'))
861 861
 			: array();
862 862
 
863 863
 
864 864
 		$this->_views = array(
865 865
 			 'all' => array(
866 866
 			    'slug' => 'all',
867
-			    'label' => __( 'All', 'event_espresso' ),
867
+			    'label' => __('All', 'event_espresso'),
868 868
 			    'count' => 0,
869
-			    'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action )
869
+			    'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action)
870 870
 			 )
871 871
 		);
872 872
 
873 873
 
874
-		foreach ( EEM_Message::instance()->all_statuses() as $status ) {
875
-			if ( $status === EEM_Message::status_debug_only && ! EEM_Message::debug() ) {
874
+		foreach (EEM_Message::instance()->all_statuses() as $status) {
875
+			if ($status === EEM_Message::status_debug_only && ! EEM_Message::debug()) {
876 876
 				continue;
877 877
 			}
878 878
 			$status_bulk_actions = $common_bulk_actions;
879 879
 			//unset bulk actions not applying to status
880
-			if ( ! empty( $status_bulk_actions ) ) {
881
-				switch ( $status ) {
880
+			if ( ! empty($status_bulk_actions)) {
881
+				switch ($status) {
882 882
 					case EEM_Message::status_idle :
883 883
 					case EEM_Message::status_resend :
884 884
 						$status_bulk_actions['send_now'] = $common_bulk_actions['send_now'];
@@ -890,21 +890,21 @@  discard block
 block discarded – undo
890 890
 						break;
891 891
 
892 892
 					case EEM_Message::status_incomplete :
893
-						unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] );
893
+						unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']);
894 894
 						break;
895 895
 
896 896
 					case EEM_Message::status_retry :
897 897
 					case EEM_Message::status_sent :
898
-						unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] );
898
+						unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']);
899 899
 						break;
900 900
 				}
901 901
 			}
902 902
 
903
-			$this->_views[ strtolower( $status ) ] = array(
904
-				'slug' => strtolower( $status ),
905
-				'label' => EEH_Template::pretty_status( $status, false, 'sentence' ),
903
+			$this->_views[strtolower($status)] = array(
904
+				'slug' => strtolower($status),
905
+				'label' => EEH_Template::pretty_status($status, false, 'sentence'),
906 906
 				'count' => 0,
907
-				'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action )
907
+				'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action)
908 908
 			);
909 909
 		}
910 910
 	}
@@ -923,8 +923,8 @@  discard block
 block discarded – undo
923 923
 	protected function _message_queue_list_table() {
924 924
 		$this->_search_btn_label = __('Message Activity', 'event_espresso');
925 925
 		$this->_template_args['per_column'] = 6;
926
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() );
927
-		$this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>';
926
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items());
927
+		$this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>';
928 928
 		$this->display_admin_list_table_page_with_no_sidebar();
929 929
 	}
930 930
 
@@ -937,8 +937,8 @@  discard block
 block discarded – undo
937 937
 		$action_css_classes = EEH_MSG_Template::get_message_action_icons();
938 938
 		$action_items = array();
939 939
 
940
-		foreach( $action_css_classes as $action_item => $action_details ) {
941
-			if ( $action_item === 'see_notifications_for' ) {
940
+		foreach ($action_css_classes as $action_item => $action_details) {
941
+			if ($action_item === 'see_notifications_for') {
942 942
 				continue;
943 943
 			}
944 944
 			$action_items[$action_item] = array(
@@ -950,37 +950,37 @@  discard block
 block discarded – undo
950 950
 		/** @type array $status_items status legend setup*/
951 951
 		$status_items = array(
952 952
 			'sent_status' => array(
953
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent,
954
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' )
953
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent,
954
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence')
955 955
 				),
956 956
 			'idle_status' => array(
957
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle,
958
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' )
957
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle,
958
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence')
959 959
 				),
960 960
 			'failed_status' => array(
961
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed,
962
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' )
961
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed,
962
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence')
963 963
 			),
964 964
 			'resend_status' => array(
965
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend,
966
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' )
965
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend,
966
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence')
967 967
 				),
968 968
 			'incomplete_status' => array(
969
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete,
970
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' )
969
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete,
970
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence')
971 971
 				),
972 972
 			'retry_status' => array(
973
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry,
974
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' )
973
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry,
974
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence')
975 975
 				)
976 976
 		);
977
-		if ( EEM_Message::debug() ) {
977
+		if (EEM_Message::debug()) {
978 978
 			$status_items['debug_only_status'] = array(
979
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only,
980
-				'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' )
979
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only,
980
+				'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence')
981 981
 			);
982 982
 		}
983
-		return array_merge( $action_items, $status_items );
983
+		return array_merge($action_items, $status_items);
984 984
 	}
985 985
 
986 986
 
@@ -990,9 +990,9 @@  discard block
 block discarded – undo
990 990
 
991 991
 	protected function _custom_mtps_preview() {
992 992
 		$this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso');
993
-		$this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />';
993
+		$this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />';
994 994
 		$this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso.  With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>';
995
-		$this->display_admin_caf_preview_page( 'custom_message_types', false );
995
+		$this->display_admin_caf_preview_page('custom_message_types', false);
996 996
 	}
997 997
 
998 998
 
@@ -1016,31 +1016,31 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @return array
1018 1018
 	 */
1019
-	public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) {
1019
+	public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) {
1020 1020
 
1021 1021
 		$MTP = EEM_Message_Template_Group::instance();
1022 1022
 
1023 1023
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby'];
1024 1024
 		$orderby = $this->_req_data['orderby'];
1025 1025
 
1026
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC';
1026
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1027 1027
 
1028
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1029
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage;
1028
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1029
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage;
1030 1030
 
1031
-		$offset = ($current_page-1)*$per_page;
1032
-		$limit = $all ? null : array( $offset, $per_page );
1031
+		$offset = ($current_page - 1) * $per_page;
1032
+		$limit = $all ? null : array($offset, $per_page);
1033 1033
 
1034 1034
 
1035 1035
 		//options will match what is in the _views array property
1036
-		switch( $type ) {
1036
+		switch ($type) {
1037 1037
 
1038 1038
 			case 'in_use':
1039
-				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true );
1039
+				$templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true);
1040 1040
 				break;
1041 1041
 
1042 1042
 			default:
1043
-				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global );
1043
+				$templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global);
1044 1044
 
1045 1045
 		}
1046 1046
 
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 		$installed_message_types = $this->_message_resource_manager->installed_message_types();
1060 1060
 		$installed = array();
1061 1061
 
1062
-		foreach ( $installed_message_types as $message_type ) {
1063
-			$installed[ $message_type->name ] = $message_type;
1062
+		foreach ($installed_message_types as $message_type) {
1063
+			$installed[$message_type->name] = $message_type;
1064 1064
 		}
1065 1065
 
1066 1066
 		return $installed;
@@ -1079,24 +1079,24 @@  discard block
 block discarded – undo
1079 1079
 	 *
1080 1080
 	 * @throws EE_error
1081 1081
 	 */
1082
-	protected function _add_message_template(  $message_type = '', $messenger='', $GRP_ID = '' ) {
1082
+	protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') {
1083 1083
 		//set values override any request data
1084
-		$message_type = !empty( $message_type ) ? $message_type : '';
1085
-		$message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type;
1084
+		$message_type = ! empty($message_type) ? $message_type : '';
1085
+		$message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type;
1086 1086
 
1087
-		$messenger = !empty( $messenger ) ? $messenger : '';
1088
-		$messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger;
1087
+		$messenger = ! empty($messenger) ? $messenger : '';
1088
+		$messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger;
1089 1089
 
1090
-		$GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : '';
1091
-		$GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID;
1090
+		$GRP_ID = ! empty($GRP_ID) ? $GRP_ID : '';
1091
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID;
1092 1092
 
1093 1093
 		//we need messenger and message type.  They should be coming from the event editor. If not here then return error
1094
-		if ( empty( $message_type ) || empty( $messenger )  )
1095
-			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));}
1094
+		if (empty($message_type) || empty($messenger))
1095
+			{throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); }
1096 1096
 
1097 1097
 		//we need the GRP_ID for the template being used as the base for the new template
1098
-		if ( empty( $GRP_ID ) )
1099
-			{throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );}
1098
+		if (empty($GRP_ID))
1099
+			{throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); }
1100 1100
 
1101 1101
 		//let's just make sure the template gets generated!
1102 1102
 
@@ -1117,8 +1117,8 @@  discard block
 block discarded – undo
1117 1117
 	 * @param int      $GRP_ID         GRP_ID for the related message template group this new template will be based
1118 1118
 	 *                                 off of.
1119 1119
 	 */
1120
-	public function add_message_template( $message_type, $messenger, $GRP_ID ) {
1121
-		$this->_add_message_template( $message_type, $messenger, $GRP_ID );
1120
+	public function add_message_template($message_type, $messenger, $GRP_ID) {
1121
+		$this->_add_message_template($message_type, $messenger, $GRP_ID);
1122 1122
 	}
1123 1123
 
1124 1124
 
@@ -1129,14 +1129,14 @@  discard block
 block discarded – undo
1129 1129
 	 * @return void
1130 1130
 	 */
1131 1131
 	protected function _edit_message_template() {
1132
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '');
1132
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1133 1133
 		$template_fields = '';
1134 1134
 		$sidebar_fields = '';
1135 1135
 		//we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates.
1136
-		add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 );
1136
+		add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2);
1137 1137
 
1138
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] )
1139
-			? absint( $this->_req_data['id'] )
1138
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id'])
1139
+			? absint($this->_req_data['id'])
1140 1140
 			: false;
1141 1141
 
1142 1142
 		$this->_set_shortcodes(); //this also sets the _message_template property.
@@ -1144,20 +1144,20 @@  discard block
 block discarded – undo
1144 1144
 		$c_label = $message_template_group->context_label();
1145 1145
 		$c_config = $message_template_group->contexts_config();
1146 1146
 
1147
-		reset( $c_config );
1148
-		$context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] )
1147
+		reset($c_config);
1148
+		$context = isset($this->_req_data['context']) && ! empty($this->_req_data['context'])
1149 1149
 			? strtolower($this->_req_data['context'])
1150 1150
 			: key($c_config);
1151 1151
 
1152 1152
 
1153
-		if ( empty($GRP_ID) ) {
1153
+		if (empty($GRP_ID)) {
1154 1154
 			$action = 'insert_message_template';
1155 1155
 			//$button_both = false;
1156 1156
 			//$button_text = array( __( 'Save','event_espresso') );
1157 1157
 			//$button_actions = array('something_different');
1158 1158
 			//$referrer = false;
1159 1159
 			$edit_message_template_form_url = add_query_arg(
1160
-				array( 'action' => $action, 'noheader' => true ),
1160
+				array('action' => $action, 'noheader' => true),
1161 1161
 				EE_MSG_ADMIN_URL
1162 1162
 			);
1163 1163
 		} else {
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 			//$button_actions = array();
1168 1168
 			//$referrer = $this->_admin_base_url;
1169 1169
 			$edit_message_template_form_url = add_query_arg(
1170
-				array( 'action' => $action, 'noheader' => true ),
1170
+				array('action' => $action, 'noheader' => true),
1171 1171
 				EE_MSG_ADMIN_URL
1172 1172
 			);
1173 1173
 		}
@@ -1181,14 +1181,14 @@  discard block
 block discarded – undo
1181 1181
 
1182 1182
 		//Do we have any validation errors?
1183 1183
 		$validators = $this->_get_transient();
1184
-		$v_fields = !empty($validators) ? array_keys($validators) : array();
1184
+		$v_fields = ! empty($validators) ? array_keys($validators) : array();
1185 1185
 
1186 1186
 
1187 1187
 		//we need to assemble the title from Various details
1188 1188
 		$context_label = sprintf(
1189 1189
 			__('(%s %s)', 'event_espresso'),
1190 1190
 			$c_config[$context]['label'],
1191
-			ucwords($c_label['label'] )
1191
+			ucwords($c_label['label'])
1192 1192
 		);
1193 1193
 
1194 1194
 		$title = sprintf(
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 			$message_template_group->message_type()
1210 1210
 		);
1211 1211
 
1212
-		if ( !$template_field_structure ) {
1212
+		if ( ! $template_field_structure) {
1213 1213
 			$template_field_structure = false;
1214 1214
 			$template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso');
1215 1215
 		}
@@ -1219,51 +1219,51 @@  discard block
 block discarded – undo
1219 1219
 
1220 1220
 
1221 1221
 		//if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array.
1222
-		if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) {
1223
-			foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) {
1224
-				unset( $template_field_structure[$context][$reference_field] );
1222
+		if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) {
1223
+			foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) {
1224
+				unset($template_field_structure[$context][$reference_field]);
1225 1225
 			}
1226 1226
 		}
1227 1227
 
1228 1228
 		//let's loop through the template_field_structure and actually assemble the input fields!
1229
-		if ( !empty($template_field_structure) ) {
1230
-			foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) {
1229
+		if ( ! empty($template_field_structure)) {
1230
+			foreach ($template_field_structure[$context] as $template_field => $field_setup_array) {
1231 1231
 				//if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them.
1232
-				if ( $template_field == 'extra' ) {
1232
+				if ($template_field == 'extra') {
1233 1233
 					$this->_template_args['is_extra_fields'] = true;
1234
-					foreach ( $field_setup_array as $reference_field => $new_fields_array ) {
1235
-						$message_template = $message_templates[ $context ][ $reference_field ];
1234
+					foreach ($field_setup_array as $reference_field => $new_fields_array) {
1235
+						$message_template = $message_templates[$context][$reference_field];
1236 1236
 						$content = $message_template instanceof EE_Message_Template
1237
-							? $message_template->get( 'MTP_content' )
1237
+							? $message_template->get('MTP_content')
1238 1238
 							: '';
1239
-						foreach ( $new_fields_array as $extra_field =>  $extra_array ) {
1239
+						foreach ($new_fields_array as $extra_field =>  $extra_array) {
1240 1240
 							//let's verify if we need this extra field via the shortcodes parameter.
1241 1241
 							$continue = false;
1242
-							if ( isset( $extra_array['shortcodes_required'] ) ) {
1243
-								foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) {
1244
-									if ( !array_key_exists( $shortcode, $this->_shortcodes ) )
1245
-										{$continue = true;}
1242
+							if (isset($extra_array['shortcodes_required'])) {
1243
+								foreach ((array) $extra_array['shortcodes_required'] as $shortcode) {
1244
+									if ( ! array_key_exists($shortcode, $this->_shortcodes))
1245
+										{$continue = true; }
1246 1246
 								}
1247
-								if ( $continue ) {continue;}
1247
+								if ($continue) {continue; }
1248 1248
 							}
1249 1249
 
1250
-							$field_id = $reference_field . '-' . $extra_field . '-content';
1250
+							$field_id = $reference_field.'-'.$extra_field.'-content';
1251 1251
 							$template_form_fields[$field_id] = $extra_array;
1252
-							$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']';
1253
-							$css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : '';
1252
+							$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']';
1253
+							$css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : '';
1254 1254
 
1255
-							$template_form_fields[$field_id]['css_class'] = ! empty( $v_fields )
1255
+							$template_form_fields[$field_id]['css_class'] = ! empty($v_fields)
1256 1256
 																			&& in_array($extra_field, $v_fields)
1257 1257
 																			&&
1258 1258
 																			(
1259
-								                                                is_array($validators[$extra_field] )
1260
-																				&& isset( $validators[$extra_field]['msg'] )
1259
+								                                                is_array($validators[$extra_field])
1260
+																				&& isset($validators[$extra_field]['msg'])
1261 1261
 							                                                )
1262
-								? 'validate-error ' . $css_class
1262
+								? 'validate-error '.$css_class
1263 1263
 								: $css_class;
1264 1264
 
1265
-							$template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field])
1266
-								? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") )
1265
+							$template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field])
1266
+								? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8"))
1267 1267
 								: '';
1268 1268
 
1269 1269
 							//do we have a validation error?  if we do then let's use that value instead
@@ -1279,32 +1279,32 @@  discard block
 block discarded – undo
1279 1279
 								$field_id
1280 1280
 							);
1281 1281
 
1282
-							if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) {
1282
+							if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') {
1283 1283
 								//we want to decode the entities
1284 1284
 								$template_form_fields[$field_id]['value'] = stripslashes(
1285
-									html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")
1285
+									html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8")
1286 1286
 								);
1287 1287
 
1288 1288
 							}/**/
1289 1289
 						}
1290
-						$templatefield_MTP_id = $reference_field . '-MTP_ID';
1291
-						$templatefield_templatename_id = $reference_field . '-name';
1290
+						$templatefield_MTP_id = $reference_field.'-MTP_ID';
1291
+						$templatefield_templatename_id = $reference_field.'-name';
1292 1292
 
1293 1293
 						$template_form_fields[$templatefield_MTP_id] = array(
1294
-							'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]',
1294
+							'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]',
1295 1295
 							'label' => null,
1296 1296
 							'input' => 'hidden',
1297 1297
 							'type' => 'int',
1298 1298
 							'required' => false,
1299 1299
 							'validation' => false,
1300
-							'value' => !empty($message_templates) ? $message_template->ID() : '',
1300
+							'value' => ! empty($message_templates) ? $message_template->ID() : '',
1301 1301
 							'css_class' => '',
1302 1302
 							'format' => '%d',
1303 1303
 							'db-col' => 'MTP_ID'
1304 1304
 						);
1305 1305
 
1306 1306
 						$template_form_fields[$templatefield_templatename_id] = array(
1307
-							'name' => 'MTP_template_fields[' . $reference_field . '][name]',
1307
+							'name' => 'MTP_template_fields['.$reference_field.'][name]',
1308 1308
 							'label' => null,
1309 1309
 							'input' => 'hidden',
1310 1310
 							'type' => 'string',
@@ -1318,14 +1318,14 @@  discard block
 block discarded – undo
1318 1318
 					}
1319 1319
 					continue; //skip the next stuff, we got the necessary fields here for this dataset.
1320 1320
 				} else {
1321
-					$field_id = $template_field . '-content';
1321
+					$field_id = $template_field.'-content';
1322 1322
 					$template_form_fields[$field_id] = $field_setup_array;
1323
-					$template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]';
1324
-					$message_template = isset( $message_templates[ $context ][ $template_field ] )
1325
-						? $message_templates[ $context ][ $template_field ]
1323
+					$template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]';
1324
+					$message_template = isset($message_templates[$context][$template_field])
1325
+						? $message_templates[$context][$template_field]
1326 1326
 						: null;
1327
-					$template_form_fields[$field_id]['value'] = ! empty( $message_templates )
1328
-																&& is_array( $message_templates[$context] )
1327
+					$template_form_fields[$field_id]['value'] = ! empty($message_templates)
1328
+																&& is_array($message_templates[$context])
1329 1329
 																&& $message_template instanceof EE_Message_Template
1330 1330
 						? $message_template->get('MTP_content')
1331 1331
 						: '';
@@ -1338,10 +1338,10 @@  discard block
 block discarded – undo
1338 1338
 
1339 1339
 					$template_form_fields[$field_id]['db-col'] = 'MTP_content';
1340 1340
 					$css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : '';
1341
-					$template_form_fields[$field_id]['css_class'] =  ! empty( $v_fields )
1342
-																	 && in_array( $template_field, $v_fields )
1343
-																	 && isset( $validators[$template_field]['msg'] )
1344
-						? 'validate-error ' . $css_class
1341
+					$template_form_fields[$field_id]['css_class'] = ! empty($v_fields)
1342
+																	 && in_array($template_field, $v_fields)
1343
+																	 && isset($validators[$template_field]['msg'])
1344
+						? 'validate-error '.$css_class
1345 1345
 						: $css_class;
1346 1346
 
1347 1347
 					//shortcode selector
@@ -1352,12 +1352,12 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
 				//k took care of content field(s) now let's take care of others.
1354 1354
 
1355
-				$templatefield_MTP_id = $template_field . '-MTP_ID';
1356
-				$templatefield_field_templatename_id = $template_field . '-name';
1355
+				$templatefield_MTP_id = $template_field.'-MTP_ID';
1356
+				$templatefield_field_templatename_id = $template_field.'-name';
1357 1357
 
1358 1358
 				//foreach template field there are actually two form fields created
1359 1359
 				$template_form_fields[$templatefield_MTP_id] = array(
1360
-					'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]',
1360
+					'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]',
1361 1361
 					'label' => null,
1362 1362
 					'input' => 'hidden',
1363 1363
 					'type' => 'int',
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 				);
1371 1371
 
1372 1372
 				$template_form_fields[$templatefield_field_templatename_id] = array(
1373
-					'name' => 'MTP_template_fields[' . $template_field . '][name]',
1373
+					'name' => 'MTP_template_fields['.$template_field.'][name]',
1374 1374
 					'label' => null,
1375 1375
 					'input' => 'hidden',
1376 1376
 					'type' => 'string',
@@ -1514,13 +1514,13 @@  discard block
 block discarded – undo
1514 1514
 				'value' => $GRP_ID
1515 1515
 				);
1516 1516
 			$sidebar_form_fields['ee-msg-evt-nonce'] = array(
1517
-				'name' => $action . '_nonce',
1517
+				'name' => $action.'_nonce',
1518 1518
 				'input' => 'hidden',
1519 1519
 				'type' => 'string',
1520
-				'value' => wp_create_nonce( $action . '_nonce')
1520
+				'value' => wp_create_nonce($action.'_nonce')
1521 1521
 				);
1522 1522
 
1523
-			if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) {
1523
+			if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) {
1524 1524
 				$sidebar_form_fields['ee-msg-template-switch'] = array(
1525 1525
 					'name' => 'template_switch',
1526 1526
 					'input' => 'hidden',
@@ -1530,8 +1530,8 @@  discard block
 block discarded – undo
1530 1530
 			}
1531 1531
 
1532 1532
 
1533
-			$template_fields = $this->_generate_admin_form_fields( $template_form_fields );
1534
-			$sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields );
1533
+			$template_fields = $this->_generate_admin_form_fields($template_form_fields);
1534
+			$sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields);
1535 1535
 
1536 1536
 
1537 1537
 		} //end if ( !empty($template_field_structure) )
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 			 $GRP_ID,
1544 1544
 			 false,
1545 1545
 			 add_query_arg(
1546
-			    array( 'action' => 'global_mtps' ),
1546
+			    array('action' => 'global_mtps'),
1547 1547
 			    $this->_admin_base_url
1548 1548
 			 )
1549 1549
 		);
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 			),
1560 1560
 			$this->_admin_base_url
1561 1561
 		);
1562
-		$preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>';
1562
+		$preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>';
1563 1563
 
1564 1564
 
1565 1565
 		//setup context switcher
@@ -1587,17 +1587,17 @@  discard block
 block discarded – undo
1587 1587
 		$this->_template_args['after_admin_page_content'] = $this->_add_form_element_after();
1588 1588
 
1589 1589
 		$this->_template_path = $this->_template_args['GRP_ID']
1590
-			? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php'
1591
-			: EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php';
1590
+			? EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_edit_meta_box.template.php'
1591
+			: EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php';
1592 1592
 
1593 1593
 		//send along EE_Message_Template_Group object for further template use.
1594 1594
 		$this->_template_args['MTP'] = $message_template_group;
1595 1595
 
1596
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true );
1596
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true);
1597 1597
 
1598 1598
 
1599 1599
 		//finally, let's set the admin_page title
1600
-		$this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title );
1600
+		$this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title);
1601 1601
 
1602 1602
 
1603 1603
 		//we need to take care of setting the shortcodes property for use elsewhere.
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 	}
1611 1611
 
1612 1612
 
1613
-	public function filter_tinymce_init( $mceInit, $editor_id ) {
1613
+	public function filter_tinymce_init($mceInit, $editor_id) {
1614 1614
 		return $mceInit;
1615 1615
 	}
1616 1616
 
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	}
1622 1622
 
1623 1623
 	public function _add_form_element_before() {
1624
-		return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">';
1624
+		return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">';
1625 1625
 	}
1626 1626
 
1627 1627
 	public function _add_form_element_after() {
@@ -1638,25 +1638,25 @@  discard block
 block discarded – undo
1638 1638
 	 *
1639 1639
 	 */
1640 1640
 	public function switch_template_pack() {
1641
-		$GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1642
-		$template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : '';
1641
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1642
+		$template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : '';
1643 1643
 
1644 1644
 		//verify we have needed values.
1645
-		if ( empty( $GRP_ID ) || empty( $template_pack ) ) {
1645
+		if (empty($GRP_ID) || empty($template_pack)) {
1646 1646
 			$this->_template_args['error'] = true;
1647
-			EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__  );
1647
+			EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1648 1648
 		} else {
1649 1649
 			//get template, set the new template_pack and then reset to default
1650 1650
 			/** @type EE_Message_Template_Group $message_template_group */
1651
-			$message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
1651
+			$message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
1652 1652
 
1653
-			$message_template_group->set_template_pack_name( $template_pack );
1653
+			$message_template_group->set_template_pack_name($template_pack);
1654 1654
 			$this->_req_data['msgr'] = $message_template_group->messenger();
1655 1655
 			$this->_req_data['mt'] = $message_template_group->message_type();
1656 1656
 
1657 1657
 			$query_args = $this->_reset_to_default_template();
1658 1658
 
1659
-			if ( empty( $query_args['id'] ) ) {
1659
+			if (empty($query_args['id'])) {
1660 1660
 				EE_Error::add_error(
1661 1661
 					__(
1662 1662
 						'Something went wrong with switching the template pack. Please try again or contact EE support',
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 				);
1667 1667
 				$this->_template_args['error'] = true;
1668 1668
 			} else {
1669
-				$template_label =$message_template_group->get_template_pack()->label;
1669
+				$template_label = $message_template_group->get_template_pack()->label;
1670 1670
 				$template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels();
1671 1671
 				EE_Error::add_success(
1672 1672
 					sprintf(
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 					)
1680 1680
 				);
1681 1681
 				//generate the redirect url for js.
1682
-				$url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1682
+				$url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1683 1683
 				$this->_template_args['data']['redirect_url'] = $url;
1684 1684
 				$this->_template_args['success'] = true;
1685 1685
 			}
@@ -1701,9 +1701,9 @@  discard block
 block discarded – undo
1701 1701
 	protected function _reset_to_default_template() {
1702 1702
 
1703 1703
 		$templates = array();
1704
-		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1704
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
1705 1705
 		//we need to make sure we've got the info we need.
1706
-		if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) {
1706
+		if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) {
1707 1707
 			EE_Error::add_error(
1708 1708
 				__(
1709 1709
 					'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.',
@@ -1715,9 +1715,9 @@  discard block
 block discarded – undo
1715 1715
 
1716 1716
 		// all templates will be reset to whatever the defaults are
1717 1717
 		// for the global template matching the messenger and message type.
1718
-		$success = !empty( $GRP_ID ) ? true : false;
1718
+		$success = ! empty($GRP_ID) ? true : false;
1719 1719
 
1720
-		if ( $success ) {
1720
+		if ($success) {
1721 1721
 
1722 1722
 			//let's first determine if the incoming template is a global template,
1723 1723
 			// if it isn't then we need to get the global template matching messenger and message type.
@@ -1725,9 +1725,9 @@  discard block
 block discarded – undo
1725 1725
 
1726 1726
 
1727 1727
 			//note this is ONLY deleting the template fields (Message Template rows) NOT the message template group.
1728
-			$success = $this->_delete_mtp_permanently( $GRP_ID, false );
1728
+			$success = $this->_delete_mtp_permanently($GRP_ID, false);
1729 1729
 
1730
-			if ( $success ) {
1730
+			if ($success) {
1731 1731
 				// if successfully deleted, lets generate the new ones.
1732 1732
 				// Note. We set GLOBAL to true, because resets on ANY template
1733 1733
 				// will use the related global template defaults for regeneration.
@@ -1745,32 +1745,32 @@  discard block
 block discarded – undo
1745 1745
 		}
1746 1746
 
1747 1747
 		//any error messages?
1748
-		if ( !$success ) {
1748
+		if ( ! $success) {
1749 1749
 			EE_Error::add_error(
1750
-				__( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ),
1750
+				__('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'),
1751 1751
 				__FILE__, __FUNCTION__, __LINE__
1752 1752
 			);
1753 1753
 		}
1754 1754
 
1755 1755
 		//all good, let's add a success message!
1756
-		if ( $success && ! empty( $templates ) ) {
1756
+		if ($success && ! empty($templates)) {
1757 1757
 			$templates = $templates[0]; //the info for the template we generated is the first element in the returned array.
1758 1758
 			EE_Error::overwrite_success();
1759
-			EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') );
1759
+			EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso'));
1760 1760
 		}
1761 1761
 
1762 1762
 
1763 1763
 		$query_args = array(
1764
-			'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null,
1765
-			'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null,
1766
-			'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps'
1764
+			'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null,
1765
+			'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null,
1766
+			'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps'
1767 1767
 			);
1768 1768
 
1769 1769
 		//if called via ajax then we return query args otherwise redirect
1770
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
1770
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1771 1771
 			return $query_args;
1772 1772
 		} else {
1773
-			$this->_redirect_after_action( false, '', '', $query_args, true );
1773
+			$this->_redirect_after_action(false, '', '', $query_args, true);
1774 1774
 			return null;
1775 1775
 		}
1776 1776
 	}
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 	 * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview.
1784 1784
 	 * @return string
1785 1785
 	 */
1786
-	public function _preview_message( $send = false ) {
1786
+	public function _preview_message($send = false) {
1787 1787
 		//first make sure we've got the necessary parameters
1788 1788
 		if (
1789 1789
 			! isset(
@@ -1799,13 +1799,13 @@  discard block
 block discarded – undo
1799 1799
 			);
1800 1800
 		}
1801 1801
 
1802
-		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1802
+		EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']);
1803 1803
 
1804 1804
 
1805 1805
 		//get the preview!
1806
-		$preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send );
1806
+		$preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send);
1807 1807
 
1808
-		if ( $send ) {
1808
+		if ($send) {
1809 1809
 			return $preview;
1810 1810
 		}
1811 1811
 
@@ -1815,22 +1815,22 @@  discard block
 block discarded – undo
1815 1815
 			'context' => $this->_req_data['context'],
1816 1816
 			'action' => 'edit_message_template'
1817 1817
 			);
1818
-		$go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1819
-		$preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>';
1818
+		$go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1819
+		$preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>';
1820 1820
 		$message_types = $this->get_installed_message_types();
1821
-		$active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
1821
+		$active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
1822 1822
 		$active_messenger_label = $active_messenger instanceof EE_messenger
1823
-			? ucwords( $active_messenger->label['singular'] )
1824
-			: esc_html__( 'Unknown Messenger', 'event_espresso' );
1823
+			? ucwords($active_messenger->label['singular'])
1824
+			: esc_html__('Unknown Messenger', 'event_espresso');
1825 1825
 		//let's provide a helpful title for context
1826 1826
 		$preview_title = sprintf(
1827
-			__( 'Viewing Preview for %s %s Message Template', 'event_espresso' ),
1827
+			__('Viewing Preview for %s %s Message Template', 'event_espresso'),
1828 1828
 			$active_messenger_label,
1829
-			ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] )
1829
+			ucwords($message_types[$this->_req_data['message_type']]->label['singular'])
1830 1830
 		);
1831 1831
 		//setup display of preview.
1832 1832
 		$this->_admin_page_title = $preview_title;
1833
-		$this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview);
1833
+		$this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview);
1834 1834
 		$this->_template_args['data']['force_json'] = true;
1835 1835
 		return '';
1836 1836
 	}
@@ -1860,9 +1860,9 @@  discard block
 block discarded – undo
1860 1860
 	 * @return void
1861 1861
 	 */
1862 1862
 	protected function _register_edit_meta_boxes() {
1863
-		add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' );
1864
-		add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1865
-		add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' );
1863
+		add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default');
1864
+		add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high');
1865
+		add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high');
1866 1866
 	}
1867 1867
 
1868 1868
 
@@ -1881,14 +1881,14 @@  discard block
 block discarded – undo
1881 1881
 
1882 1882
 		$tp_select_values = array();
1883 1883
 
1884
-		foreach ( $tp_collection as $tp ) {
1884
+		foreach ($tp_collection as $tp) {
1885 1885
 			//only include template packs that support this messenger and message type!
1886 1886
 			$supports = $tp->get_supports();
1887 1887
 			if (
1888
-				! isset( $supports[ $this->_message_template_group->messenger() ] )
1888
+				! isset($supports[$this->_message_template_group->messenger()])
1889 1889
 				|| ! in_array(
1890 1890
 					$this->_message_template_group->message_type(),
1891
-					$supports[ $this->_message_template_group->messenger() ]
1891
+					$supports[$this->_message_template_group->messenger()]
1892 1892
 				)
1893 1893
 			) {
1894 1894
 				//not supported
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 		}
1903 1903
 
1904 1904
 		//if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack.  This still allows for the odd template pack to override.
1905
-		if ( empty( $tp_select_values ) ) {
1905
+		if (empty($tp_select_values)) {
1906 1906
 			$tp_select_values[] = array(
1907 1907
 				'text' => __('Default', 'event_espresso'),
1908 1908
 				'id' => 'default'
@@ -1915,14 +1915,14 @@  discard block
 block discarded – undo
1915 1915
 			$this->_message_template_group->message_type()
1916 1916
 		);
1917 1917
 		$variations_select_values = array();
1918
-		foreach ( $variations as $variation => $label ) {
1918
+		foreach ($variations as $variation => $label) {
1919 1919
 			$variations_select_values[] = array(
1920 1920
 				'text' => $label,
1921 1921
 				'id' => $variation
1922 1922
 			);
1923 1923
 		}
1924 1924
 
1925
-		$template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels();
1925
+		$template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels();
1926 1926
 
1927 1927
 		$template_args['template_packs_selector'] = EEH_Form_Fields::select_input(
1928 1928
 			'MTP_template_pack',
@@ -1939,9 +1939,9 @@  discard block
 block discarded – undo
1939 1939
 		$template_args['template_pack_description'] = $template_pack_labels->template_pack_description;
1940 1940
 		$template_args['template_variation_description'] = $template_pack_labels->template_variation_description;
1941 1941
 
1942
-		$template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php';
1942
+		$template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php';
1943 1943
 
1944
-		EEH_Template::display_template( $template, $template_args );
1944
+		EEH_Template::display_template($template, $template_args);
1945 1945
 	}
1946 1946
 
1947 1947
 
@@ -1965,46 +1965,46 @@  discard block
 block discarded – undo
1965 1965
 		//first we need to see if there are any fields
1966 1966
 		$fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields();
1967 1967
 
1968
-		if ( !empty( $fields ) ) {
1968
+		if ( ! empty($fields)) {
1969 1969
 			//yup there be fields
1970
-			foreach ( $fields as $field => $config ) {
1971
-				$field_id = $this->_message_template_group->messenger() . '_' . $field;
1970
+			foreach ($fields as $field => $config) {
1971
+				$field_id = $this->_message_template_group->messenger().'_'.$field;
1972 1972
 				$existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings();
1973
-				$default = isset( $config['default'] ) ? $config['default'] : '';
1974
-				$default = isset( $config['value'] ) ? $config['value'] : $default;
1973
+				$default = isset($config['default']) ? $config['default'] : '';
1974
+				$default = isset($config['value']) ? $config['value'] : $default;
1975 1975
 
1976 1976
 				// if type is hidden and the value is empty
1977 1977
 				// something may have gone wrong so let's correct with the defaults
1978 1978
 				$fix = $config['input'] === 'hidden' && isset($existing[$field]) && empty($existing[$field])
1979 1979
 					? $default
1980 1980
 					: '';
1981
-				$existing[$field] = isset( $existing[$field] ) && empty( $fix )
1981
+				$existing[$field] = isset($existing[$field]) && empty($fix)
1982 1982
 					? $existing[$field]
1983 1983
 					: $fix;
1984 1984
 
1985 1985
 				$template_form_fields[$field_id] = array(
1986
-					'name'       => 'test_settings_fld[' . $field . ']',
1986
+					'name'       => 'test_settings_fld['.$field.']',
1987 1987
 					'label'      => $config['label'],
1988 1988
 					'input'      => $config['input'],
1989 1989
 					'type'       => $config['type'],
1990 1990
 					'required'   => $config['required'],
1991 1991
 					'validation' => $config['validation'],
1992
-					'value'      => isset( $existing[ $field ] ) ? $existing[ $field ] : $default,
1992
+					'value'      => isset($existing[$field]) ? $existing[$field] : $default,
1993 1993
 					'css_class'  => $config['css_class'],
1994
-					'options'    => isset( $config['options'] ) ? $config['options'] : array(),
1994
+					'options'    => isset($config['options']) ? $config['options'] : array(),
1995 1995
 					'default'    => $default,
1996 1996
 					'format'     => $config['format']
1997 1997
 				);
1998 1998
 			}
1999 1999
 		}
2000 2000
 
2001
-		$test_settings_fields = !empty( $template_form_fields)
2002
-			? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' )
2001
+		$test_settings_fields = ! empty($template_form_fields)
2002
+			? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds')
2003 2003
 			: '';
2004 2004
 
2005 2005
 		$test_settings_html = '';
2006 2006
 		//print out $test_settings_fields
2007
-		if ( !empty( $test_settings_fields ) ) {
2007
+		if ( ! empty($test_settings_fields)) {
2008 2008
 			echo $test_settings_fields;
2009 2009
 			$test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" ';
2010 2010
 			$test_settings_html .= 'name="test_button" value="';
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
 		}
2014 2014
 
2015 2015
 		//and button
2016
-		$test_settings_html .= '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>';
2016
+		$test_settings_html .= '<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>';
2017 2017
 		$test_settings_html .= '<div class="publishing-action alignright resetbutton">';
2018 2018
 		$test_settings_html .= $this->get_action_link_or_button(
2019 2019
 			'reset_to_default',
@@ -2037,13 +2037,13 @@  discard block
 block discarded – undo
2037 2037
      * @param string $linked_input_id The css id of the input that the shortcodes get added to.
2038 2038
      * @return string
2039 2039
     */
2040
-	protected function _get_shortcode_selector( $field, $linked_input_id ) {
2040
+	protected function _get_shortcode_selector($field, $linked_input_id) {
2041 2041
 		$template_args = array(
2042
-			'shortcodes' => $this->_get_shortcodes( array( $field ), true ),
2042
+			'shortcodes' => $this->_get_shortcodes(array($field), true),
2043 2043
 			'fieldname' => $field,
2044 2044
 			'linked_input_id' => $linked_input_id
2045 2045
 		);
2046
-		return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true );
2046
+		return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true);
2047 2047
 	}
2048 2048
 
2049 2049
 
@@ -2058,13 +2058,13 @@  discard block
 block discarded – undo
2058 2058
 		$shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set
2059 2059
 		//$messenger = $this->_message_template_group->messenger_obj();
2060 2060
 		//now let's set the content depending on the status of the shortcodes array
2061
-		if ( empty( $shortcodes ) ) {
2062
-			$content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>';
2061
+		if (empty($shortcodes)) {
2062
+			$content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>';
2063 2063
 			echo $content;
2064 2064
 		} else {
2065 2065
 			//$alt = 0;
2066 2066
 			?>
2067
-			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p>
2067
+			<div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p>
2068 2068
 			<?php
2069 2069
 		}
2070 2070
 
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
 	protected function _set_shortcodes() {
2082 2082
 
2083 2083
 		//no need to run this if the property is already set
2084
-		if ( !empty($this->_shortcodes ) ) {return;}
2084
+		if ( ! empty($this->_shortcodes)) {return; }
2085 2085
 
2086 2086
 		$this->_shortcodes = $this->_get_shortcodes();
2087 2087
 	}
@@ -2103,14 +2103,14 @@  discard block
 block discarded – undo
2103 2103
 	 * @return array          Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true
2104 2104
 	 *                       just an array of shortcode/label pairs.
2105 2105
 	 */
2106
-	protected function _get_shortcodes( $fields = array(), $merged = true ) {
2106
+	protected function _get_shortcodes($fields = array(), $merged = true) {
2107 2107
 		$this->_set_message_template_group();
2108 2108
 
2109 2109
 		//we need the messenger and message template to retrieve the valid shortcodes array.
2110
-		$GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false;
2111
-		$context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() );
2110
+		$GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false;
2111
+		$context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config());
2112 2112
 
2113
-		return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array();
2113
+		return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array();
2114 2114
 	}
2115 2115
 
2116 2116
 
@@ -2123,19 +2123,19 @@  discard block
 block discarded – undo
2123 2123
 	 */
2124 2124
 	protected function _set_message_template_group() {
2125 2125
 
2126
-		if ( !empty( $this->_message_template_group ) )
2127
-			{return;} //get out if this is already set.
2126
+		if ( ! empty($this->_message_template_group))
2127
+			{return; } //get out if this is already set.
2128 2128
 
2129
-		$GRP_ID =  ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false;
2130
-		$GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID;
2129
+		$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false;
2130
+		$GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID;
2131 2131
 
2132 2132
 		//let's get the message templates
2133 2133
 		$MTP = EEM_Message_Template_Group::instance();
2134 2134
 
2135
-		if ( empty($GRP_ID) )
2136
-			{$this->_message_template_group = $MTP->create_default_object();}
2135
+		if (empty($GRP_ID))
2136
+			{$this->_message_template_group = $MTP->create_default_object(); }
2137 2137
 		else
2138
-			{$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );}
2138
+			{$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); }
2139 2139
 
2140 2140
 		$this->_template_pack = $this->_message_template_group->get_template_pack();
2141 2141
 		$this->_variation = $this->_message_template_group->get_template_pack_variation();
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 	 * @param array $args various things the context switcher needs.
2155 2155
 	 *
2156 2156
 	 */
2157
-	protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) {
2157
+	protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) {
2158 2158
 		$context_details = $template_group_object->contexts_config();
2159 2159
 		$context_label = $template_group_object->context_label();
2160 2160
 		ob_start();
@@ -2162,20 +2162,20 @@  discard block
 block discarded – undo
2162 2162
 		<div class="ee-msg-switcher-container">
2163 2163
 			<form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm">
2164 2164
 				<?php
2165
-					foreach ( $args as $name => $value ) {
2166
-						if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;}
2165
+					foreach ($args as $name => $value) {
2166
+						if ($name == 'context' || empty($value) || $name == 'extra') {continue; }
2167 2167
 						?>
2168 2168
 						<input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" />
2169 2169
 						<?php
2170 2170
 					}
2171 2171
 					//setup nonce_url
2172
-					wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false);
2172
+					wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false);
2173 2173
 				?>
2174 2174
 				<select name="context">
2175 2175
 					<?php
2176 2176
 					$context_templates = $template_group_object->context_templates();
2177
-					if ( is_array($context_templates) ) :
2178
-							foreach ( $context_templates as $context => $template_fields ) :
2177
+					if (is_array($context_templates)) :
2178
+							foreach ($context_templates as $context => $template_fields) :
2179 2179
 								$checked = ($context == $args['context']) ? 'selected="selected"' : '';
2180 2180
 					?>
2181 2181
 					<option value="<?php echo $context; ?>" <?php echo $checked; ?>>
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 					</option>
2184 2184
 					<?php endforeach; endif; ?>
2185 2185
 				</select>
2186
-				<?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?>
2186
+				<?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?>
2187 2187
 				<input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>">
2188 2188
 			</form>
2189 2189
 			<?php echo $args['extra']; ?>
@@ -2210,8 +2210,8 @@  discard block
 block discarded – undo
2210 2210
 	 * @return array
2211 2211
 	 */
2212 2212
 	protected function _set_message_template_column_values($index) {
2213
-		if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) {
2214
-			foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) {
2213
+		if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) {
2214
+			foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) {
2215 2215
 				$this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value;
2216 2216
 			}
2217 2217
 		} /*else {
@@ -2220,22 +2220,22 @@  discard block
 block discarded – undo
2220 2220
 
2221 2221
 
2222 2222
 		$set_column_values = array(
2223
-			'MTP_ID'             => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ),
2224
-			'GRP_ID'             => absint( $this->_req_data[ 'GRP_ID' ] ),
2225
-			'MTP_user_id'        => absint( $this->_req_data[ 'MTP_user_id' ] ),
2226
-			'MTP_messenger'      => strtolower( $this->_req_data[ 'MTP_messenger' ] ),
2227
-			'MTP_message_type'   => strtolower( $this->_req_data[ 'MTP_message_type' ] ),
2228
-			'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ),
2229
-			'MTP_context'        => strtolower( $this->_req_data[ 'MTP_context' ] ),
2230
-			'MTP_content'        => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ],
2231
-			'MTP_is_global'      => isset( $this->_req_data[ 'MTP_is_global' ] )
2232
-				? absint( $this->_req_data[ 'MTP_is_global' ] )
2223
+			'MTP_ID'             => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']),
2224
+			'GRP_ID'             => absint($this->_req_data['GRP_ID']),
2225
+			'MTP_user_id'        => absint($this->_req_data['MTP_user_id']),
2226
+			'MTP_messenger'      => strtolower($this->_req_data['MTP_messenger']),
2227
+			'MTP_message_type'   => strtolower($this->_req_data['MTP_message_type']),
2228
+			'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']),
2229
+			'MTP_context'        => strtolower($this->_req_data['MTP_context']),
2230
+			'MTP_content'        => $this->_req_data['MTP_template_fields'][$index]['content'],
2231
+			'MTP_is_global'      => isset($this->_req_data['MTP_is_global'])
2232
+				? absint($this->_req_data['MTP_is_global'])
2233 2233
 				: 0,
2234
-			'MTP_is_override'    => isset( $this->_req_data[ 'MTP_is_override' ] )
2235
-				? absint( $this->_req_data[ 'MTP_is_override' ] )
2234
+			'MTP_is_override'    => isset($this->_req_data['MTP_is_override'])
2235
+				? absint($this->_req_data['MTP_is_override'])
2236 2236
 				: 0,
2237
-			'MTP_deleted'        => absint( $this->_req_data[ 'MTP_deleted' ] ),
2238
-			'MTP_is_active'      => absint( $this->_req_data[ 'MTP_is_active' ] )
2237
+			'MTP_deleted'        => absint($this->_req_data['MTP_deleted']),
2238
+			'MTP_is_active'      => absint($this->_req_data['MTP_is_active'])
2239 2239
 		);
2240 2240
 
2241 2241
 
@@ -2247,36 +2247,36 @@  discard block
 block discarded – undo
2247 2247
 
2248 2248
 
2249 2249
 
2250
-	protected function _insert_or_update_message_template($new = false ) {
2250
+	protected function _insert_or_update_message_template($new = false) {
2251 2251
 
2252
-		do_action ( 'AHEE_log', __FILE__, __FUNCTION__, '');
2252
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2253 2253
 		$success = 0;
2254 2254
 		$override = false;
2255 2255
 
2256 2256
 		//setup notices description
2257
-		$messenger = ! empty( $this->_req_data['MTP_messenger'] )
2258
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) )
2257
+		$messenger = ! empty($this->_req_data['MTP_messenger'])
2258
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger']))
2259 2259
 			: false;
2260 2260
 
2261
-		$message_type = ! empty( $this->_req_data['MTP_message_type'] )
2262
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) )
2261
+		$message_type = ! empty($this->_req_data['MTP_message_type'])
2262
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type']))
2263 2263
 			: false;
2264 2264
 
2265
-		$context = ! empty( $this->_req_data['MTP_context'] )
2266
-			? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) )
2265
+		$context = ! empty($this->_req_data['MTP_context'])
2266
+			? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context']))
2267 2267
 			: false;
2268 2268
 
2269
-		$item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : '';
2269
+		$item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : '';
2270 2270
 		$item_desc .= 'Message Template';
2271 2271
 		$query_args = array();
2272 2272
 		$edit_array = array();
2273 2273
 		$action_desc = '';
2274 2274
 
2275 2275
 		//if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit.
2276
-		if ( $new ) {
2277
-			$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
2278
-			if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) {
2279
-				if ( empty($edit_array) ) {
2276
+		if ($new) {
2277
+			$GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0;
2278
+			if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) {
2279
+				if (empty($edit_array)) {
2280 2280
 					$success = 0;
2281 2281
 				} else {
2282 2282
 					$success = 1;
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 
2296 2296
 
2297 2297
 			//run update for each template field in displayed context
2298
-			if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) {
2298
+			if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) {
2299 2299
 				EE_Error::add_error(
2300 2300
 					__('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'),
2301 2301
 					__FILE__, __FUNCTION__, __LINE__
@@ -2304,25 +2304,25 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 			} else {
2306 2306
 				//first validate all fields!
2307
-				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2307
+				$validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2308 2308
 
2309 2309
 				//if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array.  WE need to make sure there is no actual error messages in validates.
2310
-				if ( is_array($validates) && !empty($validates) ) {
2310
+				if (is_array($validates) && ! empty($validates)) {
2311 2311
 					//add the transient so when the form loads we know which fields to highlight
2312
-					$this->_add_transient( 'edit_message_template', $validates );
2312
+					$this->_add_transient('edit_message_template', $validates);
2313 2313
 
2314 2314
 					$success = 0;
2315 2315
 
2316 2316
 					//setup notices
2317
-					foreach ( $validates as $field => $error ) {
2318
-						if ( isset($error['msg'] ) ) {
2319
-							EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ );
2317
+					foreach ($validates as $field => $error) {
2318
+						if (isset($error['msg'])) {
2319
+							EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__);
2320 2320
 						}
2321 2321
 					}
2322 2322
 
2323 2323
 				} else {
2324 2324
 					$set_column_values = array();
2325
-					foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) {
2325
+					foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) {
2326 2326
 						$set_column_values = $this->_set_message_template_column_values($template_field);
2327 2327
 
2328 2328
 						$where_cols_n_values = array(
@@ -2335,11 +2335,11 @@  discard block
 block discarded – undo
2335 2335
 							'MTP_context' => $set_column_values['MTP_context'],
2336 2336
 							'MTP_content' => $set_column_values['MTP_content']
2337 2337
 						);
2338
-						if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) {
2339
-							if ( $updated === false ) {
2338
+						if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) {
2339
+							if ($updated === false) {
2340 2340
 								EE_Error::add_error(
2341 2341
 									sprintf(
2342
-										__( '%s field was NOT updated for some reason', 'event_espresso' ),
2342
+										__('%s field was NOT updated for some reason', 'event_espresso'),
2343 2343
 										$template_field
2344 2344
 									),
2345 2345
 									__FILE__, __FUNCTION__, __LINE__
@@ -2353,46 +2353,46 @@  discard block
 block discarded – undo
2353 2353
 
2354 2354
 					//we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs)
2355 2355
 					$mtpg_fields = array(
2356
-						'MTP_user_id'      => $set_column_values[ 'MTP_user_id' ],
2357
-						'MTP_messenger'    => $set_column_values[ 'MTP_messenger' ],
2358
-						'MTP_message_type' => $set_column_values[ 'MTP_message_type' ],
2359
-						'MTP_is_global'    => $set_column_values[ 'MTP_is_global' ],
2360
-						'MTP_is_override'  => $set_column_values[ 'MTP_is_override' ],
2361
-						'MTP_deleted'      => $set_column_values[ 'MTP_deleted' ],
2362
-						'MTP_is_active'    => $set_column_values[ 'MTP_is_active' ],
2363
-						'MTP_name'         => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] )
2364
-							? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ]
2356
+						'MTP_user_id'      => $set_column_values['MTP_user_id'],
2357
+						'MTP_messenger'    => $set_column_values['MTP_messenger'],
2358
+						'MTP_message_type' => $set_column_values['MTP_message_type'],
2359
+						'MTP_is_global'    => $set_column_values['MTP_is_global'],
2360
+						'MTP_is_override'  => $set_column_values['MTP_is_override'],
2361
+						'MTP_deleted'      => $set_column_values['MTP_deleted'],
2362
+						'MTP_is_active'    => $set_column_values['MTP_is_active'],
2363
+						'MTP_name'         => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name'])
2364
+							? $this->_req_data['ee_msg_non_global_fields']['MTP_name']
2365 2365
 							: '',
2366
-						'MTP_description'  => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] )
2367
-							? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ]
2366
+						'MTP_description'  => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description'])
2367
+							? $this->_req_data['ee_msg_non_global_fields']['MTP_description']
2368 2368
 							: ''
2369 2369
 					);
2370 2370
 
2371
-					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] );
2372
-					$updated = $MTPG->update( $mtpg_fields, array($mtpg_where) );
2371
+					$mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']);
2372
+					$updated = $MTPG->update($mtpg_fields, array($mtpg_where));
2373 2373
 
2374
-					if ( $updated === false ) {
2374
+					if ($updated === false) {
2375 2375
 						EE_Error::add_error(
2376 2376
 							sprintf(
2377
-								__( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ),
2378
-								$set_column_values[ 'GRP_ID' ]
2377
+								__('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'),
2378
+								$set_column_values['GRP_ID']
2379 2379
 							),
2380 2380
 							__FILE__, __FUNCTION__, __LINE__
2381 2381
 						);
2382 2382
 					} else {
2383 2383
 						//k now we need to ensure the template_pack and template_variation fields are set.
2384
-						$template_pack = ! empty( $this->_req_data['MTP_template_pack' ] )
2384
+						$template_pack = ! empty($this->_req_data['MTP_template_pack'])
2385 2385
 							? $this->_req_data['MTP_template_pack']
2386 2386
 							: 'default';
2387 2387
 
2388
-						$template_variation = ! empty( $this->_req_data['MTP_template_variation'] )
2388
+						$template_variation = ! empty($this->_req_data['MTP_template_variation'])
2389 2389
 							? $this->_req_data['MTP_template_variation']
2390 2390
 							: 'default';
2391 2391
 
2392
-						$mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] );
2393
-						if ( $mtpg_obj instanceof EE_Message_Template_Group ) {
2394
-							$mtpg_obj->set_template_pack_name( $template_pack );
2395
-							$mtpg_obj->set_template_pack_variation( $template_variation );
2392
+						$mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']);
2393
+						if ($mtpg_obj instanceof EE_Message_Template_Group) {
2394
+							$mtpg_obj->set_template_pack_name($template_pack);
2395
+							$mtpg_obj->set_template_pack_variation($template_variation);
2396 2396
 						}
2397 2397
 						$success = 1;
2398 2398
 					}
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
 		}
2403 2403
 
2404 2404
 		//we return things differently if doing ajax
2405
-		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2405
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2406 2406
 			$this->_template_args['success'] = $success;
2407 2407
 			$this->_template_args['error'] = ! $success ? true : false;
2408 2408
 			$this->_template_args['content'] = '';
@@ -2410,9 +2410,9 @@  discard block
 block discarded – undo
2410 2410
 				'grpID' => $edit_array['GRP_ID'],
2411 2411
 				'templateName' => $edit_array['template_name']
2412 2412
 				);
2413
-			if ( $success ) {
2413
+			if ($success) {
2414 2414
 				EE_Error::overwrite_success();
2415
-				EE_Error::add_success( __('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso') );
2415
+				EE_Error::add_success(__('The new template has been created and automatically selected for this event.  You can edit the new template by clicking the edit button.  Note before this template is assigned to this event, the event must be saved.', 'event_espresso'));
2416 2416
 			}
2417 2417
 
2418 2418
 			$this->_return_json();
@@ -2420,13 +2420,13 @@  discard block
 block discarded – undo
2420 2420
 
2421 2421
 
2422 2422
 		//was a test send triggered?
2423
-		if ( isset( $this->_req_data['test_button'] ) ) {
2423
+		if (isset($this->_req_data['test_button'])) {
2424 2424
 			EE_Error::overwrite_success();
2425
-			$this->_do_test_send( $this->_req_data['MTP_context'],  $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] );
2425
+			$this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']);
2426 2426
 			$override = true;
2427 2427
 		}
2428 2428
 
2429
-		if ( empty( $query_args ) ) {
2429
+		if (empty($query_args)) {
2430 2430
 			$query_args = array(
2431 2431
 				'id' => $this->_req_data['GRP_ID'],
2432 2432
 				'context' => $this->_req_data['MTP_context'],
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
 				);
2435 2435
 		}
2436 2436
 
2437
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override );
2437
+		$this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override);
2438 2438
 	}
2439 2439
 
2440 2440
 
@@ -2448,28 +2448,28 @@  discard block
 block discarded – undo
2448 2448
 	 * @param  string $message_type message type being tested
2449 2449
 	 *
2450 2450
 	 */
2451
-	protected function _do_test_send( $context, $messenger, $message_type ) {
2451
+	protected function _do_test_send($context, $messenger, $message_type) {
2452 2452
 		//set things up for preview
2453 2453
 		$this->_req_data['messenger'] = $messenger;
2454 2454
 		$this->_req_data['message_type'] = $message_type;
2455 2455
 		$this->_req_data['context'] = $context;
2456
-		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : '';
2457
-		$active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger );
2456
+		$this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : '';
2457
+		$active_messenger = $this->_message_resource_manager->get_active_messenger($messenger);
2458 2458
 
2459 2459
 		//let's save any existing fields that might be required by the messenger
2460 2460
 		if (
2461
-			isset( $this->_req_data['test_settings_fld'] )
2461
+			isset($this->_req_data['test_settings_fld'])
2462 2462
 			&& $active_messenger instanceof EE_messenger
2463 2463
 		) {
2464
-			$active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] );
2464
+			$active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']);
2465 2465
 		}
2466 2466
 
2467 2467
 		$success = $this->_preview_message(true);
2468 2468
 
2469
-		if ( $success ) {
2470
-			EE_Error::add_success( __('Test message sent', 'event_espresso') );
2469
+		if ($success) {
2470
+			EE_Error::add_success(__('Test message sent', 'event_espresso'));
2471 2471
 		} else {
2472
-			EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
2472
+			EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2473 2473
 		}
2474 2474
 	}
2475 2475
 
@@ -2495,11 +2495,11 @@  discard block
 block discarded – undo
2495 2495
 	protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) {
2496 2496
 
2497 2497
 		//if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates.
2498
-		if ( empty( $message_types ) ) {
2498
+		if (empty($message_types)) {
2499 2499
 			return true;
2500 2500
 		}
2501 2501
 
2502
-		return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global );
2502
+		return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global);
2503 2503
 	}
2504 2504
 
2505 2505
 
@@ -2515,33 +2515,33 @@  discard block
 block discarded – undo
2515 2515
 	 *
2516 2516
 	 * @return void
2517 2517
 	 */
2518
-	protected function _trash_or_restore_message_template($trash = true, $all = false ) {
2519
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2518
+	protected function _trash_or_restore_message_template($trash = true, $all = false) {
2519
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2520 2520
 		$MTP = EEM_Message_Template_Group::instance();
2521 2521
 
2522 2522
 		$success = 1;
2523 2523
 
2524 2524
 		//incoming GRP_IDs
2525
-		if ( $all ) {
2525
+		if ($all) {
2526 2526
 			//Checkboxes
2527
-			if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) {
2527
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2528 2528
 				//if array has more than one element then success message should be plural.
2529 2529
 				//todo: what about nonce?
2530
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2530
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2531 2531
 
2532 2532
 				//cycle through checkboxes
2533
-				while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) {
2534
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2535
-					if ( ! $trashed_or_restored ) {
2533
+				while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2534
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2535
+					if ( ! $trashed_or_restored) {
2536 2536
 						$success = 0;
2537 2537
 					}
2538 2538
 				}
2539 2539
 			} else {
2540 2540
 				//grab single GRP_ID and handle
2541
-				$GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
2542
-				if ( ! empty( $GRP_ID ) ) {
2543
-					$trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID );
2544
-					if ( ! $trashed_or_restored ) {
2541
+				$GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
2542
+				if ( ! empty($GRP_ID)) {
2543
+					$trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID);
2544
+					if ( ! $trashed_or_restored) {
2545 2545
 						$success = 0;
2546 2546
 					}
2547 2547
 				} else {
@@ -2553,13 +2553,13 @@  discard block
 block discarded – undo
2553 2553
 
2554 2554
 		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2555 2555
 
2556
-		$action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc;
2556
+		$action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc;
2557 2557
 
2558 2558
 		$item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso');
2559 2559
 
2560
-		$item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2560
+		$item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc;
2561 2561
 
2562
-		$this->_redirect_after_action( $success, $item_desc, $action_desc, array() );
2562
+		$this->_redirect_after_action($success, $item_desc, $action_desc, array());
2563 2563
 
2564 2564
 	}
2565 2565
 
@@ -2575,24 +2575,24 @@  discard block
 block discarded – undo
2575 2575
 	 * @return void
2576 2576
 	 */
2577 2577
 	protected function _delete_message_template() {
2578
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2578
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2579 2579
 
2580 2580
 		//checkboxes
2581
-		if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) {
2581
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2582 2582
 			//if array has more than one element then success message should be plural
2583
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2583
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2584 2584
 
2585 2585
 			//cycle through bulk action checkboxes
2586
-			while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) {
2587
-				$success = $this->_delete_mtp_permanently( $GRP_ID );
2586
+			while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) {
2587
+				$success = $this->_delete_mtp_permanently($GRP_ID);
2588 2588
 			}
2589 2589
 		} else {
2590 2590
 			//grab single grp_id and delete
2591
-			$GRP_ID = absint($this->_req_data['id'] );
2592
-			$success = $this->_delete_mtp_permanently( $GRP_ID );
2591
+			$GRP_ID = absint($this->_req_data['id']);
2592
+			$success = $this->_delete_mtp_permanently($GRP_ID);
2593 2593
 		}
2594 2594
 
2595
-		$this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() );
2595
+		$this->_redirect_after_action($success, 'Message Templates', 'deleted', array());
2596 2596
 
2597 2597
 	}
2598 2598
 
@@ -2607,20 +2607,20 @@  discard block
 block discarded – undo
2607 2607
 	 *
2608 2608
 	 * @return bool        boolean to indicate the success of the deletes or not.
2609 2609
 	 */
2610
-	private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) {
2610
+	private function _delete_mtp_permanently($GRP_ID, $include_group = true) {
2611 2611
 		$success = 1;
2612 2612
 		$MTPG = EEM_Message_Template_Group::instance();
2613 2613
 		//first let's GET this group
2614
-		$MTG = $MTPG->get_one_by_ID( $GRP_ID );
2614
+		$MTG = $MTPG->get_one_by_ID($GRP_ID);
2615 2615
 		//then delete permanently all the related Message Templates
2616
-		$deleted = $MTG->delete_related_permanently( 'Message_Template' );
2616
+		$deleted = $MTG->delete_related_permanently('Message_Template');
2617 2617
 
2618
-		if ( $deleted === 0 )
2619
-			{$success = 0;}
2618
+		if ($deleted === 0)
2619
+			{$success = 0; }
2620 2620
 
2621 2621
 		//now delete permanently this particular group
2622 2622
 
2623
-		if ( $include_group && ! $MTG->delete_permanently() ) {
2623
+		if ($include_group && ! $MTG->delete_permanently()) {
2624 2624
 			$success = 0;
2625 2625
 		}
2626 2626
 		return $success;
@@ -2638,7 +2638,7 @@  discard block
 block discarded – undo
2638 2638
 	*	@return string
2639 2639
 	*/
2640 2640
 	protected function _learn_more_about_message_templates_link() {
2641
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>';
2641
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>';
2642 2642
 	}
2643 2643
 
2644 2644
 
@@ -2656,10 +2656,10 @@  discard block
 block discarded – undo
2656 2656
 
2657 2657
 		$this->_set_m_mt_settings();
2658 2658
 
2659
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2659
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2660 2660
 
2661 2661
 		//let's setup the messenger tabs
2662
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger );
2662
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger);
2663 2663
 		$this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">';
2664 2664
 		$this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->';
2665 2665
 
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 	 */
2679 2679
 	protected function _set_m_mt_settings() {
2680 2680
 		//first if this is already set then lets get out no need to regenerate data.
2681
-		if ( !empty($this->_m_mt_settings) ) {
2681
+		if ( ! empty($this->_m_mt_settings)) {
2682 2682
 			return;
2683 2683
 		}
2684 2684
 
@@ -2693,10 +2693,10 @@  discard block
 block discarded – undo
2693 2693
 
2694 2694
 		//assemble the array for the _tab_text_links helper
2695 2695
 
2696
-		foreach ( $messengers as $messenger ) {
2696
+		foreach ($messengers as $messenger) {
2697 2697
 			$this->_m_mt_settings['messenger_tabs'][$messenger->name] = array(
2698 2698
 				'label' => ucwords($messenger->label['singular']),
2699
-				'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '',
2699
+				'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '',
2700 2700
 				'href' => $messenger->name,
2701 2701
 				'title' => __('Modify this Messenger', 'event_espresso'),
2702 2702
 				'slug' => $messenger->name,
@@ -2706,26 +2706,26 @@  discard block
 block discarded – undo
2706 2706
 
2707 2707
 			$message_types_for_messenger = $messenger->get_valid_message_types();
2708 2708
 
2709
-			foreach ( $message_types as $message_type ) {
2709
+			foreach ($message_types as $message_type) {
2710 2710
 				//first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox.
2711
-				if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) {
2711
+				if ( ! in_array($message_type->name, $message_types_for_messenger)) {
2712 2712
 					continue;
2713 2713
 				}
2714 2714
 
2715
-				$a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive';
2715
+				$a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive';
2716 2716
 
2717 2717
 				$this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array(
2718
-					'label'    => ucwords( $message_type->label[ 'singular' ] ),
2719
-					'class'    => 'message-type-' . $a_or_i,
2720
-					'slug_id'  => $message_type->name . '-messagetype-' . $messenger->name,
2721
-					'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ),
2722
-					'href'     => 'espresso_' . $message_type->name . '_message_type_settings',
2718
+					'label'    => ucwords($message_type->label['singular']),
2719
+					'class'    => 'message-type-'.$a_or_i,
2720
+					'slug_id'  => $message_type->name.'-messagetype-'.$messenger->name,
2721
+					'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'),
2722
+					'href'     => 'espresso_'.$message_type->name.'_message_type_settings',
2723 2723
 					'title'    => $a_or_i == 'active'
2724
-						? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' )
2725
-						: __( 'Drag this message type to the messenger to activate', 'event_espresso' ),
2724
+						? __('Drag this message type to the Inactive window to deactivate', 'event_espresso')
2725
+						: __('Drag this message type to the messenger to activate', 'event_espresso'),
2726 2726
 					'content'  => $a_or_i == 'active'
2727
-						? $this->_message_type_settings_content( $message_type, $messenger, true )
2728
-						: $this->_message_type_settings_content( $message_type, $messenger ),
2727
+						? $this->_message_type_settings_content($message_type, $messenger, true)
2728
+						: $this->_message_type_settings_content($message_type, $messenger),
2729 2729
 					'slug'     => $message_type->name,
2730 2730
 					'active'   => $a_or_i == 'active' ? true : false,
2731 2731
 					'obj'      => $message_type
@@ -2744,34 +2744,34 @@  discard block
 block discarded – undo
2744 2744
 	 *
2745 2745
 	 * @return string                html output for the content
2746 2746
 	 */
2747
-	protected function _message_type_settings_content( $message_type, $messenger, $active = false ) {
2747
+	protected function _message_type_settings_content($message_type, $messenger, $active = false) {
2748 2748
 		//get message type fields
2749 2749
 		$fields = $message_type->get_admin_settings_fields();
2750
-		$settings_template_args['template_form_fields']= '';
2750
+		$settings_template_args['template_form_fields'] = '';
2751 2751
 
2752
-		if ( !empty( $fields ) && $active ) {
2752
+		if ( ! empty($fields) && $active) {
2753 2753
 
2754
-			$existing_settings = $message_type->get_existing_admin_settings( $messenger->name );
2754
+			$existing_settings = $message_type->get_existing_admin_settings($messenger->name);
2755 2755
 
2756
-			foreach( $fields as $fldname => $fldprops ) {
2757
-				$field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname;
2756
+			foreach ($fields as $fldname => $fldprops) {
2757
+				$field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname;
2758 2758
 				$template_form_field[$field_id] = array(
2759
-					'name' => 'message_type_settings[' . $fldname . ']',
2759
+					'name' => 'message_type_settings['.$fldname.']',
2760 2760
 					'label' => $fldprops['label'],
2761 2761
 					'input' => $fldprops['field_type'],
2762 2762
 					'type' => $fldprops['value_type'],
2763 2763
 					'required' => $fldprops['required'],
2764 2764
 					'validation' => $fldprops['validation'],
2765
-					'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2766
-					'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(),
2767
-					'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'],
2765
+					'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2766
+					'options' => isset($fldprops['options']) ? $fldprops['options'] : array(),
2767
+					'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'],
2768 2768
 					'css_class' => 'no-drag',
2769 2769
 					'format' => $fldprops['format']
2770 2770
 				);
2771 2771
 			}
2772 2772
 
2773 2773
 
2774
-			$settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : '';
2774
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : '';
2775 2775
 		}
2776 2776
 
2777 2777
 		$settings_template_args['description'] = $message_type->description;
@@ -2791,13 +2791,13 @@  discard block
 block discarded – undo
2791 2791
 					)
2792 2792
 				);
2793 2793
 
2794
-		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' );
2795
-		$settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : '';
2794
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array');
2795
+		$settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : '';
2796 2796
 
2797 2797
 
2798 2798
 
2799
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php';
2800
-		$content = EEH_Template::display_template( $template, $settings_template_args, true );
2799
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php';
2800
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
2801 2801
 		return $content;
2802 2802
 	}
2803 2803
 
@@ -2814,27 +2814,27 @@  discard block
 block discarded – undo
2814 2814
 		$m_boxes = $mt_boxes = array();
2815 2815
 		$m_template_args = $mt_template_args = array();
2816 2816
 
2817
-		$selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email';
2817
+		$selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email';
2818 2818
 
2819
-		if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) {
2820
-			foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) {
2821
-				$hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden';
2822
-				$hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : '';
2819
+		if (isset($this->_m_mt_settings['messenger_tabs'])) {
2820
+			foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) {
2821
+				$hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden';
2822
+				$hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : '';
2823 2823
 				//messenger meta boxes
2824 2824
 				$active = $selected_messenger == $messenger ? true : false;
2825
-				$active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] )
2826
-				? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ]
2825
+				$active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active'])
2826
+				? $this->_m_mt_settings['message_type_tabs'][$messenger]['active']
2827 2827
 				: '';
2828
-				$m_boxes[ $messenger . '_a_box' ] = sprintf(
2829
-				__( '%s Settings', 'event_espresso' ),
2830
-				$tab_array[ 'label' ]
2828
+				$m_boxes[$messenger.'_a_box'] = sprintf(
2829
+				__('%s Settings', 'event_espresso'),
2830
+				$tab_array['label']
2831 2831
 				);
2832
-				$m_template_args[ $messenger . '_a_box' ] = array(
2833
-				'active_message_types'   => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2834
-				'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2835
-				? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2832
+				$m_template_args[$messenger.'_a_box'] = array(
2833
+				'active_message_types'   => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2834
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2835
+				? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2836 2836
 				: '',
2837
-				'content'                => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ),
2837
+				'content'                => $this->_get_messenger_box_content($tab_array['obj']),
2838 2838
 				'hidden'                 => $active ? '' : ' hidden',
2839 2839
 				'hide_on_message'        => $hide_on_message,
2840 2840
 				'messenger'              => $messenger,
@@ -2843,11 +2843,11 @@  discard block
 block discarded – undo
2843 2843
 				// message type meta boxes
2844 2844
 				// (which is really just the inactive container for each messenger
2845 2845
 				// showing inactive message types for that messenger)
2846
-				$mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' );
2847
-				$mt_template_args[ $messenger . '_i_box' ] = array(
2848
-				'active_message_types'   => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '',
2849
-				'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2850
-				? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] )
2846
+				$mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso');
2847
+				$mt_template_args[$messenger.'_i_box'] = array(
2848
+				'active_message_types'   => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '',
2849
+				'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2850
+				? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive'])
2851 2851
 				: '',
2852 2852
 				'hidden'                 => $active ? '' : ' hidden',
2853 2853
 				'hide_on_message'        => $hide_on_message,
@@ -2860,15 +2860,15 @@  discard block
 block discarded – undo
2860 2860
 
2861 2861
 
2862 2862
 		//register messenger metaboxes
2863
-		$m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php';
2864
-		foreach ( $m_boxes as $box => $label ) {
2865
-			$callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] );
2866
-			$msgr = str_replace( '_a_box', '', $box );
2863
+		$m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php';
2864
+		foreach ($m_boxes as $box => $label) {
2865
+			$callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]);
2866
+			$msgr = str_replace('_a_box', '', $box);
2867 2867
 			add_meta_box(
2868
-				'espresso_' . $msgr . '_settings',
2868
+				'espresso_'.$msgr.'_settings',
2869 2869
 				$label,
2870
-				function( $post, $metabox ) {
2871
-					echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );
2870
+				function($post, $metabox) {
2871
+					echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE);
2872 2872
 				},
2873 2873
 				$this->_current_screen->id,
2874 2874
 				'normal',
@@ -2878,17 +2878,17 @@  discard block
 block discarded – undo
2878 2878
 		}
2879 2879
 
2880 2880
 		//register message type metaboxes
2881
-		$mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php';
2882
-		foreach ( $mt_boxes as $box => $label ) {
2881
+		$mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php';
2882
+		foreach ($mt_boxes as $box => $label) {
2883 2883
 			$callback_args = array(
2884
-				'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ]
2884
+				'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box]
2885 2885
 			);
2886
-			$mt = str_replace( '_i_box', '', $box );
2886
+			$mt = str_replace('_i_box', '', $box);
2887 2887
 			add_meta_box(
2888
-				'espresso_' . $mt . '_inactive_mts',
2888
+				'espresso_'.$mt.'_inactive_mts',
2889 2889
 				$label,
2890
-				function( $post, $metabox ) {
2891
-					echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );
2890
+				function($post, $metabox) {
2891
+					echo EEH_Template::display_template($metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE);
2892 2892
 				},
2893 2893
 				$this->_current_screen->id,
2894 2894
 				'side',
@@ -2899,11 +2899,11 @@  discard block
 block discarded – undo
2899 2899
 
2900 2900
 		//register metabox for global messages settings but only when on the main site.  On single site installs this will
2901 2901
 		//always result in the metabox showing, on multisite installs the metabox will only show on the main site.
2902
-		if ( is_main_site() ) {
2902
+		if (is_main_site()) {
2903 2903
 			add_meta_box(
2904 2904
 				'espresso_global_message_settings',
2905
-				__( 'Global Message Settings', 'event_espresso' ),
2906
-				array( $this, 'global_messages_settings_metabox_content' ),
2905
+				__('Global Message Settings', 'event_espresso'),
2906
+				array($this, 'global_messages_settings_metabox_content'),
2907 2907
 				$this->_current_screen->id,
2908 2908
 				'normal',
2909 2909
 				'low',
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
 	public function global_messages_settings_metabox_content() {
2924 2924
 		$form = $this->_generate_global_settings_form();
2925 2925
 		echo $form->form_open(
2926
-			$this->add_query_args_and_nonce( array( 'action' => 'update_global_settings' ), EE_MSG_ADMIN_URL ),
2926
+			$this->add_query_args_and_nonce(array('action' => 'update_global_settings'), EE_MSG_ADMIN_URL),
2927 2927
 			'POST'
2928 2928
 		)
2929 2929
 		. $form->get_html()
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
 	 * @return EE_Form_Section_Proper
2937 2937
 	 */
2938 2938
 	protected function _generate_global_settings_form() {
2939
-		EE_Registry::instance()->load_helper( 'HTML' );
2939
+		EE_Registry::instance()->load_helper('HTML');
2940 2940
 		/** @var EE_Network_Core_Config $network_config */
2941 2941
 		$network_config = EE_Registry::instance()->NET_CFG->core;
2942 2942
 		return new EE_Form_Section_Proper(
@@ -2955,13 +2955,13 @@  discard block
 block discarded – undo
2955 2955
 							),
2956 2956
 							array(
2957 2957
 								'default' => $network_config->do_messages_on_same_request,
2958
-								'html_label_text' => __( 'Generate and send all messages:', 'event_espresso' ),
2959
-								'html_help_text' => __( 'By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system.  This makes things execute faster for people registering for your events.  However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso' ),
2958
+								'html_label_text' => __('Generate and send all messages:', 'event_espresso'),
2959
+								'html_help_text' => __('By default the messages system uses a more efficient means of processing messages on separate requests and utilizes the wp-cron scheduling system.  This makes things execute faster for people registering for your events.  However, if the wp-cron system is disabled on your site and there is no alternative in place, then you can change this so messages are always executed on the same request.', 'event_espresso'),
2960 2960
 							)
2961 2961
 						),
2962 2962
 						'update_settings' => new EE_Submit_Input(
2963 2963
 							array(
2964
-								'default' => __( 'Update', 'event_espresso' ),
2964
+								'default' => __('Update', 'event_espresso'),
2965 2965
 								'html_label_text' => '&nbsp'
2966 2966
 							)
2967 2967
 						)
@@ -2980,28 +2980,28 @@  discard block
 block discarded – undo
2980 2980
 		/** @var EE_Network_Core_Config $network_config */
2981 2981
 		$network_config = EE_Registry::instance()->NET_CFG->core;
2982 2982
 		$form = $this->_generate_global_settings_form();
2983
-		if ( $form->was_submitted() ) {
2983
+		if ($form->was_submitted()) {
2984 2984
 			$form->receive_form_submission();
2985
-			if ( $form->is_valid() ) {
2985
+			if ($form->is_valid()) {
2986 2986
 				$valid_data = $form->valid_data();
2987
-				foreach( $valid_data as $property => $value ) {
2988
-					$setter = 'set_' . $property;
2989
-					if ( method_exists( $network_config, $setter ) ) {
2990
-						$network_config->{$setter}( $value );
2987
+				foreach ($valid_data as $property => $value) {
2988
+					$setter = 'set_'.$property;
2989
+					if (method_exists($network_config, $setter)) {
2990
+						$network_config->{$setter}($value);
2991 2991
 					} else if (
2992
-						property_exists( $network_config, $property )
2992
+						property_exists($network_config, $property)
2993 2993
 						&& $network_config->{$property} !== $value
2994 2994
 					) {
2995 2995
 						$network_config->{$property} = $value;
2996 2996
 					}
2997 2997
 				}
2998 2998
 				//only update if the form submission was valid!
2999
-				EE_Registry::instance()->NET_CFG->update_config( true, false );
2999
+				EE_Registry::instance()->NET_CFG->update_config(true, false);
3000 3000
 				EE_Error::overwrite_success();
3001
-				EE_Error::add_success( __( 'Global message settings were updated', 'event_espresso' ) );
3001
+				EE_Error::add_success(__('Global message settings were updated', 'event_espresso'));
3002 3002
 			}
3003 3003
 		}
3004
-		$this->_redirect_after_action( 0, '', '', array( 'action' => 'settings' ), true );
3004
+		$this->_redirect_after_action(0, '', '', array('action' => 'settings'), true);
3005 3005
 	}
3006 3006
 
3007 3007
 
@@ -3012,13 +3012,13 @@  discard block
 block discarded – undo
3012 3012
 	 *
3013 3013
 	 * @return string            html formatted tabs
3014 3014
 	 */
3015
-	protected function _get_mt_tabs( $tab_array ) {
3015
+	protected function _get_mt_tabs($tab_array) {
3016 3016
 		$tab_array = (array) $tab_array;
3017
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php';
3017
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php';
3018 3018
 		$tabs = '';
3019 3019
 
3020
-		foreach ( $tab_array as $tab ) {
3021
-			$tabs .=  EEH_Template::display_template( $template, $tab, true );
3020
+		foreach ($tab_array as $tab) {
3021
+			$tabs .= EEH_Template::display_template($template, $tab, true);
3022 3022
 		}
3023 3023
 
3024 3024
 		return $tabs;
@@ -3034,29 +3034,29 @@  discard block
 block discarded – undo
3034 3034
 	 *
3035 3035
 	 * @return string            html formatted content
3036 3036
 	 */
3037
-	protected function _get_messenger_box_content( EE_messenger $messenger ) {
3037
+	protected function _get_messenger_box_content(EE_messenger $messenger) {
3038 3038
 
3039 3039
 		$fields = $messenger->get_admin_settings_fields();
3040 3040
 		$settings_template_args['template_form_fields'] = '';
3041 3041
 
3042 3042
 		//is $messenger active?
3043
-		$settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name );
3043
+		$settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name);
3044 3044
 
3045 3045
 
3046
-		if ( ! empty( $fields ) ) {
3046
+		if ( ! empty($fields)) {
3047 3047
 
3048 3048
 			$existing_settings = $messenger->get_existing_admin_settings();
3049 3049
 
3050
-			foreach( $fields as $fldname => $fldprops ) {
3051
-				$field_id = $messenger->name . '-' . $fldname;
3050
+			foreach ($fields as $fldname => $fldprops) {
3051
+				$field_id = $messenger->name.'-'.$fldname;
3052 3052
 				$template_form_field[$field_id] = array(
3053
-					'name' => 'messenger_settings[' . $field_id . ']',
3053
+					'name' => 'messenger_settings['.$field_id.']',
3054 3054
 					'label' => $fldprops['label'],
3055 3055
 					'input' => $fldprops['field_type'],
3056 3056
 					'type' => $fldprops['value_type'],
3057 3057
 					'required' => $fldprops['required'],
3058 3058
 					'validation' => $fldprops['validation'],
3059
-					'value' => isset( $existing_settings[$field_id])
3059
+					'value' => isset($existing_settings[$field_id])
3060 3060
 						? $existing_settings[$field_id]
3061 3061
 						: $fldprops['default'],
3062 3062
 					'css_class' => '',
@@ -3065,8 +3065,8 @@  discard block
 block discarded – undo
3065 3065
 			}
3066 3066
 
3067 3067
 
3068
-			$settings_template_args['template_form_fields'] = !empty($template_form_field)
3069
-				? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' )
3068
+			$settings_template_args['template_form_fields'] = ! empty($template_form_field)
3069
+				? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form')
3070 3070
 				: '';
3071 3071
 		}
3072 3072
 
@@ -3083,39 +3083,39 @@  discard block
 block discarded – undo
3083 3083
 			);
3084 3084
 
3085 3085
 		//make sure any active message types that are existing are included in the hidden fields
3086
-		if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) {
3087
-			foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) {
3086
+		if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) {
3087
+			foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) {
3088 3088
 				$settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array(
3089 3089
 						'type' => 'hidden',
3090 3090
 						'value' => $mt
3091 3091
 					);
3092 3092
 			}
3093 3093
 		}
3094
-		$settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields(
3095
-			$settings_template_args[ 'hidden_fields' ],
3094
+		$settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields(
3095
+			$settings_template_args['hidden_fields'],
3096 3096
 			'array'
3097 3097
 		);
3098
-		$active = $this->_message_resource_manager->is_messenger_active( $messenger->name );
3098
+		$active = $this->_message_resource_manager->is_messenger_active($messenger->name);
3099 3099
 
3100 3100
 		$settings_template_args['messenger'] = $messenger->name;
3101 3101
 		$settings_template_args['description'] = $messenger->description;
3102 3102
 		$settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden';
3103 3103
 
3104 3104
 
3105
-		$settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name )
3105
+		$settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name)
3106 3106
 			? $settings_template_args['show_hide_edit_form']
3107 3107
 			: ' hidden';
3108 3108
 
3109
-		$settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] )
3109
+		$settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields'])
3110 3110
 			? ' hidden'
3111 3111
 			: $settings_template_args['show_hide_edit_form'];
3112 3112
 
3113 3113
 
3114 3114
 		$settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on';
3115
-		$settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce');
3115
+		$settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce');
3116 3116
 		$settings_template_args['on_off_status'] = $active ? true : false;
3117
-		$template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php';
3118
-		$content = EEH_Template::display_template( $template, $settings_template_args, true);
3117
+		$template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php';
3118
+		$content = EEH_Template::display_template($template, $settings_template_args, true);
3119 3119
 		return $content;
3120 3120
 	}
3121 3121
 
@@ -3129,9 +3129,9 @@  discard block
 block discarded – undo
3129 3129
 		$success = true;
3130 3130
 		$this->_prep_default_response_for_messenger_or_message_type_toggle();
3131 3131
 		//let's check that we have required data
3132
-		if ( !isset( $this->_req_data[ 'messenger' ] ) ) {
3132
+		if ( ! isset($this->_req_data['messenger'])) {
3133 3133
 			EE_Error::add_error(
3134
-				__( 'Messenger name needed to toggle activation. None given', 'event_espresso' ),
3134
+				__('Messenger name needed to toggle activation. None given', 'event_espresso'),
3135 3135
 				__FILE__,
3136 3136
 				__FUNCTION__,
3137 3137
 				__LINE__
@@ -3140,14 +3140,14 @@  discard block
 block discarded – undo
3140 3140
 		}
3141 3141
 
3142 3142
 		//do a nonce check here since we're not arriving via a normal route
3143
-		$nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : '';
3144
-		$nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce';
3143
+		$nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : '';
3144
+		$nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce';
3145 3145
 
3146
-		$this->_verify_nonce( $nonce, $nonce_ref );
3146
+		$this->_verify_nonce($nonce, $nonce_ref);
3147 3147
 
3148 3148
 
3149 3149
 
3150
-		if ( !isset( $this->_req_data[ 'status' ])) {
3150
+		if ( ! isset($this->_req_data['status'])) {
3151 3151
 			EE_Error::add_error(
3152 3152
 				__(
3153 3153
 					'Messenger status needed to know whether activation or deactivation is happening. No status is given',
@@ -3163,11 +3163,11 @@  discard block
 block discarded – undo
3163 3163
 		//do check to verify we have a valid status.
3164 3164
 		$status = $this->_req_data['status'];
3165 3165
 
3166
-		if ( $status != 'off' && $status != 'on' ) {
3166
+		if ($status != 'off' && $status != 'on') {
3167 3167
 			EE_Error::add_error(
3168 3168
 				sprintf(
3169
-					__( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ),
3170
-					$this->_req_data[ 'status' ]
3169
+					__('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'),
3170
+					$this->_req_data['status']
3171 3171
 				),
3172 3172
 				__FILE__,
3173 3173
 				__FUNCTION__,
@@ -3176,11 +3176,11 @@  discard block
 block discarded – undo
3176 3176
 			$success = false;
3177 3177
 		}
3178 3178
 
3179
-		if ( $success ) {
3179
+		if ($success) {
3180 3180
 			//made it here?  Stop dawdling then!!
3181 3181
 			$success = $status == 'off'
3182
-				? $this->_deactivate_messenger( $this->_req_data['messenger'] )
3183
-				: $this->_activate_messenger( $this->_req_data['messenger'] );
3182
+				? $this->_deactivate_messenger($this->_req_data['messenger'])
3183
+				: $this->_activate_messenger($this->_req_data['messenger']);
3184 3184
 		}
3185 3185
 
3186 3186
 		$this->_template_args['success'] = $success;
@@ -3203,7 +3203,7 @@  discard block
 block discarded – undo
3203 3203
 		$this->_prep_default_response_for_messenger_or_message_type_toggle();
3204 3204
 
3205 3205
 		//let's make sure we have the necessary data
3206
-		if ( ! isset( $this->_req_data[ 'message_type' ] ) ) {
3206
+		if ( ! isset($this->_req_data['message_type'])) {
3207 3207
 			EE_Error::add_error(
3208 3208
 				__('Message Type name needed to toggle activation. None given', 'event_espresso'),
3209 3209
 				__FILE__, __FUNCTION__, __LINE__
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
 			$success = false;
3212 3212
 		}
3213 3213
 
3214
-		if ( ! isset( $this->_req_data[ 'messenger' ] ) ) {
3214
+		if ( ! isset($this->_req_data['messenger'])) {
3215 3215
 			EE_Error::add_error(
3216 3216
 				__('Messenger name needed to toggle activation. None given', 'event_espresso'),
3217 3217
 				__FILE__, __FUNCTION__, __LINE__
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
 			$success = false;
3220 3220
 		}
3221 3221
 
3222
-		if ( ! isset( $this->_req_data[ 'status' ])) {
3222
+		if ( ! isset($this->_req_data['status'])) {
3223 3223
 			EE_Error::add_error(
3224 3224
 				__('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'),
3225 3225
 				__FILE__, __FUNCTION__, __LINE__
@@ -3231,7 +3231,7 @@  discard block
 block discarded – undo
3231 3231
 		//do check to verify we have a valid status.
3232 3232
 		$status = $this->_req_data['status'];
3233 3233
 
3234
-		if ( $status != 'activate' && $status != 'deactivate' ) {
3234
+		if ($status != 'activate' && $status != 'deactivate') {
3235 3235
 			EE_Error::add_error(
3236 3236
 				sprintf(
3237 3237
 					__('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'),
@@ -3244,16 +3244,16 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
 
3246 3246
 		//do a nonce check here since we're not arriving via a normal route
3247
-		$nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : '';
3248
-		$nonce_ref = $this->_req_data['message_type'] . '_nonce';
3247
+		$nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : '';
3248
+		$nonce_ref = $this->_req_data['message_type'].'_nonce';
3249 3249
 
3250
-		$this->_verify_nonce( $nonce, $nonce_ref );
3250
+		$this->_verify_nonce($nonce, $nonce_ref);
3251 3251
 
3252
-		if ( $success ) {
3252
+		if ($success) {
3253 3253
 			//made it here? um, what are you waiting for then?
3254 3254
 			$success = $status == 'deactivate'
3255
-				? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] )
3256
-				: $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] );
3255
+				? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type'])
3256
+				: $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']);
3257 3257
 		}
3258 3258
 
3259 3259
 		$this->_template_args['success'] = $success;
@@ -3267,30 +3267,30 @@  discard block
 block discarded – undo
3267 3267
 	 * @param string $messenger_name The name of the messenger being activated
3268 3268
 	 * @return bool
3269 3269
 	 */
3270
-	protected function _activate_messenger( $messenger_name ) {
3270
+	protected function _activate_messenger($messenger_name) {
3271 3271
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3272
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3272
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3273 3273
 		$message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array();
3274 3274
 
3275 3275
 		//ensure is active
3276
-		$this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate );
3276
+		$this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate);
3277 3277
 
3278 3278
 		//set response_data for reload
3279
-		foreach( $message_types_to_activate as $message_type_name ) {
3279
+		foreach ($message_types_to_activate as $message_type_name) {
3280 3280
 			/** @var EE_message_type $message_type */
3281
-			$message_type = $this->_message_resource_manager->get_message_type( $message_type_name );
3282
-			if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name )
3281
+			$message_type = $this->_message_resource_manager->get_message_type($message_type_name);
3282
+			if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)
3283 3283
 			     && $message_type instanceof EE_message_type
3284 3284
 			) {
3285 3285
 				$this->_template_args['data']['active_mts'][] = $message_type_name;
3286
-				if ( $message_type->get_admin_settings_fields() ) {
3286
+				if ($message_type->get_admin_settings_fields()) {
3287 3287
 					$this->_template_args['data']['mt_reload'][] = $message_type_name;
3288 3288
 				}
3289 3289
 			}
3290 3290
 		}
3291 3291
 
3292 3292
 		//add success message for activating messenger
3293
-		return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger );
3293
+		return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger);
3294 3294
 
3295 3295
 	}
3296 3296
 
@@ -3301,11 +3301,11 @@  discard block
 block discarded – undo
3301 3301
 	 * @param string $messenger_name The name of the messenger being activated
3302 3302
 	 * @return bool
3303 3303
 	 */
3304
-	protected function _deactivate_messenger( $messenger_name ) {
3304
+	protected function _deactivate_messenger($messenger_name) {
3305 3305
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3306
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3307
-		$this->_message_resource_manager->deactivate_messenger( $messenger_name );
3308
-		return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger );
3306
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3307
+		$this->_message_resource_manager->deactivate_messenger($messenger_name);
3308
+		return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger);
3309 3309
 	}
3310 3310
 
3311 3311
 
@@ -3316,23 +3316,23 @@  discard block
 block discarded – undo
3316 3316
 	 * @param string $message_type_name  The name of the message type being activated for the messenger
3317 3317
 	 * @return bool
3318 3318
 	 */
3319
-	protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) {
3319
+	protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) {
3320 3320
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3321
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3321
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3322 3322
 		/** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/
3323
-		$message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name );
3323
+		$message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name);
3324 3324
 
3325 3325
 		//ensure is active
3326
-		$this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name );
3326
+		$this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name);
3327 3327
 
3328 3328
 		//set response for load
3329
-		if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) {
3329
+		if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) {
3330 3330
 			$this->_template_args['data']['active_mts'][] = $message_type_name;
3331
-			if ( $message_type_to_activate->get_admin_settings_fields() ) {
3331
+			if ($message_type_to_activate->get_admin_settings_fields()) {
3332 3332
 				$this->_template_args['data']['mt_reload'][] = $message_type_name;
3333 3333
 			}
3334 3334
 		}
3335
-		return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate );
3335
+		return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate);
3336 3336
 	}
3337 3337
 
3338 3338
 
@@ -3344,13 +3344,13 @@  discard block
 block discarded – undo
3344 3344
 	 * @param string $message_type_name  The name of the message type being deactivated for the messenger
3345 3345
 	 * @return bool
3346 3346
 	 */
3347
-	protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) {
3347
+	protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) {
3348 3348
 		/** @var EE_messenger $active_messenger  This will be present because it can't be toggled if it isn't*/
3349
-		$active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name );
3349
+		$active_messenger = $this->_message_resource_manager->get_messenger($messenger_name);
3350 3350
 		/** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/
3351
-		$message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name );
3352
-		$this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name );
3353
-		return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate );
3351
+		$message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name);
3352
+		$this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name);
3353
+		return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate);
3354 3354
 	}
3355 3355
 
3356 3356
 
@@ -3381,9 +3381,9 @@  discard block
 block discarded – undo
3381 3381
 		EE_Message_Type $message_type = null
3382 3382
 	) {
3383 3383
 		//if $messenger isn't a valid messenger object then get out.
3384
-		if ( ! $messenger instanceof EE_Messenger ) {
3384
+		if ( ! $messenger instanceof EE_Messenger) {
3385 3385
 			EE_Error::add_error(
3386
-				__( 'The messenger being activated is not a valid messenger', 'event_espresso' ),
3386
+				__('The messenger being activated is not a valid messenger', 'event_espresso'),
3387 3387
 				__FILE__,
3388 3388
 				__FUNCTION__,
3389 3389
 				__LINE__
@@ -3391,32 +3391,32 @@  discard block
 block discarded – undo
3391 3391
 			return false;
3392 3392
 		}
3393 3393
 		//activated
3394
-		if ( $this->_template_args['data']['active_mts'] ) {
3394
+		if ($this->_template_args['data']['active_mts']) {
3395 3395
 			EE_Error::overwrite_success();
3396 3396
 			//activated a message type with the messenger
3397
-			if ( $message_type instanceof EE_message_type ) {
3397
+			if ($message_type instanceof EE_message_type) {
3398 3398
 				EE_Error::add_success(
3399 3399
 					sprintf(
3400 3400
 						__('%s message type has been successfully activated with the %s messenger', 'event_espresso'),
3401
-						ucwords( $message_type->label['singular'] ),
3402
-						ucwords( $messenger->label['singular'] )
3401
+						ucwords($message_type->label['singular']),
3402
+						ucwords($messenger->label['singular'])
3403 3403
 					)
3404 3404
 				);
3405 3405
 
3406 3406
 				//if message type was invoice then let's make sure we activate the invoice payment method.
3407
-				if ( $message_type->name == 'invoice' ) {
3408
-					EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
3409
-					$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
3410
-					if ( $pm instanceof EE_Payment_Method ) {
3411
-						EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) );
3407
+				if ($message_type->name == 'invoice') {
3408
+					EE_Registry::instance()->load_lib('Payment_Method_Manager');
3409
+					$pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
3410
+					if ($pm instanceof EE_Payment_Method) {
3411
+						EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method.  If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso'));
3412 3412
 					}
3413 3413
 				}
3414 3414
 			//just toggles the entire messenger
3415 3415
 			} else {
3416 3416
 				EE_Error::add_success(
3417 3417
 					sprintf(
3418
-						__( '%s messenger has been successfully activated', 'event_espresso' ),
3419
-						ucwords( $messenger->label[ 'singular' ] )
3418
+						__('%s messenger has been successfully activated', 'event_espresso'),
3419
+						ucwords($messenger->label['singular'])
3420 3420
 					)
3421 3421
 				);
3422 3422
 			}
@@ -3426,12 +3426,12 @@  discard block
 block discarded – undo
3426 3426
 		//message types after the activation process.  However its possible some messengers don't HAVE any default_message_types
3427 3427
 		//in which case we just give a success message for the messenger being successfully activated.
3428 3428
 		} else {
3429
-			if ( ! $messenger->get_default_message_types() ) {
3429
+			if ( ! $messenger->get_default_message_types()) {
3430 3430
 				//messenger doesn't have any default message types so still a success.
3431 3431
 				EE_Error::add_success(
3432 3432
 					sprintf(
3433
-						__('%s messenger was successfully activated.', 'event_espresso' ),
3434
-						ucwords( $messenger->label['singular'] )
3433
+						__('%s messenger was successfully activated.', 'event_espresso'),
3434
+						ucwords($messenger->label['singular'])
3435 3435
 						)
3436 3436
 				);
3437 3437
 				return true;
@@ -3439,13 +3439,13 @@  discard block
 block discarded – undo
3439 3439
 				EE_Error::add_error(
3440 3440
 					$message_type instanceof EE_message_type
3441 3441
 						? sprintf(
3442
-						__( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ),
3443
-						ucwords( $message_type->label['singular'] ),
3444
-						ucwords( $messenger->label['singular'] )
3442
+						__('%s message type was not successfully activated with the %s messenger', 'event_espresso'),
3443
+						ucwords($message_type->label['singular']),
3444
+						ucwords($messenger->label['singular'])
3445 3445
 					)
3446 3446
 						: sprintf(
3447
-						__( '%s messenger was not successfully activated', 'event_espresso' ),
3448
-						ucwords( $messenger->label['singular'] )
3447
+						__('%s messenger was not successfully activated', 'event_espresso'),
3448
+						ucwords($messenger->label['singular'])
3449 3449
 					),
3450 3450
 					__FILE__,
3451 3451
 					__FUNCTION__,
@@ -3473,9 +3473,9 @@  discard block
 block discarded – undo
3473 3473
 		EE_Error::overwrite_success();
3474 3474
 
3475 3475
 		//if $messenger isn't a valid messenger object then get out.
3476
-		if ( ! $messenger instanceof EE_Messenger ) {
3476
+		if ( ! $messenger instanceof EE_Messenger) {
3477 3477
 			EE_Error::add_error(
3478
-				__( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ),
3478
+				__('The messenger being deactivated is not a valid messenger', 'event_espresso'),
3479 3479
 				__FILE__,
3480 3480
 				__FUNCTION__,
3481 3481
 				__LINE__
@@ -3483,13 +3483,13 @@  discard block
 block discarded – undo
3483 3483
 			return false;
3484 3484
 		}
3485 3485
 
3486
-		if ( $message_type instanceof EE_message_type ) {
3486
+		if ($message_type instanceof EE_message_type) {
3487 3487
 			$message_type_name = $message_type->name;
3488 3488
 			EE_Error::add_success(
3489 3489
 				sprintf(
3490 3490
 					__('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'),
3491
-					ucwords( $message_type->label['singular'] ),
3492
-					ucwords ( $messenger->label['singular'] )
3491
+					ucwords($message_type->label['singular']),
3492
+					ucwords($messenger->label['singular'])
3493 3493
 				)
3494 3494
 			);
3495 3495
 		} else {
@@ -3497,20 +3497,20 @@  discard block
 block discarded – undo
3497 3497
 			EE_Error::add_success(
3498 3498
 				sprintf(
3499 3499
 					__('%s messenger has been successfully deactivated.', 'event_espresso'),
3500
-					ucwords( $messenger->label['singular'] )
3500
+					ucwords($messenger->label['singular'])
3501 3501
 				)
3502 3502
 			);
3503 3503
 		}
3504 3504
 
3505 3505
 		//if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method.
3506
-		if ( $messenger->name == 'html'  || $message_type_name == 'invoice') {
3507
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
3508
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' );
3509
-			if ( $count_updated > 0 ) {
3506
+		if ($messenger->name == 'html' || $message_type_name == 'invoice') {
3507
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
3508
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice');
3509
+			if ($count_updated > 0) {
3510 3510
 				$msg = $message_type_name == 'invoice'
3511
-					? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' )
3512
-					: __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' );
3513
-				EE_Error::add_attention( $msg );
3511
+					? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso')
3512
+					: __('Deactivating the html messenger also automatically deactivates the invoice payment method.  In order for invoices to be generated the html messenger must be be active.  If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso');
3513
+				EE_Error::add_attention($msg);
3514 3514
 			}
3515 3515
 		}
3516 3516
 		return true;
@@ -3521,17 +3521,17 @@  discard block
 block discarded – undo
3521 3521
 	 * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax)
3522 3522
 	 */
3523 3523
 	public function update_mt_form() {
3524
-		if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) {
3525
-			EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ );
3524
+		if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) {
3525
+			EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__);
3526 3526
 			$this->_return_json();
3527 3527
 		}
3528 3528
 
3529 3529
 		$message_types = $this->get_installed_message_types();
3530 3530
 
3531
-		$message_type = $message_types[ $this->_req_data['message_type'] ];
3532
-		$messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] );
3531
+		$message_type = $message_types[$this->_req_data['message_type']];
3532
+		$messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']);
3533 3533
 
3534
-		$content = $this->_message_type_settings_content ( $message_type, $messenger, true );
3534
+		$content = $this->_message_type_settings_content($message_type, $messenger, true);
3535 3535
 		$this->_template_args['success'] = true;
3536 3536
 		$this->_template_args['content'] = $content;
3537 3537
 		$this->_return_json();
@@ -3545,45 +3545,45 @@  discard block
 block discarded – undo
3545 3545
 	 *
3546 3546
 	 */
3547 3547
 	public function save_settings() {
3548
-		if ( !isset( $this->_req_data['type'] ) ) {
3549
-			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3548
+		if ( ! isset($this->_req_data['type'])) {
3549
+			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3550 3550
 			$this->_template_args['error'] = true;
3551 3551
 			$this->_return_json();
3552 3552
 		}
3553 3553
 
3554 3554
 
3555
-		if ( $this->_req_data['type'] == 'messenger' ) {
3555
+		if ($this->_req_data['type'] == 'messenger') {
3556 3556
 			$settings = $this->_req_data['messenger_settings']; //this should be an array.
3557 3557
 			$messenger = $settings['messenger'];
3558 3558
 			//let's setup the settings data
3559
-			foreach ( $settings as $key => $value ) {
3560
-				switch ( $key ) {
3559
+			foreach ($settings as $key => $value) {
3560
+				switch ($key) {
3561 3561
 					case 'messenger' :
3562
-						unset( $settings['messenger'] );
3562
+						unset($settings['messenger']);
3563 3563
 						break;
3564 3564
 					case 'message_types' :
3565
-						unset( $settings['message_types'] );
3565
+						unset($settings['message_types']);
3566 3566
 						break;
3567 3567
 					default :
3568 3568
 						$settings[$key] = $value;
3569 3569
 						break;
3570 3570
 				}
3571 3571
 			}
3572
-			$this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings );
3572
+			$this->_message_resource_manager->add_settings_for_messenger($messenger, $settings);
3573 3573
 		}
3574 3574
 
3575
-		else if ( $this->_req_data['type'] == 'message_type' ) {
3575
+		else if ($this->_req_data['type'] == 'message_type') {
3576 3576
 			$settings = $this->_req_data['message_type_settings'];
3577 3577
 			$messenger = $settings['messenger'];
3578 3578
 			$message_type = $settings['message_type'];
3579 3579
 
3580
-			foreach ( $settings as $key => $value ) {
3581
-				switch ( $key ) {
3580
+			foreach ($settings as $key => $value) {
3581
+				switch ($key) {
3582 3582
 					case 'messenger' :
3583
-						unset( $settings['messenger'] );
3583
+						unset($settings['messenger']);
3584 3584
 						break;
3585 3585
 					case 'message_type' :
3586
-						unset( $settings['message_type'] );
3586
+						unset($settings['message_type']);
3587 3587
 						break;
3588 3588
 					default :
3589 3589
 						$settings[$key] = $value;
@@ -3591,16 +3591,16 @@  discard block
 block discarded – undo
3591 3591
 				}
3592 3592
 			}
3593 3593
 
3594
-			$this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings );
3594
+			$this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings);
3595 3595
 		}
3596 3596
 
3597 3597
 		//okay we should have the data all setup.  Now we just update!
3598 3598
 		$success = $this->_message_resource_manager->update_active_messengers_option();
3599 3599
 
3600
-		if ( $success ) {
3601
-			EE_Error::add_success( __('Settings updated', 'event_espresso') );
3600
+		if ($success) {
3601
+			EE_Error::add_success(__('Settings updated', 'event_espresso'));
3602 3602
 		} else {
3603
-			EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3603
+			EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
3604 3604
 		}
3605 3605
 
3606 3606
 		$this->_template_args['success'] = $success;
@@ -3622,8 +3622,8 @@  discard block
 block discarded – undo
3622 3622
      */
3623 3623
 	protected function _generate_now() {
3624 3624
 		$msg_ids = $this->_get_msg_ids_from_request();
3625
-		EED_Messages::generate_now( $msg_ids );
3626
-		$this->_redirect_after_action( false, '', '', array(), true );
3625
+		EED_Messages::generate_now($msg_ids);
3626
+		$this->_redirect_after_action(false, '', '', array(), true);
3627 3627
 	}
3628 3628
 
3629 3629
 
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
 	protected function _generate_and_send_now() {
3639 3639
 		$this->_generate_now();
3640 3640
 		$this->_send_now();
3641
-		$this->_redirect_after_action( false, '', '', array(), true );
3641
+		$this->_redirect_after_action(false, '', '', array(), true);
3642 3642
 	}
3643 3643
 
3644 3644
 
@@ -3652,8 +3652,8 @@  discard block
 block discarded – undo
3652 3652
      */
3653 3653
 	protected function _queue_for_resending() {
3654 3654
 		$msg_ids = $this->_get_msg_ids_from_request();
3655
-		EED_Messages::queue_for_resending( $msg_ids );
3656
-		$this->_redirect_after_action( false, '', '', array(), true );
3655
+		EED_Messages::queue_for_resending($msg_ids);
3656
+		$this->_redirect_after_action(false, '', '', array(), true);
3657 3657
 	}
3658 3658
 
3659 3659
 
@@ -3666,8 +3666,8 @@  discard block
 block discarded – undo
3666 3666
      */
3667 3667
 	protected function _send_now() {
3668 3668
 		$msg_ids = $this->_get_msg_ids_from_request();
3669
-		EED_Messages::send_now( $msg_ids );
3670
-		$this->_redirect_after_action( false, '', '', array(), true );
3669
+		EED_Messages::send_now($msg_ids);
3670
+		$this->_redirect_after_action(false, '', '', array(), true);
3671 3671
 	}
3672 3672
 
3673 3673
 
@@ -3681,23 +3681,23 @@  discard block
 block discarded – undo
3681 3681
 	protected function _delete_ee_messages() {
3682 3682
 		$msg_ids = $this->_get_msg_ids_from_request();
3683 3683
 		$deleted_count = 0;
3684
-		foreach ( $msg_ids as $msg_id ) {
3685
-			if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) {
3684
+		foreach ($msg_ids as $msg_id) {
3685
+			if (EEM_Message::instance()->delete_by_ID($msg_id)) {
3686 3686
 				$deleted_count++;
3687 3687
 			}
3688 3688
 		}
3689
-		if ( $deleted_count ) {
3689
+		if ($deleted_count) {
3690 3690
 			$this->_redirect_after_action(
3691 3691
 				true,
3692
-				_n( 'message', 'messages', $deleted_count, 'event_espresso' ),
3692
+				_n('message', 'messages', $deleted_count, 'event_espresso'),
3693 3693
 				__('deleted', 'event_espresso')
3694 3694
 			);
3695 3695
 		} else {
3696 3696
 			EE_Error::add_error(
3697
-				_n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ),
3697
+				_n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'),
3698 3698
 				__FILE__, __FUNCTION__, __LINE__
3699 3699
 			);
3700
-			$this->_redirect_after_action( false, '', '', array(), true );
3700
+			$this->_redirect_after_action(false, '', '', array(), true);
3701 3701
 		}
3702 3702
 	}
3703 3703
 
@@ -3710,10 +3710,10 @@  discard block
 block discarded – undo
3710 3710
      *  @return array
3711 3711
      */
3712 3712
 	protected function _get_msg_ids_from_request() {
3713
-		if ( ! isset( $this->_req_data['MSG_ID'] ) ) {
3713
+		if ( ! isset($this->_req_data['MSG_ID'])) {
3714 3714
 			return array();
3715 3715
 		}
3716
-		return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] );
3716
+		return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']);
3717 3717
 	}
3718 3718
 
3719 3719
 
Please login to merge, or discard this patch.
admin_pages/messages/Messages_Template_List_Table.class.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 	protected function _setup_data() {
44
-		$this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE);
45
-		$this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE );
44
+		$this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE);
45
+		$this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected function _set_properties() {
53 53
 		$this->_wp_list_args = array(
54
-			'singular' => __('Message Template Group', 'event_espresso' ),
55
-			'plural' => __('Message Template', 'event_espresso' ),
54
+			'singular' => __('Message Template Group', 'event_espresso'),
55
+			'plural' => __('Message Template', 'event_espresso'),
56 56
 			'ajax' => TRUE, //for now,
57 57
 			'screen' => $this->get_admin_page()->get_current_screen()->id
58 58
 			);
59 59
 		$this->_columns = array(
60 60
 			//'cb' => '<input type="checkbox" />', //no deleting default (global) templates!
61 61
 			'message_type' => __('Message Type', 'event_espresso'),
62
-			'messenger' => __( 'Messenger', 'event_espresso'),
63
-			'description' => __( 'Description', 'event_espresso' ),
62
+			'messenger' => __('Messenger', 'event_espresso'),
63
+			'description' => __('Description', 'event_espresso'),
64 64
 			//'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place.
65 65
 			);
66 66
 
67 67
 		$this->_sortable_columns = array(
68
-			'messenger' => array( 'MTP_messenger' => TRUE ),
68
+			'messenger' => array('MTP_messenger' => TRUE),
69 69
 			//'message_type' => array( 'MTP_message_type' => FALSE )
70 70
 			);
71 71
 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-	public function single_row( $item ) {
87
+	public function single_row($item) {
88 88
 		$message_type = $item->message_type_obj();
89 89
 		$messenger = $item->messenger_obj();
90 90
 
91
-		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) {
91
+		if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) {
92 92
 			echo '';
93 93
 			return;
94 94
 		}
95 95
 
96
-		parent::single_row( $item );
96
+		parent::single_row($item);
97 97
 	}
98 98
 
99 99
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 		);
112 112
 
113 113
 		//set filters to select inputs if they aren't empty
114
-		foreach ( $select_inputs as $select_input ) {
115
-			if ( $select_input ) {
114
+		foreach ($select_inputs as $select_input) {
115
+			if ($select_input) {
116 116
 				$filters[] = $select_input;
117 117
 			}
118 118
 		}
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 	 * we're just removing the search box for message templates, not needed.
124 124
 	 * @return string (empty);
125 125
 	 */
126
-	function search_box( $text, $input_id ) {
126
+	function search_box($text, $input_id) {
127 127
 		return '';
128 128
 	}
129 129
 
130 130
 
131 131
 	protected function _add_view_counts() {
132
-		foreach ( $this->_views as $view => $args )  {
133
-			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE );
132
+		foreach ($this->_views as $view => $args) {
133
+			$this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE);
134 134
 		}
135 135
 	}
136 136
 
137 137
 
138 138
 
139
-	public function column_cb( $item ) {
139
+	public function column_cb($item) {
140 140
 		return '';
141 141
 	}
142 142
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
 
147
-	function column_description( $item ) {
148
-		return '<p>' . $item->message_type_obj()->description . '</p>';
147
+	function column_description($item) {
148
+		return '<p>'.$item->message_type_obj()->description.'</p>';
149 149
 	}
150 150
 
151 151
 
@@ -160,27 +160,27 @@  discard block
 block discarded – undo
160 160
 		$actions = array();
161 161
 
162 162
 		// edit link but only if item isn't trashed.
163
-		if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) {
164
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL );
165
-			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>';
163
+		if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) {
164
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL);
165
+			$actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>';
166 166
 		}
167 167
 
168
-		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] );
168
+		$name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']);
169 169
 
170 170
 		//we want to display the contexts in here so we need to set them up
171 171
 		$c_label = $item->context_label();
172 172
 		$c_configs = $item->contexts_config();
173 173
 		$ctxt = array();
174 174
 		$context_templates = $item->context_templates();
175
-		foreach ( $context_templates as $context => $template_fields ) {
176
-			$mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
177
-			$inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : '';
175
+		foreach ($context_templates as $context => $template_fields) {
176
+			$mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL;
177
+			$inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : '';
178 178
 			$context_title = ucwords($c_configs[$context]['label']);
179
-			$edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL );
180
-			$ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title;
179
+			$edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL);
180
+			$ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title;
181 181
 		}
182 182
 
183
-		$ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : '';
183
+		$ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : '';
184 184
 
185 185
 
186 186
 		//Return the name contents
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 										/* $1%s */ $name_link,
189 189
 										/* $2%s */ $item->GRP_ID(),
190 190
 										/* %4$s */ $ctx_content,
191
-										/* $3%s */ $this->row_actions( $actions )
191
+										/* $3%s */ $this->row_actions($actions)
192 192
 		);
193 193
 	}
194 194
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return string       message_type name
199 199
 	 */
200 200
 	function column_message_type($item) {
201
-		return ucwords($item->message_type_obj()->label['singular'] );
201
+		return ucwords($item->message_type_obj()->label['singular']);
202 202
 	}
203 203
 
204 204
 
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 			)
226 226
 		);
227 227
 
228
-		foreach ( $active_message_template_groups_grouped_by_messenger as $active_message_template_group ) {
229
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
228
+		foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) {
229
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
230 230
 				$messenger = $active_message_template_group->messenger_obj();
231 231
 				$messenger_label = $messenger instanceof EE_messenger
232 232
 					? $messenger->label['singular']
233 233
 					: $active_message_template_group->messenger();
234
-				$messenger_options[ $active_message_template_group->messenger() ] = ucwords( $messenger_label );
234
+				$messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label);
235 235
 			}
236 236
 		}
237
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
237
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
238 238
 	}
239 239
 
240 240
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 			)
255 255
 		);
256 256
 
257
-		foreach ( $active_message_template_groups_grouped_by_message_type as $active_message_template_group ) {
258
-			if ( $active_message_template_group instanceof EE_Message_Template_Group ) {
257
+		foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) {
258
+			if ($active_message_template_group instanceof EE_Message_Template_Group) {
259 259
 				$message_type = $active_message_template_group->message_type_obj();
260 260
 				$message_type_label = $message_type instanceof EE_message_type
261 261
 					? $message_type->label['singular']
262 262
 					: $active_message_template_group->message_type();
263
-				$message_type_options[ $active_message_template_group->message_type() ] = ucwords( $message_type_label );
263
+				$message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label);
264 264
 			}
265 265
 		}
266
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
266
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
267 267
 	}
268 268
 
269 269
 }
Please login to merge, or discard this patch.
admin_pages/registrations/qtips/Registration_List_Table_Tips.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 	private function _registration_trash_message() {
95
-		return '<p>' . __('This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('This lock-icon means that this registration cannot be trashed.  Registrations that belong to a transaction that has payments cannot be trashed.  If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param  EEM_Registration constant $status What status is set (by class)
105 105
 	 * @return string         The status legend with the related status highlighted
106 106
 	 */
107
-	private function _registration_status_legend( $status ) {
107
+	private function _registration_status_legend($status) {
108 108
 
109 109
 		$status_array = array(
110 110
 			'approved_status' => EEM_Registration::status_id_approved,
@@ -114,6 +114,6 @@  discard block
 block discarded – undo
114 114
 			'cancelled_status' => EEM_Registration::status_id_cancelled
115 115
 			);
116 116
 
117
-		return EEH_Template::status_legend( $status_array, $status );
117
+		return EEH_Template::status_legend($status_array, $status);
118 118
 	}
119 119
 }
120 120
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/transactions/qtips/Transactions_List_Table_Tips.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param  EEM_Transaction constant $status What status is set (by class)
84 84
 	 * @return string         The status legend with the related status highlighted
85 85
 	 */
86
-	private function _transaction_status_legend( $status ) {
86
+	private function _transaction_status_legend($status) {
87 87
 
88 88
 		$status_array = array(
89 89
 			'overpaid' => EEM_Transaction::overpaid_status_code,
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
 			'failed' => EEM_Transaction::failed_status_code,
93 93
 		);
94 94
 
95
-		return EEH_Template::status_legend( $status_array, $status );
95
+		return EEH_Template::status_legend($status_array, $status);
96 96
 	}
97 97
 }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
 	/**
204 204
 	 * 		column_REG_att_checked_in
205
-	*/
205
+	 */
206 206
 	function column__REG_att_checked_in(EE_Registration $item){
207 207
 		$attendee = $item->attendee();
208 208
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * 		column_REG_final_price
291
-	*/
291
+	 */
292 292
 	function column__REG_final_price(EE_Registration $item){
293 293
 		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
294 294
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 	/**
301 301
 	 * 		column_TXN_paid
302
-	*/
302
+	 */
303 303
 	function column_TXN_paid(EE_Registration $item){
304 304
 
305 305
 		if ( $item->count() == 1 ) {
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
 	/**
328 328
 	 * 		column_TXN_total
329
-	*/
329
+	 */
330 330
 	function column_TXN_total(EE_Registration $item){
331 331
 		$txn = $item->transaction();
332 332
 		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 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
 
4 6
 class EE_Event_Registrations_List_Table extends EE_Admin_List_Table {
@@ -126,8 +128,9 @@  discard block
 block discarded – undo
126 128
 			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
127 129
 			foreach ( $events as $evt ) {
128 130
 				//any registrations for this event?
129
-				if ( ! $evt->get_count_of_all_registrations() )
130
-					continue;
131
+				if ( ! $evt->get_count_of_all_registrations() ) {
132
+									continue;
133
+				}
131 134
 				$evts[] = array( 'id' => $evt->ID(), 'text' => $evt->get('EVT_name') );
132 135
 			}
133 136
 			$filters[] = EEH_Form_Fields::select_input( 'event_id', $evts );
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71 71
 					'extra_request' => 
72 72
 						array( 
73 73
 							'EVT_ID'=> $evt_id, 
74
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
74
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}") )
75 75
 				)
76 76
 			);
77 77
 		}
78 78
 
79 79
 		$this->_sortable_columns = array(
80 80
 			 //true means its already sorted
81
-			'ATT_name' => array( 'ATT_name' => TRUE ),
82
-			'Event' => array( 'Event.EVT.Name' => FALSE )
81
+			'ATT_name' => array('ATT_name' => TRUE),
82
+			'Event' => array('Event.EVT.Name' => FALSE)
83 83
 		);
84 84
 
85 85
 		$this->_hidden_columns = array();
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
 
93 93
 
94
-	protected function _get_row_class( $item ) {
95
-		$class = parent::_get_row_class( $item );
94
+	protected function _get_row_class($item) {
95
+		$class = parent::_get_row_class($item);
96 96
 		//add status class
97
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
98
-		if ( $this->_has_checkbox_column ) {
97
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
98
+		if ($this->_has_checkbox_column) {
99 99
 			$class .= ' has-checkbox-column';
100 100
 		}
101 101
 		return $class;
@@ -107,42 +107,42 @@  discard block
 block discarded – undo
107 107
 		$filters = $where = array();
108 108
 
109 109
 
110
-		if ( empty( $this->_dtts_for_event ) ) {
110
+		if (empty($this->_dtts_for_event)) {
111 111
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
112 112
 			//note possible capability restrictions
113
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
114
-				$where['status**'] =  array( '!=', 'private' );
113
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
114
+				$where['status**'] = array('!=', 'private');
115 115
 			}
116 116
 
117
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
118
-				$where['EVT_wp_user'] =  get_current_user_id();
117
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
118
+				$where['EVT_wp_user'] = get_current_user_id();
119 119
 			}
120 120
 
121
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
122
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
123
-			foreach ( $events as $evt ) {
121
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
122
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
123
+			foreach ($events as $evt) {
124 124
 				//any registrations for this event?
125
-				if ( ! $evt->get_count_of_all_registrations() )
125
+				if ( ! $evt->get_count_of_all_registrations())
126 126
 					continue;
127 127
 				$evts[] = array(
128 128
 					'id' => $evt->ID(),
129
-					'text' => $evt->get( 'EVT_name' ),
129
+					'text' => $evt->get('EVT_name'),
130 130
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
131 131
 				);
132 132
 			}
133 133
 			$event_filter = '<div class="ee-event-filter">';
134
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
135
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
134
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
135
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
136 136
 			$event_filter .= '</div>';
137 137
 			$filters[] = $event_filter;
138 138
 
139 139
 		} else {
140 140
 			//DTT datetimes filter
141
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
141
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
142 142
 			$dtts = array();
143
-			foreach ( $this->_dtts_for_event as $dtt ) {
144
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
145
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
143
+			foreach ($this->_dtts_for_event as $dtt) {
144
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
145
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
146 146
 			}
147 147
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
148 148
 		}
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
 
164 164
 
165 165
 	protected function _get_total_event_attendees() {
166
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
167
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
166
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
167
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
168 168
 		$query_params = array();
169
-		if ($EVT_ID){
170
-			$query_params[0]['EVT_ID']=$EVT_ID;
169
+		if ($EVT_ID) {
170
+			$query_params[0]['EVT_ID'] = $EVT_ID;
171 171
 		}
172 172
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
173
-		if ( $DTT_ID ) {
173
+		if ($DTT_ID) {
174 174
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
175 175
 		}
176
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
176
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
177 177
 
178
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
178
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
179 179
 
180 180
 		return EEM_Registration::instance()->count($query_params);
181 181
 	}
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 
187 187
 
188 188
 
189
-	function column__Reg_Status( EE_Registration $item ) {
190
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
189
+	function column__Reg_Status(EE_Registration $item) {
190
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
191 191
 	}
192 192
 
193 193
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 
197 197
 	function column_cb($item) {
198
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
198
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
199 199
 	}
200 200
 
201 201
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	/**
209 209
 	 * 		column_REG_att_checked_in
210 210
 	*/
211
-	function column__REG_att_checked_in(EE_Registration $item){
211
+	function column__REG_att_checked_in(EE_Registration $item) {
212 212
 		$attendee = $item->attendee();
213 213
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
214
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
214
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
215 215
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
216 216
 		$nonce = wp_create_nonce('checkin_nonce');
217
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
218
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
217
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
218
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
219 219
 
220
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
220
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
221 221
 
222
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
222
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
223 223
 	}
224 224
 
225 225
 
@@ -228,45 +228,45 @@  discard block
 block discarded – undo
228 228
 
229 229
 	function column_ATT_name(EE_Registration $item) {
230 230
 		$attendee = $item->attendee();
231
-		if ( ! $attendee instanceof EE_Attendee ) {
231
+		if ( ! $attendee instanceof EE_Attendee) {
232 232
 			return __('No contact record for this registration.', 'event_espresso');
233 233
 		}
234 234
 
235 235
 		// edit attendee link
236
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
237
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
236
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
237
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
238 238
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
239 239
 
240 240
 		//add group details
241
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
241
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
242 242
 
243 243
 		//add regcode
244
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
244
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
245 245
 		$name_link .= '<br>';
246
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
247
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
246
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
247
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
248 248
 			: $item->reg_code();
249 249
 
250 250
 		//status
251
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
251
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
252 252
 
253 253
 		$actions = array();
254
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
255
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
254
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
255
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
256 256
 
257
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
258
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
257
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
258
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
259
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
260 260
 		}
261 261
 
262 262
 
263 263
 
264
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
264
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
265 265
 	}
266 266
 
267 267
 
268 268
 
269
-	function column_ATT_email( EE_Registration $item ) {
269
+	function column_ATT_email(EE_Registration $item) {
270 270
 		$attendee = $item->attendee();
271 271
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
272 272
 		return $item->get_first_related('Attendee')->email();
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 	function column_Event(EE_Registration $item) {
280 280
 		try {
281 281
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
282
-			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
283
-			$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
284
-		} catch( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
285
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
282
+			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
283
+			$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
284
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
285
+			$event_label = esc_html__('Unknown', 'event_espresso');
286 286
 		}
287 287
 
288 288
 		return $event_label;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 
294 294
 
295
-	function column_PRC_name(EE_Registration $item){
295
+	function column_PRC_name(EE_Registration $item) {
296 296
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
297 297
 	}
298 298
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * 		column_REG_final_price
306 306
 	*/
307
-	function column__REG_final_price(EE_Registration $item){
308
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
307
+	function column__REG_final_price(EE_Registration $item) {
308
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
309 309
 	}
310 310
 
311 311
 
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
 	/**
316 316
 	 * 		column_TXN_paid
317 317
 	*/
318
-	function column_TXN_paid(EE_Registration $item){
318
+	function column_TXN_paid(EE_Registration $item) {
319 319
 
320
-		if ( $item->count() == 1 ) {
320
+		if ($item->count() == 1) {
321 321
 
322
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
322
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
323 323
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
324 324
 			} else {
325
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
326
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
325
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
326
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
327 327
 				<span class="reg-pad-rght">
328
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
329
-						' . $item->transaction()->pretty_paid(). '
328
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
329
+						' . $item->transaction()->pretty_paid().'
330 330
 					</a>
331
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
331
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
332 332
 			}
333 333
 		} else {
334 334
 			return '<span class="reg-pad-rght"></span>';
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 	/**
343 343
 	 * 		column_TXN_total
344 344
 	*/
345
-	function column_TXN_total(EE_Registration $item){
345
+	function column_TXN_total(EE_Registration $item) {
346 346
 		$txn = $item->transaction();
347
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
348
-		if ( $item->get('REG_count') == 1 ) {
347
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
348
+		if ($item->get('REG_count') == 1) {
349 349
 			$line_total_obj = $txn->total_line_item();
350 350
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
351
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
351
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
352 352
 		} else {
353 353
 			return '<span class="reg-pad-rght"></span>';
354 354
 		}
Please login to merge, or discard this patch.
core/EE_Cart.core.php 3 patches
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
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 5
 /**
4 6
  * Event Espresso
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /**
3 3
  *
4 4
  * Event Espresso
5 5
  *
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 	  * @param EE_Session $session
68 68
 	  * @return \EE_Cart
69 69
 	  */
70
-	 public static function instance( EE_Line_Item $grand_total = null, EE_Session $session = null ) {
71
-		if ( ! empty( $grand_total ) ){
72
-			self::$_instance = new self( $grand_total, $session );
70
+	 public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) {
71
+		if ( ! empty($grand_total)) {
72
+			self::$_instance = new self($grand_total, $session);
73 73
 		}
74 74
 		// or maybe retrieve an existing one ?
75
-		if ( ! self::$_instance instanceof EE_Cart ) {
75
+		if ( ! self::$_instance instanceof EE_Cart) {
76 76
 			// try getting the cart out of the session
77 77
 			$saved_cart = $session instanceof EE_Session ? $session->cart() : null;
78
-			self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self( $grand_total, $session );
79
-			unset( $saved_cart );
78
+			self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session);
79
+			unset($saved_cart);
80 80
 		}
81 81
 		// verify that cart is ok and grand total line item exists
82
-		if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item ) {
83
-			self::$_instance = new self( $grand_total, $session );
82
+		if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) {
83
+			self::$_instance = new self($grand_total, $session);
84 84
 		}
85 85
 		self::$_instance->get_grand_total();
86 86
 		 // once everything is all said and done, save the cart to the EE_Session
87
-		add_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 );
87
+		add_action('shutdown', array(self::$_instance, 'save_cart'), 90);
88 88
 		return self::$_instance;
89 89
 	}
90 90
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	  * @param EE_Session $session
99 99
 	  * @return \EE_Cart
100 100
 	  */
101
-	 private function __construct( EE_Line_Item $grand_total = null, EE_Session $session = null ) {
102
-		 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
103
-		 $this->set_session( $session );
104
-		 if ( $grand_total instanceof EE_Line_Item ) {
105
-			 $this->set_grand_total_line_item( $grand_total );
101
+	 private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) {
102
+		 do_action('AHEE_log', __FILE__, __FUNCTION__, '');
103
+		 $this->set_session($session);
104
+		 if ($grand_total instanceof EE_Line_Item) {
105
+			 $this->set_grand_total_line_item($grand_total);
106 106
 		 }
107 107
 	 }
108 108
 
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 	  * @param EE_Session $session
115 115
 	  * @return EE_Cart
116 116
 	  */
117
-	 public static function reset( EE_Line_Item $grand_total = null, EE_Session $session = null ) {
118
-		 remove_action( 'shutdown', array( self::$_instance, 'save_cart' ), 90 );
119
-		 if ( $session instanceof EE_Session ) {
117
+	 public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) {
118
+		 remove_action('shutdown', array(self::$_instance, 'save_cart'), 90);
119
+		 if ($session instanceof EE_Session) {
120 120
 			 $session->reset_cart();
121 121
 		 }
122 122
 		 self::$_instance = null;
123
-		 return self::instance( $grand_total, $session );
123
+		 return self::instance($grand_total, $session);
124 124
 	 }
125 125
 
126 126
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 /**
129 129
 	  * @param EE_Session $session
130 130
 	  */
131
-	 public function set_session( EE_Session $session = null ) {
132
-		 $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core( 'Session' );
131
+	 public function set_session(EE_Session $session = null) {
132
+		 $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session');
133 133
 	 }
134 134
 
135 135
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	  *  know the grand total line item on it
140 140
 	  * @param EE_Line_Item $line_item
141 141
 	  */
142
-	 public function set_grand_total_line_item( EE_Line_Item $line_item ) {
142
+	 public function set_grand_total_line_item(EE_Line_Item $line_item) {
143 143
 		 $this->_grand_total = $line_item;
144 144
 	 }
145 145
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	  * @param EE_Session $session
153 153
 	  * @return \EE_Cart
154 154
 	  */
155
-	public static function get_cart_from_txn( EE_Transaction $transaction, EE_Session $session = null ) {
155
+	public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) {
156 156
 		$grand_total = $transaction->total_line_item();
157 157
 		$grand_total->get_items();
158 158
 		$grand_total->tax_descendants();
159
-		return EE_Cart::instance( $grand_total, $session );
159
+		return EE_Cart::instance($grand_total, $session);
160 160
 	}
161 161
 
162 162
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items
166 166
 	 * @return EE_Line_Item
167 167
 	 */
168
-	private function _create_grand_total(){
168
+	private function _create_grand_total() {
169 169
 		$this->_grand_total = EEH_Line_Item::create_total_line_item();
170 170
 		return $this->_grand_total;
171 171
 	}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 *	@return \EE_Line_Item[]
179 179
 	 */
180 180
 	public function get_tickets() {
181
-		return EEH_Line_Item::get_ticket_line_items( $this->_grand_total );
181
+		return EEH_Line_Item::get_ticket_line_items($this->_grand_total);
182 182
 	}
183 183
 
184 184
 
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function all_ticket_quantity_count() {
193 193
 		$tickets = $this->get_tickets();
194
-		if ( empty( $tickets )) {
194
+		if (empty($tickets)) {
195 195
 			return 0;
196 196
 		}
197 197
 		$count = 0;
198
-		foreach ( $tickets as $ticket ) {
198
+		foreach ($tickets as $ticket) {
199 199
 			$count = $count + $ticket->get('LIN_quantity');
200 200
 		}
201 201
 		return $count;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 *  Gets all the tax line items
208 208
 	 * @return \EE_Line_Item[]
209 209
 	 */
210
-	public function get_taxes(){
211
-		return EEH_Line_Item::get_taxes_subtotal( $this->_grand_total )->children();
210
+	public function get_taxes() {
211
+		return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children();
212 212
 	}
213 213
 
214 214
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * Gets the total line item (which is a parent of all other line items) on this cart
218 218
 	 * @return EE_Line_Item
219 219
 	 */
220
-	public function get_grand_total(){
220
+	public function get_grand_total() {
221 221
 		return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total();
222 222
 	}
223 223
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 *	@param int $qty
231 231
 	 *	@return TRUE on success, FALSE on fail
232 232
 	 */
233
-	public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) {
234
-		EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty );
233
+	public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) {
234
+		EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty);
235 235
 		return $this->save_cart() ? TRUE : FALSE;
236 236
 	}
237 237
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 *	@return float
255 255
 	 */
256 256
 	public function get_applied_taxes() {
257
-		return EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
257
+		return EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
258 258
 	}
259 259
 
260 260
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *	@return float
266 266
 	 */
267 267
 	public function get_cart_grand_total() {
268
-		EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
268
+		EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
269 269
 		return $this->get_grand_total()->total();
270 270
 	}
271 271
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function recalculate_all_cart_totals() {
280 280
 		$pre_tax_total = $this->get_cart_total_before_tax();
281
-		$taxes_total = EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
282
-		$this->_grand_total->set_total( $pre_tax_total + $taxes_total );
281
+		$taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
282
+		$this->_grand_total->set_total($pre_tax_total + $taxes_total);
283 283
 		$this->_grand_total->save_this_and_descendants_to_txn();
284 284
 		return $this->get_grand_total()->total();
285 285
 	}
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 *	@param array|bool|string $line_item_codes
293 293
 	 *	@return int on success, FALSE on fail
294 294
 	 */
295
-	public function delete_items( $line_item_codes = FALSE ) {
296
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
297
-		return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes );
295
+	public function delete_items($line_item_codes = FALSE) {
296
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
297
+		return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes);
298 298
 	}
299 299
 
300 300
 
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 	 *	@return bool
306 306
 	 */
307 307
 	public function empty_cart() {
308
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
308
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
309 309
 		$this->_grand_total = $this->_create_grand_total();
310
-		return $this->save_cart( TRUE );
310
+		return $this->save_cart(TRUE);
311 311
 	}
312 312
 
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 *	@return bool
319 319
 	 */
320 320
 	public function delete_cart() {
321
-		$deleted = EEH_Line_Item::delete_all_child_items( $this->_grand_total );
322
-		if ( $deleted ) {
321
+		$deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total);
322
+		if ($deleted) {
323 323
 			$deleted += $this->_grand_total->delete();
324 324
 			$this->_grand_total = null;
325 325
 		}
@@ -334,17 +334,17 @@  discard block
 block discarded – undo
334 334
 	  * @param bool $apply_taxes
335 335
 	  * @return TRUE on success, FALSE on fail
336 336
 	  */
337
-	public function save_cart( $apply_taxes = TRUE ) {
338
-		if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) {
339
-			EEH_Line_Item::ensure_taxes_applied( $this->_grand_total );
337
+	public function save_cart($apply_taxes = TRUE) {
338
+		if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) {
339
+			EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
340 340
 			//make sure we don't cache the transaction because it can get stale
341
-			if( $this->_grand_total->get_one_from_cache( 'Transaction' ) instanceof EE_Transaction &&
342
-				$this->_grand_total->get_one_from_cache( 'Transaction' )->ID()) {
343
-				$this->_grand_total->clear_cache( 'Transaction', null, true );
341
+			if ($this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction &&
342
+				$this->_grand_total->get_one_from_cache('Transaction')->ID()) {
343
+				$this->_grand_total->clear_cache('Transaction', null, true);
344 344
 			}
345 345
 		}
346
-		if ( $this->_session instanceof EE_Session ) {
347
-			return $this->_session->set_cart( $this );
346
+		if ($this->_session instanceof EE_Session) {
347
+			return $this->_session->set_cart($this);
348 348
 		} else {
349 349
 			return false;
350 350
 		}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 *	@access public
229 229
 	 *	@param EE_Ticket $ticket
230 230
 	 *	@param int $qty
231
-	 *	@return TRUE on success, FALSE on fail
231
+	 *	@return boolean on success, FALSE on fail
232 232
 	 */
233 233
 	public function add_ticket_to_cart( EE_Ticket $ticket, $qty = 1 ) {
234 234
 		EEH_Line_Item::add_ticket_purchase( $this->get_grand_total(), $ticket, $qty );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	  * @save cart to session
333 333
 	  * @access public
334 334
 	  * @param bool $apply_taxes
335
-	  * @return TRUE on success, FALSE on fail
335
+	  * @return boolean on success, FALSE on fail
336 336
 	  */
337 337
 	public function save_cart( $apply_taxes = TRUE ) {
338 338
 		if ( $apply_taxes && $this->_grand_total instanceof EE_Line_Item ) {
Please login to merge, or discard this patch.
core/admin/templates/admin_details_legend.template.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
 //this displays any legends with an array of $items that are indexed by id for each item and each item itself is an array of 'icon' and 'desc'.
3 3
 
4 4
 //figure out the columns based on the count of items (we want a max of 6 items per column).
5
-$per_col = isset( $per_column ) ? $per_column : 5;
5
+$per_col = isset($per_column) ? $per_column : 5;
6 6
 $count = 1;
7 7
 ?>
8 8
 <div class="ee-list-table-legend-container">
9 9
 	<h4><?php _e('Legend', 'event_espresso'); ?></h4>
10 10
 	<dl class="alignleft ee-list-table-legend">
11
-		<?php foreach ( $items as $item => $details ) : ?>
12
-			<?php if ( $per_col < $count ) : ?>
11
+		<?php foreach ($items as $item => $details) : ?>
12
+			<?php if ($per_col < $count) : ?>
13 13
 				</dl>
14 14
 				<dl class="alignleft ee-list-table-legend">
15 15
 			<?php $count = 1; endif; ?>
16 16
 			<dt id="ee-legend-item-<?php echo $item; ?>">
17
-				<?php $class = ! empty( $details['class'] ) ? $details['class'] : 'ee-legend-img-container'; ?>
18
-				<?php if ( strpos( $details[ 'class' ], '<span' ) !== false ) {
17
+				<?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?>
18
+				<?php if (strpos($details['class'], '<span') !== false) {
19 19
 					echo $class;
20 20
 				} else { ?>
21 21
 				<span class="<?php echo $class; ?>">
22
-					<?php if ( ! empty( $details[ 'icon' ] ) ) : ?>
23
-						<img src="<?php echo $details[ 'icon' ]; ?>" class="ee-legend-icon" alt="<?php echo esc_attr( $details[ 'desc' ] ); ?>"/>
22
+					<?php if ( ! empty($details['icon'])) : ?>
23
+						<img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" alt="<?php echo esc_attr($details['desc']); ?>"/>
24 24
 					<?php endif; ?>
25 25
 				</span>
26 26
 				<?php } ?>
Please login to merge, or discard this patch.