Completed
Branch FET-4710-paypal-tax-settings (388056)
by
unknown
342:37 queued 328:53
created
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,89 +107,89 @@  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
149 149
 			//if the itemized sum is MORE than the transaction total,
150 150
 			//add the difference it to the discounts
151 151
 			$itemized_sum_diff_from_txn_total = $transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added;
152
-			if( $itemized_sum_diff_from_txn_total < 0 ) {
152
+			if ($itemized_sum_diff_from_txn_total < 0) {
153 153
 				//itemized sum is too big
154
-				$total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total );
155
-			} elseif( $itemized_sum_diff_from_txn_total > 0 ) {
156
-				$redirect_args[ 'item_name_' . $item_num ] = substr(
157
-						__( 'Other charges', 'event_espresso' ), 0, 127 );
158
-				$redirect_args[ 'amount_' . $item_num ] = $itemized_sum_diff_from_txn_total;
159
-				$redirect_args[ 'quantity_' . $item_num ] = 1;
154
+				$total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total);
155
+			} elseif ($itemized_sum_diff_from_txn_total > 0) {
156
+				$redirect_args['item_name_'.$item_num] = substr(
157
+						__('Other charges', 'event_espresso'), 0, 127 );
158
+				$redirect_args['amount_'.$item_num] = $itemized_sum_diff_from_txn_total;
159
+				$redirect_args['quantity_'.$item_num] = 1;
160 160
 				$item_num++;
161 161
 			}
162
-			if( $total_discounts_to_cart_total > 0 ) {
163
-				$redirect_args[ 'discount_amount_cart' ] = $total_discounts_to_cart_total;
162
+			if ($total_discounts_to_cart_total > 0) {
163
+				$redirect_args['discount_amount_cart'] = $total_discounts_to_cart_total;
164 164
 			}
165 165
 			//add our taxes to the order if we're NOT using PayPal's
166
-			if( ! $this->_paypal_taxes ){
166
+			if ( ! $this->_paypal_taxes) {
167 167
 				$redirect_args['tax_cart'] = $total_line_item->get_total_tax();
168 168
 			}
169 169
 		} else {
170
-			$payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false );
170
+			$payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false);
171 171
 			//partial payment that's not for the remaining amount, so we can't send an itemized list
