Completed
Branch FET-9747-doing-it-wrong (e31ff3)
by
unknown
358:54 queued 340:15
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/line_item_filters/EE_Line_Item_Filter_Base.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EE_Line_Item_Filter_Base
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param \EEI_Line_Item $line_item
25 25
 	 * @return \EEI_Line_Item
26 26
 	 */
27
-	public function process( EEI_Line_Item $line_item ) {
27
+	public function process(EEI_Line_Item $line_item) {
28 28
 		return $line_item;
29 29
 	}
30 30
 
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.
modules/bot_trap/EED_Bot_Trap.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
 		if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-			define( 'EE_BOT_TRAP_BASE_URL', plugin_dir_url( __FILE__ ) . DS );
37
+			define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
38 38
 			add_action(
39 39
 				'AHEE__ticket_selector_chart__template__after_ticket_selector',
40
-				array( 'EED_Bot_Trap', 'generate_bot_trap' ),
40
+				array('EED_Bot_Trap', 'generate_bot_trap'),
41 41
 				10, 2
42 42
 			);
43 43
 			add_action(
44 44
 				'EED_Ticket_Selector__process_ticket_selections__before',
45
-				array( 'EED_Bot_Trap', 'process_bot_trap' ),
45
+				array('EED_Bot_Trap', 'process_bot_trap'),
46 46
 				1, 2
47 47
 			);
48 48
 			// redirect bots to bogus success page
49
-			EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
49
+			EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
50 50
 		}
51 51
 	}
52 52
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	public static function set_hooks_admin() {
62 62
 		add_action(
63 63
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
64
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
64
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
65 65
 			10
66 66
 		);
67 67
 		add_filter(
68 68
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
69
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
69
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
70 70
 			10, 1
71 71
 		);
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param    WP $WP
81 81
 	 * @return    void
82 82
 	 */
83
-	public function run( $WP ) {}
83
+	public function run($WP) {}
84 84
 
85 85
 
86 86
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function generate_bot_trap() {
94
-		$do_not_enter = __( 'please do not enter anything in this input', 'event_espresso' );
94
+		$do_not_enter = __('please do not enter anything in this input', 'event_espresso');
95 95
 		$html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">';
96
-		$html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter  . '</label>';
96
+		$html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>';
97 97
 		$html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>';
98 98
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
99
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
100
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
101
-			$html .= EE_Encryption::instance()->encrypt( time() );
99
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
100
+			EE_Registry::instance()->load_core('EE_Encryption');
101
+			$html .= EE_Encryption::instance()->encrypt(time());
102 102
 		} else {
103 103
 			$html .= time();
104 104
 		}
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public static function process_bot_trap() {
119 119
 		// what's your email address Mr. Bot ?
120
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) && $_REQUEST[ 'tkt-slctr-request-processor-email' ] == '' ? true : false;
120
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) && $_REQUEST['tkt-slctr-request-processor-email'] == '' ? true : false;
121 121
 		// get encrypted timestamp for when the form was originally displayed
122
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) : '';
122
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) : '';
123 123
 		// decrypt and convert to absolute  integer
124
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
125
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
126
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
124
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
125
+			EE_Registry::instance()->load_core('EE_Encryption');
126
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
127 127
 		} else {
128
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
128
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
129 129
 		}
130 130
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
131
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) ? true : false;
131
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) ? true : false;
132 132
 		// are we human ?
133
-		if ( $empty_trap && ! $suspicious_timing ) {
133
+		if ($empty_trap && ! $suspicious_timing) {
134 134
 			return;
135 135
 		}
136 136
 		// UH OH...
137 137
 		$redirect_url = add_query_arg(
138
-			array( 'ee' => 'ticket_selection_received' ),
138
+			array('ee' => 'ticket_selection_received'),
139 139
 			EE_Registry::instance()->CFG->core->reg_page_url()
140 140
 		);
141
-		if ( $suspicious_timing ) {
141
+		if ($suspicious_timing) {
142 142
 			$redirect_url = add_query_arg(
143
-				array( 'ee-notice' => urlencode( __( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
143
+				array('ee-notice' => urlencode(__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
144 144
 				$redirect_url
145 145
 			);
146 146
 		}
147 147
 		wp_safe_redirect(
148
-			apply_filters( 'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url )
148
+			apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url)
149 149
 		);
150 150
 		exit();
151 151
 	}
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	 * @return    void
161 161
 	 */
162 162
 	public static function display_bot_trap_success() {
163
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
164
-		$bot_notice = __( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
165
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
166
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
163
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
164
+		$bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
165
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
166
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
167 167
 	}
168 168
 
169 169
 
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 				'html_id'         			=> 'bot_trap_settings',
198 198
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
199 199
 				'subsections'     		=> array(
200
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'Bot Trap Settings', 'event_espresso' ) ) ),
200
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(__('Bot Trap Settings', 'event_espresso'))),
201 201
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
202 202
 						array(
203
-							'html_label_text' 	=> __( 'Enable Bot Trap', 'event_espresso' ),
204
-							'html_help_text' 		=>  __( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
205
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
203
+							'html_label_text' 	=> __('Enable Bot Trap', 'event_espresso'),
204
+							'html_help_text' 		=>  __('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
205
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
206 206
 							'required'        		=> false
207 207
 						)
208 208
 					),
209 209
 					'use_encryption' 		=> new EE_Yes_No_Input(
210 210
 						array(
211
-							'html_label_text' 	=> __( 'Encrypt Bot Trap Data', 'event_espresso' ),
212
-							'html_help_text' 		=>  __( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
213
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
211
+							'html_label_text' 	=> __('Encrypt Bot Trap Data', 'event_espresso'),
212
+							'html_help_text' 		=>  __('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
213
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
214 214
 							'required'        		=> false
215 215
 						)
216 216
 					),
@@ -228,30 +228,30 @@  discard block
 block discarded – undo
228 228
 	 * @param \EE_Registration_Config $EE_Registration_Config
229 229
 	 * @return \EE_Registration_Config
230 230
 	 */
231
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
231
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
232 232
 		try {
233 233
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
234 234
 			// if not displaying a form, then check for form submission
235
-			if ( $bot_trap_settings_form->was_submitted() ) {
235
+			if ($bot_trap_settings_form->was_submitted()) {
236 236
 				// capture form data
237 237
 				$bot_trap_settings_form->receive_form_submission();
238 238
 				// validate form data
239
-				if ( $bot_trap_settings_form->is_valid() ) {
239
+				if ($bot_trap_settings_form->is_valid()) {
240 240
 					// grab validated data from form
241 241
 					$valid_data = $bot_trap_settings_form->valid_data();
242
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
243
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
244
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
242
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
243
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
244
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
245 245
 					} else {
246
-						EE_Error::add_error( __( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
246
+						EE_Error::add_error(__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
247 247
 					}
248 248
 				} else {
249
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
250
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
249
+					if ($bot_trap_settings_form->submission_error_message() != '') {
250
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
251 251
 					}
252 252
 				}
253 253
 			}
254
-		} catch ( EE_Error $e ) {
254
+		} catch (EE_Error $e) {
255 255
 			$e->get_error();
256 256
 		}
257 257
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
modules/messages/EED_Messages.module.php 4 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -912,11 +912,11 @@
 block discarded – undo
912 912
 				sprintf(
913 913
 					_n(
914 914
 						'%d message successfully queued for resending.',
915
-				        '%d messages successfully queued for resending.',
916
-				        $queue_count,
917
-				        'event_espresso'
918
-				    ),
919
-				    $queue_count
915
+						'%d messages successfully queued for resending.',
916
+						$queue_count,
917
+						'event_espresso'
918
+					),
919
+					$queue_count
920 920
 				)
921 921
 			);
922 922
 		} else {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @param string  $payment_status The payment status being matched.
543 543
 	 *
544
-	 * @return string|bool The payment message type slug matching the status or false if no match.
544
+	 * @return string|false The payment message type slug matching the status or false if no match.
545 545
 	 */
546 546
 	protected static function _get_payment_message_type( $payment_status ) {
547 547
 		EE_Registry::instance()->load_helper( 'MSG_Template' );
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	 * @since 4.9.0
872 872
 	 * @param $message_ids
873 873
 	 *
874
-	 * @return bool | EE_Messages_Queue  false if no messages sent.
874
+	 * @return EE_Messages_Queue | EE_Messages_Queue  false if no messages sent.
875 875
 	 */
876 876
 	public static function send_now( $message_ids ) {
877 877
 		self::_load_controller();
Please login to merge, or discard this patch.
Spacing   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @return EED_Module
70 70
 	 */
71 71
 	public static function instance() {
72
-		return parent::get_instance( __CLASS__ );
72
+		return parent::get_instance(__CLASS__);
73 73
 	}
74 74
 
75 75
 
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function set_hooks() {
86 86
 		//actions
87
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
88
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 );
87
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
88
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2);
89 89
 		//filters
90
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
91
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
90
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
91
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
92 92
 		//register routes
93 93
 		self::_register_routes();
94 94
 	}
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public static function set_hooks_admin() {
103 103
 		//actions
104
-		add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 );
105
-		add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 );
106
-		add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 );
107
-		add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 );
108
-		add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 );
109
-		add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 );
104
+		add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2);
105
+		add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10);
106
+		add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3);
107
+		add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2);
108
+		add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10);
109
+		add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1);
110 110
 		//filters
