Completed
Branch BUG-8698-ticket-sellouts (a43227)
by
unknown
175:43 queued 155:40
created
core/interfaces/messages/EEI_Has_Sending_Messenger.interface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EE_Line_Item_Filter_Collection
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 3 patches
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -717,8 +718,9 @@  discard block
 block discarded – undo
717 718
 		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
718 719
 
719 720
 		//check file exists and is readable
720
-		if ( !is_readable( $wrapper_template ) )
721
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
721
+		if ( !is_readable( $wrapper_template ) ) {
722
+					throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
723
+		}
722 724
 
723 725
 		//require template helper
724 726
 		EE_Registry::instance()->load_helper( 'Template' );
@@ -788,20 +790,24 @@  discard block
 block discarded – undo
788 790
 	 */
789 791
 	public function get_field_label( $field ) {
790 792
 		//first let's see if the field requests is in the top level array.
791
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
792
-			return $this->_template[$field]['label'];
793
+		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) ) {
794
+					return $this->_template[$field]['label'];
795
+		}
793 796
 
794 797
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
795
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
796
-			return $this->_template_fields['extra'][$field]['main']['label'];
798
+		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  ) {
799
+					return $this->_template_fields['extra'][$field]['main']['label'];
800
+		}
797 801
 
798 802
 		//now it's possible this field may just be existing in any of the extra array items.
799 803
 		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
800 804
 			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
801
-				if ( !is_array( $subfields ) )
802
-					continue;
803
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
804
-					return $subfields[$field]['label'];
805
+				if ( !is_array( $subfields ) ) {
806
+									continue;
807
+				}
808
+				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) ) {
809
+									return $subfields[$field]['label'];
810
+				}
805 811
 			}
806 812
 		}
807 813
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	/**
504 504
 	 * @param $message_types
505 505
 	 * @param array $extra
506
-	 * @return mixed|string
506
+	 * @return string
507 507
 	 */
508 508
 	protected function _get_admin_content_events_edit( $message_types, $extra ) {
509 509
 		//defaults
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	 * All this does is set the existing test settings (in the db) for the messenger
772 772
 	 *
773 773
 	 * @access public
774
-	 * @param $settings
774
+	 * @param string $settings
775 775
 	 * @return bool success/fail
776 776
 	 */
777 777
 	public function set_existing_test_settings( $settings ) {
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @return void
290 290
 	 */
291 291
 	public function enqueue_scripts_styles() {
292
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
292
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
293 293
 	}
294 294
 
295 295
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
361 361
 
362
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
362
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
363 363
 	}
364 364
 
365 365
 
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 	 * @return stdClass
375 375
 	 */
376 376
 	public function get_supports_labels() {
377
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
377
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
378 378
 			$this->_set_supports_labels_defaults();
379 379
 		}
380
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
380
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
381 381
 	}
382 382
 
383 383
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	 *
398 398
 	 * @return string                    path or url for the requested variation.
399 399
 	 */
400
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
400
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
401 401
 		$this->_tmp_pack = $pack;
402
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
403
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
402
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
403
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
404 404
 		return $variation_path;
405 405
 
406 406
 	}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @return array
419 419
 	 */
420 420
 	public function get_default_message_types() {
421
-		$class = get_class( $this );
421
+		$class = get_class($this);
422 422
 
423 423
 		//messenger specific filter
424
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
424
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
425 425
 
426 426
 		//all messengers filter
427
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
427
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
428 428
 		return $default_types;
429 429
 	}
430 430
 
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
 	 * @return array
440 440
 	 */
441 441
 	public function get_valid_message_types() {
442
-		$class = get_class( $this );
442
+		$class = get_class($this);
443 443
 
444 444
 		//messenger specific filter
445 445
 		//messenger specific filter
446
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
446
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
447 447
 
448 448
 		//all messengers filter
449
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
449
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
450 450
 		return $valid_types;
451 451
 	}
452 452
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 * @access public
461 461
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
462 462
 	 */
463
-	public function set_validator_config( $new_config ) {
463
+	public function set_validator_config($new_config) {
464 464
 		$this->_validator_config = $new_config;
465 465
 	}
466 466
 
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
 	public function get_validator_config() {
477 477
 		$class = get_class($this);
478 478
 
479
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
480
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
479
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
480
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
481 481
 		return $config;
482 482
 	}
483 483
 
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	 * @access public
495 495
 	 * @return string content for page
496 496
 	 */
497
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
498
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
497
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
498
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
499 499
 	}
500 500
 
501 501
 
@@ -505,20 +505,20 @@  discard block
 block discarded – undo