172
-			$redirect_args['item_name_' . $item_num] = substr(
173
-				sprintf( __('Payment of %1$s for %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code() ),
172
+			$redirect_args['item_name_'.$item_num] = substr(
173
+				sprintf(__('Payment of %1$s for %2$s', "event_espresso"), $payment->amount(), $primary_registrant->reg_code()),
174 174
 				0, 127
175 175
 			);
176
-			$redirect_args['amount_' . $item_num] = $payment->amount();
177
-			$redirect_args['shipping_' . $item_num ] = '0';
178
-			$redirect_args['shipping2_' . $item_num ] = '0';
176
+			$redirect_args['amount_'.$item_num] = $payment->amount();
177
+			$redirect_args['shipping_'.$item_num] = '0';
178
+			$redirect_args['shipping2_'.$item_num] = '0';
179 179
 			$redirect_args['tax_cart'] = '0';
180 180
 			$item_num++;
181 181
 		}
182 182
 
183
-		if($this->_debug_mode){
184
-			$redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode';
185
-			$redirect_args['amount_' . $item_num] = 0;
183
+		if ($this->_debug_mode) {
184
+			$redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode';
185
+			$redirect_args['amount_'.$item_num] = 0;
186 186
 			$redirect_args['on0_'.$item_num] = 'NOTIFY URL';
187
-			$redirect_args['os0_' . $item_num] = $notify_url;
187
+			$redirect_args['os0_'.$item_num] = $notify_url;
188 188
 			$redirect_args['on1_'.$item_num] = 'RETURN URL';
189
-			$redirect_args['os1_' . $item_num] = $return_url;
189
+			$redirect_args['os1_'.$item_num] = $return_url;
190 190
 //			$redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ?
191
-			$redirect_args['shipping_' . $item_num ] = '0';
192
-			$redirect_args['shipping2_' . $item_num ] = '0';
191
+			$redirect_args['shipping_'.$item_num] = '0';
192
+			$redirect_args['shipping2_'.$item_num] = '0';
193 193
 		}
194 194
 
195 195
 		$redirect_args['business'] = $this->_paypal_id;
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 		$redirect_args['cmd'] = '_cart';
200 200
 		$redirect_args['upload'] = 1;
201 201
 		$redirect_args['currency_code'] = $payment->currency_code();
202
-		$redirect_args['rm'] = 2;//makes the user return with method=POST
203
-		if($this->_image_url){
202
+		$redirect_args['rm'] = 2; //makes the user return with method=POST
203
+		if ($this->_image_url) {
204 204
 			$redirect_args['image_url'] = $this->_image_url;
205 205
 		}
206 206
 		$redirect_args['no_shipping'] = $this->_shipping_details;
207
-		$redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this
207
+		$redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this
208 208
 
209
-		$redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this );
209
+		$redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this);
210 210
 
211 211
 		$payment->set_redirect_url($this->_gateway_url);
212 212
 		$payment->set_redirect_args($redirect_args);
@@ -227,55 +227,55 @@  discard block
 block discarded – undo
227 227
 	 * @return \EEI_Payment updated
228 228
 	 * @throws \EE_Error
229 229
 	 */
230
-	public function handle_payment_update( $update_info, $transaction ){
230
+	public function handle_payment_update($update_info, $transaction) {
231 231
 		//verify there's payment data that's been sent
232
-		if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) {
232
+		if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) {
233 233
 			// waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/)
234 234
 			// indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes
235
-			if ( isset( $update_info[ 'tx' ] ) ) {
235
+			if (isset($update_info['tx'])) {
236 236
 				return $transaction->last_payment();
237 237
 			} else {
238 238
 				return null;
239 239
 			}
240 240
 		}
241
-		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
242
-		if ( ! $payment instanceof EEI_Payment ) {
241
+		$payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']);
242
+		if ( ! $payment instanceof EEI_Payment) {
243 243
 			$payment = $transaction->last_payment();
244 244
 		}
245 245
 		// ok, then validate the IPN. Even if we've already processed this payment,
246 246
 		// let PayPal know we don't want to hear from them anymore!
247
-		if ( ! $this->validate_ipn( $update_info, $payment ) ) {
247
+		if ( ! $this->validate_ipn($update_info, $payment)) {
248 248
 			return $payment;
249 249
 		}
250 250
 		//ok, well let's process this payment then!
251
-		switch ( $update_info[ 'payment_status' ] ) {
251
+		switch ($update_info['payment_status']) {
252 252
 
253 253
 			case 'Completed' :
254 254
 				$status = $this->_pay_model->approved_status();
255
-				$gateway_response = __( 'The payment is approved.', 'event_espresso' );
255
+				$gateway_response = __('The payment is approved.', 'event_espresso');
256 256
 				break;
257 257
 
258 258
 			case 'Pending' :
259 259
 				$status = $this->_pay_model->pending_status();
260
-				$gateway_response = __( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' );
260
+				$gateway_response = __('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso');
261 261
 				break;
262 262
 
263 263
 			case 'Denied' :
264 264
 				$status = $this->_pay_model->declined_status();
265
-				$gateway_response = __( 'The payment has been declined.', 'event_espresso' );
265
+				$gateway_response = __('The payment has been declined.', 'event_espresso');
266 266
 				break;
267 267
 
268 268
 			case 'Expired' :
269 269
 			case 'Failed' :
270 270
 				$status = $this->_pay_model->failed_status();
271
-				$gateway_response = __( 'The payment failed for technical reasons or expired.', 'event_espresso' );
271
+				$gateway_response = __('The payment failed for technical reasons or expired.', 'event_espresso');
272 272
 				break;
273 273
 
274 274
 			case 'Refunded' :
275 275
 			case 'Partially_Refunded' :
276 276
 				// even though it's a refund, we consider the payment as approved, it just has a negative value
277 277
 				$status = $this->_pay_model->approved_status();
278
-				$gateway_response = __( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' );
278
+				$gateway_response = __('The payment has been refunded. Please update registrations accordingly.', 'event_espresso');
279 279
 				break;
280 280
 
281 281
 			case 'Voided' :
@@ -283,25 +283,25 @@  discard block
 block discarded – undo
283 283
 			case 'Canceled_Reversal' :
284 284
 			default :
285 285
 				$status = $this->_pay_model->cancelled_status();
286
-				$gateway_response = __( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' );
286
+				$gateway_response = __('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso');
287 287
 				break;
288 288
 
289 289
 		}
290 290
 
291 291
 		//check if we've already processed this payment
292
-		if ( $payment instanceof EEI_Payment ) {
292
+		if ($payment instanceof EEI_Payment) {
293 293
 			//payment exists. if this has the exact same status and amount, don't bother updating. just return
294
-			if ( $payment->status() == $status && $payment->amount() == $update_info[ 'mc_gross' ] ) {
294
+			if ($payment->status() == $status && $payment->amount() == $update_info['mc_gross']) {
295 295
 				// DUPLICATED IPN! dont bother updating transaction foo!;
296
-				$message_log = sprintf( __( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ), $payment->ID() );
296
+				$message_log = sprintf(__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'), $payment->ID());
297 297
 			} else {
298 298
 				// new payment yippee !!!
299
-				$payment->set_status( $status );
300
-				$payment->set_amount( floatval( $update_info[ 'mc_gross' ] ) );
301
-				$payment->set_gateway_response( $gateway_response );
302
-				$payment->set_details( $update_info );
303
-				$payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] );
304
-				$message_log = sprintf( __( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ) );
299
+				$payment->set_status($status);
300
+				$payment->set_amount(floatval($update_info['mc_gross']));
301
+				$payment->set_gateway_response($gateway_response);
302
+				$payment->set_details($update_info);
303
+				$payment->set_txn_id_chq_nmbr($update_info['txn_id']);
304
+				$message_log = sprintf(__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'));
305 305
 			}
306 306
 			$this->log(
307 307
 				array(
@@ -313,11 +313,11 @@  discard block
 block discarded – undo
313 313
 				$payment
314 314
 			);
315 315
 		}
316
-		do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this );
316
+		do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this);
317 317
 		// kill request here if this is a refund
318
-		if ( $update_info[ 'payment_status' ] == 'Refunded' || $update_info[ 'payment_status' ] == 'Partially_Refunded'   ) {
319
-			if ( apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) ) {
320
-				status_header( 200 );
318
+		if ($update_info['payment_status'] == 'Refunded' || $update_info['payment_status'] == 'Partially_Refunded') {
319
+			if (apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true)) {
320
+				status_header(200);
321 321
 				exit();
322 322
 			}
323 323
 		}
@@ -333,9 +333,9 @@  discard block
 block discarded – undo
333 333
 	 * @param EE_Payment|EEI_Payment $payment
334 334
 	 * @return boolean
335 335
 	 */
336
-	public function validate_ipn( $update_info, $payment ) {
336
+	public function validate_ipn($update_info, $payment) {
337 337
 		//allow us to skip validating IPNs with PayPal (useful for testing)
338
-		if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) {
338
+		if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) {
339 339
 			return true;
340 340
 		}
341 341
 		//...otherwise, we actually don't care what the $update_info is, we need to look
@@ -343,22 +343,22 @@  discard block
 block discarded – undo
343 343
 		// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
344 344
 		// Instead, read raw POST data from the input stream.
345 345
 		// @see https://gist.github.com/xcommerce-gists/3440401
346
-		$raw_post_data = file_get_contents( 'php://input' );
347
-		$raw_post_array = explode( '&', $raw_post_data );
346
+		$raw_post_data = file_get_contents('php://input');
347
+		$raw_post_array = explode('&', $raw_post_data);
348 348
 		$update_info = array();
349
-		foreach ( $raw_post_array as $keyval ) {
350
-			$keyval = explode( '=', $keyval );
351
-			if ( count( $keyval ) == 2 )
352
-				$update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] );
349
+		foreach ($raw_post_array as $keyval) {
350
+			$keyval = explode('=', $keyval);
351
+			if (count($keyval) == 2)
352
+				$update_info[$keyval[0]] = urldecode($keyval[1]);
353 353
 		}
354 354
 		// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
355 355
 		$req = 'cmd=_notify-validate';
356
-		$get_magic_quotes_exists = function_exists( 'get_magic_quotes_gpc' ) ? true : false;
357
-		foreach ( $update_info as $key => $value ) {
358
-			if ( $get_magic_quotes_exists && get_magic_quotes_gpc() == 1 ) {
359
-				$value = urlencode( stripslashes( $value ) );
356
+		$get_magic_quotes_exists = function_exists('get_magic_quotes_gpc') ? true : false;
357
+		foreach ($update_info as $key => $value) {
358
+			if ($get_magic_quotes_exists && get_magic_quotes_gpc() == 1) {
359
+				$value = urlencode(stripslashes($value));
360 360
 			} else {
361
-				$value = urlencode( $value );
361
+				$value = urlencode($value);
362 362
 			}
363 363
 			$req .= "&$key=$value";
364 364
 		}
@@ -368,21 +368,21 @@  discard block
 block discarded – undo
368 368
 			array(
369 369
 				'body' 				=> $req,
370 370
 				'sslverify' 		=> false,
371
-				'timeout' 		=> 60 ,
371
+				'timeout' 		=> 60,
372 372
 				// make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal
373 373
 				// plz see: https://github.com/websharks/s2member/issues/610
374
-				'user-agent' 	=> 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(),
374
+				'user-agent' 	=> 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(),
375 375
 			)
376 376
 		);
377 377
 		// then check the response
378
-		if ( ! is_wp_error( $response ) && array_key_exists( 'body', $response ) && strcmp( $response[ 'body' ], "VERIFIED" ) == 0 ) {
378
+		if ( ! is_wp_error($response) && array_key_exists('body', $response) && strcmp($response['body'], "VERIFIED") == 0) {
379 379
 			return true;
380 380
 		} else {
381 381
 			// huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly,
382 382
 			// or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html
383
-			$payment->set_gateway_response( sprintf( __( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $response[ 'body' ] ) );
384
-			$payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) );
385
-			$payment->set_status( EEM_Payment::status_id_failed );
383
+			$payment->set_gateway_response(sprintf(__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $response['body']));
384
+			$payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response));
385
+			$payment->set_status(EEM_Payment::status_id_failed);
386 386
 			// log the results
387 387
 			$this->log(
388 388
 				array(
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	protected function _process_response_url() {
406 406
 		EE_Registry::instance()->load_helper('URL');
407
-		if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) {
407
+		if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) {
408 408
 			$url = is_ssl() ? 'https://' : 'http://';
409
-			$url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' );
409
+			$url .= EEH_URL::filter_input_server_url('HTTP_HOST');
410 410
 			$url .= EEH_URL::filter_input_server_url();
411 411
 		} else {
412 412
 			$url = 'unknown';
@@ -422,30 +422,30 @@  discard block
 block discarded – undo
422 422
 	 * like the taxes or shipping
423 423
 	 * @param EEI_Payment $payment
424 424
 	 */
425
-	public function update_txn_based_on_payment( $payment ) {
425
+	public function update_txn_based_on_payment($payment) {
426 426
 		$update_info = $payment->details();
427 427
 		$transaction = $payment->transaction();
428
-		$payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false );
429
-		if( ! $transaction ){
430
-			$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 );
428
+		$payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false);
429
+		if ( ! $transaction) {
430
+			$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 431
 			return;
432 432
 		}
433
-		if( ! is_array( $update_info ) || ! isset( $update_info[ 'mc_shipping' ] ) || ! isset( $update_info[ 'tax' ] ) ) {
433
+		if ( ! is_array($update_info) || ! isset($update_info['mc_shipping']) || ! isset($update_info['tax'])) {
434 434
 			$this->log(
435 435
 				array(
436 436
 					'url' 				=> $this->_process_response_url(),
437
-					'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' ),
437
+					'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'),
438 438
 					'payment' 	=> $payment->model_field_array()
439 439
 				),
440 440
 				$payment
441 441
 			);
442 442
 			return;
443 443
 		}
444
-		if( $payment->status() !== $this->_pay_model->approved_status() ) {
444
+		if ($payment->status() !== $this->_pay_model->approved_status()) {
445 445
 			$this->log(
446 446
 				array(
447 447
 					'url' 				=> $this->_process_response_url(),
448
-					'message' 	=> __( 'We shouldn\'t update transactions taxes or shipping data from non-approved payments', 'event_espresso' ),
448
+					'message' 	=> __('We shouldn\'t update transactions taxes or shipping data from non-approved payments', 'event_espresso'),
449 449
 					'payment' 	=> $payment->model_field_array()
450 450
 				),
451 451
 				$payment
@@ -455,43 +455,43 @@  discard block
 block discarded – undo
455 455
 		$grand_total_needs_resaving = false;
456 456
 
457 457
 		//might paypal have changed the taxes?
458
-		if( $this->_paypal_taxes && $payment_was_itemized ){
458
+		if ($this->_paypal_taxes && $payment_was_itemized) {
459 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' );
460
+                    $this->_line_item->set_line_items_taxable($transaction->total_line_item(), true, 'paypal_shipping');
461 461
                     $this->_line_item->set_total_tax_to(
462 462
                             $transaction->total_line_item(),
463
-                            floatval( $update_info['tax'] ),
464
-                            __( 'Taxes', 'event_espresso' ),
465
-                            __( 'Calculated by Paypal', 'event_espresso' ),
463
+                            floatval($update_info['tax']),
464
+                            __('Taxes', 'event_espresso'),
465
+                            __('Calculated by Paypal', 'event_espresso'),
466 466
                             'paypal_tax'
467 467
                     );
468 468
                     $grand_total_needs_resaving = TRUE;
469 469
 		}
470 470
 
471
-		$shipping_amount = floatval( $update_info[ 'mc_shipping' ] );
471
+		$shipping_amount = floatval($update_info['mc_shipping']);
472 472
 		//might paypal have added shipping?
473
-		if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){
473
+		if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) {
474 474
 			$this->_line_item->add_unrelated_item(
475 475
 				$transaction->total_line_item(),
476
-				sprintf( __('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ),
476
+				sprintf(__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()),
477 477
 				$shipping_amount,
478 478
 				__('Shipping charges calculated by Paypal', 'event_espresso'),
479 479
 				1,
480 480
 				false,
481
-				'paypal_shipping_' . $transaction->ID()
481
+				'paypal_shipping_'.$transaction->ID()
482 482
 			);
483 483
 			$grand_total_needs_resaving = true;
484 484
 		}
485 485
 
486
-		if( $grand_total_needs_resaving ){
487
-			$transaction->total_line_item()->save_this_and_descendants_to_txn( $transaction->ID() );
488
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
489
-			$registration_processor->update_registration_final_prices( $transaction );
486
+		if ($grand_total_needs_resaving) {
487
+			$transaction->total_line_item()->save_this_and_descendants_to_txn($transaction->ID());
488
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
489
+			$registration_processor->update_registration_final_prices($transaction);
490 490
 		}
491 491
 		$this->log(
492 492
 			array(
493 493
 				'url' 													=> $this->_process_response_url(),
494
-				'message' 										=> __( 'Updated transaction related to payment', 'event_espresso' ),
494
+				'message' 										=> __('Updated transaction related to payment', 'event_espresso'),
495 495
 				'transaction (updated)' 					=> $transaction->model_field_array(),
496 496
 				'payment (updated)' 						=> $payment->model_field_array(),
497 497
 				'use_paypal_shipping' 					=> $this->_paypal_shipping,
Please login to merge, or discard this patch.
caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 2 patches
Spacing   +213 added lines, -213 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
 /**
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
 class Extend_Events_Admin_Page extends Events_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
35
-		define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/');
36
-		define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/');
37
-		define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/');
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35
+		define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/');
36
+		define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/');
37
+		define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/');
38 38
 	}
39 39
 
40 40
 
41 41
 	protected function _extend_page_config() {
42 42
 
43
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
43
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events';
44 44
 		$default_espresso_boxes = $this->_default_espresso_metaboxes;
45 45
 
46 46
 		//is there a evt_id in the request?
47
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
48
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
47
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
48
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
49 49
 
50 50
 		//tkt_id?
51
-		$tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0;
51
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0;
52 52
 
53 53
 		$new_page_routes = array(
54 54
 			'duplicate_event' => array(
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 				'capability' => 'ee_delete_default_ticket',
67 67
 				'obj_id' => $tkt_id,
68 68
 				'noheader' => TRUE,
69
-				'args' => array( 'trash' => TRUE )
69
+				'args' => array('trash' => TRUE)
70 70
 				),
71 71
 			'trash_tickets' => array(
72 72
 				'func' => '_trash_or_restore_ticket',
73 73
 				'capability' => 'ee_delete_default_tickets',
74 74
 				'noheader' => TRUE,
75
-				'args' => array( 'trash' => TRUE )
75
+				'args' => array('trash' => TRUE)
76 76
 				),
77 77
 			'restore_ticket' => array(
78 78
 				'func' => '_trash_or_restore_ticket',
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				)
133 133
 			);
134 134
 
135
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
135
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
136 136
 
137 137
 
138 138
 		//partial route/config override
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 		$this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
145 145
 
146 146
 		//add tickets tab but only if there are more than one default ticket!
147
-		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE );
148
-		if ( $tkt_count > 1 ) {
147
+		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE);
148
+		if ($tkt_count > 1) {
149 149
 			$new_page_config = array(
150 150
 				'ticket_list_table' => array(
151 151
 					'nav' => array(
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 				'label' => __('Templates'),
165 165
 				'order' => 30
166 166
 			),
167
-			'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
167
+			'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
168 168
 			'help_tabs' => array(
169 169
 				'general_settings_templates_help_tab' => array(
170 170
 					'title' => __('Templates', 'event_espresso'),
171 171
 					'filename' => 'general_settings_templates'
172 172
 				)
173 173
 			),
174
-			'help_tour' => array( 'Templates_Help_Tour' ),
174
+			'help_tour' => array('Templates_Help_Tour'),
175 175
 			'require_nonce' => FALSE
176 176
 		);
177 177
 
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 //				'metaboxes' => $default_espresso_boxes,
191 191
 //				'require_nonce' => FALSE
192 192
 //		);
193
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
193
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
194 194
 
195 195
 		//add filters and actions
196 196
 		//modifying _views
197
-		add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 );
198
-		add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 );
199
-		add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 );
197
+		add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2);
198
+		add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2);
199
+		add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2);
200 200
 
201 201
 
202 202
 		//filters for event list table
203
-		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2);
204
-		add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 );
203
+		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2);
204
+		add_filter('FHEE__Extend_Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2);
205 205
 
206 206
 		//legend item
207
-		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') );
207
+		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items'));
208 208
 
209
-		add_action('admin_init', array( $this, 'admin_init') );
209
+		add_action('admin_init', array($this, 'admin_init'));
210 210
 
211 211
 		//heartbeat stuff
212
-		add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 );
212
+		add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2);
213 213
 
214 214
 	}
215 215
 
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 		EE_Registry::$i18n_js_strings = array_merge(
223 223
 			EE_Registry::$i18n_js_strings,
224 224
 			array(
225
-				'image_confirm'          => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ),
226
-				'event_starts_on'        => __( 'Event Starts on', 'event_espresso' ),
227
-				'event_ends_on'          => __( 'Event Ends on', 'event_espresso' ),
228
-				'event_datetime_actions' => __( 'Actions', 'event_espresso' ),
229
-				'event_clone_dt_msg'     => __( 'Clone this Event Date and Time', 'event_espresso' ),
230
-				'remove_event_dt_msg'    => __( 'Remove this Event Time', 'event_espresso' )
225
+				'image_confirm'          => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'),
226
+				'event_starts_on'        => __('Event Starts on', 'event_espresso'),
227
+				'event_ends_on'          => __('Event Ends on', 'event_espresso'),
228
+				'event_datetime_actions' => __('Actions', 'event_espresso'),
229
+				'event_clone_dt_msg'     => __('Clone this Event Date and Time', 'event_espresso'),
230
+				'remove_event_dt_msg'    => __('Remove this Event Time', 'event_espresso')
231 231
 			)
232 232
 		);
233 233
 	}
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return array  possibly appended response.
244 244
 	 */
245
-	public function heartbeat_response( $response, $data ) {
245
+	public function heartbeat_response($response, $data) {
246 246
 		/**
247 247
 		 * check whether count of tickets is approaching the potential
248 248
 		 * limits for the server.
249 249
 		 */
250
-		if ( ! empty( $data['input_count'] ) ) {
250
+		if ( ! empty($data['input_count'])) {
251 251
 			$response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']);
252 252
 		}
253 253
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
 
264 264
 
265
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
266
-		$return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug );
265
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
266
+		$return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
267 267
 		//make sure this is only when editing
268
-		if ( !empty( $id ) ) {
269
-			$href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url );
268
+		if ( ! empty($id)) {
269
+			$href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url);
270 270
 			$title = esc_attr__('Duplicate Event', 'event_espresso');
271
-			$return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">' . $title  . '</button>';
271
+			$return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'.$title.'</button>';
272 272
 		}
273 273
 		return $return;
274 274
 	}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				'label' => __('Trash', 'event_espresso'),
292 292
 				'count' => 0,
293 293
 				'bulk_action' => array(
294
-					'restore_tickets' => __('Restore from Trash' , 'event_espresso'),
294
+					'restore_tickets' => __('Restore from Trash', 'event_espresso'),
295 295
 					'delete_tickets' => __('Delete Permanently', 'event_espresso')
296 296
 					)
297 297
 				)
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 
303 303
 	public function load_scripts_styles_edit() {
304
-		wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE );
304
+		wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE);
305 305
 
306 306
 		/**
307 307
 		 * load accounting js.
@@ -320,20 +320,20 @@  discard block
 block discarded – undo
320 320
 
321 321
 
322 322
 
323
-	public function add_additional_datetime_button( $template, $template_args ) {
324
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE);
323
+	public function add_additional_datetime_button($template, $template_args) {
324
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE);
325 325
 	}
326 326
 
327 327
 
328 328
 
329
-	public function add_datetime_clone_button( $template, $template_args ) {
330
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE );
329
+	public function add_datetime_clone_button($template, $template_args) {
330
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE);
331 331
 	}
332 332
 
333 333
 
334 334
 
335
-	public function datetime_timezones_template( $template, $template_args ) {
336
-		return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE );
335
+	public function datetime_timezones_template($template, $template_args) {
336
+		return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE);
337 337
 	}
338 338
 
339 339
 
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	protected function _set_list_table_views_default() {
343 343
 		parent::_set_list_table_views_default();
344 344
 		$export_label = __('Export Events', 'event_espresso');
345
-		if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) {
345
+		if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) {
346 346
 //			$this->_views['all']['bulk_action']['export_events'] = $export_label;
347 347
 //			$this->_views['draft']['bulk_action']['export_events'] = $export_label;
348 348
 
349
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
349
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
350 350
 //				$this->_views['trash']['bulk_action']['export_events'] = $export_label;
351 351
 			}
352 352
 		}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			)
373 373
 		);
374 374
 
375
-		$this->_views = array_merge( $this->_views, $new_views);
375
+		$this->_views = array_merge($this->_views, $new_views);
376 376
 	}
377 377
 
378 378
 
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
 
387 387
 
388 388
 
389
-	public function extra_list_table_actions( $actionlinks, $event ) {
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) {
389
+	public function extra_list_table_actions($actionlinks, $event) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) {
391 391
 			$reports_query_args = array(
392 392
 					'action' => 'reports',
393 393
 					'EVT_ID' => $event->ID()
394 394
 				);
395
-			$reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL );
396
-			$actionlinks[] = '<a href="' . $reports_link . '" title="' .  esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t";
395
+			$reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
396
+			$actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t";
397 397
 		}
398 398
 		return $actionlinks;
399 399
 	}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 
403 403
 	public function additional_legend_items($items) {
404
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) {
404
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) {
405 405
 			$items['reports'] = array(
406 406
 					'class' => 'dashicons dashicons-chart-bar',
407 407
 					'desc' => __('Event Reports', 'event_espresso')
@@ -426,17 +426,17 @@  discard block
 block discarded – undo
426 426
 	 */
427 427
 	protected function _duplicate_event() {
428 428
 		//first make sure the ID for the event is in the request.  If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?)
429
-		if ( !isset( $this->_req_data['EVT_ID'] ) ) {
430
-			EE_Error::add_error( __('In order to duplicate an event an Event ID is required.  None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
431
-			$this->_redirect_after_action( FALSE, '', '', array(), TRUE );
429
+		if ( ! isset($this->_req_data['EVT_ID'])) {
430
+			EE_Error::add_error(__('In order to duplicate an event an Event ID is required.  None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
431
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
432 432
 			return;
433 433
 		}
434 434
 
435 435
 		//k we've got EVT_ID so let's use that to get the event we'll duplicate
436
-		$orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] );
436
+		$orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
437 437
 
438
-		if ( ! $orig_event instanceof EE_Event )
439
-			throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) );
438
+		if ( ! $orig_event instanceof EE_Event)
439
+			throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID']));
440 440
 
441 441
 		//k now let's clone the $orig_event before getting relations
442 442
 		$new_event = clone $orig_event;
@@ -449,43 +449,43 @@  discard block
 block discarded – undo
449 449
 
450 450
 
451 451
 		//reset the ID and modify other details to make it clear this is a dupe
452
-		$new_event->set( 'EVT_ID', 0 );
453
-		$new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso');
454
-		$new_event->set( 'EVT_name',  $new_name );
455
-		$new_event->set( 'EVT_slug',  wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) );
456
-		$new_event->set( 'status', 'draft' );
452
+		$new_event->set('EVT_ID', 0);
453
+		$new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso');
454
+		$new_event->set('EVT_name', $new_name);
455
+		$new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0));
456
+		$new_event->set('status', 'draft');
457 457
 
458 458
 		//duplicate discussion settings
459
-		$new_event->set( 'comment_status', $orig_event->get('comment_status') );
460
-		$new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) );
459
+		$new_event->set('comment_status', $orig_event->get('comment_status'));
460
+		$new_event->set('ping_status', $orig_event->get('ping_status'));
461 461
 
462 462
 		//save the new event
463 463
 		$new_event->save();
464 464
 
465 465
 		//venues
466
-		foreach( $orig_ven as $ven ) {
467
-			$new_event->_add_relation_to( $ven, 'Venue' );
466
+		foreach ($orig_ven as $ven) {
467
+			$new_event->_add_relation_to($ven, 'Venue');
468 468
 		}
469 469
 		$new_event->save();
470 470
 
471 471
 
472 472
 		//now we need to get the question group relations and handle that
473 473
 		//first primary question groups
474
-		$orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) );
475
-		if ( !empty( $orig_primary_qgs ) ) {
476
-			foreach ( $orig_primary_qgs as $id => $obj ) {
477
-				if ( $obj instanceof EE_Question_Group ) {
478
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) );
474
+		$orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1)));
475
+		if ( ! empty($orig_primary_qgs)) {
476
+			foreach ($orig_primary_qgs as $id => $obj) {
477
+				if ($obj instanceof EE_Question_Group) {
478
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1));
479 479
 				}
480 480
 			}
481 481
 		}
482 482
 
483 483
 		//next additional attendee question groups
484
-		$orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) );
485
-		if ( !empty( $orig_additional_qgs ) ) {
486
-			foreach ( $orig_additional_qgs as $id => $obj ) {
487
-				if ( $obj instanceof EE_Question_Group ) {
488
-					$new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) );
484
+		$orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0)));
485
+		if ( ! empty($orig_additional_qgs)) {
486
+			foreach ($orig_additional_qgs as $id => $obj) {
487
+				if ($obj instanceof EE_Question_Group) {
488
+					$new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0));
489 489
 				}
490 490
 			}
491 491
 		}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
 		//k now that we have the new event saved we can loop through the datetimes and start adding relations.
498 498
 		$cloned_tickets = array();
499
-		foreach ( $orig_datetimes as $orig_dtt ) {
499
+		foreach ($orig_datetimes as $orig_dtt) {
500 500
 			$new_dtt = clone $orig_dtt;
501 501
 			$orig_tkts = $orig_dtt->tickets();
502 502
 
@@ -504,22 +504,22 @@  discard block
 block discarded – undo
504 504
 			$new_dtt->set('DTT_ID', 0);
505 505
 			$new_dtt->set('DTT_sold', 0);
506 506
 			$new_dtt->save();
507
-			$new_event->_add_relation_to( $new_dtt, 'Datetime');
507
+			$new_event->_add_relation_to($new_dtt, 'Datetime');
508 508
 			$new_event->save();
509 509
 
510 510
 			//now let's get the ticket relations setup.
511
-			foreach ( (array) $orig_tkts as $orig_tkt ) {
511
+			foreach ((array) $orig_tkts as $orig_tkt) {
512 512
 				//it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
513
-				if ( ! $orig_tkt instanceof EE_Ticket )
513
+				if ( ! $orig_tkt instanceof EE_Ticket)
514 514
 					continue;
515 515
 
516 516
 				//is this ticket archived?  If it is then let's skip
517
-				if ( $orig_tkt->get( 'TKT_deleted' ) ) {
517
+				if ($orig_tkt->get('TKT_deleted')) {
518 518
 					continue;
519 519
 				}
520 520
 
521 521
 				//does this original ticket already exist in the clone_tickets cache?  If so we'll just use the new ticket from it.
522
-				if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) {
522
+				if (isset($cloned_tickets[$orig_tkt->ID()])) {
523 523
 					$new_tkt = $cloned_tickets[$orig_tkt->ID()];
524 524
 				} else {
525 525
 					$new_tkt = clone $orig_tkt;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 					$new_tkt->save(); //make sure new ticket has ID.
532 532
 
533 533
 					//price relations on new ticket need to be setup.
534
-					foreach ( $orig_prices as $orig_price ) {
534
+					foreach ($orig_prices as $orig_price) {
535 535
 						$new_price = clone $orig_price;
536 536
 						$new_price->set('PRC_ID', 0);
537 537
 						$new_price->save();
@@ -548,39 +548,39 @@  discard block
 block discarded – undo
548 548
 		}
549 549
 
550 550
 		//clone taxonomy information
551
-		$taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) );
551
+		$taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag'));
552 552
 
553 553
 		//get terms for original event (notice)
554
-		$orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with );
554
+		$orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
555 555
 
556 556
 		//loop through terms and add them to new event.
557
-		foreach ( $orig_terms as $term ) {
558
-			wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true );
557
+		foreach ($orig_terms as $term) {
558
+			wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
559 559
 		}
560 560
 
561 561
 
562
-		do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event );
562
+		do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
563 563
 
564 564
 		//now let's redirect to the edit page for this duplicated event if we have a new event id.
565
-		if ( $new_event->ID() ) {
565
+		if ($new_event->ID()) {
566 566
 			$redirect_args = array(
567 567
 				'post' => $new_event->ID(),
568 568
 				'action' => 'edit'
569 569
 			);
570
-			EE_Error::add_success( __('Event successfully duplicated.  Please review the details below and make any necessary edits', 'event_espresso') );
570
+			EE_Error::add_success(__('Event successfully duplicated.  Please review the details below and make any necessary edits', 'event_espresso'));
571 571
 		} else {
572 572
 			$redirect_args = array(
573 573
 				'action' => 'default'
574 574
 				);
575
-			EE_Error::add_error( __('Not able to duplicate event.  Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
575
+			EE_Error::add_error(__('Not able to duplicate event.  Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
576 576
 		}
577 577
 
578
-		$this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE );
578
+		$this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE);
579 579
 	}
580 580
 
581 581
 
582 582
 
583
-	protected function _import_page(){
583
+	protected function _import_page() {
584 584
 
585 585
 		$title = __('Import', 'event_espresso');
586 586
 		$intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso');
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 		$action = 'import_events';
589 589
 		$type = 'csv';
590 590
 		$this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type);
591
-		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url);
592
-		$content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true);
591
+		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url);
592
+		$content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true);
593 593
 
594 594
 
595 595
 		$this->_template_args['admin_page_content'] = $content;
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
 	 * @return string html
603 603
 	 */
604 604
 	protected function _import_events() {
605
-		require_once(EE_CLASSES . 'EE_Import.class.php');
605
+		require_once(EE_CLASSES.'EE_Import.class.php');
606 606
 		$success = EE_Import::instance()->import();
607
-		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true);
607
+		$this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true);
608 608
 
609 609
 	}
610 610
 
@@ -618,24 +618,24 @@  discard block
 block discarded – undo
618 618
 	 * @return file
619 619
 	 */
620 620
 	protected function _events_export() {
621
-		if(isset($this->_req_data['EVT_ID'])){
621
+		if (isset($this->_req_data['EVT_ID'])) {
622 622
 			$event_ids = $this->_req_data['EVT_ID'];
623
-		}elseif(isset($this->_req_data['EVT_IDs'])){
623
+		}elseif (isset($this->_req_data['EVT_IDs'])) {
624 624
 			$event_ids = $this->_req_data['EVT_IDs'];
625
-		}else{
625
+		} else {
626 626
 			$event_ids = NULL;
627 627
 		}
628 628
 		//todo: I don't like doing this but it'll do until we modify EE_Export Class.
629 629
 		$new_request_args = array(
630 630
 			'export' => 'report',
631 631
 			'action' => 'all_event_data',
632
-			'EVT_ID' => $event_ids ,
632
+			'EVT_ID' => $event_ids,
633 633
 		);
634 634
 		$this->_req_data = array_merge($this->_req_data, $new_request_args);
635 635
 
636
-		EE_Registry::instance()->load_helper( 'File' );
637
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
638
-			require_once(EE_CLASSES . 'EE_Export.class.php');
636
+		EE_Registry::instance()->load_helper('File');
637
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
638
+			require_once(EE_CLASSES.'EE_Export.class.php');
639 639
 			$EE_Export = EE_Export::instance($this->_req_data);
640 640
 			$EE_Export->export();
641 641
 		}
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
 			'category_ids' => $this->_req_data['EVT_CAT_ID']
658 658
 			);
659 659
 
660
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
660
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
661 661
 
662
-		EE_Registry::instance()->load_helper( 'File' );
663
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
664
-			require_once( EE_CLASSES . 'EE_Export.class.php');
665
-			$EE_Export = EE_Export::instance( $this->_req_data );
662
+		EE_Registry::instance()->load_helper('File');
663
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
664
+			require_once(EE_CLASSES.'EE_Export.class.php');
665
+			$EE_Export = EE_Export::instance($this->_req_data);
666 666
 			$EE_Export->export();
667 667
 		}
668 668
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	/**
674 674
 	 * Creates a sample CSV file for importing
675 675
 	 */
676
-	protected function _sample_export_file(){
676
+	protected function _sample_export_file() {
677 677
 //		require_once(EE_CLASSES . 'EE_Export.class.php');
678 678
 		EE_Export::instance()->export_sample();
679 679
 	}
@@ -690,10 +690,10 @@  discard block
 block discarded – undo
690 690
 		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
691 691
 		 * from General_Settings_Admin_Page to here.
692 692
 		 */
693
-		$this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args );
694
-		$this->_set_add_edit_form_tags( 'update_template_settings' );
695
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
696
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE );
693
+		$this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args);
694
+		$this->_set_add_edit_form_tags('update_template_settings');
695
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
696
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE);
697 697
 		$this->display_admin_page_with_sidebar();
698 698
 	}