111
-		add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 );
112
-		add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
113
-		add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 );
111
+		add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2);
112
+		add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
113
+		add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4);
114 114
 	}
115 115
 
116 116
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 * @return void
125 125
 	 */
126 126
 	protected static function _register_routes() {
127
-		EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' );
128
-		EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'execute_batch_request' );
129
-		EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' );
130
-		EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' );
131
-		do_action( 'AHEE__EED_Messages___register_routes' );
127
+		EE_Config::register_route('msg_url_trigger', 'Messages', 'run');
128
+		EE_Config::register_route('msg_cron_trigger', 'Messages', 'execute_batch_request');
129
+		EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger');
130
+		EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger');
131
+		do_action('AHEE__EED_Messages___register_routes');
132 132
 	}
133 133
 
134 134
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 	 * @since 4.9.0
140 140
 	 * @param WP $WP
141 141
 	 */
142
-	public function browser_trigger( $WP ) {
142
+	public function browser_trigger($WP) {
143 143
 		//ensure controller is loaded
144 144
 		self::_load_controller();
145
-		$token = EE_Registry::instance()->REQ->get( 'token' );
145
+		$token = EE_Registry::instance()->REQ->get('token');
146 146
 		try {
147
-			$mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager );
148
-			self::$_MSG_PROCESSOR->generate_and_send_now( $mtg );
149
-		} catch( EE_Error $e ) {
150
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
147
+			$mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager);
148
+			self::$_MSG_PROCESSOR->generate_and_send_now($mtg);
149
+		} catch (EE_Error $e) {
150
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
151 151
 			// add specific message for developers if WP_DEBUG in on
152
-			$error_msg .= '||' . $e->getMessage();
153
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
152
+			$error_msg .= '||'.$e->getMessage();
153
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
154 154
 		}
155 155
 	}
156 156
 
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 * @since 4.9.0
167 167
 	 * @param $WP
168 168
 	 */
169
-	public function browser_error_trigger( $WP ) {
170
-		$token = EE_Registry::instance()->REQ->get( 'token' );
171
-		if ( $token ) {
172
-			$message = EEM_Message::instance()->get_one_by_token( $token );
173
-			if ( $message instanceof EE_Message ) {
174
-				header( 'HTTP/1.1 200 OK' );
175
-				$error_msg = nl2br( $message->error_message() );
169
+	public function browser_error_trigger($WP) {
170
+		$token = EE_Registry::instance()->REQ->get('token');
171
+		if ($token) {
172
+			$message = EEM_Message::instance()->get_one_by_token($token);
173
+			if ($message instanceof EE_Message) {
174
+				header('HTTP/1.1 200 OK');
175
+				$error_msg = nl2br($message->error_message());
176 176
 				?>
177 177
 				<!DOCTYPE html>
178 178
 				<html>
179 179
 					<head></head>
180 180
 					<body>
181
-						<?php echo empty( $error_msg )
182
-						? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' )
181
+						<?php echo empty($error_msg)
182
+						? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso')
183 183
 						: wp_kses(
184 184
 							$error_msg,
185 185
 							array(
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
 	 * @throws EE_Error
215 215
 	 * @return    void
216 216
 	 */
217
-	public function run( $WP ) {
217
+	public function run($WP) {
218 218
 		//ensure controller is loaded
219 219
 		self::_load_controller();
220 220
 		// attempt to process message
221 221
 		try {
222 222
 			/** @type EE_Message_To_Generate_From_Request $message_to_generate */
223
-			$message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
224
-			self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate );
225
-		} catch ( EE_Error $e ) {
226
-			$error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' );
223
+			$message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
224
+			self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate);
225
+		} catch (EE_Error $e) {
226
+			$error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso');
227 227
 			// add specific message for developers if WP_DEBUG in on
228
-			$error_msg .= '||' . $e->getMessage();
229
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
228
+			$error_msg .= '||'.$e->getMessage();
229
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
230 230
 		}
231 231
 	}
232 232
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 	 * This is triggered by the 'msg_cron_trigger' route.
236 236
 	 * @param WP $WP
237 237
 	 */
238
-	public function execute_batch_request( $WP ) {
238
+	public function execute_batch_request($WP) {
239 239
 		$this->run_cron();
240
-		header( 'HTTP/1.1 200 OK' );
240
+		header('HTTP/1.1 200 OK');
241 241
 		exit();
242 242
 	}
243 243
 
@@ -251,35 +251,35 @@  discard block
 block discarded – undo
251 251
 	public function run_cron() {
252 252
 		self::_load_controller();
253 253
 		//get required vars
254
-		$cron_type = EE_Registry::instance()->REQ->get( 'type' );
255
-		$transient_key = EE_Registry::instance()->REQ->get( 'key' );
254
+		$cron_type = EE_Registry::instance()->REQ->get('type');
255
+		$transient_key = EE_Registry::instance()->REQ->get('key');
256 256
 
257 257
 		//now let's verify transient, if not valid exit immediately
258
-		if ( ! get_transient( $transient_key ) ) {
258
+		if ( ! get_transient($transient_key)) {
259 259
 			/**
260 260
 			 * trigger error so this gets in the error logs.  This is important because it happens on a non-user request.
261 261
 			 */
262
-			trigger_error( esc_attr__( 'Invalid Request (Transient does not exist)', 'event_espresso' ) );
262
+			trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso'));
263 263
 		}
264 264
 
265 265
 		//if made it here, lets' delete the transient to keep the db clean
266
-		delete_transient( $transient_key );
266
+		delete_transient($transient_key);
267 267
 
268
-		if ( apply_filters( 'FHEE__EED_Messages__run_cron__use_wp_cron', true ) ) {
268
+		if (apply_filters('FHEE__EED_Messages__run_cron__use_wp_cron', true)) {
269 269
 
270
-			$method = 'batch_' . $cron_type . '_from_queue';
271
-			if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) {
270
+			$method = 'batch_'.$cron_type.'_from_queue';
271
+			if (method_exists(self::$_MSG_PROCESSOR, $method)) {
272 272
 				self::$_MSG_PROCESSOR->$method();
273 273
 			} else {
274 274
 				//no matching task
275 275
 				/**
276 276
 				 * trigger error so this gets in the error logs.  This is important because it happens on a non user request.
277 277
 				 */
278
-				trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) );
278
+				trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type)));
279 279
 			}
280 280
 		}
281 281
 
282
-		do_action( 'FHEE__EED_Messages__run_cron__end' );
282
+		do_action('FHEE__EED_Messages__run_cron__end');
283 283
 	}
284 284
 
285 285
 
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @return EE_Messages_Template_Pack
297 297
 	 */
298
-	public static function get_template_pack( $template_pack_name ) {
299
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
300
-		return EEH_MSG_Template::get_template_pack( $template_pack_name );
298
+	public static function get_template_pack($template_pack_name) {
299
+		EE_Registry::instance()->load_helper('MSG_Template');
300
+		return EEH_MSG_Template::get_template_pack($template_pack_name);
301 301
 	}
302 302
 
303 303
 
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 	 * @return EE_Messages_Template_Pack[]
312 312
 	 */
313 313
 	public static function get_template_packs() {
314
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
314
+		EE_Registry::instance()->load_helper('MSG_Template');
315 315
 
316 316
 		//for backward compat, let's make sure this returns in the same format as originally.
317 317
 		$template_pack_collection = EEH_MSG_Template::get_template_pack_collection();
318 318
 		$template_pack_collection->rewind();
319 319
 		$template_packs = array();
320
-		while ( $template_pack_collection->valid() ) {
321
-			$template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current();
320
+		while ($template_pack_collection->valid()) {
321
+			$template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current();
322 322
 			$template_pack_collection->next();
323 323
 		}
324 324
 		return $template_packs;
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 	 * @return void
335 335
 	 */
336 336
 	public static function set_autoloaders() {
337
-		if ( empty( self::$_MSG_PATHS ) ) {
337
+		if (empty(self::$_MSG_PATHS)) {
338 338
 			self::_set_messages_paths();
339
-			foreach ( self::$_MSG_PATHS as $path ) {
340
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path );
339
+			foreach (self::$_MSG_PATHS as $path) {
340
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path);
341 341
 			}
342 342
 			// add aliases
343
-			EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' );
344
-			EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' );
343
+			EEH_Autoloader::add_alias('EE_messages', 'EE_messages');
344
+			EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger');
345 345
 		}
346 346
 	}
347 347
 
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 			'shortcodes',
370 370
 			);
371 371
 		$paths = array();
372
-		foreach ( $dir_ref as $index => $dir ) {
373
-			$paths[ $index ] = EE_LIBRARIES . $dir;
372
+		foreach ($dir_ref as $index => $dir) {
373
+			$paths[$index] = EE_LIBRARIES.$dir;
374 374
 		}
375
-		self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths );
375
+		self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths);
376 376
 	}
377 377
 
378 378
 
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
 	 * @return void
384 384
 	 */
385 385
 	protected static function _load_controller() {
386
-		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) {
387
-			EE_Registry::instance()->load_core( 'Request_Handler' );
386
+		if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) {
387
+			EE_Registry::instance()->load_core('Request_Handler');
388 388
 			self::set_autoloaders();
389
-			self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' );
390
-			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' );
391
-			self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
389
+			self::$_EEMSG = EE_Registry::instance()->load_lib('messages');
390
+			self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor');
391
+			self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
392 392
 		}
393 393
 	}
394 394
 
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 	/**
398 398
 	 * @param EE_Transaction $transaction
399 399
 	 */
400
-	public static function payment_reminder( EE_Transaction $transaction ) {
400
+	public static function payment_reminder(EE_Transaction $transaction) {
401 401
 		self::_load_controller();
402
-		$data = array( $transaction, null );
403
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data );
402
+		$data = array($transaction, null);
403
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data);
404 404
 	}
405 405
 
406 406
 
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
 	 * @param  EE_Payment object
412 412
 	 * @return void
413 413
 	 */
414
-	public static function payment( EE_Transaction $transaction, EE_Payment $payment ) {
414
+	public static function payment(EE_Transaction $transaction, EE_Payment $payment) {
415 415
 		self::_load_controller();
416
-		$data = array( $transaction, $payment );
417
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
418
-		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
416
+		$data = array($transaction, $payment);
417
+		EE_Registry::instance()->load_helper('MSG_Template');
418
+		$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
419 419
 		//if payment amount is less than 0 then switch to payment_refund message type.
420 420
 		$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
421
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
421
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
422 422
 	}
423 423
 
424 424
 
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	/**
427 427
 	 * @param EE_Transaction $transaction
428 428
 	 */
429
-	public static function cancelled_registration( EE_Transaction $transaction ) {
429
+	public static function cancelled_registration(EE_Transaction $transaction) {
430 430
 		self::_load_controller();
431
-		$data = array( $transaction, null );
432
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data );
431
+		$data = array($transaction, null);
432
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data);
433 433
 	}
434 434
 
435 435
 
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
 	 * @param array $extra_details
443 443
 	 * @return void
444 444
 	 */
445
-	public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) {
445
+	public static function maybe_registration(EE_Registration $registration, $extra_details = array()) {
446 446
 
447
-		if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) {
447
+		if ( ! self::_verify_registration_notification_send($registration, $extra_details)) {
448 448
 			//no messages please
449 449
 			return;
450 450
 		}
@@ -459,22 +459,22 @@  discard block
 block discarded – undo
459 459
 		$mtgs = array();
460 460
 
461 461
 		//loop through registrations and trigger messages once per status.
462
-		foreach ( $all_registrations as $reg ) {
462
+		foreach ($all_registrations as $reg) {
463 463
 
464 464
 			//already triggered?
465
-			if ( in_array( $reg->status_ID(), $statuses_sent ) ) {
465
+			if (in_array($reg->status_ID(), $statuses_sent)) {
466 466
 				continue;
467 467
 			}
468 468
 
469
-			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() );
470
-			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) );
469
+			$message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID());
470
+			$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID()));
471 471
 			$statuses_sent[] = $reg->status_ID();
472 472
 		}