505 505
 	 * @param array $extra
506 506
 	 * @return mixed|string
507 507
 	 */
508
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
508
+	protected function _get_admin_content_events_edit($message_types, $extra) {
509 509
 		//defaults
510 510
 		$template_args = array();
511 511
 		$selector_rows = '';
512 512
 
513 513
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
514
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
514
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
515 515
 
516
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
516
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
517
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
518 518
 
519 519
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
520 520
 		$global_templates = EEM_Message_Template_Group::instance()->get_all(
521
-			array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) )
521
+			array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true))
522 522
 		);
523 523
 		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event(
524 524
 			$event_id,
@@ -527,55 +527,55 @@  discard block
 block discarded – undo
527 527
 				'MTP_is_active' => true
528 528
 			)
529 529
 		);
530
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
530
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
531 531
 
532 532
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
533
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
534
-			if ( $mtpg instanceof EE_Message_Template_Group ) {
533
+		foreach ($global_templates as $mtpgID => $mtpg) {
534
+			if ($mtpg instanceof EE_Message_Template_Group) {
535 535
 				//verify this message type is supposed to show on this page
536 536
 				$mtp_obj = $mtpg->message_type_obj();
537
-				if ( ! $mtp_obj instanceof EE_message_type ) {
537
+				if ( ! $mtp_obj instanceof EE_message_type) {
538 538
 					continue;
539 539
 				}
540
-				$mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages;
541
-				if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
540
+				$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
541
+				if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) {
542 542
 					continue;
543 543
 				}
544 544
 				$select_values = array();
545
-				$select_values[ $mtpgID ] = __( 'Global', 'event_espresso' );
546
-				$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null;
545
+				$select_values[$mtpgID] = __('Global', 'event_espresso');
546
+				$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null;
547 547
 				//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
548
-				if ( ! $mtpg->get( 'MTP_is_override' ) ) {
548
+				if ( ! $mtpg->get('MTP_is_override')) {
549 549
 					//any custom templates for this message type?
550
-					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
551
-					foreach ( $custom_templates as $cmtpgID => $cmtpg ) {
552
-						$select_values[ $cmtpgID ] = $cmtpg->name();
553
-						$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
550
+					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
551
+					foreach ($custom_templates as $cmtpgID => $cmtpg) {
552
+						$select_values[$cmtpgID] = $cmtpg->name();
553
+						$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
554 554
 					}
555 555
 				}
556 556
 				//if there is no $default_value then we set it as the global
557
-				$default_value = empty( $default_value ) ? $mtpgID : $default_value;
558
-				$edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) );
559
-				$create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
560
-				$st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] );
561
-				$st_args[ 'mt_slug' ] = $mtpg->message_type();
562
-				$st_args[ 'messenger_slug' ] = $this->name;
563
-				$st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
557
+				$default_value = empty($default_value) ? $mtpgID : $default_value;
558
+				$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
559
+				$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
560
+				$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
561
+				$st_args['mt_slug'] = $mtpg->message_type();
562
+				$st_args['messenger_slug'] = $this->name;
563
+				$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
564 564
 				//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
565
-				$st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>';
566
-				$st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : '';
567
-				$st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : '';
568
-				$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true );
565
+				$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
566
+				$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : '';
567
+				$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
568
+				$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true);
569 569
 			}
570 570
 		}
571 571
 
572 572
 		//if no selectors present then get out.
