Completed
Branch BUG-8698-ticket-sellouts+8511 (0d128a)
by
unknown
33:55 queued 17:36
created
core/libraries/form_sections/form_handlers/SequentialStepFormManager.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 use Exception;
17 17
 use InvalidArgumentException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 		$progress_step_style = 'number_bubbles',
116 116
 		EE_Request $request
117 117
 	) {
118
-		$this->setBaseUrl( $base_url );
119
-		$this->setDefaultFormStep( $default_form_step );
120
-		$this->setFormAction( $form_action );
121
-		$this->setFormConfig( $form_config );
122
-		$this->setProgressStepStyle( $progress_step_style );
118
+		$this->setBaseUrl($base_url);
119
+		$this->setDefaultFormStep($default_form_step);
120
+		$this->setFormAction($form_action);
121
+		$this->setFormConfig($form_config);
122
+		$this->setProgressStepStyle($progress_step_style);
123 123
 		$this->request = $request;
124 124
 	}
125 125
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
131 131
 	 */
132 132
 	public function baseUrl() {
133
-		if ( strpos( $this->base_url, $this->getCurrentStep()->slug() ) === false ) {
133
+		if (strpos($this->base_url, $this->getCurrentStep()->slug()) === false) {
134 134
 			add_query_arg(
135
-				array( $this->form_step_url_key => $this->getCurrentStep()->slug() ),
135
+				array($this->form_step_url_key => $this->getCurrentStep()->slug()),
136 136
 				$this->base_url
137 137
 			);
138 138
 		}
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @throws InvalidDataTypeException
147 147
 	 * @throws InvalidArgumentException
148 148
 	 */
149
-	protected function setBaseUrl( $base_url ) {
150
-		if ( ! is_string( $base_url ) ) {
151
-			throw new InvalidDataTypeException( '$base_url', $base_url, 'string' );
149
+	protected function setBaseUrl($base_url) {
150
+		if ( ! is_string($base_url)) {
151
+			throw new InvalidDataTypeException('$base_url', $base_url, 'string');
152 152
 		}
153
-		if ( empty( $base_url ) ) {
153
+		if (empty($base_url)) {
154 154
 			throw new InvalidArgumentException(
155
-				__( 'The base URL can not be an empty string.', 'event_espresso' )
155
+				__('The base URL can not be an empty string.', 'event_espresso')
156 156
 			);
157 157
 		}
158 158
 		$this->base_url = $base_url;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @throws InvalidDataTypeException
166 166
 	 */
167 167
 	public function formStepUrlKey() {
168
-		if ( empty( $this->form_step_url_key ) ) {
168
+		if (empty($this->form_step_url_key)) {
169 169
 			$this->setFormStepUrlKey();
170 170
 		}
171 171
 		return $this->form_step_url_key;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param string $form_step_url_key
178 178
 	 * @throws InvalidDataTypeException
179 179
 	 */
180
-	public function setFormStepUrlKey( $form_step_url_key = 'ee-form-step' ) {
181
-		if ( ! is_string( $form_step_url_key ) ) {
182
-			throw new InvalidDataTypeException( '$form_step_key', $form_step_url_key, 'string' );
180
+	public function setFormStepUrlKey($form_step_url_key = 'ee-form-step') {
181
+		if ( ! is_string($form_step_url_key)) {
182
+			throw new InvalidDataTypeException('$form_step_key', $form_step_url_key, 'string');
183 183
 		}
184
-		$this->form_step_url_key = ! empty( $form_step_url_key ) ? $form_step_url_key : 'ee-form-step';
184
+		$this->form_step_url_key = ! empty($form_step_url_key) ? $form_step_url_key : 'ee-form-step';
185 185
 	}
186 186
 
187 187
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * @param $default_form_step
200 200
 	 * @throws InvalidDataTypeException
201 201
 	 */
202
-	protected function setDefaultFormStep( $default_form_step ) {
203
-		if ( ! is_string( $default_form_step ) ) {
204
-			throw new InvalidDataTypeException( '$default_form_step', $default_form_step, 'string' );
202
+	protected function setDefaultFormStep($default_form_step) {
203
+		if ( ! is_string($default_form_step)) {
204
+			throw new InvalidDataTypeException('$default_form_step', $default_form_step, 'string');
205 205
 		}
206 206
 		$this->default_form_step = $default_form_step;
207 207
 	}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * @throws InvalidDataTypeException
215 215
 	 */
216 216
 	protected function setCurrentStepFromRequest() {
217
-		$current_step_slug = $this->request()->get( $this->formStepUrlKey(), $this->defaultFormStep() );
218
-		if ( ! $this->form_steps->setCurrent( $current_step_slug ) ) {
217
+		$current_step_slug = $this->request()->get($this->formStepUrlKey(), $this->defaultFormStep());
218
+		if ( ! $this->form_steps->setCurrent($current_step_slug)) {
219 219
 			throw new InvalidIdentifierException(
220 220
 				$current_step_slug,
221 221
 				$this->defaultFormStep(),
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
238 238
 	 */
239 239
 	public function getCurrentStep() {
240
-		if ( ! $this->form_steps->current() instanceof SequentialStepForm ) {
241
-			throw new InvalidFormHandlerException( $this->form_steps->current() );
240
+		if ( ! $this->form_steps->current() instanceof SequentialStepForm) {
241
+			throw new InvalidFormHandlerException($this->form_steps->current());
242 242
 		}
243 243
 		return $this->form_steps->current();
244 244
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
251 251
 	 */
252 252
 	public function formAction() {
253
-		if ( ! is_string( $this->form_action ) || empty( $this->form_action ) ) {
253
+		if ( ! is_string($this->form_action) || empty($this->form_action)) {
254 254
 			$this->form_action = $this->baseUrl();
255 255
 		}
256 256
 		return $this->form_action;
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 * @param string $form_action
263 263
 	 * @throws InvalidDataTypeException
264 264
 	 */
265
-	public function setFormAction( $form_action ) {
266
-		if ( ! is_string( $form_action ) ) {
267
-			throw new InvalidDataTypeException( '$form_action', $form_action, 'string' );
265
+	public function setFormAction($form_action) {
266
+		if ( ! is_string($form_action)) {
267
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
268 268
 		}
269 269
 		$this->form_action = $form_action;
270 270
 	}
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 	 * @param array $form_action_args
276 276
 	 * @throws InvalidDataTypeException
277 277
 	 */
278
-	public function addFormActionArgs( $form_action_args = array() ) {
279
-		if ( ! is_array( $form_action_args ) ) {
280
-			throw new InvalidDataTypeException( '$form_action_args', $form_action_args, 'array' );
278
+	public function addFormActionArgs($form_action_args = array()) {
279
+		if ( ! is_array($form_action_args)) {
280
+			throw new InvalidDataTypeException('$form_action_args', $form_action_args, 'array');
281 281
 		}
282
-		$form_action_args = ! empty( $form_action_args )
282
+		$form_action_args = ! empty($form_action_args)
283 283
 			? $form_action_args
284
-			: array( $this->formStepUrlKey() => $this->form_steps->current()->slug() );
284
+			: array($this->formStepUrlKey() => $this->form_steps->current()->slug());
285 285
 		$this->getCurrentStep()->setFormAction(
286
-			add_query_arg( $form_action_args, $this->formAction() )
286
+			add_query_arg($form_action_args, $this->formAction())
287 287
 		);
288 288
 		$this->form_action = $this->getCurrentStep()->formAction();
289 289
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	/**
303 303
 	 * @param string $form_config
304 304
 	 */
305
-	public function setFormConfig( $form_config ) {
305
+	public function setFormConfig($form_config) {
306 306
 		$this->form_config = $form_config;
307 307
 	}
308 308
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	/**
321 321
 	 * @param string $progress_step_style
322 322
 	 */
323
-	public function setProgressStepStyle( $progress_step_style ) {
323
+	public function setProgressStepStyle($progress_step_style) {
324 324
 		$this->progress_step_style = $progress_step_style;
325 325
 	}
326 326
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getProgressStepsCollection() {
342 342
 		static $collection = null;
343
-		if ( ! $collection instanceof ProgressStepCollection ) {
343
+		if ( ! $collection instanceof ProgressStepCollection) {
344 344
 			$collection = new ProgressStepCollection();
345 345
 		}
346 346
 		return $collection;
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 	 * @throws InvalidClassException
357 357
 	 * @throws InvalidInterfaceException
358 358
 	 */
359
-	protected function generateProgressSteps( Collection $progress_steps_collection ) {
359
+	protected function generateProgressSteps(Collection $progress_steps_collection) {
360 360
 		$current_step = $this->getCurrentStep();
361 361
 		/** @var SequentialStepForm $form_step */
362
-		foreach ( $this->form_steps as $form_step ) {
362
+		foreach ($this->form_steps as $form_step) {
363 363
 			// is this step active ?
364
-			if ( ! $form_step->initialize() ) {
364
+			if ( ! $form_step->initialize()) {
365 365
 				continue;
366 366
 			}
367 367
 			$progress_steps_collection->add(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			);
376 376
 		}
377 377
 		// set collection pointer back to current step
378
-		$this->form_steps->setCurrentUsingObject( $current_step );
378
+		$this->form_steps->setCurrentUsingObject($current_step);
379 379
 		return new ProgressStepManager(
380 380
 			$this->progressStepStyle(),
381 381
 			$this->defaultFormStep(),
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 * @throws InvalidInterfaceException
410 410
 	 * @throws InvalidArgumentException
411 411
 	 */
412
-	public function processForm( $form_data = array() ) {
412
+	public function processForm($form_data = array()) {
413 413
 		$this->buildCurrentStepFormForProcessing();
414
-		$this->processCurrentStepForm( $form_data );
414
+		$this->processCurrentStepForm($form_data);
415 415
 	}
416 416
 
417 417
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	public function buildCurrentStepFormForDisplay() {
428 428
 		$form_step = $this->buildCurrentStepForm();
429 429
 		// no displayable content ? then skip straight to processing
430
-		if ( ! $form_step->displayable() ) {
430
+		if ( ! $form_step->displayable()) {
431 431
 			$this->addFormActionArgs();
432
-			$form_step->setFormAction( $this->formAction() );
433
-			wp_safe_redirect( $form_step->formAction() );
432
+			$form_step->setFormAction($this->formAction());
433
+			wp_safe_redirect($form_step->formAction());
434 434
 		}
435 435
 	}
436 436
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @throws InvalidArgumentException
446 446
 	 */
447 447
 	public function buildCurrentStepFormForProcessing() {
448
-		$this->buildCurrentStepForm( false );
448
+		$this->buildCurrentStepForm(false);
449 449
 	}
450 450
 
451 451
 
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 	 * @throws InvalidInterfaceException
461 461
 	 * @throws InvalidArgumentException
462 462
 	 */
463
-	private function buildCurrentStepForm( $for_display = true ) {
463
+	private function buildCurrentStepForm($for_display = true) {
464 464
 		$this->form_steps = $this->getFormStepsCollection();
465 465
 		$this->setCurrentStepFromRequest();
466 466
 		$form_step = $this->getCurrentStep();
467
-		if ( $form_step->submitBtnText() === __( 'Submit', 'event_espresso' ) ) {
468
-			$form_step->setSubmitBtnText( __( 'Next Step', 'event_espresso' ) );
467
+		if ($form_step->submitBtnText() === __('Submit', 'event_espresso')) {
468
+			$form_step->setSubmitBtnText(__('Next Step', 'event_espresso'));
469 469
 		}
470
-		if ( $for_display && $form_step->displayable() ) {
470
+		if ($for_display && $form_step->displayable()) {
471 471
 			$this->progress_step_manager = $this->generateProgressSteps(
472 472
 				$this->getProgressStepsCollection()
473 473
 			);
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 			$this->progress_step_manager->setPreviousStepsCompleted();
479 479
 			$this->progress_step_manager->enqueueStylesAndScripts();
480 480
 			$this->addFormActionArgs();
481
-			$form_step->setFormAction( $this->formAction() );
481
+			$form_step->setFormAction($this->formAction());
482 482
 
483 483
 		} else {
484
-			$form_step->setRedirectUrl( $this->baseUrl() );
484
+			$form_step->setRedirectUrl($this->baseUrl());
485 485
 			$form_step->addRedirectArgs(
486
-				array( $this->formStepUrlKey() => $this->form_steps->current()->slug() )
486
+				array($this->formStepUrlKey() => $this->form_steps->current()->slug())
487 487
 			);
488 488
 		}
489 489
 		$form_step->generate();
490
-		if ( $for_display ) {
490
+		if ($for_display) {
491 491
 			$form_step->enqueueStylesAndScripts();
492 492
 		}
493 493
 		return $form_step;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @param bool $return_as_string
500 500
 	 * @return string
501 501
 	 */
502
-	public function displayProgressSteps( $return_as_string = true ) {
502
+	public function displayProgressSteps($return_as_string = true) {
503 503
 		$progress_steps = apply_filters(
504 504
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__before_steps',
505 505
 			''
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__after_steps',
510 510
 			''
511 511
 		);
512
-		if ( $return_as_string ) {
512
+		if ($return_as_string) {
513 513
 			return $progress_steps;
514 514
 		}
515 515
 		echo $progress_steps;
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @return string
524 524
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
525 525
 	 */
526
-	public function displayCurrentStepForm( $return_as_string = true ) {
527
-		if ( $return_as_string ) {
526
+	public function displayCurrentStepForm($return_as_string = true) {
527
+		if ($return_as_string) {
528 528
 			return $this->getCurrentStep()->display();
529 529
 		}
530 530
 		echo $this->getCurrentStep()->display();
@@ -539,32 +539,32 @@  discard block
 block discarded – undo
539 539
 	 * @throws InvalidArgumentException
540 540
 	 * @throws InvalidDataTypeException
541 541
 	 */
542
-	public function processCurrentStepForm( $form_data = array() ) {
542
+	public function processCurrentStepForm($form_data = array()) {
543 543
 		// grab instance of current step because after calling next() below,
544 544
 		// any calls to getCurrentStep() will return the "next" step because we advanced
545 545
 		$current_step = $this->getCurrentStep();
546 546
 		try {
547 547
 			// form processing should either throw exceptions or return true
548
-			$current_step->process( $form_data );
549
-		} catch ( Exception $e ) {
548
+			$current_step->process($form_data);
549
+		} catch (Exception $e) {
550 550
 			// something went wrong, so...
551 551
 			// if WP_DEBUG === true, display the Exception and stack trace right now
552
-			new ExceptionStackTraceDisplay( $e );
552
+			new ExceptionStackTraceDisplay($e);
553 553
 			// else convert the Exception to an EE_Error
554
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
554
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
555 555
 			// prevent redirect to next step or other if exception was thrown
556 556
 			if (
557 557
 				$current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_NEXT_STEP
558 558
 				|| $current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_OTHER
559 559
 			) {
560
-				$current_step->setRedirectTo( SequentialStepForm::REDIRECT_TO_CURRENT_STEP );
560
+				$current_step->setRedirectTo(SequentialStepForm::REDIRECT_TO_CURRENT_STEP);
561 561
 			}
562 562
 		}
563 563
 		// save notices to a transient so that when we redirect back
564 564
 		// to the display portion for this step
565 565
 		// those notices can be displayed
566
-		EE_Error::get_notices( false, true );
567
-		$this->redirectForm( $current_step );
566
+		EE_Error::get_notices(false, true);
567
+		$this->redirectForm($current_step);
568 568
 	}
569 569
 
570 570
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepFormInterface $current_step
576 576
 	 */
577
-	public function redirectForm( SequentialStepFormInterface $current_step ) {
577
+	public function redirectForm(SequentialStepFormInterface $current_step) {
578 578
 		$redirect_step = $current_step;
579
-		switch( $current_step->redirectTo() ) {
579
+		switch ($current_step->redirectTo()) {
580 580
 
581 581
 			case SequentialStepForm::REDIRECT_TO_OTHER :
582 582
 				// going somewhere else, so just check out now
583
-				wp_safe_redirect( $redirect_step->redirectUrl() );
583
+				wp_safe_redirect($redirect_step->redirectUrl());
584 584
 				exit();
585 585
 				break;
586 586
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
 			case SequentialStepForm::REDIRECT_TO_NEXT_STEP :
592 592
 				$this->form_steps->next();
593
-				if ( $this->form_steps->valid() ) {
593
+				if ($this->form_steps->valid()) {
594 594
 					$redirect_step = $this->form_steps->current();
595 595
 				}
596 596
 				break;
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 				// $redirect_step is already set
601 601
 
602 602
 		}
603
-		$current_step->setRedirectUrl( $this->baseUrl() );
603
+		$current_step->setRedirectUrl($this->baseUrl());
604 604
 		$current_step->addRedirectArgs(
605 605
 			// use the slug for whatever step we are redirecting too
606
-			array( $this->formStepUrlKey() => $redirect_step->slug() )
606
+			array($this->formStepUrlKey() => $redirect_step->slug())
607 607
 		);
608
-		wp_safe_redirect( $current_step->redirectUrl() );
608
+		wp_safe_redirect($current_step->redirectUrl());
609 609
 		exit();
610 610
 	}
611 611
 
Please login to merge, or discard this patch.
strategies/validation/EE_Full_HTML_Validation_Strategy.strategy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{
13
+class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param null $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = NULL ) {
19
-		if ( ! $validation_error_message ) {
18
+	public function __construct($validation_error_message = NULL) {
19
+		if ( ! $validation_error_message) {
20 20
 			$validation_error_message = sprintf(
21
-				__( 'Only the following HTML tags are allowed:%1$s%2$s', "event_espresso" ),
21
+				__('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"),
22 22
 				'<br />',
23 23
 				$this->get_list_of_allowed_tags()
24 24
 			);
25 25
 		}
26
-		parent::__construct( $validation_error_message );
26
+		parent::__construct($validation_error_message);
27 27
 	}
28 28
 
29 29
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function get_list_of_allowed_tags() {
39 39
 		global $allowedposttags;
40
-		ksort( $allowedposttags );
41
-		return implode( ', ', array_keys( $allowedposttags ) );
40
+		ksort($allowedposttags);
41
+		return implode(', ', array_keys($allowedposttags));
42 42
 	}
43 43
 
44 44
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function validate($normalized_value) {
51 51
 		global $allowedposttags;
52
-		parent::validate( $normalized_value );
53
-		$normalized_value_sans_tags =  wp_kses( "$normalized_value", $allowedposttags );
54
-		if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) {
55
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' );
52
+		parent::validate($normalized_value);
53
+		$normalized_value_sans_tags = wp_kses("$normalized_value", $allowedposttags);
54
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
55
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
56 56
 		}
57 57
 	}
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/form_sections/inputs/EE_Select_Ajax_Model_Rest_Input.input.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @subpackage
12 12
  * @author				Mike Nelson
13 13
  */
14
-class EE_Select_Ajax_Model_Rest_Input extends EE_Form_Input_With_Options_Base{
14
+class EE_Select_Ajax_Model_Rest_Input extends EE_Form_Input_With_Options_Base {
15 15
 
16 16
 	/**
17 17
 	 * @var string $_model_name
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 *                                  And the arguments accepted by EE_Form_Input_With_Options_Base
51 51
 	 * @throws \EE_Error
52 52
 	 */
53
-	public function __construct( $input_settings = array() ) {
53
+	public function __construct($input_settings = array()) {
54 54
 		//needed input settings:
55 55
 		//select2_args
56 56
 		$this->_model_name = EEH_Array::is_set(
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		);
67 67
 		// make sure limit and caps are always set
68 68
 		$query_params = array_merge(
69
-			array( 'limit' => 10, 'caps' => EEM_Base::caps_read_admin ),
69
+			array('limit' => 10, 'caps' => EEM_Base::caps_read_admin),
70 70
 			$query_params
71 71
 		);
72 72
 		$this->_value_field_name = EEH_Array::is_set(
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$this->_display_field_name = EEH_Array::is_set(
78 78
 			$input_settings,
79 79
 			'display_field_name',
80
-			$model->get_a_field_of_type( 'EE_Text_Field_Base' )->get_name()
80
+			$model->get_a_field_of_type('EE_Text_Field_Base')->get_name()
81 81
 		);
82 82
 		$this->_extra_select_columns = EEH_Array::is_set(
83 83
 			$input_settings,
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
 		);
95 95
 		//get resource endpoint
96 96
 		$rest_controller = new EventEspresso\core\libraries\rest_api\controllers\model\Read();
97
-		$rest_controller->set_requested_version( EED_Core_Rest_Api::latest_rest_api_version() );
97
+		$rest_controller->set_requested_version(EED_Core_Rest_Api::latest_rest_api_version());
98 98
 		$default_select2_args = array(
99 99
 			'ajax' => array(
100 100
 				'url' => $rest_controller->get_versioned_link_to(
101
-					EEH_Inflector::pluralize_and_lower( $this->_model_name )
101
+					EEH_Inflector::pluralize_and_lower($this->_model_name)
102 102
 				),
103 103
 				'dataType' => 'json',
104 104
 				'delay' => '250',
105 105
 				'data_interface' => 'EE_Select2_REST_API_Interface',
106 106
 				'data_interface_args' => array(
107
-					'default_query_params' => (object)Model_Data_Translator::prepare_query_params_for_rest_api(
107
+					'default_query_params' => (object) Model_Data_Translator::prepare_query_params_for_rest_api(
108 108
 						$query_params,
109 109
 						$model
110 110
 					),
111 111
 					'display_field' => $this->_display_field_name,
112 112
 					'value_field' => $this->_value_field_name,
113
-					'nonce' => wp_create_nonce( 'wp_rest' ),
114
-					'locale' => str_replace( '_', '-', strtolower( get_locale() ) )
113
+					'nonce' => wp_create_nonce('wp_rest'),
114
+					'locale' => str_replace('_', '-', strtolower(get_locale()))
115 115
 				),
116 116
 			),
117 117
 			'cache' => true,
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 		);
120 120
 		$select2_args = array_replace_recursive(
121 121
 			$default_select2_args,
122
-			(array)EEH_Array::is_set( $input_settings, 'select2_args', array() )
122
+			(array) EEH_Array::is_set($input_settings, 'select2_args', array())
123 123
 		);
124
-		$this->set_display_strategy( new EE_Select2_Display_Strategy( $select2_args ) );
125
-		parent::__construct( array(), $input_settings );
124
+		$this->set_display_strategy(new EE_Select2_Display_Strategy($select2_args));
125
+		parent::__construct(array(), $input_settings);
126 126
 	}
127 127
 
128 128
 
@@ -140,34 +140,34 @@  discard block
 block discarded – undo
140 140
 	 * @return void
141 141
 	 * @throws \EE_Error
142 142
 	 */
143
-	public function _set_raw_value( $value ) {
144
-		$values_for_options = (array)$value;
145
-		$value_field = $this->_get_model()->field_settings_for( $this->_value_field_name );
146
-		$display_field = $this->_get_model()->field_settings_for( $this->_display_field_name );
147
-		$this->_extra_select_columns[] = $value_field->get_qualified_column() . ' AS ' . $this->_value_field_name;
148
-		$this->_extra_select_columns[] = $display_field->get_qualified_column() . ' AS ' . $this->_display_field_name;
143
+	public function _set_raw_value($value) {
144
+		$values_for_options = (array) $value;
145
+		$value_field = $this->_get_model()->field_settings_for($this->_value_field_name);
146
+		$display_field = $this->_get_model()->field_settings_for($this->_display_field_name);
147
+		$this->_extra_select_columns[] = $value_field->get_qualified_column().' AS '.$this->_value_field_name;
148
+		$this->_extra_select_columns[] = $display_field->get_qualified_column().' AS '.$this->_display_field_name;
149 149
 		$display_values = $this->_get_model()->get_all_wpdb_results(
150 150
 			array(
151 151
 				array(
152
-					$this->_value_field_name => array( 'IN', $values_for_options )
152
+					$this->_value_field_name => array('IN', $values_for_options)
153 153
 				)
154 154
 			),
155 155
 			ARRAY_A,
156
-			implode( ',', $this->_extra_select_columns )
156
+			implode(',', $this->_extra_select_columns)
157 157
 		);
158 158
 		$select_options = array();
159
-		if( is_array( $select_options ) ) {
160
-			foreach( $display_values as $db_rows ) {
161
-				$db_rows = (array)$db_rows;
162
-				$select_options[ $db_rows[ $this->_value_field_name ] ] = apply_filters(
159
+		if (is_array($select_options)) {
160
+			foreach ($display_values as $db_rows) {
161
+				$db_rows = (array) $db_rows;
162
+				$select_options[$db_rows[$this->_value_field_name]] = apply_filters(
163 163
 					'FHEE__EE_Select_Ajax_Model_Rest_Input___set_raw_value__select_option_value',
164
-					$db_rows[ $this->_display_field_name ],
164
+					$db_rows[$this->_display_field_name],
165 165
 					$db_rows
166 166
 				);
167 167
 			}
168 168
 		}
169
-		$this->set_select_options( $select_options );
170
-		parent::_set_raw_value( $value );
169
+		$this->set_select_options($select_options);
170
+		parent::_set_raw_value($value);
171 171
 	}
172 172
 
173 173
 	/**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @throws EE_Error
177 177
 	 */
178 178
 	protected function _get_model() {
179
-		if( ! EE_Registry::instance()->is_model_name(  $this->_model_name ) ) {
179
+		if ( ! EE_Registry::instance()->is_model_name($this->_model_name)) {
180 180
 			throw new EE_Error(
181 181
 				sprintf(
182 182
 					__(
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				)
188 188
 			);
189 189
 		} else {
190
-			return EE_Registry::instance()->load_model( $this->_model_name );
190
+			return EE_Registry::instance()->load_model($this->_model_name);
191 191
 		}
192 192
 	}
193 193
 
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Addon.lib.php 1 patch
Spacing   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param string $min_core_version
67 67
 	 * @return string always like '4.3.0.rc.000'
68 68
 	 */
69
-	protected static function _effective_version( $min_core_version ) {
69
+	protected static function _effective_version($min_core_version) {
70 70
 		// versions: 4 . 3 . 1 . p . 123
71 71
 		// offsets:    0 . 1 . 2 . 3 . 4
72
-		$version_parts = explode( '.', $min_core_version );
72
+		$version_parts = explode('.', $min_core_version);
73 73
 		//check they specified the micro version (after 2nd period)
74
-		if( ! isset( $version_parts[ 2 ] ) ) {
75
-			$version_parts[ 2] = '0';
74
+		if ( ! isset($version_parts[2])) {
75
+			$version_parts[2] = '0';
76 76
 		}
77 77
 		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
78 78
 		//soon we can assume that's 'rc', but this current version is 'alpha'
79
-		if( ! isset( $version_parts[ 3 ] ) ) {
80
-			$version_parts[ 3 ] = 'dev';
79
+		if ( ! isset($version_parts[3])) {
80
+			$version_parts[3] = 'dev';
81 81
 		}
82
-		if( ! isset( $version_parts[ 4 ] ) ) {
83
-			$version_parts[ 4 ] = '000';
82
+		if ( ! isset($version_parts[4])) {
83
+			$version_parts[4] = '000';
84 84
 		}
85
-		return implode( '.', $version_parts );
85
+		return implode('.', $version_parts);
86 86
 
87 87
 	}
88 88
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $actual_core_version the actual core version, optional
93 93
 	 * @return boolean
94 94
 	 */
95
-	public static  function _meets_min_core_version_requirement( $min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION ) {
96
-		return version_compare( self::_effective_version( $actual_core_version ), self::_effective_version( $min_core_version ), '>=' );
95
+	public static  function _meets_min_core_version_requirement($min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION) {
96
+		return version_compare(self::_effective_version($actual_core_version), self::_effective_version($min_core_version), '>=');
97 97
 	}
98 98
 
99 99
 
@@ -155,112 +155,112 @@  discard block
 block discarded – undo
155 155
 	 * @throws EE_Error
156 156
 	 * @return void
157 157
 	 */
158
-	public static function register( $addon_name = '', $setup_args = array()  ) {
158
+	public static function register($addon_name = '', $setup_args = array()) {
159 159
 		// required fields MUST be present, so let's make sure they are.
160
-		if ( empty( $addon_name ) || ! is_array( $setup_args )) {
161
-			throw new EE_Error( __( 'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso' ));
160
+		if (empty($addon_name) || ! is_array($setup_args)) {
161
+			throw new EE_Error(__('In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso'));
162 162
 		}
163
-		if ( ! isset($setup_args[ 'main_file_path' ]) || empty( $setup_args[ 'main_file_path' ] ) ){
164
-			throw new EE_Error( sprintf( __( 'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso' ), implode(",", array_keys( $setup_args ) ) ) );
163
+		if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
164
+			throw new EE_Error(sprintf(__('When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso'), implode(",", array_keys($setup_args))));
165 165
 		}
166 166
 		// check that addon has not already been registered with that name
167
-		if ( isset( self::$_settings[ $addon_name ] ) && ! did_action( 'activate_plugin' ) ) {
168
-			throw new EE_Error( sprintf( __( 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso' ), $addon_name ));
167
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
168
+			throw new EE_Error(sprintf(__('An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso'), $addon_name));
169 169
 		}
170 170
 
171 171
 
172 172
 		// no class name for addon?
173
-		if ( empty( $setup_args['class_name'] )) {
173
+		if (empty($setup_args['class_name'])) {
174 174
 			// generate one by first separating name with spaces
175
-			$class_name = str_replace( array( '-', '_' ), ' ', trim( $addon_name ));
175
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
176 176
 			//capitalize, then replace spaces with underscores
177
-			$class_name = str_replace( ' ', '_', ucwords( $class_name ));
177
+			$class_name = str_replace(' ', '_', ucwords($class_name));
178 178
 		} else {
179 179
 			$class_name = $setup_args['class_name'];
180 180
 		}
181
-		$class_name = strpos( $class_name, 'EE_' ) === 0 ? $class_name : 'EE_' . $class_name;
181
+		$class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
182 182
 		//setup $_settings array from incoming values.
183 183
 		$addon_settings = array(
184 184
 			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
185 185
 			'class_name' 						=> $class_name,
186 186
 			// the addon slug for use in URLs, etc
187
-			'plugin_slug' 						=> isset( $setup_args['plugin_slug'] ) ? (string)$setup_args['plugin_slug'] : '',
187
+			'plugin_slug' 						=> isset($setup_args['plugin_slug']) ? (string) $setup_args['plugin_slug'] : '',
188 188
 			// page slug to be used when generating the "Settings" link on the WP plugin page
189
-			'plugin_action_slug' 			=> isset( $setup_args[ 'plugin_action_slug' ] ) ? (string)$setup_args[ 'plugin_action_slug' ] : '',
189
+			'plugin_action_slug' 			=> isset($setup_args['plugin_action_slug']) ? (string) $setup_args['plugin_action_slug'] : '',
190 190
 			// the "software" version for the addon
191
-			'version' 								=> isset( $setup_args['version'] ) ? (string)$setup_args['version'] : '',
191
+			'version' 								=> isset($setup_args['version']) ? (string) $setup_args['version'] : '',
192 192
 			// the minimum version of EE Core that the addon will work with
193
-			'min_core_version' 			=> isset( $setup_args['min_core_version'] ) ? (string)$setup_args['min_core_version'] : '',
193
+			'min_core_version' 			=> isset($setup_args['min_core_version']) ? (string) $setup_args['min_core_version'] : '',
194 194
 			// the minimum version of WordPress that the addon will work with
195
-			'min_wp_version' 			=> isset( $setup_args['min_wp_version'] ) ? (string)$setup_args['min_wp_version'] : EE_MIN_WP_VER_REQUIRED,
195
+			'min_wp_version' 			=> isset($setup_args['min_wp_version']) ? (string) $setup_args['min_wp_version'] : EE_MIN_WP_VER_REQUIRED,
196 196
 			// full server path to main file (file loaded directly by WP)
197
-			'main_file_path' 					=> isset( $setup_args['main_file_path'] ) ? (string)$setup_args['main_file_path'] : '',
197
+			'main_file_path' 					=> isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '',
198 198
 			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
199
-			'admin_path' 						=> isset( $setup_args['admin_path'] ) ? (string)$setup_args['admin_path'] : '',
199
+			'admin_path' 						=> isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '',
200 200
 			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
201
-			'admin_callback' 				=> isset( $setup_args['admin_callback'] ) ? (string)$setup_args['admin_callback'] : '',
201
+			'admin_callback' 				=> isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '',
202 202
 			// the section name for this addon's configuration settings section (defaults to "addons")
203
-			'config_section' 					=> isset( $setup_args['config_section'] ) ? (string)$setup_args['config_section'] : 'addons',
203
+			'config_section' 					=> isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons',
204 204
 			// the class name for this addon's configuration settings object
205
-			'config_class' 						=> isset( $setup_args['config_class'] ) ? (string)$setup_args['config_class'] : '',
205
+			'config_class' 						=> isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '',
206 206
 			//the name given to the config for this addons' configuration settings object (optional)
207
-			'config_name' 					=> isset( $setup_args['config_name'] ) ? (string) $setup_args['config_name']: '',
207
+			'config_name' 					=> isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '',
208 208
 			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
209
-			'autoloader_paths' 			=> isset( $setup_args['autoloader_paths'] ) ? (array)$setup_args['autoloader_paths'] : array(),
209
+			'autoloader_paths' 			=> isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(),
210 210
 			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
211
-			'autoloader_folders' 			=> isset( $setup_args['autoloader_folders'] ) ? (array)$setup_args['autoloader_folders'] : array(),
211
+			'autoloader_folders' 			=> isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(),
212 212
 			// array of full server paths to any EE_DMS data migration scripts used by the addon
213
-			'dms_paths' 						=> isset( $setup_args['dms_paths'] ) ? (array)$setup_args['dms_paths'] : array(),
213
+			'dms_paths' 						=> isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(),
214 214
 			// array of full server paths to any EED_Modules used by the addon
215
-			'module_paths' 					=> isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
215
+			'module_paths' 					=> isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
216 216
 			// array of full server paths to any EES_Shortcodes used by the addon
217
-			'shortcode_paths'			 	=> isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
217
+			'shortcode_paths'			 	=> isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
218 218
 			// array of full server paths to any WP_Widgets used by the addon
219
-			'widget_paths' 					=> isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
219
+			'widget_paths' 					=> isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
220 220
 			// array of PUE options used by the addon
221
-			'pue_options' 						=> isset( $setup_args['pue_options'] ) ? (array)$setup_args['pue_options'] : array(),
222
-			'message_types' 				=> isset( $setup_args['message_types'] ) ? (array) $setup_args['message_types'] : array(),
223
-			'capabilities' 						=> isset( $setup_args['capabilities'] ) ? (array) $setup_args['capabilities'] : array(),
224
-			'capability_maps' 				=> isset( $setup_args['capability_maps'] ) ? (array) $setup_args['capability_maps'] : array(),
225
-			'model_paths' 					=> isset( $setup_args['model_paths'] ) ? (array) $setup_args['model_paths'] : array(),
226
-			'class_paths' 						=> isset( $setup_args['class_paths'] ) ? (array) $setup_args['class_paths'] : array(),
227
-			'model_extension_paths' 	=> isset( $setup_args['model_extension_paths'] ) ? (array) $setup_args['model_extension_paths'] : array(),
228
-			'class_extension_paths' 		=> isset( $setup_args['class_extension_paths'] ) ? (array) $setup_args['class_extension_paths'] : array(),
229
-			'custom_post_types' 			=> isset( $setup_args['custom_post_types'] ) ? (array) $setup_args['custom_post_types'] : array(),
230
-			'custom_taxonomies' 		=> isset( $setup_args['custom_taxonomies'] ) ? (array) $setup_args['custom_taxonomies'] : array(),
231
-			'payment_method_paths'	=> isset( $setup_args[ 'payment_method_paths' ] ) ? (array) $setup_args[ 'payment_method_paths' ] : array(),
232
-			'default_terms' 					=> isset( $setup_args['default_terms'] ) ? (array) $setup_args['default_terms'] : array(),
221
+			'pue_options' 						=> isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(),
222
+			'message_types' 				=> isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(),
223
+			'capabilities' 						=> isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(),
224
+			'capability_maps' 				=> isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(),
225
+			'model_paths' 					=> isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(),
226
+			'class_paths' 						=> isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(),
227
+			'model_extension_paths' 	=> isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(),
228
+			'class_extension_paths' 		=> isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(),
229
+			'custom_post_types' 			=> isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(),
230
+			'custom_taxonomies' 		=> isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(),
231
+			'payment_method_paths'	=> isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
232
+			'default_terms' 					=> isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(),
233 233
 			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page that can be used for adding upgrading/marketing info
234
-			'plugins_page_row' 			=> isset( $setup_args['plugins_page_row'] ) ? $setup_args['plugins_page_row'] : '',
234
+			'plugins_page_row' 			=> isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '',
235 235
 		);
236 236
 
237 237
 		// if plugin_action_slug is NOT set, but an admin page path IS set, then let's just use the plugin_slug since that will be used for linking to the admin page
238
-		$addon_settings[ 'plugin_action_slug' ] = empty( $addon_settings[ 'plugin_action_slug' ] ) && ! empty( $addon_settings[ 'admin_path' ] ) ? $addon_settings[ 'plugin_slug' ] : $addon_settings[ 'plugin_action_slug' ];
238
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) && ! empty($addon_settings['admin_path']) ? $addon_settings['plugin_slug'] : $addon_settings['plugin_action_slug'];
239 239
 		// full server path to main file (file loaded directly by WP)
240
-		$addon_settings['plugin_basename'] = plugin_basename( $addon_settings[ 'main_file_path' ] );
240
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
241 241
 
242 242
 		global $wp_version;
243 243
 		//check whether this addon version is compatible with EE core
244
-		if ( isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) &&
245
-				! self::_meets_min_core_version_requirement( EE_Register_Addon::$_incompatible_addons[ $addon_name ], $addon_settings[ 'version' ] ) ) {
244
+		if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) &&
245
+				! self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
246 246
 			$incompatibility_message = sprintf(
247
-				__( 'The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso' ),
247
+				__('The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso'),
248 248
 				$addon_name,
249 249
 				'<br />',
250
-				EE_Register_Addon::$_incompatible_addons[ $addon_name ]
250
+				EE_Register_Addon::$_incompatible_addons[$addon_name]
251 251
 			);
252
-		} else if ( ! self::_meets_min_core_version_requirement( $addon_settings[ 'min_core_version' ], espresso_version() ) ) {
252
+		} else if ( ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())) {
253 253
 			$incompatibility_message = sprintf(
254 254
 				__(
255 255
 					'The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".',
256 256
 					'event_espresso'
257 257
 				),
258 258
 				$addon_name,
259
-				self::_effective_version( $addon_settings[ 'min_core_version' ] ),
260
-				self::_effective_version( espresso_version() ),
259
+				self::_effective_version($addon_settings['min_core_version']),
260
+				self::_effective_version(espresso_version()),
261 261
 				'<br />'
262 262
 			);
263
-		} else if (version_compare( $wp_version, $addon_settings['min_wp_version'], '<' )) {
263
+		} else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
264 264
 			$incompatibility_message = sprintf(
265 265
 				__(
266 266
 					'The Event Espresso "%1$s" addon could not be activated because it requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
@@ -269,137 +269,137 @@  discard block
 block discarded – undo
269 269
 				$addon_name,
270 270
 				$addon_settings['min_wp_version'],
271 271
 				'<br />'
272
-			);;
272
+			); ;
273 273
 		} else {
274 274
 			$incompatibility_message = '';
275 275
 		}
276
-		if ( ! empty( $incompatibility_message ) ) {
276
+		if ( ! empty($incompatibility_message)) {
277 277
 			//remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
278 278
 			//plugin activated fine when it didn't
279
-			if( isset( $_GET[ 'activate' ]) ) {
280
-				unset( $_GET[ 'activate' ] );
279
+			if (isset($_GET['activate'])) {
280
+				unset($_GET['activate']);
281 281
 			}
282
-			if( isset( $_REQUEST[ 'activate' ] ) ){
283
-				unset( $_REQUEST[ 'activate' ] );
282
+			if (isset($_REQUEST['activate'])) {
283
+				unset($_REQUEST['activate']);
284 284
 			}
285 285
 			//and show an error message indicating the plugin didn't activate properly
286
-			EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ );
287
-			if ( current_user_can( 'activate_plugins' )) {
288
-				require_once( ABSPATH.'wp-admin/includes/plugin.php' );
289
-				deactivate_plugins( plugin_basename( $addon_settings[ 'main_file_path' ] ), TRUE );
286
+			EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
287
+			if (current_user_can('activate_plugins')) {
288
+				require_once(ABSPATH.'wp-admin/includes/plugin.php');
289
+				deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
290 290
 			}
291 291
 			return;
292 292
 		}
293 293
 		//this is an activation request
294
-		if( did_action( 'activate_plugin' ) ){
294
+		if (did_action('activate_plugin')) {
295 295
 			//to find if THIS is the addon that was activated,
296 296
 			//just check if we have already registered it or not
297 297
 			//(as the newly-activated addon wasn't around the first time addons were registered)
298
-			if( ! isset( self::$_settings[ $addon_name ] ) ){
299
-				self::$_settings[ $addon_name ] = $addon_settings;
298
+			if ( ! isset(self::$_settings[$addon_name])) {
299
+				self::$_settings[$addon_name] = $addon_settings;
300 300
 				$addon = self::_load_and_init_addon_class($addon_name);
301 301
 				$addon->set_activation_indicator_option();
302 302
 				//dont bother setting up the rest of the addon.
303 303
 				//we know it was just activated and the request will end soon
304 304
 			}
305 305
 			return;
306
-		}else{
306
+		} else {
307 307
 			// make sure this was called in the right place!
308
-			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
308
+			if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
309 309
 				EE_Error::doing_it_wrong(
310 310
 					__METHOD__,
311 311
 					sprintf(
312
-						__( 'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.','event_espresso'),
312
+						__('An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.', 'event_espresso'),
313 313
 						$addon_name
314 314
 					),
315 315
 					'4.3.0'
316 316
 				);
317 317
 			}
318
-			self::$_settings[ $addon_name ] = $addon_settings;
318
+			self::$_settings[$addon_name] = $addon_settings;
319 319
 		}
320 320
 		// we need cars
321
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] )) {
321
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
322 322
 			// setup autoloader for single file
323
-			EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] );
323
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
324 324
 		}
325 325
 		// setup autoloaders for folders
326
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] )) {
327
-			foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) {
328
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder );
326
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
327
+			foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
328
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
329 329
 			}
330 330
 		}
331 331
 		// register new models
332
-		if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
333
-			EE_Register_Model::register( $addon_name, array( 'model_paths' => self::$_settings[ $addon_name ]['model_paths'] , 'class_paths' => self::$_settings[ $addon_name ]['class_paths']));
332
+		if ( ! empty(self::$_settings[$addon_name]['model_paths']) || ! empty(self::$_settings[$addon_name]['class_paths'])) {
333
+			EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
334 334
 		}
335 335
 		// register model extensions
336
-		if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
337
-			EE_Register_Model_Extensions::register( $addon_name, array( 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'] , 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths']));
336
+		if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) || ! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
337
+			EE_Register_Model_Extensions::register($addon_name, array('model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths']));
338 338
 		}
339 339
 		// setup DMS
340
-		if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
341
-			EE_Register_Data_Migration_Scripts::register( $addon_name, array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ));
340
+		if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
341
+			EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
342 342
 		}
343 343
 		// if config_class is present let's register config.
344
-		if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
344
+		if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
345 345
 			EE_Register_Config::register(
346
-				self::$_settings[ $addon_name ]['config_class'],
346
+				self::$_settings[$addon_name]['config_class'],
347 347
 				array(
348
-					'config_section' => self::$_settings[ $addon_name ]['config_section'],
349
-					'config_name' => self::$_settings[ $addon_name ]['config_name']
348
+					'config_section' => self::$_settings[$addon_name]['config_section'],
349
+					'config_name' => self::$_settings[$addon_name]['config_name']
350 350
 				)
351 351
 			);
352 352
 		}
353 353
 		// register admin page
354
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
355
-			EE_Register_Admin_Page::register( $addon_name, array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ));
354
+		if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
355
+			EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
356 356
 
357 357
 		}
358 358
 		// add to list of modules to be registered
359
-		if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
360
-			EE_Register_Module::register( $addon_name, array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ));
359
+		if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
360
+			EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
361 361
 		}
362 362
 		// add to list of shortcodes to be registered
363
-		if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
364
-			EE_Register_Shortcode::register( $addon_name, array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ));
363
+		if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
364
+			EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
365 365
 		}
366 366
 		// add to list of widgets to be registered
367
-		if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
368
-			EE_Register_Widget::register( $addon_name, array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ));
367
+		if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
368
+			EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
369 369
 		}
370 370
 
371 371
 		//register capability related stuff.
372
-		if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) {
373
-			EE_Register_Capabilities::register( $addon_name , array( 'capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps'] ) );
372
+		if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
373
+			EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
374 374
 		}
375 375
 		//any message type to register?
376
-		if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
377
-				add_action( 'EE_Brewing_Regular___messages_caf', array( 'EE_Register_Addon', 'register_message_types' ) );
376
+		if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
377
+				add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
378 378
 		}
379 379
 
380 380
 		// if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
381
-		if ( ! empty( $setup_args['pue_options'] )) {
382
-			self::$_settings[ $addon_name ]['pue_options'] = array(
383
-				'pue_plugin_slug' 	=> isset( $setup_args['pue_options']['pue_plugin_slug'] ) ? (string)$setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower( $class_name ),
384
-				'plugin_basename' => isset( $setup_args['pue_options']['plugin_basename'] ) ? (string)$setup_args['pue_options']['plugin_basename'] : plugin_basename( self::$_settings[ $addon_name ]['main_file_path'] ),
385
-				'checkPeriod' 			=> isset( $setup_args['pue_options']['checkPeriod'] ) ? (string)$setup_args['pue_options']['checkPeriod'] : '24',
386
-				'use_wp_update'		=> isset( $setup_args['pue_options']['use_wp_update'] ) ? (string)$setup_args['pue_options']['use_wp_update'] : FALSE
381
+		if ( ! empty($setup_args['pue_options'])) {
382
+			self::$_settings[$addon_name]['pue_options'] = array(
383
+				'pue_plugin_slug' 	=> isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_'.strtolower($class_name),
384
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) ? (string) $setup_args['pue_options']['plugin_basename'] : plugin_basename(self::$_settings[$addon_name]['main_file_path']),
385
+				'checkPeriod' 			=> isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24',
386
+				'use_wp_update'		=> isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE
387 387
 			);
388
-			add_action( 'AHEE__EE_System__brew_espresso__after_pue_init', array( 'EE_Register_Addon', 'load_pue_update' ));
388
+			add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
389 389
 		}
390 390
 
391 391
 		//any custom post type/ custom capabilities or default terms to register
392
-		if ( !empty( self::$_settings[$addon_name]['custom_post_types'] ) || !empty( self::$_settings[$addon_name]['custom_taxonomies'] ) ) {
393
-			EE_Register_CPT::register( $addon_name, array( 'cpts' => self::$_settings[$addon_name]['custom_post_types'] , 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms'] ) );
392
+		if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
393
+			EE_Register_CPT::register($addon_name, array('cpts' => self::$_settings[$addon_name]['custom_post_types'], 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms']));
394 394
 		}
395
-		if( ! empty( self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) ){
396
-			EE_Register_Payment_Method::register($addon_name, array( 'payment_method_paths' => self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) );
395
+		if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
396
+			EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
397 397
 		}
398 398
 		// load and instantiate main addon class
399 399
 		$addon = self::_load_and_init_addon_class($addon_name);
400 400
 		// call any additional admin_callback functions during load_admin_controller hook
401
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] )) {
402
-			add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ));
401
+		if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
402
+			add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
403 403
 		}
404 404
 	}
405 405
 
@@ -410,22 +410,22 @@  discard block
 block discarded – undo
410 410
 	 * @param string $addon_name
411 411
 	 * @return EE_Addon
412 412
 	 */
413
-	private static function _load_and_init_addon_class($addon_name){
414
-		$addon = EE_Registry::instance()->load_addon( dirname( self::$_settings[ $addon_name ]['main_file_path'] ), self::$_settings[ $addon_name ]['class_name'] );
415
-		$addon->set_name( $addon_name );
416
-		$addon->set_plugin_slug( self::$_settings[ $addon_name ][ 'plugin_slug' ] );
417
-		$addon->set_plugin_basename( self::$_settings[ $addon_name ][ 'plugin_basename' ] );
418
-		$addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] );
419
-		$addon->set_plugin_action_slug( self::$_settings[ $addon_name ][ 'plugin_action_slug' ] );
420
-		$addon->set_plugins_page_row( self::$_settings[ $addon_name ][ 'plugins_page_row' ] );
421
-		$addon->set_version( self::$_settings[ $addon_name ]['version'] );
422
-		$addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) );
423
-		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
424
-		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
425
-		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
413
+	private static function _load_and_init_addon_class($addon_name) {
414
+		$addon = EE_Registry::instance()->load_addon(dirname(self::$_settings[$addon_name]['main_file_path']), self::$_settings[$addon_name]['class_name']);
415
+		$addon->set_name($addon_name);
416
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
417
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
418
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
419
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
420
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
421
+		$addon->set_version(self::$_settings[$addon_name]['version']);
422
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
423
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
424
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
425
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
426 426
 		//unfortunately this can't be hooked in upon construction, because we don't have
427 427
 		//the plugin mainfile's path upon construction.
428
-		register_deactivation_hook($addon->get_main_plugin_file(), array($addon,'deactivation'));
428
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
429 429
 		return $addon;
430 430
 	}
431 431
 
@@ -438,18 +438,18 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	public static function load_pue_update() {
440 440
 		// load PUE client
441
-		require_once  EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
441
+		require_once  EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
442 442
 		// cycle thru settings
443
-		foreach ( self::$_settings as $settings ) {
444
-			if ( ! empty( $settings['pue_options'] )) {
443
+		foreach (self::$_settings as $settings) {
444
+			if ( ! empty($settings['pue_options'])) {
445 445
 				// initiate the class and start the plugin update engine!
446 446
 				new PluginUpdateEngineChecker(
447 447
 				// host file URL
448 448
 					'https://eventespresso.com',
449 449
 					// plugin slug(s)
450 450
 					array(
451
-						'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ),
452
-						'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' )
451
+						'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']),
452
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr')
453 453
 					),
454 454
 					// options
455 455
 					array(
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 	 * @return void
478 478
 	 */
479 479
 	public static function register_message_types() {
480
-		foreach ( self::$_settings as $settings ) {
481
-			foreach( $settings['message_types'] as $message_type => $message_type_settings ) {
482
-				EE_Register_Message_Type::register( $message_type, $message_type_settings );
480
+		foreach (self::$_settings as $settings) {
481
+			foreach ($settings['message_types'] as $message_type => $message_type_settings) {
482
+				EE_Register_Message_Type::register($message_type, $message_type_settings);
483 483
 			}
484 484
 		}
485 485
 	}
@@ -495,60 +495,60 @@  discard block
 block discarded – undo
495 495
 	 * @throws EE_Error
496 496
 	 * @return void
497 497
 	 */
498
-	public static function deregister( $addon_name = NULL ) {
499
-		if ( isset( self::$_settings[ $addon_name ] )) {
500
-			$class_name = self::$_settings[ $addon_name ]['class_name'];
501
-			if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
498
+	public static function deregister($addon_name = NULL) {
499
+		if (isset(self::$_settings[$addon_name])) {
500
+			$class_name = self::$_settings[$addon_name]['class_name'];
501
+			if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
502 502
 				// setup DMS
503
-				EE_Register_Data_Migration_Scripts::deregister( $addon_name );
503
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
504 504
 			}
505
-			if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
505
+			if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
506 506
 				// register admin page
507
-				EE_Register_Admin_Page::deregister( $addon_name );
507
+				EE_Register_Admin_Page::deregister($addon_name);
508 508
 			}
509
-			if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
509
+			if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
510 510
 				// add to list of modules to be registered
511
-				EE_Register_Module::deregister( $addon_name );
511
+				EE_Register_Module::deregister($addon_name);
512 512
 			}
513
-			if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
513
+			if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
514 514
 				// add to list of shortcodes to be registered
515
-				EE_Register_Shortcode::deregister( $addon_name );
515
+				EE_Register_Shortcode::deregister($addon_name);
516 516
 			}
517
-			if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
517
+			if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
518 518
 				// if config_class present let's register config.
519
-				EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class']);
519
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
520 520
 			}
521
-			if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
521
+			if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
522 522
 				// add to list of widgets to be registered
523
-				EE_Register_Widget::deregister( $addon_name );
523
+				EE_Register_Widget::deregister($addon_name);
524 524
 			}
525
-			if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) ||
526
-					! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
525
+			if ( ! empty(self::$_settings[$addon_name]['model_paths']) ||
526
+					! empty(self::$_settings[$addon_name]['class_paths'])) {
527 527
 				// add to list of shortcodes to be registered
528
-				EE_Register_Model::deregister( $addon_name );
528
+				EE_Register_Model::deregister($addon_name);
529 529
 			}
530
-			if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) ||
531
-					! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
530
+			if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) ||
531
+					! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
532 532
 				// add to list of shortcodes to be registered
533
-				EE_Register_Model_Extensions::deregister( $addon_name );
533
+				EE_Register_Model_Extensions::deregister($addon_name);
534 534
 				}
535
-			if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
536
-				foreach( self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings ) {
537
-					EE_Register_Message_Type::deregister( $message_type );
535
+			if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
536
+				foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
537
+					EE_Register_Message_Type::deregister($message_type);
538 538
 				}
539 539
 			}
540 540
 			//deregister capabilities for addon
541
-			if ( ! empty( self::$_settings[$addon_name]['capabilities'] ) || ! empty( self::$_settings[$addon_name]['capability_maps']) ) {
542
-				EE_Register_Capabilities::deregister( $addon_name );
541
+			if ( ! empty(self::$_settings[$addon_name]['capabilities']) || ! empty(self::$_settings[$addon_name]['capability_maps'])) {
542
+				EE_Register_Capabilities::deregister($addon_name);
543 543
 			}
544 544
 			//deregister custom_post_types for addon
545
-			if ( ! empty( self::$_settings[$addon_name]['custom_post_types'] ) ) {
546
-				EE_Register_CPT::deregister( $addon_name );
545
+			if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
546
+				EE_Register_CPT::deregister($addon_name);
547 547
 			}
548
-			remove_action('deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),  array( EE_Registry::instance()->addons->{$class_name}, 'deactivation' ) );
549
-			remove_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required' ) );
548
+			remove_action('deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->{$class_name}, 'deactivation'));
549
+			remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required'));
550 550
 			unset(EE_Registry::instance()->addons->{$class_name});
551
-			unset( self::$_settings[ $addon_name ] );
551
+			unset(self::$_settings[$addon_name]);
552 552
 		}
553 553
 	}
554 554
 
Please login to merge, or discard this patch.
admin_pages/transactions/EE_Admin_Transactions_List_Table.class.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	/**
32 32
 	 * @param \Transactions_Admin_Page $admin_page
33 33
 	 */
34
-	public function __construct( \Transactions_Admin_Page $admin_page ){
35
-		parent::__construct( $admin_page );
34
+	public function __construct(\Transactions_Admin_Page $admin_page) {
35
+		parent::__construct($admin_page);
36 36
 		$this->_status = $this->_admin_page->get_transaction_status_array();
37 37
 	}
38 38
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	 *_setup_data
43 43
 	 */
44 44
 	protected function _setup_data() {
45
-		$this->_data = $this->_admin_page->get_transactions( $this->_per_page );
46
-		$status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all';
47
-		$this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status );
45
+		$this->_data = $this->_admin_page->get_transactions($this->_per_page);
46
+		$status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all';
47
+		$this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status);
48 48
 	}
49 49
 
50 50
 
@@ -59,25 +59,25 @@  discard block
 block discarded – undo
59 59
 			'ajax' => TRUE,
60 60
 			'screen' => $this->_admin_page->get_current_screen()->id
61 61
 			);
62
-		$ID_column_name = __( 'ID', 'event_espresso' );
62
+		$ID_column_name = __('ID', 'event_espresso');
63 63
 		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
64
-		$ID_column_name .= __( 'Transaction Date', 'event_espresso' );
64
+		$ID_column_name .= __('Transaction Date', 'event_espresso');
65 65
 		$ID_column_name .= '</span> ';
66 66
 		$this->_columns = array(
67 67
 			'TXN_ID' => $ID_column_name,
68
-			'TXN_timestamp'	=> __( 'Transaction Date', 'event_espresso' ),
69
-			'TXN_total' => __( 'Total', 'event_espresso' ),
70
-			'TXN_paid' => __( 'Paid', 'event_espresso' ),
71
-			'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ),
72
-			'event_name' => __( 'Event', 'event_espresso' ),
73
-			'actions' => __( 'Actions', 'event_espresso' )
68
+			'TXN_timestamp'	=> __('Transaction Date', 'event_espresso'),
69
+			'TXN_total' => __('Total', 'event_espresso'),
70
+			'TXN_paid' => __('Paid', 'event_espresso'),
71
+			'ATT_fname' => __('Primary Registrant', 'event_espresso'),
72
+			'event_name' => __('Event', 'event_espresso'),
73
+			'actions' => __('Actions', 'event_espresso')
74 74
 		);
75 75
 
76 76
 		$this->_sortable_columns = array(
77
-			'TXN_ID' => array( 'TXN_ID' => FALSE ),
78
-			'event_name' => array( 'event_name'=> FALSE ),
79
-			'ATT_fname'	=> array( 'ATT_fname'=> FALSE ),
80
-			'TXN_timestamp'	=> array( 'TXN_timestamp'=> TRUE ) //true means its already sorted
77
+			'TXN_ID' => array('TXN_ID' => FALSE),
78
+			'event_name' => array('event_name'=> FALSE),
79
+			'ATT_fname'	=> array('ATT_fname'=> FALSE),
80
+			'TXN_timestamp'	=> array('TXN_timestamp'=> TRUE) //true means its already sorted
81 81
 		);
82 82
 
83 83
 		$this->_primary_column = 'TXN_ID';
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return string
96 96
 	 * @throws \EE_Error
97 97
 	 */
98
-	protected function _get_row_class( $item ) {
99
-		$class = parent::_get_row_class( $item );
98
+	protected function _get_row_class($item) {
99
+		$class = parent::_get_row_class($item);
100 100
 		//add status class
101
-		$class .= ' ee-status-strip txn-status-' . $item->status_ID();
102
-		if ( $this->_has_checkbox_column ) {
101
+		$class .= ' ee-status-strip txn-status-'.$item->status_ID();
102
+		if ($this->_has_checkbox_column) {
103 103
 			$class .= ' has-checkbox-column';
104 104
 		}
105 105
 		return $class;
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function _get_table_filters() {
118 118
 		$filters = array();
119
-		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
120
-		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y', current_time('timestamp') );
119
+		$start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
120
+		$end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y', current_time('timestamp'));
121 121
 		ob_start();
122 122
 		?>
123 123
 		<label for="txn-filter-start-date">Display Transactions from </label>
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 *_add_view_counts
137 137
 	 */
138 138
 	protected function _add_view_counts() {
139
-		$this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' );
140
-		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' );
141
-		$this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' );
139
+		$this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all');
140
+		$this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned');
141
+		$this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed');
142 142
 	}
143 143
 
144 144
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	 * @return string
151 151
 	 * @throws \EE_Error
152 152
 	 */
153
-	public function column_TXN_ID( EE_Transaction $item ){
154
-    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
155
-	   $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>';
153
+	public function column_TXN_ID(EE_Transaction $item) {
154
+    	$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
155
+	   $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>';
156 156
 
157 157
 	   //txn timestamp
158
-	   $content .= '  <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>';
158
+	   $content .= '  <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>';
159 159
 	   return $content;
160 160
 	}
161 161
 
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 	 * @return mixed|string|void
167 167
 	 * @throws \EE_Error
168 168
 	 */
169
-	protected function _get_txn_timestamp( EE_Transaction $item ) {
169
+	protected function _get_txn_timestamp(EE_Transaction $item) {
170 170
 		//txn timestamp
171 171
 		// is TXN less than 2 hours old ?
172 172
 		if (
173
-			( $item->failed() || $item->is_abandoned() )
173
+			($item->failed() || $item->is_abandoned())
174 174
 			&& (
175
-				( time() - EE_Registry::instance()->SSN->lifespan() ) < $item->datetime( false, true )
175
+				(time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true)
176 176
 			)
177 177
 		) {
178
-			$timestamp = __( 'TXN in progress...', 'event_espresso' );
178
+			$timestamp = __('TXN in progress...', 'event_espresso');
179 179
 	   } else {
180
-			$timestamp = $item->get_i18n_datetime( 'TXN_timestamp' );
180
+			$timestamp = $item->get_i18n_datetime('TXN_timestamp');
181 181
 		}
182 182
 		return $timestamp;
183 183
 	}
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	 * @return string
192 192
 	 * @throws \EE_Error
193 193
 	 */
194
-	public function column_cb($item ){
195
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'],  $item->ID());
194
+	public function column_cb($item) {
195
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID());
196 196
 	}
197 197
 
198 198
 
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 * @return string
205 205
 	 * @throws \EE_Error
206 206
 	 */
207
-	public function column_TXN_timestamp( EE_Transaction $item ){
208
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
209
-		$txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>';
207
+	public function column_TXN_timestamp(EE_Transaction $item) {
208
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
209
+		$txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>';
210 210
 		//status
211
-		$txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
211
+		$txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
212 212
 		return $txn_date;
213 213
 	}
214 214
 
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 * @return string
222 222
 	 * @throws \EE_Error
223 223
 	 */
224
-	public function column_TXN_total( EE_Transaction $item ){
225
-		if ( $item->get('TXN_total') > 0 ) {
226
-			return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>';
224
+	public function column_TXN_total(EE_Transaction $item) {
225
+		if ($item->get('TXN_total') > 0) {
226
+			return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>';
227 227
 		} else {
228
-			return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>';
228
+			return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>';
229 229
 		}
230 230
 	}
231 231
 
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * @return mixed|string
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	public function column_TXN_paid( EE_Transaction $item ){
241
+	public function column_TXN_paid(EE_Transaction $item) {
242 242
 		$transaction_total = $item->get('TXN_total');
243 243
 		$transaction_paid = $item->get('TXN_paid');
244 244
 
245
-		if ( \EEH_Money::compare_floats( $transaction_total, 0,'>' ) ) {
245
+		if (\EEH_Money::compare_floats($transaction_total, 0, '>')) {
246 246
 			// monies owing
247 247
 			$span_class = 'txn-overview-part-payment-spn';
248
-			if ( \EEH_Money::compare_floats( $transaction_paid, $transaction_total, '>=' ) ) {
248
+			if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) {
249 249
 				// paid in full
250 250
 				$span_class = 'txn-overview-full-payment-spn';
251
-			} elseif ( \EEH_Money::compare_floats( $transaction_paid, 0, '==' ) ) {
251
+			} elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) {
252 252
 				// no payments made
253 253
 				$span_class = 'txn-overview-no-payment-spn';
254 254
 			}
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 		}
259 259
 
260 260
 		$payment_method = $item->payment_method();
261
-		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' );
261
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso');
262 262
 
263
-		$content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>';
264
-		if ( $transaction_paid > 0 ) {
265
-			$content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>';
263
+		$content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>';
264
+		if ($transaction_paid > 0) {
265
+			$content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>';
266 266
 		}
267 267
 		return $content;
268 268
 	}
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 	 * @return string|void
277 277
 	 * @throws \EE_Error
278 278
 	 */
279
-	public function column_ATT_fname( EE_Transaction $item ){
279
+	public function column_ATT_fname(EE_Transaction $item) {
280 280
 		$primary_reg = $item->primary_registration();
281 281
 		$attendee = $primary_reg->get_first_related('Attendee');
282
-		if ( $attendee instanceof EE_Attendee ) {
283
-			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL );
284
-			$content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name();
285
-			$content .= '<br>' . $attendee->email();
282
+		if ($attendee instanceof EE_Attendee) {
283
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL);
284
+			$content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name();
285
+			$content .= '<br>'.$attendee->email();
286 286
 			return $content;
287 287
 		}
288 288
 		return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso');
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 	 * @return string|void
298 298
 	 * @throws \EE_Error
299 299
 	 */
300
-	public function column_ATT_email( EE_Transaction $item ){
300
+	public function column_ATT_email(EE_Transaction $item) {
301 301
 		$attendee = $item->primary_registration()->get_first_related('Attendee');
302
-		if ( ! empty( $attendee ) ) {
303
-			return '<a href="mailto:' . $attendee->get( 'ATT_email' ) . '">' . $attendee->get( 'ATT_email' ) . '</a>';
302
+		if ( ! empty($attendee)) {
303
+			return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>';
304 304
 		} else {
305 305
 			return $item->failed() || $item->is_abandoned()
306
-				? __( 'no contact record.', 'event_espresso' )
306
+				? __('no contact record.', 'event_espresso')
307 307
 				: __(
308 308
 					'No contact record, because the transaction was abandoned or the registration process failed.',
309 309
 					'event_espresso'
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 	 * @return string|void
321 321
 	 * @throws \EE_Error
322 322
 	 */
323
- 	public function column_event_name( EE_Transaction $item ){
323
+ 	public function column_event_name(EE_Transaction $item) {
324 324
     	$actions = array();
325 325
 		$event = $item->primary_registration()->get_first_related('Event');
326
-		if ( !empty( $event ) ) {
327
-			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL );
326
+		if ( ! empty($event)) {
327
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL);
328 328
 			$event_name = $event->get('EVT_name');
329 329
 
330 330
 			//filter this view by transactions for this event
331
-			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) );
332
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) {
333
-				$actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>';
331
+			$txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID()));
332
+			if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) {
333
+				$actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>';
334 334
 			}
335 335
 
336
-			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' .  wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) );
336
+			return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions));
337 337
 		} else {
338 338
 			return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso');
339 339
 		}
@@ -348,35 +348,35 @@  discard block
 block discarded – undo
348 348
 	 * @return string
349 349
 	 * @throws \EE_Error
350 350
 	 */
351
- 	public function column_actions( EE_Transaction $item ){
351
+ 	public function column_actions(EE_Transaction $item) {
352 352
 
353 353
     	$registration = $item->primary_registration();
354 354
     	$attendee = $registration->attendee();
355 355
 
356 356
         //Build row actions
357
-		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
357
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
358 358
 		$dl_invoice_lnk_url = $registration->invoice_url();
359 359
 		$dl_receipt_lnk_url = $registration->receipt_url();
360
-		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
361
-		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL );
362
-	    $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array(
360
+		$view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
361
+		$send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL);
362
+	    $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array(
363 363
 		    'TXN_ID' => $item->ID()
364 364
 	    ));
365 365
 
366 366
 		//Build row actions
367 367
 		$view_lnk = '
368 368
 			<li>
369
-				<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text">
369
+				<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text">
370 370
 					<span class="dashicons dashicons-cart"></span>
371 371
 				</a>
372 372
 			</li>';
373 373
 
374 374
 		$dl_invoice_lnk = '';
375 375
 		//only show invoice link if message type is active.
376
-		if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) {
376
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) {
377 377
 			$dl_invoice_lnk = '
378 378
 			<li>
379
-				<a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
379
+				<a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text">
380 380
 					<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
381 381
 				</a>
382 382
 			</li>';
@@ -384,17 +384,17 @@  discard block
 block discarded – undo
384 384
 
385 385
 		$dl_receipt_lnk = '';
386 386
 		//only show receipt link if message type is active.
387
-		if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) {
387
+		if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) {
388 388
 			$dl_receipt_lnk = '
389 389
 			<li>
390
-				<a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
390
+				<a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text">
391 391
 					<span class="dashicons dashicons-media-default ee-icon-size-18"></span>
392 392
 				</a>
393 393
 			</li>';
394 394
 		}
395 395
 
396 396
 		//only show payment reminder link if the message type is active.
397
-		if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
397
+		if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
398 398
 			$send_pay_lnk = $attendee instanceof EE_Attendee
399 399
 							&& EE_Registry::instance()->CAP->current_user_can(
400 400
 								'ee_send_message',
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 							)
403 403
 				? '
404 404
 				<li>
405
-					<a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text">
405
+					<a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text">
406 406
 						<span class="dashicons dashicons-email-alt"></span>
407 407
 					</a>
408 408
 				</li>'
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 		)
423 423
 			? '
424 424
 				<li>
425
-					<a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text">
425
+					<a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
426 426
 						<span class="dashicons dashicons-clipboard"></span>
427 427
 					</a>
428 428
 				</li>'
429 429
 			: '';
430 430
 
431 431
 		$view_related_messages_lnk = '';
432
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
433
-			$view_related_messages_lnk = '<li>' . $related_messages_link . '</li>';
432
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
433
+			$view_related_messages_lnk = '<li>'.$related_messages_link.'</li>';
434 434
 		}
435 435
 
436
-		return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' );
436
+		return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul');
437 437
     }
438 438
 
439 439
 
Please login to merge, or discard this patch.
messages/defaults/default/email_payment_reminder_content.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
 						<tbody>
32 32
 							<tr>
33 33
 								<td>
34
-									<h2><?php printf( esc_html__( 'Hello, %s:', 'event_espresso' ), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]' ); ?></h2>
35
-									<p class="lead"><?php esc_html_e( "We'd like to remind you that you still owe money for the following transaction:", 'event_espresso' ); ?></p>
36
-									<h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3>
34
+									<h2><?php printf(esc_html__('Hello, %s:', 'event_espresso'), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]'); ?></h2>
35
+									<p class="lead"><?php esc_html_e("We'd like to remind you that you still owe money for the following transaction:", 'event_espresso'); ?></p>
36
+									<h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3>
37 37
 									<ul>
38 38
 										<li>
39
-											<strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS]
39
+											<strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS]
40 40
 										</li>
41 41
 										<li>
42
-											<strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> [TXN_ID]
42
+											<strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> [TXN_ID]
43 43
 										</li>
44 44
 										<li>
45
-											<strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST]
45
+											<strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST]
46 46
 										</li>
47 47
 										<li>
48
-											<strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING]
48
+											<strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING]
49 49
 										</li>
50 50
 									</ul>
51 51
 									<p class="callout">
52
-										<?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?>
52
+										<?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?>
53 53
 									</p>
54 54
 									[EVENT_LIST]
55 55
 									<p class="callout">
56
-										<?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?>
56
+										<?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?>
57 57
 									</p>
58 58
 								</td>
59 59
 							</tr>
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 									<tbody>
79 79
 										<tr>
80 80
 											<td>
81
-												<h3><?php esc_html_e( 'Connect with Us:', 'event_espresso' ); ?></h3>
82
-												<a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e( 'Facebook', 'event_espresso' ); ?></a>
83
-												<a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e( 'Twitter', 'event_espresso' ); ?></a>
84
-												<a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e( 'Google+', 'event_espresso' ); ?></a>
81
+												<h3><?php esc_html_e('Connect with Us:', 'event_espresso'); ?></h3>
82
+												<a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e('Facebook', 'event_espresso'); ?></a>
83
+												<a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e('Twitter', 'event_espresso'); ?></a>
84
+												<a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e('Google+', 'event_espresso'); ?></a>
85 85
 											</td>
86 86
 										</tr>
87 87
 									</tbody>
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 									<tbody>
92 92
 										<tr>
93 93
 											<td>
94
-												<h3><?php esc_html_e( 'Contact Info:', 'event_espresso' ); ?></h3>
95
-												<?php esc_html_e( 'Phone:', 'event_espresso' ); ?> <strong>[CO_PHONE]</strong>
96
-												<?php esc_html_e( 'Email:', 'event_espresso' ); ?>
94
+												<h3><?php esc_html_e('Contact Info:', 'event_espresso'); ?></h3>
95
+												<?php esc_html_e('Phone:', 'event_espresso'); ?> <strong>[CO_PHONE]</strong>
96
+												<?php esc_html_e('Email:', 'event_espresso'); ?>
97 97
 												<strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong>
98 98
 											</td>
99 99
 										</tr>
Please login to merge, or discard this patch.
messages/defaults/default/email_payment_reminder_content_admin.template.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 						<tbody>
32 32
 							<tr>
33 33
 								<td>
34
-									<h1><?php esc_html_e( 'Payment Reminder Notification', 'event_espresso' ); ?></h1>
35
-									<?php esc_html_e( 'The following message was sent to the Primary Registrant of this transaction:', 'event_espresso' ); ?>
36
-									<h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3>
34
+									<h1><?php esc_html_e('Payment Reminder Notification', 'event_espresso'); ?></h1>
35
+									<?php esc_html_e('The following message was sent to the Primary Registrant of this transaction:', 'event_espresso'); ?>
36
+									<h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3>
37 37
 									<ul>
38 38
 										<li>
39
-											<strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS]
39
+											<strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS]
40 40
 										</li>
41
-										<li><strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong>
41
+										<li><strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong>
42 42
 											<a href="[TRANSACTION_ADMIN_URL]">[TXN_ID]</a></li>
43 43
 										<li>
44
-											<strong><?php esc_html_e( 'Payment Gateway:', 'event_espresso' ); ?></strong> [PAYMENT_GATEWAY]
44
+											<strong><?php esc_html_e('Payment Gateway:', 'event_espresso'); ?></strong> [PAYMENT_GATEWAY]
45 45
 										</li>
46 46
 										<li>
47
-											<strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST]
47
+											<strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST]
48 48
 										</li>
49 49
 										<li>
50
-											<strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING]
50
+											<strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING]
51 51
 										</li>
52 52
 									</ul>
53 53
 								</td>
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 					</table>
57 57
 				</div>
58 58
 				<div class="content">
59
-					<h2><?php esc_html_e( 'Registrant Details:', 'event_espresso' ); ?></h2>
59
+					<h2><?php esc_html_e('Registrant Details:', 'event_espresso'); ?></h2>
60 60
 					<p class="callout"><strong>[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]:</strong>
61 61
 						<a href="mailto:[PRIMARY_REGISTRANT_EMAIL]">[PRIMARY_REGISTRANT_EMAIL]</a></p>
62 62
 				</div>
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Recipient_Details_Shortcodes.lib.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,14 +64,14 @@
 block discarded – undo
64 64
 		//make sure we end up with a copy of the EE_Messages_Addressee object
65 65
 		$this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
66 66
 		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee
67
-		                    && is_array( $this->_data )
68
-		                    && isset( $this->_data['data'] )
69
-		                    && $this->_data['data'] instanceof EE_Messages_Addressee
67
+							&& is_array( $this->_data )
68
+							&& isset( $this->_data['data'] )
69
+							&& $this->_data['data'] instanceof EE_Messages_Addressee
70 70
 			? $this->_data['data'] :
71 71
 			$this->_recipient;
72 72
 		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee
73
-		                    && ! empty( $this->_extra_data['data'] )
74
-		                    && $this->_extra_data['data'] instanceof EE_Messages_Addressee
73
+							&& ! empty( $this->_extra_data['data'] )
74
+							&& $this->_extra_data['data'] instanceof EE_Messages_Addressee
75 75
 			? $this->_extra_data['data']
76 76
 			: $this->_recipient;
77 77
 
Please login to merge, or discard this patch.
Spacing   +50 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -37,58 +37,57 @@  discard block
 block discarded – undo
37 37
 
38 38
 
39 39
 	protected function _init_props() {
40
-		$this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' );
41
-		$this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' );
40
+		$this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso');
41
+		$this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso');
42 42
 		$this->_shortcodes = array(
43
-			'[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ),
44
-			'[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ),
45
-			'[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ),
46
-			'[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ),
47
-			'[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ),
48
-			'[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ),
49
-			'[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ),
50
-			'[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ),
51
-			'[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ),
52
-			'[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ),
53
-			'[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ),
54
-			'[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ),
55
-			'[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ),
56
-			'[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient.  Otherwise the value of 0 is printed.', 'event_espresso' )
43
+			'[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'),
44
+			'[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'),
45
+			'[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'),
46
+			'[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'),
47
+			'[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'),
48
+			'[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'),
49
+			'[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'),
50
+			'[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'),
51
+			'[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'),
52
+			'[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'),
53
+			'[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'),
54
+			'[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'),
55
+			'[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode.  After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'),
56
+			'[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient.  Otherwise the value of 0 is printed.', 'event_espresso')
57 57
 			);
58 58
 	}
59 59
 
60 60
 
61 61
 
62
-	protected function _parser( $shortcode ) {
62
+	protected function _parser($shortcode) {
63 63
 
64 64
 		//make sure we end up with a copy of the EE_Messages_Addressee object
65 65
 		$this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
66 66
 		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee
67
-		                    && is_array( $this->_data )
68
-		                    && isset( $this->_data['data'] )
67
+		                    && is_array($this->_data)
68
+		                    && isset($this->_data['data'])
69 69
 		                    && $this->_data['data'] instanceof EE_Messages_Addressee
70
-			? $this->_data['data'] :
71
-			$this->_recipient;
70
+			? $this->_data['data'] : $this->_recipient;
72 71
 		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee
73
-		                    && ! empty( $this->_extra_data['data'] )
72
+		                    && ! empty($this->_extra_data['data'])
74 73
 		                    && $this->_extra_data['data'] instanceof EE_Messages_Addressee
75 74
 			? $this->_extra_data['data']
76 75
 			: $this->_recipient;
77 76
 
78
-		if ( ! $this->_recipient instanceof EE_Messages_Addressee ) {
77
+		if ( ! $this->_recipient instanceof EE_Messages_Addressee) {
79 78
 			return '';
80 79
 		}
81 80
 
82 81
 		$attendee = $this->_recipient->att_obj;
83
-		if ( ! $attendee instanceof EE_Attendee ) {
82
+		if ( ! $attendee instanceof EE_Attendee) {
84 83
 			return '';
85 84
 		}
86 85
 
87
-		$this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] )
88
-			? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs']
86
+		$this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs'])
87
+			? $this->_recipient->attendees[$attendee->ID()]['reg_objs']
89 88
 			: array();
90 89
 
91
-		switch ( $shortcode ) {
90
+		switch ($shortcode) {
92 91
 			case '[RECIPIENT_FNAME]' :
93 92
 				return $attendee->fname();
94 93
 				break;
@@ -102,14 +101,14 @@  discard block
 block discarded – undo
102 101
 				break;
103 102
 
104 103
 			case '[RECIPIENT_REGISTRATION_CODE]' :
105
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) {
104
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration) {
106 105
 					return '';
107 106
 				}
108 107
 				return $this->_get_reg_code();
109 108
 				break;
110 109
 
111 110
 			case '[RECIPIENT_EDIT_REGISTRATION_LINK]' :
112
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) {
111
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration) {
113 112
 					return '';
114 113
 				}
115 114
 				return $this->_recipient->reg_obj->edit_attendee_information_url();
@@ -151,23 +150,23 @@  discard block
 block discarded – undo
151 150
 				break;
152 151
 		}
153 152
 
154
-		if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) {
155
-			$shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode );
156
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
153
+		if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) {
154
+			$shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode);
155
+			$shortcode = trim(str_replace(']', '', $shortcode));
157 156
 
158 157
 
159 158
 			//now let's figure out what question has this text
160
-			if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) {
159
+			if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) {
161 160
 				return '';
162 161
 			}
163 162
 
164
-			foreach ( $this->_recipient->questions as $ansid => $question ) {
163
+			foreach ($this->_recipient->questions as $ansid => $question) {
165 164
 				if (
166 165
 					$question instanceof EE_Question
167 166
 					&& $question->display_text() == $shortcode
168
-					&& isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] )
167
+					&& isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid])
169 168
 				) {
170
-					return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' );
169
+					return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
171 170
 				}
172 171
 			}
173 172
 		}
@@ -198,53 +197,53 @@  discard block
 block discarded – undo
198 197
 	protected function _get_reg_code() {
199 198
 
200 199
 		//if only one related registration for the recipient then just return that reg code.
201
-		if ( count( $this->_registrations_for_recipient ) <= 1 )  {
200
+		if (count($this->_registrations_for_recipient) <= 1) {
202 201
 			return $this->_recipient->reg_obj->reg_code();
203 202
 		}
204 203
 
205 204
 		//k more than one registration so let's see if we can get specific to context
206 205
 		//are we parsing event_list?
207
-		if ( $this->_data instanceof EE_Event ) {
206
+		if ($this->_data instanceof EE_Event) {
208 207
 			$reg_code = array();
209 208
 			//loop through registrations for recipient and see if there is a match for this event
210
-			foreach ( $this->_registrations_for_recipient as $reg ) {
211
-				if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) {
209
+			foreach ($this->_registrations_for_recipient as $reg) {
210
+				if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) {
212 211
 					$reg_code[] = $reg->reg_code();
213 212
 				}
214 213
 			}
215
-			return implode( ', ', $reg_code );
214
+			return implode(', ', $reg_code);
216 215
 		}
217 216
 
218 217
 		//are we parsing ticket list?
219
-		if ( $this->_data instanceof EE_Ticket ) {
218
+		if ($this->_data instanceof EE_Ticket) {
220 219
 			$reg_code = array();
221 220
 			//loop through each registration for recipient and see if there is a match for this ticket
222
-			foreach ( $this->_registrations_for_recipient as $reg ) {
223
-				if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) {
221
+			foreach ($this->_registrations_for_recipient as $reg) {
222
+				if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) {
224 223
 					$reg_code = $reg->reg_code();
225 224
 				}
226 225
 			}
227
-			return implode( ', ', $reg_code );
226
+			return implode(', ', $reg_code);
228 227
 		}
229 228
 
230 229
 		//do we have a specific reg_obj?  Let's use it
231
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
230
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
232 231
 			return $this->_data->reg_obj->reg_code();
233 232
 		}
234 233
 
235 234
 		//do we have a specific reg_obj?  Let's use it
236
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
235
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
237 236
 			return $this->_data->reg_obj->reg_code();
238 237
 		}
239 238
 
240 239
 		//not able to determine the single reg code so let's return a comma delimited list of reg codes.
241 240
 		$reg_code = array();
242
-		foreach ( $this->_registrations_for_recipient as $reg ) {
243
-			if ( $reg instanceof EE_Registration ) {
241
+		foreach ($this->_registrations_for_recipient as $reg) {
242
+			if ($reg instanceof EE_Registration) {
244 243
 				$reg_code[] = $reg->reg_code();
245 244
 			}
246 245
 		}
247
-		return implode( ', ', $reg_code );
246
+		return implode(', ', $reg_code);
248 247
 	}
249 248
 
250 249
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
 	/**
43 43
 	 * EE_Attendee_Shortcodes constructor.
44
-	*/
44
+	 */
45 45
 	public function __construct() {
46 46
 		parent::__construct();
47 47
 	}
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -49,25 +49,25 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _init_props() {
52
-		$this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' );
53
-		$this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' );
52
+		$this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
53
+		$this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
54 54
 		$this->_shortcodes = array(
55
-			'[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ),
56
-			'[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ),
57
-			'[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ),
58
-			'[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ),
59
-			'[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ),
60
-			'[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ),
61
-			'[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ),
62
-			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ),
63
-			'[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ),
64
-			'[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ),
65
-			'[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ),
66
-			'[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ),
67
-			'[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ),
68
-			'[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ),
69
-			'[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ),
70
-			'[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' )
55
+			'[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'),
56
+			'[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'),
57
+			'[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'),
58
+			'[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'),
59
+			'[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'),
60
+			'[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'),
61
+			'[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'),
62
+			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'),
63
+			'[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'),
64
+			'[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'),
65
+			'[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'),
66
+			'[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'),
67
+			'[CITY]' => esc_html__('The city for the registration.', 'event_espresso'),
68
+			'[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'),
69
+			'[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'),
70
+			'[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso')
71 71
 			);
72 72
 	}
73 73
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 	 * @return string
82 82
 	 * @throws \EE_Error
83 83
 	 */
84
-	protected function _parser( $shortcode ) {
84
+	protected function _parser($shortcode) {
85 85
 
86 86
 
87
-		$this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
87
+		$this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
88 88
 			? $this->_extra_data['data']
89 89
 			: null;
90 90
 
@@ -93,34 +93,34 @@  discard block
 block discarded – undo
93 93
 			? null
94 94
 			: $this->_data;
95 95
 
96
-		if ( ! $registration instanceof EE_Registration ) {
96
+		if ( ! $registration instanceof EE_Registration) {
97 97
 			//let's attempt to get the txn_id for the error message.
98
-			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction
98
+			$txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction
99 99
 				? $this->_xtra->txn->ID()
100
-				: esc_html__( 'Unknown', 'event_espresso' );
101
-			$msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' );
100
+				: esc_html__('Unknown', 'event_espresso');
101
+			$msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso');
102 102
 			$dev_msg = sprintf(
103
-				esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ),
103
+				esc_html__('The transaction ID for this request is: %s', 'event_espresso'),
104 104
 				$txn_id
105 105
 			);
106
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
106
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
107 107
 		}
108 108
 
109 109
 		//attendee obj for this registration
110
-		$attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] )
111
-			?  $this->_xtra->registrations[ $registration->ID() ]['att_obj']
112
-			: null ;
110
+		$attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj'])
111
+			? $this->_xtra->registrations[$registration->ID()]['att_obj']
112
+			: null;
113 113
 
114
-		if ( ! $attendee instanceof EE_Attendee ) {
115
-			$msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' );
114
+		if ( ! $attendee instanceof EE_Attendee) {
115
+			$msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso');
116 116
 			$dev_msg = sprintf(
117
-				esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ),
117
+				esc_html__('The registration ID for this request is: %s', 'event_espresso'),
118 118
 				$registration->ID()
119 119
 			);
120
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
120
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
121 121
 		}
122 122
 
123
-		switch ( $shortcode ) {
123
+		switch ($shortcode) {
124 124
 
125 125
 			case '[FNAME]' :
126 126
 				return $attendee->fname();
Please login to merge, or discard this patch.