473 473
 
474
-		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) );
474
+		$mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null));
475 475
 
476 476
 		//batch queue and initiate request
477
-		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs );
477
+		self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs);
478 478
 		self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
479 479
 	}
480 480
 
@@ -489,39 +489,39 @@  discard block
 block discarded – undo
489 489
 	 *
490 490
 	 * @return bool          true = send away, false = nope halt the presses.
491 491
 	 */
492
-	protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) {
492
+	protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) {
493 493
 		 //self::log(
494 494
 		 //	__CLASS__, __FUNCTION__, __LINE__,
495 495
 		 //	$registration->transaction(),
496 496
 		 //	array( '$extra_details' => $extra_details )
497 497
 		 //);
498 498
 		// currently only using this to send messages for the primary registrant
499
-		if ( ! $registration->is_primary_registrant() ) {
499
+		if ( ! $registration->is_primary_registrant()) {
500 500
 			return false;
501 501
 		}
502 502
 		// first we check if we're in admin and not doing front ajax
503
-		if ( is_admin() && ! EE_FRONT_AJAX ) {
503
+		if (is_admin() && ! EE_FRONT_AJAX) {
504 504
 			//make sure appropriate admin params are set for sending messages
505
-			if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) {
505
+			if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) {
506 506
 				//no messages sent please.
507 507
 				return false;
508 508
 			}
509 509
 		} else {
510 510
 			// frontend request (either regular or via AJAX)
511 511
 			// TXN is NOT finalized ?
512
-			if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) {
512
+			if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) {
513 513
 				return false;
514 514
 			}
515 515
 			// return visit but nothing changed ???
516 516
 			if (
517
-				isset( $extra_details['revisit'], $extra_details['status_updates'] ) &&
517
+				isset($extra_details['revisit'], $extra_details['status_updates']) &&
518 518
 				$extra_details['revisit'] && ! $extra_details['status_updates']
519 519
 			) {
520 520
 				return false;
521 521
 			}
522 522
 			// NOT sending messages && reg status is something other than "Not-Approved"
523 523
 			if (
524
-				! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) &&
524
+				! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) &&
525 525
 				$registration->status_ID() !== EEM_Registration::status_id_not_approved
526 526
 			) {
527 527
 				return false;
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 *
544 544
 	 * @return array
545 545
 	 */
546
-	protected static function _get_reg_status_array( $reg_status = '' ) {
547
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
548
-		return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
549
-			? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status )
546
+	protected static function _get_reg_status_array($reg_status = '') {
547
+		EE_Registry::instance()->load_helper('MSG_Template');
548
+		return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
549
+			? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status)
550 550
 			: EEH_MSG_Template::reg_status_to_message_type_array();
551 551
 	}
552 552
 
@@ -562,10 +562,10 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return string|bool The payment message type slug matching the status or false if no match.
564 564
 	 */
565
-	protected static function _get_payment_message_type( $payment_status ) {
566
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
567
-		return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
568
-			? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status )
565
+	protected static function _get_payment_message_type($payment_status) {
566
+		EE_Registry::instance()->load_helper('MSG_Template');
567
+		return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
568
+			? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status)
569 569
 			: false;
570 570
 	}
571 571
 
@@ -579,33 +579,33 @@  discard block
 block discarded – undo
579 579
 	 * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages
580 580
 	 * @return bool          success/fail
581 581
 	 */
582
-	public static function process_resend( $req_data ) {
582
+	public static function process_resend($req_data) {
583 583
 		self::_load_controller();
584 584
 
585 585
 		//if $msgID in this request then skip to the new resend_message
586
-		if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) {
586
+		if (EE_Registry::instance()->REQ->get('MSG_ID')) {
587 587
 			return self::resend_message();
588 588
 		}
589 589
 
590 590
 		//make sure any incoming request data is set on the REQ so that it gets picked up later.
591 591
 		$req_data = (array) $req_data;
592
-		foreach( $req_data as $request_key => $request_value ) {
593
-			EE_Registry::instance()->REQ->set( $request_key, $request_value );
592
+		foreach ($req_data as $request_key => $request_value) {
593
+			EE_Registry::instance()->REQ->set($request_key, $request_value);
594 594
 		}
595 595
 
596
-		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) {
596
+		if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) {
597 597
 			return false;
598 598
 		}
599 599
 
600 600
 		try {
601
-			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send );
601
+			self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send);
602 602
 			self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority();
603
-		} catch( EE_Error $e ) {
604
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
603
+		} catch (EE_Error $e) {
604
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
605 605
 			return false;
606 606
 		}
607 607
 		EE_Error::add_success(
608
-			__( 'Messages have been successfully queued for generation and sending.', 'event_espresso' )
608
+			__('Messages have been successfully queued for generation and sending.', 'event_espresso')
609 609
 		);
610 610
 		return true; //everything got queued.
611 611
 	}
@@ -618,17 +618,17 @@  discard block
 block discarded – undo
618 618
 	public static function resend_message() {
619 619
 		self::_load_controller();
620 620
 
621
-		$msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' );
622
-		if ( ! $msgID ) {
623
-			EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
621
+		$msgID = EE_Registry::instance()->REQ->get('MSG_ID');
622
+		if ( ! $msgID) {
623
+			EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
624 624
 			return false;
625 625
 		}
626 626
 
627
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID );
627
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID);
628 628
 
629 629
 		//setup success message.