699 699
 
@@ -705,24 +705,24 @@  discard block
 block discarded – undo
705 705
 		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
706 706
 		 * from General_Settings_Admin_Page to here.
707 707
 		 */
708
-		EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data );
708
+		EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data);
709 709
 
710 710
 
711 711
 		//update custom post type slugs and detect if we need to flush rewrite rules
712 712
 		$old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
713
-		EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] );
713
+		EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']);
714 714
 
715 715
 
716 716
 		$what = 'Template Settings';
717
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ );
717
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__);
718 718
 
719 719
 
720
-		if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) {
721
-			update_option( 'ee_flush_rewrite_rules', true );
720
+		if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) {
721
+			update_option('ee_flush_rewrite_rules', true);
722 722
 		}
723 723
 
724 724
 
725
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) );
725
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings'));
726 726
 
727 727
 	}
728 728
 
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
 		$this->verify_cpt_object();
742 742
 
743
-		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core');
743
+		add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core');
744 744
 		//add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready.
745 745
 
746 746
 		//todo feature in progress
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			array('id' => true, 'text' => __('Yes', 'event_espresso')),
765 765
 			array('id' => false, 'text' => __('No', 'event_espresso'))
766 766
 		);
767
-		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE);
767
+		$default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE);
768 768
 		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE);
