Completed
Branch FET-7988-evertec-needs (20e248)
by
unknown
824:36 queued 813:30
created
caffeinated/admin/new/pricing/Pricing_Admin_Page_Init.core.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 *
24 24
 * ------------------------------------------------------------------------
25 25
 */
26
-class Pricing_Admin_Page_Init extends EE_Admin_Page_Init  {
26
+class Pricing_Admin_Page_Init extends EE_Admin_Page_Init {
27 27
 
28 28
 
29 29
 
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function __construct() {
38 38
 
39
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
39
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
40 40
 
41
-		define( 'PRICING_PG_SLUG', 'pricing' );
42
-		define( 'PRICING_LABEL', __('Pricing', 'event_espresso'));
43
-		define( 'PRICING_PG_NAME', ucwords( str_replace( '_', '', PRICING_PG_SLUG )));
44
-		define( 'PRICING_ADMIN', EE_CORE_CAF_ADMIN . 'new' . DS . PRICING_PG_SLUG . DS );
45
-		define( 'PRICING_ADMIN_URL', admin_url( 'admin.php?page=' . PRICING_PG_SLUG ));
46
-		define( 'PRICING_ASSETS_PATH', PRICING_ADMIN . 'assets' . DS );
47
-		define( 'PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . PRICING_PG_SLUG .'/assets/' );
48
-		define( 'PRICING_TEMPLATE_PATH', PRICING_ADMIN . 'templates' . DS );
49
-		define( 'PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . PRICING_PG_SLUG . DS . 'templates/' );
41
+		define('PRICING_PG_SLUG', 'pricing');
42
+		define('PRICING_LABEL', __('Pricing', 'event_espresso'));
43
+		define('PRICING_PG_NAME', ucwords(str_replace('_', '', PRICING_PG_SLUG)));
44
+		define('PRICING_ADMIN', EE_CORE_CAF_ADMIN.'new'.DS.PRICING_PG_SLUG.DS);
45
+		define('PRICING_ADMIN_URL', admin_url('admin.php?page='.PRICING_PG_SLUG));
46
+		define('PRICING_ASSETS_PATH', PRICING_ADMIN.'assets'.DS);
47
+		define('PRICING_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.PRICING_PG_SLUG.'/assets/');
48
+		define('PRICING_TEMPLATE_PATH', PRICING_ADMIN.'templates'.DS);
49
+		define('PRICING_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.PRICING_PG_SLUG.DS.'templates/');
50 50
 
51 51
 		parent::__construct();
52
-		$this->_folder_path = EE_CORE_CAF_ADMIN . 'new' . DS . $this->_folder_name . DS;
52
+		$this->_folder_path = EE_CORE_CAF_ADMIN.'new'.DS.$this->_folder_name.DS;
53 53
 
54 54
 	}
55 55
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 	protected function _set_menu_map() {
67
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
67
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
68 68
 			'menu_group' => 'management',
69 69
 			'menu_order' => 20,
70 70
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
Please login to merge, or discard this patch.
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.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Braces   +30 added lines, -19 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
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 
167 168
 	public function caf_updates( $update_callbacks ) {
168 169
 		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
170
+			if ( $callback[1] == '_default_tickets_update' ) {
171
+							unset( $update_callbacks[$key] );
172
+			}
171 173
 		}
172 174
 
173 175
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -268,8 +270,9 @@  discard block
 block discarded – undo
268 270
 			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269 271
 			foreach ( $dtts_to_delete as $id ) {
270 272
 				$id = absint( $id );
271
-				if ( empty( $id ) )
272
-					continue;
273
+				if ( empty( $id ) ) {
274
+									continue;
275
+				}
273 276
 
274 277
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 278
 
@@ -507,8 +510,9 @@  discard block
 block discarded – undo
507 510
 				}
508 511
 
509 512
 				//if we have a new_tkt... let's add to it as well
510
-				if ( !empty( $new_tkt ) )
511
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
513
+				if ( !empty( $new_tkt ) ) {
514
+									$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
515
+				}
512 516
 			}
513 517
 
514 518
 
@@ -518,8 +522,9 @@  discard block
 block discarded – undo
518 522
 			foreach ( $dtts_removed as $dttrow ) {
519 523
 				$dttrow = (int) $dttrow;
520 524
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
521
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
522
-					continue;
525
+				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) {
526
+									continue;
527
+				}
523 528
 
524 529
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
525 530
 
@@ -529,8 +534,9 @@  discard block
 block discarded – undo
529 534
 					$saved_dtts[$dttrow]->save();
530 535
 				}
531 536
 
532
-				if ( !empty( $new_tkt ) )
533
-					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
537
+				if ( !empty( $new_tkt ) ) {
538
+									$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
539
+				}
534 540
 			}
535 541
 
536 542
 
@@ -572,8 +578,9 @@  discard block
 block discarded – undo
572 578
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
573 579
 
574 580
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
575
-			if ( $tkt_to_remove->get('TKT_is_default') )
576
-				continue;
581
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
582
+							continue;
583
+			}
577 584
 
578 585
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
579 586
 			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
@@ -634,13 +641,16 @@  discard block
 block discarded – undo
634 641
 		}
635 642
 
636 643
 		//possibly need to save tkt
637
-		if ( ! $ticket->ID() )
638
-			$ticket->save();
644
+		if ( ! $ticket->ID() ) {
645
+					$ticket->save();
646
+		}
639 647
 
640 648
 		foreach ( $prices as $row => $prc ) {
641 649
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
642
-			if ( empty($prt_id) )
643
-				continue; //prices MUST have a price type id.
650
+			if ( empty($prt_id) ) {
651
+							continue;
652
+			}
653
+			//prices MUST have a price type id.
644 654
 			$PRC_values = array(
645 655
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
646 656
 				'PRT_ID' => $prt_id,
@@ -784,8 +794,9 @@  discard block
 block discarded – undo
784 794
 				$datetime_tickets[$dttid][] = $tktrow;
785 795
 
786 796
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
787
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
788
-					$ticket_datetimes[$tktid][] = $dttrow;
797
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
798
+									$ticket_datetimes[$tktid][] = $dttrow;
799
+				}
789 800
 			}
790 801
 		}
791 802
 
Please login to merge, or discard this patch.
Doc Comments   +20 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
130 130
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
131 131
 	 * @param  array    $data   The request data from the form
132
-	 * @return bool             success or fail
132
+	 * @return boolean|null             success or fail
133 133
 	 */
134 134
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
135 135
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @param  EE_Event         $evtobj     Event object being updated
233 233
 	 * @param  EE_Datetime[]    $saved_dtts an array of datetime ids being updated
234 234
 	 * @param  array            $data       incoming request data
235
-	 * @return bool                 		success or fail
235
+	 * @return boolean|null                 		success or fail
236 236
 	 */
237 237
 	private function _update_tkts( $evtobj, $saved_dtts, $data ) {
238 238
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
521 521
 	 * @param int|bool 		$base_price if FALSE then NOT doing a base price add.
522 522
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
523
-	 * @return  void
523
+	 * @return  EE_Ticket
524 524
 	 */
525 525
 	private function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
526 526
 
@@ -732,6 +732,9 @@  discard block
 block discarded – undo
732 732
 
733 733
 
734 734
 
735
+	/**
736
+	 * @param integer $dttrow
737
+	 */
735 738
 	private function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
736 739
 
737 740
 		$dtt_display_template_args = array(
@@ -745,6 +748,10 @@  discard block
 block discarded – undo
745 748
 
746 749
 
747 750
 
751
+	/**
752
+	 * @param EE_Datetime|null $dtt
753
+	 * @param boolean $default
754
+	 */
748 755
 	private function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
749 756
 
750 757
 		$template_args = array(
@@ -773,6 +780,10 @@  discard block
 block discarded – undo
773 780
 	}
774 781
 
775 782
 
783
+	/**
784
+	 * @param EE_Datetime|null $dtt
785
+	 * @param boolean $default
786
+	 */
776 787
 	private function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
777 788
 
778 789
 		$template_args = array(
@@ -977,6 +988,9 @@  discard block
 block discarded – undo
977 988
 
978 989
 
979 990
 
991
+	/**
992
+	 * @param boolean $default
993
+	 */
980 994
 	private function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
981 995
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
982 996
 		$template_args = array(
@@ -1083,6 +1097,9 @@  discard block
 block discarded – undo
1083 1097
 
1084 1098
 
1085 1099
 
1100
+	/**
1101
+	 * @param boolean $default
1102
+	 */
1086 1103
 	private function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1087 1104
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1088 1105
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Spacing   +328 added lines, -328 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
 /**
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 		$this->_name = 'pricing';
41 41
 
42 42
 		//capability check
43
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
43
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
44 44
 			return;
45 45
 		}
46 46
 
47 47
 		//if we were going to add our own metaboxes we'd use the below.
48 48
 		$this->_metaboxes = array(
49 49
 			0 => array(
50
-				'page_route' => array('edit','create_new'),
50
+				'page_route' => array('edit', 'create_new'),
51 51
 				'func' => 'pricing_metabox',
52 52
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
53 53
 				'priority' => 'high',
54 54
 				'context' => 'normal'
55 55
 				),
56 56
 
57
-			);/**/
57
+			); /**/
58 58
 
59 59
 		$this->_remove_metaboxes = array(
60 60
 			0 => array(
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
 		$this->_scripts_styles = array(
68 68
 			'registers' => array(
69 69
 				'ee-tickets-datetimes-css' => array(
70
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
70
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
71 71
 					'type' => 'css'
72 72
 					),
73 73
 				'ee-dtt-ticket-metabox' => array(
74
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
74
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
75 75
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
76 76
 					)
77 77
 				),
78 78
 			'deregisters' => array(
79
-				'event-editor-css' => array('type' => 'css' ),
79
+				'event-editor-css' => array('type' => 'css'),
80 80
 				'event-datetime-metabox' => array('type' => 'js')
81 81
 				),
82 82
 			'enqueues' => array(
83
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
84
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
83
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
84
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
85 85
 				),
86 86
 			'localize' => array(
87 87
 				'ee-dtt-ticket-metabox' => array(
88 88
 					'DTT_TRASH_BLOCK' => array(
89 89
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
90 90
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
91
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
91
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
92 92
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
93 93
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
94
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
94
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
95 95
 						),
96 96
 					'DTT_ERROR_MSG' => array(
97 97
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
98
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
98
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
99 99
 						),
100 100
 					'DTT_OVERSELL_WARNING' => array(
101 101
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
 			);
107 107
 
108 108
 
109
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
110
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
109
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
110
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
111 111
 	}
112 112
 
113 113
 
114 114
 
115
-	public function caf_updates( $update_callbacks ) {
116
-		foreach ( $update_callbacks as $key => $callback ) {
117
-			if ( $callback[1] == '_default_tickets_update' )
118
-				unset( $update_callbacks[$key] );
115
+	public function caf_updates($update_callbacks) {
116
+		foreach ($update_callbacks as $key => $callback) {
117
+			if ($callback[1] == '_default_tickets_update')
118
+				unset($update_callbacks[$key]);
119 119
 		}
120 120
 
121
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
121
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
122 122
 		return $update_callbacks;
123 123
 	}
124 124
 
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 * @param  array    $data   The request data from the form
132 132
 	 * @return bool             success or fail
133 133
 	 */
134
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
134
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
135 135
 		//first we need to start with datetimes cause they are the "root" items attached to events.
136
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
136
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
137 137
 		//next tackle the tickets (and prices?)
138
-		$success = $this->_update_tkts( $evtobj, $saved_dtts, $data );
138
+		$success = $this->_update_tkts($evtobj, $saved_dtts, $data);
139 139
 	}
140 140
 
141 141
 
@@ -146,76 +146,76 @@  discard block
 block discarded – undo
146 146
 	 * @param  array    	$data    the request data from the form
147 147
 	 * @return EE_Datetime           array of EE_Datetime ids created/updated.
148 148
 	 */
149
-	private function _update_dtts( $evt_obj, $data ) {
150
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
149
+	private function _update_dtts($evt_obj, $data) {
150
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
151 151
 		$success = TRUE;
152 152
 
153
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
154
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
153
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
154
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
155 155
 			$datetime_values = array(
156
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
157
-				'DTT_name' => !empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
158
-				'DTT_description' => !empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
156
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
157
+				'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
158
+				'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
159 159
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
160 160
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
161
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
162
-				'DTT_order' => !isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
161
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
162
+				'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
163 163
 				);
164 164
 
165 165
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
166 166
 
167
-			if ( !empty( $dtt['DTT_ID'] ) ) {
168
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
169
-				foreach ( $datetime_values as $field => $value ) {
170
-					$DTM->set( $field, $value );
167
+			if ( ! empty($dtt['DTT_ID'])) {
168
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
169
+				foreach ($datetime_values as $field => $value) {
170
+					$DTM->set($field, $value);
171 171
 				}
172 172
 
173 173
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
174 174
 				$saved_dtts[$DTM->ID()] = $DTM;
175 175
 			} else {
176
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
176
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
177 177
 			}
178 178
 
179 179
 			$DTM->save();
180
-			$DTT = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
180
+			$DTT = $evt_obj->_add_relation_to($DTM, 'Datetime');
181 181
 
182 182
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
183
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
184
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
183
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
184
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
185 185
 				EE_Registry::instance()->load_helper('DTT_Helper');
186 186
 				EE_Registry::instance()->load_helper('DTT_Helper');
187 187
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
188 188
 				$DTT->save();
189 189
 			}
190
-			$datetimes_start_times[$DTT->start_date_and_time('Y-m-d','H:i:s')] = $DTT->ID();
190
+			$datetimes_start_times[$DTT->start_date_and_time('Y-m-d', 'H:i:s')] = $DTT->ID();
191 191
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
192 192
 			$saved_dtts[$DTT->ID()] = $DTT;
193 193
 			$saved_dtt_objs[$row] = $DTT;
194 194
 
195
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
195
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
196 196
 		}
197 197
 
198 198
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
199
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
199
+		$old_datetimes = explode(',', $data['datetime_IDs']);
200 200
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
201 201
 
202
-		if ( is_array( $old_datetimes ) ) {
203
-			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
204
-			foreach ( $dtts_to_delete as $id ) {
205
-				$id = absint( $id );
206
-				if ( empty( $id ) )
202
+		if (is_array($old_datetimes)) {
203
+			$dtts_to_delete = array_diff($old_datetimes, array_keys($saved_dtts));
204
+			foreach ($dtts_to_delete as $id) {
205
+				$id = absint($id);
206
+				if (empty($id))
207 207
 					continue;
208 208
 
209 209
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
210 210
 
211 211
 				//remove tkt relationships.
212 212
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
213
-				foreach ( $related_tickets as $tkt ) {
213
+				foreach ($related_tickets as $tkt) {
214 214
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
215 215
 				}
216 216
 
217 217
 
218
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
218
+				$evt_obj->_remove_relation_to($id, 'Datetime');
219 219
 			}
220 220
 		}
221 221
 
@@ -234,63 +234,63 @@  discard block
 block discarded – undo
234 234
 	 * @param  array            $data       incoming request data
235 235
 	 * @return bool                 		success or fail
236 236
 	 */
237
-	private function _update_tkts( $evtobj, $saved_dtts, $data ) {
237
+	private function _update_tkts($evtobj, $saved_dtts, $data) {
238 238
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
239 239
 		$data = stripslashes_deep($data);
240
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
240
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
241 241
 		$success = TRUE;
242 242
 		$saved_tickets = $dtts_on_existing = array();
243
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
243
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
244 244
 
245 245
 		//load money helper
246
-		EE_Registry::instance()->load_helper( 'Money' );
246
+		EE_Registry::instance()->load_helper('Money');
247 247
 
248
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
248
+		foreach ($data['edit_tickets'] as $row => $tkt) {
249 249
 
250 250
 			$update_prices = $create_new_TKT = $ticket_sold = FALSE;
251 251
 			$new_default = $new_tkt = NULL;
252 252
 
253 253
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
254 254
 
255
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
256
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
255
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
256
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
257 257
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
258 258
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
259 259
 
260 260
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
261 261
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
262
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
262
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
263 263
 
264 264
 			//note incoming base price needs converted from localized value.
265
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
265
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
266 266
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
267 267
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
268
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
268
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
269 269
 
270 270
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
271 271
 
272 272
 			$TKT_values = array(
273
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
274
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
275
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
276
-				'TKT_description' => !empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
277
-				'TKT_start_date' => isset( $tkt['TKT_start_date'] ) ? $tkt['TKT_start_date'] : current_time('mysql'),
278
-				'TKT_end_date' => isset( $tkt['TKT_end_date'] ) ? $tkt['TKT_end_date'] : current_time('mysql'),
279
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
280
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
281
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
282
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
273
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
274
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
275
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
276
+				'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
277
+				'TKT_start_date' => isset($tkt['TKT_start_date']) ? $tkt['TKT_start_date'] : current_time('mysql'),
278
+				'TKT_end_date' => isset($tkt['TKT_end_date']) ? $tkt['TKT_end_date'] : current_time('mysql'),
279
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
280
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
281
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
282
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
283 283
 				'TKT_row' => $row,
284
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
285
-				'TKT_taxable' => !empty( $tkt['TKT_taxable'] ) ? 1 : 0,
286
-				'TKT_required' => !empty( $tkt['TKT_required'] ) ? 1 : 0,
284
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
285
+				'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0,
286
+				'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0,
287 287
 				'TKT_price' => $ticket_price
288 288
 				);
289 289
 
290 290
 
291 291
 
292 292
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
293
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
293
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
294 294
 				$TKT_values['TKT_ID'] = 0;
295 295
 				$TKT_values['TKT_is_default'] = 0;
296 296
 				$update_prices = TRUE;
@@ -300,25 +300,25 @@  discard block
 block discarded – undo
300 300
 			//we actually do our saves ahead of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
301 301
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
302 302
 
303
-			if ( !empty( $TKT_values['TKT_ID'] ) ) {
304
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
303
+			if ( ! empty($TKT_values['TKT_ID'])) {
304
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
305 305
 
306
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
306
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
307 307
 
308 308
 				//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
309 309
 				$orig_price = $TKT->price();
310
-				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
310
+				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
311 311
 
312 312
 				//set new values
313
-				foreach ( $TKT_values as $field => $value ) {
314
-					$TKT->set( $field, $value );
313
+				foreach ($TKT_values as $field => $value) {
314
+					$TKT->set($field, $value);
315 315
 				}
316 316
 
317 317
 				//make sure price is set if it hasn't been already
318
-				$TKT->set( 'TKT_price', $ticket_price );
318
+				$TKT->set('TKT_price', $ticket_price);
319 319
 
320 320
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
321
-				if ( $create_new_TKT ) {
321
+				if ($create_new_TKT) {
322 322
 					//@TODO need to move this logic into its own method that just receives the ticket object (and other necessary info)
323 323
 					$new_tkt = clone($TKT);
324 324
 
@@ -328,26 +328,26 @@  discard block
 block discarded – undo
328 328
 					//TKT will get archived later b/c we are NOT adding it to the saved_tickets array.
329 329
 
330 330
 					//if existing $TKT has sold amount, then we need to adjust the qty for the new TKT to = the remaining available.
331
-					if ( $TKT->get('TKT_sold') > 0 ) {
331
+					if ($TKT->get('TKT_sold') > 0) {
332 332
 						$new_qty = $TKT->get('TKT_qty') - $TKT->get('TKT_sold');
333 333
 						$new_tkt->set_qty($new_qty);
334 334
 					}
335 335
 
336 336
 
337 337
 					//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
338
-					$new_tkt->set( 'TKT_ID', 0 );
339
-					$new_tkt->set( 'TKT_deleted', 0 );
340
-					$new_tkt->set( 'TKT_price', $ticket_price );
341
-					$new_tkt->set( 'TKT_sold', 0 );
338
+					$new_tkt->set('TKT_ID', 0);
339
+					$new_tkt->set('TKT_deleted', 0);
340
+					$new_tkt->set('TKT_price', $ticket_price);
341
+					$new_tkt->set('TKT_sold', 0);
342 342
 
343 343
 					//now we update the prices just for this ticket
344
-					$new_tkt = $this->_add_prices_to_ticket( $price_rows, $new_tkt, TRUE );
344
+					$new_tkt = $this->_add_prices_to_ticket($price_rows, $new_tkt, TRUE);
345 345
 
346 346
 					//and we update the base price
347
-					$new_tkt =  $this->_add_prices_to_ticket( array(), $new_tkt, TRUE, $base_price, $base_price_id );
347
+					$new_tkt = $this->_add_prices_to_ticket(array(), $new_tkt, TRUE, $base_price, $base_price_id);
348 348
 
349
-					foreach ( $dtts_on_existing as $adddtt ) {
350
-						$new_tkt->_add_relation_to( $adddtt, 'Datetime' );
349
+					foreach ($dtts_on_existing as $adddtt) {
350
+						$new_tkt->_add_relation_to($adddtt, 'Datetime');
351 351
 					}
352 352
 
353 353
 				}
@@ -355,35 +355,35 @@  discard block
 block discarded – undo
355 355
 			} else {
356 356
 				//no TKT_id so a new TKT
357 357
 				$TKT_values['TKT_price'] = $ticket_price;
358
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values, $timezone ), FALSE, FALSE );
358
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values, $timezone), FALSE, FALSE);
359 359
 				$update_prices = TRUE;
360 360
 			}
361 361
 
362 362
 			$TKT->save(); //make sure any current values have been saved.
363 363
 
364 364
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
365
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
366
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
365
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
366
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
367 367
 				EE_Registry::instance()->load_helper('DTT_Helper');
368 368
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
369 369
 			}
370 370
 
371 371
 			//let's make sure the base price is handled
372
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
372
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
373 373
 
374 374
 			//add/update price_modifiers
375
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
375
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
376 376
 
377 377
 
378 378
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
379
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
380
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
379
+			if ( ! defined('DOING_AUTOSAVE')) {
380
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
381 381
 					$update_prices = TRUE;
382 382
 					$new_default = clone $TKT;
383
-					$new_default->set( 'TKT_ID', 0 );
384
-					$new_default->set( 'TKT_is_default', 1 );
385
-					$new_default->set( 'TKT_row', 1 );
386
-					$new_default->set( 'TKT_price', $ticket_price );
383
+					$new_default->set('TKT_ID', 0);
384
+					$new_default->set('TKT_is_default', 1);
385
+					$new_default->set('TKT_row', 1);
386
+					$new_default->set('TKT_price', $ticket_price);
387 387
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
388 388
 					$new_default->_remove_relations('Datetime');
389 389
 					$new_default->save();
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
392 392
 
393 393
 					//don't forget the base price!
394
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
394
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
395 395
 				}
396 396
 			}
397 397
 
@@ -399,42 +399,42 @@  discard block
 block discarded – undo
399 399
 
400 400
 
401 401
 			//first let's do the add_relation_to()
402
-			$dtts_added = empty( $dtts_added ) || ( is_array( $dtts_added ) && ( isset( $dtts_added[0] ) && $dtts_added[0] == '' ) ) ? array() : $dtts_added;
402
+			$dtts_added = empty($dtts_added) || (is_array($dtts_added) && (isset($dtts_added[0]) && $dtts_added[0] == '')) ? array() : $dtts_added;
403 403
 
404
-			foreach ( $dtts_added as $dttrow ) {
404
+			foreach ($dtts_added as $dttrow) {
405 405
 				$dttrow = (int) $dttrow;
406 406
 				$TKT->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
407 407
 
408 408
 				//now wait a minute.  Does this tkt have any sold?  Cause if it does then we need to add that to the DTT sold because this DTT is getting added.
409
-				if ( $TKT->get('TKT_sold') > 0 ) {
410
-					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold') );
409
+				if ($TKT->get('TKT_sold') > 0) {
410
+					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold'));
411 411
 					$saved_dtts[$dttrow]->save();
412 412
 				}
413 413
 
414 414
 				//if we have a new_tkt... let's add to it as well
415
-				if ( !empty( $new_tkt ) )
416
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
415
+				if ( ! empty($new_tkt))
416
+					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
417 417
 			}
418 418
 
419 419
 
420
-			$dtts_removed = empty( $dtts_removed ) || ( is_array( $dtts_removed ) && isset( $dtts_removed[0] ) && $dtts_removed[0] == '' ) ? array() : $dtts_removed;
420
+			$dtts_removed = empty($dtts_removed) || (is_array($dtts_removed) && isset($dtts_removed[0]) && $dtts_removed[0] == '') ? array() : $dtts_removed;
421 421
 
422 422
 			//now let's do the remove_relation_to()
423
-			foreach ( $dtts_removed as $dttrow ) {
423
+			foreach ($dtts_removed as $dttrow) {
424 424
 				$dttrow = (int) $dttrow;
425 425
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
426
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
426
+				if (empty($saved_dtts[$dttrow]) || ! $saved_dtts[$dttrow] instanceof EE_Datetime)
427 427
 					continue;
428 428
 
429 429
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
430 430
 
431 431
 				//now wait a minute.  Does this tkt have any sold? Cause if it does then we need to remove it's sold from the DTT_sold.
432
-				if ( $TKT->get('TKT_sold') > 0 ) {
433
-					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold') );
432
+				if ($TKT->get('TKT_sold') > 0) {
433
+					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold'));
434 434
 					$saved_dtts[$dttrow]->save();
435 435
 				}
436 436
 
437
-				if ( !empty( $new_tkt ) )
437
+				if ( ! empty($new_tkt))
438 438
 					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
439 439
 			}
440 440
 
@@ -445,43 +445,43 @@  discard block
 block discarded – undo
445 445
 			//let's assign any tickets that have been setup to the saved_tickets tracker
446 446
 			//save existing TKT
447 447
 			$TKT->save();
448
-			if ( $create_new_TKT ) {
448
+			if ($create_new_TKT) {
449 449
 				//save new TKT
450 450
 				$new_tkt->save();
451 451
 				//add new ticket to array
452 452
 				$saved_tickets[$new_tkt->ID()] = $new_tkt;
453 453
 
454
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
454
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
455 455
 
456 456
 			} else {
457 457
 				//add tkt to saved tkts
458 458
 				//save existing TKT
459 459
 				$saved_tickets[$TKT->ID()] = $TKT;
460 460
 
461
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
461
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
462 462
 			}
463 463
 
464 464
 		}
465 465
 
466 466
 		//now we need to handle tickets actually "deleted permanently".  There are cases where we'd want this to happen (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).  Or a draft event was saved and in the process of editing a ticket is trashed.  No sense in keeping all the related data in the db!
467
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
468
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
467
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
468
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
469 469
 		/*var_dump($old_tickets);
470 470
 		var_dump($saved_tickets);
471 471
 		var_dump($tickets_removed);*/
472 472
 
473
-		foreach ( $tickets_removed as $id ) {
474
-			$id = absint( $id );
473
+		foreach ($tickets_removed as $id) {
474
+			$id = absint($id);
475 475
 
476 476
 			//get the ticket for this id
477 477
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
478 478
 
479 479
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
480
-			if ( $tkt_to_remove->get('TKT_is_default') )
480
+			if ($tkt_to_remove->get('TKT_is_default'))
481 481
 				continue;
482 482
 
483 483
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
484
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
484
+			if ($tkt_to_remove->count_related('Registration') > 0) {
485 485
 				$tkt_to_remove->delete();
486 486
 				continue;
487 487
 			}
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
490 490
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
491 491
 
492
-			foreach( $dtts as $dtt ) {
492
+			foreach ($dtts as $dtt) {
493 493
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
494 494
 			}
495 495
 
496 496
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
497 497
 			$tkt_to_remove->delete_related_permanently('Price');
498 498
 
499
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
499
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
500 500
 
501 501
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
502 502
 			$tkt_to_remove->delete_permanently();
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
520 520
 	 * @return  void
521 521
 	 */
522
-	private function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
522
+	private function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
523 523
 
524 524
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
525 525
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		$updated_prices = array();
528 528
 
529 529
 		// if $base_price ! FALSE then updating a base price.
530
-		if ( $base_price !== FALSE ) {
530
+		if ($base_price !== FALSE) {
531 531
 			$prices[1] = array(
532 532
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
533 533
 				'PRT_ID' => 1,
@@ -538,47 +538,47 @@  discard block
 block discarded – undo
538 538
 		}
539 539
 
540 540
 		//possibly need to save tkt
541
-		if ( ! $ticket->ID() )
541
+		if ( ! $ticket->ID())
542 542
 			$ticket->save();
543 543
 
544
-		foreach ( $prices as $row => $prc ) {
545
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
546
-			if ( empty($prt_id) )
544
+		foreach ($prices as $row => $prc) {
545
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
546
+			if (empty($prt_id))
547 547
 				continue; //prices MUST have a price type id.
548 548
 			$PRC_values = array(
549
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
549
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
550 550
 				'PRT_ID' => $prt_id,
551
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
552
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
553
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
551
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
552
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
553
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
554 554
 				'PRC_is_default' => 0, //make sure we set PRC_is_default to 0 for all ticket saves from event_editor
555 555
 				'PRC_order' => $row
556 556
 				);
557
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
557
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
558 558
 				$PRC_values['PRC_ID'] = 0;
559
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
559
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
560 560
 			} else {
561
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
561
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
562 562
 				//update this price with new values
563
-				foreach ( $PRC_values as $field => $newprc ) {
564
-					$PRC->set( $field, $newprc );
563
+				foreach ($PRC_values as $field => $newprc) {
564
+					$PRC->set($field, $newprc);
565 565
 				}
566 566
 			}
567 567
 			$PRC->save();
568 568
 			$prcid = $PRC->ID();
569 569
 			$updated_prices[$prcid] = $PRC;
570
-			$ticket->_add_relation_to( $PRC, 'Price' );
570
+			$ticket->_add_relation_to($PRC, 'Price');
571 571
 		}
572 572
 
573 573
 		//now let's remove any prices that got removed from the ticket
574
-		if ( !empty ( $current_prices_on_ticket ) ) {
574
+		if ( ! empty ($current_prices_on_ticket)) {
575 575
 			$current = array_keys($current_prices_on_ticket);
576 576
 			$updated = array_keys($updated_prices);
577 577
 			$prices_to_remove = array_diff($current, $updated);
578
-			if ( !empty( $prices_to_remove ) ) {
579
-				foreach ( $prices_to_remove as $prc_id ) {
578
+			if ( ! empty($prices_to_remove)) {
579
+				foreach ($prices_to_remove as $prc_id) {
580 580
 					$p = $current_prices_on_ticket[$prc_id];
581
-					$ticket->_remove_relation_to( $p, 'Price' );
581
+					$ticket->_remove_relation_to($p, 'Price');
582 582
 
583 583
 					//delete permanently the price
584 584
 					$p->delete_permanently();
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 
593 593
 
594
-	public function autosave_handling( $event_admin_obj ) {
594
+	public function autosave_handling($event_admin_obj) {
595 595
 		return $event_admin_obj; //doing nothing for the moment.
596 596
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
597 597
 
@@ -625,12 +625,12 @@  discard block
 block discarded – undo
625 625
 
626 626
 		//default main template args
627 627
 		$main_template_args = array(
628
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
628
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
629 629
 			'existing_datetime_ids' => '',
630 630
 			'total_dtt_rows' => 1,
631
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
631
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
632 632
 			'datetime_rows' => '',
633
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
633
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
634 634
 			'ticket_rows' => '',
635 635
 			'existing_ticket_ids' => '',
636 636
 			'total_ticket_rows' => 1,
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
642 642
 
643
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
643
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
644 644
 
645 645
 		/**
646 646
 		 * 1. Start with retrieving Datetimes
@@ -648,22 +648,22 @@  discard block
 block discarded – undo
648 648
 		 * 3. For each ticket get related prices
649 649
 		 */
650 650
 
651
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
652
-		$times = $DTM->get_all_event_dates( $evtID );
651
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
652
+		$times = $DTM->get_all_event_dates($evtID);
653 653
 
654 654
 
655 655
 
656 656
 		$main_template_args['total_dtt_rows'] = count($times);
657
-		foreach ( $times as $time ) {
657
+		foreach ($times as $time) {
658 658
 			$dttid = $time->get('DTT_ID');
659 659
 			$dttrow = $time->get('DTT_order');
660 660
 			$existing_datetime_ids[] = $dttid;
661 661
 
662 662
 			//tickets attached
663
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
663
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
664 664
 
665 665
 			//if there are no related tickets this is likely a new event OR autodraft event so we need to generate the default tickets CAUSE dtts ALWAYS have at least one related ticket!!.
666
-			if ( empty ( $related_tickets ) ) {
666
+			if (empty ($related_tickets)) {
667 667
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
668 668
 			}
669 669
 
@@ -672,11 +672,11 @@  discard block
 block discarded – undo
672 672
 
673 673
 			//loop through and setup the ticket rows and make sure the order is set.
674 674
 			$order = 0;
675
-			foreach ( $related_tickets as $ticket ) {
675
+			foreach ($related_tickets as $ticket) {
676 676
 				$tktid = $ticket->get('TKT_ID');
677 677
 				$tktrow = $ticket->get('TKT_row');
678 678
 				//we only want unique tickets in our final display!!
679
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
679
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
680 680
 					$existing_ticket_ids[] = $tktid;
681 681
 					$all_tickets[] = $ticket;
682 682
 				}
@@ -685,89 +685,89 @@  discard block
 block discarded – undo
685 685
 				$datetime_tickets[$dttid][] = $tktrow;
686 686
 
687 687
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
688
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
688
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
689 689
 					$ticket_datetimes[$tktid][] = $dttrow;
690 690
 			}
691 691
 		}
692 692
 
693
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
694
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
695
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
693
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
694
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
695
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
696 696
 
697 697
 		//sort $all_tickets by order
698
-		usort( $all_tickets, function( $a, $b ) {
698
+		usort($all_tickets, function($a, $b) {
699 699
 			$a_order = (int) $a->get('TKT_order');
700 700
 			$b_order = (int) $b->get('TKT_order');
701
-			if ( $a_order == $b_order ) {
701
+			if ($a_order == $b_order) {
702 702
 				return 0;
703 703
 			}
704
-			return ( $a_order < $b_order ) ? -1 : 1;
704
+			return ($a_order < $b_order) ? -1 : 1;
705 705
 		});
706 706
 
707 707
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
708 708
 		$dttrow = 1;
709
-		foreach ( $times as $time ) {
710
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
709
+		foreach ($times as $time) {
710
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
711 711
 			$dttrow++;
712 712
 		}
713 713
 
714 714
 		//then loop through all tickets for the ticket rows.
715 715
 		$tktrow = 1;
716
-		foreach ( $all_tickets as $ticket ) {
717
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
716
+		foreach ($all_tickets as $ticket) {
717
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
718 718
 			$tktrow++;
719 719
 		}
720 720
 
721 721
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
722
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
723
-		EEH_Template::display_template( $template, $main_template_args );
722
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
723
+		EEH_Template::display_template($template, $main_template_args);
724 724
 		return;
725 725
 	}
726 726
 
727 727
 
728 728
 
729
-	private function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
729
+	private function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
730 730
 
731 731
 		$dtt_display_template_args = array(
732
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
733
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
732
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
733
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
734 734
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
735 735
 			);
736
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
737
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
736
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
737
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
738 738
 	}
739 739
 
740 740
 
741 741
 
742
-	private function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
742
+	private function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
743 743
 
744 744
 		$template_args = array(
745 745
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
746 746
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
747
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
747
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
748 748
 			'DTT_ID' => $default ? '' : $dtt->ID(),
749 749
 			'DTT_name' => $default ? '' : $dtt->name(),
750 750
 			'DTT_description' => $default ? '' : $dtt->description(),
751
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( 'Y-m-d h:i a'),
752
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( 'Y-m-d h:i a'),
753
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
751
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date('Y-m-d h:i a'),
752
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date('Y-m-d h:i a'),
753
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
754 754
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
755 755
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
756
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
757
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
756
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
757
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
758 758
 			);
759 759
 
760
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
760
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
761 761
 
762 762
 		//allow filtering of template args at this point.
763
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
763
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
764 764
 
765
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
766
-		return EEH_Template::display_template( $template, $template_args, TRUE );
765
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
766
+		return EEH_Template::display_template($template, $template_args, TRUE);
767 767
 	}
768 768
 
769 769
 
770
-	private function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
770
+	private function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
771 771
 
772 772
 		$template_args = array(
773 773
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -775,59 +775,59 @@  discard block
 block discarded – undo
775 775
 			'DTT_description' => $default ? '' : $dtt->description(),
776 776
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
777 777
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
778
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
778
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
779 779
 			);
780 780
 
781 781
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
782
-		if ( !$default ) {
782
+		if ( ! $default) {
783 783
 			$tktrow = 1;
784
-			foreach ( $all_tickets as $ticket ) {
785
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
784
+			foreach ($all_tickets as $ticket) {
785
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
786 786
 				$tktrow++;
787 787
 			}
788 788
 		}
789 789
 
790 790
 		//filter template args at this point
791
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
791
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
792 792
 
793
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
794
-		return EEH_Template::display_template( $template, $template_args, TRUE );
793
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
794
+		return EEH_Template::display_template($template, $template_args, TRUE);
795 795
 	}
796 796
 
797 797
 
798 798
 
799
-	private function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
800
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
801
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
802
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
799
+	private function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
800
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
801
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
802
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
803 803
 		$template_args = array(
804 804
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
805
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
805
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
806 806
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
807 807
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
808
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
809
-			'tkt_status_class' => $default && empty( $ticket ) ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
808
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
809
+			'tkt_status_class' => $default && empty($ticket) ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
810 810
 			);
811 811
 
812 812
 		//filter template args
813
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
813
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
814 814
 
815
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
816
-		return EEH_Template::display_template( $template, $template_args, TRUE );
815
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
816
+		return EEH_Template::display_template($template, $template_args, TRUE);
817 817
 	}
818 818
 
819 819
 
820 820
 
821 821
 
822
-	private function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
823
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
822
+	private function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
823
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
824 824
 
825 825
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
826
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
826
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
827 827
 
828
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
828
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
829 829
 
830
-		$ticket_subtotal = !empty( $ticket ) ? $ticket->get_ticket_subtotal() : 0;
830
+		$ticket_subtotal = ! empty($ticket) ? $ticket->get_ticket_subtotal() : 0;
831 831
 		$base_price = $ticket instanceof EE_Ticket ? $ticket->base_price() : NULL;
832 832
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
833 833
 
@@ -835,24 +835,24 @@  discard block
 block discarded – undo
835 835
 		$template_args = array(
836 836
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
837 837
 			'TKT_order' => $default ? 'TICKETNUM' : $tktrow, //on initial page load this will always be the correct order.
838
-			'tkt_status_class' => $default ? ' tkt-status-' . EE_Ticket::onsale : $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
838
+			'tkt_status_class' => $default ? ' tkt-status-'.EE_Ticket::onsale : $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
839 839
 			'display_edit_tkt_row' => ' style="display:none;"', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 || $default ? ' style="display:none"' : '',
840 840
 			'edit_tkt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
841 841
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
842 842
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
843 843
 			'TKT_start_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_start_date', 'Y-m-d h:i a') : '',
844
-			'TKT_end_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_end_date', 'Y-m-d h:i a' ) : '',
845
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
844
+			'TKT_end_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_end_date', 'Y-m-d h:i a') : '',
845
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
846 846
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
847 847
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
848 848
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
849
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
850
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
851
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
852
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
853
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
849
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
850
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
851
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
852
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
853
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
854 854
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
855
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
855
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
856 856
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
857 857
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
858 858
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -861,99 +861,99 @@  discard block
 block discarded – undo
861 861
 			'ticket_price_rows' => '',
862 862
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
863 863
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
864
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
865
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
864
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
865
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
866 866
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
867 867
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
868 868
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
869 869
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
870
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
870
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
871 871
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
872
-			'TKT_taxable' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? ' checked="checked"' : '',
873
-			'display_subtotal' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
872
+			'TKT_taxable' => ! empty($ticket) && $ticket->get('TKT_taxable') ? ' checked="checked"' : '',
873
+			'display_subtotal' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
874 874
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
875
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
875
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
876 876
 			'TKT_subtotal_amount' => $ticket_subtotal,
877
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
878
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE: FALSE,
879
-			'ticket_archive_class' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
880
-			'trash_icon' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
881
-			'clone_icon' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
877
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
878
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE,
879
+			'ticket_archive_class' => ! empty($ticket) && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
880
+			'trash_icon' => ! empty($ticket) && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
881
+			'clone_icon' => ! empty($ticket) && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
882 882
 			);
883 883
 
884
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
884
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
885 885
 
886 886
 		//handle rows that should NOT be empty
887
-		if ( empty( $template_args['TKT_start_date'] ) ) {
887
+		if (empty($template_args['TKT_start_date'])) {
888 888
 			//if empty then the start date will be now.
889 889
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
890
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
890
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
891 891
 		}
892 892
 
893
-		if ( empty( $template_args['TKT_end_date'] ) ) {
893
+		if (empty($template_args['TKT_end_date'])) {
894 894
 
895 895
 			//get the earliest datetime (if present);
896
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
896
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
897 897
 
898
-			if ( !empty( $earliest_dtt ) ) {
898
+			if ( ! empty($earliest_dtt)) {
899 899
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
900 900
 			} else {
901 901
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
902
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
902
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
903 903
 			}
904
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
904
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
905 905
 		}
906 906
 
907 907
 		//generate ticket_datetime items
908
-		if ( ! $default ) {
908
+		if ( ! $default) {
909 909
 			$dttrow = 1;
910
-			foreach ( $all_dtts as $dtt ) {
911
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
910
+			foreach ($all_dtts as $dtt) {
911
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
912 912
 				$dttrow++;
913 913
 			}
914 914
 		}
915 915
 
916 916
 		$prcrow = 1;
917
-		foreach ( $prices as $price ) {
918
-			if ( $price->is_base_price() ) {
917
+		foreach ($prices as $price) {
918
+			if ($price->is_base_price()) {
919 919
 				$prcrow++;
920 920
 				continue;
921 921
 			}
922
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
923
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
924
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
922
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
923
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
924
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
925 925
 			$prcrow++;
926 926
 		}
927 927
 
928 928
 		//filter $template_args
929
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
929
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
930 930
 
931
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
932
-		return EEH_Template::display_template( $template, $template_args, TRUE );
931
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
932
+		return EEH_Template::display_template($template, $template_args, TRUE);
933 933
 	}
934 934
 
935 935
 
936 936
 
937 937
 
938 938
 
939
-	private function _get_tax_rows( $tktrow, $ticket ) {
939
+	private function _get_tax_rows($tktrow, $ticket) {
940 940
 		$tax_rows = '';
941
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
941
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
942 942
 		$template_args = array();
943
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
944
-		foreach ( $taxes as $tax ) {
945
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
943
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
944
+		foreach ($taxes as $tax) {
945
+			$tax_added = $this->_get_tax_added($tax, $ticket);
946 946
 			$template_args = array(
947
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
947
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
948 948
 				'tax_id' => $tax->ID(),
949 949
 				'tkt_row' => $tktrow,
950 950
 				'tax_label' => $tax->get('PRC_name'),
951 951
 				'tax_added' => $tax_added,
952
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
952
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
953 953
 				'tax_amount' => $tax->get('PRC_amount')
954 954
 				);
955
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
956
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
955
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
956
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
957 957
 		}
958 958
 
959 959
 
@@ -961,81 +961,81 @@  discard block
 block discarded – undo
961 961
 	}
962 962
 
963 963
 
964
-	private function _get_tax_added( EE_Price $tax, $ticket ) {
965
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
964
+	private function _get_tax_added(EE_Price $tax, $ticket) {
965
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
966 966
 		return $subtotal * $tax->get('PRC_amount') / 100;
967 967
 	}
968 968
 
969 969
 
970 970
 
971 971
 
972
-	private function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
973
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
972
+	private function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
973
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
974 974
 		$template_args = array(
975 975
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
976 976
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
977 977
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
978
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
978
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
979 979
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
980 980
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
981 981
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
982 982
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
983 983
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
984
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
985
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
986
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
987
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
988
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
984
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
985
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
986
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
987
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
988
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
989 989
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
990 990
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
991
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
992
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
991
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
992
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
993 993
 			);
994 994
 
995
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
995
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
996 996
 
997
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
998
-		return EEH_Template::display_template( $template, $template_args, TRUE );
997
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
998
+		return EEH_Template::display_template($template, $template_args, TRUE);
999 999
 	}
1000 1000
 
1001 1001
 
1002
-	private function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1003
-		if ( $price->is_base_price() ) {
1004
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1002
+	private function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1003
+		if ($price->is_base_price()) {
1004
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1005 1005
 		} else {
1006
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1006
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1007 1007
 		}
1008 1008
 
1009 1009
 	}
1010 1010
 
1011 1011
 
1012
-	private function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1012
+	private function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1013 1013
 		$template_args = array(
1014 1014
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1015
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1016
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1015
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1016
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1017 1017
 				'PRT_name' => __('Price', 'event_espresso'),
1018 1018
 				'price_selected_operator' => '+',
1019 1019
 				'price_selected_is_percent' => 0
1020 1020
 			);
1021
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1021
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1022 1022
 
1023
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1023
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1024 1024
 
1025
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1025
+		return EEH_Template::display_template($template, $template_args, TRUE);
1026 1026
 	}
1027 1027
 
1028 1028
 
1029 1029
 
1030
-	private function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1031
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1032
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1033
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1034
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1035
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1030
+	private function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1031
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1032
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1033
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1034
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1035
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1036 1036
 		$price_option_spans = '';
1037 1037
 		//setup pricetypes for selector
1038
-		foreach ( $price_types as $price_type ) {
1038
+		foreach ($price_types as $price_type) {
1039 1039
 			$all_price_types[] = array(
1040 1040
 				'id' => $price_type->ID(),
1041 1041
 				'text' => $price_type->get('PRT_name'),
@@ -1047,50 +1047,50 @@  discard block
 block discarded – undo
1047 1047
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1048 1048
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1049 1049
 				);
1050
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1050
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1051 1051
 		}
1052 1052
 
1053
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1053
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1054 1054
 		$main_name = $select_name;
1055
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1055
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1056 1056
 
1057 1057
 		$template_args = array(
1058 1058
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1059
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1060
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1059
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1060
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1061 1061
 			'main_name' => $main_name,
1062 1062
 			'selected_price_type_id' => $selected_price_type_id,
1063 1063
 			'price_option_spans' => $price_option_spans,
1064
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1065
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1064
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1065
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1066 1066
 			'disabled' => $disabled
1067 1067
 			);
1068 1068
 
1069
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1069
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1070 1070
 
1071
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1071
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1072 1072
 
1073
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1073
+		return EEH_Template::display_template($template, $template_args, TRUE);
1074 1074
 	}
1075 1075
 
1076 1076
 
1077 1077
 
1078
-	private function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1079
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1080
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1081
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1078
+	private function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1079
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1080
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1081
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1082 1082
 		$template_args = array(
1083
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1083
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1084 1084
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1085
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1086
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1087
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1085
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1086
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1087
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1088 1088
 			'tkt_status_class' => '',
1089 1089
 			);
1090 1090
 
1091
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1092
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1093
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1091
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1092
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1093
+		return EEH_Template::display_template($template, $template_args, TRUE);
1094 1094
 	}
1095 1095
 
1096 1096
 
@@ -1098,53 +1098,53 @@  discard block
 block discarded – undo
1098 1098
 	private function _get_ticket_js_structure($all_dtts, $all_tickets) {
1099 1099
 		$template_args = array(
1100 1100
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1101
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1102
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1101
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1102
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1103 1103
 			'default_price_rows' => '',
1104 1104
 			'default_base_price_amount' => 0,
1105 1105
 			'default_base_price_name' => '',
1106 1106
 			'default_base_price_description' => '',
1107
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1108
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1107
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1108
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1109 1109
 			'existing_available_datetime_tickets_list' => '',
1110 1110
 			'existing_available_ticket_datetimes_list' => '',
1111
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1112
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1111
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1112
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1113 1113
 			);
1114 1114
 
1115 1115
 		$tktrow = 1;
1116
-		foreach ( $all_tickets as $ticket ) {
1117
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1116
+		foreach ($all_tickets as $ticket) {
1117
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1118 1118
 			$tktrow++;
1119 1119
 		}
1120 1120
 
1121 1121
 
1122 1122
 		$dttrow = 1;
1123
-		foreach ( $all_dtts as $dtt ) {
1124
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1123
+		foreach ($all_dtts as $dtt) {
1124
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1125 1125
 			$dttrow++;
1126 1126
 		}
1127 1127
 
1128 1128
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1129 1129
 		$prcrow = 1;
1130
-		foreach ( $default_prices as $price ) {
1131
-			if ( $price->is_base_price() ) {
1130
+		foreach ($default_prices as $price) {
1131
+			if ($price->is_base_price()) {
1132 1132
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1133 1133
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1134 1134
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1135 1135
 				$prcrow++;
1136 1136
 				continue;
1137 1137
 			}
1138
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1139
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1140
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1138
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1139
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1140
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1141 1141
 			$prcrow++;
1142 1142
 		}
1143 1143
 
1144
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1144
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1145 1145
 
1146
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1147
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1146
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1147
+		return EEH_Template::display_template($template, $template_args, TRUE);
1148 1148
 	}
1149 1149
 
1150 1150
 
Please login to merge, or discard this patch.
new/pricing/help_tours/Pricing_Add_New_Default_Price_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Add New Default Price', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the add new default price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Add New Default Price', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the add new default price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 
86 86
 	protected function _price_type_stop() {
87
-		return '<p>' . __('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_name_stop() {
91
-		return '<p>' . __('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _price_description_stop() {
95
-		return '<p>' . __('View the price type (price, discount, tax or surcharge) description.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('View the price type (price, discount, tax or surcharge) description.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _price_amount_stop() {
99
-		return '<p>' . __('The ticket amount before any deductions.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('The ticket amount before any deductions.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Add_New_Price_Type_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Add New Price Type', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the Add New Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Add New Price Type', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the Add New Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 	
86 86
 	protected function _basic_type_stop() {
87
-		return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Set a price type to be a discount, surcharge, or tax.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_type_name_stop() {
91
-		return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price type.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _percentage_dollar_amount_stop() {
95
-		return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('Set a price type to be percentage-based or a fixed amount.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _order_of_application_stop() {
99
-		return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('Set the order of application for a price type.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Default_Prices_Help_Tour.class.php 2 patches
Spacing   +9 added lines, -9 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
 /**
@@ -99,33 +99,33 @@  discard block
 block discarded – undo
99 99
 
100 100
 
101 101
 	protected function _start() {
102
-		$content = '<h3>' . __('Default Pricing', 'event_espresso') . '</h3>';
103
-		$content .= '<p>' . __('This tour of the Default Pricing page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
102
+		$content = '<h3>'.__('Default Pricing', 'event_espresso').'</h3>';
103
+		$content .= '<p>'.__('This tour of the Default Pricing page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
104 104
 		return $content;
105 105
 	}
106 106
 
107 107
 	protected function _name_column_stop() {
108
-		return '<p>' . __('The name of the price, discount, tax, or surcharge that will be seen by your customers. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
108
+		return '<p>'.__('The name of the price, discount, tax, or surcharge that will be seen by your customers. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
109 109
 	}
110 110
 
111 111
 	protected function _type_column_stop() {
112
-		return '<p>' . __('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
112
+		return '<p>'.__('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
113 113
 	}
114 114
 
115 115
 	protected function _description_column_stop() {
116
-		return '<p>' . __('View the price type (price, discount, tax or surcharge) description.', 'event_espresso') . '</p>';
116
+		return '<p>'.__('View the price type (price, discount, tax or surcharge) description.', 'event_espresso').'</p>';
117 117
 	}
118 118
 
119 119
 	protected function _amount_column_stop() {
120
-		return '<p>' . __('The ticket amount before any deductions. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
120
+		return '<p>'.__('The ticket amount before any deductions. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
121 121
 	}
122 122
 
123 123
 	protected function _bulk_actions_stop() {
124
-		return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>';
124
+		return '<p>'.__('Perform bulk actions to multiple price types.', 'event_espresso').'</p>';
125 125
 	}
126 126
 
127 127
 	protected function _search_stop() {
128
-		return '<p>' . __('Search through default pricing. The following sources will be searched: Price Name, Price Type, Price Description, and Price Amount.', 'event_espresso') . '</p>';
128
+		return '<p>'.__('Search through default pricing. The following sources will be searched: Price Name, Price Type, Price Description, and Price Amount.', 'event_espresso').'</p>';
129 129
 	}
130 130
 
131 131
 }
132 132
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Edit_Default_Price_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Edit Default Price', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the Edit Default Price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Edit Default Price', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the Edit Default Price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 
86 86
 	protected function _price_type_stop() {
87
-		return '<p>' . __('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_name_stop() {
91
-		return '<p>' . __('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _price_description_stop() {
95
-		return '<p>' . __('View the price type (price, discount, tax or surcharge) description.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('View the price type (price, discount, tax or surcharge) description.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _price_amount_stop() {
99
-		return '<p>' . __('The ticket amount before any deductions.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('The ticket amount before any deductions.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Edit_Price_Type_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Edit Price Type', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Edit Price Type', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 
86 86
 	protected function _basic_type_stop() {
87
-		return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Set a price type to be a discount, surcharge, or tax.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_type_name_stop() {
91
-		return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price type.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _percentage_dollar_amount_stop() {
95
-		return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('Set a price type to be percentage-based or a fixed amount.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _order_of_application_stop() {
99
-		return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('Set the order of application for a price type.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
new/pricing/help_tours/Pricing_Price_Types_Default_Help_Tour.class.php 2 patches
Spacing   +10 added lines, -10 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
 /**
@@ -99,37 +99,37 @@  discard block
 block discarded – undo
99 99
 
100 100
 
101 101
 	protected function _start() {
102
-		$content = '<h3>' . __('Price Types', 'event_espresso') . '</h3>';
103
-		$content .= '<p>' . __('This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
102
+		$content = '<h3>'.__('Price Types', 'event_espresso').'</h3>';
103
+		$content .= '<p>'.__('This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
104 104
 		return $content;
105 105
 	}
106 106
 
107 107
 	protected function _name_column_stop() {
108
-		return '<p>' . __('The name of the price type. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
108
+		return '<p>'.__('The name of the price type. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
109 109
 	}
110 110
 
111 111
 	protected function _base_type_stop() {
112
-		return '<p>' . __('View if a price type is a discount, surcharge, or tax.', 'event_espresso') . '</p>';
112
+		return '<p>'.__('View if a price type is a discount, surcharge, or tax.', 'event_espresso').'</p>';
113 113
 	}
114 114
 
115 115
 	protected function _member_column_stop() {
116
-		return '<p>' . __('Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', 'event_espresso') . '</p>';
116
+		return '<p>'.__('Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', 'event_espresso').'</p>';
117 117
 	}
118 118
 
119 119
 	protected function _percent_column_stop() {
120
-		return '<p>' . __('View if the discount, surcharge, or tax is percentage-based or a fixed amount.', 'event_espresso') . '</p>';
120
+		return '<p>'.__('View if the discount, surcharge, or tax is percentage-based or a fixed amount.', 'event_espresso').'</p>';
121 121
 	}
122 122
 
123 123
 	protected function _order_column_stop() {
124
-		return '<p>' . __('View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', 'event_espresso') . '</p>';
124
+		return '<p>'.__('View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', 'event_espresso').'</p>';
125 125
 	}
126 126
 
127 127
 	protected function _bulk_actions_stop() {
128
-		return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>';
128
+		return '<p>'.__('Perform bulk actions to multiple price types.', 'event_espresso').'</p>';
129 129
 	}
130 130
 
131 131
 	protected function _search_stop() {
132
-		return '<p>' . __('Search through price types. The following source will be searched: Price Type Name.', 'event_espresso') . '</p>';
132
+		return '<p>'.__('Search through price types. The following source will be searched: Price Type Name.', 'event_espresso').'</p>';
133 133
 	}
134 134
 
135 135
 }
136 136
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
templates/event_tickets_datetime_price_modifier_selector.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php echo $price_modifier_selector; ?>
2
-<?php if ( $disabled ) : ?>
2
+<?php if ($disabled) : ?>
3 3
 	<input type="hidden" name="<?php echo $main_name; ?>" value="<?php echo $selected_price_type_id; ?>">
4 4
 <?php endif; ?>
5 5
 
Please login to merge, or discard this patch.