630
-		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
631
-		EE_Error::add_success( sprintf(
630
+		$count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
631
+		EE_Error::add_success(sprintf(
632 632
 			_n(
633 633
 				'There was %d message queued for resending.',
634 634
 				'There were %d messages queued for resending.',
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 				'event_espresso'
637 637
 			),
638 638
 			$count_ready_for_resend
639
-		) );
639
+		));
640 640
 		return true;
641 641
 	}
642 642
 
@@ -649,13 +649,13 @@  discard block
 block discarded – undo
649 649
 	 * @param  EE_Payment $payment EE_payment object
650 650
 	 * @return bool              success/fail
651 651
 	 */
652
-	public static function process_admin_payment( EE_Payment $payment ) {
653
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
652
+	public static function process_admin_payment(EE_Payment $payment) {
653
+		EE_Registry::instance()->load_helper('MSG_Template');
654 654
 		//we need to get the transaction object
655 655
 		$transaction = $payment->transaction();
656
-		if ( $transaction instanceof EE_Transaction ) {
657
-			$data = array( $transaction, $payment );
658
-			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() );
656
+		if ($transaction instanceof EE_Transaction) {
657
+			$data = array($transaction, $payment);
658
+			$message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID());
659 659
 
660 660
 			//if payment amount is less than 0 then switch to payment_refund message type.
661 661
 			$message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type;
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
 
666 666
 			self::_load_controller();
667 667
 
668
-			self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data );
668
+			self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data);
669 669
 
670 670
 			//get count of queued for generation
671
-			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( array( EEM_Message::status_incomplete, EEM_Message::status_idle ) );
671
+			$count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(array(EEM_Message::status_incomplete, EEM_Message::status_idle));
672 672
 
673
-			if ( $count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0 ) {
674
-				add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
673
+			if ($count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0) {
674
+				add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
675 675
 				return true;
676 676
 			} else {
677
-				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() );
677
+				$count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending());
678 678
 				/**
679 679
 				 * Verify that there are actually errors.  If not then we return a success message because the queue might have been emptied due to successful
680 680
 				 * IMMEDIATE generation.
681 681
 				 */
682
-				if ( $count_failed > 0 ) {
683
-					EE_Error::add_error( sprintf(
682
+				if ($count_failed > 0) {
683
+					EE_Error::add_error(sprintf(
684 684
 						_n(
685 685
 							'The payment notification generation failed.',
686 686
 							'%d payment notifications failed being sent.',
@@ -688,11 +688,11 @@  discard block
 block discarded – undo
688 688
 							'event_espresso'
689 689
 						),
690 690
 						$count_failed
691
-					), __FILE__, __FUNCTION__, __LINE__ );
691
+					), __FILE__, __FUNCTION__, __LINE__);
692 692
 
693 693
 					return false;
694 694
 				} else {
695
-					add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' );
695
+					add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true');
696 696
 					return true;
697 697
 				}
698 698
 			}
@@ -716,11 +716,11 @@  discard block
 block discarded – undo
716 716
 	 * @param  int      	      $grp_id     a specific message template group id.
717 717
 	 * @return void
718 718
 	 */
719
-	public static function send_newsletter_message( $registrations, $grp_id ) {
719
+	public static function send_newsletter_message($registrations, $grp_id) {
720 720
 		//make sure mtp is id and set it in the EE_Request Handler later messages setup.
721
-		EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id );
721
+		EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id);
722 722
 		self::_load_controller();
723
-		self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations );
723
+		self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations);
724 724
 	}
725 725
 
726 726
 
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
 	 * @param string 	$message_type
736 736
 	 * @return 	string
737 737
 	 */
738
-	public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) {
738
+	public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') {
739 739
 		// whitelist $messenger
740
-		switch ( $messenger ) {
740
+		switch ($messenger) {
741 741
 			case 'pdf' :
742 742
 				$sending_messenger = 'pdf';
743 743
 				$generating_messenger = 'html';
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 				break;
750 750
 		}
751 751
 		// whitelist $message_type
752
-		switch ( $message_type ) {
752
+		switch ($message_type) {
753 753
 			case 'receipt' :
754 754
 				$message_type = 'receipt';
755 755
 				break;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 				break;
760 760
 		}
761 761
 		// verify that both the messenger AND the message type are active
762
-		if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) {
762
+		if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) {
763 763
 			//need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?)
764 764
 			$template_query_params = array(
765 765
 				'MTP_is_active' => true,
@@ -768,16 +768,16 @@  discard block
 block discarded – undo
768 768
 				'Event.EVT_ID' => $registration->event_ID()
769 769
 			);
770 770
 			//get the message template group.
771
-			$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
771
+			$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
772 772
 			//if we don't have an EE_Message_Template_Group then return
773
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
773
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
774 774
 				// remove EVT_ID from query params so that global templates get picked up
775
-				unset( $template_query_params['Event.EVT_ID'] );
775
+				unset($template_query_params['Event.EVT_ID']);
776 776
 				//get global template as the fallback
777
-				$msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) );
777
+				$msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params));
778 778
 			}
779 779
 			//if we don't have an EE_Message_Template_Group then return
780
-			if ( ! $msg_template_group instanceof EE_Message_Template_Group ) {
780
+			if ( ! $msg_template_group instanceof EE_Message_Template_Group) {
781 781
 				return '';
782 782
 			}
783 783
 			// generate the URL
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 	 * @param bool 	  $send true we will do a test send using the messenger delivery, false we just do a regular preview
807 807
 	 * @return string          The body of the message.
808 808
 	 */
809
-	public static function preview_message( $type, $context, $messenger, $send = false ) {
809
+	public static function preview_message($type, $context, $messenger, $send = false) {
810 810
 		self::_load_controller();
811 811
 		$mtg = new EE_Message_To_Generate(
812 812
 			$messenger,
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 			$context,
816 816
 			true
817 817
 		);
818
-		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg );
819
-		if ( $generated_preview_queue instanceof EE_Messages_Queue ) {
818
+		$generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg);
819
+		if ($generated_preview_queue instanceof EE_Messages_Queue) {
820 820
 			return $generated_preview_queue->get_message_repository()->current()->content();
821 821
 		} else {
822 822
 			return $generated_preview_queue;
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	 *
844 844
 	 * @return bool          success or fail.
845 845
 	 */
846
-	public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) {
846
+	public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') {
847 847
 		self::_load_controller();
848 848
 		/** @type EE_Message_To_Generate_From_Queue $message_to_generate */
849 849
 		$message_to_generate = EE_Registry::instance()->load_lib(
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 				$custom_subject,
856 856
 			)
857 857
 		);
858
-		return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate );
858
+		return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate);
859 859
 	}
860 860
 
861 861
 
@@ -868,22 +868,22 @@  discard block
 block discarded – undo
868 868
 	 * @param array     $message_ids An array of message ids
869 869
 	 * @return bool | EE_Messages_Queue     false if nothing was generated, EE_Messages_Queue containing generated messages.
870 870
 	 */
871
-	public static function generate_now( $message_ids ) {
871
+	public static function generate_now($message_ids) {
872 872
 		self::_load_controller();
873 873
 		$messages = EEM_Message::instance()->get_all(
874 874
 			array(
875 875
 				0 => array(
876
-					'MSG_ID' => array( 'IN', $message_ids ),
876
+					'MSG_ID' => array('IN', $message_ids),
877 877
 					'STS_ID' => EEM_Message::status_incomplete,
878 878
 				)
879 879
 			)
880 880
 		);
881 881
 
882
-		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages );
882
+		$generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages);
883 883
 