769 769
 		$template_args['_event'] = $this->_cpt_model_obj;
770 770
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
771 771
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
772 772
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
773 773
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
774
-		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() );
775
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
776
-		$templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php';
774
+		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
775
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
776
+		$templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php';
777 777
 		EEH_Template::display_template($templatepath, $template_args);
778 778
 	}
779 779
 
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * @param  array  $box  metabox args
787 787
 	 * @return string       metabox contents
788 788
 	 */
789
-	public function event_type_meta_box( $post, $box ) {
790
-		$template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) );
791
-		$template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php';
789
+	public function event_type_meta_box($post, $box) {
790
+		$template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type'));
791
+		$template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php';
792 792
 		EEH_Template::display_template($template, $template_args);
793 793
 	}
794 794
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 
799 799
 
800 800
 
801
-	public function wp_terms_radio( $post_id = 0, $args = array() ) {
801
+	public function wp_terms_radio($post_id = 0, $args = array()) {
802 802
 		$defaults = array(
803 803
 			'descendants_and_self' => 0,
804 804
 			'selected_cats' => false,
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
 			'taxonomy' => 'category',
808 808
 			'checked_ontop' => true
809 809
 		);
810
-		$args = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
810
+		$args = apply_filters('wp_terms_checklist_args', $args, $post_id);
811 811
 
812
-		extract( wp_parse_args($args, $defaults), EXTR_SKIP );
812
+		extract(wp_parse_args($args, $defaults), EXTR_SKIP);
813 813
 
814
-		if ( empty($walker) || !is_a($walker, 'Walker') )
814
+		if (empty($walker) || ! is_a($walker, 'Walker'))
815 815
 			$walker = new Walker_Radio_Checklist;
816 816
 
817 817
 		$descendants_and_self = (int) $descendants_and_self;
@@ -819,37 +819,37 @@  discard block
 block discarded – undo
819 819
 		$args = array('taxonomy' => $taxonomy);
820 820
 
821 821
 		$tax = get_taxonomy($taxonomy);
822
-		$args['disabled'] = !current_user_can($tax->cap->assign_terms);
822
+		$args['disabled'] = ! current_user_can($tax->cap->assign_terms);
823 823
 
824
-		if ( is_array( $selected_cats ) )
824
+		if (is_array($selected_cats))
825 825
 			$args['selected_cats'] = $selected_cats;
826
-		elseif ( $post_id )
826
+		elseif ($post_id)
827 827
 			$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
828 828
 		else
829 829
 			$args['selected_cats'] = array();
830 830
 
831
-		if ( is_array( $popular_cats ) )
831
+		if (is_array($popular_cats))
832 832
 			$args['popular_cats'] = $popular_cats;
833 833
 		else
834
-			$args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
834
+			$args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false));
835 835
 