573
-		if ( empty( $selector_rows ) ) {
573
+		if (empty($selector_rows)) {
574 574
 			return '';
575 575
 		}
576 576
 
577 577
 		$template_args['selector_rows'] = $selector_rows;
578
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
578
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 	 * @return array $this->_template_fields
591 591
 	 */
592 592
 	public function get_template_fields() {
593
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
594
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
593
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
594
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
595 595
 		return $template_fields;
596 596
 	}
597 597
 
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
 	 * @param mixed $value
606 606
 	 */
607 607
 	protected function _set_template_value($item, $value) {
608
-		if ( array_key_exists($item, $this->_template_fields) ) {
609
-			$prop = '_' . $item;
610
-			$this->{$prop}= $value;
608
+		if (array_key_exists($item, $this->_template_fields)) {
609
+			$prop = '_'.$item;
610
+			$this->{$prop} = $value;
611 611
 		}
612 612
 	}
613 613
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return bool Very important that all messengers return bool for successful send or not.  Error messages can be
619 619
 	 *              added to EE_Error.
620 620
 	 */
621
-	public function send_message( $message, EE_message_type $message_type ) {
622
-		$this->_validate_and_setup( $message );
621
+	public function send_message($message, EE_message_type $message_type) {
622
+		$this->_validate_and_setup($message);
623 623
 		$this->_incoming_message_type = $message_type;
624 624
 		return $this->_send_message();
625 625
 	}
@@ -633,28 +633,28 @@  discard block
 block discarded – undo
633 633
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
634 634
 	 * @return string          return the message html content
635 635
 	 */
636
-	public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) {
637
-		$this->_validate_and_setup( $message );
636
+	public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) {
637
+		$this->_validate_and_setup($message);
638 638
 
639 639
 		$this->_incoming_message_type = $message_type;
640 640
 
641
-		if ( $send ) {
641
+		if ($send) {
642 642
 			//are we overriding any existing template fields?
643 643
 			$settings = $this->get_existing_test_settings();
644
-			if ( ! empty( $settings ) ) {
645
-				foreach ( $settings as $field => $value ) {
646
-					$this->_set_template_value( $field, $value );
644
+			if ( ! empty($settings)) {
645
+				foreach ($settings as $field => $value) {
646
+					$this->_set_template_value($field, $value);
647 647
 				}
648 648
 			}
649 649
 		}
650 650
 
651 651
 		//enqueue preview js so that any links/buttons on the page are disabled.
652
-		if ( ! $send ) {
652
+		if ( ! $send) {
653 653
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
654 654
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
655
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
656
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
657
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
655
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
656
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
657
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
658 658
 		}
659 659
 
660 660
 		return $send ? $this->_send_message() : $this->_preview();
@@ -672,10 +672,10 @@  discard block
 block discarded – undo
672 672
 	 */
673 673
 	public function add_preview_script() {
674 674
 		//error message
675
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
676
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
677
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
678
-		wp_enqueue_script( 'ee-messages-preview-js' );
675
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
676
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
677
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
678
+		wp_enqueue_script('ee-messages-preview-js');
679 679
 	}
680 680
 
681 681
 
@@ -686,13 +686,13 @@  discard block
 block discarded – undo
686 686
 	 * @param  EE_Message $message
687 687
 	 * @throws EE_Error
688 688
 	 */
689
-	protected function _validate_and_setup( EE_Message $message ) {
689
+	protected function _validate_and_setup(EE_Message $message) {
690 690
 		$template_pack = $message->get_template_pack();
691 691
 		$variation = $message->get_template_pack_variation();
692 692
 
693 693
 		//verify we have the required template pack value on the $message object.
694
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack ) {
695
-			throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) );
694
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack) {
695
+			throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso'));
696 696
 		}
697 697
 
698 698
 		$this->_tmp_pack = $template_pack;
@@ -701,11 +701,11 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$template_fields = $this->get_template_fields();
703 703
 
704
-		foreach ( $template_fields as $template => $value ) {
705
-			if ( $template !== 'extra' ) {
706
-				$column_value = $message->get_field_or_extra_meta( 'MSG_' . $template );
704
+		foreach ($template_fields as $template => $value) {
705
+			if ($template !== 'extra') {
706
+				$column_value = $message->get_field_or_extra_meta('MSG_'.$template);
707 707
 				$message_template_value = $column_value ? $column_value : null;
708
-				$this->_set_template_value( $template, $message_template_value );
708
+				$this->_set_template_value($template, $message_template_value);
709 709
 			}
710 710
 		}
711 711
 	}
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	 * @return string
721 721
 	 * @throws \EE_Error
722 722
 	 */
723
-	protected function _get_main_template( $preview = FALSE ) {
723
+	protected function _get_main_template($preview = FALSE) {
724 724
 		$type = $preview ? 'preview' : 'main';
725 725
 
726
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
726
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
727 727
 
728 728
 		//check file exists and is readable
729
-		if ( !is_readable( $wrapper_template ) )
730
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
729
+		if ( ! is_readable($wrapper_template))
730
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
731 731
 
732 732
 		//add message type to template args
733 733
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
734 734
 
735
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
735
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
736 736
 	}
737 737
 
738 738
 
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 */
769 769
 	public function get_existing_test_settings() {
770 770
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
771
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
771
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
772 772
 		$settings = $Message_Resource_Manager->get_active_messengers_option();
773
-		return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array();
773
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
774 774
 	}
775 775
 
776 776
 
@@ -782,12 +782,12 @@  discard block
 block discarded – undo
782 782
 	 * @param $settings
783 783
 	 * @return bool success/fail
784 784
 	 */
785
-	public function set_existing_test_settings( $settings ) {
785
+	public function set_existing_test_settings($settings) {
786 786
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
787
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
787
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
788 788
 		$existing = $Message_Resource_Manager->get_active_messengers_option();
789
-		$existing[ $this->name ]['test_settings'] = $settings;
790
-		return $Message_Resource_Manager->update_active_messengers_option( $existing );
789
+		$existing[$this->name]['test_settings'] = $settings;
790
+		return $Message_Resource_Manager->update_active_messengers_option($existing);
791 791
 	}
792 792
 
793 793
 
@@ -800,21 +800,21 @@  discard block
 block discarded – undo
800 800
 	 * @param string $field The field to retrieve the label for
801 801
 	 * @return string        	  The label
802 802
 	 */
803
-	public function get_field_label( $field ) {
803
+	public function get_field_label($field) {
804 804
 		//first let's see if the field requests is in the top level array.
805
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
805
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
806 806
 			return $this->_template[$field]['label'];
807 807
 
808 808
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
809
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
809
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
810 810
 			return $this->_template_fields['extra'][$field]['main']['label'];
811 811
 
812 812
 		//now it's possible this field may just be existing in any of the extra array items.
813
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
814
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
815
-				if ( !is_array( $subfields ) )
813
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
814
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
815
+				if ( ! is_array($subfields))
816 816
 					continue;
817
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
817
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
818 818
 					return $subfields[$field]['label'];
819 819
 			}
820 820
 		}
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 *
836 836
 	 * @return void
837 837
 	 */
838
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
838
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
839 839
 		return;
840 840
 	}
841 841
 
Please login to merge, or discard this patch.
libraries/messages/data_class/EE_Messages_Gateways_incoming_data.class.php 1 patch
Spacing   +22 added lines, -22 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
 /**
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 	 * @param array $data
44 44
 	 * @throws \EE_Error
45 45
 	 */
46
-	public function __construct( $data ) {
46
+	public function __construct($data) {
47 47
 
48 48
 		//test for valid params
49
-		if ( ! ( $data[0] instanceof EE_Transaction ))
50
-			throw new EE_Error( __('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso') );
49
+		if ( ! ($data[0] instanceof EE_Transaction))
50
+			throw new EE_Error(__('Incoming data for the Gateways data handler must have an EE_Transaction object as the value for the first array index.', 'event_espresso'));
51 51
 
52
-		if ( empty( $data[1] ) || ! $data[1] instanceof  EE_Payment  )
53
-			$pmt_obj = $this->_get_empty_payment_obj( $data[0] );
52
+		if (empty($data[1]) || ! $data[1] instanceof  EE_Payment)
53
+			$pmt_obj = $this->_get_empty_payment_obj($data[0]);
54 54
 
55
-		if ( ! empty( $data[2] ) ) {
55
+		if ( ! empty($data[2])) {
56 56
 			$filtered_reg_status = $data[2];
57 57
 		}
58 58
 
59 59
 		$data = array(
60 60
 			'txn_obj' => $data[0],
61 61
 			'pmt_obj' => isset($pmt_obj) ? $pmt_obj : $data[1],
62
-			'filtered_reg_status' => isset( $filtered_reg_status ) ? $filtered_reg_status : null
62
+			'filtered_reg_status' => isset($filtered_reg_status) ? $filtered_reg_status : null
63 63
 			);
64
-		parent::__construct( $data );
64
+		parent::__construct($data);
65 65
 	}
66 66
 
67 67
 
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return array   The prepped data for db
77 77
 	 */
78
-	static public function convert_data_for_persistent_storage( $data ) {
78
+	static public function convert_data_for_persistent_storage($data) {
79 79
 		$prepped_data = array();
80 80
 
81
-		if ( $data[0] instanceof EE_Transaction ) {
81
+		if ($data[0] instanceof EE_Transaction) {
82 82
 			$prepped_data['Transaction'] = $data[0]->ID();
83 83
 		}
84 84
 
85
-		if ( isset( $data[1] ) && $data[1] instanceof EE_Payment ) {
85
+		if (isset($data[1]) && $data[1] instanceof EE_Payment) {
86 86
 			$prepped_data['Payment'] = $data[1]->ID();
87 87
 		}
88 88
 
89
-		if ( ! empty( $data[2] ) ) {
89
+		if ( ! empty($data[2])) {
90 90
 			$prepped_data['filter'] = $data[2];
91 91
 		}
92 92
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @return array
108 108
 	 */
109
-	static public function convert_data_from_persistent_storage( $data ) {
109
+	static public function convert_data_from_persistent_storage($data) {
110 110
 		$prepped_data = array(
111
-			0 => isset( $data['Transaction'] ) ? EEM_Transaction::instance()->get_one_by_ID( $data['Transaction'] ) : null,
112
-			1 => isset( $data['Payment'] ) ? EEM_Payment::instance()->get_one_by_ID( $data['Payment'] ) : null,
113
-			2 => isset( $data['filter'] ) ? $data['filter'] : null
111
+			0 => isset($data['Transaction']) ? EEM_Transaction::instance()->get_one_by_ID($data['Transaction']) : null,
112
+			1 => isset($data['Payment']) ? EEM_Payment::instance()->get_one_by_ID($data['Payment']) : null,
113
+			2 => isset($data['filter']) ? $data['filter'] : null
114 114
 		);
115 115
 		return $prepped_data;
116 116
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param \EE_Transaction $txn
122 122
 	 * @return \EE_Payment
123 123
 	 */
124
-	private function _get_empty_payment_obj( EE_Transaction $txn ) {
125
-		$PMT = EE_Payment::new_instance( array(
124
+	private function _get_empty_payment_obj(EE_Transaction $txn) {
125
+		$PMT = EE_Payment::new_instance(array(
126 126
 			'STS_ID' => EEM_Payment::status_id_pending,
127 127
 			'PAY_timestamp' => time(),
128 128
 			'PMD_ID' => $txn->payment_method_ID(),
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 
151 151
 
152 152
 		//other data from the session (if possible)
153
-		$this->user_id = isset( $session_data['user_id'] ) ? $session_data['user_id'] : '';
154
-		$this->ip_address = isset( $session_data['ip_address'] ) ? $session_data['ip_address'] : '';
155
-		$this->user_agent = isset( $session_data['user_agent'] ) ? $session_data['user_agent'] : '';
153
+		$this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : '';
154
+		$this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : '';
155
+		$this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : '';
156 156
 		$this->init_access = $this->last_access = '';
157 157
 
158 158
 		$this->reg_objs = $this->txn->get_many_related('Registration');
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Recipient_Details_Shortcodes.lib.php 1 patch
Spacing   +33 added lines, -33 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
 /**
@@ -50,31 +50,31 @@  discard block
 block discarded – undo
50 50
 			'[RECIPIENT_ADDRESS2]' => __('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'),
51 51
 			'[RECIPIENT_CITY]' => __('The city for the recipient of the message.', 'event_espresso'),
52 52
 			'[RECIPIENT_ZIP_PC]' => __('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'),
53
-			'[RECIPIENT_ADDRESS_STATE]' => __('The state/province for the recipient of the message.', 'event_espresso' ),
53
+			'[RECIPIENT_ADDRESS_STATE]' => __('The state/province for the recipient of the message.', 'event_espresso'),
54 54
 			'[RECIPIENT_COUNTRY]' => __('The country for the recipient of the message.', 'event_espresso'),
55
-			'[RECIPIENT_ANSWER_*]' => __('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' )
55
+			'[RECIPIENT_ANSWER_*]' => __('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 56
 			);
57 57
 	}
58 58
 
59 59
 
60 60
 
61
-	protected function _parser( $shortcode ) {
61
+	protected function _parser($shortcode) {
62 62
 
63 63
 		//make sure we end up with a copy of the EE_Messages_Addressee object
64 64
 		$this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
65
-		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient;
66
-		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient;
65
+		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient;
66
+		$this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient;
67 67
 
68
-		if ( ! $this->_recipient instanceof EE_Messages_Addressee )
68
+		if ( ! $this->_recipient instanceof EE_Messages_Addressee)
69 69
 			return '';
70 70
 
71 71
 		$attendee = $this->_recipient->att_obj;
72
-		if ( ! $attendee instanceof EE_Attendee )
72
+		if ( ! $attendee instanceof EE_Attendee)
73 73
 			return '';
74 74
 
75
-		$this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] : array();
75
+		$this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] : array();
76 76
 
77
-		switch ( $shortcode ) {
77
+		switch ($shortcode) {
78 78
 			case '[RECIPIENT_FNAME]' :
79 79
 				return $attendee->fname();
80 80
 				break;
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 				break;
89 89
 
90 90
 			case '[RECIPIENT_REGISTRATION_CODE]' :
91
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration )
91
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration)
92 92
 					return '';
93 93
 				return $this->_get_reg_code();
94 94
 				break;
95 95
 
96 96
 			case '[RECIPIENT_EDIT_REGISTRATION_LINK]' :
97
-				if ( ! $this->_recipient->reg_obj instanceof EE_Registration )
97
+				if ( ! $this->_recipient->reg_obj instanceof EE_Registration)
98 98
 					return '';
99 99
 				return $this->_recipient->reg_obj->edit_attendee_information_url();
100 100
 				break;
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 				break;
131 131
 		}
132 132
 
133
-		if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) {
134
-			$shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode );
135
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
133
+		if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) {
134
+			$shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode);
135
+			$shortcode = trim(str_replace(']', '', $shortcode));
136 136
 
137 137
 
138 138
 			//now let's figure out what question has this text
139
-			if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) {
139
+			if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) {
140 140
 				return '';
141 141
 			}
142 142
 
143
-			foreach ( $this->_recipient->questions as $ansid => $question ) {
144
-				if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset( $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid] ) ) {
145
-					return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty( 'ANS_value', 'no_wpautop' );
143
+			foreach ($this->_recipient->questions as $ansid => $question) {
144
+				if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid])) {
145
+					return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop');
146 146
 				}
147 147
 			}
148 148
 		}
@@ -173,53 +173,53 @@  discard block
 block discarded – undo
173 173
 	protected function _get_reg_code() {
174 174
 
175 175
 		//if only one related registration for the recipient then just return that reg code.
176
-		if ( count( $this->_registrations_for_recipient ) <= 1 )  {
176
+		if (count($this->_registrations_for_recipient) <= 1) {
177 177
 			return $this->_recipient->reg_obj->reg_code();
178 178
 		}
179 179
 
180 180
 		//k more than one registration so let's see if we can get specific to context
181 181
 		//are we parsing event_list?
182
-		if ( $this->_data instanceof EE_Event ) {
182
+		if ($this->_data instanceof EE_Event) {
183 183
 			$reg_code = array();
184 184
 			//loop through registrations for recipient and see if there is a match for this event
185
-			foreach ( $this->_registrations_for_recipient as $reg ) {
186
-				if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) {
185
+			foreach ($this->_registrations_for_recipient as $reg) {
186
+				if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) {
187 187
 					$reg_code[] = $reg->reg_code();
188 188
 				}
189 189
 			}
190
-			return implode( ', ', $reg_code );
190
+			return implode(', ', $reg_code);
191 191
 		}
192 192
 
193 193
 		//are we parsing ticket list?
194
-		if ( $this->_data instanceof EE_Ticket ) {
194
+		if ($this->_data instanceof EE_Ticket) {
195 195
 			$reg_code = array();
196 196
 			//loop through each registration for recipient and see if there is a match for this ticket
197
-			foreach ( $this->_registrations_for_recipient as $reg ) {
198
-				if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) {
197
+			foreach ($this->_registrations_for_recipient as $reg) {
198
+				if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) {
199 199
 					$reg_code = $reg->reg_code();
200 200
 				}
201 201
 			}
202
-			return implode( ', ', $reg_code );
202
+			return implode(', ', $reg_code);
203 203
 		}
204 204
 
205 205
 		//do we have a specific reg_obj?  Let's use it
206
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
206
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
207 207
 			return $this->_data->reg_obj->reg_code();
208 208
 		}
209 209
 
210 210
 		//do we have a specific reg_obj?  Let's use it
211
-		if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) {
211
+		if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) {
212 212
 			return $this->_data->reg_obj->reg_code();
213 213
 		}
214 214
 
215 215
 		//not able to determine the single reg code so let's return a comma delimited list of reg codes.
216 216
 		$reg_code = array();
217
-		foreach ( $this->_registrations_for_recipient as $reg ) {
218
-			if ( $reg instanceof EE_Registration ) {
217
+		foreach ($this->_registrations_for_recipient as $reg) {
218
+			if ($reg instanceof EE_Registration) {
219 219
 				$reg_code[] = $reg->reg_code();
220 220
 			}
221 221
 		}
222
-		return implode(', ', $reg_code );
222
+		return implode(', ', $reg_code);
223 223
 	}
224 224
 
225 225
 
Please login to merge, or discard this patch.
core/db_classes/EE_Event.class.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1006,7 +1006,7 @@
 block discarded – undo
1006 1006
 	 *
1007 1007
 	 * @access public
1008 1008
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1009
-	 * @return mixed void|string
1009
+	 * @return string void|string
1010 1010
 	 */
1011 1011
 	public function pretty_active_status( $echo = TRUE ) {
1012 1012
 		$active_status = $this->get_active_status();
Please login to merge, or discard this patch.
core/EE_Addon.core.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 
121 121
 	/**
122
-	 * @param mixed $min_core_version
122
+	 * @param string $min_core_version
123 123
 	 */
124 124
 	public function set_min_core_version( $min_core_version = NULL ) {
125 125
 		$this->_min_core_version = $min_core_version;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	/**
141 141
 	 * Sets addon_name
142 142
 	 * @param string $addon_name
143
-	 * @return boolean
143
+	 * @return string
144 144
 	 */
145 145
 	function set_name( $addon_name ) {
146 146
 		return $this->_addon_name = $addon_name;
Please login to merge, or discard this patch.
4_9_0_stages/EE_DMS_4_9_0_Email_System_Question.dmsstage.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @author				Brent Christensen
14 14
  *
15 15
  */
16
-class EE_DMS_4_9_0_Email_System_Question extends EE_Data_Migration_Script_Stage_Table{
16
+class EE_DMS_4_9_0_Email_System_Question extends EE_Data_Migration_Script_Stage_Table {
17 17
 
18 18
 
19 19
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 		global $wpdb;
27
-		$this->_pretty_name = __( 'Email - System Question', 'event_espresso' );
27
+		$this->_pretty_name = __('Email - System Question', 'event_espresso');
28 28
 		$this->_old_table = $wpdb->prefix.'esp_question';
29 29
 		$this->_extra_where_sql = "WHERE QST_system = 'email'";
30 30
 		parent::__construct();
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 	 * @param array $question an associative array where keys are column names and values are their values.
38 38
 	 * @return null
39 39
 	 */
40
-	protected function _migrate_old_row( $question ) {
41
-		if ( $question['QST_ID'] && $question['QST_system'] == 'email' ) {
40
+	protected function _migrate_old_row($question) {
41
+		if ($question['QST_ID'] && $question['QST_system'] == 'email') {
42 42
 			global $wpdb;
43 43
 			$success = $wpdb->update(
44 44
 				$this->_old_table,
45
-				array( 'QST_type' => 'EMAIL' ),  // data
46
-				array( 'QST_ID' => $question['QST_ID'] ),  // where
47
-				array( '%s' ),   // data format
48
-				array( '%d' )  // where format
45
+				array('QST_type' => 'EMAIL'), // data
46
+				array('QST_ID' => $question['QST_ID']), // where
47
+				array('%s'), // data format
48
+				array('%d')  // where format
49 49
 			);
50
-			if ( ! $success ) {
50
+			if ( ! $success) {
51 51
 				$this->add_error(
52 52
 					sprintf(
53
-						__( 'Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso' ),
54
-						json_encode( $question['QST_system'] ),
53
+						__('Could not update question system name "%1$s" for question ID=%2$d because "%3$s"', 'event_espresso'),
54
+						json_encode($question['QST_system']),
55 55
 						$question['QST_ID'],
56 56
 						$wpdb->last_error
57 57
 					)
Please login to merge, or discard this patch.
core/db_models/fields/EE_Model_Field_Base.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  *
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @subpackage    /core/db_models/fields/EE_Model_Field_Base.php
19 19
  * @author 				Michael Nelson
20 20
  */
21
-abstract class EE_Model_Field_Base{
21
+abstract class EE_Model_Field_Base {
22 22
 	var $_table_alias;
23 23
 	var $_table_column;
24 24
 	var $_name;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param      $nullable
35 35
 	 * @param null $default_value
36 36
 	 */
37
-	function __construct($table_column, $nicename, $nullable, $default_value = null){
37
+	function __construct($table_column, $nicename, $nullable, $default_value = null) {
38 38
 		$this->_table_column = $table_column;
39 39
 		$this->_nicename = $nicename;
40 40
 		$this->_nullable = $nullable;
@@ -48,27 +48,27 @@  discard block
 block discarded – undo
48 48
 	 * @param $name
49 49
 	 * @param $model_name
50 50
 	 */
51
-	function _construct_finalize($table_alias, $name, $model_name){
51
+	function _construct_finalize($table_alias, $name, $model_name) {
52 52
 		$this->_table_alias = $table_alias;
53 53
 		$this->_name = $name;
54 54
 		$this->_model_name = $model_name;
55 55
 		/**
56 56
 		 * allow for changing the defaults
57 57
 		 */
58
-		$this->_nicename = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this );
59
-		$this->_default_value = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this );
58
+		$this->_nicename = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this);
59
+		$this->_default_value = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this);
60 60
 	}
61
-	function get_table_alias(){
61
+	function get_table_alias() {
62 62
 		return $this->_table_alias;
63 63
 	}
64
-	function get_table_column(){
64
+	function get_table_column() {
65 65
 		return $this->_table_column;
66 66
 	}
67 67
 	/**
68 68
 	 * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime'
69 69
 	 * @return string
70 70
 	 */
71
-	function get_model_name(){
71
+	function get_model_name() {
72 72
 		return $this->_model_name;
73 73
 	}
74 74
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	 * @throws \EE_Error
77 77
 	 * @return string
78 78
 	 */
79
-	function get_name(){
80
-		if($this->_name){
79
+	function get_name() {
80
+		if ($this->_name) {
81 81
 			return $this->_name;
82
-		}else{
83
-			throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"),get_class($this)));
82
+		} else {
83
+			throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"), get_class($this)));
84 84
 		}
85 85
 	}
86
-	function get_nicename(){
86
+	function get_nicename() {
87 87
 		return $this->_nicename;
88 88
 	}
89
-	function is_nullable(){
89
+	function is_nullable() {
90 90
 		return $this->_nullable;
91 91
 	}
92 92
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * on insertion it can be null. However, on updates it must be present.
95 95
 	 * @return boolean
96 96
 	 */
97
-	function is_auto_increment(){
97
+	function is_auto_increment() {
98 98
 		return false;
99 99
 	}
100 100
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * value domains at the top of EEM_Base
103 103
 	 * @return mixed
104 104
 	 */
105
-	function get_default_value(){
105
+	function get_default_value() {
106 106
 		return $this->_default_value;
107 107
 	}
108 108
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * in the current query
114 114
 	 * @return string
115 115
 	 */
116
-	function get_qualified_column(){
116
+	function get_qualified_column() {
117 117
 		return $this->get_table_alias().".".$this->get_table_column();
118 118
 	}
119 119
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @param mixed $value_of_field_on_model_object
125 125
 	 * @return mixed
126 126
 	 */
127
-	function prepare_for_get($value_of_field_on_model_object){
127
+	function prepare_for_get($value_of_field_on_model_object) {
128 128
 		return $value_of_field_on_model_object;
129 129
 	}
130 130
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param mixed $value_of_field_on_model_object
135 135
 	 * @return mixed
136 136
 	 */
137
-	function prepare_for_use_in_db($value_of_field_on_model_object){
137
+	function prepare_for_use_in_db($value_of_field_on_model_object) {
138 138
 		return $value_of_field_on_model_object;
139 139
 	}
140 140
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @param mixed $value_inputted_for_field_on_model_object
146 146
 	 * @return mixed
147 147
 	 */
148
-	function prepare_for_set($value_inputted_for_field_on_model_object){
148
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
149 149
 		return $value_inputted_for_field_on_model_object;
150 150
 	}
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @param mixed $value_found_in_db_for_model_object
157 157
 	 * @return mixed
158 158
 	 */
159
-	function prepare_for_set_from_db($value_found_in_db_for_model_object){
159
+	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
160 160
 		return $this->prepare_for_set($value_found_in_db_for_model_object);
161 161
 	}
162 162
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param mixed $value_on_field_to_be_outputted
168 168
 	 * @return mixed
169 169
 	 */
170
-	function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ){
170
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted) {
171 171
 		return $value_on_field_to_be_outputted;
172 172
 	}
173 173
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * By default, all fields aren't db-only.
183 183
 	 * @return boolean
184 184
 	 */
185
-	function is_db_only_field(){
185
+	function is_db_only_field() {
186 186
 		return false;
187 187
 	}
188 188
 }
189 189
\ No newline at end of file
Please login to merge, or discard this patch.
4_9_0_stages/EE_DMS_4_9_0_Answers_With_No_Registration.dmsstage.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @author				Brent Christensen
15 15
  *
16 16
  */
17
-class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage{
17
+class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage {
18 18
 
19 19
 
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @return EE_DMS_4_9_0_Answers_With_No_Registration
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->_pretty_name = __( 'Answer Cleanup', 'event_espresso' );
27
+		$this->_pretty_name = __('Answer Cleanup', 'event_espresso');
28 28
 		parent::__construct();
29 29
 	}
30 30
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	protected function _migration_step($num_items_to_migrate = 50) {
49 49
 		global $wpdb;
50 50
 		$wpdb->delete(
51
-			$wpdb->prefix . 'esp_answer',
52
-			array( 'REG_ID' => 0 ),
53
-			array( '%d' )
51
+			$wpdb->prefix.'esp_answer',
52
+			array('REG_ID' => 0),
53
+			array('%d')
54 54
 		);
55 55
 		$this->set_completed();
56 56
 		return 1;
Please login to merge, or discard this patch.