Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
548:45 queued 526:33
created
modules/ticket_selector/templates/ticket_selector_chart.template.php 1 patch
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -8,32 +8,32 @@  discard block
 block discarded – undo
8 8
 
9 9
 $row = 1;
10 10
 $max = 1;
11
-$ticket_count = count( $tickets );
11
+$ticket_count = count($tickets);
12 12
 
13
-if ( ! $ticket_count ) {
13
+if ( ! $ticket_count) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $required_ticket_sold_out = FALSE;
18
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
18
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
19 19
 ob_start();
20 20
 
21
-foreach ( $tickets as $TKT_ID => $ticket ) {
22
-	if ( $ticket instanceof EE_Ticket ) {
21
+foreach ($tickets as $TKT_ID => $ticket) {
22
+	if ($ticket instanceof EE_Ticket) {
23 23
 		//	d( $ticket );
24
-		$max =$ticket->max();
24
+		$max = $ticket->max();
25 25
 		$min = 0;
26 26
 		$remaining = $ticket->remaining();
27
-		if ( $ticket->is_on_sale() && $ticket->is_remaining() ) {
27
+		if ($ticket->is_on_sale() && $ticket->is_remaining()) {
28 28
 			// offer the number of $tickets_remaining or $max_atndz, whichever is smaller
29
-			$max = min( $remaining, $max_atndz );
29
+			$max = min($remaining, $max_atndz);
30 30
 			// but... we also want to restrict the number of tickets by the ticket max setting,
31 31
 			// however, the max still can't be higher than what was just set above
32
-			$max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max;
32
+			$max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max;
33 33
 			// and we also want to restrict the minimum number of tickets by the ticket min setting
34 34
 			$min = $ticket->min() > 0 ? $ticket->min() : 0;
35 35
 			// and if the ticket is required, then make sure that min qty is at least 1
36
-			$min = $ticket->required() ? max( $min, 1 ) : $min;
36
+			$min = $ticket->required() ? max($min, 1) : $min;
37 37
 		} else {
38 38
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
39 39
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
@@ -42,40 +42,40 @@  discard block
 block discarded – undo
42 42
 		$ticket_price = $ticket->get_ticket_total_with_taxes();
43 43
 		$ticket_bundle = FALSE;
44 44
 		// for ticket bundles, set min and max qty the same
45
-		if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) {
45
+		if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) {
46 46
 			$ticket_price = $ticket_price * $ticket->min();
47 47
 			$ticket_bundle = TRUE;
48 48
 		}
49
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
49
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
50 50
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
51 51
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
52 52
 		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status();
53 53
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
54 54
 		// check ticket status
55
-		switch ( $tkt_status ) {
55
+		switch ($tkt_status) {
56 56
 			// sold_out
57 57
 			case EE_Ticket::sold_out :
58
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>';
58
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>';
59 59
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
60 60
 			break;
61 61
 			// expired
62 62
 			case EE_Ticket::expired :
63
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>';
63
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>';
64 64
 				$status_class = 'ticket-sales-expired lt-grey-text';
65 65
 			break;
66 66
 			// archived
67 67
 			case EE_Ticket::archived :
68
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>';
68
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>';
69 69
 				$status_class = 'archived-ticket hidden';
70 70
 			break;
71 71
 			// pending
72 72
 			case EE_Ticket::pending :
73
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>';
73
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>';
74 74
 				$status_class = 'ticket-pending';
75 75
 			break;
76 76
 			// onsale
77 77
 			case EE_Ticket::onsale :
78
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>';
78
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>';
79 79
 				$status_class = 'ticket-on-sale';
80 80
 			break;
81 81
 		}
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 		 *
91 91
 		 * @var string|bool
92 92
 		 */
93
-		if ( false !== ( $new_row_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
93
+		if (false !== ($new_row_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
94 94
 			echo $new_row_content;
95 95
 			continue;
96 96
 		}
97 97
 	?>
98
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
98
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
99 99
 		<?php
100 100
 		/**
101 101
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 		 *
108 108
 		 * @var string|bool
109 109
 		 */
110
-		if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
110
+		if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
111 111
 			echo $new_row_cells_content;
112 112
 			echo '</tr>';
113 113
 			continue;
114 114
 		}
115 115
 		?>
116 116
 					<td class="tckt-slctr-tbl-td-name">
117
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
118
-						<?php if ( $template_settings->show_ticket_details ) : ?>
119
-							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>">
120
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
117
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
118
+						<?php if ($template_settings->show_ticket_details) : ?>
119
+							<a id="display-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>">
120
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
121 121
 							</a>
122
-							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;">
123
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
122
+							<a id="hide-tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;">
123
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
124 124
 							</a>
125 125
 						<?php endif; //end show details check ?>
126
-					<?php if ( $ticket->required() ) { ?>
127
-						<p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p>
126
+					<?php if ($ticket->required()) { ?>
127
+						<p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p>
128 128
 					<?php } ?>
129 129
 					<?php
130 130
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -138,63 +138,63 @@  discard block
 block discarded – undo
138 138
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
139 139
 					?>
140 140
 					</td>
141
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
142
-					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?>&nbsp;<span class="smaller-text no-bold"><?php
143
-						if ( $ticket_bundle ) {
144
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
141
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
142
+					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?>&nbsp;<span class="smaller-text no-bold"><?php
143
+						if ($ticket_bundle) {
144
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
145 145
 						} else {
146
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
146
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
147 147
 						}?></span>&nbsp;</td>
148 148
 					<?php } ?>
149 149
 					<td class="tckt-slctr-tbl-td-qty cntr">
150 150
 					<?php
151 151
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
152 152
 					// sold out or other status ?
153
-					if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) {
153
+					if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) {
154 154
 					?>
155
-						<span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' ));?></span>
155
+						<span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')); ?></span>
156 156
 					<?php
157
-					} else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) {
157
+					} else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) {
158 158
 						echo $ticket_status;
159
-					} else if ( $tkt_status == EE_Ticket::pending ) {
159
+					} else if ($tkt_status == EE_Ticket::pending) {
160 160
 					?>
161 161
 					<div class="ticket-pending-pg">
162
-						<span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' )); ?></span><br/>
163
-						<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span>
162
+						<span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso')); ?></span><br/>
163
+						<span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span>
164 164
 					</div>
165 165
 					<?php
166 166
 					// min qty purchasable is less than tickets available
167
-					} else if ( $ticket->min() > $remaining ) {
167
+					} else if ($ticket->min() > $remaining) {
168 168
 					?>
169 169
 					<div class="archived-ticket-pg">
170
-						<span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/>
170
+						<span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/>
171 171
 					</div>
172 172
 					<?php
173 173
 					// if only one attendee is allowed to register at a time
174
-					} else if ( $max_atndz  == 1 ) {
174
+					} else if ($max_atndz == 1) {
175 175
 						// display submit button since we have tickets available
176
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
176
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
177 177
 				?>
178
-					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
178
+					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
179 179
 			<?php
180 180
 						$hidden_input_qty = FALSE;
181 181
 
182
-					} else if ( $max_atndz  == 0 ) {
183
-						echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
184
-					} elseif ( $max > 0 ) {
182
+					} else if ($max_atndz == 0) {
183
+						echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
184
+					} elseif ($max > 0) {
185 185
 						// display submit button since we have tickets available
186
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
186
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
187 187
 
188 188
 				?>
189
-					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title="">
189
+					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title="">
190 190
 					<?php
191 191
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
192
-						if ( ! $ticket->required() && $min !== 0 ) {
192
+						if ( ! $ticket->required() && $min !== 0) {
193 193
 					?>
194 194
 						<option value="0">&nbsp;0&nbsp;</option>
195 195
 					<?php }
196 196
 						// offer ticket quantities from the min to the max
197
-						for ( $i = $min; $i <= $max; $i++) {
197
+						for ($i = $min; $i <= $max; $i++) {
198 198
 					?>
199 199
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
200 200
 					<?php } ?>
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
 					}
206 206
 					// depending on group reg we need to change the format for qty
207
-					if ( $hidden_input_qty ) {
207
+					if ($hidden_input_qty) {
208 208
 					?>
209 209
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
210 210
 					<?php
@@ -214,33 +214,33 @@  discard block
 block discarded – undo
214 214
 
215 215
 					</td>
216 216
 				</tr>
217
-				<?php if ( $template_settings->show_ticket_details ) : ?>
218
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
217
+				<?php if ($template_settings->show_ticket_details) : ?>
218
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
219 219
 						<td class="tckt-slctr-tkt-details-td" colspan="3" >
220
-							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID . '-' . $TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
220
+							<div id="tckt-slctr-tkt-details-<?php echo $EVT_ID.'-'.$TKT_ID; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
221 221
 
222 222
 								<section class="tckt-slctr-tkt-details-sctn">
223
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
223
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
224 224
 									<p><?php echo $ticket->description(); ?></p>
225 225
 
226
-									<?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
226
+									<?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
227 227
 									<section class="tckt-slctr-tkt-price-sctn">
228
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
228
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
229 229
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
230 230
 											<table class="tckt-slctr-tkt-details-tbl">
231 231
 												<thead>
232 232
 													<tr>
233
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
234
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
235
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
233
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
234
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
235
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
236 236
 													</tr>
237 237
 												</thead>
238 238
 												<tbody>
239
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
239
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
240 240
 													<tr>
241
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
242
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
243
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
241
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
242
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
243
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
244 244
 													</tr>
245 245
 													<?php
246 246
 															$running_total = $ticket->base_price()->amount();
@@ -248,44 +248,44 @@  discard block
 block discarded – undo
248 248
 															$running_total = 0;
249 249
 														}
250 250
 														// now add price modifiers
251
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
251
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
252 252
 													<tr>
253
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
254
-													<?php if ( $price_mod->is_percent() ) { ?>
255
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
253
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
254
+													<?php if ($price_mod->is_percent()) { ?>
255
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
256 256
 														<?php
257
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
257
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
258 258
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
259 259
 														?>
260 260
 													<?php } else { ?>
261 261
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
262
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
262
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
263 263
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
264 264
 													<?php } ?>
265
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
265
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
266 266
 														<?php $running_total += $new_sub_total; ?>
267 267
 													</tr>
268 268
 												<?php } ?>
269
-												<?php if ( $ticket->taxable() ) { ?>
269
+												<?php if ($ticket->taxable()) { ?>
270 270
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
271 271
 													<tr>
272
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
273
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
272
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
273
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
274 274
 													</tr>
275 275
 
276
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
276
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
277 277
 													<tr>
278
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
279
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
280
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
281
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
278
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
279
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
280
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
281
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
282 282
 														<?php $running_total += $tax_amount; ?>
283 283
 													</tr>
284 284
 													<?php } ?>
285 285
 												<?php } ?>
286 286
 													<tr>
287
-														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td>
288
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td>
287
+														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td>
288
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
289 289
 													</tr>
290 290
 												</tbody>
291 291
 											</table>
@@ -295,106 +295,106 @@  discard block
 block discarded – undo
295 295
 									<?php } ?>
296 296
 
297 297
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
298
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
299
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/>
300
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date',  $time_format ) ; ?><br/>
301
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/>
298
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
299
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/>
300
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/>
301
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/>
302 302
 									</section>
303 303
 									<br/>
304 304
 
305
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
305
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
306 306
 
307
-									<?php if ( $ticket->min() &&$ticket->max() ) { ?>
307
+									<?php if ($ticket->min() && $ticket->max()) { ?>
308 308
 									<section class="tckt-slctr-tkt-quantities-sctn">
309
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
310
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/>
311
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
312
-										<?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/>
309
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
310
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/>
311
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
312
+										<?php if ($ticket->min() > $remaining) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/>
313 313
 										<?php //$max = min( $max, $max_atndz );?>
314
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/>
314
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/>
315 315
 									</section>
316 316
 									<br/>
317 317
 									<?php } ?>
318 318
 
319
-									<?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?>
319
+									<?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?>
320 320
 									<section class="tckt-slctr-tkt-uses-sctn">
321
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
321
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
322 322
 										<span class="drk-grey-text small-text no-bold"> - <?php
323 323
 											echo apply_filters(
324 324
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
325 325
 												sprintf(
326
-													__( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ),
326
+													__('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'),
327 327
 													'<br/>',
328 328
 													'<strong>',
329 329
 													'</strong>'
330 330
 												)
331 331
 											);
332 332
 											?></span><br/>
333
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php  echo $ticket->uses();?><br/>
333
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php  echo $ticket->uses(); ?><br/>
334 334
 									</section>
335 335
 									<?php } ?>
336 336
 
337 337
 									<?php
338
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
338
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
339 339
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
340
-									if ( ! empty( $datetimes )) { ?>
340
+									if ( ! empty($datetimes)) { ?>
341 341
 									<section class="tckt-slctr-tkt-datetimes-sctn">
342
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
343
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span>
342
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
343
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span>
344 344
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
345 345
 											<table class="tckt-slctr-tkt-details-tbl">
346 346
 												<thead>
347 347
 													<tr>
348 348
 														<th class="tckt-slctr-tkt-details-date-th">
349
-															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span>
349
+															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span>
350 350
 														</th>
351 351
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
352
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
352
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
353 353
 														</th>
354
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
354
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
355 355
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
356
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span>
356
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span>
357 357
 															</th>
358 358
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
359
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span>
359
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span>
360 360
 															</th>
361 361
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
362
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span>
362
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span>
363 363
 															</th>
364 364
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
365
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span>
365
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span>
366 366
 															</th>
367 367
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
368 368
 													</tr>
369 369
 												</thead>
370 370
 												<tbody>
371 371
 											<?php
372
-												foreach ( $datetimes as $datetime ) {
373
-													if ( $datetime instanceof EE_Datetime ) {
372
+												foreach ($datetimes as $datetime) {
373
+													if ($datetime instanceof EE_Datetime) {
374 374
 											?>
375 375
 
376 376
 												<tr>
377
-													<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text">
377
+													<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text">
378 378
 														<?php $datetime_name = $datetime->name(); ?>
379
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
380
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
379
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
380
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
381 381
 													</td>
382
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
383
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
382
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
383
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
384 384
 													</td>
385
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
386
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text">
385
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
386
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text">
387 387
 															<?php echo $ticket->sold(); ?>
388 388
 														</td>
389
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text">
390
-															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?>
389
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text">
390
+															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?>
391 391
 														</td>
392
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text">
392
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text">
393 393
 															<?php echo $datetime->sold(); ?>
394 394
 														</td>
395
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
396
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text">
397
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
395
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
396
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text">
397
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
398 398
 														</td>
399 399
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
400 400
 												</tr>
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 							</div>
413 413
 						</td>
414 414
 					</tr>
415
-				<?php endif;  //end template_settings->show_ticket_details check?>
415
+				<?php endif; //end template_settings->show_ticket_details check?>
416 416
 	<?php
417 417
 			$row++;
418 418
 		}
@@ -421,32 +421,32 @@  discard block
 block discarded – undo
421 421
 $ticket_row_html = ob_get_clean();
422 422
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
423 423
 $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false;
424
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
424
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
425 425
 //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ );
426 426
 //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ );
427 427
 //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ );
428 428
 //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ );
429 429
 remove_filter(
430 430
 	'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
431
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
431
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
432 432
 );
433 433
 remove_filter(
434 434
 	'FHEE__EE_Ticket_Selector__after_view_details_btn',
435
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
435
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
436 436
 );
437
-if ( ! $hide_ticket_selector ) {
437
+if ( ! $hide_ticket_selector) {
438 438
 ?>
439 439
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
440 440
 
441
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
441
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
442 442
 
443 443
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
444 444
 		<thead>
445 445
 			<tr>
446 446
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
447
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
447
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
448 448
 				</th>
449
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
449
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
450 450
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
451 451
 					<?php
452 452
 						/**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 						 * @param string 'Price' The translatable text to display in the table header for price
458 458
 						 * @param int $EVT_ID The Event ID
459 459
 						 */
460
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
460
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
461 461
 					?>
462 462
 				</th>
463 463
 				<?php } ?>
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
472 472
 						* @param int $EVT_ID The Event ID
473 473
 						*/
474
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
474
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
475 475
 					?>
476 476
 				</th>
477 477
 			</tr>
478 478
 		</thead>
479 479
 		<tbody>
480
-			<?php echo $ticket_row_html;?>
480
+			<?php echo $ticket_row_html; ?>
481 481
 		</tbody>
482 482
 	</table>
483 483
 
484 484
 	<input type="hidden" name="noheader" value="true" />
485
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" />
485
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" />
486 486
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
487 487
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
488 488
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
489 489
 
490 490
 <?php
491
-if ( $max_atndz > 0 && ! $hide_ticket_selector ) {
491
+if ($max_atndz > 0 && ! $hide_ticket_selector) {
492 492
 	echo apply_filters(
493 493
 		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
494 494
 		''
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 }
497 497
 ?>
498 498
 
499
-	<?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?>
499
+	<?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?>
500 500
 
501 501
 </div>
502
-<?php } else if ( isset( $TKT_ID ) ) { ?>
502
+<?php } else if (isset($TKT_ID)) { ?>
503 503
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
504 504
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
505 505
 <input type="hidden" name="noheader" value="true"/>
@@ -508,27 +508,27 @@  discard block
 block discarded – undo
508 508
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
509 509
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
510 510
 <?php
511
-	if ( $ticket instanceof EE_Ticket ) {
512
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
511
+	if ($ticket instanceof EE_Ticket) {
512
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
513 513
 		$ticket_description = $ticket->description();
514 514
 ?>
515 515
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
516 516
 	<div class="no-tkt-slctr-ticket-content-dv">
517 517
 		<h5><?php echo $ticket->name(); ?></h5>
518
-		<?php if ( ! empty( $ticket_description ) ) { ?>
518
+		<?php if ( ! empty($ticket_description)) { ?>
519 519
 		<p><?php echo $ticket_description; ?></p>
520 520
 		<?php } ?>
521 521
 	</div>
522 522
 <?php
523 523
 		add_filter(
524 524
 			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
525
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
525
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
526 526
 		);
527 527
 		add_filter(
528 528
 			'FHEE__EE_Ticket_Selector__after_view_details_btn',
529
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
529
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
530 530
 		);
531
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
531
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
532 532
 	}
533 533
 }
534 534
 ?>
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage 	includes/classes/EE_Transaction.class.php
27 27
  * @author 				Brent Christensen
28 28
  */
29
-class EE_Transaction extends EE_Base_Class implements EEI_Transaction{
29
+class EE_Transaction extends EE_Base_Class implements EEI_Transaction {
30 30
 
31 31
 
32 32
 	/**
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 *                             		    date_format and the second value is the time format
39 39
 	 * @return EE_Transaction
40 40
 	 */
41
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
42
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
43
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
41
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
42
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
43
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
44 44
 	}
45 45
 
46 46
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 *                          		the website will be used.
52 52
 	 * @return EE_Attendee
53 53
 	 */
54
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
55
-		return new self( $props_n_values, TRUE, $timezone );
54
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
55
+		return new self($props_n_values, TRUE, $timezone);
56 56
 	}
57 57
 
58 58
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @return 	void
68 68
 	 */
69 69
 	public function lock() {
70
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
71
-		$locked_transactions[ $this->ID() ] = true;
72
-		update_option( 'ee_locked_transactions', $locked_transactions );
70
+		$locked_transactions = get_option('ee_locked_transactions', array());
71
+		$locked_transactions[$this->ID()] = true;
72
+		update_option('ee_locked_transactions', $locked_transactions);
73 73
 	}
74 74
 
75 75
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @return 	void
84 84
 	 */
85 85
 	public function unlock() {
86
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
87
-		unset( $locked_transactions[ $this->ID() ] );
88
-		update_option( 'ee_locked_transactions', $locked_transactions );
86
+		$locked_transactions = get_option('ee_locked_transactions', array());
87
+		unset($locked_transactions[$this->ID()]);
88
+		update_option('ee_locked_transactions', $locked_transactions);
89 89
 	}
90 90
 
91 91
 	/**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @return boolean
103 103
 	 */
104 104
 	public function is_locked() {
105
-		$locked_transactions = get_option( 'ee_locked_transactions', array() );
106
-		return isset( $locked_transactions[ $this->ID() ] ) ? true : false;
105
+		$locked_transactions = get_option('ee_locked_transactions', array());
106
+		return isset($locked_transactions[$this->ID()]) ? true : false;
107 107
 	}
108 108
 
109 109
 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @access        public
115 115
 	 * @param        float $total total value of transaction
116 116
 	 */
117
-	public function set_total( $total = 0.00 ) {
118
-		$this->set( 'TXN_total', $total );
117
+	public function set_total($total = 0.00) {
118
+		$this->set('TXN_total', $total);
119 119
 	}
120 120
 
121 121
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @access        public
127 127
 	 * @param        float $total_paid total amount paid to date (sum of all payments)
128 128
 	 */
129
-	public function set_paid( $total_paid = 0.00 ) {
130
-		$this->set( 'TXN_paid', $total_paid );
129
+	public function set_paid($total_paid = 0.00) {
130
+		$this->set('TXN_paid', $total_paid);
131 131
 	}
132 132
 
133 133
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @access        public
139 139
 	 * @param        string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set
140 140
 	 */
141
-	public function set_status( $status = '' ) {
142
-		$this->set( 'STS_ID', $status );
141
+	public function set_status($status = '') {
142
+		$this->set('STS_ID', $status);
143 143
 	}
144 144
 
145 145
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @access        public
151 151
 	 * @param        string $hash_salt required for some payment gateways
152 152
 	 */
153
-	public function set_hash_salt( $hash_salt = '' ) {
154
-		$this->set( 'TXN_hash_salt', $hash_salt );
153
+	public function set_hash_salt($hash_salt = '') {
154
+		$this->set('TXN_hash_salt', $hash_salt);
155 155
 	}
156 156
 
157 157
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * Sets TXN_reg_steps array
161 161
 	 * @param array $txn_reg_steps
162 162
 	 */
163
-	function set_reg_steps( $txn_reg_steps ) {
164
-		$this->set( 'TXN_reg_steps', $txn_reg_steps );
163
+	function set_reg_steps($txn_reg_steps) {
164
+		$this->set('TXN_reg_steps', $txn_reg_steps);
165 165
 	}
166 166
 
167 167
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @return array
172 172
 	 */
173 173
 	function reg_steps() {
174
-		$TXN_reg_steps = $this->get( 'TXN_reg_steps' );
175
-		return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array();
174
+		$TXN_reg_steps = $this->get('TXN_reg_steps');
175
+		return is_array($TXN_reg_steps) ? $TXN_reg_steps : array();
176 176
 	}
177 177
 
178 178
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @return string of transaction's total cost, with currency symbol and decimal
183 183
 	 */
184 184
 	public function pretty_total() {
185
-		return $this->get_pretty( 'TXN_total' );
185
+		return $this->get_pretty('TXN_total');
186 186
 	}
187 187
 
188 188
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @return string
193 193
 	 */
194 194
 	public function pretty_paid() {
195
-		return $this->get_pretty( 'TXN_paid' );
195
+		return $this->get_pretty('TXN_paid');
196 196
 	}
197 197
 
198 198
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return float amount remaining
205 205
 	 */
206 206
 	public function remaining() {
207
-		return (float)( $this->total() - $this->paid() );
207
+		return (float) ($this->total() - $this->paid());
208 208
 	}
209 209
 
210 210
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @return float
216 216
 	 */
217 217
 	public function total() {
218
-		return $this->get( 'TXN_total' );
218
+		return $this->get('TXN_total');
219 219
 	}
220 220
 
221 221
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @return float
227 227
 	 */
228 228
 	public function paid() {
229
-		return $this->get( 'TXN_paid' );
229
+		return $this->get('TXN_paid');
230 230
 	}
231 231
 
232 232
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 * @access        public
237 237
 	 */
238 238
 	public function get_cart_session() {
239
-		$session_data = $this->get( 'TXN_session_data' );
240
-		return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL;
239
+		$session_data = $this->get('TXN_session_data');
240
+		return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL;
241 241
 	}
242 242
 
243 243
 
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 	 * @access        public
248 248
 	 */
249 249
 	public function session_data() {
250
-		$session_data = $this->get( 'TXN_session_data' );
251
-		if ( empty( $session_data ) ) {
252
-			$session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() );
250
+		$session_data = $this->get('TXN_session_data');
251
+		if (empty($session_data)) {
252
+			$session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array());
253 253
 		}
254 254
 		return $session_data;
255 255
 	}
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	 * @access        public
263 263
 	 * @param        EE_Session|array $session_data
264 264
 	 */
265
-	public function set_txn_session_data( $session_data ) {
266
-		if ( $session_data instanceof EE_Session ) {
267
-			$this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE ));
265
+	public function set_txn_session_data($session_data) {
266
+		if ($session_data instanceof EE_Session) {
267
+			$this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE));
268 268
 		} else {
269
-			$this->set( 'TXN_session_data', $session_data );
269
+			$this->set('TXN_session_data', $session_data);
270 270
 		}
271 271
 	}
272 272
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @access        public
278 278
 	 */
279 279
 	public function hash_salt_() {
280
-		return $this->get( 'TXN_hash_salt' );
280
+		return $this->get('TXN_hash_salt');
281 281
 	}
282 282
 
283 283
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 	 * @param 	boolean 	$gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied
298 298
 	 * @return 	string | int
299 299
 	 */
300
-	public function datetime( $format = FALSE, $gmt = FALSE ) {
301
-		if ( $format ) {
302
-			return $this->get_pretty( 'TXN_timestamp' );
303
-		} else if ( $gmt ) {
304
-			return $this->get_raw( 'TXN_timestamp' );
300
+	public function datetime($format = FALSE, $gmt = FALSE) {
301
+		if ($format) {
302
+			return $this->get_pretty('TXN_timestamp');
303
+		} else if ($gmt) {
304
+			return $this->get_raw('TXN_timestamp');
305 305
 		} else {
306
-			return $this->get( 'TXN_timestamp' );
306
+			return $this->get('TXN_timestamp');
307 307
 		}
308 308
 	}
309 309
 
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 	 * @param        boolean $get_cached   TRUE to retrieve cached registrations or FALSE to pull from the db
316 316
 	 * @return EE_Registration[]
317 317
 	 */
318
-	public function registrations( $query_params = array(), $get_cached = FALSE ) {
319
-		$query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params;
318
+	public function registrations($query_params = array(), $get_cached = FALSE) {
319
+		$query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params;
320 320
 		$query_params = $get_cached ? array() : $query_params;
321
-		return $this->get_many_related( 'Registration', $query_params );
321
+		return $this->get_many_related('Registration', $query_params);
322 322
 	}
323 323
 
324 324
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT'
330 330
 	 */
331 331
 	public function attendees() {
332
-		return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) );
332
+		return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID())));
333 333
 	}
334 334
 
335 335
 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param array $query_params like EEM_Base::get_all
340 340
 	 * @return EE_Payment[]
341 341
 	 */
342
-	public function payments( $query_params = array() ) {
343
-		return $this->get_many_related( 'Payment', $query_params );
342
+	public function payments($query_params = array()) {
343
+		return $this->get_many_related('Payment', $query_params);
344 344
 	}
345 345
 
346 346
 
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 	 * @return EE_Payment[]
351 351
 	 */
352 352
 	public function approved_payments() {
353
-		EE_Registry::instance()->load_model( 'Payment' );
354
-		return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) );
353
+		EE_Registry::instance()->load_model('Payment');
354
+		return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC')));
355 355
 	}
356 356
 
357 357
 
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 	 * @param bool $show_icons
362 362
 	 * @return string
363 363
 	 */
364
-	public function e_pretty_status( $show_icons = FALSE ) {
365
-		echo $this->pretty_status( $show_icons );
364
+	public function e_pretty_status($show_icons = FALSE) {
365
+		echo $this->pretty_status($show_icons);
366 366
 	}
367 367
 
368 368
 
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	 * @param bool $show_icons
373 373
 	 * @return string
374 374
 	 */
375
-	public function pretty_status( $show_icons = FALSE ) {
376
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
375
+	public function pretty_status($show_icons = FALSE) {
376
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
377 377
 		$icon = '';
378
-		switch ( $this->status_ID() ) {
378
+		switch ($this->status_ID()) {
379 379
 			case EEM_Transaction::complete_status_code:
380 380
 				$icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : '';
381 381
 				break;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				$icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : '';
393 393
 				break;
394 394
 		}
395
-		return $icon . $status[ $this->status_ID() ];
395
+		return $icon.$status[$this->status_ID()];
396 396
 	}
397 397
 
398 398
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @access        public
403 403
 	 */
404 404
 	public function status_ID() {
405
-		return $this->get( 'STS_ID' );
405
+		return $this->get('STS_ID');
406 406
 	}
407 407
 
408 408
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return boolean
413 413
 	 */
414 414
 	public function is_free() {
415
-		return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE;
415
+		return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE;
416 416
 	}
417 417
 
418 418
 
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 	 * @access public
481 481
 	 * @return string
482 482
 	 */
483
-	public function invoice_url( $type = 'html' ) {
483
+	public function invoice_url($type = 'html') {
484 484
 		$REG = $this->primary_registration();
485
-		if ( ! $REG instanceof EE_Registration ) {
485
+		if ( ! $REG instanceof EE_Registration) {
486 486
 			return '';
487 487
 		}
488
-		return $REG->invoice_url( $type );
488
+		return $REG->invoice_url($type);
489 489
 	}
490 490
 
491 491
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 * @return EE_Registration
496 496
 	 */
497 497
 	public function primary_registration() {
498
-		return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) );
498
+		return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
499 499
 	}
500 500
 
501 501
 
@@ -505,12 +505,12 @@  discard block
 block discarded – undo
505 505
 	 * @param string $type 'pdf' or 'html' (default is 'html')
506 506
 	 * @return string
507 507
 	 */
508
-	public function receipt_url( $type = 'html' ) {
508
+	public function receipt_url($type = 'html') {
509 509
 		$REG = $this->primary_registration();
510
-		if ( ! $REG instanceof EE_Registration ) {
510
+		if ( ! $REG instanceof EE_Registration) {
511 511
 			return '';
512 512
 		}
513
-		return $REG->receipt_url( $type );
513
+		return $REG->receipt_url($type);
514 514
 	}
515 515
 
516 516
 
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
 	 * @deprecated
536 536
 	 * @return boolean
537 537
 	 */
538
-	public function update_based_on_payments(){
538
+	public function update_based_on_payments() {
539 539
 		EE_Error::doing_it_wrong(
540
-			__CLASS__ . '::' . __FUNCTION__,
541
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
540
+			__CLASS__.'::'.__FUNCTION__,
541
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
542 542
 			'4.6.0'
543 543
 		);
544 544
 		/** @type EE_Transaction_Processor $transaction_processor */
545
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
546
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this );
545
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
546
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this);
547 547
 	}
548 548
 
549 549
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 	 * @return string
553 553
 	 */
554 554
 	public function gateway_response_on_transaction() {
555
-		$payment = $this->get_first_related( 'Payment' );
555
+		$payment = $this->get_first_related('Payment');
556 556
 		return $payment instanceof EE_Payment ? $payment->gateway_response() : '';
557 557
 	}
558 558
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return EE_Status
564 564
 	 */
565 565
 	public function status_obj() {
566
-		return $this->get_first_related( 'Status' );
566
+		return $this->get_first_related('Status');
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param array $query_params like EEM_Base::get_all
574 574
 	 * @return EE_Extra_Meta
575 575
 	 */
576
-	public function extra_meta( $query_params = array() ) {
577
-		return $this->get_many_related( 'Extra_Meta', $query_params );
576
+	public function extra_meta($query_params = array()) {
577
+		return $this->get_many_related('Extra_Meta', $query_params);
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Registration $registration
585 585
 	 * @return EE_Base_Class the relation was added to
586 586
 	 */
587
-	public function add_registration( EE_Registration $registration ) {
588
-		return $this->_add_relation_to( $registration, 'Registration' );
587
+	public function add_registration(EE_Registration $registration) {
588
+		return $this->_add_relation_to($registration, 'Registration');
589 589
 	}
590 590
 
591 591
 
@@ -596,8 +596,8 @@  discard block
 block discarded – undo
596 596
 	 * @param int $registration_or_id
597 597
 	 * @return EE_Base_Class that was removed from being related
598 598
 	 */
599
-	public function remove_registration_with_id( $registration_or_id ) {
600
-		return $this->_remove_relation_to( $registration_or_id, 'Registration' );
599
+	public function remove_registration_with_id($registration_or_id) {
600
+		return $this->_remove_relation_to($registration_or_id, 'Registration');
601 601
 	}
602 602
 
603 603
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	 * @return EE_Line_Item[]
608 608
 	 */
609 609
 	public function items_purchased() {
610
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) );
610
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item)));
611 611
 	}
612 612
 
613 613
 
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
 	 * @param EE_Line_Item $line_item
618 618
 	 * @return EE_Base_Class the relation was added to
619 619
 	 */
620
-	public function add_line_item( EE_Line_Item $line_item ) {
621
-		return $this->_add_relation_to( $line_item, 'Line_Item' );
620
+	public function add_line_item(EE_Line_Item $line_item) {
621
+		return $this->_add_relation_to($line_item, 'Line_Item');
622 622
 	}
623 623
 
624 624
 
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 * @param array $query_params
629 629
 	 * @return EE_Line_Item[]
630 630
 	 */
631
-	public function line_items( $query_params = array() ) {
632
-		return $this->get_many_related( 'Line_Item', $query_params );
631
+	public function line_items($query_params = array()) {
632
+		return $this->get_many_related('Line_Item', $query_params);
633 633
 	}
634 634
 
635 635
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 * @return EE_Line_Item[]
640 640
 	 */
641 641
 	public function tax_items() {
642
-		return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) );
642
+		return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax)));
643 643
 	}
644 644
 
645 645
 
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
 	 * @return EE_Line_Item
651 651
 	 */
652 652
 	public function total_line_item() {
653
-		$item =  $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) );
654
-		if( ! $item ){
655
-			EE_Registry::instance()->load_helper( 'Line_Item' );
656
-			$item = EEH_Line_Item::create_total_line_item( $this );
653
+		$item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total)));
654
+		if ( ! $item) {
655
+			EE_Registry::instance()->load_helper('Line_Item');
656
+			$item = EEH_Line_Item::create_total_line_item($this);
657 657
 		}
658 658
 		return $item;
659 659
 	}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function tax_total() {
669 669
 		$tax_line_item = $this->tax_total_line_item();
670
-		if ( $tax_line_item ) {
670
+		if ($tax_line_item) {
671 671
 			return $tax_line_item->total();
672 672
 		} else {
673 673
 			return 0;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 	 * @return EE_Line_Item
682 682
 	 */
683 683
 	public function tax_total_line_item() {
684
-		return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() );
684
+		return EEH_Line_Item::get_taxes_subtotal($this->total_line_item());
685 685
 	}
686 686
 
687 687
 
@@ -690,20 +690,20 @@  discard block
 block discarded – undo
690 690
 	 *  Gets the array of billing info for the gateway and for this transaction's primary registration's attendee.
691 691
 	 * @return EE_Form_Section_Proper
692 692
 	 */
693
-	public function billing_info(){
693
+	public function billing_info() {
694 694
 		$payment_method = $this->payment_method();
695
-		if ( !$payment_method){
695
+		if ( ! $payment_method) {
696 696
 			EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
697 697
 			return false;
698 698
 		}
699 699
 		$primary_reg = $this->primary_registration();
700
-		if ( ! $primary_reg ) {
701
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
700
+		if ( ! $primary_reg) {
701
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
702 702
 			return FALSE;
703 703
 		}
704 704
 		$attendee = $primary_reg->attendee();
705
-		if ( ! $attendee ) {
706
-			EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
705
+		if ( ! $attendee) {
706
+			EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
707 707
 			return FALSE;
708 708
 		}
709 709
 		return $attendee->billing_info_for_payment_method($payment_method);
@@ -738,15 +738,15 @@  discard block
 block discarded – undo
738 738
 	 * offline ones, dont' create payments)
739 739
 	 * @return EE_Payment_Method
740 740
 	 */
741
-	function payment_method(){
741
+	function payment_method() {
742 742
 		$pm = $this->get_first_related('Payment_Method');
743
-		if( $pm instanceof EE_Payment_Method ){
743
+		if ($pm instanceof EE_Payment_Method) {
744 744
 			return $pm;
745
-		}else{
745
+		} else {
746 746
 			$last_payment = $this->last_payment();
747
-			if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){
747
+			if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) {
748 748
 				return $last_payment->payment_method();
749
-			}else{
749
+			} else {
750 750
 				return NULL;
751 751
 			}
752 752
 		}
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
 	 * @return EE_Payment
758 758
 	 */
759 759
 	public function last_payment() {
760
-		return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) );
760
+		return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc')));
761 761
 	}
762 762
 
763 763
 	/**
764 764
 	 * Gets all the line items which are unrelated to tickets on this transaction
765 765
 	 * @return EE_Line_Item[]
766 766
 	 */
767
-	public function non_ticket_line_items(){
768
-		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() );
767
+	public function non_ticket_line_items() {
768
+		return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID());
769 769
 	}
770 770
 
771 771
 
Please login to merge, or discard this patch.
core/helpers/EEH_Line_Item.helper.php 2 patches
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * EEH_Line_Item
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 * @param boolean $code if set to a value, ensures there is only one line item with that code
41 41
 	 * @return boolean success
42 42
 	 */
43
-	public static function add_unrelated_item( EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL  ){
44
-		$items_subtotal = self::get_pre_tax_subtotal( $parent_line_item );
43
+	public static function add_unrelated_item(EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) {
44
+		$items_subtotal = self::get_pre_tax_subtotal($parent_line_item);
45 45
 		$line_item = EE_Line_Item::new_instance(array(
46 46
 			'LIN_name' => $name,
47 47
 			'LIN_desc' => $description,
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			'LIN_quantity' => $quantity,
50 50
 			'LIN_percent' => null,
51 51
 			'LIN_is_taxable' => $taxable,
52
-			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0,
53
-			'LIN_total' => floatval( $unit_price ) * intval( $quantity ),
52
+			'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0,
53
+			'LIN_total' => floatval($unit_price) * intval($quantity),
54 54
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
55 55
 			'LIN_code' => $code,
56 56
 		));
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			$line_item,
60 60
 			$parent_line_item
61 61
 		);
62
-		return self::add_item( $parent_line_item, $line_item );
62
+		return self::add_item($parent_line_item, $line_item);
63 63
 	}
64 64
 
65 65
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param boolean      $taxable
81 81
 	 * @return boolean success
82 82
 	 */
83
-	public static function add_percentage_based_item( EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE ){
83
+	public static function add_percentage_based_item(EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE) {
84 84
 		$line_item = EE_Line_Item::new_instance(array(
85 85
 			'LIN_name' => $name,
86 86
 			'LIN_desc' => $description,
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			'LIN_percent' => $percentage_amount,
89 89
 			'LIN_quantity' => NULL,
90 90
 			'LIN_is_taxable' => $taxable,
91
-			'LIN_total' => floatval( $percentage_amount * ( $parent_line_item->total() / 100 )),
91
+			'LIN_total' => floatval($percentage_amount * ($parent_line_item->total() / 100)),
92 92
 			'LIN_type'=>  EEM_Line_Item::type_line_item,
93 93
 			'LIN_parent' => $parent_line_item->ID()
94 94
 		));
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'FHEE__EEH_Line_Item__add_percentage_based_item__line_item',
97 97
 			$line_item
98 98
 		);
99
-		return self::add_item( $parent_line_item, $line_item );
99
+		return self::add_item($parent_line_item, $line_item);
100 100
 	}
101 101
 
102 102
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	 * @return \EE_Line_Item
118 118
 	 * @throws \EE_Error
119 119
 	 */
120
-	public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){
121
-		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) {
122
-			throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
120
+	public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
121
+		if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) {
122
+			throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
123 123
 		}
124 124
 		// either increment the qty for an existing ticket
125
-		$line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty );
125
+		$line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty);
126 126
 		// or add a new one
127
-		if ( ! $line_item instanceof EE_Line_Item ) {
128
-			$line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty );
127
+		if ( ! $line_item instanceof EE_Line_Item) {
128
+			$line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty);
129 129
 		}
130 130
 		$total_line_item->recalculate_total_including_taxes();
131 131
 		return $line_item;
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
 	 * @return \EE_Line_Item
142 142
 	 * @throws \EE_Error
143 143
 	 */
144
-	public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
144
+	public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
145 145
 		$line_item = null;
146
-		if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) {
147
-			$ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item );
148
-			foreach ( (array)$ticket_line_items as $ticket_line_item ) {
149
-				if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_ID() == $ticket->ID() ) {
146
+		if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) {
147
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item);
148
+			foreach ((array) $ticket_line_items as $ticket_line_item) {
149
+				if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_ID() == $ticket->ID()) {
150 150
 					$line_item = $ticket_line_item;
151 151
 					break;
152 152
 				}
153 153
 			}
154 154
 		}
155
-		if ( $line_item instanceof EE_Line_Item ) {
156
-			EEH_Line_Item::increment_quantity( $line_item, $qty );
155
+		if ($line_item instanceof EE_Line_Item) {
156
+			EEH_Line_Item::increment_quantity($line_item, $qty);
157 157
 			return $line_item;
158 158
 		}
159 159
 		return null;
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
 	 * @param int $qty
167 167
 	 * @return void
168 168
 	 */
169
-	public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) {
170
-		if( ! $line_item->is_percent() ) {
169
+	public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) {
170
+		if ( ! $line_item->is_percent()) {
171 171
 			$qty += $line_item->quantity();
172
-			$line_item->set_quantity( $qty );
173
-			$line_item->set_total( $line_item->unit_price() * $qty );
172
+			$line_item->set_quantity($qty);
173
+			$line_item->set_total($line_item->unit_price() * $qty);
174 174
 		}
175
-		foreach( $line_item->children() as $child ) {
176
-			if( $child->is_sub_line_item() ) {
177
-				EEH_Line_Item::update_quantity( $child, $line_item->quantity() );
175
+		foreach ($line_item->children() as $child) {
176
+			if ($child->is_sub_line_item()) {
177
+				EEH_Line_Item::update_quantity($child, $line_item->quantity());
178 178
 			}
179 179
 		}
180 180
 	}
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 * @param EE_Line_Item $line_item
186 186
 	 * @param int $new_quantity
187 187
 	 */
188
-	public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) {
189
-		if( ! $line_item->is_percent() ) {
190
-			$line_item->set_quantity( $new_quantity );
191
-			$line_item->set_total( $line_item->unit_price() * $new_quantity );
188
+	public static function update_quantity(EE_Line_Item $line_item, $new_quantity) {
189
+		if ( ! $line_item->is_percent()) {
190
+			$line_item->set_quantity($new_quantity);
191
+			$line_item->set_total($line_item->unit_price() * $new_quantity);
192 192
 		}
193
-		foreach( $line_item->children() as $child ) {
194
-			if( $child->is_sub_line_item() ) {
195
-				EEH_Line_Item::update_quantity( $child, $new_quantity );
193
+		foreach ($line_item->children() as $child) {
194
+			if ($child->is_sub_line_item()) {
195
+				EEH_Line_Item::update_quantity($child, $new_quantity);
196 196
 			}
197 197
 		}
198 198
 	}
@@ -207,45 +207,45 @@  discard block
 block discarded – undo
207 207
 	 * @return \EE_Line_Item
208 208
 	 * @throws \EE_Error
209 209
 	 */
210
-	public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) {
210
+	public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) {
211 211
 		$datetimes = $ticket->datetimes();
212
-		$first_datetime = reset( $datetimes );
213
-		if( $first_datetime instanceof EE_Datetime &&
214
-				$first_datetime->event() instanceof EE_Event ) {
212
+		$first_datetime = reset($datetimes);
213
+		if ($first_datetime instanceof EE_Datetime &&
214
+				$first_datetime->event() instanceof EE_Event) {
215 215
 			$first_datetime_name = $first_datetime->event()->name();
216 216
 		} else {
217
-			$first_datetime_name = __( 'Event', 'event_espresso' );
217
+			$first_datetime_name = __('Event', 'event_espresso');
218 218
 		}
219
-		$event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name );
219
+		$event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name);
220 220
 		// get event subtotal line
221
-		$events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket );
222
-		if ( ! $events_sub_total instanceof EE_Line_Item ) {
223
-			throw new EE_Error( sprintf( __( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) );
221
+		$events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket);
222
+		if ( ! $events_sub_total instanceof EE_Line_Item) {
223
+			throw new EE_Error(sprintf(__('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'), $ticket->ID(), $total_line_item->ID()));
224 224
 		}
225 225
 		// add $ticket to cart
226
-		$line_item = EE_Line_Item::new_instance( array(
226
+		$line_item = EE_Line_Item::new_instance(array(
227 227
 			'LIN_name'       	=> $ticket->name(),
228
-			'LIN_desc'       		=> $ticket->description() != '' ? $ticket->description() . ' ' . $event : $event,
228
+			'LIN_desc'       		=> $ticket->description() != '' ? $ticket->description().' '.$event : $event,
229 229
 			'LIN_unit_price' 	=> $ticket->price(),
230 230
 			'LIN_quantity'   	=> $qty,
231 231
 			'LIN_is_taxable' 	=> $ticket->taxable(),
232
-			'LIN_order'      	=> count( $events_sub_total->children() ),
232
+			'LIN_order'      	=> count($events_sub_total->children()),
233 233
 			'LIN_total'      		=> $ticket->price() * $qty,
234 234
 			'LIN_type'       		=> EEM_Line_Item::type_line_item,
235 235
 			'OBJ_ID'         		=> $ticket->ID(),
236 236
 			'OBJ_type'       	=> 'Ticket'
237
-		) );
237
+		));
238 238
 		$line_item = apply_filters(
239 239
 			'FHEE__EEH_Line_Item__create_ticket_line_item__line_item',
240 240
 			$line_item
241 241
 		);
242
-		$events_sub_total->add_child_line_item( $line_item );
242
+		$events_sub_total->add_child_line_item($line_item);
243 243
 		//now add the sub-line items
244 244
 		$running_total_for_ticket = 0;
245
-		foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) {
245
+		foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) {
246 246
 			$sign = $price->is_discount() ? -1 : 1;
247 247
 			$price_total = $price->is_percent() ? $running_total_for_ticket * $price->amount() / 100 : $price->amount() * $qty;
248
-			$sub_line_item = EE_Line_Item::new_instance( array(
248
+			$sub_line_item = EE_Line_Item::new_instance(array(
249 249
 				'LIN_name'       	=> $price->name(),
250 250
 				'LIN_desc'       		=> $price->desc(),
251 251
 				'LIN_quantity'   	=> $price->is_percent() ? null : $qty,
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 				'LIN_type'       		=> EEM_Line_Item::type_sub_line_item,
256 256
 				'OBJ_ID'         		=> $price->ID(),
257 257
 				'OBJ_type'       	=> 'Price'
258
-			) );
258
+			));
259 259
 			$sub_line_item = apply_filters(
260 260
 				'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item',
261 261
 				$sub_line_item
262 262
 			);
263
-			if ( $price->is_percent() ) {
264
-				$sub_line_item->set_percent( $sign * $price->amount() );
263
+			if ($price->is_percent()) {
264
+				$sub_line_item->set_percent($sign * $price->amount());
265 265
 			} else {
266
-				$sub_line_item->set_unit_price( $sign * $price->amount() );
266
+				$sub_line_item->set_unit_price($sign * $price->amount());
267 267
 			}
268 268
 			$running_total_for_ticket += $price_total;
269
-			$line_item->add_child_line_item( $sub_line_item );
269
+			$line_item->add_child_line_item($sub_line_item);
270 270
 		}
271 271
 		return $line_item;
272 272
 	}
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 	 * @param EE_Line_Item $item to be added
285 285
 	 * @return boolean
286 286
 	 */
287
-	public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){
288
-		$pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item );
289
-		if ( $pre_tax_subtotal instanceof EE_Line_Item ){
287
+	public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) {
288
+		$pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item);
289
+		if ($pre_tax_subtotal instanceof EE_Line_Item) {
290 290
 			$success = $pre_tax_subtotal->add_child_line_item($item);
291
-		}else{
291
+		} else {
292 292
 			return FALSE;
293 293
 		}
294 294
 		$total_line_item->recalculate_total_including_taxes();
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
303 303
 	 *	@return \EE_Line_Item
304 304
 	 */
305
-	public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){
306
-		$pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' );
307
-		return $pre_tax_subtotal instanceof EE_Line_Item ? $pre_tax_subtotal : self::create_pre_tax_subtotal( $total_line_item );
305
+	public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) {
306
+		$pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal');
307
+		return $pre_tax_subtotal instanceof EE_Line_Item ? $pre_tax_subtotal : self::create_pre_tax_subtotal($total_line_item);
308 308
 	}
309 309
 
310 310
 
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
315 315
 	 * @return \EE_Line_Item
316 316
 	 */
317
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){
318
-		$taxes = $total_line_item->get_child_line_item( 'taxes' );
319
-		return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item );
317
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item) {
318
+		$taxes = $total_line_item->get_child_line_item('taxes');
319
+		return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item);
320 320
 	}
321 321
 
322 322
 
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Transaction $transaction
328 328
 	 * @return void
329 329
 	 */
330
-	public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){
331
-		if( $transaction ){
330
+	public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) {
331
+		if ($transaction) {
332 332
 			/** @type EEM_Transaction $EEM_Transaction */
333
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
334
-			$transaction = $EEM_Transaction->ensure_is_ID( $transaction );
335
-			$line_item->set_TXN_ID( $transaction );
333
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
334
+			$transaction = $EEM_Transaction->ensure_is_ID($transaction);
335
+			$line_item->set_TXN_ID($transaction);
336 336
 		}
337 337
 	}
338 338
 
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @param EE_Transaction $transaction
346 346
 	 * @return \EE_Line_Item of type total
347 347
 	 */
348
-	public static function create_total_line_item( $transaction = NULL ){
349
-		$total_line_item = EE_Line_Item::new_instance( array(
348
+	public static function create_total_line_item($transaction = NULL) {
349
+		$total_line_item = EE_Line_Item::new_instance(array(
350 350
 			'LIN_code'	=> 'total',
351 351
 			'LIN_name'	=> __('Grand Total', 'event_espresso'),
352 352
 			'LIN_type'	=> EEM_Line_Item::type_total,
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 			'FHEE__EEH_Line_Item__create_total_line_item__total_line_item',
357 357
 			$total_line_item
358 358
 		);
359
-		self::set_TXN_ID( $total_line_item, $transaction );
360
-		self::create_pre_tax_subtotal( $total_line_item, $transaction );
361
-		self::create_taxes_subtotal( $total_line_item, $transaction );
359
+		self::set_TXN_ID($total_line_item, $transaction);
360
+		self::create_pre_tax_subtotal($total_line_item, $transaction);
361
+		self::create_taxes_subtotal($total_line_item, $transaction);
362 362
 		return $total_line_item;
363 363
 	}
364 364
 
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 	 * @param EE_Transaction $transaction
371 371
 	 * @return EE_Line_Item
372 372
 	 */
373
-	protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
374
-		$pre_tax_line_item = EE_Line_Item::new_instance( array(
373
+	protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
374
+		$pre_tax_line_item = EE_Line_Item::new_instance(array(
375 375
 			'LIN_code' 	=> 'pre-tax-subtotal',
376
-			'LIN_name' 	=> __( 'Pre-Tax Subtotal', 'event_espresso' ),
376
+			'LIN_name' 	=> __('Pre-Tax Subtotal', 'event_espresso'),
377 377
 			'LIN_type' 	=> EEM_Line_Item::type_sub_total
378
-		) );
378
+		));
379 379
 		$pre_tax_line_item = apply_filters(
380 380
 			'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item',
381 381
 			$pre_tax_line_item
382 382
 		);
383
-		self::set_TXN_ID( $pre_tax_line_item, $transaction );
384
-		$total_line_item->add_child_line_item( $pre_tax_line_item );
385
-		self::create_event_subtotal( $pre_tax_line_item, $transaction );
383
+		self::set_TXN_ID($pre_tax_line_item, $transaction);
384
+		$total_line_item->add_child_line_item($pre_tax_line_item);
385
+		self::create_event_subtotal($pre_tax_line_item, $transaction);
386 386
 		return $pre_tax_line_item;
387 387
 	}
388 388
 
@@ -395,21 +395,21 @@  discard block
 block discarded – undo
395 395
 	 * @param EE_Transaction $transaction
396 396
 	 * @return EE_Line_Item
397 397
 	 */
398
-	protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){
398
+	protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
399 399
 		$tax_line_item = EE_Line_Item::new_instance(array(
400 400
 			'LIN_code'	=> 'taxes',
401 401
 			'LIN_name' 	=> __('Taxes', 'event_espresso'),
402 402
 			'LIN_type'	=> EEM_Line_Item::type_tax_sub_total,
403
-			'LIN_order' => 1000,//this should always come last
403
+			'LIN_order' => 1000, //this should always come last
404 404
 		));
405 405
 		$tax_line_item = apply_filters(
406 406
 			'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item',
407 407
 			$tax_line_item
408 408
 		);
409
-		self::set_TXN_ID( $tax_line_item, $transaction );
410
-		$total_line_item->add_child_line_item( $tax_line_item );
409
+		self::set_TXN_ID($tax_line_item, $transaction);
410
+		$total_line_item->add_child_line_item($tax_line_item);
411 411
 		//and lastly, add the actual taxes
412
-		self::apply_taxes( $total_line_item );
412
+		self::apply_taxes($total_line_item);
413 413
 		return $tax_line_item;
414 414
 	}
415 415
 
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
 	 * @param EE_Event $event
423 423
 	 * @return EE_Line_Item
424 424
 	 */
425
-	public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){
425
+	public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) {
426 426
 		$event_line_item = EE_Line_Item::new_instance(array(
427
-			'LIN_code'	=> self::get_event_code( $event ),
428
-			'LIN_name' 	=> self::get_event_name( $event ),
429
-			'LIN_desc' 	=> self::get_event_desc( $event ),
427
+			'LIN_code'	=> self::get_event_code($event),
428
+			'LIN_name' 	=> self::get_event_name($event),
429
+			'LIN_desc' 	=> self::get_event_desc($event),
430 430
 			'LIN_type'	=> EEM_Line_Item::type_sub_total,
431 431
 			'OBJ_type' 	=> 'Event',
432 432
 			'OBJ_ID' 		=>  $event instanceof EE_Event ? $event->ID() : 0
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 			'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item',
436 436
 			$event_line_item
437 437
 		);
438
-		self::set_TXN_ID( $event_line_item, $transaction );
439
-		$pre_tax_line_item->add_child_line_item( $event_line_item );
438
+		self::set_TXN_ID($event_line_item, $transaction);
439
+		$pre_tax_line_item->add_child_line_item($event_line_item);
440 440
 		return $event_line_item;
441 441
 	}
442 442
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	 * @param EE_Event $event
446 446
 	 * @return string
447 447
 	 */
448
-	public static function get_event_code( $event ) {
449
-		return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' );
448
+	public static function get_event_code($event) {
449
+		return 'event-'.($event instanceof EE_Event ? $event->ID() : '0');
450 450
 	}
451 451
 
452 452
 	/**
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param EE_Event $event
455 455
 	 * @return string
456 456
 	 */
457
-	public static function get_event_name( $event ) {
458
-		return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' );
457
+	public static function get_event_name($event) {
458
+		return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso');
459 459
 	}
460 460
 
461 461
 	/**
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 * @param EE_Event $event
464 464
 	 * @return string
465 465
 	 */
466
-	public static function get_event_desc( $event ) {
466
+	public static function get_event_desc($event) {
467 467
 		return $event instanceof EE_Event ? $event->short_description() : '';
468 468
 	}
469 469
 
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
 	  * @throws \EE_Error
478 478
 	  * @return EE_Line_Item
479 479
 	  */
480
-	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
480
+	public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) {
481 481
 		$first_datetime = $ticket->first_datetime();
482
-		if( ! $first_datetime instanceof EE_Datetime ){
483
-			throw new EE_Error( sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() ) );
482
+		if ( ! $first_datetime instanceof EE_Datetime) {
483
+			throw new EE_Error(sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID()));
484 484
 		}
485 485
 		$event = $first_datetime->event();
486
-		if ( ! $event instanceof EE_Event ) {
487
-			throw new EE_Error( sprintf( __( 'The supplied ticket (ID %d) has no event data associated with it.','event_espresso' ), $ticket->ID() ) );
486
+		if ( ! $event instanceof EE_Event) {
487
+			throw new EE_Error(sprintf(__('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'), $ticket->ID()));
488 488
 		}
489
-		return EEH_Line_Item::get_event_line_item( $grand_total, $event );
489
+		return EEH_Line_Item::get_event_line_item($grand_total, $event);
490 490
 	}
491 491
 
492 492
 	/**
@@ -495,31 +495,31 @@  discard block
 block discarded – undo
495 495
 	 * @param EE_Event $event
496 496
 	 * @return EE_Line_Item for the event subtotal which is a child of $grand_total
497 497
 	 */
498
-	public static function get_event_line_item( EE_Line_Item $grand_total, $event ) {
498
+	public static function get_event_line_item(EE_Line_Item $grand_total, $event) {
499 499
 		/** @type EE_Event $event */
500
-		$event = EEM_Event::instance()->ensure_is_obj( $event, true );
500
+		$event = EEM_Event::instance()->ensure_is_obj($event, true);
501 501
 		$event_line_item = NULL;
502 502
 		$found = false;
503
-		foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) {
503
+		foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) {
504 504
 			// default event subtotal, we should only ever find this the first time this method is called
505
-			if ( ! $event_line_item->OBJ_ID() ) {
505
+			if ( ! $event_line_item->OBJ_ID()) {
506 506
 				// let's use this! but first... set the event details
507
-				EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
507
+				EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
508 508
 				$found = true;
509 509
 				break;
510
-			} else if ( $event_line_item->OBJ_ID() === $event->ID() ) {
510
+			} else if ($event_line_item->OBJ_ID() === $event->ID()) {
511 511
 				// found existing line item for this event in the cart, so break out of loop and use this one
512 512
 				$found = true;
513 513
 				break;
514 514
 			}
515 515
 		}
516
-		if ( ! $found ) {
516
+		if ( ! $found) {
517 517
 			//there is no event sub-total yet, so add it
518
-			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
518
+			$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total);
519 519
 			// create a new "event" subtotal below that
520
-			$event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event );
520
+			$event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event);
521 521
 			// and set the event details
522
-			EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event );
522
+			EEH_Line_Item::set_event_subtotal_details($event_line_item, $event);
523 523
 		}
524 524
 		return $event_line_item;
525 525
 	}
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
 	 * @param EE_Transaction $transaction
534 534
 	 * @return EE_Line_Item
535 535
 	 */
536
-	public static function set_event_subtotal_details( EE_Line_Item $event_line_item, EE_Event $event, $transaction = NULL ){
537
-		if ( $event instanceof EE_Event ) {
538
-			$event_line_item->set_code( self::get_event_code( $event ) );
539
-			$event_line_item->set_name( self::get_event_name( $event ) );
540
-			$event_line_item->set_desc( self::get_event_desc( $event ) );
541
-			$event_line_item->set_OBJ_ID( $event->ID() );
536
+	public static function set_event_subtotal_details(EE_Line_Item $event_line_item, EE_Event $event, $transaction = NULL) {
537
+		if ($event instanceof EE_Event) {
538
+			$event_line_item->set_code(self::get_event_code($event));
539
+			$event_line_item->set_name(self::get_event_name($event));
540
+			$event_line_item->set_desc(self::get_event_desc($event));
541
+			$event_line_item->set_OBJ_ID($event->ID());
542 542
 		}
543
-		self::set_TXN_ID( $event_line_item, $transaction );
543
+		self::set_TXN_ID($event_line_item, $transaction);
544 544
 	}
545 545
 
546 546
 
@@ -551,19 +551,19 @@  discard block
 block discarded – undo
551 551
 	 * any old taxes are removed
552 552
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
553 553
 	 */
554
-	public static function apply_taxes( EE_Line_Item $total_line_item ){
554
+	public static function apply_taxes(EE_Line_Item $total_line_item) {
555 555
 		/** @type EEM_Price $EEM_Price */
556
-		$EEM_Price = EE_Registry::instance()->load_model( 'Price' );
556
+		$EEM_Price = EE_Registry::instance()->load_model('Price');
557 557
 		// get array of taxes via Price Model
558 558
 		$ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes();
559
-		ksort( $ordered_taxes );
560
-		$taxes_line_item = self::get_taxes_subtotal( $total_line_item );
559
+		ksort($ordered_taxes);
560
+		$taxes_line_item = self::get_taxes_subtotal($total_line_item);
561 561
 		//just to be safe, remove its old tax line items
562 562
 		$taxes_line_item->delete_children_line_items();
563 563
 		//loop thru taxes
564
-		foreach ( $ordered_taxes as $order => $taxes ) {
565
-			foreach ( $taxes as $tax ) {
566
-				if ( $tax instanceof EE_Price ) {
564
+		foreach ($ordered_taxes as $order => $taxes) {
565
+			foreach ($taxes as $tax) {
566
+				if ($tax instanceof EE_Price) {
567 567
 					$tax_line_item = EE_Line_Item::new_instance(
568 568
 						array(
569 569
 							'LIN_name'       => $tax->name(),
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 						'FHEE__EEH_Line_Item__apply_taxes__tax_line_item',
582 582
 						$tax_line_item
583 583
 					);
584
-					$taxes_line_item->add_child_line_item( $tax_line_item );
584
+					$taxes_line_item->add_child_line_item($tax_line_item);
585 585
 				}
586 586
 			}
587 587
 		}
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
597 597
 	 * @return float
598 598
 	 */
599
-	public static function ensure_taxes_applied( $total_line_item ){
600
-		$taxes_subtotal = self::get_taxes_subtotal( $total_line_item );
601
-		if( ! $taxes_subtotal->children()){
602
-			self::apply_taxes( $total_line_item );
599
+	public static function ensure_taxes_applied($total_line_item) {
600
+		$taxes_subtotal = self::get_taxes_subtotal($total_line_item);
601
+		if ( ! $taxes_subtotal->children()) {
602
+			self::apply_taxes($total_line_item);
603 603
 		}
604 604
 		return $taxes_subtotal->total();
605 605
 	}
@@ -612,16 +612,16 @@  discard block
 block discarded – undo
612 612
 	 * @param EE_Line_Item $parent_line_item
613 613
 	 * @return bool
614 614
 	 */
615
-	public static function delete_all_child_items( EE_Line_Item $parent_line_item ) {
615
+	public static function delete_all_child_items(EE_Line_Item $parent_line_item) {
616 616
 		$deleted = 0;
617
-		foreach ( $parent_line_item->children() as $child_line_item ) {
618
-			if ( $child_line_item instanceof EE_Line_Item ) {
619
-				$deleted += EEH_Line_Item::delete_all_child_items( $child_line_item );
620
-				if ( $child_line_item->ID() ) {
617
+		foreach ($parent_line_item->children() as $child_line_item) {
618
+			if ($child_line_item instanceof EE_Line_Item) {
619
+				$deleted += EEH_Line_Item::delete_all_child_items($child_line_item);
620
+				if ($child_line_item->ID()) {
621 621
 					$child_line_item->delete();
622
-					unset( $child_line_item );
622
+					unset($child_line_item);
623 623
 				} else {
624
-					$parent_line_item->delete_child_line_item( $child_line_item->code() );
624
+					$parent_line_item->delete_child_line_item($child_line_item->code());
625 625
 				}
626 626
 				$deleted++;
627 627
 			}
@@ -643,25 +643,25 @@  discard block
 block discarded – undo
643 643
 	 * @param array|bool|string $line_item_codes
644 644
 	 * @return int number of items successfully removed
645 645
 	 */
646
-	public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) {
646
+	public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) {
647 647
 
648
-		if( $total_line_item->type() != EEM_Line_Item::type_total ){
649
-			EE_Error::doing_it_wrong('EEH_Line_Item::delete_items', __( 'This static method should only be called with a TOTAL line item, otherwise we won\'t recalculate the totals correctly', 'event_espresso' ), '4.6.18' );
648
+		if ($total_line_item->type() != EEM_Line_Item::type_total) {
649
+			EE_Error::doing_it_wrong('EEH_Line_Item::delete_items', __('This static method should only be called with a TOTAL line item, otherwise we won\'t recalculate the totals correctly', 'event_espresso'), '4.6.18');
650 650
 		}
651
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
651
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
652 652
 
653 653
 		// check if only a single line_item_id was passed
654
-		if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) {
654
+		if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) {
655 655
 			// place single line_item_id in an array to appear as multiple line_item_ids
656
-			$line_item_codes = array ( $line_item_codes );
656
+			$line_item_codes = array($line_item_codes);
657 657
 		}
658 658
 		$removals = 0;
659 659
 		// cycle thru line_item_ids
660
-		foreach ( $line_item_codes as $line_item_id ) {
660
+		foreach ($line_item_codes as $line_item_id) {
661 661
 			$removals += $total_line_item->delete_child_line_item($line_item_id);
662 662
 		}
663 663
 
664
-		if ( $removals > 0 ) {
664
+		if ($removals > 0) {
665 665
 			$total_line_item->recalculate_taxes_and_tax_total();
666 666
 			return $removals;
667 667
 		} else {
@@ -684,32 +684,32 @@  discard block
 block discarded – undo
684 684
 	 *                                           $amount will be added onto it; otherwise will simply set the taxes to match $amount
685 685
 	 * @return EE_Line_Item the new tax line item created
686 686
 	 */
687
-	public static function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false ){
688
-            $tax_subtotal = self::get_taxes_subtotal( $total_line_item );
687
+	public static function set_total_tax_to(EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false) {
688
+            $tax_subtotal = self::get_taxes_subtotal($total_line_item);
689 689
             $taxable_total = $total_line_item->taxable_total();
690 690
 
691
-            if( $add_to_existing_line_item ) {
692
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
693
-                EEM_Line_Item::instance()->delete( array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) );
691
+            if ($add_to_existing_line_item) {
692
+                $new_tax = $tax_subtotal->get_child_line_item($code);
693
+                EEM_Line_Item::instance()->delete(array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID())));
694 694
             } else {
695 695
                 $new_tax = null;
696 696
                 $tax_subtotal->delete_children_line_items();
697 697
             }
698
-            if( $new_tax ) {
699
-                $new_tax->set_total( $new_tax->total() + $amount );
700
-                $new_tax->set_percent( $taxable_total ? ( $new_tax->total() ) / $taxable_total * 100 : 0 );
698
+            if ($new_tax) {
699
+                $new_tax->set_total($new_tax->total() + $amount);
700
+                $new_tax->set_percent($taxable_total ? ($new_tax->total()) / $taxable_total * 100 : 0);
701 701
             } else {
702 702
                 //no existing tax item. Create it
703
-				$new_tax = EE_Line_Item::new_instance( array(
703
+				$new_tax = EE_Line_Item::new_instance(array(
704 704
 					'TXN_ID'      => $total_line_item->TXN_ID(),
705
-					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
705
+					'LIN_name'    => $name ? $name : __('Tax', 'event_espresso'),
706 706
 					'LIN_desc'    => $description ? $description : '',
707
-					'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0,
707
+					'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0,
708 708
 					'LIN_total'   => $amount,
709 709
 					'LIN_parent'  => $tax_subtotal->ID(),
710 710
 					'LIN_type'    => EEM_Line_Item::type_tax,
711 711
 					'LIN_code'    => $code
712
-				) );
712
+				));
713 713
 			}
714 714
 
715 715
             $new_tax = apply_filters(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 				$total_line_item
719 719
             );
720 720
             $new_tax->save();
721
-            $tax_subtotal->set_total( $new_tax->total() );
721
+            $tax_subtotal->set_total($new_tax->total());
722 722
             $tax_subtotal->save();
723 723
             $total_line_item->recalculate_total_including_taxes();
724 724
             return $new_tax;
@@ -734,17 +734,17 @@  discard block
 block discarded – undo
734 734
 	 *  it will be whitelisted (ie, except from becoming taxable)
735 735
 	 * @param boolean $taxable
736 736
 	 */
737
-	public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null ) {
738
-		if( $code_substring_for_whitelist !== null ) {
739
-			$whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false;
737
+	public static function set_line_items_taxable(EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null) {
738
+		if ($code_substring_for_whitelist !== null) {
739
+			$whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false;
740 740
 		} else {
741 741
 			$whitelisted = false;
742 742
 		}
743
-		if( $line_item->is_line_item() && ! $whitelisted ) {
744
-			$line_item->set_is_taxable( $taxable );
743
+		if ($line_item->is_line_item() && ! $whitelisted) {
744
+			$line_item->set_is_taxable($taxable);
745 745
 		}
746
-		foreach( $line_item->children() as $child_line_item ) {
747
-			EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist );
746
+		foreach ($line_item->children() as $child_line_item) {
747
+			EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist);
748 748
 		}
749 749
 	}
750 750
 
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
758 758
 	 * @return EE_Line_Item[]
759 759
 	 */
760
-	public static function get_event_subtotals( EE_Line_Item $parent_line_item ) {
761
-		return self::get_subtotals_of_object_type( $parent_line_item, 'Event' );
760
+	public static function get_event_subtotals(EE_Line_Item $parent_line_item) {
761
+		return self::get_subtotals_of_object_type($parent_line_item, 'Event');
762 762
 	}
763 763
 
764 764
 
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
 	 * @param string $obj_type
772 772
 	 * @return EE_Line_Item[]
773 773
 	 */
774
-	public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
775
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_sub_total, $obj_type );
774
+	public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
775
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_sub_total, $obj_type);
776 776
 	}
777 777
 
778 778
 
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
785 785
 	 * @return EE_Line_Item[]
786 786
 	 */
787
-	public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) {
788
-		return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' );
787
+	public static function get_ticket_line_items(EE_Line_Item $parent_line_item) {
788
+		return self::get_line_items_of_object_type($parent_line_item, 'Ticket');
789 789
 	}
790 790
 
791 791
 
@@ -798,8 +798,8 @@  discard block
 block discarded – undo
798 798
 	 * @param string $obj_type
799 799
 	 * @return EE_Line_Item[]
800 800
 	 */
801
-	public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) {
802
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type );
801
+	public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') {
802
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type);
803 803
 	}
804 804
 
805 805
 
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
811 811
 	 * @return EE_Line_Item[]
812 812
 	 */
813
-	public static function get_tax_descendants( EE_Line_Item $parent_line_item ) {
814
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax );
813
+	public static function get_tax_descendants(EE_Line_Item $parent_line_item) {
814
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax);
815 815
 	}
816 816
 
817 817
 
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
 	 * @param \EE_Line_Item $parent_line_item - the line item to find descendants of
823 823
 	 * @return EE_Line_Item[]
824 824
 	 */
825
-	public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) {
826
-		return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item );
825
+	public static function get_line_item_descendants(EE_Line_Item $parent_line_item) {
826
+		return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item);
827 827
 	}
828 828
 
829 829
 
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	 * @param string $line_item_type one of the EEM_Line_Item constants
837 837
 	 * @return EE_Line_Item[]
838 838
 	 */
839
-	public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) {
840
-		return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL );
839
+	public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) {
840
+		return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL);
841 841
 	}
842 842
 
843 843
 
@@ -850,15 +850,15 @@  discard block
 block discarded – undo
850 850
 	 * @param string | NULL $obj_type object model class name (minus prefix) or NULL to ignore object type when searching
851 851
 	 * @return EE_Line_Item[]
852 852
 	 */
853
-	protected static function _get_descendants_by_type_and_object_type( EE_Line_Item $parent_line_item, $line_item_type, $obj_type = NULL ) {
853
+	protected static function _get_descendants_by_type_and_object_type(EE_Line_Item $parent_line_item, $line_item_type, $obj_type = NULL) {
854 854
 		$objects = array();
855
-		foreach ( $parent_line_item->children() as $child_line_item ) {
856
-			if ( $child_line_item instanceof EE_Line_Item ) {
857
-				if ( $child_line_item->type() == $line_item_type && ( $child_line_item->OBJ_type() == $obj_type || $obj_type === NULL )) {
855
+		foreach ($parent_line_item->children() as $child_line_item) {
856
+			if ($child_line_item instanceof EE_Line_Item) {
857
+				if ($child_line_item->type() == $line_item_type && ($child_line_item->OBJ_type() == $obj_type || $obj_type === NULL)) {
858 858
 					$objects[] = $child_line_item;
859 859
 				} else {
860 860
 					//go-through-all-its children looking for more matches
861
-					$objects = array_merge( $objects, self::_get_descendants_by_type_and_object_type( $child_line_item, $line_item_type, $obj_type ));
861
+					$objects = array_merge($objects, self::_get_descendants_by_type_and_object_type($child_line_item, $line_item_type, $obj_type));
862 862
 				}
863 863
 			}
864 864
 		}
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	 * @param array $OBJ_IDs array of OBJ_IDs
877 877
 	 * @return EE_Line_Item[]
878 878
 	 */
879
-	public static function get_line_items_by_object_type_and_IDs( EE_Line_Item $parent_line_item, $OBJ_type = '', $OBJ_IDs = array() ) {
880
-		return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs );
879
+	public static function get_line_items_by_object_type_and_IDs(EE_Line_Item $parent_line_item, $OBJ_type = '', $OBJ_IDs = array()) {
880
+		return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs);
881 881
 	}
882 882
 
883 883
 
@@ -890,15 +890,15 @@  discard block
 block discarded – undo
890 890
 	 * @param array $OBJ_IDs array of OBJ_IDs
891 891
 	 * @return EE_Line_Item[]
892 892
 	 */
893
-	protected static function _get_descendants_by_object_type_and_object_ID( EE_Line_Item $parent_line_item, $OBJ_type, $OBJ_IDs ) {
893
+	protected static function _get_descendants_by_object_type_and_object_ID(EE_Line_Item $parent_line_item, $OBJ_type, $OBJ_IDs) {
894 894
 		$objects = array();
895
-		foreach ( $parent_line_item->children() as $child_line_item ) {
896
-			if ( $child_line_item instanceof EE_Line_Item ) {
897
-				if ( is_array( $OBJ_IDs ) && $child_line_item->OBJ_type() == $OBJ_type && in_array( $child_line_item->OBJ_ID(), $OBJ_IDs )) {
895
+		foreach ($parent_line_item->children() as $child_line_item) {
896
+			if ($child_line_item instanceof EE_Line_Item) {
897
+				if (is_array($OBJ_IDs) && $child_line_item->OBJ_type() == $OBJ_type && in_array($child_line_item->OBJ_ID(), $OBJ_IDs)) {
898 898
 					$objects[] = $child_line_item;
899 899
 				} else {
900 900
 					//go-through-all-its children looking for more matches
901
-					$objects = array_merge( $objects, self::_get_descendants_by_object_type_and_object_ID( $child_line_item, $OBJ_type, $OBJ_IDs ));
901
+					$objects = array_merge($objects, self::_get_descendants_by_object_type_and_object_ID($child_line_item, $OBJ_type, $OBJ_IDs));
902 902
 				}
903 903
 			}
904 904
 		}
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 	 * @param string $type like one of the EEM_Line_Item::type_*
917 917
 	 * @return EE_Line_Item
918 918
 	 */
919
-	public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) {
920
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type );
919
+	public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) {
920
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type);
921 921
 	}
922 922
 
923 923
 
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
 	 * @param string $code any value used for LIN_code
931 931
 	 * @return EE_Line_Item
932 932
 	 */
933
-	public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) {
934
-		return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code );
933
+	public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) {
934
+		return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code);
935 935
 	}
936 936
 
937 937
 
@@ -944,15 +944,15 @@  discard block
 block discarded – undo
944 944
 	 * @param string $value any value stored in $search_field
945 945
 	 * @return EE_Line_Item
946 946
 	 */
947
-	protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) {
948
-		foreach( $parent_line_item->children() as $child ){
949
-			if ( $child->get( $search_field ) == $value ){
947
+	protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) {
948
+		foreach ($parent_line_item->children() as $child) {
949
+			if ($child->get($search_field) == $value) {
950 950
 				return $child;
951 951
 			}
952 952
 		}
953
-		foreach( $parent_line_item->children() as $child ){
954
-			$descendant_found = self::_get_nearest_descendant( $child, $search_field, $value );
955
-			if ( $descendant_found ){
953
+		foreach ($parent_line_item->children() as $child) {
954
+			$descendant_found = self::_get_nearest_descendant($child, $search_field, $value);
955
+			if ($descendant_found) {
956 956
 				return $descendant_found;
957 957
 			}
958 958
 		}
@@ -968,22 +968,22 @@  discard block
 block discarded – undo
968 968
 	 * @param int $indentation
969 969
 	 * @return void
970 970
 	 */
971
-	public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){
971
+	public static function visualize(EE_Line_Item $line_item, $indentation = 0) {
972 972
 		echo "\n<br />";
973
-		for( $i = 0; $i < $indentation; $i++ ){
973
+		for ($i = 0; $i < $indentation; $i++) {
974 974
 			echo " - ";
975 975
 		}
976
-		if( $line_item->is_percent() ) {
977
-			$breakdown = $line_item->percent() . '%';
976
+		if ($line_item->is_percent()) {
977
+			$breakdown = $line_item->percent().'%';
978 978
 		} else {
979
-			$breakdown = '$' . $line_item->unit_price() . "x" . $line_item->quantity();
979
+			$breakdown = '$'.$line_item->unit_price()."x".$line_item->quantity();
980 980
 		}
981
-		echo $line_item->name() . "( " . $line_item->ID() . " ) : " . $line_item->type() . " $" . $line_item->total() . "(" . $breakdown . ")";
982
-		if( $line_item->is_taxable() ){
981
+		echo $line_item->name()."( ".$line_item->ID()." ) : ".$line_item->type()." $".$line_item->total()."(".$breakdown.")";
982
+		if ($line_item->is_taxable()) {
983 983
 			echo "  * taxable";
984 984
 		}
985
-		if( $line_item->children() ){
986
-			foreach($line_item->children() as $child){
985
+		if ($line_item->children()) {
986
+			foreach ($line_item->children() as $child) {
987 987
 				self::visualize($child, $indentation + 1);
988 988
 			}
989 989
 		}
@@ -1024,88 +1024,88 @@  discard block
 block discarded – undo
1024 1024
 	 *                                          is theirs, which can be done with
1025 1025
 	 *                                          `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );`
1026 1026
 	 */
1027
-	public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) {
1027
+	public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) {
1028 1028
 		//init running grand total if not already
1029
-		if ( ! isset( $running_totals[ 'total' ] ) ) {
1030
-			$running_totals[ 'total' ] = 0;
1029
+		if ( ! isset($running_totals['total'])) {
1030
+			$running_totals['total'] = 0;
1031 1031
 		}
1032
-		if( ! isset( $running_totals[ 'taxable' ] ) ) {
1033
-			$running_totals[ 'taxable' ] = array( 'total' => 0 );
1032
+		if ( ! isset($running_totals['taxable'])) {
1033
+			$running_totals['taxable'] = array('total' => 0);
1034 1034
 		}
1035
-		foreach ( $line_item->children() as $child_line_item ) {
1036
-			switch ( $child_line_item->type() ) {
1035
+		foreach ($line_item->children() as $child_line_item) {
1036
+			switch ($child_line_item->type()) {
1037 1037
 
1038 1038
 				case EEM_Line_Item::type_sub_total :
1039
-					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities );
1039
+					$running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities);
1040 1040
 					//combine arrays but preserve numeric keys
1041
-					$running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals );
1042
-					$running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ];
1043
-					$running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ];
1041
+					$running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals);
1042
+					$running_totals['total'] += $running_totals_from_subtotal['total'];
1043
+					$running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total'];
1044 1044
 					break;
1045 1045
 
1046 1046
 				case EEM_Line_Item::type_tax_sub_total :
1047 1047
 
1048 1048
 					//find how much the taxes percentage is
1049
-					if ( $child_line_item->percent() != 0 ) {
1049
+					if ($child_line_item->percent() != 0) {
1050 1050
 						$tax_percent_decimal = $child_line_item->percent() / 100;
1051 1051
 					} else {
1052 1052
 						$tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100;
1053 1053
 					}
1054 1054
 					//and apply to all the taxable totals, and add to the pretax totals
1055
-					foreach ( $running_totals as $line_item_id => $this_running_total ) {
1055
+					foreach ($running_totals as $line_item_id => $this_running_total) {
1056 1056
 						//"total" and "taxable" array key is an exception
1057
-						if ( $line_item_id === 'taxable' ) {
1057
+						if ($line_item_id === 'taxable') {
1058 1058
 							continue;
1059 1059
 						}
1060
-						$taxable_total = $running_totals[ 'taxable' ][ $line_item_id ];
1061
-						$running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal );
1060
+						$taxable_total = $running_totals['taxable'][$line_item_id];
1061
+						$running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal);
1062 1062
 					}
1063 1063
 					break;
1064 1064
 
1065 1065
 				case EEM_Line_Item::type_line_item :
1066 1066
 
1067 1067
 					// ticket line items or ????
1068
-					if ( $child_line_item->OBJ_type() === 'Ticket' ) {
1068
+					if ($child_line_item->OBJ_type() === 'Ticket') {
1069 1069
 						// kk it's a ticket
1070
-						if ( isset( $running_totals[ $child_line_item->ID() ] ) ) {
1070
+						if (isset($running_totals[$child_line_item->ID()])) {
1071 1071
 							//huh? that shouldn't happen.
1072
-							$running_totals[ 'total' ] += $child_line_item->total();
1072
+							$running_totals['total'] += $child_line_item->total();
1073 1073
 						} else {
1074 1074
 							//its not in our running totals yet. great.
1075
-							if ( $child_line_item->is_taxable() ) {
1075
+							if ($child_line_item->is_taxable()) {
1076 1076
 								$taxable_amount = $child_line_item->unit_price();
1077 1077
 							} else {
1078 1078
 								$taxable_amount = 0;
1079 1079
 							}
1080 1080
 							// are we only calculating totals for some tickets?
1081
-							if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) {
1082
-								$quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ];
1083
-								$running_totals[ $child_line_item->ID() ] = $quantity ? $child_line_item->unit_price() : 0;
1084
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity ? $taxable_amount : 0;
1081
+							if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) {
1082
+								$quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()];
1083
+								$running_totals[$child_line_item->ID()] = $quantity ? $child_line_item->unit_price() : 0;
1084
+								$running_totals['taxable'][$child_line_item->ID()] = $quantity ? $taxable_amount : 0;
1085 1085
 							} else {
1086 1086
 								$quantity = $child_line_item->quantity();
1087
-								$running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price();
1088
-								$running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount;
1087
+								$running_totals[$child_line_item->ID()] = $child_line_item->unit_price();
1088
+								$running_totals['taxable'][$child_line_item->ID()] = $taxable_amount;
1089 1089
 							}
1090
-							$running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity;
1091
-							$running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity;
1090
+							$running_totals['taxable']['total'] += $taxable_amount * $quantity;
1091
+							$running_totals['total'] += $child_line_item->unit_price() * $quantity;
1092 1092
 						}
1093 1093
 					} else {
1094 1094
 						// it's some other type of item added to the cart
1095 1095
 						// it should affect the running totals
1096 1096
 						// basically we want to convert it into a PERCENT modifier. Because
1097 1097
 						// more clearly affect all registration's final price equally
1098
-						$line_items_percent_of_running_total = $running_totals[ 'total' ] > 0 ? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1 : 1;
1099
-						foreach ( $running_totals as $line_item_id => $this_running_total ) {
1098
+						$line_items_percent_of_running_total = $running_totals['total'] > 0 ? ($child_line_item->total() / $running_totals['total']) + 1 : 1;
1099
+						foreach ($running_totals as $line_item_id => $this_running_total) {
1100 1100
 							//the "taxable" array key is an exception
1101
-							if ( $line_item_id === 'taxable' ) {
1101
+							if ($line_item_id === 'taxable') {
1102 1102
 								continue;
1103 1103
 							}
1104 1104
 							// update the running totals
1105 1105
 							// yes this actually even works for the running grand total!
1106
-							$running_totals[ $line_item_id ] = $line_items_percent_of_running_total * $this_running_total;
1107
-							if ( $child_line_item->is_taxable() ) {
1108
-								$running_totals[ 'taxable' ][ $line_item_id ] = $line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ];
1106
+							$running_totals[$line_item_id] = $line_items_percent_of_running_total * $this_running_total;
1107
+							if ($child_line_item->is_taxable()) {
1108
+								$running_totals['taxable'][$line_item_id] = $line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id];
1109 1109
 							}
1110 1110
 						}
1111 1111
 					}
@@ -1124,15 +1124,15 @@  discard block
 block discarded – undo
1124 1124
 	 * @param EE_Registration[] $registrations
1125 1125
 	 * @return \EE_Line_Item
1126 1126
 	 */
1127
-	public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) {
1128
-		$copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations );
1129
-		foreach ( $line_item->children() as $child_li ) {
1130
-			$copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) );
1127
+	public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) {
1128
+		$copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations);
1129
+		foreach ($line_item->children() as $child_li) {
1130
+			$copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations));
1131 1131
 		}
1132 1132
 		//if this is the grand total line item, make sure the totals all add up
1133 1133
 		//(we could have duplicated this logic AS we copied the line items, but
1134 1134
 		//it seems DRYer this way)
1135
-		if ( $copy_li->type() === EEM_Line_Item::type_total ) {
1135
+		if ($copy_li->type() === EEM_Line_Item::type_total) {
1136 1136
 			$copy_li->recalculate_total_including_taxes();
1137 1137
 		}
1138 1138
 		return $copy_li;
@@ -1147,26 +1147,26 @@  discard block
 block discarded – undo
1147 1147
 	 * @return EE_Line_Item
1148 1148
 	 * @param EE_Registration[] $registrations
1149 1149
 	 */
1150
-	public static function billable_line_item( EE_Line_Item $line_item, $registrations ) {
1150
+	public static function billable_line_item(EE_Line_Item $line_item, $registrations) {
1151 1151
 		$new_li_fields = $line_item->model_field_array();
1152
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1152
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1153 1153
 			$line_item->OBJ_type() === 'Ticket'
1154 1154
 		) {
1155 1155
 			$count = 0;
1156
-			foreach ( $registrations as $registration ) {
1157
-				if ( $line_item->OBJ_ID() === $registration->ticket_ID() &&
1158
-					in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() )
1156
+			foreach ($registrations as $registration) {
1157
+				if ($line_item->OBJ_ID() === $registration->ticket_ID() &&
1158
+					in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment())
1159 1159
 				) {
1160 1160
 					$count++;
1161 1161
 				}
1162 1162
 			}
1163
-			$new_li_fields[ 'LIN_quantity' ] = $count;
1163
+			$new_li_fields['LIN_quantity'] = $count;
1164 1164
 		}
1165 1165
 		//don't set the total. We'll leave that up to the code that calculates it
1166
-		unset( $new_li_fields[ 'LIN_ID' ] );
1167
-		unset( $new_li_fields[ 'LIN_parent' ] );
1168
-		unset( $new_li_fields[ 'LIN_total' ] );
1169
-		return EE_Line_Item::new_instance( $new_li_fields );
1166
+		unset($new_li_fields['LIN_ID']);
1167
+		unset($new_li_fields['LIN_parent']);
1168
+		unset($new_li_fields['LIN_total']);
1169
+		return EE_Line_Item::new_instance($new_li_fields);
1170 1170
 	}
1171 1171
 
1172 1172
 
@@ -1178,19 +1178,19 @@  discard block
 block discarded – undo
1178 1178
 	 * @param EE_Line_Item $line_item |null
1179 1179
 	 * @return \EE_Line_Item|null
1180 1180
 	 */
1181
-	public static function non_empty_line_items( EE_Line_Item $line_item ) {
1182
-		$copied_li = EEH_Line_Item::non_empty_line_item( $line_item );
1183
-		if ( $copied_li === null ) {
1181
+	public static function non_empty_line_items(EE_Line_Item $line_item) {
1182
+		$copied_li = EEH_Line_Item::non_empty_line_item($line_item);
1183
+		if ($copied_li === null) {
1184 1184
 			return null;
1185 1185
 		}
1186 1186
 		//if this is an event subtotal, we want to only include it if it
1187 1187
 		//has a non-zero total and at least one ticket line item child
1188 1188
 		$ticket_children = 0;
1189
-		foreach ( $line_item->children() as $child_li ) {
1190
-			$child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li );
1191
-			if ( $child_li_copy !== null ) {
1192
-				$copied_li->add_child_line_item( $child_li_copy );
1193
-				if ( $child_li_copy->type() === EEM_Line_Item::type_line_item &&
1189
+		foreach ($line_item->children() as $child_li) {
1190
+			$child_li_copy = EEH_Line_Item::non_empty_line_items($child_li);
1191
+			if ($child_li_copy !== null) {
1192
+				$copied_li->add_child_line_item($child_li_copy);
1193
+				if ($child_li_copy->type() === EEM_Line_Item::type_line_item &&
1194 1194
 					$child_li_copy->OBJ_type() === 'Ticket'
1195 1195
 				) {
1196 1196
 					$ticket_children++;
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		}
1200 1200
 		//if this is an event subtotal with NO ticket children
1201 1201
 		//we basically want to ignore it
1202
-		if ( $line_item->type() === EEM_Line_Item::type_sub_total &&
1202
+		if ($line_item->type() === EEM_Line_Item::type_sub_total &&
1203 1203
 			$line_item->OBJ_type() === 'Event' &&
1204 1204
 			$ticket_children === 0 &&
1205 1205
 			$line_item->total() === 0
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 	 * @param EE_Line_Item      $line_item
1218 1218
 	 * @return EE_Line_Item
1219 1219
 	 */
1220
-	public static function non_empty_line_item( EE_Line_Item $line_item ) {
1221
-		if ( $line_item->type() === EEM_Line_Item::type_line_item &&
1220
+	public static function non_empty_line_item(EE_Line_Item $line_item) {
1221
+		if ($line_item->type() === EEM_Line_Item::type_line_item &&
1222 1222
 			$line_item->OBJ_type() === 'Ticket' &&
1223 1223
 			$line_item->quantity() == 0
1224 1224
 		) {
@@ -1226,9 +1226,9 @@  discard block
 block discarded – undo
1226 1226
 		}
1227 1227
 		$new_li_fields = $line_item->model_field_array();
1228 1228
 		//don't set the total. We'll leave that up to the code that calculates it
1229
-		unset( $new_li_fields[ 'LIN_ID' ] );
1230
-		unset( $new_li_fields[ 'LIN_parent' ] );
1231
-		return EE_Line_Item::new_instance( $new_li_fields );
1229
+		unset($new_li_fields['LIN_ID']);
1230
+		unset($new_li_fields['LIN_parent']);
1231
+		return EE_Line_Item::new_instance($new_li_fields);
1232 1232
 	}
1233 1233
 
1234 1234
 
@@ -1242,9 +1242,9 @@  discard block
 block discarded – undo
1242 1242
 	 * @param EE_Line_Item $total_line_item
1243 1243
 	 *	@return \EE_Line_Item
1244 1244
 	 */
1245
-	public static function get_items_subtotal( EE_Line_Item $total_line_item ){
1246
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1247
-		return self::get_pre_tax_subtotal( $total_line_item );
1245
+	public static function get_items_subtotal(EE_Line_Item $total_line_item) {
1246
+		EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1247
+		return self::get_pre_tax_subtotal($total_line_item);
1248 1248
 	}
1249 1249
 
1250 1250
 
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 	 * @param EE_Transaction $transaction
1255 1255
 	 *	@return \EE_Line_Item
1256 1256
 	 */
1257
-	public static function create_default_total_line_item( $transaction = NULL) {
1258
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' );
1259
-		return self::create_total_line_item( $transaction );
1257
+	public static function create_default_total_line_item($transaction = NULL) {
1258
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0');
1259
+		return self::create_total_line_item($transaction);
1260 1260
 	}
1261 1261
 
1262 1262
 
@@ -1267,9 +1267,9 @@  discard block
 block discarded – undo
1267 1267
 	 * @param EE_Transaction $transaction
1268 1268
 	 *	@return \EE_Line_Item
1269 1269
 	 */
1270
-	public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1271
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' );
1272
-		return self::create_pre_tax_subtotal( $total_line_item, $transaction );
1270
+	public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1271
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0');
1272
+		return self::create_pre_tax_subtotal($total_line_item, $transaction);
1273 1273
 	}
1274 1274
 
1275 1275
 
@@ -1280,9 +1280,9 @@  discard block
 block discarded – undo
1280 1280
 	 * @param EE_Transaction $transaction
1281 1281
 	 *	@return \EE_Line_Item
1282 1282
 	 */
1283
-	public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1284
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' );
1285
-		return self::create_taxes_subtotal( $total_line_item, $transaction );
1283
+	public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1284
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0');
1285
+		return self::create_taxes_subtotal($total_line_item, $transaction);
1286 1286
 	}
1287 1287
 
1288 1288
 
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
 	 * @param EE_Transaction $transaction
1294 1294
 	 *	@return \EE_Line_Item
1295 1295
 	 */
1296
-	public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) {
1297
-		EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' );
1298
-		return self::create_event_subtotal( $total_line_item, $transaction );
1296
+	public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) {
1297
+		EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0');
1298
+		return self::create_event_subtotal($total_line_item, $transaction);
1299 1299
 	}
1300 1300
 
1301 1301
 
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
 	}
469 469
 
470 470
 	/**
471
-	  * Given the grand total line item and a ticket, finds the event sub-total
472
-	  * line item the ticket's purchase should be added onto
473
-	  *
474
-	  * @access public
475
-	  * @param EE_Line_Item $grand_total the grand total line item
476
-	  * @param EE_Ticket $ticket
477
-	  * @throws \EE_Error
478
-	  * @return EE_Line_Item
479
-	  */
471
+	 * Given the grand total line item and a ticket, finds the event sub-total
472
+	 * line item the ticket's purchase should be added onto
473
+	 *
474
+	 * @access public
475
+	 * @param EE_Line_Item $grand_total the grand total line item
476
+	 * @param EE_Ticket $ticket
477
+	 * @throws \EE_Error
478
+	 * @return EE_Line_Item
479
+	 */
480 480
 	public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) {
481 481
 		$first_datetime = $ticket->first_datetime();
482 482
 		if( ! $first_datetime instanceof EE_Datetime ){
@@ -685,21 +685,21 @@  discard block
 block discarded – undo
685 685
 	 * @return EE_Line_Item the new tax line item created
686 686
 	 */
687 687
 	public static function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false ){
688
-            $tax_subtotal = self::get_taxes_subtotal( $total_line_item );
689
-            $taxable_total = $total_line_item->taxable_total();
690
-
691
-            if( $add_to_existing_line_item ) {
692
-                $new_tax = $tax_subtotal->get_child_line_item( $code );
693
-                EEM_Line_Item::instance()->delete( array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) );
694
-            } else {
695
-                $new_tax = null;
696
-                $tax_subtotal->delete_children_line_items();
697
-            }
698
-            if( $new_tax ) {
699
-                $new_tax->set_total( $new_tax->total() + $amount );
700
-                $new_tax->set_percent( $taxable_total ? ( $new_tax->total() ) / $taxable_total * 100 : 0 );
701
-            } else {
702
-                //no existing tax item. Create it
688
+			$tax_subtotal = self::get_taxes_subtotal( $total_line_item );
689
+			$taxable_total = $total_line_item->taxable_total();
690
+
691
+			if( $add_to_existing_line_item ) {
692
+				$new_tax = $tax_subtotal->get_child_line_item( $code );
693
+				EEM_Line_Item::instance()->delete( array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) );
694
+			} else {
695
+				$new_tax = null;
696
+				$tax_subtotal->delete_children_line_items();
697
+			}
698
+			if( $new_tax ) {
699
+				$new_tax->set_total( $new_tax->total() + $amount );
700
+				$new_tax->set_percent( $taxable_total ? ( $new_tax->total() ) / $taxable_total * 100 : 0 );
701
+			} else {
702
+				//no existing tax item. Create it
703 703
 				$new_tax = EE_Line_Item::new_instance( array(
704 704
 					'TXN_ID'      => $total_line_item->TXN_ID(),
705 705
 					'LIN_name'    => $name ? $name : __( 'Tax', 'event_espresso' ),
@@ -712,16 +712,16 @@  discard block
 block discarded – undo
712 712
 				) );
713 713
 			}
714 714
 
715
-            $new_tax = apply_filters(
715
+			$new_tax = apply_filters(
716 716
 				'FHEE__EEH_Line_Item__set_total_tax_to__new_tax_subtotal',
717 717
 				$new_tax,
718 718
 				$total_line_item
719
-            );
720
-            $new_tax->save();
721
-            $tax_subtotal->set_total( $new_tax->total() );
722
-            $tax_subtotal->save();
723
-            $total_line_item->recalculate_total_including_taxes();
724
-            return $new_tax;
719
+			);
720
+			$new_tax->save();
721
+			$tax_subtotal->set_total( $new_tax->total() );
722
+			$tax_subtotal->save();
723
+			$total_line_item->recalculate_total_including_taxes();
724
+			return $new_tax;
725 725
 	}
726 726
 
727 727
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Interfaces.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -295,23 +295,23 @@  discard block
 block discarded – undo
295 295
 	 * @param float $amount
296 296
 	 * @param string $name
297 297
 	 * @param string $description
298
-         * @param string $code 
299
-         * @param boolean $add_to_existing_line_item if true and a duplicate line item with 
300
-         *  the same code is found, $amount will be added onto it; otherwise will simply
301
-         *  set the taxes to match $amount
298
+	 * @param string $code 
299
+	 * @param boolean $add_to_existing_line_item if true and a duplicate line item with 
300
+	 *  the same code is found, $amount will be added onto it; otherwise will simply
301
+	 *  set the taxes to match $amount
302 302
 	 * @return EE_Line_Item the new tax created
303 303
 	 */
304 304
 	public function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name  = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false );
305 305
         
306
-         /**
307
-         * Makes all the line items which are children of $line_item taxable (or not).
308
-         * Does NOT save the line items
309
-         * @param EE_Line_Item $line_item
310
-         * @param boolean $taxable
311
-         * @param string $code_substring_for_whitelist if this string is part of the line item's code
312
-         *  it will be whitelisted (ie, except from becoming taxable)
313
-         */
314
-        public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null );
306
+		 /**
307
+		  * Makes all the line items which are children of $line_item taxable (or not).
308
+		  * Does NOT save the line items
309
+		  * @param EE_Line_Item $line_item
310
+		  * @param boolean $taxable
311
+		  * @param string $code_substring_for_whitelist if this string is part of the line item's code
312
+		  *  it will be whitelisted (ie, except from becoming taxable)
313
+		  */
314
+		public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null );
315 315
 
316 316
 	/**
317 317
 	 * Adds a simple item ( unrelated to any other model object) to the total line item,
@@ -341,15 +341,15 @@  discard block
 block discarded – undo
341 341
  */
342 342
 interface EEHI_Money{
343 343
 		/**
344
-	 * For comparing floats. Default operator is '=', but see the $operator below for all options.
345
-	 * This should be used to compare floats instead of normal '==' because floats
346
-	 * are inherently imprecise, and so you can sometimes have two floats that appear to be identical
347
-	 * but actually differ by 0.00000001.
348
-	 * @param float $float1
349
-	 * @param float $float2
350
-	 * @param string $operator  The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
351
-	 * @return boolean whether the equation is true or false
352
-	 */
344
+		 * For comparing floats. Default operator is '=', but see the $operator below for all options.
345
+		 * This should be used to compare floats instead of normal '==' because floats
346
+		 * are inherently imprecise, and so you can sometimes have two floats that appear to be identical
347
+		 * but actually differ by 0.00000001.
348
+		 * @param float $float1
349
+		 * @param float $float2
350
+		 * @param string $operator  The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
351
+		 * @return boolean whether the equation is true or false
352
+		 */
353 353
 	function compare_floats( $float1, $float2, $operator='=' );
354 354
 }
355 355
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 /**
6 6
  * Interface EEI_Base
7 7
  */
8
-interface EEI_Base{
8
+interface EEI_Base {
9 9
 	/**
10 10
 	 * gets the unique ID of the model object. If it hasn't been saved yet
11 11
 	 * to the database, this should be 0 or NULL
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row)
33 33
 	 * NOTE: if the values haven't changed, returns 0
34 34
 	 */
35
-	public function update_extra_meta($meta_key,$meta_value,$previous_value = NULL);
35
+	public function update_extra_meta($meta_key, $meta_value, $previous_value = NULL);
36 36
 
37 37
 	/**
38 38
 	 * Adds a new extra meta record. If $unique is set to TRUE, we'll first double-check
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param boolean $unique
44 44
 	 * @return boolean
45 45
 	 */
46
-	public function add_extra_meta($meta_key,$meta_value,$unique = false);
46
+	public function add_extra_meta($meta_key, $meta_value, $unique = false);
47 47
 
48 48
 	/**
49 49
 	 * Deletes all the extra meta rows for this record as specified by key. If $meta_value
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @param string $meta_value
53 53
 	 * @return int number of extra meta rows deleted
54 54
 	 */
55
-	public function delete_extra_meta($meta_key,$meta_value = NULL);
55
+	public function delete_extra_meta($meta_key, $meta_value = NULL);
56 56
 
57 57
 	/**
58 58
 	 * Gets the extra meta with the given meta key. If you specify "single" we just return 1, otherwise
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @param mixed $default if we don't find anything, what should we return?
64 64
 	 * @return mixed single value if $single; array if ! $single
65 65
 	 */
66
-	public function get_extra_meta($meta_key,$single = FALSE,$default = NULL);
66
+	public function get_extra_meta($meta_key, $single = FALSE, $default = NULL);
67 67
 }
68 68
 
69 69
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param 	EE_Response $response
91 91
 	 * @return 	EE_Response
92 92
 	 */
93
-	public function handle_request( EE_Request $request, EE_Response $response );
93
+	public function handle_request(EE_Request $request, EE_Response $response);
94 94
 }
95 95
 
96 96
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @param EE_Request $request
107 107
 	 * @param EE_Response $response
108 108
 	 */
109
-	public function handle_response( EE_Request $request, EE_Response $response );
109
+	public function handle_response(EE_Request $request, EE_Response $response);
110 110
 }
111 111
 
112 112
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @param string $country
272 272
 	 * @param string $CNT_ISO
273 273
 	 */
274
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO );
274
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO);
275 275
 }
276 276
 
277 277
 
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 /**
282 282
  * Interface EEHI_Line_Item
283 283
  */
284
-interface EEHI_Line_Item{
284
+interface EEHI_Line_Item {
285 285
 	/**
286 286
 	 * Adds an item to the purchase in the right spot
287 287
 	 * @param EE_Line_Item $total_line_item
288 288
 	 * @param EE_Line_Item $line_item
289 289
 	 */
290
-	public function add_item( EE_line_Item $total_line_item, EE_Line_Item $line_item );
290
+	public function add_item(EE_line_Item $total_line_item, EE_Line_Item $line_item);
291 291
 	/**
292 292
 	 * Overwrites the previous tax by clearing out the old taxes, and creates a new
293 293
 	 * tax and updates the total line item accordingly
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
          *  set the taxes to match $amount
302 302
 	 * @return EE_Line_Item the new tax created
303 303
 	 */
304
-	public function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name  = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false );
304
+	public function set_total_tax_to(EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false);
305 305
         
306 306
          /**
307 307
          * Makes all the line items which are children of $line_item taxable (or not).
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
          * @param string $code_substring_for_whitelist if this string is part of the line item's code
312 312
          *  it will be whitelisted (ie, except from becoming taxable)
313 313
          */
314
-        public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null );
314
+        public static function set_line_items_taxable(EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null);
315 315
 
316 316
 	/**
317 317
 	 * Adds a simple item ( unrelated to any other model object) to the total line item,
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 	 * @param boolean $code if set to a value, ensures there is only one line item with that code
326 326
 	 * @return boolean success
327 327
 	 */
328
-	public function add_unrelated_item( EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = null );
328
+	public function add_unrelated_item(EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = null);
329 329
 
330 330
 	/**
331 331
 	 * Gets the line item for the taxes subtotal
332 332
 	 * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total
333 333
 	 * @return \EE_Line_Item
334 334
 	 */
335
-	public static function get_taxes_subtotal( EE_Line_Item $total_line_item );
335
+	public static function get_taxes_subtotal(EE_Line_Item $total_line_item);
336 336
 }
337 337
 
338 338
 
339 339
 /**
340 340
  * Money-related helper
341 341
  */
342
-interface EEHI_Money{
342
+interface EEHI_Money {
343 343
 		/**
344 344
 	 * For comparing floats. Default operator is '=', but see the $operator below for all options.
345 345
 	 * This should be used to compare floats instead of normal '==' because floats
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
 	 * @param string $operator  The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
351 351
 	 * @return boolean whether the equation is true or false
352 352
 	 */
353
-	function compare_floats( $float1, $float2, $operator='=' );
353
+	function compare_floats($float1, $float2, $operator = '=');
354 354
 }
355 355
 
356 356
 /**
357 357
  * Interface EEHI_Template
358 358
  */
359
-interface EEHI_Template{
359
+interface EEHI_Template {
360 360
 
361 361
 	/**
362 362
 	 * EEH_Template::format_currency
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 	 * @param string   $cur_code_span_class
370 370
 	 * @return string the html output for the formatted money value
371 371
 	 */
372
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' );
372
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code');
373 373
 }
374 374
 
375 375
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 * @param array $options
385 385
 	 * @return mixed
386 386
 	 */
387
-	public function display_line_item( EE_Line_Item $line_item, $options = array() );
387
+	public function display_line_item(EE_Line_Item $line_item, $options = array());
388 388
 
389 389
 }
390 390
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	 * @throws EE_Error
397 397
 	 * @return bool
398 398
 	 */
399
-	public static function ensure_file_exists_and_is_writable( $full_file_path = '' );
399
+	public static function ensure_file_exists_and_is_writable($full_file_path = '');
400 400
 	
401 401
 	/**
402 402
 	 * ensure_folder_exists_and_is_writable
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @throws EE_Error
406 406
 	 * @return bool
407 407
 	 */
408
-	public static function ensure_folder_exists_and_is_writable( $folder = '' );
408
+	public static function ensure_folder_exists_and_is_writable($folder = '');
409 409
 }
410 410
 
411 411
 // End of file EEI_Interfaces.php
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EE_Paypal_Standard_Form.form.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -21,37 +21,37 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * @param EE_PMT_Paypal_Standard $payment_method_type
23 23
 	 */
24
-	public function __construct( $payment_method_type ){
24
+	public function __construct($payment_method_type) {
25 25
 		parent::__construct(
26 26
 			array(
27 27
 				'payment_method_type'          => $payment_method_type,
28 28
 				'extra_meta_inputs'            => array(
29
-					'paypal_id'        => new EE_Text_Input( array(
30
-						'html_label_text' => sprintf( __( "Paypal Email %s", 'event_espresso' ), $payment_method_type->get_help_tab_link() ),
31
-						'html_help_text'  => __( "Typically [email protected]", 'event_espresso' ),
29
+					'paypal_id'        => new EE_Text_Input(array(
30
+						'html_label_text' => sprintf(__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()),
31
+						'html_help_text'  => __("Typically [email protected]", 'event_espresso'),
32 32
 						'required'        => true
33
-					) ),
34
-					'image_url'        => new EE_Admin_File_Uploader_Input( array(
35
-						'html_help_text'  => __( "Used for your business/personal logo on the PayPal page", 'event_espresso' ),
36
-						'html_label_text' => __( 'Image URL', 'event_espresso' )
37
-					) ),
38
-					'paypal_taxes'     => new EE_Yes_No_Input( array(
39
-						'html_label_text' => sprintf( __( 'Paypal Calculates Taxes %s', 'event_espresso' ), $payment_method_type->get_help_tab_link() ),
40
-						'html_help_text'  => __( 'Whether Paypal should add taxes to the order', 'event_espresso' ),
33
+					)),
34
+					'image_url'        => new EE_Admin_File_Uploader_Input(array(
35
+						'html_help_text'  => __("Used for your business/personal logo on the PayPal page", 'event_espresso'),
36
+						'html_label_text' => __('Image URL', 'event_espresso')
37
+					)),
38
+					'paypal_taxes'     => new EE_Yes_No_Input(array(
39
+						'html_label_text' => sprintf(__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()),
40
+						'html_help_text'  => __('Whether Paypal should add taxes to the order', 'event_espresso'),
41 41
 						'default'         => false
42
-					) ),
43
-					'paypal_shipping'  => new EE_Yes_No_Input( array(
44
-						'html_label_text' => sprintf( __( 'Paypal Calculates Shipping %s', 'event_espresso' ), $payment_method_type->get_help_tab_link() ),
45
-						'html_help_text'  => __( 'Whether Paypal should add shipping surcharges', 'event_espresso' ),
42
+					)),
43
+					'paypal_shipping'  => new EE_Yes_No_Input(array(
44
+						'html_label_text' => sprintf(__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()),
45
+						'html_help_text'  => __('Whether Paypal should add shipping surcharges', 'event_espresso'),
46 46
 						'default'         => false
47
-					) ),
48
-					'shipping_details' => new EE_Select_Input( array(
49
-						EE_PMT_Paypal_Standard::shipping_info_none     => __( "Do not prompt for an address", 'event_espresso' ),
50
-						EE_PMT_Paypal_Standard::shipping_info_optional => __( "Prompt for an address, but do not require it", 'event_espresso' ),
51
-						EE_PMT_Paypal_Standard::shipping_info_required => __( "Prompt for an address, and require it", 'event_espresso' )
52
-					) ),
47
+					)),
48
+					'shipping_details' => new EE_Select_Input(array(
49
+						EE_PMT_Paypal_Standard::shipping_info_none     => __("Do not prompt for an address", 'event_espresso'),
50
+						EE_PMT_Paypal_Standard::shipping_info_optional => __("Prompt for an address, but do not require it", 'event_espresso'),
51
+						EE_PMT_Paypal_Standard::shipping_info_required => __("Prompt for an address, and require it", 'event_espresso')
52
+					)),
53 53
 				),
54
-				'before_form_content_template' => $payment_method_type->file_folder() . DS . 'templates' . DS . 'paypal_standard_settings_before_form.template.php',
54
+				'before_form_content_template' => $payment_method_type->file_folder().DS.'templates'.DS.'paypal_standard_settings_before_form.template.php',
55 55
 			)
56 56
 		);
57 57
 	}
@@ -61,28 +61,28 @@  discard block
 block discarded – undo
61 61
 	/**
62 62
 	 * @param array $req_data
63 63
 	 */
64
-	protected function _normalize( $req_data ) {
65
-		parent::_normalize( $req_data );
66
-		$paypal_calculates_shipping = $this->get_input_value( 'paypal_shipping' );
67
-		$paypal_calculates_taxes = $this->get_input_value( 'paypal_taxes' );
68
-		$paypal_requests_address_info = $this->get_input_value( 'shipping_details' );
64
+	protected function _normalize($req_data) {
65
+		parent::_normalize($req_data);
66
+		$paypal_calculates_shipping = $this->get_input_value('paypal_shipping');
67
+		$paypal_calculates_taxes = $this->get_input_value('paypal_taxes');
68
+		$paypal_requests_address_info = $this->get_input_value('shipping_details');
69 69
 		if (
70
-			( $paypal_calculates_shipping || $paypal_calculates_taxes ) &&
70
+			($paypal_calculates_shipping || $paypal_calculates_taxes) &&
71 71
 			$paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none
72 72
 		) {
73 73
 			//they want paypal to calculate taxes or shipping. They need to ask for
74 74
 			//address info, otherwise paypal can't calculate taxes or shipping
75 75
 			/** @type EE_Select_Input $shipping_details_input */
76
-			$shipping_details_input = $this->get_input( 'shipping_details' );
77
-			$shipping_details_input->set_default( EE_PMT_Paypal_Standard::shipping_info_optional );
76
+			$shipping_details_input = $this->get_input('shipping_details');
77
+			$shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional);
78 78
 			$shipping_details_input_options = $shipping_details_input->options();
79 79
 			EE_Error::add_attention(
80 80
 				sprintf(
81
-					__( 'Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso' ),
82
-					strip_tags( $shipping_details_input->html_label_text() ),
83
-					isset( $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] )
84
-						? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]
85
-						: __( 'Unknown', 'event_espresso' )
81
+					__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'),
82
+					strip_tags($shipping_details_input->html_label_text()),
83
+					isset($shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional])
84
+						? $shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional]
85
+						: __('Unknown', 'event_espresso')
86 86
 				),
87 87
 				__FILE__, __FUNCTION__, __LINE__
88 88
 			);
Please login to merge, or discard this patch.
payment_methods/Paypal_Standard/EEG_Paypal_Standard.gateway.php 3 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		parent::set_settings($settings_array);
78 78
 		if($this->_debug_mode){
79 79
 			$this->_gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
80
-		}else{
80
+		} else{
81 81
 			$this->_gateway_url = 'https://www.paypal.com/cgi-bin/webscr';
82 82
 		}
83 83
 	}
@@ -340,8 +340,9 @@  discard block
 block discarded – undo
340 340
 		$update_info = array();
341 341
 		foreach ( $raw_post_array as $keyval ) {
342 342
 			$keyval = explode( '=', $keyval );
343
-			if ( count( $keyval ) == 2 )
344
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
343
+			if ( count( $keyval ) == 2 ) {
344
+							$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
345
+			}
345 346
 		}
346 347
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
347 348
 		$req = 'cmd=_notify-validate';
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -456,16 +456,16 @@
 block discarded – undo
456 456
 
457 457
 		//might paypal have changed the taxes?
458 458
 		if( $this->_paypal_taxes && $payment_was_itemized ){
459
-                    //note that we're doing this BEFORE adding shipping; we actually want PayPal's shipping to remain non-taxable
460
-                    $this->_line_item->set_line_items_taxable( $transaction->total_line_item(), true, 'paypal_shipping' );
461
-                    $this->_line_item->set_total_tax_to(
462
-                            $transaction->total_line_item(),
463
-                            floatval( $update_info['tax'] ),
464
-                            __( 'Taxes', 'event_espresso' ),
465
-                            __( 'Calculated by Paypal', 'event_espresso' ),
466
-                            'paypal_tax'
467
-                    );
468
-                    $grand_total_needs_resaving = TRUE;
459
+					//note that we're doing this BEFORE adding shipping; we actually want PayPal's shipping to remain non-taxable
460
+					$this->_line_item->set_line_items_taxable( $transaction->total_line_item(), true, 'paypal_shipping' );
461
+					$this->_line_item->set_total_tax_to(
462
+							$transaction->total_line_item(),
463
+							floatval( $update_info['tax'] ),
464
+							__( 'Taxes', 'event_espresso' ),
465
+							__( 'Calculated by Paypal', 'event_espresso' ),
466
+							'paypal_tax'
467
+					);
468
+					$grand_total_needs_resaving = TRUE;
469 469
 		}
470 470
 
471 471
 		$shipping_amount = floatval( $update_info[ 'mc_shipping' ] );
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return EEG_Paypal_Standard
69 69
 	 */
70 70
 	public function __construct() {
71
-		$this->set_uses_separate_IPN_request( true ) ;
71
+		$this->set_uses_separate_IPN_request(true);
72 72
 		parent::__construct();
73 73
 	}
74 74
 
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	 * Also sets the gateway url class variable based on whether debug mode is enabled or not
79 79
 	 * @param array $settings_array
80 80
 	 */
81
-	public function set_settings($settings_array){
81
+	public function set_settings($settings_array) {
82 82
 		parent::set_settings($settings_array);
83
-		if($this->_debug_mode){
83
+		if ($this->_debug_mode) {
84 84
 			$this->_gateway_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
85
-		}else{
85
+		} else {
86 86
 			$this->_gateway_url = 'https://www.paypal.com/cgi-bin/webscr';
87 87
 		}
88 88
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @param string      $cancel_url   URL to send the user to after a cancelled payment attempt on teh payment provider's website
98 98
 	 * @return EEI_Payment
99 99
 	 */
100
-	public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ){
100
+	public function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL) {
101 101
 		$redirect_args = array();
102 102
 		$transaction = $payment->transaction();
103 103
 		$primary_registrant = $transaction->primary_registration();
@@ -107,42 +107,42 @@  discard block
 block discarded – undo
107 107
 
108 108
 		$total_discounts_to_cart_total = $transaction->paid();
109 109
 		//only itemize the order if we're paying for the rest of the order's amount
110
-		if( $payment->amount() == $transaction->total() ) {
111
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true );
110
+		if ($payment->amount() == $transaction->total()) {
111
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true);
112 112
 			//this payment is for the remaining transaction amount,
113 113
 			//keep track of exactly how much the itemized order amount equals
114 114
 			$itemized_sum = 0;
115 115
 			$shipping_previously_added = 0;
116 116
 			//so let's show all the line items
117
-			foreach($total_line_item->get_items() as $line_item){
118
-				if ( $line_item instanceof EE_Line_Item ) {
117
+			foreach ($total_line_item->get_items() as $line_item) {
118
+				if ($line_item instanceof EE_Line_Item) {
119 119
 					//it's some kind of discount
120
-					if( $line_item->total() < 0 ) {
121
-						$total_discounts_to_cart_total += abs( $line_item->total() );
120
+					if ($line_item->total() < 0) {
121
+						$total_discounts_to_cart_total += abs($line_item->total());
122 122
 						$itemized_sum += $line_item->total();
123 123
 						continue;
124 124
 					}
125 125
 					//dont include shipping again.
126
-					if( strpos( $line_item->code(), 'paypal_shipping_') === 0 ) {
126
+					if (strpos($line_item->code(), 'paypal_shipping_') === 0) {
127 127
 						$shipping_previously_added = $line_item->total();
128 128
 						continue;
129 129
 					}
130
-					$redirect_args[ 'item_name_' . $item_num ] = substr(
131
-						sprintf( _x( '%1$s for %2$s', 'Ticket for Event', 'event_espresso' ), $line_item->name(), $line_item->ticket_event_name() ),
130
+					$redirect_args['item_name_'.$item_num] = substr(
131
+						sprintf(_x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), $line_item->name(), $line_item->ticket_event_name()),
132 132
 						0, 127
133 133
 					);
134
-					$redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price();
135
-					$redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity();
134
+					$redirect_args['amount_'.$item_num] = $line_item->unit_price();
135
+					$redirect_args['quantity_'.$item_num] = $line_item->quantity();
136 136
 					//if we're not letting PayPal calculate shipping, tell them its 0
137
-					if ( ! $this->_paypal_shipping ) {
138
-						$redirect_args[ 'shipping_' . $item_num ] = '0';
139
-						$redirect_args[ 'shipping2_' . $item_num ] = '0';
137
+					if ( ! $this->_paypal_shipping) {
138
+						$redirect_args['shipping_'.$item_num] = '0';
139
+						$redirect_args['shipping2_'.$item_num] = '0';
140 140
 					}
141 141
 					$item_num++;
142 142
 					$itemized_sum += $line_item->total();
143 143
 				}
144 144
 			}
145
-			$taxes_li = $this->_line_item->get_taxes_subtotal( $total_line_item );
145
+			$taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item);
146 146
 			//ideally itemized sum equals the transaction total. but if not (which is weird)
147 147
 			//and the itemized sum is LESS than the transaction total
148 148
 			//add another line item
@@ -152,47 +152,47 @@  discard block
 block discarded – undo
152 152
 					$transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added,
153 153
 					2 
154 154
 				);
155
-			if( $itemized_sum_diff_from_txn_total < 0 ) {
155
+			if ($itemized_sum_diff_from_txn_total < 0) {
156 156
 				//itemized sum is too big
157
-				$total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total );
158
-			} elseif( $itemized_sum_diff_from_txn_total > 0 ) {
159
-				$redirect_args[ 'item_name_' . $item_num ] = substr(
160
-						__( 'Other charges', 'event_espresso' ), 0, 127 );
161
-				$redirect_args[ 'amount_' . $item_num ] = $this->format_currency( $itemized_sum_diff_from_txn_total );
162
-				$redirect_args[ 'quantity_' . $item_num ] = 1;
157
+				$total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total);
158
+			} elseif ($itemized_sum_diff_from_txn_total > 0) {
159
+				$redirect_args['item_name_'.$item_num] = substr(
160
+						__('Other charges', 'event_espresso'), 0, 127 );
161
+				$redirect_args['amount_'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total);
162
+				$redirect_args['quantity_'.$item_num] = 1;
163 163
 				$item_num++;
164 164
 			}
165
-			if( $total_discounts_to_cart_total > 0 ) {
166
-				$redirect_args[ 'discount_amount_cart' ] = $this->format_currency( $total_discounts_to_cart_total );
165
+			if ($total_discounts_to_cart_total > 0) {
166
+				$redirect_args['discount_amount_cart'] = $this->format_currency($total_discounts_to_cart_total);
167 167
 			}
168 168
 			//add our taxes to the order if we're NOT using PayPal's
169
-			if( ! $this->_paypal_taxes ){
169
+			if ( ! $this->_paypal_taxes) {
170 170
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
171 171
 			}
172 172
 		} else {
173
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false );
173
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false);
174 174
 			//partial payment that's not for the remaining amount, so we can't send an itemized list
175
-			$redirect_args['item_name_' . $item_num] = substr(
176
-				sprintf( __('Payment of %1$s for %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code() ),
175
+			$redirect_args['item_name_'.$item_num] = substr(
176
+				sprintf(__('Payment of %1$s for %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code()),
177 177
 				0, 127
178 178
 			);
179
-			$redirect_args['amount_' . $item_num] = $payment->amount();
180
-			$redirect_args['shipping_' . $item_num ] = '0';
181
-			$redirect_args['shipping2_' . $item_num ] = '0';
179
+			$redirect_args['amount_'.$item_num] = $payment->amount();
180
+			$redirect_args['shipping_'.$item_num] = '0';
181
+			$redirect_args['shipping2_'.$item_num] = '0';
182 182
 			$redirect_args['tax_cart'] = '0';
183 183
 			$item_num++;
184 184
 		}
185 185
 
186
-		if($this->_debug_mode){
187
-			$redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode';
188
-			$redirect_args['amount_' . $item_num] = 0;
186
+		if ($this->_debug_mode) {
187
+			$redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode';
188
+			$redirect_args['amount_'.$item_num] = 0;
189 189
 			$redirect_args['on0_'.$item_num] = 'NOTIFY URL';
190
-			$redirect_args['os0_' . $item_num] = $notify_url;
190
+			$redirect_args['os0_'.$item_num] = $notify_url;
191 191
 			$redirect_args['on1_'.$item_num] = 'RETURN URL';
192
-			$redirect_args['os1_' . $item_num] = $return_url;
192
+			$redirect_args['os1_'.$item_num] = $return_url;
193 193
 //			$redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ?
194
-			$redirect_args['shipping_' . $item_num ] = '0';
195
-			$redirect_args['shipping2_' . $item_num ] = '0';
194
+			$redirect_args['shipping_'.$item_num] = '0';
195
+			$redirect_args['shipping2_'.$item_num] = '0';
196 196
 		}
197 197
 
198 198
 		$redirect_args['business'] = $this->_paypal_id;
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 		$redirect_args['cmd'] = '_cart';
203 203
 		$redirect_args['upload'] = 1;
204 204
 		$redirect_args['currency_code'] = $payment->currency_code();
205
-		$redirect_args['rm'] = 2;//makes the user return with method=POST
206
-		if($this->_image_url){
205
+		$redirect_args['rm'] = 2; //makes the user return with method=POST
206
+		if ($this->_image_url) {
207 207
 			$redirect_args['image_url'] = $this->_image_url;
208 208
 		}
209 209
 		$redirect_args['no_shipping'] = $this->_shipping_details;
210
-		$redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this
210
+		$redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this
211 211
 
212
-		$redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this );
212
+		$redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this);
213 213
 
214 214
 		$payment->set_redirect_url($this->_gateway_url);
215 215
 		$payment->set_redirect_args($redirect_args);
@@ -230,55 +230,55 @@  discard block
 block discarded – undo
230 230
 	 * @return \EEI_Payment updated
231 231
 	 * @throws \EE_Error
232 232
 	 */
233
-	public function handle_payment_update( $update_info, $transaction ){
233
+	public function handle_payment_update($update_info, $transaction) {
234 234
 		//verify there's payment data that's been sent
235
-		if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) {
235
+		if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) {
236 236
 			// waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/)
237 237
 			// indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes
238
-			if ( isset( $update_info[ 'tx' ] ) ) {
238
+			if (isset($update_info['tx'])) {
239 239
 				return $transaction->last_payment();
240 240
 			} else {
241 241
 				return null;
242 242
 			}
243 243
 		}
244
-		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
245
-		if ( ! $payment instanceof EEI_Payment ) {
244
+		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']);
245
+		if ( ! $payment instanceof EEI_Payment) {
246 246
 			$payment = $transaction->last_payment();
247 247
 		}
248 248
 		// ok, then validate the IPN. Even if we've already processed this payment,
249 249
 		// let PayPal know we don't want to hear from them anymore!
250
-		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
250
+		if ( ! $this->validate_ipn($update_info, $payment)) {
251 251
 			return $payment;
252 252
 		}
253 253
 		//ok, well let's process this payment then!
254
-		switch ( $update_info[ 'payment_status' ] ) {
254
+		switch ($update_info['payment_status']) {
255 255
 
256 256
 			case 'Completed' :
257 257
 				$status = $this->_pay_model->approved_status();
258
-				$gateway_response = __( 'The payment is approved.', 'event_espresso' );
258
+				$gateway_response = __('The payment is approved.', 'event_espresso');
259 259
 				break;
260 260
 
261 261
 			case 'Pending' :
262 262
 				$status = $this->_pay_model->pending_status();
263
-				$gateway_response = __( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' );
263
+				$gateway_response = __('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso');
264 264
 				break;
265 265
 
266 266
 			case 'Denied' :
267 267
 				$status = $this->_pay_model->declined_status();
268
-				$gateway_response = __( 'The payment has been declined.', 'event_espresso' );
268
+				$gateway_response = __('The payment has been declined.', 'event_espresso');
269 269
 				break;
270 270
 
271 271
 			case 'Expired' :
272 272
 			case 'Failed' :
273 273
 				$status = $this->_pay_model->failed_status();
274
-				$gateway_response = __( 'The payment failed for technical reasons or expired.', 'event_espresso' );
274
+				$gateway_response = __('The payment failed for technical reasons or expired.', 'event_espresso');
275 275
 				break;
276 276
 
277 277
 			case 'Refunded' :
278 278
 			case 'Partially_Refunded' :
279 279
 				// even though it's a refund, we consider the payment as approved, it just has a negative value
280 280
 				$status = $this->_pay_model->approved_status();
281
-				$gateway_response = __( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' );
281
+				$gateway_response = __('The payment has been refunded. Please update registrations accordingly.', 'event_espresso');
282 282
 				break;
283 283
 
284 284
 			case 'Voided' :
@@ -286,25 +286,25 @@  discard block
 block discarded – undo
286 286
 			case 'Canceled_Reversal' :
287 287
 			default :
288 288
 				$status = $this->_pay_model->cancelled_status();
289
-				$gateway_response = __( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' );
289
+				$gateway_response = __('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso');
290 290
 				break;
291 291
 
292 292
 		}
293 293
 
294 294
 		//check if we've already processed this payment
295
-		if ( $payment instanceof EEI_Payment ) {
295
+		if ($payment instanceof EEI_Payment) {
296 296
 			//payment exists. if this has the exact same status and amount, don't bother updating. just return
297
-			if ( $payment->status() == $status && $payment->amount() == $update_info[ 'mc_gross' ] ) {
297
+			if ($payment->status() == $status && $payment->amount() == $update_info['mc_gross']) {
298 298
 				// DUPLICATED IPN! dont bother updating transaction foo!;
299
-				$message_log = sprintf( __( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ), $payment->ID() );
299
+				$message_log = sprintf(__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'), $payment->ID());
300 300
 			} else {
301 301
 				// new payment yippee !!!
302
-				$payment->set_status( $status );
303
-				$payment->set_amount( floatval( $update_info[ 'mc_gross' ] ) );
304
-				$payment->set_gateway_response( $gateway_response );
305
-				$payment->set_details( $update_info );
306
-				$payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
307
-				$message_log = sprintf( __( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ) );
302
+				$payment->set_status($status);
303
+				$payment->set_amount(floatval($update_info['mc_gross']));
304
+				$payment->set_gateway_response($gateway_response);
305
+				$payment->set_details($update_info);
306
+				$payment->set_txn_id_chq_nmbr($update_info['txn_id']);
307
+				$message_log = sprintf(__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'));
308 308
 			}
309 309
 			$this->log(
310 310
 				array(
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 				$payment
317 317
 			);
318 318
 		}
319
-		do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this );
319
+		do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this);
320 320
 		// kill request here if this is a refund
321
-		if ( $update_info[ 'payment_status' ] == 'Refunded' || $update_info[ 'payment_status' ] == 'Partially_Refunded'   ) {
322
-			if ( apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) ) {
323
-				status_header( 200 );
321
+		if ($update_info['payment_status'] == 'Refunded' || $update_info['payment_status'] == 'Partially_Refunded') {
322
+			if (apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)) {
323
+				status_header(200);
324 324
 				exit();
325 325
 			}
326 326
 		}
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 	 * @param EE_Payment|EEI_Payment $payment
337 337
 	 * @return boolean
338 338
 	 */
339
-	public function validate_ipn( $update_info, $payment ) {
339
+	public function validate_ipn($update_info, $payment) {
340 340
 		//allow us to skip validating IPNs with PayPal (useful for testing)
341
-		if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) {
341
+		if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) {
342 342
 			return true;
343 343
 		}
344 344
 		//...otherwise, we actually don't care what the $update_info is, we need to look
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
 		// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
347 347
 		// Instead, read raw POST data from the input stream.
348 348
 		// @see https://gist.github.com/xcommerce-gists/3440401
349
-		$raw_post_data = file_get_contents( 'php://input' );
350
-		$raw_post_array = explode( '&', $raw_post_data );
349
+		$raw_post_data = file_get_contents('php://input');
350
+		$raw_post_array = explode('&', $raw_post_data);
351 351
 		$update_info = array();
352
-		foreach ( $raw_post_array as $keyval ) {
353
-			$keyval = explode( '=', $keyval );
354
-			if ( count( $keyval ) == 2 )
355
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
352
+		foreach ($raw_post_array as $keyval) {
353
+			$keyval = explode('=', $keyval);
354
+			if (count($keyval) == 2)
355
+				$update_info[$keyval[0]] = urldecode($keyval[1]);
356 356
 		}
357 357
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
358 358
 		$req = 'cmd=_notify-validate';
359
-		$get_magic_quotes_exists = function_exists( 'get_magic_quotes_gpc' ) ? true : false;
360
-		foreach ( $update_info as $key => $value ) {
361
-			if ( $get_magic_quotes_exists && get_magic_quotes_gpc() == 1 ) {
362
-				$value = urlencode( stripslashes( $value ) );
359
+		$get_magic_quotes_exists = function_exists('get_magic_quotes_gpc') ? true : false;
360
+		foreach ($update_info as $key => $value) {
361
+			if ($get_magic_quotes_exists && get_magic_quotes_gpc() == 1) {
362
+				$value = urlencode(stripslashes($value));
363 363
 			} else {
364
-				$value = urlencode( $value );
364
+				$value = urlencode($value);
365 365
 			}
366 366
 			$req .= "&$key=$value";
367 367
 		}
@@ -371,21 +371,21 @@  discard block
 block discarded – undo
371 371
 			array(
372 372
 				'body' 				=> $req,
373 373
 				'sslverify' 		=> false,
374
-				'timeout' 		=> 60 ,
374
+				'timeout' 		=> 60,
375 375
 				// make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal
376 376
 				// plz see: https://github.com/websharks/s2member/issues/610
377
-				'user-agent' 	=> 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(),
377
+				'user-agent' 	=> 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(),
378 378
 			)
379 379
 		);
380 380
 		// then check the response
381
-		if ( ! is_wp_error( $response ) && array_key_exists( 'body', $response ) && strcmp( $response[ 'body' ], "VERIFIED" ) == 0 ) {
381
+		if ( ! is_wp_error($response) && array_key_exists('body', $response) && strcmp($response['body'], "VERIFIED") == 0) {
382 382
 			return true;
383 383
 		} else {
384 384
 			// huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly,
385 385
 			// or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html
386
-			$payment->set_gateway_response( sprintf( __( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $response[ 'body' ] ) );
387
-			$payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) );
388
-			$payment->set_status( EEM_Payment::status_id_failed );
386
+			$payment->set_gateway_response(sprintf(__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $response['body']));
387
+			$payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response));
388
+			$payment->set_status(EEM_Payment::status_id_failed);
389 389
 			// log the results
390 390
 			$this->log(
391 391
 				array(
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	protected function _process_response_url() {
409 409
 		EE_Registry::instance()->load_helper('URL');
410
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
410
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
411 411
 			$url = is_ssl() ? 'https://' : 'http://';
412
-			$url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' );
412
+			$url .= EEH_URL::filter_input_server_url('HTTP_HOST');
413 413
 			$url .= EEH_URL::filter_input_server_url();
414 414
 		} else {
415 415
 			$url = 'unknown';
@@ -425,30 +425,30 @@  discard block
 block discarded – undo
425 425
 	 * like the taxes or shipping
426 426
 	 * @param EEI_Payment $payment
427 427
 	 */
428
-	public function update_txn_based_on_payment( $payment ) {
428
+	public function update_txn_based_on_payment($payment) {
429 429
 		$update_info = $payment->details();
430 430
 		$transaction = $payment->transaction();
431
-		$payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false );
432
-		if( ! $transaction ){
433
-			$this->log( __( 'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', 'event_espresso' ), $payment );
431
+		$payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false);
432
+		if ( ! $transaction) {
433
+			$this->log(__('Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', 'event_espresso'), $payment);
434 434
 			return;
435 435
 		}
436
-		if( ! is_array( $update_info ) || ! isset( $update_info[ 'mc_shipping' ] ) || ! isset( $update_info[ 'tax' ] ) ) {
436
+		if ( ! is_array($update_info) || ! isset($update_info['mc_shipping']) || ! isset($update_info['tax'])) {
437 437
 			$this->log(
438 438
 				array(
439 439
 					'url' 				=> $this->_process_response_url(),
440
-					'message' 	=> __( 'Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', 'event_espresso' ),
440
+					'message' 	=> __('Could not update transaction based on payment because the payment details have not yet been put on the payment. This normally happens during the IPN or returning from PayPal', 'event_espresso'),
441 441
 					'payment' 	=> $payment->model_field_array()
442 442
 				),
443 443
 				$payment
444 444
 			);
445 445
 			return;
446 446
 		}
447
-		if( $payment->status() !== $this->_pay_model->approved_status() ) {
447
+		if ($payment->status() !== $this->_pay_model->approved_status()) {
448 448
 			$this->log(
449 449
 				array(
450 450
 					'url' 				=> $this->_process_response_url(),
451
-					'message' 	=> __( 'We shouldn\'t update transactions taxes or shipping data from non-approved payments', 'event_espresso' ),
451
+					'message' 	=> __('We shouldn\'t update transactions taxes or shipping data from non-approved payments', 'event_espresso'),
452 452
 					'payment' 	=> $payment->model_field_array()
453 453
 				),
454 454
 				$payment
@@ -458,43 +458,43 @@  discard block
 block discarded – undo
458 458
 		$grand_total_needs_resaving = false;
459 459
 
460 460
 		//might paypal have changed the taxes?
461
-		if( $this->_paypal_taxes && $payment_was_itemized ){
461
+		if ($this->_paypal_taxes && $payment_was_itemized) {
462 462
                     //note that we're doing this BEFORE adding shipping; we actually want PayPal's shipping to remain non-taxable
463
-                    $this->_line_item->set_line_items_taxable( $transaction->total_line_item(), true, 'paypal_shipping' );
463
+                    $this->_line_item->set_line_items_taxable($transaction->total_line_item(), true, 'paypal_shipping');
464 464
                     $this->_line_item->set_total_tax_to(
465 465
                             $transaction->total_line_item(),
466
-                            floatval( $update_info['tax'] ),
467
-                            __( 'Taxes', 'event_espresso' ),
468
-                            __( 'Calculated by Paypal', 'event_espresso' ),
466
+                            floatval($update_info['tax']),
467
+                            __('Taxes', 'event_espresso'),
468
+                            __('Calculated by Paypal', 'event_espresso'),
469 469
                             'paypal_tax'
470 470
                     );
471 471
                     $grand_total_needs_resaving = TRUE;
472 472
 		}
473 473
 
474
-		$shipping_amount = floatval( $update_info[ 'mc_shipping' ] );
474
+		$shipping_amount = floatval($update_info['mc_shipping']);
475 475
 		//might paypal have added shipping?
476
-		if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){
476
+		if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) {
477 477
 			$this->_line_item->add_unrelated_item(
478 478
 				$transaction->total_line_item(),
479
-				sprintf( __('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ),
479
+				sprintf(__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()),
480 480
 				$shipping_amount,
481 481
 				__('Shipping charges calculated by Paypal', 'event_espresso'),
482 482
 				1,
483 483
 				false,
484
-				'paypal_shipping_' . $transaction->ID()
484
+				'paypal_shipping_'.$transaction->ID()
485 485
 			);
486 486
 			$grand_total_needs_resaving = true;
487 487
 		}
488 488
 
489
-		if( $grand_total_needs_resaving ){
490
-			$transaction->total_line_item()->save_this_and_descendants_to_txn( $transaction->ID() );
491
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
492
-			$registration_processor->update_registration_final_prices( $transaction );
489
+		if ($grand_total_needs_resaving) {
490
+			$transaction->total_line_item()->save_this_and_descendants_to_txn($transaction->ID());
491
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
492
+			$registration_processor->update_registration_final_prices($transaction);
493 493
 		}
494 494
 		$this->log(
495 495
 			array(
496 496
 				'url' 													=> $this->_process_response_url(),
497
-				'message' 										=> __( 'Updated transaction related to payment', 'event_espresso' ),
497
+				'message' 										=> __('Updated transaction related to payment', 'event_espresso'),
498 498
 				'transaction (updated)' 					=> $transaction->model_field_array(),
499 499
 				'payment (updated)' 						=> $payment->model_field_array(),
500 500
 				'use_paypal_shipping' 					=> $this->_paypal_shipping,
Please login to merge, or discard this patch.
core/helpers/EEH_File.helper.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -595,8 +595,6 @@
 block discarded – undo
595 595
 	 * converts it into a "remote" filepath (the filepath the currently-in-use 
596 596
 	 * $wp_filesystem needs to use access the folder or file).
597 597
 	 * See http://wordpress.stackexchange.com/questions/124900/using-wp-filesystem-in-plugins
598
-	 * @param WP_Filesystem_Base $wp_filesystem we aren't initially sure which one
599
-	 * is in use, so you need to provide it
600 598
 	 * @param string $local_filepath the filepath to the folder/file locally
601 599
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg 
602 600
 	 * ftp or ssh, will use to access the folder
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author			Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link					http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- */
3
+	 * Event Espresso
4
+	 *
5
+	 * Event Registration and Management Plugin for WordPress
6
+	 *
7
+	 * @ package			Event Espresso
8
+	 * @ author			Seth Shoultes
9
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+	 * @ link					http://www.eventespresso.com
12
+	 * @ version		 	4.0
13
+	 *
14
+	 */
15 15
 require_once( EE_HELPERS . 'EEH_Base.helper.php' );
16 16
 /**
17
- *
18
- * Class EEH_File
19
- *
20
- * Description
21
- *
22
- * @package 			Event Espresso
23
- * @subpackage 	core
24
- * @author 				Brent Christensen
25
- * @since 				$VID:$
26
- *
27
- */
17
+	 *
18
+	 * Class EEH_File
19
+	 *
20
+	 * Description
21
+	 *
22
+	 * @package 			Event Espresso
23
+	 * @subpackage 	core
24
+	 * @author 				Brent Christensen
25
+	 * @since 				$VID:$
26
+	 *
27
+	 */
28 28
 class EEH_File extends EEH_Base {
29 29
 
30 30
 	/**
Please login to merge, or discard this patch.
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
  * @ version		 	4.0
13 13
  *
14 14
  */
15
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
16
-require_once( EE_INTERFACES . 'EEI_Interfaces.php' );
15
+require_once(EE_HELPERS.'EEH_Base.helper.php');
16
+require_once(EE_INTERFACES.'EEI_Interfaces.php');
17 17
 /**
18 18
  *
19 19
  * Class EEH_File
@@ -42,30 +42,30 @@  discard block
 block discarded – undo
42 42
 	 * @throws EE_Error
43 43
 	 * @return WP_Filesystem_Base
44 44
 	 */
45
-	private static function _get_wp_filesystem( $filepath = null) {
46
-		if( apply_filters( 
45
+	private static function _get_wp_filesystem($filepath = null) {
46
+		if (apply_filters( 
47 47
 				'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', 
48
-				$filepath && EEH_File::is_in_uploads_folder( $filepath ), 
49
-				$filepath ) ) {
50
-			if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) {
51
-				require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
48
+				$filepath && EEH_File::is_in_uploads_folder($filepath), 
49
+				$filepath )) {
50
+			if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) {
51
+				require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php');
52 52
 				$method = 'direct';
53
-				$wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
53
+				$wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
54 54
 				//check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem()
55
-				if ( ! defined('FS_CHMOD_DIR') ) {
56
-					define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
55
+				if ( ! defined('FS_CHMOD_DIR')) {
56
+					define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755));
57 57
 				}
58
-				if ( ! defined('FS_CHMOD_FILE') ) {
59
-					define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
58
+				if ( ! defined('FS_CHMOD_FILE')) {
59
+					define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644));
60 60
 				}
61
-				require_once( $wp_filesystem_direct_file );
62
-				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() );
61
+				require_once($wp_filesystem_direct_file);
62
+				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array());
63 63
 			}
64 64
 			return EEH_File::$_wp_filesystem_direct;
65 65
 		}
66 66
 		global $wp_filesystem;
67 67
 		// no filesystem setup ???
68
-		if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
68
+		if ( ! $wp_filesystem instanceof WP_Filesystem_Base) {
69 69
 			// if some eager beaver's just trying to get in there too early...
70 70
 			// let them do it, because we are one of those eager beavers! :P
71 71
 			/**
@@ -78,34 +78,34 @@  discard block
 block discarded – undo
78 78
 			 * and there may be troubles if the WP files are owned by a different user
79 79
 			 * than the server user. But both of these issues should exist in 4.4 and earlier too
80 80
 			 */
81
-			if ( FALSE && ! did_action( 'wp_loaded' )) {
81
+			if (FALSE && ! did_action('wp_loaded')) {
82 82
 				$msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso');
83
-				if ( WP_DEBUG ) {
84
-					$msg .= '<br />' .  __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
83
+				if (WP_DEBUG) {
84
+					$msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
85 85
 				}
86
-				throw new EE_Error( $msg );
86
+				throw new EE_Error($msg);
87 87
 			} else {
88 88
 				// should be loaded if we are past the wp_loaded hook...
89
-				if ( ! function_exists( 'WP_Filesystem' )) {
90
-					require_once( ABSPATH . 'wp-admin/includes/file.php' );
91
-					require_once( ABSPATH . 'wp-admin/includes/template.php' );
89
+				if ( ! function_exists('WP_Filesystem')) {
90
+					require_once(ABSPATH.'wp-admin/includes/file.php');
91
+					require_once(ABSPATH.'wp-admin/includes/template.php');
92 92
 				}
93 93
 				// turn on output buffering so that we can capture the credentials form
94 94
 				ob_start();
95
-				$credentials = request_filesystem_credentials( '' );
95
+				$credentials = request_filesystem_credentials('');
96 96
 				// store credentials form for the time being
97 97
 				EEH_File::$_credentials_form = ob_get_clean();
98 98
 				// basically check for direct or previously configured access
99
-				if ( ! WP_Filesystem( $credentials ) ) {
99
+				if ( ! WP_Filesystem($credentials)) {
100 100
 					// if credentials do NOT exist
101
-					if ( $credentials === FALSE ) {
102
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
103
-						throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
104
-					} elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
105
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
101
+					if ($credentials === FALSE) {
102
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
103
+						throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
104
+					} elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
105
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
106 106
 						throw new EE_Error(
107 107
 								sprintf(
108
-										__( 'WP Filesystem Error: $1%s', 'event_espresso' ),
108
+										__('WP Filesystem Error: $1%s', 'event_espresso'),
109 109
 										$wp_filesystem->errors->get_error_message() ) );
110 110
 					}
111 111
 				}
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * display_request_filesystem_credentials_form
119 119
 	 */
120 120
 	public static function display_request_filesystem_credentials_form() {
121
-		if ( ! empty( EEH_File::$_credentials_form )) {
122
-			echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>';
121
+		if ( ! empty(EEH_File::$_credentials_form)) {
122
+			echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>';
123 123
 		}
124 124
 	}
125 125
 
@@ -137,29 +137,29 @@  discard block
 block discarded – undo
137 137
 	 * @throws EE_Error
138 138
 	 * @return bool
139 139
 	 */
140
-	public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) {
140
+	public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') {
141 141
 		// load WP_Filesystem and set file permissions
142
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
143
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
144
-		if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) {
145
-			$file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name;
146
-			$file_name .= ! empty( $file_ext ) ? ' file' : ' folder';
142
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
143
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
144
+		if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
145
+			$file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name;
146
+			$file_name .= ! empty($file_ext) ? ' file' : ' folder';
147 147
 			$msg = sprintf(
148
-				__( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ),
148
+				__('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'),
149 149
 				$file_name,
150 150
 				'<br />'
151 151
 			);
152
-			if ( EEH_File::exists( $full_file_path )) {
153
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file );
152
+			if (EEH_File::exists($full_file_path)) {
153
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file);
154 154
 			} else {
155 155
 				// no file permissions means the file was not found
156 156
 				$msg .= sprintf(
157
-					__( 'Please ensure the following path is correct: "%s".', 'event_espresso' ),
157
+					__('Please ensure the following path is correct: "%s".', 'event_espresso'),
158 158
 					$full_file_path
159 159
 				);
160 160
 			}
161
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
162
-				throw new EE_Error( $msg . '||' . $msg );
161
+			if (defined('WP_DEBUG') && WP_DEBUG) {
162
+				throw new EE_Error($msg.'||'.$msg);
163 163
 			}
164 164
 			return FALSE;
165 165
 		}
@@ -176,24 +176,24 @@  discard block
 block discarded – undo
176 176
 	 * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages
177 177
 	 * @return string
178 178
 	 */
179
-	private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){
179
+	private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') {
180 180
 		// load WP_Filesystem and set file permissions
181
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
181
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
182 182
 		// check file permissions
183
-		$perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
184
-		if ( $perms ) {
183
+		$perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
184
+		if ($perms) {
185 185
 			// file permissions exist, but way be set incorrectly
186
-			$type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : '';
187
-			$type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder';
186
+			$type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : '';
187
+			$type_of_file .= ! empty($type_of_file) ? 'file' : 'folder';
188 188
 			return sprintf(
189
-				__( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ),
189
+				__('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'),
190 190
 				$type_of_file,
191 191
 				$perms
192 192
 			);
193 193
 		} else {
194 194
 			// file exists but file permissions could not be read ?!?!
195 195
 			return sprintf(
196
-				__( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ),
196
+				__('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'),
197 197
 				$full_file_path
198 198
 			);
199 199
 		}
@@ -211,35 +211,35 @@  discard block
 block discarded – undo
211 211
 	 * can't write to it
212 212
 	 * @return bool false if folder isn't writable; true if it exists and is writeable,
213 213
 	 */
214
-	public static function ensure_folder_exists_and_is_writable( $folder = '' ){
215
-		if ( empty( $folder )) {
214
+	public static function ensure_folder_exists_and_is_writable($folder = '') {
215
+		if (empty($folder)) {
216 216
 			return false;
217 217
 		}
218 218
 		// remove ending DS
219
-		$folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' ));
220
-		$parent_folder = EEH_File::get_parent_folder( $folder );
219
+		$folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\'));
220
+		$parent_folder = EEH_File::get_parent_folder($folder);
221 221
 		// add DS to folder
222
-		$folder = EEH_File::end_with_directory_separator( $folder );
223
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $folder );
224
-		if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) {
222
+		$folder = EEH_File::end_with_directory_separator($folder);
223
+		$wp_filesystem = EEH_File::_get_wp_filesystem($folder);
224
+		if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
225 225
 			//ok so it doesn't exist. Does its parent? Can we write to it?
226
-			if(	! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
226
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
227 227
 				return false;
228 228
 			}
229
-			if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) {
229
+			if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) {
230 230
 				return false;
231 231
 			} else {
232
-				if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath(  $folder ) ) ) {
233
-					if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
234
-						$msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder );
235
-						$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder );
236
-						throw new EE_Error( $msg );
232
+				if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
233
+					if (defined('WP_DEBUG') && WP_DEBUG) {
234
+						$msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder);
235
+						$msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder);
236
+						throw new EE_Error($msg);
237 237
 					}
238 238
 					return false;
239 239
 				}
240
-				EEH_File::add_index_file( $folder );
240
+				EEH_File::add_index_file($folder);
241 241
 			}
242
-		} elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
242
+		} elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) {
243 243
 			return false;
244 244
 		}
245 245
 		return true;
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
 	 * @throws EE_Error
255 255
 	 * @return bool
256 256
 	 */
257
-	public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){
257
+	public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') {
258 258
 		// load WP_Filesystem and set file permissions
259
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_path );
260
-		$full_path = EEH_File::standardise_directory_separators( $full_path );
261
-		if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) {
262
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
263
-				$msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder );
264
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path );
265
-				throw new EE_Error( $msg );
259
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_path);
260
+		$full_path = EEH_File::standardise_directory_separators($full_path);
261
+		if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) {
262
+			if (defined('WP_DEBUG') && WP_DEBUG) {
263
+				$msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder);
264
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path);
265
+				throw new EE_Error($msg);
266 266
 			}
267 267
 			return FALSE;
268 268
 		}
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
 	 * @throws EE_Error
280 280
 	 * @return bool
281 281
 	 */
282
-	public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) {
282
+	public static function ensure_file_exists_and_is_writable($full_file_path = '') {
283 283
 		// load WP_Filesystem and set file permissions
284
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
285
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
286
-		$parent_folder = EEH_File::get_parent_folder( $full_file_path );
287
-		if ( ! EEH_File::exists( $full_file_path )) {
288
-			if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
284
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
285
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
286
+		$parent_folder = EEH_File::get_parent_folder($full_file_path);
287
+		if ( ! EEH_File::exists($full_file_path)) {
288
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
289 289
 				return false;
290 290
 			}
291
-			if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) {
292
-				if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
293
-					$msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path );
294
-					$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
295
-					throw new EE_Error( $msg );
291
+			if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
292
+				if (defined('WP_DEBUG') && WP_DEBUG) {
293
+					$msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path);
294
+					$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
295
+					throw new EE_Error($msg);
296 296
 				}
297 297
 				return false;
298 298
 			}
299 299
 		}
300
-		if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) {
300
+		if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) {
301 301
 			return false;
302 302
 		}
303 303
 		return true;
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
 	 * @param string $file_or_folder_path
310 310
 	 * @return string parent folder, ENDING with a directory separator
311 311
 	 */
312
-	public static function get_parent_folder( $file_or_folder_path ) {
312
+	public static function get_parent_folder($file_or_folder_path) {
313 313
 		//find the last DS, ignoring a DS on the very end
314 314
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
315 315
 		//parent folder, "/var/something/"
316
-		$ds = strrpos( $file_or_folder_path, DS, -2 );
317
-		return substr( $file_or_folder_path, 0, $ds + 1 );
316
+		$ds = strrpos($file_or_folder_path, DS, -2);
317
+		return substr($file_or_folder_path, 0, $ds + 1);
318 318
 	}
319 319
 	
320
-	public static function ensure_folder_exists_recursively( $folder ) {
320
+	public static function ensure_folder_exists_recursively($folder) {
321 321
 		
322 322
 	}
323 323
 
@@ -328,12 +328,12 @@  discard block
 block discarded – undo
328 328
 	 * @param string $full_file_path
329 329
 	 * @return string
330 330
 	 */
331
-	public static function get_file_contents( $full_file_path = '' ){
332
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
333
-		if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) {
331
+	public static function get_file_contents($full_file_path = '') {
332
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
333
+		if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) {
334 334
 			// load WP_Filesystem and set file permissions
335
-			$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
336
-			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
335
+			$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
336
+			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
337 337
 		}
338 338
 		return '';
339 339
 	}
@@ -348,26 +348,26 @@  discard block
 block discarded – undo
348 348
 	 * @throws EE_Error
349 349
 	 * @return bool
350 350
 	 */
351
-	public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){
352
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
353
-		$file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : '';
354
-		$folder = EEH_File::remove_filename_from_filepath( $full_file_path );
355
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
356
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
357
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path );
358
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
359
-				throw new EE_Error( $msg );
351
+	public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') {
352
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
353
+		$file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : '';
354
+		$folder = EEH_File::remove_filename_from_filepath($full_file_path);
355
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
356
+			if (defined('WP_DEBUG') && WP_DEBUG) {
357
+				$msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path);
358
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
359
+				throw new EE_Error($msg);
360 360
 			}
361 361
 			return FALSE;
362 362
 		}
363 363
 		// load WP_Filesystem and set file permissions
364
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
364
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
365 365
 		// write the file
366
-		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) {
367
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
368
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path );
369
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' );
370
-				throw new EE_Error( $msg );
366
+		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) {
367
+			if (defined('WP_DEBUG') && WP_DEBUG) {
368
+				$msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path);
369
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f');
370
+				throw new EE_Error($msg);
371 371
 			}
372 372
 			return FALSE;
373 373
 		}
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 	 * @param boolean|string $type 'd' for directory, 'f' for file
383 383
 	 * @return boolean
384 384
 	 */
385
-	public static function delete( $filepath, $recursive = false, $type = false ) {
385
+	public static function delete($filepath, $recursive = false, $type = false) {
386 386
 		$wp_filesystem = EEH_File::_get_wp_filesystem();
387
-		return $wp_filesystem->delete( $filepath, $recursive, $type ) ? TRUE : FALSE;
387
+		return $wp_filesystem->delete($filepath, $recursive, $type) ? TRUE : FALSE;
388 388
 	}
389 389
 
390 390
 
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	 * @param string $full_file_path
397 397
 	 * @return bool
398 398
 	 */
399
-	public static function exists( $full_file_path = '' ) {
400
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
401
-		return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE;
399
+	public static function exists($full_file_path = '') {
400
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
401
+		return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE;
402 402
 	}
403 403
 
404 404
 
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 	 * @param string $full_file_path
411 411
 	 * @return bool
412 412
 	 */
413
-	public static function is_readable( $full_file_path = '' ) {
414
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
415
-		if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath(  $full_file_path ) ) ) {
413
+	public static function is_readable($full_file_path = '') {
414
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
415
+		if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
416 416
 			return true;
417 417
 		} else {
418 418
 			return false;
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @param string $full_file_path
429 429
 	 * @return string
430 430
 	 */
431
-	public static function remove_filename_from_filepath( $full_file_path = '' ) {
432
-		return pathinfo( $full_file_path, PATHINFO_DIRNAME );
431
+	public static function remove_filename_from_filepath($full_file_path = '') {
432
+		return pathinfo($full_file_path, PATHINFO_DIRNAME);
433 433
 	}
434 434
 
435 435
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 	 * @param string $full_file_path
440 440
 	 * @return string
441 441
 	 */
442
-	public static function get_filename_from_filepath( $full_file_path = '' ) {
443
-		return pathinfo( $full_file_path, PATHINFO_BASENAME );
442
+	public static function get_filename_from_filepath($full_file_path = '') {
443
+		return pathinfo($full_file_path, PATHINFO_BASENAME);
444 444
 	}
445 445
 
446 446
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @param string $full_file_path
451 451
 	 * @return string
452 452
 	 */
453
-	public static function get_file_extension( $full_file_path = '' ) {
454
-		return pathinfo( $full_file_path, PATHINFO_EXTENSION );
453
+	public static function get_file_extension($full_file_path = '') {
454
+		return pathinfo($full_file_path, PATHINFO_EXTENSION);
455 455
 	}
456 456
 
457 457
 
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
 	 * @param string $folder
462 462
 	 * @return bool
463 463
 	 */
464
-	public static function add_htaccess_deny_from_all( $folder = '' ) {
465
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
466
-		if ( ! EEH_File::exists( $folder . '.htaccess' ) ) {
467
-			if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) {
464
+	public static function add_htaccess_deny_from_all($folder = '') {
465
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
466
+		if ( ! EEH_File::exists($folder.'.htaccess')) {
467
+			if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) {
468 468
 				return FALSE;
469 469
 			}
470 470
 		}
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 	 * @param string $folder
478 478
 	 * @return boolean
479 479
 	 */
480
-	public static function add_index_file( $folder ) {
481
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
482
-		if ( ! EEH_File::exists( $folder . 'index.php' ) ) {
483
-			if ( ! EEH_File::write_to_file( $folder . 'index.php', 'You are not permitted to read from this folder', '.php' )) {
480
+	public static function add_index_file($folder) {
481
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
482
+		if ( ! EEH_File::exists($folder.'index.php')) {
483
+			if ( ! EEH_File::write_to_file($folder.'index.php', 'You are not permitted to read from this folder', '.php')) {
484 484
 				return false;
485 485
 			}
486 486
 		}
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
 	 * @param string $file_path
496 496
 	 * @return string
497 497
 	 */
498
-	public static function get_classname_from_filepath_with_standard_filename( $file_path ){
498
+	public static function get_classname_from_filepath_with_standard_filename($file_path) {
499 499
 		//extract file from path
500
-		$filename = basename( $file_path );
500
+		$filename = basename($file_path);
501 501
 		//now remove the first period and everything after
502
-		$pos_of_first_period = strpos( $filename,'.' );
502
+		$pos_of_first_period = strpos($filename, '.');
503 503
 		return substr($filename, 0, $pos_of_first_period);
504 504
 	}
505 505
 
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 	 * @param string $file_path
512 512
 	 * @return string
513 513
 	 */
514
-	public static function standardise_directory_separators( $file_path ){
515
-		return str_replace( array( '\\', '/' ), DS, $file_path );
514
+	public static function standardise_directory_separators($file_path) {
515
+		return str_replace(array('\\', '/'), DS, $file_path);
516 516
 	}
517 517
 
518 518
 
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @param string $file_path
524 524
 	 * @return string
525 525
 	 */
526
-	public static function end_with_directory_separator( $file_path ){
527
-		return rtrim( $file_path, '/\\' ) . DS;
526
+	public static function end_with_directory_separator($file_path) {
527
+		return rtrim($file_path, '/\\').DS;
528 528
 	}
529 529
 
530 530
 
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 	 * @param $file_path
535 535
 	 * @return string
536 536
 	 */
537
-	public static function standardise_and_end_with_directory_separator( $file_path ){
538
-		return self::end_with_directory_separator( self::standardise_directory_separators( $file_path ));
537
+	public static function standardise_and_end_with_directory_separator($file_path) {
538
+		return self::end_with_directory_separator(self::standardise_directory_separators($file_path));
539 539
 	}
540 540
 
541 541
 
@@ -552,21 +552,21 @@  discard block
 block discarded – undo
552 552
 	 *		if $index_numerically == FALSE (Default) keys are what the class names SHOULD be;
553 553
 	 *		 and values are their filepaths
554 554
 	 */
555
-	public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){
555
+	public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) {
556 556
 		$class_to_folder_path = array();
557
-		foreach( $folder_paths as $folder_path ){
558
-			$folder_path = self::standardise_and_end_with_directory_separator( $folder_path );
557
+		foreach ($folder_paths as $folder_path) {
558
+			$folder_path = self::standardise_and_end_with_directory_separator($folder_path);
559 559
 			// load WP_Filesystem and set file permissions
560
-			$files_in_folder = glob( $folder_path . '*' );
560
+			$files_in_folder = glob($folder_path.'*');
561 561
 			$class_to_folder_path = array();
562
-			if ( $files_in_folder ) {
563
-				foreach( $files_in_folder as $file_path ){
562
+			if ($files_in_folder) {
563
+				foreach ($files_in_folder as $file_path) {
564 564
 					//only add files, not folders
565
-					if ( ! is_dir( $file_path )) {
566
-						if ( $index_numerically ) {
565
+					if ( ! is_dir($file_path)) {
566
+						if ($index_numerically) {
567 567
 							$class_to_folder_path[] = $file_path;
568 568
 						} else {
569
-							$classname = self::get_classname_from_filepath_with_standard_filename( $file_path );
569
+							$classname = self::get_classname_from_filepath_with_standard_filename($file_path);
570 570
 							$class_to_folder_path[$classname] = $file_path;
571 571
 						}
572 572
 					}
@@ -586,39 +586,39 @@  discard block
 block discarded – undo
586 586
 	 * @return boolean success
587 587
 	 * @throws EE_Error
588 588
 	 */
589
-	public static function copy( $source_file, $destination_file, $overwrite = FALSE ){
590
-		$full_source_path = EEH_File::standardise_directory_separators( $source_file );
591
-		if( ! EEH_File::exists( $full_source_path ) ){
592
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
593
-				$msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path );
594
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path );
595
-				throw new EE_Error( $msg );
589
+	public static function copy($source_file, $destination_file, $overwrite = FALSE) {
590
+		$full_source_path = EEH_File::standardise_directory_separators($source_file);
591
+		if ( ! EEH_File::exists($full_source_path)) {
592
+			if (defined('WP_DEBUG') && WP_DEBUG) {
593
+				$msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path);
594
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path);
595
+				throw new EE_Error($msg);
596 596
 			}
597 597
 			return FALSE;
598 598
 		}
599 599
 
600
-		$full_dest_path = EEH_File::standardise_directory_separators( $destination_file );
601
-		$folder = EEH_File::remove_filename_from_filepath( $full_dest_path );
602
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
603
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
604
-				$msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path );
605
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path );
606
-				throw new EE_Error( $msg );
600
+		$full_dest_path = EEH_File::standardise_directory_separators($destination_file);
601
+		$folder = EEH_File::remove_filename_from_filepath($full_dest_path);
602
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
603
+			if (defined('WP_DEBUG') && WP_DEBUG) {
604
+				$msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path);
605
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path);
606
+				throw new EE_Error($msg);
607 607
 			}
608 608
 			return FALSE;
609 609
 		}
610 610
 
611 611
 		// load WP_Filesystem and set file permissions
612
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file );
612
+		$wp_filesystem = EEH_File::_get_wp_filesystem($destination_file);
613 613
 		// write the file
614 614
 		if ( ! $wp_filesystem->copy( 
615
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ), 
616
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ), 
615
+						EEH_File::convert_local_filepath_to_remote_filepath($full_source_path), 
616
+						EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path), 
617 617
 						$overwrite )) {
618
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
619
-				$msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path );
620
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' );
621
-				throw new EE_Error( $msg );
618
+			if (defined('WP_DEBUG') && WP_DEBUG) {
619
+				$msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path);
620
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f');
621
+				throw new EE_Error($msg);
622 622
 			}
623 623
 			return FALSE;
624 624
 		}
@@ -630,9 +630,9 @@  discard block
 block discarded – undo
630 630
 	 * @param string $filepath
631 631
 	 * @return boolean
632 632
 	 */
633
-	public static function is_in_uploads_folder( $filepath ) {
633
+	public static function is_in_uploads_folder($filepath) {
634 634
 		$uploads = wp_upload_dir();
635
-		return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false;
635
+		return strpos($filepath, $uploads['basedir']) === 0 ? true : false;
636 636
 	}
637 637
 	
638 638
 	/**
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg 
647 647
 	 * ftp or ssh, will use to access the folder
648 648
 	 */
649
-	public static function convert_local_filepath_to_remote_filepath( $local_filepath ) {
650
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath );
651
-		return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath );
649
+	public static function convert_local_filepath_to_remote_filepath($local_filepath) {
650
+		$wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath);
651
+		return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath);
652 652
 	}
653 653
 }
654 654
 // End of file EEH_File.helper.php
Please login to merge, or discard this patch.
admin/extend/general_settings/Extend_General_Settings_Admin_Page.core.php 1 patch
Spacing   +23 added lines, -23 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
 /**
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-	public function __construct( $routing = TRUE ) {
36
-		parent::__construct( $routing );
37
-		define( 'GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/' );
35
+	public function __construct($routing = TRUE) {
36
+		parent::__construct($routing);
37
+		define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/');
38 38
 	}
39 39
 
40 40
 
41 41
 
42 42
 	protected function _extend_page_config() {
43 43
 
44
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
44
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings';
45 45
 
46 46
 		//filters and action hooks here
47
-		add_action('AHEE__admin_option_settings__template__before', array( $this, 'use_venue_and_staff_manager_settings'), 10 );
48
-		add_action( 'AHEE__admin_option_settings__template__before', array( $this, 'debug_logging_options' ), 9 );
49
-		add_filter( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array( $this, 'update_debug_logging_options' ), 10, 1 );
47
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'use_venue_and_staff_manager_settings'), 10);
48
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
49
+		add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', array($this, 'update_debug_logging_options'), 10, 1);
50 50
 
51 51
 	}
52 52
 
53 53
 
54 54
 
55
-	public function use_venue_and_staff_manager_settings( $template_args ) {
56
-		$_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager'] );
57
-		$template = GEN_SET_CAF_TEMPLATE_PATH . 'use_venue_and_staff_manager_settings.template.php';
58
-		EEH_Template::display_template( $template, $_args );
55
+	public function use_venue_and_staff_manager_settings($template_args) {
56
+		$_args['use_personnel_manager_select'] = EEH_Form_Fields::select_input('use_personnel_manager', $template_args['values'], $template_args['use_personnel_manager']);
57
+		$template = GEN_SET_CAF_TEMPLATE_PATH.'use_venue_and_staff_manager_settings.template.php';
58
+		EEH_Template::display_template($template, $_args);
59 59
 	}
60 60
 
61 61
 
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	 * @param array $template_args
69 69
 	 * @return void
70 70
 	 */
71
-	public function debug_logging_options( $template_args = array() ) {
71
+	public function debug_logging_options($template_args = array()) {
72 72
 		$template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging;
73
-		$template_args['use_remote_logging'] = isset( EE_Registry::instance()->CFG->admin->use_remote_logging ) ? absint( EE_Registry::instance()->CFG->admin->use_remote_logging ) : FALSE;
74
-		$template_args['remote_logging_url'] = isset( EE_Registry::instance()->CFG->admin->remote_logging_url ) && ! empty( EE_Registry::instance()->CFG->admin->remote_logging_url ) ? stripslashes( EE_Registry::instance()->CFG->admin->remote_logging_url ) : '';
75
-		$template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
76
-		EEH_Template::display_template( $template, $template_args );
73
+		$template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : FALSE;
74
+		$template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
75
+		$template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php';
76
+		EEH_Template::display_template($template, $template_args);
77 77
 	}
78 78
 
79 79
 
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 	 * @param array $admin_options
85 85
 	 * @return array
86 86
 	 */
87
-	public function update_debug_logging_options( $admin_options = array() ) {
88
-		$use_full_logging = isset( $this->_req_data['use_full_logging'] ) ? (bool)absint( $this->_req_data['use_full_logging'] ) : $admin_options->use_full_logging;
87
+	public function update_debug_logging_options($admin_options = array()) {
88
+		$use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
89 89
 		$admin_options->use_full_logging = $use_full_logging;
90 90
 		
91
-		if ( $use_full_logging === FALSE ) {
92
-			EE_Error::get_notices( FALSE );
91
+		if ($use_full_logging === FALSE) {
92
+			EE_Error::get_notices(FALSE);
93 93
 			EE_Error::reset_notices();
94 94
 		}
95 95
 
96
-		$admin_options->use_remote_logging = isset( $this->_req_data['use_remote_logging'] ) ? absint( $this->_req_data['use_remote_logging'] ) : $admin_options->use_remote_logging;
97
-		$admin_options->remote_logging_url = isset( $this->_req_data['remote_logging_url'] ) ? esc_url_raw( $this->_req_data['remote_logging_url'] ) : $admin_options->remote_logging_url;
96
+		$admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
97
+		$admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
98 98
 		return $admin_options;
99 99
 	}
100 100
 
Please login to merge, or discard this patch.
core/helpers/EEH_Debug_Tools.helper.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since 				4.0
9 9
  *
10 10
  */
11
-class EEH_Debug_Tools{
11
+class EEH_Debug_Tools {
12 12
 
13 13
 	/**
14 14
 	 * 	instance of the EEH_Autoloader object
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function instance() {
43 43
 		// check if class object is instantiated, and instantiated properly
44
-		if ( ! self::$_instance instanceof EEH_Debug_Tools ) {
44
+		if ( ! self::$_instance instanceof EEH_Debug_Tools) {
45 45
 			self::$_instance = new self();
46 46
 		}
47 47
 		return self::$_instance;
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	private function __construct() {
59 59
 		// load Kint PHP debugging library
60
-		if ( ! class_exists( 'Kint' ) &&  file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){
60
+		if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) {
61 61
 			// despite EE4 having a check for an existing copy of the Kint debugging class,
62 62
 			// if another plugin was loaded AFTER EE4 and they did NOT perform a similar check,
63 63
 			// then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error
64 64
 			// so we've moved it to our test folder so that it is not included with production releases
65 65
 			// plz use https://wordpress.org/plugins/kint-debugger/  if testing production versions of EE
66
-			require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' );
66
+			require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php');
67 67
 		}
68
-		if ( ! defined('DOING_AJAX') || ! isset( $_REQUEST['noheader'] ) || $_REQUEST['noheader'] != 'true' || ! isset( $_REQUEST['TB_iframe'] )) {
68
+		if ( ! defined('DOING_AJAX') || ! isset($_REQUEST['noheader']) || $_REQUEST['noheader'] != 'true' || ! isset($_REQUEST['TB_iframe'])) {
69 69
 			//add_action( 'shutdown', array($this,'espresso_session_footer_dump') );
70 70
 		}
71
-		$plugin = basename( EE_PLUGIN_DIR_PATH );
72
-		add_action( "activate_{$plugin}", array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
73
-		add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' ));
74
-		add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' ));
71
+		$plugin = basename(EE_PLUGIN_DIR_PATH);
72
+		add_action("activate_{$plugin}", array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
73
+		add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors'));
74
+		add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name'));
75 75
 	}
76 76
 
77 77
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * 	@return void
83 83
 	 */
84 84
 	public static function show_db_name() {
85
-		if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) {
86
-			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>';
85
+		if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) {
86
+			echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>';
87 87
 		}
88 88
 	}
89 89
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * 	@return void
96 96
 	 */
97 97
 	public function espresso_session_footer_dump() {
98
-		if ( class_exists('Kint') && function_exists( 'wp_get_current_user' ) && current_user_can('update_core') && ( defined('WP_DEBUG') && WP_DEBUG ) &&  ! defined('DOING_AJAX') && class_exists( 'EE_Registry' )) {
99
-			Kint::dump(  EE_Registry::instance()->SSN->id() );
100
-			Kint::dump( EE_Registry::instance()->SSN );
98
+		if (class_exists('Kint') && function_exists('wp_get_current_user') && current_user_can('update_core') && (defined('WP_DEBUG') && WP_DEBUG) && ! defined('DOING_AJAX') && class_exists('EE_Registry')) {
99
+			Kint::dump(EE_Registry::instance()->SSN->id());
100
+			Kint::dump(EE_Registry::instance()->SSN);
101 101
 //			Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() );
102 102
 			$this->espresso_list_hooked_functions();
103 103
 			$this->show_times();
@@ -114,27 +114,27 @@  discard block
 block discarded – undo
114 114
 	 * @param bool $tag
115 115
 	 * @return void
116 116
 	 */
117
-	public function espresso_list_hooked_functions( $tag=FALSE ){
117
+	public function espresso_list_hooked_functions($tag = FALSE) {
118 118
 		global $wp_filter;
119 119
 		echo '<br/><br/><br/><h3>Hooked Functions</h3>';
120
-		if ( $tag ) {
121
-			$hook[$tag]=$wp_filter[$tag];
122
-			if ( ! is_array( $hook[$tag] )) {
123
-				trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING );
120
+		if ($tag) {
121
+			$hook[$tag] = $wp_filter[$tag];
122
+			if ( ! is_array($hook[$tag])) {
123
+				trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
124 124
 				return;
125 125
 			}
126
-			echo '<h5>For Tag: '. $tag .'</h5>';
126
+			echo '<h5>For Tag: '.$tag.'</h5>';
127 127
 		}
128 128
 		else {
129
-			$hook=$wp_filter;
130
-			ksort( $hook );
129
+			$hook = $wp_filter;
130
+			ksort($hook);
131 131
 		}
132
-		foreach( $hook as $tag => $priorities ) {
132
+		foreach ($hook as $tag => $priorities) {
133 133
 			echo "<br />&gt;&gt;&gt;&gt;&gt;\t<strong>$tag</strong><br />";
134
-			ksort( $priorities );
135
-			foreach( $priorities as $priority => $function ){
134
+			ksort($priorities);
135
+			foreach ($priorities as $priority => $function) {
136 136
 				echo $priority;
137
-				foreach( $function as $name => $properties ) {
137
+				foreach ($function as $name => $properties) {
138 138
 					echo "\t$name<br />";
139 139
 				}
140 140
 			}
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
 	 * @param string $hook_name
151 151
 	 * @return array
152 152
 	 */
153
-	public static function registered_filter_callbacks( $hook_name = '' ) {
153
+	public static function registered_filter_callbacks($hook_name = '') {
154 154
 		$filters = array();
155 155
 		global $wp_filter;
156
-		if ( isset( $wp_filter[ $hook_name ] ) ) {
157
-			$filters[ $hook_name ] = array();
158
-			foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) {
159
-				$filters[ $hook_name ][ $priority ] = array();
160
-				foreach ( $callbacks as $callback ) {
161
-					$filters[ $hook_name ][ $priority ][] = $callback['function'];
156
+		if (isset($wp_filter[$hook_name])) {
157
+			$filters[$hook_name] = array();
158
+			foreach ($wp_filter[$hook_name] as $priority => $callbacks) {
159
+				$filters[$hook_name][$priority] = array();
160
+				foreach ($callbacks as $callback) {
161
+					$filters[$hook_name][$priority][] = $callback['function'];
162 162
 				}
163 163
 			}
164 164
 		}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * 	start_timer
172 172
 	 * @param null $timer_name
173 173
 	 */
174
-	public function start_timer( $timer_name = NULL ){
175
-		$this->_start_times[$timer_name] = microtime( TRUE );
174
+	public function start_timer($timer_name = NULL) {
175
+		$this->_start_times[$timer_name] = microtime(TRUE);
176 176
 	}
177 177
 
178 178
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	 * stop_timer
182 182
 	 * @param string $timer_name
183 183
 	 */
184
-	public function stop_timer($timer_name = 'default'){
185
-		if( isset( $this->_start_times[ $timer_name ] ) ){
186
-			$start_time = $this->_start_times[ $timer_name ];
187
-			unset( $this->_start_times[ $timer_name ] );
188
-		}else{
189
-			$start_time = array_pop( $this->_start_times );
184
+	public function stop_timer($timer_name = 'default') {
185
+		if (isset($this->_start_times[$timer_name])) {
186
+			$start_time = $this->_start_times[$timer_name];
187
+			unset($this->_start_times[$timer_name]);
188
+		} else {
189
+			$start_time = array_pop($this->_start_times);
190 190
 		}
191
-		$total_time = microtime( TRUE ) - $start_time;
192
-		switch ( $total_time ) {
191
+		$total_time = microtime(TRUE) - $start_time;
192
+		switch ($total_time) {
193 193
 			case $total_time < 0.00001 :
194 194
 				$color = '#8A549A';
195 195
 				$bold = 'normal';
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				$bold = 'bold';
216 216
 				break;
217 217
 		}
218
-		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name;
218
+		$this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name;
219 219
 	 }
220 220
 	 /**
221 221
 	  * Measure the memory usage by PHP so far.
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	  * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called
224 224
 	  * @return void
225 225
 	  */
226
-	 public function measure_memory( $label, $output_now = false ) {
227
-		 $memory_used = $this->convert( memory_get_peak_usage( true ) );
228
-		 $this->_memory_usage_points[ $label ] = $memory_used;
229
-		 if( $output_now ) {
226
+	 public function measure_memory($label, $output_now = false) {
227
+		 $memory_used = $this->convert(memory_get_peak_usage(true));
228
+		 $this->_memory_usage_points[$label] = $memory_used;
229
+		 if ($output_now) {
230 230
 			 echo "\r\n<br>$label : $memory_used";
231 231
 		 }
232 232
 	 }
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	  * @param int $size
237 237
 	  * @return string
238 238
 	  */
239
-	 public function convert( $size ) {
240
-		$unit=array('b','kb','mb','gb','tb','pb');
241
-		return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[ absint( $i ) ];
239
+	 public function convert($size) {
240
+		$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
241
+		return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$unit[absint($i)];
242 242
 	 }
243 243
 
244 244
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 * @param bool $output_now
249 249
 	 * @return string
250 250
 	 */
251
-	public function show_times($output_now=true){
252
-		$output = '<h2>Times:</h2>' . implode("<br>",$this->_times) . '<h2>Memory</h2>' . implode('<br>', $this->_memory_usage_points );
253
-		 if($output_now){
251
+	public function show_times($output_now = true) {
252
+		$output = '<h2>Times:</h2>'.implode("<br>", $this->_times).'<h2>Memory</h2>'.implode('<br>', $this->_memory_usage_points);
253
+		 if ($output_now) {
254 254
 			 echo $output;
255 255
 			 return '';
256 256
 		 }
@@ -265,25 +265,25 @@  discard block
 block discarded – undo
265 265
 	 * 	@return void
266 266
 	 */
267 267
 	public static function ee_plugin_activation_errors() {
268
-		if ( WP_DEBUG ) {
268
+		if (WP_DEBUG) {
269 269
 			$activation_errors = ob_get_contents();
270
-			if ( ! empty( $activation_errors ) ) {
271
-				$activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors;
270
+			if ( ! empty($activation_errors)) {
271
+				$activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors;
272 272
 			}
273
-			espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' );
274
-			if ( class_exists( 'EEH_File' )) {
273
+			espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php');
274
+			if (class_exists('EEH_File')) {
275 275
 				try {
276
-					EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' );
277
-					EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors );
278
-				} catch( EE_Error $e ){
279
-					EE_Error::add_error( sprintf( __(  'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
276
+					EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html');
277
+					EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors);
278
+				} catch (EE_Error $e) {
279
+					EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
280 280
 				}
281 281
 			} else {
282 282
 				// old school attempt
283
-				file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors );
283
+				file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors);
284 284
 			}
285
-			$activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors;
286
-			update_option( 'ee_plugin_activation_errors', $activation_errors );
285
+			$activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors;
286
+			update_option('ee_plugin_activation_errors', $activation_errors);
287 287
 		}
288 288
 	}
289 289
 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	 * @param int     $error_type
300 300
 	 * @uses trigger_error()
301 301
 	 */
302
-	public function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
303
-		do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version);
304
-		$version = is_null( $version ) ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version );
305
-		trigger_error( sprintf( __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s','event_espresso' ), $function, $message, $version ), $error_type );
302
+	public function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
303
+		do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version);
304
+		$version = is_null($version) ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version);
305
+		trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', 'event_espresso'), $function, $message, $version), $error_type);
306 306
 	}
307 307
 
308 308
 
@@ -323,22 +323,22 @@  discard block
 block discarded – undo
323 323
 	 * @param string $debug_index
324 324
 	 * @param string $debug_key
325 325
 	 */
326
-	public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false,  $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) {
327
-		if ( WP_DEBUG && false ) {
328
-			$debug_key = $debug_key . '_' . EE_Session::instance()->id();
329
-			$debug_data = get_option( $debug_key, array() );
326
+	public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') {
327
+		if (WP_DEBUG && false) {
328
+			$debug_key = $debug_key.'_'.EE_Session::instance()->id();
329
+			$debug_data = get_option($debug_key, array());
330 330
 			$default_data = array(
331
-				$class => $func . '() : ' . $line,
331
+				$class => $func.'() : '.$line,
332 332
 				'REQ'  => $display_request ? $_REQUEST : '',
333 333
 			);
334 334
 			// don't serialize objects
335
-			$info = self::strip_objects( $info );
336
-			$index = ! empty( $debug_index ) ? $debug_index : 0;
337
-			if ( ! isset( $debug_data[$index] ) ) {
335
+			$info = self::strip_objects($info);
336
+			$index = ! empty($debug_index) ? $debug_index : 0;
337
+			if ( ! isset($debug_data[$index])) {
338 338
 				$debug_data[$index] = array();
339 339
 			}
340
-			$debug_data[$index][microtime()] = array_merge( $default_data, $info );
341
-			update_option( $debug_key, $debug_data );
340
+			$debug_data[$index][microtime()] = array_merge($default_data, $info);
341
+			update_option($debug_key, $debug_data);
342 342
 		}
343 343
 	}
344 344
 
@@ -350,26 +350,26 @@  discard block
 block discarded – undo
350 350
 	 * @param array $info
351 351
 	 * @return array
352 352
 	 */
353
-	public static function strip_objects( $info = array() ) {
354
-		foreach ( $info as $key => $value ) {
355
-			if ( is_array( $value ) ) {
356
-				$info[ $key ] = self::strip_objects( $value );
357
-			} else if ( is_object( $value ) ) {
358
-				$object_class = get_class( $value );
359
-				$info[ $object_class ] = array();
360
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value );
361
-				if ( method_exists( $value, 'ID' ) ) {
362
-					$info[ $object_class ][ 'ID' ] = $value->ID();
353
+	public static function strip_objects($info = array()) {
354
+		foreach ($info as $key => $value) {
355
+			if (is_array($value)) {
356
+				$info[$key] = self::strip_objects($value);
357
+			} else if (is_object($value)) {
358
+				$object_class = get_class($value);
359
+				$info[$object_class] = array();
360
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value);
361
+				if (method_exists($value, 'ID')) {
362
+					$info[$object_class]['ID'] = $value->ID();
363 363
 				}
364
-				if ( method_exists( $value, 'status' ) ) {
365
-					$info[ $object_class ][ 'status' ] = $value->status();
366
-				} else if ( method_exists( $value, 'status_ID' ) ) {
367
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
364
+				if (method_exists($value, 'status')) {
365
+					$info[$object_class]['status'] = $value->status();
366
+				} else if (method_exists($value, 'status_ID')) {
367
+					$info[$object_class]['status'] = $value->status_ID();
368 368
 				}
369
-				unset( $info[ $key ] );
369
+				unset($info[$key]);
370 370
 			}
371 371
 		}
372
-		return (array)$info;
372
+		return (array) $info;
373 373
 	}
374 374
 
375 375
 
@@ -386,31 +386,31 @@  discard block
 block discarded – undo
386 386
 	 * @param string $height
387 387
 	 * @param bool $die
388 388
 	 */
389
-	public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false ) {
389
+	public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false) {
390 390
 		//$print_r = false;
391
-		if ( is_object( $var ) ) {
391
+		if (is_object($var)) {
392 392
 			$var_name = ! $var_name ? 'object' : $var_name;
393 393
 			//$print_r = true;
394
-		} else if ( is_array( $var ) ) {
394
+		} else if (is_array($var)) {
395 395
 			$var_name = ! $var_name ? 'array' : $var_name;
396 396
 			//$print_r = true;
397
-		} else if ( is_numeric( $var ) ) {
397
+		} else if (is_numeric($var)) {
398 398
 			$var_name = ! $var_name ? 'numeric' : $var_name;
399
-		} else if ( is_string( $var ) ) {
399
+		} else if (is_string($var)) {
400 400
 			$var_name = ! $var_name ? 'string' : $var_name;
401
-		} else if ( is_null( $var ) ) {
401
+		} else if (is_null($var)) {
402 402
 			$var_name = ! $var_name ? 'null' : $var_name;
403 403
 		}
404
-		$var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) );
404
+		$var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name));
405 405
 		ob_start();
406
-		echo '<pre style="display:block; width:100%; height:' . $height . '; border:2px solid light-blue;">';
407
-		echo '<h5 style="color:#2EA2CC;"><b>' . $var_name . '</b></h5><span style="color:#E76700">';
406
+		echo '<pre style="display:block; width:100%; height:'.$height.'; border:2px solid light-blue;">';
407
+		echo '<h5 style="color:#2EA2CC;"><b>'.$var_name.'</b></h5><span style="color:#E76700">';
408 408
 		//$print_r ? print_r( $var ) : var_dump( $var );
409
-		var_dump( $var );
410
-		echo '</span><br /><span style="font-size:10px;font-weight:normal;">' . $file . '<br />line no: ' . $line . '</span></pre>';
409
+		var_dump($var);
410
+		echo '</span><br /><span style="font-size:10px;font-weight:normal;">'.$file.'<br />line no: '.$line.'</span></pre>';
411 411
 		$result = ob_get_clean();
412
-		if ( $die ) {
413
-			die( $result );
412
+		if ($die) {
413
+			die($result);
414 414
 		} else {
415 415
 			echo $result;
416 416
 		}
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
  * borrowed from Kint Debugger
428 428
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
429 429
  */
430
-if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) {
431
-	function dump_wp_query(){
430
+if (class_exists('Kint') && ! function_exists('dump_wp_query')) {
431
+	function dump_wp_query() {
432 432
 		global $wp_query;
433 433
 		d($wp_query);
434 434
 	}
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
  * borrowed from Kint Debugger
439 439
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
440 440
  */
441
-if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) {
442
-	function dump_wp(){
441
+if (class_exists('Kint') && ! function_exists('dump_wp')) {
442
+	function dump_wp() {
443 443
 		global $wp;
444 444
 		d($wp);
445 445
 	}
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
  * borrowed from Kint Debugger
450 450
  * Plugin URI: http://upthemes.com/plugins/kint-debugger/
451 451
  */
452
-if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) {
453
-	function dump_post(){
452
+if (class_exists('Kint') && ! function_exists('dump_post')) {
453
+	function dump_post() {
454 454
 		global $post;
455 455
 		d($post);
456 456
 	}
Please login to merge, or discard this patch.