836
-		if ( $descendants_and_self ) {
837
-			$categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) );
838
-			$self = get_term( $descendants_and_self, $taxonomy );
839
-			array_unshift( $categories, $self );
836
+		if ($descendants_and_self) {
837
+			$categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
838
+			$self = get_term($descendants_and_self, $taxonomy);
839
+			array_unshift($categories, $self);
840 840
 		} else {
841 841
 			$categories = (array) get_terms($taxonomy, array('get' => 'all'));
842 842
 		}
843 843
 
844
-		if ( $checked_ontop ) {
844
+		if ($checked_ontop) {
845 845
 			// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
846 846
 			$checked_categories = array();
847
-			$keys = array_keys( $categories );
847
+			$keys = array_keys($categories);
848 848
 
849
-			foreach( $keys as $k ) {
850
-				if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
849
+			foreach ($keys as $k) {
850
+				if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
851 851
 					$checked_categories[] = $categories[$k];
852
-					unset( $categories[$k] );
852
+					unset($categories[$k]);
853 853
 				}
854 854
 			}
855 855
 
@@ -874,18 +874,18 @@  discard block
 block discarded – undo
874 874
 	 * @param  array  $list_table_obj the list table object
875 875
 	 * @return array                  new filters
876 876
 	 */
877
-	public function list_table_filters( $oldfilters, $list_table_obj ) {
877
+	public function list_table_filters($oldfilters, $list_table_obj) {
878 878
 		$filters = array();
879 879
 
880 880
 		//first month/year filters
881 881
 		$filters[] = $this->espresso_event_months_dropdown();
882 882
 
883 883
 
884
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
884
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
885 885
 
886 886
 		//active status dropdown
887
-		if ( $status !== 'draft' )
888
-			$filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' );
887
+		if ($status !== 'draft')
888
+			$filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : '');
889 889
 
890 890
 		//category filter
891 891
 		$filters[] = $this->category_dropdown();
@@ -907,17 +907,17 @@  discard block
 block discarded – undo
907 907
 	 */
908 908
 	public function espresso_event_months_dropdown() {
909 909
 		//what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set!
910
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
910
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
911 911
 
912 912
 		//categories?
913
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
913
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
914 914
 
915 915
 		//active status?
916
-		$active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL;
916
+		$active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL;
917 917
 
918 918
 		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
919 919
 
920
-		return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status );
920
+		return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
921 921
 	}
922 922
 
923 923
 
@@ -928,12 +928,12 @@  discard block
 block discarded – undo
928 928
 	 * @param  string $current_value whatever the ucrrent active status is
929 929
 	 * @return string                html dropdown.
930 930
 	 */
931
-	public function  active_status_dropdown( $current_value = '' ) {
931
+	public function  active_status_dropdown($current_value = '') {
932 932
 		$select_name = 'active_status';
933
-		$values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') );
933
+		$values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso'));
934 934
 		$id = 'id="espresso-active-status-dropdown-filter"';
935 935
 		$class = 'wide';
936
-		echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class );
936
+		echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class);
937 937
 	}
938 938
 
939 939
 
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
 	 * @return string html
946 946
 	 */
947 947
 	public function category_dropdown() {
948
-		$cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1;
948
+		$cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
949 949
 
950
-		return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat );
950
+		return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
951 951
 	}