884
-		if ( ! $generated_queue instanceof EE_Messages_Queue ) {
884
+		if ( ! $generated_queue instanceof EE_Messages_Queue) {
885 885
 			EE_Error::add_error(
886
-				__( 'The messages were not generated.  This is usually because there is already a batch being generated on a separate request.  You can wait a minute or two and try again.', 'event_espresso' ),
886
+				__('The messages were not generated.  This is usually because there is already a batch being generated on a separate request.  You can wait a minute or two and try again.', 'event_espresso'),
887 887
 				__FILE__, __FUNCTION__, __LINE__
888 888
 			);
889 889
 		}
@@ -902,28 +902,28 @@  discard block
 block discarded – undo
902 902
 	 *
903 903
 	 * @return bool | EE_Messages_Queue  false if no messages sent.
904 904
 	 */
905
-	public static function send_now( $message_ids ) {
905
+	public static function send_now($message_ids) {
906 906
 		self::_load_controller();
907 907
 		$messages = EEM_Message::instance()->get_all(
908 908
 			array(
909 909
 				0 => array(
910
-					'MSG_ID' => array( 'IN', $message_ids ),
911
-					'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) )
910
+					'MSG_ID' => array('IN', $message_ids),
911
+					'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry))
912 912
 				)
913 913
 			)
914 914
 		);
915 915
 
916
-		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages );
916
+		$sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages);
917 917
 
918
-		if ( ! $sent_queue instanceof EE_Messages_Queue ) {
918
+		if ( ! $sent_queue instanceof EE_Messages_Queue) {
919 919
 			EE_Error::add_error(
920
-				__( 'The messages were not sent.  This is usually because there is already a batch being sent on a separate request.  You can wait a minute or two and try again.', 'event_espresso' ),
920
+				__('The messages were not sent.  This is usually because there is already a batch being sent on a separate request.  You can wait a minute or two and try again.', 'event_espresso'),
921 921
 				__FILE__, __FUNCTION__, __LINE__
922 922
 			);
923 923
 		} else {
924 924
 			//can count how many sent by using the messages in the queue
925
-			$sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() );
926
-			if ( $sent_count > 0 ) {
925
+			$sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent());
926
+			if ($sent_count > 0) {
927 927
 				EE_Error::add_success(
928 928
 					sprintf(
929 929
 						_n(
@@ -938,8 +938,8 @@  discard block
 block discarded – undo
938 938
 			} else {
939 939
 				EE_Error::overwrite_errors();
940 940
 				EE_Error::add_error(
941
-					__( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
942
-					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ),
941
+					__('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error.
942
+					If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'),
943 943
 					__FILE__, __FUNCTION__, __LINE__
944 944
 				);
945 945
 			}
@@ -960,13 +960,13 @@  discard block
 block discarded – undo
960 960
 	 *
961 961
 	 * @return bool  true means messages were successfully queued for resending, false means none were queued for resending.
962 962
 	 */
963
-	public static function queue_for_resending( $message_ids ) {
963
+	public static function queue_for_resending($message_ids) {
964 964
 		self::_load_controller();
965
-		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids );
965
+		self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids);
966 966
 
967 967
 		//get queue and count
968
-		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend );
969
-		if ( $queue_count > 0 ) {
968
+		$queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend);
969
+		if ($queue_count > 0) {
970 970
 			EE_Error::add_success(
971 971
 				sprintf(
972 972
 					_n(
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 			);
981 981
 		} else {
982 982
 			EE_Error::add_error(
983
-				__( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ),
983
+				__('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'),
984 984
 				__FILE__, __FUNCTION__, __LINE__
985 985
 			);
986 986
 		}
@@ -1002,16 +1002,16 @@  discard block
 block discarded – undo
1002 1002
 	 * @param array $info
1003 1003
 	 * @param bool $display_request
1004 1004
 	 */
1005
-	protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) {
1006
-		if ( WP_DEBUG && false ) {
1007
-			if ( $transaction instanceof EE_Transaction ) {
1005
+	protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) {
1006
+		if (WP_DEBUG && false) {
1007
+			if ($transaction instanceof EE_Transaction) {
1008 1008
 				// don't serialize objects
1009
-				$info = EEH_Debug_Tools::strip_objects( $info );
1009
+				$info = EEH_Debug_Tools::strip_objects($info);
1010 1010
 				$info['TXN_status'] = $transaction->status_ID();
1011 1011
 				$info['TXN_reg_steps'] = $transaction->reg_steps();
1012
-				if ( $transaction->ID() ) {
1013
-					$index = 'EE_Transaction: ' . $transaction->ID();
1014
-					EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index );
1012
+				if ($transaction->ID()) {
1013
+					$index = 'EE_Transaction: '.$transaction->ID();
1014
+					EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index);
1015 1015
 				}
1016 1016
 			}
1017 1017
 		}
Please login to merge, or discard this patch.
reg_steps/payment_options/payment_options_main.template.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 
2 2
 	<h4 id="reg-page-totals-hdr" class="">
3
-		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?>
3
+		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?>
4 4
 	</h4>
5 5
 
6 6
 	<div class="spco-payment-info-dv">
7 7
 		<table id="spco-payment-info-table">
8 8
 			<thead>
9 9
 				<tr>
10
-					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th>
11
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th>
12
-					<th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th>
13
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th>
14
-					<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?>
10
+					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
11
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th>
12
+					<th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th>
13
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th>
14
+					<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?>
15 15
 				</tr>
16 16
 			</thead>
17 17
 			<tbody>
18
-			<?php echo $transaction_details;?>
19
-			<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?>
18
+			<?php echo $transaction_details; ?>
19
+			<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?>
20 20
 			</tbody>
21 21
 		</table>
22 22
 	</div>
23 23
 	<div class="clear-float"> </div>
24 24
 
25
-	<?php  echo $before_payment_options;  ?>
25
+	<?php  echo $before_payment_options; ?>
26 26
 
27 27
 	<div id="methods-of-payment">
28 28
 		<?php echo $payment_options; ?>
29
-		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters( 'FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __( 'select a different method of payment:', 'event_espresso' )); ?></a>
29
+		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters('FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __('select a different method of payment:', 'event_espresso')); ?></a>
30 30
 	</div>
31 31
 	<!-- end #methods-of-payment -->
32 32
 
33
-	<?php  echo $after_payment_options;  ?>
33
+	<?php  echo $after_payment_options; ?>
34 34
 
35
-	<?php  echo $default_hidden_inputs;  ?>
36
-	<?php  echo $extra_hidden_inputs;  ?>
35
+	<?php  echo $default_hidden_inputs; ?>
36
+	<?php  echo $extra_hidden_inputs; ?>
37 37
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php //echo '<h1>' . __FILE__ . '</h1>'; ?>
2 2
 <?php global $post; ?>
3 3
 <div class="venue-content">
4
-<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?>
4
+<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?>
5 5
 	<div class="entry-meta">
6
-		<span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span>
6
+		<span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span>
7 7
 		<?php
8
-			if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
8
+			if ( ! post_password_required() && (comments_open() || get_comments_number())) :
9 9
 		?>
10
-		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span>
10
+		<span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span>
11 11
 		<?php
12 12
 			endif;
13 13
 
14
-			edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
14
+			edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
15 15
 		?>
16 16
 	</div>
17 17
 <?php  endif; ?>
18 18
 	
19 19
 	<h3 class="event-venues-h3 ee-event-h3">
20
-		<?php _e( 'Details', 'event_espresso' ); ?>
20
+		<?php _e('Details', 'event_espresso'); ?>
21 21
 	</h3>
22 22
 
23
-	<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
23
+	<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
24 24
 	<p>
25
-		<span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo $venue_phone; ?>
25
+		<span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo $venue_phone; ?>
26 26
 	</p>
27 27
 	<?php endif; ?>
28
-	<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
28
+	<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
29 29
 	<p>
30
-		<span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo $venue_website; ?>
30
+		<span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo $venue_website; ?>
31 31
 	</p>
32 32
 	<?php endif; ?>
33 33
 	<?php 
34
-	do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); 
35
-	if ( is_archive() && has_excerpt( $post->ID )) {
34
+	do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); 
35
+	if (is_archive() && has_excerpt($post->ID)) {
36 36
 		the_excerpt();
37 37
 	} else {
38 38
 		the_content();
39 39
 	}
40
-	do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); 
40
+	do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); 
41 41
 	?>
42 42
 </div>
43 43
 <!-- .venue-content -->
Please login to merge, or discard this patch.
core/db_models/EEM_Post_Meta.model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * ------------------------------------------------------------------------
33 33
  */
34
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
34
+require_once (EE_MODELS.'EEM_Base.model.php');
35 35
 
36 36
 class EEM_Post_Meta extends EEM_Base {
37 37
 
38 38
   	// private instance of the EE_Post_Meta object
39 39
 	protected static $_instance = NULL;
40 40
 
41
-	protected function __construct( $timezone = NULL ) {
42
-		$this->singular_item = __('Post Meta','event_espresso');
43
-		$this->plural_item = __('Post Metas','event_espresso');
41
+	protected function __construct($timezone = NULL) {
42
+		$this->singular_item = __('Post Meta', 'event_espresso');
43
+		$this->plural_item = __('Post Metas', 'event_espresso');
44 44
 		$this->_tables = array(
45 45
 			'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id')
46 46
 		);
47
-		$models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() );
47
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
48 48
 		$this->_fields = array(
49 49
 			'Post_Meta'=>array(
50 50
 				'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")),
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 				'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true)
54 54
 			));
55 55
 		$this->_model_relations = array();
56
-		foreach($models_this_can_attach_to as $model){
56
+		foreach ($models_this_can_attach_to as $model) {
57 57
 			$this->_model_relations[$model] = new EE_Belongs_To_Relation();
58 58
 		}
59
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
60
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' );
59
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
60
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value');
61 61
 		}
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -944,7 +944,7 @@
 block discarded – undo
944 944
 	 * @access  private
945 945
 	 * @param  int $VNU_ID
946 946
 	 * @param  string $venue_status
947
-	 * @return void
947
+	 * @return boolean
948 948
 	 */
949 949
 	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
950 950
 		// grab venue id
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 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
@@ -893,8 +894,9 @@  discard block
 block discarded – undo
893 894
 		}
894 895
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
895 896
 
896
-		if ( $redirect_after )
897
-			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
897
+		if ( $redirect_after ) {
898
+					$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
899
+		}
898 900
 
899 901
 	}
900 902
 
@@ -1013,8 +1015,9 @@  discard block
 block discarded – undo
1013 1015
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1014 1016
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1015 1017
 		}
1016
-		if ( $redirect_after )
1017
-			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1018
+		if ( $redirect_after ) {
1019
+					$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1020
+		}
1018 1021
 	}
1019 1022
 
1020 1023
 
@@ -1185,8 +1188,10 @@  discard block
 block discarded – undo
1185 1188
 	 * @return void
1186 1189
 	 */
1187 1190
 	private function _set_category_object() {
1188
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1189
-			return; //already have the category object so get out.
1191
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
1192
+					return;
1193
+		}
1194
+		//already have the category object so get out.
1190 1195
 
1191 1196
 		//set default category object
1192 1197
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +238 added lines, -238 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
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 					'label' => __('Google Maps'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
380
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -582,115 +582,115 @@  discard block
 block discarded – undo
582 582
 		$default_map_settings = new stdClass();
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		// for event details pages (reg page)
585
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
586
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
587
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
588
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
589
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
590
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
591
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
585
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
586
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
587
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
588
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
589
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
590
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
591
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
592 592
 		// for event list pages
593
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
594
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
595
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
596
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
597
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
598
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
599
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
593
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
594
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
595
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
596
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
597
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
598
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
599
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
600 600
 
601 601
 		$this->_template_args['map_settings'] =
602
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
603
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
602
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
603
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
604 604
 				: $default_map_settings;
605 605
 
606
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
607
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
608
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
606
+		$this->_set_add_edit_form_tags('update_google_map_settings');
607
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
608
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
609 609
 		$this->display_admin_page_with_sidebar();
610 610
 	}
611 611
 
612 612
 	protected function _update_google_map_settings() {
613 613
 
614 614
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
615
-			isset( $this->_req_data['use_google_maps'] )
616
-				? absint( $this->_req_data['use_google_maps'] )
615
+			isset($this->_req_data['use_google_maps'])
616
+				? absint($this->_req_data['use_google_maps'])
617 617
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
620
-			isset( $this->_req_data['event_details_map_width'] )
621
-				? absint( $this->_req_data['event_details_map_width'] )
620
+			isset($this->_req_data['event_details_map_width'])
621
+				? absint($this->_req_data['event_details_map_width'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
625
-			isset( $this->_req_data['event_details_map_height'] )
626
-				? absint( $this->_req_data['event_details_map_height'] )
625
+			isset($this->_req_data['event_details_map_height'])
626
+				? absint($this->_req_data['event_details_map_height'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
630
-			isset( $this->_req_data['event_details_map_zoom'] )
631
-				? absint( $this->_req_data['event_details_map_zoom'] )
630
+			isset($this->_req_data['event_details_map_zoom'])
631
+				? absint($this->_req_data['event_details_map_zoom'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
635
-			isset( $this->_req_data['event_details_display_nav'] )
636
-				? absint( $this->_req_data['event_details_display_nav'] )
635
+			isset($this->_req_data['event_details_display_nav'])
636
+				? absint($this->_req_data['event_details_display_nav'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
640
-			isset( $this->_req_data['event_details_nav_size'] )
641
-				? absint( $this->_req_data['event_details_nav_size'] )
640
+			isset($this->_req_data['event_details_nav_size'])
641
+				? absint($this->_req_data['event_details_nav_size'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
645
-			isset( $this->_req_data['event_details_control_type'] )
646
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
645
+			isset($this->_req_data['event_details_control_type'])
646
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
650
-			isset( $this->_req_data['event_details_map_align'] )
651
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
650
+			isset($this->_req_data['event_details_map_align'])
651
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
655
-			isset( $this->_req_data['event_list_map_width'] )
656
-				? absint( $this->_req_data['event_list_map_width'] )
655
+			isset($this->_req_data['event_list_map_width'])
656
+				? absint($this->_req_data['event_list_map_width'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
660
-			isset( $this->_req_data['event_list_map_height'] )
661
-				? absint( $this->_req_data['event_list_map_height'] )
660
+			isset($this->_req_data['event_list_map_height'])
661
+				? absint($this->_req_data['event_list_map_height'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
665
-			isset( $this->_req_data['event_list_map_zoom'] )
666
-				? absint( $this->_req_data['event_list_map_zoom'] )
665
+			isset($this->_req_data['event_list_map_zoom'])
666
+				? absint($this->_req_data['event_list_map_zoom'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
670
-			isset( $this->_req_data['event_list_display_nav'] )
671
-				? absint( $this->_req_data['event_list_display_nav'] )
670
+			isset($this->_req_data['event_list_display_nav'])
671
+				? absint($this->_req_data['event_list_display_nav'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
675
-			isset( $this->_req_data['event_list_nav_size'] )
676
-				? absint( $this->_req_data['event_list_nav_size'] )
675
+			isset($this->_req_data['event_list_nav_size'])
676
+				? absint($this->_req_data['event_list_nav_size'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
680
-			isset( $this->_req_data['event_list_control_type'] )
681
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
680
+			isset($this->_req_data['event_list_control_type'])
681
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
685
-			isset( $this->_req_data['event_list_map_align'] )
686
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
685
+			isset($this->_req_data['event_list_map_align'])
686
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
688 688
 
689
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
689
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
690 690
 
691 691
 		$what = 'Google Map Settings';
692
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
693
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
692
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
693
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
694 694
 
695 695
 	}
696 696
 
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 	protected function _venue_editor_metaboxes() {
700 700
 		$this->verify_cpt_object();
701 701
 
702
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
703
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
704
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
702
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
703
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
704
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
705 705
 
706 706
 	}
707 707
 
@@ -709,23 +709,23 @@  discard block
 block discarded – undo
709 709
 
710 710
 	public function venue_gmap_metabox() {
711 711
 		$template_args = array(
712
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
712
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
713 713
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
714 714
 			);
715
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
716
-		EEH_Template::display_template( $template, $template_args );
715
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
716
+		EEH_Template::display_template($template, $template_args);
717 717
 	}
718 718
 
719 719
 
720 720
 
721 721
 	public function venue_address_metabox() {
722 722
 
723
-		$template_args['_venue'] =$this->_cpt_model_obj;
723
+		$template_args['_venue'] = $this->_cpt_model_obj;
724 724
 
725 725
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
726 726
 			$QFI = new EE_Question_Form_Input(
727
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
728
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
727
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
728
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
729 729
 				array(
730 730
 					'input_name' =>  'sta_id',
731 731
 					'input_id' => 'sta_id',
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 		);
738 738
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
739 739
 			$QFI = new EE_Question_Form_Input(
740
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
741
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
740
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
741
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
742 742
 				array(
743 743
 					'input_name' =>  'cnt_iso',
744 744
 					'input_id' => 'cnt_iso',
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 			)
750 750
 		);
751 751
 
752
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
753
-		EEH_Template::display_template( $template, $template_args );
752
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
753
+		EEH_Template::display_template($template, $template_args);
754 754
 	}
755 755
 
756 756
 
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 		$template_args = array(
763 763
 			'_venue' => $this->_cpt_model_obj
764 764
 			);
765
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
766
-		EEH_Template::display_template( $template, $template_args );
765
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
766
+		EEH_Template::display_template($template, $template_args);
767 767
 	}
768 768
 
769 769
 
@@ -786,52 +786,52 @@  discard block
 block discarded – undo
786 786
 	 * @param  object $post    Post object (with "blessed" WP properties)
787 787
 	 * @return void
788 788
 	 */
789
-	protected function _insert_update_cpt_item( $post_id, $post ) {
789
+	protected function _insert_update_cpt_item($post_id, $post) {
790 790
 
791
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
792
-			return;// get out we're not processing the saving of venues.
791
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
792
+			return; // get out we're not processing the saving of venues.
793 793
 		}
794 794
 
795
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
795
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
796 796
 
797 797
 		$venue_values = array(
798
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
799
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
800
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
801
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
802
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
803
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
804
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
805
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
806
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
807
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
810
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
798
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
799
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
800
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
801
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
802
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
803
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
804
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
805
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
806
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
807
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
810
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
811 811
 			);
812 812
 
813 813
 		//update venue
814
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
814
+		$success = $this->_venue_model->update($venue_values, array($wheres));
815 815
 
816 816
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
817
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
818
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
817
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
818
+		$venue = $this->_venue_model->get_one(array($get_one_where));
819 819
 
820 820
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
821
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
821
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
822 822
 
823 823
 		$att_success = TRUE;
824 824
 
825
-		foreach ( $venue_update_callbacks as $v_callback ) {
826
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
827
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
825
+		foreach ($venue_update_callbacks as $v_callback) {
826
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
827
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
828 828
 		}
829 829
 
830 830
 		//any errors?
831
-		if ( $success && !$att_success ) {
832
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
833
-		} else if ( $success === FALSE ) {
834
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
831
+		if ($success && ! $att_success) {
832
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
833
+		} else if ($success === FALSE) {
834
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
835 835
 		}
836 836
 	}
837 837
 
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
 
840 840
 
841 841
 
842
-	public function trash_cpt_item( $post_id ) {
842
+	public function trash_cpt_item($post_id) {
843 843
 		$this->_req_data['VNU_ID'] = $post_id;
844
-		$this->_trash_or_restore_venue( 'trash', FALSE );
844
+		$this->_trash_or_restore_venue('trash', FALSE);
845 845
 	}
846 846
 
847 847
 
@@ -849,18 +849,18 @@  discard block
 block discarded – undo
849 849
 
850 850
 
851 851
 
852
-	public function restore_cpt_item( $post_id ) {
852
+	public function restore_cpt_item($post_id) {
853 853
 		$this->_req_data['VNU_ID'] = $post_id;
854
-		$this->_trash_or_restore_venue( 'draft', FALSE );
854
+		$this->_trash_or_restore_venue('draft', FALSE);
855 855
 	}
856 856
 
857 857
 
858 858
 
859 859
 
860 860
 
861
-	public function delete_cpt_item( $post_id ) {
861
+	public function delete_cpt_item($post_id) {
862 862
 		$this->_req_data['VNU_ID'] = $post_id;
863
-		$this->_delete_venue( FALSE );
863
+		$this->_delete_venue(FALSE);
864 864
 	}
865 865
 
866 866
 
@@ -875,15 +875,15 @@  discard block
 block discarded – undo
875 875
 
876 876
 
877 877
 
878
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
879
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
878
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
879
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
880 880
 
881 881
 		//loop thru venues
882
-		if ( $VNU_ID ) {
882
+		if ($VNU_ID) {
883 883
 			//clean status
884
-			$venue_status = sanitize_key( $venue_status );
884
+			$venue_status = sanitize_key($venue_status);
885 885
 			// grab status
886
-			if (!empty($venue_status)) {
886
+			if ( ! empty($venue_status)) {
887 887
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
888 888
 			} else {
889 889
 				$success = FALSE;
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		}
898 898
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
899 899
 
900
-		if ( $redirect_after )
900
+		if ($redirect_after)
901 901
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
902 902
 
903 903
 	}
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
 
907 907
 
908 908
 
909
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
909
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
910 910
 		// clean status
911 911
 		$venue_status = sanitize_key($venue_status);
912 912
 		// grab status
913
-		if (!empty($venue_status)) {
913
+		if ( ! empty($venue_status)) {
914 914
 			$success = TRUE;
915 915
 			//determine the event id and set to array.
916 916
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -950,20 +950,20 @@  discard block
 block discarded – undo
950 950
 	 * @param  string $venue_status
951 951
 	 * @return void
952 952
 	 */
953
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
953
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
954 954
 		// grab venue id
955
-		if (! $VNU_ID) {
955
+		if ( ! $VNU_ID) {
956 956
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
957 957
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
958 958
 			return FALSE;
959 959
 		}
960 960
 
961
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
961
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
962 962
 
963 963
 		// clean status
964 964
 		$venue_status = sanitize_key($venue_status);
965 965
 		// grab status
966
-		if ( ! $venue_status ) {
966
+		if ( ! $venue_status) {
967 967
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
968 968
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
969 969
 			return FALSE;
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				$hook = FALSE;
985 985
 		}
986 986
 		//use class to change status
987
-		$this->_cpt_model_obj->set_status( $venue_status );
987
+		$this->_cpt_model_obj->set_status($venue_status);
988 988
 		$success = $this->_cpt_model_obj->save();
989 989
 
990 990
 		if ($success === FALSE) {
@@ -1003,21 +1003,21 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  bool $redirect_after
1004 1004
 	 * @return void
1005 1005
 	 */
1006
-	protected function _delete_venue( $redirect_after = true ) {
1006
+	protected function _delete_venue($redirect_after = true) {
1007 1007
 		//determine the venue id and set to array.
1008 1008
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1009
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1009
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1010 1010
 
1011 1011
 
1012 1012
 		// loop thru venues
1013 1013
 		if ($VNU_ID) {
1014
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1014
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1015 1015
 		} else {
1016 1016
 			$success = FALSE;
1017 1017
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1018 1018
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1019 1019
 		}
1020
-		if ( $redirect_after )
1020
+		if ($redirect_after)
1021 1021
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1022 1022
 	}
1023 1023
 
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	//todo: put in parent
1050 1050
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1051 1051
 		// grab event id
1052
-		if (!$VNU_ID = absint($VNU_ID)) {
1052
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1053 1053
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1054 1054
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1055 1055
 			return FALSE;
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1070 1070
 			return FALSE;
1071 1071
 		}
1072
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1072
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1073 1073
 		return TRUE;
1074 1074
 	}
1075 1075
 
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 	/* QUERIES */
1081 1081
 
1082 1082
 
1083
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1083
+	public function get_venues($per_page = 10, $count = FALSE) {
1084 1084
 
1085
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1085
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1086 1086
 
1087
-		switch ( $_orderby ) {
1087
+		switch ($_orderby) {
1088 1088
 			case 'id':
1089 1089
 				$orderby = 'VNU_ID';
1090 1090
 				break;
@@ -1102,43 +1102,43 @@  discard block
 block discarded – undo
1102 1102
 		}
1103 1103
 
1104 1104
 
1105
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1105
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1106 1106
 
1107
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1108
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1109
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1107
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1108
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1109
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1110 1110
 
1111 1111
 
1112
-		$offset = ($current_page-1)*$per_page;
1112
+		$offset = ($current_page - 1) * $per_page;
1113 1113
 		$limit = array($offset, $per_page);
1114 1114
 
1115
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1115
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1116 1116
 		$where = array();
1117 1117
 
1118 1118
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1119
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1119
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1120 1120
 			$where['status'] = $this->_req_data['status'];
1121 1121
 		}
1122 1122
 
1123
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1123
+		if (isset($this->_req_data['venue_status'])) {
1124 1124
 			$where['status'] = $this->_req_data['venue_status'];
1125 1125
 		}
1126 1126
 
1127 1127
 
1128
-		if ( $category ) {
1128
+		if ($category) {
1129 1129
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1130 1130
 			$where['Term_Taxonomy.term_id'] = $category;
1131 1131
 		}
1132 1132
 
1133 1133
 
1134
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1135
-			$where['VNU_wp_user'] =  get_current_user_id();
1134
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1135
+			$where['VNU_wp_user'] = get_current_user_id();
1136 1136
 		} else {
1137
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1137
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1138 1138
 					$where['OR'] = array(
1139
-						'status*restrict_private' => array( '!=', 'private' ),
1139
+						'status*restrict_private' => array('!=', 'private'),
1140 1140
 						'AND'                     => array(
1141
-							'status*inclusive' => array( '=', 'private' ),
1141
+							'status*inclusive' => array('=', 'private'),
1142 1142
 							'VNU_wp_user'      => get_current_user_id()
1143 1143
 						)
1144 1144
 					);
@@ -1148,30 +1148,30 @@  discard block
 block discarded – undo
1148 1148
 
1149 1149
 
1150 1150
 
1151
-		if ( isset( $this->_req_data['s'] ) ) {
1152
-			$sstr = '%' . $this->_req_data['s'] . '%';
1151
+		if (isset($this->_req_data['s'])) {
1152
+			$sstr = '%'.$this->_req_data['s'].'%';
1153 1153
 			$where['OR'] = array(
1154
-				'VNU_name' => array('LIKE',$sstr ),
1155
-				'VNU_desc' => array('LIKE',$sstr ),
1156
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1157
-				'VNU_address' => array( 'LIKE', $sstr ),
1158
-				'VNU_address2' => array( 'LIKE', $sstr ),
1159
-				'VNU_city' => array( 'LIKE', $sstr ),
1160
-				'VNU_zip' => array( 'LIKE', $sstr ),
1161
-				'VNU_phone' => array( 'LIKE', $sstr ),
1162
-				'VNU_url' => array( 'LIKE', $sstr ),
1163
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1164
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1165
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1166
-				'Event.EVT_name' => array('LIKE', $sstr ),
1167
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1168
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1169
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1154
+				'VNU_name' => array('LIKE', $sstr),
1155
+				'VNU_desc' => array('LIKE', $sstr),
1156
+				'VNU_short_desc' => array('LIKE', $sstr),
1157
+				'VNU_address' => array('LIKE', $sstr),
1158
+				'VNU_address2' => array('LIKE', $sstr),
1159
+				'VNU_city' => array('LIKE', $sstr),
1160
+				'VNU_zip' => array('LIKE', $sstr),
1161
+				'VNU_phone' => array('LIKE', $sstr),
1162
+				'VNU_url' => array('LIKE', $sstr),
1163
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1164
+				'VNU_virtual_url' => array('LIKE', $sstr),
1165
+				'VNU_google_map_link' => array('LIKE', $sstr),
1166
+				'Event.EVT_name' => array('LIKE', $sstr),
1167
+				'Event.EVT_desc' => array('LIKE', $sstr),
1168
+				'Event.EVT_phone' => array('LIKE', $sstr),
1169
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1170 1170
 				);
1171 1171
 		}
1172 1172
 
1173 1173
 
1174
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1174
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1175 1175
 
1176 1176
 		return $venues;
1177 1177
 
@@ -1189,22 +1189,22 @@  discard block
 block discarded – undo
1189 1189
 	 * @return void
1190 1190
 	 */
1191 1191
 	private function _set_category_object() {
1192
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1192
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1193 1193
 			return; //already have the category object so get out.
1194 1194
 
1195 1195
 		//set default category object
1196 1196
 		$this->_set_empty_category_object();
1197 1197
 
1198 1198
 		//only set if we've got an id
1199
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1199
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1200 1200
 			return;
1201 1201
 		}
1202 1202
 
1203 1203
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1204
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1204
+		$term = get_term($category_id, 'espresso_venue_categories');
1205 1205
 
1206 1206
 
1207
-		if ( !empty( $term ) ) {
1207
+		if ( ! empty($term)) {
1208 1208
 			$this->_category->category_name = $term->name;
1209 1209
 			$this->_category->category_identifier = $term->slug;
1210 1210
 			$this->_category->category_desc = $term->description;
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 
1219 1219
 	private function _set_empty_category_object() {
1220 1220
 		$this->_category = new stdClass();
1221
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1221
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1222 1222
 		$this->_category->id = $this->_category->parent = 0;
1223 1223
 	}
1224 1224
 
1225 1225
 
1226 1226
 
1227 1227
 	protected function _category_list_table() {
1228
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1228
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1229 1229
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1230 1230
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1231 1231
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1241,13 +1241,13 @@  discard block
 block discarded – undo
1241 1241
 		$this->_set_add_edit_form_tags($route);
1242 1242
 
1243 1243
 		$this->_set_category_object();
1244
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1244
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1245 1245
 
1246 1246
 		$delete_action = 'delete_category';
1247 1247
 
1248
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1248
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1249 1249
 
1250
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1250
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1251 1251
 
1252 1252
 		//take care of contents
1253 1253
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1261,25 +1261,25 @@  discard block
 block discarded – undo
1261 1261
 			'type' => 'wp_editor',
1262 1262
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1263 1263
 			'class' => 'my_editor_custom',
1264
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1264
+			'wpeditor_args' => array('media_buttons' => FALSE)
1265 1265
 		);
1266
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1266
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1267 1267
 
1268
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1268
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1269 1269
 
1270 1270
 		//setup category select for term parents.
1271 1271
 		$category_select_values[] = array(
1272 1272
 			'text' => __('No Parent', 'event_espresso'),
1273 1273
 			'id' => 0
1274 1274
 			);
1275
-		foreach ( $all_terms as $term ) {
1275
+		foreach ($all_terms as $term) {
1276 1276
 			$category_select_values[] = array(
1277 1277
 				'text' => $term->name,
1278 1278
 				'id' => $term->term_id
1279 1279
 				);
1280 1280
 		}
1281 1281
 
1282
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1282
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1283 1283
 		$template_args = array(
1284 1284
 			'category' => $this->_category,
1285 1285
 			'category_select' => $category_select,
@@ -1288,15 +1288,15 @@  discard block
 block discarded – undo
1288 1288
 			'disable' => '',
1289 1289
 			'disabled_message' =>FALSE
1290 1290
 			);
1291
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1292
-		return EEH_Template::display_template($template, $template_args, TRUE );
1291
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1292
+		return EEH_Template::display_template($template, $template_args, TRUE);
1293 1293
 	}
1294 1294
 
1295 1295
 
1296 1296
 	protected function _delete_categories() {
1297
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1297
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1298 1298
 
1299
-		foreach ( $cat_ids as $cat_id ) {
1299
+		foreach ($cat_ids as $cat_id) {
1300 1300
 			$this->_delete_category($cat_id);
1301 1301
 		}
1302 1302
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 		$query_args = array(
1305 1305
 			'action' => 'category_list'
1306 1306
 			);
1307
-		$this->_redirect_after_action(0,'','',$query_args);
1307
+		$this->_redirect_after_action(0, '', '', $query_args);
1308 1308
 
1309 1309
 	}
1310 1310
 
@@ -1313,58 +1313,58 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
 
1315 1315
 	protected function _delete_category($cat_id) {
1316
-		$cat_id = absint( $cat_id );
1317
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1316
+		$cat_id = absint($cat_id);
1317
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1318 1318
 	}
1319 1319
 
1320 1320
 
1321 1321
 
1322 1322
 	protected function _insert_or_update_category($new_category) {
1323 1323
 
1324
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1324
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1325 1325
 		$success = 0; //we already have a success message so lets not send another.
1326
-		if ( $cat_id ) {
1326
+		if ($cat_id) {
1327 1327
 			$query_args = array(
1328 1328
 				'action'     => 'edit_category',
1329 1329
 				'VEN_CAT_ID' => $cat_id
1330 1330
 			);
1331 1331
 		} else {
1332
-			$query_args = array( 'action' => 'add_category' );
1332
+			$query_args = array('action' => 'add_category');
1333 1333
 		}
1334
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1334
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1335 1335
 
1336 1336
 	}
1337 1337
 
1338 1338
 
1339 1339
 
1340
-	private function _insert_category( $update = FALSE ) {
1340
+	private function _insert_category($update = FALSE) {
1341 1341
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1342
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1343
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1344
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1342
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1343
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1344
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1345 1345
 
1346
-		if ( empty( $category_name ) ) {
1347
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1348
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1346
+		if (empty($category_name)) {
1347
+			$msg = __('You must add a name for the category.', 'event_espresso');
1348
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1349 1349
 			return false;
1350 1350
 		}
1351 1351
 
1352 1352
 
1353
-		$term_args=array(
1353
+		$term_args = array(
1354 1354
 			'name'=>$category_name,
1355 1355
 			'description'=>$category_desc,
1356 1356
 			'parent'=>$category_parent
1357 1357
 		);
1358 1358
 
1359
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1359
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1360 1360
 
1361
-		if ( !is_array( $insert_ids ) ) {
1362
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1363
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1361
+		if ( ! is_array($insert_ids)) {
1362
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1363
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1364 1364
 		} else {
1365 1365
 			$cat_id = $insert_ids['term_id'];
1366
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1367
-			EE_Error::add_success( $msg );
1366
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1367
+			EE_Error::add_success($msg);
1368 1368
 		}
1369 1369
 
1370 1370
 		return $cat_id;
@@ -1384,11 +1384,11 @@  discard block
 block discarded – undo
1384 1384
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1385 1385
 			);
1386 1386
 
1387
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1387
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1388 1388
 
1389
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1390
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1391
-			$EE_Export = EE_Export::instance( $this->_req_data );
1389
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1390
+			require_once(EE_CLASSES.'EE_Export.class.php');
1391
+			$EE_Export = EE_Export::instance($this->_req_data);
1392 1392
 			$EE_Export->export();
1393 1393
 		}
1394 1394
 
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 	protected function _import_categories() {
1402 1402
 
1403
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1403
+		require_once(EE_CLASSES.'EE_Import.class.php');
1404 1404
 		EE_Import::instance()->import();
1405 1405
 
1406 1406
 	}
@@ -1408,29 +1408,29 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
 
1410 1410
 
1411
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1411
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1412 1412
 
1413 1413
 		//testing term stuff
1414
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1416
-		$limit = ($current_page-1)*$per_page;
1417
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1418
-		if ( isset( $this->_req_data['s'] ) ) {
1419
-			$sstr = '%' . $this->_req_data['s'] . '%';
1414
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1416
+		$limit = ($current_page - 1) * $per_page;
1417
+		$where = array('taxonomy' => 'espresso_venue_categories');
1418
+		if (isset($this->_req_data['s'])) {
1419
+			$sstr = '%'.$this->_req_data['s'].'%';
1420 1420
 			$where['OR'] = array(
1421
-				'Term.name' => array( 'LIKE', $sstr),
1422
-				'description' => array( 'LIKE', $sstr )
1421
+				'Term.name' => array('LIKE', $sstr),
1422
+				'description' => array('LIKE', $sstr)
1423 1423
 				);
1424 1424
 		}
1425 1425
 
1426 1426
 		$query_params = array(
1427 1427
 			$where,
1428
-			'order_by' => array( $orderby => $order ),
1429
-			'limit' => $limit . ',' . $per_page,
1428
+			'order_by' => array($orderby => $order),
1429
+			'limit' => $limit.','.$per_page,
1430 1430
 			'force_join' => array('Term')
1431 1431
 			);
1432 1432
 
1433
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1433
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1434 1434
 
1435 1435
 		return $categories;
1436 1436
 	}
Please login to merge, or discard this patch.