Completed
Branch BUG-9583-fix-fetching-term-rel... (646110)
by
unknown
539:15 queued 523:53
created
core/libraries/messages/EE_Messages_Queue.lib.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -534,7 +534,7 @@
 block discarded – undo
534 534
 *@param EE_Message            $message
535 535
 	 * @param EE_Messenger    $messenger
536 536
 	 * @param EE_message_type $message_type
537
-	 * @param $test_send
537
+	 * @param boolean $test_send
538 538
 	 * @return bool   true means all went well, false means, not so much.
539 539
 	 */
540 540
 	protected function _do_preview( EE_Message $message, EE_Messenger $messenger, EE_message_type $message_type, $test_send ) {
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param \EE_Message_Repository       $message_repository
73 73
 	 */
74
-	public function __construct( EE_Message_Repository $message_repository ) {
75
-		$this->_batch_count        = apply_filters( 'FHEE__EE_Messages_Queue___batch_count', 50 );
74
+	public function __construct(EE_Message_Repository $message_repository) {
75
+		$this->_batch_count        = apply_filters('FHEE__EE_Messages_Queue___batch_count', 50);
76 76
 		$this->_rate_limit         = $this->get_rate_limit();
77 77
 		$this->_message_repository = $message_repository;
78 78
 	}
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 *                                 use the messenger send method but typically is based on preview data.
92 92
 	 * @return bool          Whether the message was successfully added to the repository or not.
93 93
 	 */
94
-	public function add( EE_Message $message, $data = array(), $preview = false, $test_send = false ) {
94
+	public function add(EE_Message $message, $data = array(), $preview = false, $test_send = false) {
95 95
 		$data['preview'] = $preview;
96 96
 		$data['test_send'] = $test_send;
97
-		return $this->_message_repository->add( $message, $data );
97
+		return $this->_message_repository->add($message, $data);
98 98
 	}
99 99
 
100 100
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	 * @param bool          $persist    This flag indicates whether to attempt to delete the object from the db as well.
107 107
 	 * @return bool
108 108
 	 */
109
-	public function remove( EE_Message $message, $persist = false ) {
110
-		if ( $persist && $this->_message_repository->current() !== $message ) {
109
+	public function remove(EE_Message $message, $persist = false) {
110
+		if ($persist && $this->_message_repository->current() !== $message) {
111 111
 			//get pointer on right message
112
-			if ( $this->_message_repository->has( $message ) ) {
112
+			if ($this->_message_repository->has($message)) {
113 113
 				$this->_message_repository->rewind();
114
-				while( $this->_message_repository->valid() ) {
115
-					if ( $this->_message_repository->current() === $message ) {
114
+				while ($this->_message_repository->valid()) {
115
+					if ($this->_message_repository->current() === $message) {
116 116
 						break;
117 117
 					}
118 118
 					$this->_message_repository->next();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				return false;
122 122
 			}
123 123
 		}
124
-		return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove( $message );
124
+		return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove($message);
125 125
 	}
126 126
 
127 127
 
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
 	 * @return bool  true if successfully retrieved batch, false no batch ready.
162 162
 	 */
163 163
 	public function get_batch_to_generate() {
164
-		if ( $this->is_locked( EE_Messages_Queue::action_generating ) ) {
164
+		if ($this->is_locked(EE_Messages_Queue::action_generating)) {
165 165
 			return false;
166 166
 		}
167 167
 
168 168
 		//lock batch generation to prevent race conditions.
169
-		$this->lock_queue( EE_Messages_Queue::action_generating );
169
+		$this->lock_queue(EE_Messages_Queue::action_generating);
170 170
 
171 171
 		$query_args = array(
172 172
 			// key 0 = where conditions
173
-			0 => array( 'STS_ID' => EEM_Message::status_incomplete ),
173
+			0 => array('STS_ID' => EEM_Message::status_incomplete),
174 174
 			'order_by' => $this->_get_priority_orderby(),
175 175
 			'limit' => $this->_batch_count
176 176
 		);
177
-		$messages = EEM_Message::instance()->get_all( $query_args );
177
+		$messages = EEM_Message::instance()->get_all($query_args);
178 178
 
179
-		if ( ! $messages ) {
179
+		if ( ! $messages) {
180 180
 			return false; //nothing to generate
181 181
 		}
182 182
 
183
-		foreach ( $messages as $message ) {
184
-			if ( $message instanceof EE_Message ) {
183
+		foreach ($messages as $message) {
184
+			if ($message instanceof EE_Message) {
185 185
 				$data = $message->all_extra_meta_array();
186
-				$this->add( $message, $data );
186
+				$this->add($message, $data);
187 187
 			}
188 188
 		}
189 189
 		return true;
@@ -206,34 +206,34 @@  discard block
 block discarded – undo
206 206
 	 *               to assist with notifying user.
207 207
 	 */
208 208
 	public function get_to_send_batch_and_send() {
209
-		if ( $this->is_locked( EE_Messages_Queue::action_sending ) || $this->_rate_limit < 1 ) {
209
+		if ($this->is_locked(EE_Messages_Queue::action_sending) || $this->_rate_limit < 1) {
210 210
 			return false;
211 211
 		}
212 212
 
213
-		$this->lock_queue( EE_Messages_Queue::action_sending );
213
+		$this->lock_queue(EE_Messages_Queue::action_sending);
214 214
 
215 215
 		$batch = $this->_batch_count < $this->_rate_limit ? $this->_batch_count : $this->_rate_limit;
216 216
 
217 217
 		$query_args = array(
218 218
 			// key 0 = where conditions
219
-			0 => array( 'STS_ID' => array( 'IN', EEM_Message::instance()->stati_indicating_to_send() ) ),
219
+			0 => array('STS_ID' => array('IN', EEM_Message::instance()->stati_indicating_to_send())),
220 220
 			'order_by' => $this->_get_priority_orderby(),
221 221
 			'limit' => $batch
222 222
 		);
223 223
 
224
-		$messages_to_send = EEM_Message::instance()->get_all( $query_args );
224
+		$messages_to_send = EEM_Message::instance()->get_all($query_args);
225 225
 
226 226
 
227 227
 		//any to send?
228
-		if ( ! $messages_to_send ) {
229
-			$this->unlock_queue( EE_Messages_Queue::action_sending );
228
+		if ( ! $messages_to_send) {
229
+			$this->unlock_queue(EE_Messages_Queue::action_sending);
230 230
 			return false;
231 231
 		}
232 232
 
233 233
 		//add to queue.
234
-		foreach ( $messages_to_send as $message ) {
235
-			if ( $message instanceof EE_Message ) {
236
-				$this->add( $message );
234
+		foreach ($messages_to_send as $message) {
235
+			if ($message instanceof EE_Message) {
236
+				$this->add($message);
237 237
 			}
238 238
 		}
239 239
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$this->execute();
242 242
 
243 243
 		//release lock
244
-		$this->unlock_queue( EE_Messages_Queue::action_sending );
244
+		$this->unlock_queue(EE_Messages_Queue::action_sending);
245 245
 		return true;
246 246
 	}
247 247
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param   string  $type   The type of queue being locked.
255 255
 	 */
256
-	public function lock_queue( $type = EE_Messages_Queue::action_generating ) {
257
-		set_transient( $this->_get_lock_key( $type ), 1, $this->_get_lock_expiry( $type ) );
256
+	public function lock_queue($type = EE_Messages_Queue::action_generating) {
257
+		set_transient($this->_get_lock_key($type), 1, $this->_get_lock_expiry($type));
258 258
 	}
259 259
 
260 260
 
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @param   string  $type   The type of queue being unlocked.
267 267
 	 */
268
-	public function unlock_queue( $type = EE_Messages_Queue::action_generating ) {
269
-		delete_transient( $this->_get_lock_key( $type ) );
268
+	public function unlock_queue($type = EE_Messages_Queue::action_generating) {
269
+		delete_transient($this->_get_lock_key($type));
270 270
 	}
271 271
 
272 272
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 * @param string $type  The type of lock.
278 278
 	 * @return string
279 279
 	 */
280
-	protected function _get_lock_key( $type = EE_Messages_Queue::action_generating ) {
281
-		return '_ee_lock_' . $type;
280
+	protected function _get_lock_key($type = EE_Messages_Queue::action_generating) {
281
+		return '_ee_lock_'.$type;
282 282
 	}
283 283
 
284 284
 
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 * @param string $type  The type of lock
290 290
 	 * @return int   time to expiry in seconds.
291 291
 	 */
292
-	protected function _get_lock_expiry( $type = EE_Messages_Queue::action_generating ) {
293
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type );
292
+	protected function _get_lock_expiry($type = EE_Messages_Queue::action_generating) {
293
+		return (int) apply_filters('FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type);
294 294
 	}
295 295
 
296 296
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return int
309 309
 	 */
310 310
 	protected function _get_rate_limit_expiry() {
311
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS );
311
+		return (int) apply_filters('FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS);
312 312
 	}
313 313
 
314 314
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @return int
320 320
 	 */
321 321
 	protected function _default_rate_limit() {
322
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue___rate_limit', 200 );
322
+		return (int) apply_filters('FHEE__EE_Messages_Queue___rate_limit', 200);
323 323
 	}
324 324
 
325 325
 
@@ -345,14 +345,14 @@  discard block
 block discarded – undo
345 345
 	 * @param  string $type The type of lock being checked for.
346 346
 	 * @return bool
347 347
 	 */
348
-	public function is_locked( $type = EE_Messages_Queue::action_generating ) {
348
+	public function is_locked($type = EE_Messages_Queue::action_generating) {
349 349
 		/**
350 350
 		 * This filters the default is_locked behaviour.
351 351
 		 */
352 352
 		$is_locked = filter_var(
353 353
 			apply_filters(
354 354
 				'FHEE__EE_Messages_Queue__is_locked',
355
-				get_transient( $this->_get_lock_key( $type ) ),
355
+				get_transient($this->_get_lock_key($type)),
356 356
 				$this
357 357
 			),
358 358
 			FILTER_VALIDATE_BOOLEAN
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		 *            Also implemented here because messages processed on the same request should not have any locks applied.
364 364
 		 */
365 365
 		if (
366
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
366
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
367 367
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
368 368
 		) {
369 369
 			$is_locked = false;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	 * @return int
386 386
 	 */
387 387
 	public function get_rate_limit() {
388
-		if ( ! $rate_limit = get_transient( $this->_get_rate_limit_key() ) ) {
388
+		if ( ! $rate_limit = get_transient($this->_get_rate_limit_key())) {
389 389
 			$rate_limit = $this->_default_rate_limit();
390
-			set_transient( $this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key() );
390
+			set_transient($this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key());
391 391
 		}
392 392
 		return $rate_limit;
393 393
 	}
@@ -399,12 +399,12 @@  discard block
 block discarded – undo
399 399
 	 * This updates existing rate limit with the new limit which is the old minus the batch.
400 400
 	 * @param int $batch_completed  This sets the new rate limit based on the given batch that was completed.
401 401
 	 */
402
-	public function set_rate_limit( $batch_completed ) {
402
+	public function set_rate_limit($batch_completed) {
403 403
 		//first get the most up to date rate limit (in case its expired and reset)
404 404
 		$rate_limit = $this->get_rate_limit();
405 405
 		$new_limit = $rate_limit - $batch_completed;
406 406
 		//updating the transient option directly to avoid resetting the expiry.
407
-		update_option( '_transient_' . $this->_get_rate_limit_key(), $new_limit );
407
+		update_option('_transient_'.$this->_get_rate_limit_key(), $new_limit);
408 408
 	}
409 409
 
410 410
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 * @param string $task This indicates what type of request is going to be initiated.
418 418
 	 * @param int    $priority  This indicates the priority that triggers initiating the request.
419 419
 	 */
420
-	public function initiate_request_by_priority( $task = 'generate', $priority = EEM_Message::priority_high ) {
420
+	public function initiate_request_by_priority($task = 'generate', $priority = EEM_Message::priority_high) {
421 421
 		//determine what status is matched with the priority as part of the trigger conditions.
422 422
 		$status = $task == 'generate'
423 423
 			? EEM_Message::status_incomplete
@@ -437,19 +437,19 @@  discard block
 block discarded – undo
437 437
 		 *   the same request.
438 438
 		 */
439 439
 		if (
440
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
440
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
441 441
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
442 442
 		) {
443
-			$messages_processor = EE_Registry::instance()->load_lib( 'Messages_Processor' );
444
-			if ( $messages_processor instanceof EE_Messages_Processor ) {
445
-				return $messages_processor->process_immediately_from_queue( $this );
443
+			$messages_processor = EE_Registry::instance()->load_lib('Messages_Processor');
444
+			if ($messages_processor instanceof EE_Messages_Processor) {
445
+				return $messages_processor->process_immediately_from_queue($this);
446 446
 			}
447 447
 			//if we get here then that means the messages processor couldn't be loaded so messages will just remain
448 448
 			//queued for manual triggering by end user.
449 449
 		}
450 450
 
451
-		if ( $this->_message_repository->count_by_priority_and_status( $priority, $status ) ) {
452
-			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( $task );
451
+		if ($this->_message_repository->count_by_priority_and_status($priority, $status)) {
452
+			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request($task);
453 453
 		}
454 454
 	}
455 455
 
@@ -474,53 +474,53 @@  discard block
 block discarded – undo
474 474
 	 *                    Also, if the messenger is an request type messenger (or a preview),
475 475
 	 * 					  its entirely possible that the messenger will exit before
476 476
 	 */
477
-	public function execute( $save = true, $sending_messenger = null, $by_priority = false ) {
477
+	public function execute($save = true, $sending_messenger = null, $by_priority = false) {
478 478
 		$messages_sent = 0;
479 479
 		$this->_did_hook = array();
480 480
 		$this->_message_repository->rewind();
481 481
 
482
-		while ( $this->_message_repository->valid() ) {
482
+		while ($this->_message_repository->valid()) {
483 483
 			$error_messages = array();
484 484
 			/** @type EE_Message $message */
485 485
 			$message = $this->_message_repository->current();
486 486
 			//only process things that are queued for sending
487
-			if ( ! in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) {
487
+			if ( ! in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) {
488 488
 				$this->_message_repository->next();
489 489
 				continue;
490 490
 			}
491 491
 			//if $by_priority is set and does not match then continue;
492
-			if ( $by_priority && $by_priority != $message->priority() ) {
492
+			if ($by_priority && $by_priority != $message->priority()) {
493 493
 				$this->_message_repository->next();
494 494
 				continue;
495 495
 			}
496 496
 			//error checking
497
-			if ( ! $message->valid_messenger() ) {
497
+			if ( ! $message->valid_messenger()) {
498 498
 				$error_messages[] = sprintf(
499
-					__( 'The %s messenger is not active at time of sending.', 'event_espresso' ),
499
+					__('The %s messenger is not active at time of sending.', 'event_espresso'),
500 500
 					$message->messenger()
501 501
 				);
502 502
 			}
503
-			if ( ! $message->valid_message_type() ) {
503
+			if ( ! $message->valid_message_type()) {
504 504
 				$error_messages[] = sprintf(
505
-					__( 'The %s message type is not active at the time of sending.', 'event_espresso' ),
505
+					__('The %s message type is not active at the time of sending.', 'event_espresso'),
506 506
 					$message->message_type()
507 507
 				);
508 508
 			}
509 509
 			// if there was supposed to be a sending messenger for this message, but it was invalid/inactive,
510 510
 			// then it will instead be an EE_Error object, so let's check for that
511
-			if ( $sending_messenger instanceof EE_Error ) {
511
+			if ($sending_messenger instanceof EE_Error) {
512 512
 				$error_messages[] = $sending_messenger->getMessage();
513 513
 			}
514 514
 			// if there are no errors, then let's process the message
515
-			if ( empty( $error_messages ) && $this->_process_message( $message, $sending_messenger ) ) {
515
+			if (empty($error_messages) && $this->_process_message($message, $sending_messenger)) {
516 516
 				$messages_sent++;
517 517
 			}
518
-			$this->_set_error_message( $message, $error_messages );
518
+			$this->_set_error_message($message, $error_messages);
519 519
 			//add modified time
520
-			$message->set_modified( time() );
520
+			$message->set_modified(time());
521 521
 			$this->_message_repository->next();
522 522
 		}
523
-		if ( $save ) {
523
+		if ($save) {
524 524
 			$this->save();
525 525
 		}
526 526
 		return $messages_sent;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	 * @param mixed 	 $sending_messenger (optional)
536 536
 	 * @return bool
537 537
 	 */
538
-	protected function _process_message( EE_Message $message, $sending_messenger = null ) {
538
+	protected function _process_message(EE_Message $message, $sending_messenger = null) {
539 539
 		// these *should* have been validated in the execute() method above
540 540
 		$messenger = $message->messenger_object();
541 541
 		$message_type = $message->message_type_object();
@@ -545,20 +545,20 @@  discard block
 block discarded – undo
545 545
 			&& $messenger instanceof EE_messenger
546 546
 			&& $sending_messenger->name != $messenger->name
547 547
 		) {
548
-			$messenger->do_secondary_messenger_hooks( $sending_messenger->name );
548
+			$messenger->do_secondary_messenger_hooks($sending_messenger->name);
549 549
 			$messenger = $sending_messenger;
550 550
 		}
551 551
 		// send using messenger, but double check objects
552
-		if ( $messenger instanceof EE_messenger && $message_type instanceof EE_message_type ) {
552
+		if ($messenger instanceof EE_messenger && $message_type instanceof EE_message_type) {
553 553
 			//set hook for message type (but only if not using another messenger to send).
554
-			if ( ! isset( $this->_did_hook[ $message_type->name ] ) ) {
555
-				$message_type->do_messenger_hooks( $messenger );
556
-				$this->_did_hook[ $message_type->name ] = 1;
554
+			if ( ! isset($this->_did_hook[$message_type->name])) {
555
+				$message_type->do_messenger_hooks($messenger);
556
+				$this->_did_hook[$message_type->name] = 1;
557 557
 			}
558 558
 			//if preview then use preview method
559 559
 			return $this->_message_repository->is_preview()
560
-				? $this->_do_preview( $message, $messenger, $message_type, $this->_message_repository->is_test_send() )
561
-				: $this->_do_send( $message, $messenger, $message_type );
560
+				? $this->_do_preview($message, $messenger, $message_type, $this->_message_repository->is_test_send())
561
+				: $this->_do_send($message, $messenger, $message_type);
562 562
 		}
563 563
 		return false;
564 564
 	}
@@ -576,12 +576,12 @@  discard block
 block discarded – undo
576 576
 	 * @param array $status  Stati to check for in queue
577 577
 	 * @return int  Count of EE_Message's matching the given status.
578 578
 	 */
579
-	public function count_STS_in_queue( $status ) {
579
+	public function count_STS_in_queue($status) {
580 580
 		$count = 0;
581
-		$status = is_array( $status ) ? $status : array( $status );
581
+		$status = is_array($status) ? $status : array($status);
582 582
 		$this->_message_repository->rewind();
583
-		foreach( $this->_message_repository as $message ) {
584
-			if ( in_array( $message->STS_ID(), $status ) ) {
583
+		foreach ($this->_message_repository as $message) {
584
+			if (in_array($message->STS_ID(), $status)) {
585 585
 				$count++;
586 586
 			}
587 587
 		}
@@ -598,15 +598,15 @@  discard block
 block discarded – undo
598 598
 	 * @param $test_send
599 599
 	 * @return bool   true means all went well, false means, not so much.
600 600
 	 */
601
-	protected function _do_preview( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send ) {
602
-		if ( $preview = $messenger->get_preview( $message, $message_type, $test_send ) ) {
603
-			if ( ! $test_send ) {
604
-				$message->set_content( $preview );
601
+	protected function _do_preview(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send) {
602
+		if ($preview = $messenger->get_preview($message, $message_type, $test_send)) {
603
+			if ( ! $test_send) {
604
+				$message->set_content($preview);
605 605
 			}
606
-			$message->set_STS_ID( EEM_Message::status_sent );
606
+			$message->set_STS_ID(EEM_Message::status_sent);
607 607
 			return true;
608 608
 		} else {
609
-			$message->set_STS_ID( EEM_Message::status_failed );
609
+			$message->set_STS_ID(EEM_Message::status_failed);
610 610
 			return false;
611 611
 		}
612 612
 	}
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
 	 * @param EE_message_type $message_type
623 623
 	 * @return bool true means all went well, false means, not so much.
624 624
 	 */
625
-	protected function _do_send( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type ) {
626
-		if ( $messenger->send_message( $message, $message_type ) ) {
627
-			$message->set_STS_ID( EEM_Message::status_sent );
625
+	protected function _do_send(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type) {
626
+		if ($messenger->send_message($message, $message_type)) {
627
+			$message->set_STS_ID(EEM_Message::status_sent);
628 628
 			return true;
629 629
 		} else {
630
-			$message->set_STS_ID( EEM_Message::status_retry );
630
+			$message->set_STS_ID(EEM_Message::status_retry);
631 631
 			return false;
632 632
 		}
633 633
 	}
@@ -641,21 +641,21 @@  discard block
 block discarded – undo
641 641
 	 * @param EE_Message $message
642 642
 	 * @param array      $error_messages the response from the messenger.
643 643
 	 */
644
-	protected function _set_error_message( EE_Message $message, $error_messages ) {
644
+	protected function _set_error_message(EE_Message $message, $error_messages) {
645 645
 		$error_messages = (array) $error_messages;
646
-		if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending() ) ) {
646
+		if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) {
647 647
 			$notices = EE_Error::has_notices();
648
-			$error_messages[] = __( 'Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso' );
649
-			if ( $notices === 1 ) {
648
+			$error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso');
649
+			if ($notices === 1) {
650 650
 				$notices = EE_Error::get_vanilla_notices();
651
-				$notices['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : array();
652
-				$error_messages[] = implode( "\n", $notices['errors'] );
651
+				$notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array();
652
+				$error_messages[] = implode("\n", $notices['errors']);
653 653
 			}
654 654
 		}
655
-		if ( count( $error_messages ) > 0 ) {
656
-			$msg = __( 'Message was not executed successfully.', 'event_espresso' );
657
-			$msg = $msg . "\n" . implode( "\n", $error_messages );
658
-			$message->set_error_message( $msg );
655
+		if (count($error_messages) > 0) {
656
+			$msg = __('Message was not executed successfully.', 'event_espresso');
657
+			$msg = $msg."\n".implode("\n", $error_messages);
658
+			$message->set_error_message($msg);
659 659
 		}
660 660
 	}
661 661
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Message_Type.lib.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -50,79 +50,79 @@  discard block
 block discarded – undo
50 50
 	 * @throws \EE_Error
51 51
 	 * }
52 52
 	 */
53
-	public static function register( $mt_name = NULL, $setup_args = array() ) {
53
+	public static function register($mt_name = NULL, $setup_args = array()) {
54 54
 		//required fields MUST be present, so let's make sure they are.
55 55
 		if (
56
-			! isset( $mt_name )
57
-			|| ! is_array( $setup_args )
58
-			|| empty( $setup_args['mtfilename'] ) || empty( $setup_args['autoloadpaths'] )
59
-		){
56
+			! isset($mt_name)
57
+			|| ! is_array($setup_args)
58
+			|| empty($setup_args['mtfilename']) || empty($setup_args['autoloadpaths'])
59
+		) {
60 60
 			throw new EE_Error(
61
-				__( 'In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso' )
61
+				__('In order to register a message type with EE_Register_Message_Type::register, you must include a unique name for the message type, plus an array containing the following keys: "mtfilename", "autoloadpaths"', 'event_espresso')
62 62
 			);
63 63
 		}
64 64
 
65 65
 		//make sure we don't register twice
66
-		if( isset( self::$_ee_message_type_registry[ $mt_name ] ) ){
66
+		if (isset(self::$_ee_message_type_registry[$mt_name])) {
67 67
 			return;
68 68
 		}
69 69
 
70 70
 		//make sure this was called in the right place!
71 71
 		if (
72
-			! did_action( 'EE_Brewing_Regular___messages_caf' )
73
-			|| did_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' )
72
+			! did_action('EE_Brewing_Regular___messages_caf')
73
+			|| did_action('AHEE__EE_System__perform_activations_upgrades_and_migrations')
74 74
 		) {
75 75
 			EE_Error::doing_it_wrong(
76 76
 				__METHOD__,
77 77
 				sprintf(
78
-					__('A message type named "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.','event_espresso'),
78
+					__('A message type named "%s" has been attempted to be registered with the EE Messages System.  It may or may not work because it should be only called on the "EE_Brewing_Regular___messages_caf" hook.', 'event_espresso'),
79 79
 					$mt_name
80 80
 				),
81 81
 				'4.3.0'
82 82
 			);
83 83
 		}
84 84
 		//setup $__ee_message_type_registry array from incoming values.
85
-		self::$_ee_message_type_registry[ $mt_name ] = array(
85
+		self::$_ee_message_type_registry[$mt_name] = array(
86 86
 			'mtfilename' => (string) $setup_args['mtfilename'],
87 87
 			'autoloadpaths' => (array) $setup_args['autoloadpaths'],
88
-			'messengers_to_activate_with' => ! empty( $setup_args['messengers_to_activate_with'] )
88
+			'messengers_to_activate_with' => ! empty($setup_args['messengers_to_activate_with'])
89 89
 				? (array) $setup_args['messengers_to_activate_with']
90 90
 				: array(),
91
-			'messengers_to_validate_with' => ! empty( $setup_args['messengers_to_validate_with'] )
91
+			'messengers_to_validate_with' => ! empty($setup_args['messengers_to_validate_with'])
92 92
 				? (array) $setup_args['messengers_to_validate_with']
93 93
 				: array(),
94
-			'force_activation' => ! empty( $setup_args['force_activation'] )
94
+			'force_activation' => ! empty($setup_args['force_activation'])
95 95
 				? (bool) $setup_args['force_activation']
96 96
 				: array()
97 97
 		);
98 98
 		//add filters
99 99
 		add_filter(
100 100
 			'FHEE__EED_Messages___set_messages_paths___MSG_PATHS',
101
-			array( 'EE_Register_Message_Type', 'register_msgs_autoload_paths' ),
101
+			array('EE_Register_Message_Type', 'register_msgs_autoload_paths'),
102 102
 			10
103 103
 		);
104 104
 		add_filter(
105 105
 			'FHEE__EE_messages__get_installed__messagetype_files',
106
-			array( 'EE_Register_Message_Type', 'register_messagetype_files' ),
106
+			array('EE_Register_Message_Type', 'register_messagetype_files'),
107 107
 			10,
108 108
 			1
109 109
 		);
110 110
 		add_filter(
111 111
 			'FHEE__EE_messenger__get_default_message_types__default_types',
112
-			array( 'EE_Register_Message_Type', 'register_messengers_to_activate_mt_with' ),
112
+			array('EE_Register_Message_Type', 'register_messengers_to_activate_mt_with'),
113 113
 			10,
114 114
 			2
115 115
 		);
116 116
 		add_filter(
117 117
 			'FHEE__EE_messenger__get_valid_message_types__valid_types',
118
-			array( 'EE_Register_Message_Type', 'register_messengers_to_validate_mt_with' ),
118
+			array('EE_Register_Message_Type', 'register_messengers_to_validate_mt_with'),
119 119
 			10,
120 120
 			2
121 121
 		);
122 122
 		//actions
123 123
 		add_action(
124 124
 			'AHEE__EE_Addon__initialize_default_data__begin',
125
-			array( 'EE_Register_Message_Type', 'set_defaults' )
125
+			array('EE_Register_Message_Type', 'set_defaults')
126 126
 		);
127 127
 	}
128 128
 
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public static function set_defaults() {
135 135
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
136
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
136
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
137 137
 
138 138
 		//for any message types with force activation, let's ensure they are activated
139
-		foreach ( self::$_ee_message_type_registry as $message_type_name => $settings ) {
140
-			if ( $settings['force_activation'] ) {
141
-				foreach ( $settings['messengers_to_activate_with'] as $messenger ) {
139
+		foreach (self::$_ee_message_type_registry as $message_type_name => $settings) {
140
+			if ($settings['force_activation']) {
141
+				foreach ($settings['messengers_to_activate_with'] as $messenger) {
142 142
 					//DO not force activation if this message type has already been activated in the system
143
-					if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger( $message_type_name, $messenger ) ) {
144
-						$message_resource_manager->ensure_message_type_is_active( $message_type_name, $messenger );
143
+					if ( ! $message_resource_manager->has_message_type_been_activated_for_messenger($message_type_name, $messenger)) {
144
+						$message_resource_manager->ensure_message_type_is_active($message_type_name, $messenger);
145 145
 					}
146 146
 				}
147 147
 			}
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 	 * @param string  $message_type_name the name for the message type that was previously registered
159 159
 	 * @return void
160 160
 	 */
161
-	public static function deregister( $message_type_name = null ) {
162
-		if ( ! empty( self::$_ee_message_type_registry[ $message_type_name ] ) ) {
161
+	public static function deregister($message_type_name = null) {
162
+		if ( ! empty(self::$_ee_message_type_registry[$message_type_name])) {
163 163
 			//let's make sure that we remove any place this message type was made active
164 164
 			/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
165
-			$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
166
-			$Message_Resource_Manager->deactivate_message_type( $message_type_name );
167
-			unset( self::$_ee_message_type_registry[ $message_type_name ] );
165
+			$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
166
+			$Message_Resource_Manager->deactivate_message_type($message_type_name);
167
+			unset(self::$_ee_message_type_registry[$message_type_name]);
168 168
 		}
169 169
 	}
170 170
 
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 	 * @param  array  $messagetype_files The current array of message type file names
179 179
 	 * @return  array                                 Array of message type file names
180 180
 	 */
181
-	public static function register_messagetype_files( $messagetype_files ) {
182
-		if ( empty( self::$_ee_message_type_registry ) ) {
181
+	public static function register_messagetype_files($messagetype_files) {
182
+		if (empty(self::$_ee_message_type_registry)) {
183 183
 			return $messagetype_files;
184 184
 		}
185
-		foreach ( self::$_ee_message_type_registry as $mt_reg ) {
186
-			if ( empty( $mt_reg['mtfilename' ] ) ) {
185
+		foreach (self::$_ee_message_type_registry as $mt_reg) {
186
+			if (empty($mt_reg['mtfilename'])) {
187 187
 				continue;
188 188
 			}
189 189
 			$messagetype_files[] = $mt_reg['mtfilename'];
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 	 * @param array $paths array of paths to be checked by EE_messages autoloader.
204 204
 	 * @return array
205 205
 	 */
206
-	public static function register_msgs_autoload_paths( $paths  ) {
207
-		if ( ! empty( self::$_ee_message_type_registry ) ) {
208
-			foreach ( self::$_ee_message_type_registry as $mt_reg ) {
209
-				if ( empty( $mt_reg['autoloadpaths'] ) ) {
206
+	public static function register_msgs_autoload_paths($paths) {
207
+		if ( ! empty(self::$_ee_message_type_registry)) {
208
+			foreach (self::$_ee_message_type_registry as $mt_reg) {
209
+				if (empty($mt_reg['autoloadpaths'])) {
210 210
 					continue;
211 211
 				}
212
-				$paths = array_merge( $paths, $mt_reg['autoloadpaths'] );
212
+				$paths = array_merge($paths, $mt_reg['autoloadpaths']);
213 213
 			}
214 214
 		}
215 215
 		return $paths;
@@ -228,18 +228,18 @@  discard block
 block discarded – undo
228 228
 	 * @param  EE_messenger $messenger      The EE_messenger the filter is called from.
229 229
 	 * @return array
230 230
 	 */
231
-	public static function register_messengers_to_activate_mt_with( $default_types, EE_messenger $messenger ) {
232
-		if ( empty( self::$_ee_message_type_registry ) ) {
231
+	public static function register_messengers_to_activate_mt_with($default_types, EE_messenger $messenger) {
232
+		if (empty(self::$_ee_message_type_registry)) {
233 233
 			return $default_types;
234 234
 		}
235
-		foreach ( self::$_ee_message_type_registry as $message_type_name => $mt_reg ) {
236
-			if ( empty( $mt_reg['messengers_to_activate_with'] ) || empty( $mt_reg['mtfilename'] ) ) {
235
+		foreach (self::$_ee_message_type_registry as $message_type_name => $mt_reg) {
236
+			if (empty($mt_reg['messengers_to_activate_with']) || empty($mt_reg['mtfilename'])) {
237 237
 				continue;
238 238
 			}
239 239
 			// loop through each of the messengers and if it matches the loaded class
240 240
 			// then we add this message type to the
241
-			foreach ( $mt_reg['messengers_to_activate_with'] as $msgr ) {
242
-				if ( $messenger->name == $msgr ) {
241
+			foreach ($mt_reg['messengers_to_activate_with'] as $msgr) {
242
+				if ($messenger->name == $msgr) {
243 243
 					$default_types[] = $message_type_name;
244 244
 				}
245 245
 			}
@@ -259,18 +259,18 @@  discard block
 block discarded – undo
259 259
 	 * @param  EE_messenger $messenger      The EE_messenger the filter is called from.
260 260
 	 * @return  array
261 261
 	 */
262
-	public static function register_messengers_to_validate_mt_with( $valid_types, EE_messenger $messenger ) {
263
-		if ( empty( self::$_ee_message_type_registry ) ) {
262
+	public static function register_messengers_to_validate_mt_with($valid_types, EE_messenger $messenger) {
263
+		if (empty(self::$_ee_message_type_registry)) {
264 264
 			return $valid_types;
265 265
 		}
266
-		foreach ( self::$_ee_message_type_registry as $message_type_name => $mt_reg ) {
267
-			if ( empty( $mt_reg['messengers_to_validate_with'] ) || empty( $mt_reg['mtfilename'] ) ) {
266
+		foreach (self::$_ee_message_type_registry as $message_type_name => $mt_reg) {
267
+			if (empty($mt_reg['messengers_to_validate_with']) || empty($mt_reg['mtfilename'])) {
268 268
 				continue;
269 269
 			}
270 270
 			// loop through each of the messengers and if it matches the loaded class
271 271
 			// then we add this message type to the
272
-			foreach ( $mt_reg['messengers_to_validate_with'] as $msgr ) {
273
-				if ( $messenger->name == $msgr ) {
272
+			foreach ($mt_reg['messengers_to_validate_with'] as $msgr) {
273
+				if ($messenger->name == $msgr) {
274 274
 					$valid_types[] = $message_type_name;
275 275
 				}
276 276
 			}
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -251,14 +251,14 @@
 block discarded – undo
251 251
 
252 252
 
253 253
 	 /**
254
-	 * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter.
255
-	 *
256
-	 * @since   4.3.0
257
-	 * @param  array        $valid_types 	array of message types valid with messenger (
258
-	 *                                      corresponds to the $name property of message type)
259
-	 * @param  EE_messenger $messenger      The EE_messenger the filter is called from.
260
-	 * @return  array
261
-	 */
254
+	  * callback for FHEE__EE_messenger__get_valid_message_types__default_types filter.
255
+	  *
256
+	  * @since   4.3.0
257
+	  * @param  array        $valid_types 	array of message types valid with messenger (
258
+	  *                                      corresponds to the $name property of message type)
259
+	  * @param  EE_messenger $messenger      The EE_messenger the filter is called from.
260
+	  * @return  array
261
+	  */
262 262
 	public static function register_messengers_to_validate_mt_with( $valid_types, EE_messenger $messenger ) {
263 263
 		if ( empty( self::$_ee_message_type_registry ) ) {
264 264
 			return $valid_types;
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_receipt_content.template.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 			</td>
24 24
 			<td>
25 25
 				<div id="invoice-info">
26
-					<h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2>
26
+					<h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2>
27 27
 
28
-					<h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?>
28
+					<h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?>
29 29
 						<span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3>
30 30
 
31
-					<h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?>
31
+					<h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?>
32 32
 						<span class="plain-text">[TXN_ID]</span></h3>
33 33
 
34
-					<h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?>
34
+					<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?>
35 35
 						<span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3>
36 36
 				</div>
37 37
 			</td>
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 		[EVENT_LIST]
42 42
 	</div>
43 43
 	<div class="taxes">
44
-		<h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3>
44
+		<h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3>
45 45
 		<table class="invoice-amount">
46 46
 			<thead>
47 47
 				<tr class="header_row">
48
-					<th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th>
49
-					<th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th>
50
-					<th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th>
51
-					<th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th>
52
-					<th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th>
48
+					<th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th>
49
+					<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
50
+					<th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th>
51
+					<th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th>
52
+					<th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th>
53 53
 				</tr>
54 54
 			</thead>
55 55
 			<tbody>
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 		</table>
61 61
 	</div>
62 62
 	<div class="taxes">
63
-		<h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3>
64
-		<p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p>
63
+		<h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3>
64
+		<p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p>
65 65
 		<table class="invoice-amount">
66 66
 			<thead>
67 67
 				<tr class="header_row">
68
-					<th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th>
69
-					<th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th>
70
-					<th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th>
71
-					<th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th>
68
+					<th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th>
69
+					<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
70
+					<th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th>
71
+					<th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th>
72 72
 				</tr>
73 73
 			</thead>
74 74
 			<tbody>
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 		</table>
80 80
 	</div>
81 81
 	<div class="grand-total-dv">
82
-		<h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2>
82
+		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2>
83 83
 	</div>
84 84
 	<div class="payment-dv">
85
-		<h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3>
85
+		<h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3>
86 86
 		<table class="invoice-amount">
87 87
 			<thead>
88 88
 				<tr class="header_row">
89
-					<th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th>
90
-					<th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th>
91
-					<th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th>
92
-					<th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th>
93
-					<th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th>
94
-					<th><?php _e( 'Amount', 'event_espresso' ); ?></th>
89
+					<th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th>
90
+					<th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th>
91
+					<th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th>
92
+					<th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th>
93
+					<th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th>
94
+					<th><?php _e('Amount', 'event_espresso'); ?></th>
95 95
 				</tr>
96 96
 			</thead>
97 97
 			<tbody>
@@ -105,21 +105,21 @@  discard block
 block discarded – undo
105 105
 			<tfoot>
106 106
 				<tr class='total_tr'>
107 107
 					<td colspan="4">&nbsp;</td>
108
-					<td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td>
108
+					<td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td>
109 109
 					<td class="item_r">[TOTAL_AMOUNT_PAID]</td>
110 110
 				</tr>
111 111
 				<tr class="total_tr odd">
112 112
 					<td colspan="4">&nbsp;</td>
113
-					<td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td>
113
+					<td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td>
114 114
 					<td class="total">[TOTAL_OWING]</td>
115 115
 				</tr>
116 116
 			</tfoot>
117 117
 		</table>
118 118
 	</div>
119 119
 	<div class="additional-info-dv">
120
-		<h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3>
120
+		<h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3>
121 121
 		<div class="additional-info">
122
-			<h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2>
122
+			<h2><?php _e("Venue Details:", "event_espresso"); ?></h2>
123 123
 			<table class="venue-list">
124 124
 				<tr class="venue-details">
125 125
 					<td class="venue-details-part venue-address-dv">
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 					<td class="venue-details-part venue-image-dv">[GOOGLE_MAP_IMAGE]</td>
132 132
 				</tr>
133 133
 			</table>
134
-			<div class='aln-cntr'><?php printf( __( "Powered by %sEvent Espresso %s", "event_espresso" ), "<a href='https://eventespresso.com'>", "</a>" ); ?></div>
134
+			<div class='aln-cntr'><?php printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='https://eventespresso.com'>", "</a>"); ?></div>
135 135
 		</div>
136 136
 	</div>
137 137
 </div>
Please login to merge, or discard this patch.
core/db_models/EEM_Payment_Method.model.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * Overrides parent ot also check by the slug
203 203
 	 * @see EEM_Base::ensure_is_obj()
204
-	 * @param string|int|EE_Payment_Method $base_class_obj_or_id
204
+	 * @param EE_Payment_Method $base_class_obj_or_id
205 205
 	 * @param boolean                      $ensure_is_in_db
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 * Note: if an offline payment method was selected on the related transaction then this will have no payment methods returned.
364 364
 	 * It will ONLY return a payment method for a PAYMENT recorded against the registration.
365 365
 	 *
366
-	 * @param EE_Registration|int $registration_or_reg_id  Either the EE_Registration object or the id for the registration.
367
-	 * @return EE_Payment|null
366
+	 * @param EE_Registration $registration_or_reg_id  Either the EE_Registration object or the id for the registration.
367
+	 * @return EE_Base_Class|null
368 368
 	 */
369 369
 	public function get_last_used_for_registration( $registration_or_reg_id ) {
370 370
 		$registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id );
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -217,8 +217,7 @@  discard block
 block discarded – undo
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219 219
 			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
220
-		}
221
-		catch ( EE_Error $e ) {
220
+		} catch ( EE_Error $e ) {
222 221
 			//handle it outside the catch
223 222
 		}
224 223
 		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
@@ -283,8 +282,7 @@  discard block
 block discarded – undo
283 282
 						break;
284 283
 					}
285 284
 				}
286
-			}
287
-			catch ( EE_Error $e ) {
285
+			} catch ( EE_Error $e ) {
288 286
 				$payment_method->set_active( FALSE );
289 287
 			}
290 288
 		}
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 	 * @access   protected
38 38
 	 * @return EEM_Payment_Method
39 39
 	 */
40
-	protected function __construct( $timezone = NULL ) {
41
-		$this->singlular_item = __( 'Payment Method', 'event_espresso' );
42
-		$this->plural_item = __( 'Payment Methods', 'event_espresso' );
43
-		$this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) );
40
+	protected function __construct($timezone = NULL) {
41
+		$this->singlular_item = __('Payment Method', 'event_espresso');
42
+		$this->plural_item = __('Payment Methods', 'event_espresso');
43
+		$this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID'));
44 44
 		$this->_fields = array(
45 45
 			'Payment_Method' => array(
46
-				'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ),
47
-				'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ),
48
-				'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ),
49
-				'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ),
50
-				'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ),
51
-				'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ),
52
-				'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ),
53
-				'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ),
54
-				'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ),
55
-				'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ),
56
-				'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ),
57
-				'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API'
46
+				'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')),
47
+				'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'),
48
+				'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE),
49
+				'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''),
50
+				'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE),
51
+				'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE),
52
+				'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE),
53
+				'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0),
54
+				'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE),
55
+				'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE),
56
+				'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''),
57
+				'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API'
58 58
 		) );
59 59
 		$this->_model_relations = array(
60 60
  //			'Event'=>new EE_HABTM_Relation('Event_Payment_Method'),
61 61
 			'Payment' => new EE_Has_Many_Relation(),
62
-			'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ),
62
+			'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'),
63 63
 			'Transaction' => new EE_Has_Many_Relation(),
64 64
 			'WP_User' => new EE_Belongs_To_Relation(),
65 65
 		);
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 	}
68 68
 
69 69
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param string $slug
74 74
 	 * @return EE_Payment_Method
75 75
 	 */
76
-	public function get_one_by_slug( $slug ) {
77
-		return $this->get_one( array( array( 'PMD_slug' => $slug ) ) );
76
+	public function get_one_by_slug($slug) {
77
+		return $this->get_one(array(array('PMD_slug' => $slug)));
78 78
 	}
79 79
 
80 80
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 		return apply_filters(
89 89
 			'FHEE__EEM_Payment_Method__scopes',
90 90
 			array(
91
-				self::scope_cart 		=> __( "Front-end Registration Page", 'event_espresso' ),
92
-				self::scope_admin 	=> __( "Admin Registration Page (no online processing)", 'event_espresso' )
91
+				self::scope_cart 		=> __("Front-end Registration Page", 'event_espresso'),
92
+				self::scope_admin 	=> __("Admin Registration Page (no online processing)", 'event_espresso')
93 93
 			)
94 94
 		);
95 95
 	}
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param string $scope like one of EEM_Payment_Method::instance()->scopes()
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function is_valid_scope( $scope ) {
104
+	public function is_valid_scope($scope) {
105 105
 		$scopes = $this->scopes();
106
-		if ( isset( $scopes[ $scope ] ) ) {
106
+		if (isset($scopes[$scope])) {
107 107
 			return TRUE;
108 108
 		} else {
109 109
 			return FALSE;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @throws EE_Error
120 120
 	 * @return EE_Payment_Method[]
121 121
 	 */
122
-	public function get_all_active( $scope = NULL, $query_params = array() ) {
123
-		if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) {
124
-			$query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) );
122
+	public function get_all_active($scope = NULL, $query_params = array()) {
123
+		if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) {
124
+			$query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC'));
125 125
 		}
126
-		return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) );
126
+		return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params));
127 127
 	}
128 128
 
129 129
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param array $query_params
133 133
 	 * @return int
134 134
 	 */
135
-	public function count_active( $scope = NULL, $query_params = array() ){
136
-		return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) );
135
+	public function count_active($scope = NULL, $query_params = array()) {
136
+		return $this->count($this->_get_query_params_for_all_active($scope, $query_params));
137 137
 	}
138 138
 
139 139
 	/**
@@ -144,21 +144,21 @@  discard block
 block discarded – undo
144 144
 	 * @return array like param of EEM_Base::get_all()
145 145
 	 * @throws EE_Error
146 146
 	 */
147
-	protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){
148
-		if ( $scope ) {
149
-			if ( $this->is_valid_scope( $scope ) ) {
150
-				return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params );
147
+	protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) {
148
+		if ($scope) {
149
+			if ($this->is_valid_scope($scope)) {
150
+				return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params);
151 151
 			} else {
152
-				throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) );
152
+				throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope));
153 153
 			}
154 154
 		} else {
155 155
 			$acceptable_scopes = array();
156 156
 			$count = 0;
157
-			foreach ( $this->scopes() as $scope_name => $desc ) {
157
+			foreach ($this->scopes() as $scope_name => $desc) {
158 158
 				$count++;
159
-				$acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' );
159
+				$acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%');
160 160
 			}
161
-			return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params );
161
+			return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params);
162 162
 		}
163 163
 	}
164 164
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 * @return array like param of EEM_Base::get_all()
171 171
 	 * @throws EE_Error
172 172
 	 */
173
-	public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) {
174
-		return $this->_get_query_params_for_all_active( $scope, $query_params );
173
+	public function get_query_params_for_all_active($scope = NULL, $query_params = array()) {
174
+		return $this->_get_query_params_for_all_active($scope, $query_params);
175 175
 	}
176 176
 
177 177
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param array  $query_params
182 182
 	 * @return EE_Payment_Method
183 183
 	 */
184
-	public function get_one_active( $scope = NULL, $query_params = array() ) {
185
-		return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) );
184
+	public function get_one_active($scope = NULL, $query_params = array()) {
185
+		return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params));
186 186
 	}
187 187
 
188 188
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $type
193 193
 	 * @return EE_Payment_Method
194 194
 	 */
195
-	public function get_one_of_type( $type ) {
196
-		return $this->get_one( array( array( 'PMD_type' => $type ) ) );
195
+	public function get_one_of_type($type) {
196
+		return $this->get_one(array(array('PMD_type' => $type)));
197 197
 	}
198 198
 
199 199
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @return EE_Payment_Method
207 207
 	 * @throws EE_Error
208 208
 	 */
209
-	public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) {
209
+	public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) {
210 210
 		//first: check if it's a slug
211
-		if( is_string( $base_class_obj_or_id ) ) {
212
-			$obj = $this->get_one_by_slug( $base_class_obj_or_id );
213
-			if( $obj ) {
211
+		if (is_string($base_class_obj_or_id)) {
212
+			$obj = $this->get_one_by_slug($base_class_obj_or_id);
213
+			if ($obj) {
214 214
 				return $obj;
215 215
 			}
216 216
 		}
217 217
 		//ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID)
218 218
 		try {
219
-			return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db );
219
+			return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db);
220 220
 		}
221
-		catch ( EE_Error $e ) {
221
+		catch (EE_Error $e) {
222 222
 			//handle it outside the catch
223 223
 		}
224
-		throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) );
224
+		throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id));
225 225
 	}
226 226
 
227 227
 
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
 	 * @param mixed $base_obj_or_id_or_slug
233 233
 	 * @return int
234 234
 	 */
235
-	function ensure_is_ID( $base_obj_or_id_or_slug ) {
236
-		if ( is_string( $base_obj_or_id_or_slug ) ) {
235
+	function ensure_is_ID($base_obj_or_id_or_slug) {
236
+		if (is_string($base_obj_or_id_or_slug)) {
237 237
 			//assume it's a slug
238
-			$base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug );
238
+			$base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug);
239 239
 		}
240
-		return parent::ensure_is_ID( $base_obj_or_id_or_slug );
240
+		return parent::ensure_is_ID($base_obj_or_id_or_slug);
241 241
 	}
242 242
 
243 243
 
@@ -246,36 +246,36 @@  discard block
 block discarded – undo
246 246
 	 * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default.
247 247
 	 * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart
248 248
 	 */
249
-	function verify_button_urls( $payment_methods = NULL ) {
250
-		$payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
251
-		foreach ( $payment_methods as $payment_method ) {
249
+	function verify_button_urls($payment_methods = NULL) {
250
+		$payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart);
251
+		foreach ($payment_methods as $payment_method) {
252 252
 			try {
253 253
 				$current_button_url = $payment_method->button_url();
254
-				$buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
255
-					'current_ssl' => str_replace( "http://", "https://", $current_button_url ),
256
-					'current' => str_replace( "https://", "http://", $current_button_url ),
257
-					'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ),
258
-					'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ),
259
-				) );
260
-				foreach( $buttons_urls_to_try as $button_url_to_try ) {
261
-					if(
254
+				$buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array(
255
+					'current_ssl' => str_replace("http://", "https://", $current_button_url),
256
+					'current' => str_replace("https://", "http://", $current_button_url),
257
+					'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()),
258
+					'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()),
259
+				));
260
+				foreach ($buttons_urls_to_try as $button_url_to_try) {
261
+					if (
262 262
 							(//this is the current url and it exists, regardless of SSL issues
263 263
 								$button_url_to_try == $current_button_url &&
264 264
 								EEH_URL::remote_file_exists(
265 265
 										$button_url_to_try,
266 266
 										array(
267 267
 											'sslverify' => false,
268
-											'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
268
+											'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block
269 269
 											) )
270 270
 							)
271 271
 							||
272 272
 							(//this is NOT the current url and it exists with a working SSL cert
273 273
 								$button_url_to_try != $current_button_url &&
274
-								EEH_URL::remote_file_exists( $button_url_to_try )
274
+								EEH_URL::remote_file_exists($button_url_to_try)
275 275
 							) ) {
276
-						if( $current_button_url != $button_url_to_try ){
277
-							$payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) );
278
-							EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) );
276
+						if ($current_button_url != $button_url_to_try) {
277
+							$payment_method->save(array('PMD_button_url' => $button_url_to_try));
278
+							EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try));
279 279
 						}
280 280
 						//this image exists. So if wasn't set before, now it is;
281 281
 						//or if it was already set, we have nothing to do
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 					}
284 284
 				}
285 285
 			}
286
-			catch ( EE_Error $e ) {
287
-				$payment_method->set_active( FALSE );
286
+			catch (EE_Error $e) {
287
+				$payment_method->set_active(FALSE);
288 288
 			}
289 289
 		}
290 290
 	}
@@ -298,29 +298,29 @@  discard block
 block discarded – undo
298 298
 	 * @param array $rows
299 299
 	 * @return EE_Payment_Method[]
300 300
 	 */
301
-	protected function _create_objects( $rows = array() ) {
302
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
303
-		$payment_methods = parent::_create_objects( $rows );
301
+	protected function _create_objects($rows = array()) {
302
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
303
+		$payment_methods = parent::_create_objects($rows);
304 304
 		/* @var $payment_methods EE_Payment_Method[] */
305 305
 		$usable_payment_methods = array();
306
-		foreach ( $payment_methods as $key => $payment_method ) {
307
-			if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $payment_method->type() ) ) {
308
-				$usable_payment_methods[ $key ] = $payment_method;
306
+		foreach ($payment_methods as $key => $payment_method) {
307
+			if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($payment_method->type())) {
308
+				$usable_payment_methods[$key] = $payment_method;
309 309
 				//some payment methods enqueue their scripts in EE_PMT_*::__construct
310 310
 				//which is kinda a no-no (just because it's being constructed doesn't mean we need to enqueue
311 311
 				//its scripts). but for backwards-compat we should continue to do that
312 312
 				$payment_method->type_obj();
313
-			} elseif( $payment_method->active() ) {				
313
+			} elseif ($payment_method->active()) {				
314 314
 				//only deactivate and notify the admin if the payment is active somewhere
315 315
 				$payment_method->deactivate();
316 316
 				$payment_method->save();
317 317
 				EE_Error::add_persistent_admin_notice(
318
-					'auto-deactivated-' . $payment_method->type(),
318
+					'auto-deactivated-'.$payment_method->type(),
319 319
 					sprintf(
320
-						__( 'The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso' ),
320
+						__('The payment method %1$s was automatically deactivated because it appears its associated Event Espresso Addon was recently deactivated.%2$sIt can be reactivated on the %3$sPlugins admin page%4$s, then you can reactivate the payment method.', 'event_espresso'),
321 321
 						$payment_method->admin_name(),
322 322
 						'<br />',
323
-						'<a href="' . admin_url('plugins.php') . '">',
323
+						'<a href="'.admin_url('plugins.php').'">',
324 324
 						'</a>'
325 325
 					),
326 326
 					true
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	 * @param string 	$scope @see EEM_Payment_Method::get_all_for_events
341 341
 	 * @return EE_Payment_Method[]
342 342
 	 */
343
-	public function get_all_for_transaction( $transaction, $scope ) {
343
+	public function get_all_for_transaction($transaction, $scope) {
344 344
 		//@todo take relations between events and payment methods into account, once that relation exists
345
-		if ( $transaction instanceof EE_Transaction ) {
345
+		if ($transaction instanceof EE_Transaction) {
346 346
 			//@todo take the relation between transaction and currencies into account
347 347
 		}
348
-		$currencies_for_events = array( EE_Config::instance()->currency->code );
348
+		$currencies_for_events = array(EE_Config::instance()->currency->code);
349 349
 		//give addons a chance to override what payment methods are chosen based on the transaction
350 350
 		return apply_filters(
351 351
 			'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods',
352
-			$this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ),
352
+			$this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))),
353 353
 			$transaction,
354 354
 			$scope
355 355
 		);
@@ -365,16 +365,16 @@  discard block
 block discarded – undo
365 365
 	 * @param EE_Registration|int $registration_or_reg_id  Either the EE_Registration object or the id for the registration.
366 366
 	 * @return EE_Payment|null
367 367
 	 */
368
-	public function get_last_used_for_registration( $registration_or_reg_id ) {
369
-		$registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id );
368
+	public function get_last_used_for_registration($registration_or_reg_id) {
369
+		$registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id);
370 370
 
371 371
 		$query_params = array(
372 372
 			0 => array(
373 373
 				'Payment.Registration.REG_ID' => $registration_id,
374 374
 			),
375
-			'order_by' => array( 'Payment.PAY_ID' => 'DESC' )
375
+			'order_by' => array('Payment.PAY_ID' => 'DESC')
376 376
 		);
377
-		return $this->get_one( $query_params );
377
+		return $this->get_one($query_params);
378 378
 	}
379 379
 
380 380
 }
Please login to merge, or discard this patch.
reg_steps/attendee_information/attendee_info_main.template.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 	<p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text">
2
-		<?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_information_pg', sprintf( __('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>' )); ?>
2
+		<?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_information_pg', sprintf(__('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>')); ?>
3 3
 	</p>
4 4
 
5 5
 <?php
@@ -7,34 +7,34 @@  discard block
 block discarded – undo
7 7
 $prev_event = '';
8 8
 $prev_ticket = '';
9 9
 
10
-if ( count( $registrations ) > 0 ) {
11
-	foreach ( $registrations as $registration ) {
12
-		if ( $registration instanceof EE_Registration ) {
10
+if (count($registrations) > 0) {
11
+	foreach ($registrations as $registration) {
12
+		if ($registration instanceof EE_Registration) {
13 13
 			$att_nmbr++;
14 14
 ?>
15 15
 
16
-		<div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link();?>" class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID();?>">
16
+		<div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>" class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>">
17 17
 
18
-			<?php if ( $registration->event()->ID() != $prev_event ) { ?>
18
+			<?php if ($registration->event()->ID() != $prev_event) { ?>
19 19
 			<h4 id="event_title-<?php echo $registration->event()->ID() ?>" class="big-event-title-hdr">
20 20
 				<?php echo $registration->event()->name(); ?>
21 21
 			</h4>
22 22
 			<?php } ?>
23
-			<?php if ( $registration->ticket()->ID() != $prev_ticket ) { ?>
24
-				<?php if ( ! $revisit ) { ?>
23
+			<?php if ($registration->ticket()->ID() != $prev_ticket) { ?>
24
+				<?php if ( ! $revisit) { ?>
25 25
 			<div class="spco-ticket-info-dv small-text">
26
-				<h5><?php _e('Details', 'event_espresso');?></h5>
26
+				<h5><?php _e('Details', 'event_espresso'); ?></h5>
27 27
 				<table>
28 28
 					<thead>
29 29
 						<tr>
30
-							<th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th>
31
-							<th scope="col" width="7.5%" class="jst-rght"><?php _e('Qty', 'event_espresso');?></th>
32
-							<th scope="col" width="17.5%" class="jst-rght"><?php _e('Price', 'event_espresso');?></th>
33
-							<th scope="col" width="17.5%" class="jst-rght"><?php _e('Total', 'event_espresso');?></th>
30
+							<th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
31
+							<th scope="col" width="7.5%" class="jst-rght"><?php _e('Qty', 'event_espresso'); ?></th>
32
+							<th scope="col" width="17.5%" class="jst-rght"><?php _e('Price', 'event_espresso'); ?></th>
33
+							<th scope="col" width="17.5%" class="jst-rght"><?php _e('Total', 'event_espresso'); ?></th>
34 34
 						</tr>
35 35
 					</thead>
36 36
 					<tbody>
37
-					<?php echo $ticket_line_item[ $registration->ticket()->ID() ]; ?>
37
+					<?php echo $ticket_line_item[$registration->ticket()->ID()]; ?>
38 38
 					</tbody>
39 39
 				</table>
40 40
 			</div>
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 			<?php
45 45
 			// ATTENDEE QUESTIONS
46
-			$reg_form = EE_Template_Layout::get_subform_name( $registration->reg_url_link() );
46
+			$reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
47 47
 			echo ${$reg_form};
48 48
 			?>
49 49
 
Please login to merge, or discard this patch.
core/db_classes/EE_Soft_Delete_Base_Class.class.php 1 patch
Spacing   +7 added lines, -7 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
  * Event Espresso
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
 	 * @param bool $delete true=>delete, false=>restore
44 44
 	 * @return bool|int
45 45
 	 */
46
-	public function delete_or_restore( $delete = true ) {
46
+	public function delete_or_restore($delete = true) {
47 47
 		/**
48 48
 		 * Called just before trashing (soft delete) or restoring a trashed item.
49 49
 		 *
50 50
 		 * @param EE_Base_Class $model_object about to be trashed or restored
51 51
 		 * @param bool          $delete       true the item is being trashed, false the item is being restored.
52 52
 		 */
53
-		do_action( 'AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete );
53
+		do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete);
54 54
 		$model = $this->get_model();
55
-		$result = $model->delete_or_restore_by_ID( $delete, $this->ID() );
55
+		$result = $model->delete_or_restore_by_ID($delete, $this->ID());
56 56
 		/**
57 57
 		 * Called just after trashing (soft delete) or restoring a trashed item.
58 58
 		 * @param EE_Base_Class $model_object that was just trashed or restored.
59 59
 		 * @param bool          $delete       true the item is being trashed, false the item is being restored.
60 60
 		 * @param bool|int $result
61 61
 		 */
62
-		do_action( 'AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result );
62
+		do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result);
63 63
 		return $result;
64 64
 	}
65 65
 
@@ -70,6 +70,6 @@  discard block
 block discarded – undo
70 70
 	 * @return bool|int
71 71
 	 */
72 72
 	public function restore() {
73
-		return $this->delete_or_restore( false );
73
+		return $this->delete_or_restore(false);
74 74
 	}
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
registrations/form_sections/EE_Registration_Custom_Questions_Form.form.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 			if( $subsection->form_data_present_in( $req_data ) ) {
129 129
 				try{
130 130
 					$subsection->_normalize($req_data);
131
-				}catch( EE_Validation_Error $e ){
131
+				} catch( EE_Validation_Error $e ){
132 132
 					$subsection->add_validation_error( $e );
133 133
 				}
134 134
 			}
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since		 	   4.8.30.rc.009
14 14
  *
15 15
  */
16
-if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
17
-	exit( 'No direct script access allowed' );
16
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
17
+	exit('No direct script access allowed');
18 18
 }
19 19
 
20
-class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper{
20
+class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper {
21 21
 	/**
22 22
 	 *
23 23
 	 * @var EE_Registration
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 	 * @param EE_Registration $reg
30 30
 	 * @param array $options
31 31
 	 */
32
-	public function __construct( EE_Registration $reg, $options = array() ) {
32
+	public function __construct(EE_Registration $reg, $options = array()) {
33 33
 		$this->_registration = $reg;
34
-		if( ! isset( $options[ 'layout_strategy' ] ) ) {
35
-			$options[ 'layout_strategy' ] = new EE_Admin_Two_Column_Layout();
34
+		if ( ! isset($options['layout_strategy'])) {
35
+			$options['layout_strategy'] = new EE_Admin_Two_Column_Layout();
36 36
 		}
37
-		if( ! isset( $options[ 'html_id' ] ) ) {
38
-			$options[ 'html_id' ] = 'reg-admin-attendee-questions-frm';
37
+		if ( ! isset($options['html_id'])) {
38
+			$options['html_id'] = 'reg-admin-attendee-questions-frm';
39 39
 		}
40 40
 		$this->build_form_from_registration();
41
-		parent::__construct( $options );
41
+		parent::__construct($options);
42 42
 	}
43 43
 
44 44
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function build_form_from_registration() {
54 54
 		$reg = $this->get_registration();
55
-		if( ! $reg instanceof EE_Registration ) {
56
-			throw new EE_Error( __( 'We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso') );
55
+		if ( ! $reg instanceof EE_Registration) {
56
+			throw new EE_Error(__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso'));
57 57
 		}
58 58
 		//we want to get all their question groups
59 59
 		$question_groups = EEM_Question_Group::instance()->get_all(
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 					'Event_Question_Group.EQG_primary' => $reg->count() == 1 ? TRUE : FALSE,
64 64
 					'OR' => array(
65 65
 						'Question.QST_system*blank' =>  '',
66
-						'Question.QST_system*null' => array( 'IS_NULL' ) 
66
+						'Question.QST_system*null' => array('IS_NULL') 
67 67
 					)
68 68
 				),
69
-				'order_by' => array( 'QSG_order' => 'ASC' )
69
+				'order_by' => array('QSG_order' => 'ASC')
70 70
 			)
71 71
 		);
72 72
 		//get each question groups questions
73
-		foreach( $question_groups as $question_group ) {
74
-			if ( $question_group instanceof EE_Question_Group ) {
75
-				$this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group(
73
+		foreach ($question_groups as $question_group) {
74
+			if ($question_group instanceof EE_Question_Group) {
75
+				$this->_subsections[$question_group->ID()] = $this->build_subform_from_question_group(
76 76
 					$question_group,
77 77
 					$reg
78 78
 				);
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 * @return \EE_Form_Section_Proper
90 90
 	 * @throws \EE_Error
91 91
 	 */
92
-	public function build_subform_from_question_group( $question_group, $registration ) {
93
-		if( ! $question_group instanceof EE_Question_Group ||
92
+	public function build_subform_from_question_group($question_group, $registration) {
93
+		if ( ! $question_group instanceof EE_Question_Group ||
94 94
 			! $registration instanceof EE_Registration) {
95
-			throw new EE_Error( __( 'A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso' ) );
95
+			throw new EE_Error(__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso'));
96 96
 		}
97 97
 		$parts_of_subsection = array(
98 98
 			'title' => new EE_Form_Section_HTML(
99
-					EEH_HTML::h5( $question_group->name(),
99
+					EEH_HTML::h5($question_group->name(),
100 100
 					$question_group->identifier(),
101
-					'espresso-question-group-title-h5 section-title' )
101
+					'espresso-question-group-title-h5 section-title')
102 102
 				)
103 103
 		);
104 104
 		$questions = $question_group->questions( 
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 				array( 
107 107
 					'OR' => array(
108 108
 						'QST_system*blank' => '',
109
-						'QST_system*null' => array( 'IS_NULL' )
109
+						'QST_system*null' => array('IS_NULL')
110 110
 					)
111 111
 				)
112 112
 			)
113 113
 		);
114
-		foreach( $questions as $question ) {
115
-			$parts_of_subsection[ $question->ID() ] = $question->generate_form_input( $registration );
114
+		foreach ($questions as $question) {
115
+			$parts_of_subsection[$question->ID()] = $question->generate_form_input($registration);
116 116
 		}
117
-		$parts_of_subsection[ 'edit_link' ] = new EE_Form_Section_HTML(
118
-				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
119
-					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
117
+		$parts_of_subsection['edit_link'] = new EE_Form_Section_HTML(
118
+				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="'.esc_attr__('click to edit question', 'event_espresso').'">
119
+					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
120 120
 					<div class="dashicons dashicons-edit"></div>
121 121
 				</a></td></tr>'
122 122
 			);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	protected function _normalize($req_data) {
137 137
 		$this->_received_submission = TRUE;
138 138
 		$this->_validation_errors = array();
139
-		foreach($this->get_validatable_subsections() as $subsection){
140
-			if( $subsection->form_data_present_in( $req_data ) ) {
141
-				try{
139
+		foreach ($this->get_validatable_subsections() as $subsection) {
140
+			if ($subsection->form_data_present_in($req_data)) {
141
+				try {
142 142
 					$subsection->_normalize($req_data);
143
-				}catch( EE_Validation_Error $e ){
144
-					$subsection->add_validation_error( $e );
143
+				} catch (EE_Validation_Error $e) {
144
+					$subsection->add_validation_error($e);
145 145
 				}
146 146
 			}
147 147
 		}
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 	 * calling parent::_validate() first.
157 157
 	 */
158 158
 	protected function _validate() {
159
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
160
-			if( $subsection->form_data_present_in( array_merge( $_GET, $_POST ) ) ) {
161
-				if(method_exists($this,'_validate_'.$subsection_name)){
162
-					call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
159
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
160
+			if ($subsection->form_data_present_in(array_merge($_GET, $_POST))) {
161
+				if (method_exists($this, '_validate_'.$subsection_name)) {
162
+					call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
163 163
 				}
164 164
 				$subsection->_validate();
165
-			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
165
+			} elseif ($subsection instanceof EE_Form_Section_Proper) {
166 166
 				$subsection->_received_submission = true;
167 167
 			}
168 168
 		}
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin">
2 2
 
3
-	<h1><?php esc_attr_e( 'Event Espresso', 'event_espresso' ); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
3
+	<h1><?php esc_attr_e('Event Espresso', 'event_espresso'); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
4 4
 
5 5
 	<div id="ajax-notices-container"></div>
6 6
 
7 7
 	<?php echo $nav_tabs; ?>
8 8
 
9 9
 	<?php
10
-	do_action( 'AHEE__admin_wrapper__template__before_admin_page_content' );
10
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
11 11
 	echo $before_admin_page_content;
12 12
 	echo $admin_page_content;
13 13
 	echo $after_admin_page_content;
14
-	do_action( 'AHEE__admin_wrapper__template__after_admin_page_content' );
14
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
15 15
 	?>
16 16
 
17 17
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper_ajax.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin">
2
-	<h1><?php esc_attr_e( 'Event Espresso', 'event_espresso' ); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
2
+	<h1><?php esc_attr_e('Event Espresso', 'event_espresso'); ?>&nbsp;-&nbsp;<?php echo $admin_page_title; ?></h1>
3 3
 
4
-	<div class="ee-notices"><?php echo isset( $ajax_notices ) ? $ajax_notices : ''; ?></div>
4
+	<div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; ?></div>
5 5
 	<?php
6
-	do_action( 'AHEE__admin_wrapper__template__before_admin_page_content' );
6
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
7 7
 	echo $before_admin_page_content;
8 8
 	echo $admin_page_content;
9 9
 	echo $after_admin_page_content;
10
-	do_action( 'AHEE__admin_wrapper__template__after_admin_page_content' );
10
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
11 11
 	?>
12 12
 </div>
13 13
 <!-- espresso-admin -->
14 14
\ No newline at end of file
Please login to merge, or discard this patch.