952 952
 
953 953
 
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
 	 * @return int
960 960
 	 */
961 961
 	public function total_events_today() {
962
-		$start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' );
963
-		$end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' );
962
+		$start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC');
963
+		$end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC');
964 964
 
965 965
 		$where = array(
966
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) )
966
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end))
967 967
 			);
968 968
 
969
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
969
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
970 970
 		return $count;
971 971
 	}
972 972
 
@@ -981,14 +981,14 @@  discard block
 block discarded – undo
981 981
 		$this_year_r = date('Y');
982 982
 		$this_month_r = date('m');
983 983
 		$days_this_month = date('t');
984
-		$start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' );
985
-		$end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' );
984
+		$start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC');
985
+		$end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC');
986 986
 
987 987
 		$where = array(
988
-			'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) )
988
+			'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end))
989 989
 			);
990 990
 
991
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
991
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
992 992
 		return $count;
993 993
 	}
994 994
 
@@ -1005,53 +1005,53 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 
1007 1007
 
1008
-	public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
1008
+	public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) {
1009 1009
 
1010
-		$orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby'];
1011
-		$order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order'];
1010
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1011
+		$order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1012 1012
 
1013
-		switch ( $orderby ) {
1013
+		switch ($orderby) {
1014 1014
 			case 'TKT_name' :
1015
-				$orderby = array( 'TKT_name' => $order );
1015
+				$orderby = array('TKT_name' => $order);
1016 1016
 				break;
1017 1017
 
1018 1018
 			case 'TKT_price' :
1019
-				$orderby = array( 'TKT_price' => $order );
1019
+				$orderby = array('TKT_price' => $order);
1020 1020
 				break;
1021 1021
 
1022 1022
 			case 'TKT_uses' :
1023
-				$orderby = array( 'TKT_uses' => $order );
1023
+				$orderby = array('TKT_uses' => $order);
1024 1024
 				break;
1025 1025
 
1026 1026
 			case 'TKT_min' :
1027
-				$orderby = array( 'TKT_min' => $order );
1027
+				$orderby = array('TKT_min' => $order);
1028 1028
 				break;
1029 1029
 
1030 1030
 			case 'TKT_max' :
1031
-				$orderby = array( 'TKT_max' => $order );
1031
+				$orderby = array('TKT_max' => $order);
1032 1032
 				break;
1033 1033
 
1034 1034
 			case 'TKT_qty' :
1035
-				$orderby = array( 'TKT_qty' => $order );
1035
+				$orderby = array('TKT_qty' => $order);
1036 1036
 				break;
1037 1037
 		}
1038 1038
 
1039
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1040
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1039
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1040
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1041 1041
 
1042 1042
 		$_where = array(
1043 1043
 			'TKT_is_default' => 1,
1044 1044
 			'TKT_deleted' => $trashed
1045 1045
 			);
1046 1046
 
1047
-		$offset = ($current_page-1)*$per_page;
1048
-		$limit = array( $offset, $per_page );
1047
+		$offset = ($current_page - 1) * $per_page;
1048
+		$limit = array($offset, $per_page);
1049 1049
 
1050
-		if ( isset( $this->_req_data['s'] ) ) {
1051
-			$sstr = '%' . $this->_req_data['s'] . '%';
1050
+		if (isset($this->_req_data['s'])) {
1051
+			$sstr = '%'.$this->_req_data['s'].'%';
1052 1052
 			$_where['OR'] = array(
1053
-				'TKT_name' => array('LIKE',$sstr ),
1054
-				'TKT_description' => array('LIKE',$sstr )
1053
+				'TKT_name' => array('LIKE', $sstr),
1054
+				'TKT_description' => array('LIKE', $sstr)
1055 1055
 				);
1056 1056
 		}
1057 1057
 
@@ -1062,9 +1062,9 @@  discard block
 block discarded – undo
1062 1062
 			'group_by'=>'TKT_ID'
1063 1063
 			);
1064 1064
 
1065
-		if($count){
1065
+		if ($count) {
1066 1066
 			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
1067
-		}else{
1067
+		} else {
1068 1068
 			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1069 1069
 		}
1070 1070
 
@@ -1074,35 +1074,35 @@  discard block
 block discarded – undo
1074 1074
 
1075 1075
 
1076 1076
 
1077
-	protected function _trash_or_restore_ticket(  $trash = FALSE ) {
1077
+	protected function _trash_or_restore_ticket($trash = FALSE) {
1078 1078
 		$success = 1;
1079 1079
 
1080 1080
 		$TKT = EEM_Ticket::instance();
1081 1081
 
1082 1082
 		//checkboxes?
1083
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1083
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1084 1084
 			//if array has more than one element then success message should be plural
1085
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1085
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1086 1086
 
1087 1087
 			//cycle thru the boxes
1088
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1089
-				if ( $trash ) {
1090
-					if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1088
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1089
+				if ($trash) {
1090
+					if ( ! $TKT->delete_by_ID($TKT_ID))
1091 1091
 						$success = 0;
1092 1092
 				} else {
1093
-					if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1093
+					if ( ! $TKT->restore_by_ID($TKT_ID))
1094 1094
 						$success = 0;
1095 1095
 				}
1096 1096
 			}
1097 1097
 		} else {
1098 1098
 			//grab single id and trash
1099
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1099
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1100 1100
 
1101
-			if ( $trash ) {
1102
-				if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1101
+			if ($trash) {
1102
+				if ( ! $TKT->delete_by_ID($TKT_ID))
1103 1103
 					$success = 0;
1104 1104
 			} else {
1105
-				if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1105
+				if ( ! $TKT->restore_by_ID($TKT_ID))
1106 1106
 					$success = 0;
1107 1107
 			}
1108 1108
 		}
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 			'action' => 'ticket_list_table',
1113 1113
 			'status' => $trash ? '' : 'trashed'
1114 1114
 			);
1115
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1115
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1116 1116
 	}
1117 1117
 
1118 1118
 
@@ -1125,21 +1125,21 @@  discard block
 block discarded – undo
1125 1125
 		$TKT = EEM_Ticket::instance();
1126 1126
 
1127 1127
 		//checkboxes?
1128
-		if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) {
1128
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1129 1129
 			//if array has more than one element then success message should be plural
1130
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1130
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1131 1131
 
1132 1132
 			//cycle thru the boxes
1133
-			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1133
+			while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) {
1134 1134
 				//delete
1135
-				if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1135
+				if ( ! $this->_delete_the_ticket($TKT_ID)) {
1136 1136
 					$success = 0;
1137 1137
 				}
1138 1138
 			}
1139 1139
 		} else {
1140 1140
 			//grab single id and trash
1141
-			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1142
-			if ( ! $this->_delete_the_ticket( $TKT_ID ) ) {
1141
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1142
+			if ( ! $this->_delete_the_ticket($TKT_ID)) {
1143 1143
 					$success = 0;
1144 1144
 				}
1145 1145
 		}
@@ -1151,16 +1151,16 @@  discard block
 block discarded – undo
1151 1151
 			);
1152 1152
 
1153 1153
 		//failsafe.  If the default ticket count === 1 then we need to redirect to event overview.
1154
-		if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) )
1154
+		if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE))
1155 1155
 			$query_args = array();
1156
-		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1156
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1157 1157
 	}
1158 1158
 
1159 1159
 
1160 1160
 
1161 1161
 
1162
-	protected function _delete_the_ticket( $TKT_ID ) {
1163
-		$tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID );
1162
+	protected function _delete_the_ticket($TKT_ID) {
1163
+		$tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1164 1164
 		$tkt->_remove_relations('Datetime');
1165 1165
 		//delete all related prices first
1166 1166
 		$tkt->delete_related_permanently('Price');
Please login to merge, or discard this patch.
Braces   +44 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -435,8 +436,9 @@  discard block
 block discarded – undo
435 436
 		//k we've got EVT_ID so let's use that to get the event we'll duplicate
436 437
 		$orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] );
437 438
 
438
-		if ( ! $orig_event instanceof EE_Event )
439
-			throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) );
439
+		if ( ! $orig_event instanceof EE_Event ) {
440
+					throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso '), $this->_req_data['EVT_ID'] ) );
441
+		}
440 442
 
441 443
 		//k now let's clone the $orig_event before getting relations
442 444
 		$new_event = clone $orig_event;
@@ -510,8 +512,9 @@  discard block
 block discarded – undo
510 512
 			//now let's get the ticket relations setup.
511 513
 			foreach ( (array) $orig_tkts as $orig_tkt ) {
512 514
 				//it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
513
-				if ( ! $orig_tkt instanceof EE_Ticket )
514
-					continue;
515
+				if ( ! $orig_tkt instanceof EE_Ticket ) {
516
+									continue;
517
+				}
515 518
 
516 519
 				//is this ticket archived?  If it is then let's skip
517 520
 				if ( $orig_tkt->get( 'TKT_deleted' ) ) {
@@ -620,9 +623,9 @@  discard block
 block discarded – undo
620 623
 	protected function _events_export() {
621 624
 		if(isset($this->_req_data['EVT_ID'])){
622 625
 			$event_ids = $this->_req_data['EVT_ID'];
623
-		}elseif(isset($this->_req_data['EVT_IDs'])){
626
+		} elseif(isset($this->_req_data['EVT_IDs'])){
624 627
 			$event_ids = $this->_req_data['EVT_IDs'];
625
-		}else{
628
+		} else{
626 629
 			$event_ids = NULL;
627 630
 		}
628 631
 		//todo: I don't like doing this but it'll do until we modify EE_Export Class.
@@ -811,8 +814,9 @@  discard block
 block discarded – undo
811 814
 
812 815
 		extract( wp_parse_args($args, $defaults), EXTR_SKIP );
813 816
 
814
-		if ( empty($walker) || !is_a($walker, 'Walker') )
815
-			$walker = new Walker_Radio_Checklist;
817
+		if ( empty($walker) || !is_a($walker, 'Walker') ) {
818
+					$walker = new Walker_Radio_Checklist;
819
+		}
816 820
 
817 821
 		$descendants_and_self = (int) $descendants_and_self;
818 822
 
@@ -821,17 +825,19 @@  discard block
 block discarded – undo
821 825
 		$tax = get_taxonomy($taxonomy);
822 826
 		$args['disabled'] = !current_user_can($tax->cap->assign_terms);
823 827
 
824
-		if ( is_array( $selected_cats ) )
825
-			$args['selected_cats'] = $selected_cats;
826
-		elseif ( $post_id )
827
-			$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
828
-		else
829
-			$args['selected_cats'] = array();
828
+		if ( is_array( $selected_cats ) ) {
829
+					$args['selected_cats'] = $selected_cats;
830
+		} elseif ( $post_id ) {
831
+					$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
832
+		} else {
833
+					$args['selected_cats'] = array();
834
+		}
830 835
 
831
-		if ( is_array( $popular_cats ) )
832
-			$args['popular_cats'] = $popular_cats;
833
-		else
834
-			$args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
836
+		if ( is_array( $popular_cats ) ) {
837
+					$args['popular_cats'] = $popular_cats;
838
+		} else {
839
+					$args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
840
+		}
835 841
 
836 842
 		if ( $descendants_and_self ) {
837 843
 			$categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) );
@@ -884,8 +890,9 @@  discard block
 block discarded – undo
884 890
 		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
885 891
 
886 892
 		//active status dropdown
887
-		if ( $status !== 'draft' )
888
-			$filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' );
893
+		if ( $status !== 'draft' ) {
894
+					$filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' );
895
+		}
889 896
 
890 897
 		//category filter
891 898
 		$filters[] = $this->category_dropdown();
@@ -1064,7 +1071,7 @@  discard block
 block discarded – undo
1064 1071
 
1065 1072
 		if($count){
1066 1073
 			return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where));
1067
-		}else{
1074
+		} else{
1068 1075
 			return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1069 1076
 		}
1070 1077
 
@@ -1087,11 +1094,13 @@  discard block
 block discarded – undo
1087 1094
 			//cycle thru the boxes
1088 1095
 			while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) {
1089 1096
 				if ( $trash ) {
1090
-					if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1091
-						$success = 0;
1097
+					if ( ! $TKT->delete_by_ID( $TKT_ID ) ) {
1098
+											$success = 0;
1099
+					}
1092 1100
 				} else {
1093
-					if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1094
-						$success = 0;
1101
+					if ( ! $TKT->restore_by_ID( $TKT_ID ) ) {
1102
+											$success = 0;
1103
+					}
1095 1104
 				}
1096 1105
 			}
1097 1106
 		} else {
@@ -1099,11 +1108,13 @@  discard block
 block discarded – undo
1099 1108
 			$TKT_ID = absint( $this->_req_data['TKT_ID'] );
1100 1109
 
1101 1110
 			if ( $trash ) {
1102
-				if ( ! $TKT->delete_by_ID( $TKT_ID ) )
1103
-					$success = 0;
1111
+				if ( ! $TKT->delete_by_ID( $TKT_ID ) ) {
1112
+									$success = 0;
1113
+				}
1104 1114
 			} else {
1105
-				if ( ! $TKT->restore_by_ID( $TKT_ID ) )
1106
-					$success = 0;
1115
+				if ( ! $TKT->restore_by_ID( $TKT_ID ) ) {
1116
+									$success = 0;
1117
+				}
1107 1118
 			}
1108 1119
 		}
1109 1120
 
@@ -1151,8 +1162,9 @@  discard block
 block discarded – undo
1151 1162
 			);
1152 1163
 
1153 1164
 		//failsafe.  If the default ticket count === 1 then we need to redirect to event overview.
1154
-		if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) )
1155
-			$query_args = array();
1165
+		if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) {
1166
+					$query_args = array();
1167
+		}
1156 1168
 		$this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args );
1157 1169
 	}
1158 1170
 
Please login to merge, or discard this patch.
pricing/templates/event_tickets_datetime_ticket_js_structure.template.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,19 +76,19 @@
 block discarded – undo
76 76
 
77 77
 <?php
78 78
 /**
79
- * template args in use
80
- * 
81
- * $default_datetime_edit_row
82
- * $default_ticket_row
83
- * $default_price_row
84
- * $default_price_rows
85
- * $default_base_price_amount
86
- * $default_base_price_name
87
- * $default_base_price_description
88
- * $default_price_modifier_selector_row
89
- * $default_available_tickets_for_datetime
90
- * $existing_available_datetime_tickets_list
91
- * $existing_available_ticket_datetimes_list
92
- * $new_available_datetime_ticket_list_item
93
- * $new_available_ticket_datetime_list_item
94
- */
95 79
\ No newline at end of file
80
+					 * template args in use
81
+					 * 
82
+					 * $default_datetime_edit_row
83
+					 * $default_ticket_row
84
+					 * $default_price_row
85
+					 * $default_price_rows
86
+					 * $default_base_price_amount
87
+					 * $default_base_price_name
88
+					 * $default_base_price_description
89
+					 * $default_price_modifier_selector_row
90
+					 * $default_available_tickets_for_datetime
91
+					 * $existing_available_datetime_tickets_list
92
+					 * $existing_available_ticket_datetimes_list
93
+					 * $new_available_datetime_ticket_list_item
94
+					 * $new_available_ticket_datetime_list_item
95
+					 */
96 96
\ No newline at end of file
Please login to merge, or discard this patch.
new/pricing/templates/event_tickets_datetime_ticket_tax_row.template.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
 </tr>
12 12
 <?php
13 13
 /**
14
- * template vars in use:
15
- *
16
- * $tkt_row
17
- * $display_tax
18
- * $tax_label
19
- * $tax_added
20
- * $tax_amount
21
- */
22 14
\ No newline at end of file
15
+					 * template vars in use:
16
+					 *
17
+					 * $tkt_row
18
+					 * $display_tax
19
+					 * $tax_label
20
+					 * $tax_added
21
+					 * $tax_amount
22
+					 */
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
admin/new/pricing/templates/event_tickets_metabox_main.template.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -99,17 +99,17 @@
 block discarded – undo
99 99
 <?php echo $ticket_js_structure; ?>
100 100
 <?php
101 101
 /**
102
- * template vars in use
103
- *
104
- * $event_datetime_help_link
105
- * $existing_datetime_ids
106
- * $total_dtt_rows
107
- * $add_new_dtt_help_link
108
- * $datetime_rows
109
- * $show_tickets_container
110
- * $ticket_rows
111
- * $existing_ticket_ids
112
- * $total_ticket_rows
113
- * $ticket_js_structure
114
- * $ee_collapsible_status
115
- */
116 102
\ No newline at end of file
103
+					 * template vars in use
104
+					 *
105
+					 * $event_datetime_help_link
106
+					 * $existing_datetime_ids
107
+					 * $total_dtt_rows
108
+					 * $add_new_dtt_help_link
109
+					 * $datetime_rows
110
+					 * $show_tickets_container
111
+					 * $ticket_rows
112
+					 * $existing_ticket_ids
113
+					 * $total_ticket_rows
114
+					 * $ticket_js_structure
115
+					 * $ee_collapsible_status
116
+					 */
117 117
\ No newline at end of file
Please login to merge, or discard this patch.
admin/new/pricing/templates/event_tickets_datetime_row_wrapper.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 <?php echo $dtt_attached_tickets_row; ?>
3 3
 <?php
4 4
 /**
5
- * template vars used in template
6
- *
7
- * $dtt_row
8
- * $dtt_edit_row
9
- * $dtt_attached_tickets_row
10
- */
11 5
\ No newline at end of file
6
+					 * template vars used in template
7
+					 *
8
+					 * $dtt_row
9
+					 * $dtt_edit_row
10
+					 * $dtt_attached_tickets_row
11
+					 */
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
help_tabs/payment_methods_overview_paypalstandard.help_tab.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?>
6
+<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?>
7 7
 </p>
8 8
 <h3><?php _e('PayPal Standard Settings', 'event_espresso'); ?></h3>
9 9
 <ul>
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 </li>
22 22
 <li>
23 23
 <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br />
24
-<?php printf( __('If set to "Yes", we will indicate to PayPal that it ought to calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/>
25
-<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?>
24
+<?php printf(__('If set to "Yes", we will indicate to PayPal that it ought to calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/>
25
+<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?>
26 26
 </li>
27 27
 <li>
28 28
 <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br />
29 29
 <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it ought to calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/>
30
-<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?>
30
+<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?>
31 31
 <li>
32
-<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/>
33
-<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/>
34
-<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/>
35
-<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?>
32
+<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/>
33
+<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/>
34
+<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/>
35
+<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?>
36 36
 </li>
37 37
 <li>
38 38
 <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br />
Please login to merge, or discard this patch.
registrations/templates/attendee_registrations_main_meta_box.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
 		<table class="admin-primary-mbox-tbl">
6 6
 			<thead>
7 7
 				<tr>
8
-					<th class="jst-left"><?php _e( 'Event Name', 'event_espresso' );?></th>
9
-					<th class="jst-left"><?php _e( 'REG ID', 'event_espresso' );?></th>
10
-					<th class="jst-left"><?php _e( 'TXN ID', 'event_espresso' );?></th>
11
-					<th class="jst-left"><?php _e( 'Reg Code', 'event_espresso' );?></th>
12
-					<th class="jst-rght"><?php _e( 'Ticket Price', 'event_espresso' );?></th>
8
+					<th class="jst-left"><?php _e('Event Name', 'event_espresso'); ?></th>
9
+					<th class="jst-left"><?php _e('REG ID', 'event_espresso'); ?></th>
10
+					<th class="jst-left"><?php _e('TXN ID', 'event_espresso'); ?></th>
11
+					<th class="jst-left"><?php _e('Reg Code', 'event_espresso'); ?></th>
12
+					<th class="jst-rght"><?php _e('Ticket Price', 'event_espresso'); ?></th>
13 13
 				</tr>
14 14
 			</thead>
15 15
 			<tbody>
16
-			<?php foreach( $registrations as $registration ) : ?>
16
+			<?php foreach ($registrations as $registration) : ?>
17 17
 				<tr>
18 18
 					<td class="jst-left">
19 19
 					<?php
20
-						$event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' ));
21
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ?  '<a href="'. $event_url .'"  title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name();
20
+						$event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events'));
21
+						echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'"  title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name();
22 22
 					?>
23 23
 					</td>
24 24
 					<td class="jst-left">
25 25
 					<?php
26
-							$reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
27
-							echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
28
-							<a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . 
29
-								sprintf( __( 'View Registration ', 'event_espresso'), $registration->ID() ) .
26
+							$reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
27
+							echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
28
+							<a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. 
29
+								sprintf(__('View Registration ', 'event_espresso'), $registration->ID()).
30 30
 							'</a>' : '';
31 31
 					?>
32 32
 					</td>
33 33
 					<td class="jst-left">
34 34
 					<?php
35
-						$txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL );
36
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '
37
-						<a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">
38
-							View Transaction ' . $registration->transaction_ID() . '
35
+						$txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL);
36
+						echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
37
+						<a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">
38
+							View Transaction ' . $registration->transaction_ID().'
39 39
 						</a>' : '';
40 40
 					?>
41 41
 					</td>
42
-					<td class="jst-left"><?php echo $registration->reg_code();?></td>
43
-					<td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td>
42
+					<td class="jst-left"><?php echo $registration->reg_code(); ?></td>
43
+					<td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td>
44 44
 				</tr>
45 45
 			<?php endforeach; ?>
46 46
 			</tbody>
Please login to merge, or discard this patch.