Completed
Branch BUG-10050-ticket-price-details (1781ce)
by
unknown
80:36 queued 69:23
created
core/interfaces/EEI_Interfaces.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 interface EEI_Attendee {
191 191
 	public function fname();
192 192
 	public function lname();
193
-    public function full_name();
193
+	public function full_name();
194 194
 	public function email();
195 195
 	public function phone();
196 196
 	public function address();
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
 	 * @param float $amount
312 312
 	 * @param string $name
313 313
 	 * @param string $description
314
-         * @param string $code
315
-         * @param boolean $add_to_existing_line_item if true and a duplicate line item with
316
-         *  the same code is found, $amount will be added onto it; otherwise will simply
317
-         *  set the taxes to match $amount
314
+	 * @param string $code
315
+	 * @param boolean $add_to_existing_line_item if true and a duplicate line item with
316
+	 *  the same code is found, $amount will be added onto it; otherwise will simply
317
+	 *  set the taxes to match $amount
318 318
 	 * @return EE_Line_Item the new tax created
319 319
 	 */
320 320
 	public function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name  = NULL, $description = NULL, $code = NULL, $add_to_existing_line_item = false );
321 321
 
322
-         /**
323
-         * Makes all the line items which are children of $line_item taxable (or not).
324
-         * Does NOT save the line items
325
-         * @param EE_Line_Item $line_item
326
-         * @param boolean $taxable
327
-         * @param string $code_substring_for_whitelist if this string is part of the line item's code
328
-         *  it will be whitelisted (ie, except from becoming taxable)
329
-         */
330
-        public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null );
322
+		 /**
323
+		  * Makes all the line items which are children of $line_item taxable (or not).
324
+		  * Does NOT save the line items
325
+		  * @param EE_Line_Item $line_item
326
+		  * @param boolean $taxable
327
+		  * @param string $code_substring_for_whitelist if this string is part of the line item's code
328
+		  *  it will be whitelisted (ie, except from becoming taxable)
329
+		  */
330
+		public static function set_line_items_taxable( EE_Line_Item $line_item, $taxable = true, $code_substring_for_whitelist = null );
331 331
 
332 332
 	/**
333 333
 	 * Adds a simple item ( unrelated to any other model object) to the total line item,
@@ -357,15 +357,15 @@  discard block
 block discarded – undo
357 357
  */
358 358
 interface EEHI_Money{
359 359
 		/**
360
-	 * For comparing floats. Default operator is '=', but see the $operator below for all options.
361
-	 * This should be used to compare floats instead of normal '==' because floats
362
-	 * are inherently imprecise, and so you can sometimes have two floats that appear to be identical
363
-	 * but actually differ by 0.00000001.
364
-	 * @param float $float1
365
-	 * @param float $float2
366
-	 * @param string $operator  The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
367
-	 * @return boolean whether the equation is true or false
368
-	 */
360
+		 * For comparing floats. Default operator is '=', but see the $operator below for all options.
361
+		 * This should be used to compare floats instead of normal '==' because floats
362
+		 * are inherently imprecise, and so you can sometimes have two floats that appear to be identical
363
+		 * but actually differ by 0.00000001.
364
+		 * @param float $float1
365
+		 * @param float $float2
366
+		 * @param string $operator  The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne
367
+		 * @return boolean whether the equation is true or false
368
+		 */
369 369
 	public function compare_floats( $float1, $float2, $operator='=' );
370 370
 }
371 371
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Paypal_Pro/EEG_Paypal_Pro.gateway.php 2 patches
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Paypal_Pro extends EE_Onsite_Gateway{
28
+class EEG_Paypal_Pro extends EE_Onsite_Gateway {
29 29
 	/**
30 30
 	 *
31 31
 	 * @var $_paypal_api_username string
@@ -88,42 +88,42 @@  discard block
 block discarded – undo
88 88
 	 * } @see parent::do_direct_payment for more info
89 89
 	 * @return \EE_Payment|\EEI_Payment
90 90
 	 */
91
-	public function do_direct_payment($payment,$billing_info = null){
91
+	public function do_direct_payment($payment, $billing_info = null) {
92 92
 		$transaction = $payment->transaction();
93
-        if (! $transaction instanceof EEI_Transaction) {
93
+        if ( ! $transaction instanceof EEI_Transaction) {
94 94
             throw new EE_Error(esc_html('No transaction for payment while paying with PayPal Pro.', 'event_espresso'));
95 95
         }
96 96
         $primary_registrant = $transaction->primary_registration();
97
-        if (! $primary_registrant instanceof EEI_Registration) {
97
+        if ( ! $primary_registrant instanceof EEI_Registration) {
98 98
             throw new EE_Error(esc_html('No primary registration on transaction while paying with PayPal Pro.',
99 99
                 'event_espresso'));
100 100
         }
101 101
         $attendee = $primary_registrant->attendee();
102
-        if (! $attendee instanceof EEI_Attendee) {
102
+        if ( ! $attendee instanceof EEI_Attendee) {
103 103
             throw new EE_Error(esc_html('No attendee on primary registration while paying with PayPal Pro.',
104 104
                 'event_espresso'));
105 105
         }
106
-		$order_description  = $this->_format_order_description( $payment );
106
+		$order_description = $this->_format_order_description($payment);
107 107
 		//charge for the full amount. Show itemized list
108
-		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
108
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
109 109
 			$item_num = 1;
110 110
 			$total_line_item = $transaction->total_line_item();
111 111
 			$order_items = array();
112 112
 			foreach ($total_line_item->get_items() as $line_item) {
113 113
 				//ignore line items with a quantity of 0
114
-				if( $line_item->quantity() == 0 ) {
114
+				if ($line_item->quantity() == 0) {
115 115
 					continue;
116 116
 				}
117 117
 				$item = array(
118 118
 						// Item Name.  127 char max.
119 119
 						'l_name' => substr(
120
-							$this->_format_line_item_name( $line_item, $payment ),
120
+							$this->_format_line_item_name($line_item, $payment),
121 121
 							0,
122 122
 							127
123 123
 						),
124 124
 						// Item description.  127 char max.
125 125
 						'l_desc' => substr( 
126
-							$this->_format_line_item_desc( $line_item, $payment ),
126
+							$this->_format_line_item_desc($line_item, $payment),
127 127
 							0,
128 128
 							127
129 129
 						),
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
 			}
148 148
 			$item_amount = $total_line_item->get_items_total();
149 149
 			$tax_amount = $total_line_item->get_total_tax();
150
-		}else{
150
+		} else {
151 151
 			$order_items = array();
152 152
 			$item_amount = $payment->amount();
153 153
 			$tax_amount = 0;
154
-			array_push($order_items,array(
154
+			array_push($order_items, array(
155 155
 				// Item Name.  127 char max.
156 156
 				'l_name' => substr(
157
-					$this->_format_partial_payment_line_item_name( $payment ),
157
+					$this->_format_partial_payment_line_item_name($payment),
158 158
 					0,
159 159
 					127
160 160
 				),
161 161
 				// Item description.  127 char max.
162 162
 				'l_desc' => substr( 
163
-					$this->_format_partial_payment_line_item_desc( $payment ),
163
+					$this->_format_partial_payment_line_item_desc($payment),
164 164
 					0,
165 165
 					127
166 166
 				),
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 			// Payer's salutation.  20 char max.
209 209
 			'salutation' => '',
210 210
 			// Payer's first name.  25 char max.
211
-			'firstname' => substr($billing_info['first_name'],0,25),
211
+			'firstname' => substr($billing_info['first_name'], 0, 25),
212 212
 			// Payer's middle name.  25 char max.
213 213
 			'middlename' => '',
214 214
 			// Payer's last name.  25 char max.
215
-			'lastname' => substr($billing_info['last_name'],0,25),
215
+			'lastname' => substr($billing_info['last_name'], 0, 25),
216 216
 			// Payer's suffix.  12 char max.
217 217
 			'suffix' => ''
218 218
 		);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			// Required.  Name of City.
226 226
 			'city' => $billing_info['city'],
227 227
 			// Required. Name of State or Province.
228
-			'state' => substr( $billing_info['state'], 0, 40 ),
228
+			'state' => substr($billing_info['state'], 0, 40),
229 229
 			// Required.  Country code.
230 230
 			'countrycode' => $billing_info['country'],
231 231
 			// Required.  Postal code of payer.
@@ -233,21 +233,21 @@  discard block
 block discarded – undo
233 233
 		);
234 234
 
235 235
         //check if the registration info contains the needed fields for paypal pro (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/)
236
-        if($attendee->address() && $attendee->city() && $attendee->country_ID()){
236
+        if ($attendee->address() && $attendee->city() && $attendee->country_ID()) {
237 237
             $use_registration_address_info = true;
238 238
         } else {
239 239
             $use_registration_address_info = false;
240 240
         }
241 241
         //so if the attendee has enough data to fill out PayPal Pro's shipping info, use it. If not, use the billing info again
242 242
         $ShippingAddress = array(
243
-            'shiptoname' => substr($use_registration_address_info ? $attendee->full_name() : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32),
243
+            'shiptoname' => substr($use_registration_address_info ? $attendee->full_name() : $billing_info['first_name'].' '.$billing_info['last_name'], 0, 32),
244 244
             'shiptostreet' => substr($use_registration_address_info ? $attendee->address() : $billing_info['address'], 0, 100),
245
-            'shiptostreet2' => substr($use_registration_address_info ? $attendee->address2() : $billing_info['address2'],0,100),
246
-            'shiptocity' => substr($use_registration_address_info ? $attendee->city() : $billing_info['city'],0,40),
247
-            'state' => substr($use_registration_address_info ? $attendee->state_name() : $billing_info['state'],0,40),
245
+            'shiptostreet2' => substr($use_registration_address_info ? $attendee->address2() : $billing_info['address2'], 0, 100),
246
+            'shiptocity' => substr($use_registration_address_info ? $attendee->city() : $billing_info['city'], 0, 40),
247
+            'state' => substr($use_registration_address_info ? $attendee->state_name() : $billing_info['state'], 0, 40),
248 248
             'shiptocountry' => $use_registration_address_info ? $attendee->country_ID() : $billing_info['country'],
249
-            'shiptozip' => substr($use_registration_address_info ? $attendee->zip() : $billing_info['zip'],0,20),
250
-            'shiptophonenum' => substr($use_registration_address_info ? $attendee->phone() : $billing_info['phone'],0,20),
249
+            'shiptozip' => substr($use_registration_address_info ? $attendee->zip() : $billing_info['zip'], 0, 20),
250
+            'shiptophonenum' => substr($use_registration_address_info ? $attendee->phone() : $billing_info['phone'], 0, 20),
251 251
         );
252 252
 
253 253
 		$PaymentDetails = array(
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			// Required.  Three-letter currency code.  Default is USD.
257 257
 			'currencycode' => $payment->currency_code(),
258 258
 			// Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
259
-			'itemamt' => $this->format_currency($item_amount),//
259
+			'itemamt' => $this->format_currency($item_amount), //
260 260
 			// Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
261 261
 			'shippingamt' => '',
262 262
 			// Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 			// Free-form field for your own use.  256 char max.
269 269
 			'custom' => $primary_registrant ? $primary_registrant->ID() : '',
270 270
 			// Your own invoice or tracking number
271
-			'invnum' => wp_generate_password(12,false),//$transaction->ID(),
271
+			'invnum' => wp_generate_password(12, false), //$transaction->ID(),
272 272
 			// URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
273 273
 			'notifyurl' => '',
274
-			'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this
274
+			'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this
275 275
 		);
276 276
 		// Wrap all data arrays into a single, "master" array which will be passed into the class function.
277 277
 		$PayPalRequestData = array(
@@ -285,32 +285,32 @@  discard block
 block discarded – undo
285 285
 				'OrderItems' => $order_items,
286 286
 		);
287 287
 		$this->_log_clean_request($PayPalRequestData, $payment);
288
-		try{
288
+		try {
289 289
 			$PayPalResult = $this->prep_and_curl_request($PayPalRequestData);
290 290
 			//remove PCI-sensitive data so it doesn't get stored
291
-			$PayPalResult = $this->_log_clean_response($PayPalResult,$payment);
291
+			$PayPalResult = $this->_log_clean_response($PayPalResult, $payment);
292 292
 
293 293
 			$message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK'];
294
-			if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) {
295
-				$payment->set_status( $this->_pay_model->failed_status() ) ;
296
-				$payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) );
294
+			if (empty($PayPalResult['RAWRESPONSE'])) {
295
+				$payment->set_status($this->_pay_model->failed_status());
296
+				$payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso'));
297 297
 				$payment->set_details($PayPalResult);
298
-			}else{
299
-				if($this->_APICallSuccessful($PayPalResult)){
298
+			} else {
299
+				if ($this->_APICallSuccessful($PayPalResult)) {
300 300
 					$payment->set_status($this->_pay_model->approved_status());
301
-				}else{
301
+				} else {
302 302
 					$payment->set_status($this->_pay_model->declined_status());
303 303
 				}
304 304
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
305
-				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0);
305
+				$payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0);
306 306
 				$payment->set_gateway_response($message);
307
-				$payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null);
307
+				$payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null);
308 308
 
309 309
 				$primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : '';
310 310
 				$payment->set_extra_accntng($primary_registration_code);
311 311
 				$payment->set_details($PayPalResult);
312 312
 			}
313
-		}catch(Exception $e){
313
+		} catch (Exception $e) {
314 314
 			$payment->set_status($this->_pay_model->failed_status());
315 315
 			$payment->set_gateway_response($e->getMessage());
316 316
 		}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @param EEI_Payment $payment
328 328
 	 * @return array
329 329
 	 */
330
-	private function _log_clean_request($request,$payment){
330
+	private function _log_clean_request($request, $payment) {
331 331
 		$cleaned_request_data = $request;
332 332
 		unset($cleaned_request_data['CCDetails']['acct']);
333 333
 		unset($cleaned_request_data['CCDetails']['cvv2']);
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 	 * @param EEI_Payment $payment
344 344
 	 * @return array cleaned
345 345
 	 */
346
-	private function _log_clean_response($response,$payment){
346
+	private function _log_clean_response($response, $payment) {
347 347
 		unset($response['REQUESTDATA']['CREDITCARDTYPE']);
348 348
 		unset($response['REQUESTDATA']['ACCT']);
349 349
 		unset($response['REQUESTDATA']['EXPDATE']);
350 350
 		unset($response['REQUESTDATA']['CVV2']);
351 351
 		unset($response['RAWREQUEST']);
352
-		$this->log(array('Paypal Response'=>$response),$payment);
352
+		$this->log(array('Paypal Response'=>$response), $payment);
353 353
 		return $response;
354 354
 	}
355 355
 
@@ -374,32 +374,32 @@  discard block
 block discarded – undo
374 374
 		// DP Fields
375 375
 		$DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array();
376 376
 		foreach ($DPFields as $DPFieldsVar => $DPFieldsVal)
377
-			$DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal);
377
+			$DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal);
378 378
 
379 379
 		// CC Details Fields
380 380
 		$CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array();
381 381
 		foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal)
382
-			$CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal);
382
+			$CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal);
383 383
 
384 384
 		// PayerInfo Type Fields
385 385
 		$PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array();
386 386
 		foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal)
387
-			$PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal);
387
+			$PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal);
388 388
 
389 389
 		// Payer Name Fields
390 390
 		$PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array();
391 391
 		foreach ($PayerName as $PayerNameVar => $PayerNameVal)
392
-			$PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal);
392
+			$PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal);
393 393
 
394 394
 		// Address Fields (Billing)
395 395
 		$BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array();
396 396
 		foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal)
397
-			$BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal);
397
+			$BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal);
398 398
 
399 399
 		// Payment Details Type Fields
400 400
 		$PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array();
401 401
 		foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal)
402
-			$PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal);
402
+			$PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal);
403 403
 
404 404
 		// Payment Details Item Type Fields
405 405
 		$OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array();
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 		foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) {
408 408
 			$CurrentItem = $OrderItems[$OrderItemsVar];
409 409
 			foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal)
410
-				$OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal);
410
+				$OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal);
411 411
 			$n++;
412 412
 		}
413 413
 
414 414
 		// Ship To Address Fields
415 415
 		$ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array();
416 416
 		foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal)
417
-			$ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal);
417
+			$ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal);
418 418
 
419 419
 		// 3D Secure Fields
420 420
 		$Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array();
421 421
 		foreach ($Secure3D as $Secure3DVar => $Secure3DVal)
422
-			$Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal);
422
+			$Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal);
423 423
 
424 424
 		// Now that we have each chunk we need to go ahead and append them all together for our entire NVP string
425
-		$NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP;
425
+		$NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP;
426 426
 		$NVPResponse = $this->_CURLRequest($NVPRequest);
427 427
 		$NVPRequestArray = $this->_NVPToArray($NVPRequest);
428 428
 		$NVPResponseArray = $this->_NVPToArray($NVPResponse);
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 	private function _CURLRequest($Request) {
447 447
 		$EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp';
448 448
 		$curl = curl_init();
449
-		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) );
449
+		curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE));
450 450
 		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
451 451
 		curl_setopt($curl, CURLOPT_TIMEOUT, 60);
452 452
 		curl_setopt($curl, CURLOPT_URL, $EndPointURL);
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 	private function _APICallSuccessful($PayPalResult) {
497 497
 		$approved = false;
498 498
 		// check main response message from PayPal
499
-		if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) {
499
+		if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) {
500 500
 			$ack = strtoupper($PayPalResult['ACK']);
501
-			$approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false;
501
+			$approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false;
502 502
 		}
503 503
 
504 504
 		return $approved;
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 
515 515
 		$Errors = array();
516 516
 		$n = 0;
517
-		while (isset($DataArray['L_ERRORCODE' . $n . ''])) {
518
-			$LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : '';
519
-			$LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : '';
520
-			$LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : '';
521
-			$LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : '';
517
+		while (isset($DataArray['L_ERRORCODE'.$n.''])) {
518
+			$LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : '';
519
+			$LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : '';
520
+			$LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : '';
521
+			$LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : '';
522 522
 
523 523
 			$CurrentItem = array(
524 524
 					'L_ERRORCODE' => $LErrorCode,
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 				elseif ($CurrentErrorVar == 'L_SEVERITYCODE')
559 559
 					$CurrentVarName = 'Severity Code';
560 560
 
561
-				$error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal;
561
+				$error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal;
562 562
 			}
563 563
 		}
564 564
 		return $error;
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function do_direct_payment($payment,$billing_info = null){
92 92
 		$transaction = $payment->transaction();
93
-        if (! $transaction instanceof EEI_Transaction) {
94
-            throw new EE_Error(esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso'));
95
-        }
96
-        $primary_registrant = $transaction->primary_registration();
97
-        if (! $primary_registrant instanceof EEI_Registration) {
98
-            throw new EE_Error(esc_html__('No primary registration on transaction while paying with PayPal Pro.',
99
-                'event_espresso'));
100
-        }
101
-        $attendee = $primary_registrant->attendee();
102
-        if (! $attendee instanceof EEI_Attendee) {
103
-            throw new EE_Error(esc_html__('No attendee on primary registration while paying with PayPal Pro.',
104
-                'event_espresso'));
105
-        }
93
+		if (! $transaction instanceof EEI_Transaction) {
94
+			throw new EE_Error(esc_html__('No transaction for payment while paying with PayPal Pro.', 'event_espresso'));
95
+		}
96
+		$primary_registrant = $transaction->primary_registration();
97
+		if (! $primary_registrant instanceof EEI_Registration) {
98
+			throw new EE_Error(esc_html__('No primary registration on transaction while paying with PayPal Pro.',
99
+				'event_espresso'));
100
+		}
101
+		$attendee = $primary_registrant->attendee();
102
+		if (! $attendee instanceof EEI_Attendee) {
103
+			throw new EE_Error(esc_html__('No attendee on primary registration while paying with PayPal Pro.',
104
+				'event_espresso'));
105
+		}
106 106
 		$order_description  = $this->_format_order_description( $payment );
107 107
 		//charge for the full amount. Show itemized list
108 108
 		if( $this->_can_easily_itemize_transaction_for( $payment ) ){
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
 			'zip' => $billing_info['zip'],
233 233
 		);
234 234
 
235
-        //check if the registration info contains the needed fields for paypal pro (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/)
236
-        if($attendee->address() && $attendee->city() && $attendee->country_ID()){
237
-            $use_registration_address_info = true;
238
-        } else {
239
-            $use_registration_address_info = false;
240
-        }
241
-        //so if the attendee has enough data to fill out PayPal Pro's shipping info, use it. If not, use the billing info again
242
-        $ShippingAddress = array(
243
-            'shiptoname' => substr($use_registration_address_info ? $attendee->full_name() : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32),
244
-            'shiptostreet' => substr($use_registration_address_info ? $attendee->address() : $billing_info['address'], 0, 100),
245
-            'shiptostreet2' => substr($use_registration_address_info ? $attendee->address2() : $billing_info['address2'],0,100),
246
-            'shiptocity' => substr($use_registration_address_info ? $attendee->city() : $billing_info['city'],0,40),
247
-            'state' => substr($use_registration_address_info ? $attendee->state_name() : $billing_info['state'],0,40),
248
-            'shiptocountry' => $use_registration_address_info ? $attendee->country_ID() : $billing_info['country'],
249
-            'shiptozip' => substr($use_registration_address_info ? $attendee->zip() : $billing_info['zip'],0,20),
250
-            'shiptophonenum' => substr($use_registration_address_info ? $attendee->phone() : $billing_info['phone'],0,20),
251
-        );
235
+		//check if the registration info contains the needed fields for paypal pro (see https://developer.paypal.com/docs/classic/api/merchant/DoDirectPayment_API_Operation_NVP/)
236
+		if($attendee->address() && $attendee->city() && $attendee->country_ID()){
237
+			$use_registration_address_info = true;
238
+		} else {
239
+			$use_registration_address_info = false;
240
+		}
241
+		//so if the attendee has enough data to fill out PayPal Pro's shipping info, use it. If not, use the billing info again
242
+		$ShippingAddress = array(
243
+			'shiptoname' => substr($use_registration_address_info ? $attendee->full_name() : $billing_info['first_name'] . ' ' . $billing_info['last_name'], 0, 32),
244
+			'shiptostreet' => substr($use_registration_address_info ? $attendee->address() : $billing_info['address'], 0, 100),
245
+			'shiptostreet2' => substr($use_registration_address_info ? $attendee->address2() : $billing_info['address2'],0,100),
246
+			'shiptocity' => substr($use_registration_address_info ? $attendee->city() : $billing_info['city'],0,40),
247
+			'state' => substr($use_registration_address_info ? $attendee->state_name() : $billing_info['state'],0,40),
248
+			'shiptocountry' => $use_registration_address_info ? $attendee->country_ID() : $billing_info['country'],
249
+			'shiptozip' => substr($use_registration_address_info ? $attendee->zip() : $billing_info['zip'],0,20),
250
+			'shiptophonenum' => substr($use_registration_address_info ? $attendee->phone() : $billing_info['phone'],0,20),
251
+		);
252 252
 
253 253
 		$PaymentDetails = array(
254 254
 			// Required.  Total amount of order, including shipping, handling, and tax.
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 				'PayerInfo' => $PayerInfo,
281 281
 				'PayerName' => $PayerName,
282 282
 				'BillingAddress' => $BillingAddress,
283
-                'ShippingAddress' => $ShippingAddress,
283
+				'ShippingAddress' => $ShippingAddress,
284 284
 				'PaymentDetails' => $PaymentDetails,
285 285
 				'OrderItems' => $order_items,
286 286
 		);
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 1 patch
Indentation   +686 added lines, -686 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -22,691 +22,691 @@  discard block
 block discarded – undo
22 22
 final class EE_Front_Controller
23 23
 {
24 24
 
25
-    /**
26
-     *    $_template_path
27
-     * @var    string $_template_path
28
-     * @access    public
29
-     */
30
-    private $_template_path;
31
-
32
-    /**
33
-     *    $_template
34
-     * @var    string $_template
35
-     * @access    public
36
-     */
37
-    private $_template;
38
-
39
-    /**
40
-     * @type  EE_Registry $Registry
41
-     * @access    protected
42
-     */
43
-    protected $Registry;
44
-
45
-    /**
46
-     * @type  EE_Request_Handler $Request_Handler
47
-     * @access    protected
48
-     */
49
-    protected $Request_Handler;
50
-
51
-    /**
52
-     * @type  EE_Module_Request_Router $Module_Request_Router
53
-     * @access    protected
54
-     */
55
-    protected $Module_Request_Router;
56
-
57
-
58
-    /**
59
-     *    class constructor
60
-     *    should fire after shortcode, module, addon, or other plugin's default priority init phases have run
61
-     *
62
-     * @access    public
63
-     * @param \EE_Registry              $Registry
64
-     * @param \EE_Request_Handler       $Request_Handler
65
-     * @param \EE_Module_Request_Router $Module_Request_Router
66
-     */
67
-    public function __construct(
68
-        EE_Registry $Registry,
69
-        EE_Request_Handler $Request_Handler,
70
-        EE_Module_Request_Router $Module_Request_Router
71
-    ) {
72
-        $this->Registry              = $Registry;
73
-        $this->Request_Handler       = $Request_Handler;
74
-        $this->Module_Request_Router = $Module_Request_Router;
75
-        // make sure template tags are loaded immediately so that themes don't break
76
-        add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
77
-        // determine how to integrate WP_Query with the EE models
78
-        add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
79
-        // load other resources and begin to actually run shortcodes and modules
80
-        add_action('wp_loaded', array($this, 'wp_loaded'), 5);
81
-        // analyse the incoming WP request
82
-        add_action('parse_request', array($this, 'get_request'), 1, 1);
83
-        // process any content shortcodes
84
-        add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
85
-        // process request with module factory
86
-        add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
87
-        // before headers sent
88
-        add_action('wp', array($this, 'wp'), 5);
89
-        // load css and js
90
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
91
-        // header
92
-        add_action('wp_head', array($this, 'header_meta_tag'), 5);
93
-        add_action('wp_print_scripts', array($this, 'wp_print_scripts'), 10);
94
-        add_filter('template_include', array($this, 'template_include'), 1);
95
-        // display errors
96
-        add_action('loop_start', array($this, 'display_errors'), 2);
97
-        // the content
98
-        // add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
99
-        //exclude our private cpt comments
100
-        add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
101
-        //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
102
-        add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
103
-        // action hook EE
104
-        do_action('AHEE__EE_Front_Controller__construct__done', $this);
105
-        // for checking that browser cookies are enabled
106
-        if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
107
-            setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
108
-        }
109
-    }
110
-
111
-
112
-    /**
113
-     * @return EE_Request_Handler
114
-     */
115
-    public function Request_Handler()
116
-    {
117
-        return $this->Request_Handler;
118
-    }
119
-
120
-
121
-    /**
122
-     * @return EE_Module_Request_Router
123
-     */
124
-    public function Module_Request_Router()
125
-    {
126
-        return $this->Module_Request_Router;
127
-    }
128
-
129
-
130
-
131
-
132
-
133
-    /***********************************************        INIT ACTION HOOK         ***********************************************/
134
-
135
-
136
-    /**
137
-     *    load_espresso_template_tags - if current theme is an espresso theme, or uses ee theme template parts, then
138
-     *    load it's functions.php file ( if not already loaded )
139
-     *
140
-     * @return void
141
-     */
142
-    public function load_espresso_template_tags()
143
-    {
144
-        if (is_readable(EE_PUBLIC . 'template_tags.php')) {
145
-            require_once(EE_PUBLIC . 'template_tags.php');
146
-        }
147
-    }
148
-
149
-
150
-    /**
151
-     * filter_wp_comments
152
-     * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment
153
-     * widgets/queries done on frontend
154
-     *
155
-     * @param  array $clauses array of comment clauses setup by WP_Comment_Query
156
-     * @return array array of comment clauses with modifications.
157
-     */
158
-    public function filter_wp_comments($clauses)
159
-    {
160
-        global $wpdb;
161
-        if (strpos($clauses['join'], $wpdb->posts) !== false) {
162
-            $cpts = EE_Register_CPTs::get_private_CPTs();
163
-            foreach ($cpts as $cpt => $details) {
164
-                $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
165
-            }
166
-        }
167
-        return $clauses;
168
-    }
169
-
170
-
171
-    /**
172
-     *    employ_CPT_Strategy
173
-     *
174
-     * @access    public
175
-     * @return    void
176
-     */
177
-    public function employ_CPT_Strategy()
178
-    {
179
-        if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
180
-            $this->Registry->load_core('CPT_Strategy');
181
-        }
182
-    }
183
-
184
-
185
-    /**
186
-     * this just makes sure that if the site is using ssl that we force that for any admin ajax calls from frontend
187
-     *
188
-     * @param  string $url incoming url
189
-     * @return string         final assembled url
190
-     */
191
-    public function maybe_force_admin_ajax_ssl($url)
192
-    {
193
-        if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
194
-            $url = str_replace('http://', 'https://', $url);
195
-        }
196
-        return $url;
197
-    }
198
-
199
-
200
-
201
-
202
-
203
-
204
-    /***********************************************        WP_LOADED ACTION HOOK         ***********************************************/
205
-
206
-
207
-    /**
208
-     *    wp_loaded - should fire after shortcode, module, addon, or other plugin's have been registered and their
209
-     *    default priority init phases have run
210
-     *
211
-     * @access    public
212
-     * @return    void
213
-     */
214
-    public function wp_loaded()
215
-    {
216
-    }
217
-
218
-
219
-
220
-
221
-
222
-    /***********************************************        PARSE_REQUEST HOOK         ***********************************************/
223
-    /**
224
-     *    _get_request
225
-     *
226
-     * @access public
227
-     * @param WP $WP
228
-     * @return void
229
-     */
230
-    public function get_request(WP $WP)
231
-    {
232
-        do_action('AHEE__EE_Front_Controller__get_request__start');
233
-        $this->Request_Handler->parse_request($WP);
234
-        do_action('AHEE__EE_Front_Controller__get_request__complete');
235
-    }
236
-
237
-
238
-    /**
239
-     *    _initialize_shortcodes - calls init method on shortcodes that have been determined to be in the_content for
240
-     *    the currently requested page
241
-     *
242
-     * @access    public
243
-     * @param WP $WP
244
-     * @return    void
245
-     */
246
-    public function _initialize_shortcodes(WP $WP)
247
-    {
248
-        do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
249
-        $this->Request_Handler->set_request_vars($WP);
250
-        // grab post_name from request
251
-        $current_post  = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
252
-            $this->Request_Handler->get('post_name'));
253
-        $show_on_front = get_option('show_on_front');
254
-        // if it's not set, then check if frontpage is blog
255
-        if (empty($current_post)) {
256
-            // yup.. this is the posts page, prepare to load all shortcode modules
257
-            $current_post = 'posts';
258
-            // unless..
259
-            if ($show_on_front === 'page') {
260
-                // some other page is set as the homepage
261
-                $page_on_front = get_option('page_on_front');
262
-                if ($page_on_front) {
263
-                    // k now we need to find the post_name for this page
264
-                    global $wpdb;
265
-                    $page_on_front = $wpdb->get_var(
266
-                        $wpdb->prepare(
267
-                            "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d",
268
-                            $page_on_front
269
-                        )
270
-                    );
271
-                    // set the current post slug to what it actually is
272
-                    $current_post = $page_on_front ? $page_on_front : $current_post;
273
-                }
274
-            }
275
-        }
276
-        // where are posts being displayed ?
277
-        $page_for_posts = EE_Config::get_page_for_posts();
278
-        // in case $current_post is hierarchical like: /parent-page/current-page
279
-        $current_post = basename($current_post);
280
-        // are we on a category page?
281
-        $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name',
282
-                $WP->query_vars);
283
-        // make sure shortcodes are set
284
-        if (isset($this->Registry->CFG->core->post_shortcodes)) {
285
-            if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
286
-                $this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
287
-            }
288
-            // cycle thru all posts with shortcodes set
289
-            foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
290
-                // filter shortcodes so
291
-                $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes',
292
-                    $post_shortcodes);
293
-                // now cycle thru shortcodes
294
-                foreach ($post_shortcodes as $shortcode_class => $post_id) {
295
-                    // are we on this page, or on the blog page, or an EE CPT category page ?
296
-                    if ($current_post === $post_name || $term_exists) {
297
-                        // maybe init the shortcode
298
-                        $this->initialize_shortcode_if_active_on_page(
299
-                            $shortcode_class,
300
-                            $current_post,
301
-                            $page_for_posts,
302
-                            $post_id,
303
-                            $term_exists,
304
-                            $WP
305
-                        );
306
-                        // if this is NOT the "Posts page" and we have a valid entry
307
-                        // for the "Posts page" in our tracked post_shortcodes array
308
-                        // but the shortcode is not being tracked for this page
309
-                    } else if (
310
-                        $post_name !== $page_for_posts
311
-                        && isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
312
-                        && ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])
313
-                    ) {
314
-                        // then remove the "fallback" shortcode processor
315
-                        remove_shortcode($shortcode_class);
316
-                    }
317
-                }
318
-            }
319
-        }
320
-        do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
321
-    }
322
-
323
-
324
-    /**
325
-     * @param string $shortcode_class
326
-     * @param string $current_post
327
-     * @param string $page_for_posts
328
-     * @param int    $post_id
329
-     * @param bool   $term_exists
330
-     * @param WP     $WP
331
-     */
332
-    protected function initialize_shortcode_if_active_on_page(
333
-        $shortcode_class,
334
-        $current_post,
335
-        $page_for_posts,
336
-        $post_id,
337
-        $term_exists,
338
-        $WP
339
-    ) {
340
-        // verify shortcode is in list of registered shortcodes
341
-        if ( ! isset($this->Registry->shortcodes->{$shortcode_class})) {
342
-            if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
343
-                EE_Error::add_error(
344
-                    sprintf(
345
-                        __(
346
-                            'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.',
347
-                            'event_espresso'
348
-                        ),
349
-                        $shortcode_class
350
-                    ),
351
-                    __FILE__,
352
-                    __FUNCTION__,
353
-                    __LINE__
354
-                );
355
-                add_filter('FHEE_run_EE_the_content', '__return_true');
356
-            }
357
-            add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
358
-            return;
359
-        }
360
-        // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
361
-        if (
362
-            $term_exists
363
-            || $current_post === $page_for_posts
364
-            || isset($this->Registry->CFG->core->post_shortcodes[$current_post])
365
-        ) {
366
-            // let's pause to reflect on this...
367
-            $sc_reflector = new ReflectionClass('EES_' . $shortcode_class);
368
-            // ensure that class is actually a shortcode
369
-            if (
370
-                defined('WP_DEBUG')
371
-                && WP_DEBUG === true
372
-                && ! $sc_reflector->isSubclassOf('EES_Shortcode')
373
-            ) {
374
-                EE_Error::add_error(
375
-                    sprintf(
376
-                        __(
377
-                            'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.',
378
-                            'event_espresso'
379
-                        ),
380
-                        $shortcode_class
381
-                    ),
382
-                    __FILE__,
383
-                    __FUNCTION__,
384
-                    __LINE__
385
-                );
386
-                add_filter('FHEE_run_EE_the_content', '__return_true');
387
-                return;
388
-            }
389
-            // and pass the request object to the run method
390
-            $this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
391
-            // fire the shortcode class's run method, so that it can activate resources
392
-            $this->Registry->shortcodes->{$shortcode_class}->run($WP);
393
-        }
394
-    }
395
-
396
-
397
-    /**
398
-     *    pre_get_posts - basically a module factory for instantiating modules and selecting the final view template
399
-     *
400
-     * @access    public
401
-     * @param   WP_Query $WP_Query
402
-     * @return    void
403
-     */
404
-    public function pre_get_posts($WP_Query)
405
-    {
406
-        // only load Module_Request_Router if this is the main query
407
-        if (
408
-            $this->Module_Request_Router instanceof EE_Module_Request_Router
409
-            && $WP_Query->is_main_query()
410
-        ) {
411
-            // cycle thru module routes
412
-            while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
413
-                // determine module and method for route
414
-                $module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
415
-                if ($module instanceof EED_Module) {
416
-                    // get registered view for route
417
-                    $this->_template_path = $this->Module_Request_Router->get_view($route);
418
-                    // grab module name
419
-                    $module_name = $module->module_name();
420
-                    // map the module to the module objects
421
-                    $this->Registry->modules->{$module_name} = $module;
422
-                }
423
-            }
424
-        }
425
-    }
426
-
427
-
428
-
429
-
430
-
431
-    /***********************************************        WP HOOK         ***********************************************/
432
-
433
-
434
-    /**
435
-     *    wp - basically last chance to do stuff before headers sent
436
-     *
437
-     * @access    public
438
-     * @return    void
439
-     */
440
-    public function wp()
441
-    {
442
-    }
443
-
444
-
445
-
446
-    /***********************************************        WP_ENQUEUE_SCRIPTS && WP_HEAD HOOK         ***********************************************/
447
-
448
-
449
-    /**
450
-     *    wp_enqueue_scripts
451
-     *
452
-     * @access    public
453
-     * @return    void
454
-     */
455
-    public function wp_enqueue_scripts()
456
-    {
457
-
458
-        // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
459
-        if (apply_filters('FHEE_load_css', true)) {
460
-
461
-            $this->Registry->CFG->template_settings->enable_default_style = true;
462
-            //Load the ThemeRoller styles if enabled
463
-            if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
464
-
465
-                //Load custom style sheet if available
466
-                if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
467
-                    wp_register_style('espresso_custom_css',
468
-                        EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet,
469
-                        EVENT_ESPRESSO_VERSION);
470
-                    wp_enqueue_style('espresso_custom_css');
471
-                }
472
-
473
-                if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')) {
474
-                    wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css',
475
-                        array('dashicons'), EVENT_ESPRESSO_VERSION);
476
-                } else {
477
-                    wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
478
-                        array('dashicons'), EVENT_ESPRESSO_VERSION);
479
-                }
480
-                wp_enqueue_style('espresso_default');
481
-
482
-                if (is_readable(get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css')) {
483
-                    wp_register_style('espresso_style',
484
-                        get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css',
485
-                        array('dashicons', 'espresso_default'));
486
-                } else {
487
-                    wp_register_style('espresso_style',
488
-                        EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css',
489
-                        array('dashicons', 'espresso_default'));
490
-                }
491
-
492
-            }
493
-
494
-        }
495
-
496
-        // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
497
-        if (apply_filters('FHEE_load_js', true)) {
498
-
499
-            wp_enqueue_script('jquery');
500
-            //let's make sure that all required scripts have been setup
501
-            if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
502
-                $msg = sprintf(
503
-                    __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.',
504
-                        'event_espresso'),
505
-                    '<em><br />',
506
-                    '</em>'
507
-                );
508
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
509
-            }
510
-            // load core js
511
-            wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'),
512
-                EVENT_ESPRESSO_VERSION, true);
513
-            wp_enqueue_script('espresso_core');
514
-            wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
515
-
516
-        }
517
-
518
-        //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
519
-        if (apply_filters('FHEE_load_qtip', false)) {
520
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
521
-        }
522
-
523
-
524
-        //accounting.js library
525
-        // @link http://josscrowcroft.github.io/accounting.js/
526
-        if (apply_filters('FHEE_load_accounting_js', false)) {
527
-            $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
528
-            wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
529
-                array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, true);
530
-            wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', true);
531
-            wp_enqueue_script('ee-accounting');
532
-
533
-            $currency_config = array(
534
-                'currency' => array(
535
-                    'symbol'    => $this->Registry->CFG->currency->sign,
536
-                    'format'    => array(
537
-                        'pos'  => $this->Registry->CFG->currency->sign_b4 ? '%s%v' : '%v%s',
538
-                        'neg'  => $this->Registry->CFG->currency->sign_b4 ? '- %s%v' : '- %v%s',
539
-                        'zero' => $this->Registry->CFG->currency->sign_b4 ? '%s--' : '--%s',
540
-                    ),
541
-                    'decimal'   => $this->Registry->CFG->currency->dec_mrk,
542
-                    'thousand'  => $this->Registry->CFG->currency->thsnds,
543
-                    'precision' => $this->Registry->CFG->currency->dec_plc,
544
-                ),
545
-                'number'   => array(
546
-                    'precision' => 0,
547
-                    'thousand'  => $this->Registry->CFG->currency->thsnds,
548
-                    'decimal'   => $this->Registry->CFG->currency->dec_mrk,
549
-                ),
550
-            );
551
-            wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
552
-        }
553
-
554
-        if ( ! function_exists('wp_head')) {
555
-            $msg = sprintf(
556
-                __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
557
-                    'event_espresso'),
558
-                '<em><br />',
559
-                '</em>'
560
-            );
561
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
562
-        }
563
-        if ( ! function_exists('wp_footer')) {
564
-            $msg = sprintf(
565
-                __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
566
-                    'event_espresso'),
567
-                '<em><br />',
568
-                '</em>'
569
-            );
570
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
571
-        }
572
-
573
-    }
574
-
575
-
576
-    /**
577
-     *    header_meta_tag
578
-     *
579
-     * @access    public
580
-     * @return    void
581
-     */
582
-    public function header_meta_tag()
583
-    {
584
-        print(
585
-            apply_filters(
586
-                'FHEE__EE_Front_Controller__header_meta_tag',
587
-                '<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n")
588
-        );
589
-
590
-        //let's exclude all event type taxonomy term archive pages from search engine indexing
591
-        //@see https://events.codebasehq.com/projects/event-espresso/tickets/10249
592
-        if (
593
-            is_tax('espresso_event_type')
594
-            && get_option( 'blog_public' ) !== '0'
595
-        ) {
596
-            print(
597
-                apply_filters(
598
-                    'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
599
-                    '<meta name="robots" content="noindex,follow" />' . "\n"
600
-                )
601
-            );
602
-        }
603
-    }
604
-
605
-
606
-
607
-    /**
608
-     * wp_print_scripts
609
-     *
610
-     * @return void
611
-     */
612
-    public function wp_print_scripts()
613
-    {
614
-        global $post;
615
-        if (
616
-            get_post_type() === 'espresso_events' 
617
-            && is_singular() 
618
-            && isset($post->EE_Event)
619
-            && $post->EE_Event instanceof EE_Event
620
-        ) {
621
-            \EEH_Schema::add_json_linked_data_for_event($post->EE_Event);
622
-        }
623
-    }
624
-
625
-
626
-
627
-    /***********************************************        THE_CONTENT FILTER HOOK         ***********************************************/
628
-
629
-
630
-
631
-    /**
632
-     *    the_content
633
-     *
634
-     * @access    public
635
-     * @param   $the_content
636
-     * @return    string
637
-     */
638
-    // public function the_content( $the_content ) {
639
-    // 	// nothing gets loaded at this point unless other systems turn this hookpoint on by using:  add_filter( 'FHEE_run_EE_the_content', '__return_true' );
640
-    // 	if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) {
641
-    // 	}
642
-    // 	return $the_content;
643
-    // }
644
-
645
-
646
-    /***********************************************        WP_FOOTER         ***********************************************/
647
-
648
-
649
-    /**
650
-     *    display_errors
651
-     *
652
-     * @access    public
653
-     * @return    string
654
-     */
655
-    public function display_errors()
656
-    {
657
-        static $shown_already = false;
658
-        do_action('AHEE__EE_Front_Controller__display_errors__begin');
659
-        if (
660
-            ! $shown_already
661
-            && apply_filters('FHEE__EE_Front_Controller__display_errors', true)
662
-            && is_main_query()
663
-            && ! is_feed()
664
-            && in_the_loop()
665
-            && $this->Request_Handler->is_espresso_page()
666
-        ) {
667
-            echo EE_Error::get_notices();
668
-            $shown_already = true;
669
-            EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
670
-        }
671
-        do_action('AHEE__EE_Front_Controller__display_errors__end');
672
-    }
673
-
674
-
675
-
676
-
677
-
678
-    /***********************************************        UTILITIES         ***********************************************/
679
-    /**
680
-     *    template_include
681
-     *
682
-     * @access    public
683
-     * @param   string $template_include_path
684
-     * @return    string
685
-     */
686
-    public function template_include($template_include_path = null)
687
-    {
688
-        if ($this->Request_Handler->is_espresso_page()) {
689
-            $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
690
-            $template_path        = EEH_Template::locate_template($this->_template_path, array(), false);
691
-            $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
692
-            $this->_template      = basename($this->_template_path);
693
-            return $this->_template_path;
694
-        }
695
-        return $template_include_path;
696
-    }
697
-
698
-
699
-    /**
700
-     *    get_selected_template
701
-     *
702
-     * @access    public
703
-     * @param bool $with_path
704
-     * @return    string
705
-     */
706
-    public function get_selected_template($with_path = false)
707
-    {
708
-        return $with_path ? $this->_template_path : $this->_template;
709
-    }
25
+	/**
26
+	 *    $_template_path
27
+	 * @var    string $_template_path
28
+	 * @access    public
29
+	 */
30
+	private $_template_path;
31
+
32
+	/**
33
+	 *    $_template
34
+	 * @var    string $_template
35
+	 * @access    public
36
+	 */
37
+	private $_template;
38
+
39
+	/**
40
+	 * @type  EE_Registry $Registry
41
+	 * @access    protected
42
+	 */
43
+	protected $Registry;
44
+
45
+	/**
46
+	 * @type  EE_Request_Handler $Request_Handler
47
+	 * @access    protected
48
+	 */
49
+	protected $Request_Handler;
50
+
51
+	/**
52
+	 * @type  EE_Module_Request_Router $Module_Request_Router
53
+	 * @access    protected
54
+	 */
55
+	protected $Module_Request_Router;
56
+
57
+
58
+	/**
59
+	 *    class constructor
60
+	 *    should fire after shortcode, module, addon, or other plugin's default priority init phases have run
61
+	 *
62
+	 * @access    public
63
+	 * @param \EE_Registry              $Registry
64
+	 * @param \EE_Request_Handler       $Request_Handler
65
+	 * @param \EE_Module_Request_Router $Module_Request_Router
66
+	 */
67
+	public function __construct(
68
+		EE_Registry $Registry,
69
+		EE_Request_Handler $Request_Handler,
70
+		EE_Module_Request_Router $Module_Request_Router
71
+	) {
72
+		$this->Registry              = $Registry;
73
+		$this->Request_Handler       = $Request_Handler;
74
+		$this->Module_Request_Router = $Module_Request_Router;
75
+		// make sure template tags are loaded immediately so that themes don't break
76
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
77
+		// determine how to integrate WP_Query with the EE models
78
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
79
+		// load other resources and begin to actually run shortcodes and modules
80
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
81
+		// analyse the incoming WP request
82
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
83
+		// process any content shortcodes
84
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
85
+		// process request with module factory
86
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
87
+		// before headers sent
88
+		add_action('wp', array($this, 'wp'), 5);
89
+		// load css and js
90
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
91
+		// header
92
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
93
+		add_action('wp_print_scripts', array($this, 'wp_print_scripts'), 10);
94
+		add_filter('template_include', array($this, 'template_include'), 1);
95
+		// display errors
96
+		add_action('loop_start', array($this, 'display_errors'), 2);
97
+		// the content
98
+		// add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
99
+		//exclude our private cpt comments
100
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
101
+		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
102
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
103
+		// action hook EE
104
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
105
+		// for checking that browser cookies are enabled
106
+		if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
107
+			setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
108
+		}
109
+	}
110
+
111
+
112
+	/**
113
+	 * @return EE_Request_Handler
114
+	 */
115
+	public function Request_Handler()
116
+	{
117
+		return $this->Request_Handler;
118
+	}
119
+
120
+
121
+	/**
122
+	 * @return EE_Module_Request_Router
123
+	 */
124
+	public function Module_Request_Router()
125
+	{
126
+		return $this->Module_Request_Router;
127
+	}
128
+
129
+
130
+
131
+
132
+
133
+	/***********************************************        INIT ACTION HOOK         ***********************************************/
134
+
135
+
136
+	/**
137
+	 *    load_espresso_template_tags - if current theme is an espresso theme, or uses ee theme template parts, then
138
+	 *    load it's functions.php file ( if not already loaded )
139
+	 *
140
+	 * @return void
141
+	 */
142
+	public function load_espresso_template_tags()
143
+	{
144
+		if (is_readable(EE_PUBLIC . 'template_tags.php')) {
145
+			require_once(EE_PUBLIC . 'template_tags.php');
146
+		}
147
+	}
148
+
149
+
150
+	/**
151
+	 * filter_wp_comments
152
+	 * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment
153
+	 * widgets/queries done on frontend
154
+	 *
155
+	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
156
+	 * @return array array of comment clauses with modifications.
157
+	 */
158
+	public function filter_wp_comments($clauses)
159
+	{
160
+		global $wpdb;
161
+		if (strpos($clauses['join'], $wpdb->posts) !== false) {
162
+			$cpts = EE_Register_CPTs::get_private_CPTs();
163
+			foreach ($cpts as $cpt => $details) {
164
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
165
+			}
166
+		}
167
+		return $clauses;
168
+	}
169
+
170
+
171
+	/**
172
+	 *    employ_CPT_Strategy
173
+	 *
174
+	 * @access    public
175
+	 * @return    void
176
+	 */
177
+	public function employ_CPT_Strategy()
178
+	{
179
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
180
+			$this->Registry->load_core('CPT_Strategy');
181
+		}
182
+	}
183
+
184
+
185
+	/**
186
+	 * this just makes sure that if the site is using ssl that we force that for any admin ajax calls from frontend
187
+	 *
188
+	 * @param  string $url incoming url
189
+	 * @return string         final assembled url
190
+	 */
191
+	public function maybe_force_admin_ajax_ssl($url)
192
+	{
193
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
194
+			$url = str_replace('http://', 'https://', $url);
195
+		}
196
+		return $url;
197
+	}
198
+
199
+
200
+
201
+
202
+
203
+
204
+	/***********************************************        WP_LOADED ACTION HOOK         ***********************************************/
205
+
206
+
207
+	/**
208
+	 *    wp_loaded - should fire after shortcode, module, addon, or other plugin's have been registered and their
209
+	 *    default priority init phases have run
210
+	 *
211
+	 * @access    public
212
+	 * @return    void
213
+	 */
214
+	public function wp_loaded()
215
+	{
216
+	}
217
+
218
+
219
+
220
+
221
+
222
+	/***********************************************        PARSE_REQUEST HOOK         ***********************************************/
223
+	/**
224
+	 *    _get_request
225
+	 *
226
+	 * @access public
227
+	 * @param WP $WP
228
+	 * @return void
229
+	 */
230
+	public function get_request(WP $WP)
231
+	{
232
+		do_action('AHEE__EE_Front_Controller__get_request__start');
233
+		$this->Request_Handler->parse_request($WP);
234
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
235
+	}
236
+
237
+
238
+	/**
239
+	 *    _initialize_shortcodes - calls init method on shortcodes that have been determined to be in the_content for
240
+	 *    the currently requested page
241
+	 *
242
+	 * @access    public
243
+	 * @param WP $WP
244
+	 * @return    void
245
+	 */
246
+	public function _initialize_shortcodes(WP $WP)
247
+	{
248
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
249
+		$this->Request_Handler->set_request_vars($WP);
250
+		// grab post_name from request
251
+		$current_post  = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
252
+			$this->Request_Handler->get('post_name'));
253
+		$show_on_front = get_option('show_on_front');
254
+		// if it's not set, then check if frontpage is blog
255
+		if (empty($current_post)) {
256
+			// yup.. this is the posts page, prepare to load all shortcode modules
257
+			$current_post = 'posts';
258
+			// unless..
259
+			if ($show_on_front === 'page') {
260
+				// some other page is set as the homepage
261
+				$page_on_front = get_option('page_on_front');
262
+				if ($page_on_front) {
263
+					// k now we need to find the post_name for this page
264
+					global $wpdb;
265
+					$page_on_front = $wpdb->get_var(
266
+						$wpdb->prepare(
267
+							"SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d",
268
+							$page_on_front
269
+						)
270
+					);
271
+					// set the current post slug to what it actually is
272
+					$current_post = $page_on_front ? $page_on_front : $current_post;
273
+				}
274
+			}
275
+		}
276
+		// where are posts being displayed ?
277
+		$page_for_posts = EE_Config::get_page_for_posts();
278
+		// in case $current_post is hierarchical like: /parent-page/current-page
279
+		$current_post = basename($current_post);
280
+		// are we on a category page?
281
+		$term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name',
282
+				$WP->query_vars);
283
+		// make sure shortcodes are set
284
+		if (isset($this->Registry->CFG->core->post_shortcodes)) {
285
+			if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
286
+				$this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
287
+			}
288
+			// cycle thru all posts with shortcodes set
289
+			foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
290
+				// filter shortcodes so
291
+				$post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes',
292
+					$post_shortcodes);
293
+				// now cycle thru shortcodes
294
+				foreach ($post_shortcodes as $shortcode_class => $post_id) {
295
+					// are we on this page, or on the blog page, or an EE CPT category page ?
296
+					if ($current_post === $post_name || $term_exists) {
297
+						// maybe init the shortcode
298
+						$this->initialize_shortcode_if_active_on_page(
299
+							$shortcode_class,
300
+							$current_post,
301
+							$page_for_posts,
302
+							$post_id,
303
+							$term_exists,
304
+							$WP
305
+						);
306
+						// if this is NOT the "Posts page" and we have a valid entry
307
+						// for the "Posts page" in our tracked post_shortcodes array
308
+						// but the shortcode is not being tracked for this page
309
+					} else if (
310
+						$post_name !== $page_for_posts
311
+						&& isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
312
+						&& ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])
313
+					) {
314
+						// then remove the "fallback" shortcode processor
315
+						remove_shortcode($shortcode_class);
316
+					}
317
+				}
318
+			}
319
+		}
320
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
321
+	}
322
+
323
+
324
+	/**
325
+	 * @param string $shortcode_class
326
+	 * @param string $current_post
327
+	 * @param string $page_for_posts
328
+	 * @param int    $post_id
329
+	 * @param bool   $term_exists
330
+	 * @param WP     $WP
331
+	 */
332
+	protected function initialize_shortcode_if_active_on_page(
333
+		$shortcode_class,
334
+		$current_post,
335
+		$page_for_posts,
336
+		$post_id,
337
+		$term_exists,
338
+		$WP
339
+	) {
340
+		// verify shortcode is in list of registered shortcodes
341
+		if ( ! isset($this->Registry->shortcodes->{$shortcode_class})) {
342
+			if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
343
+				EE_Error::add_error(
344
+					sprintf(
345
+						__(
346
+							'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.',
347
+							'event_espresso'
348
+						),
349
+						$shortcode_class
350
+					),
351
+					__FILE__,
352
+					__FUNCTION__,
353
+					__LINE__
354
+				);
355
+				add_filter('FHEE_run_EE_the_content', '__return_true');
356
+			}
357
+			add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
358
+			return;
359
+		}
360
+		// is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
361
+		if (
362
+			$term_exists
363
+			|| $current_post === $page_for_posts
364
+			|| isset($this->Registry->CFG->core->post_shortcodes[$current_post])
365
+		) {
366
+			// let's pause to reflect on this...
367
+			$sc_reflector = new ReflectionClass('EES_' . $shortcode_class);
368
+			// ensure that class is actually a shortcode
369
+			if (
370
+				defined('WP_DEBUG')
371
+				&& WP_DEBUG === true
372
+				&& ! $sc_reflector->isSubclassOf('EES_Shortcode')
373
+			) {
374
+				EE_Error::add_error(
375
+					sprintf(
376
+						__(
377
+							'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.',
378
+							'event_espresso'
379
+						),
380
+						$shortcode_class
381
+					),
382
+					__FILE__,
383
+					__FUNCTION__,
384
+					__LINE__
385
+				);
386
+				add_filter('FHEE_run_EE_the_content', '__return_true');
387
+				return;
388
+			}
389
+			// and pass the request object to the run method
390
+			$this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
391
+			// fire the shortcode class's run method, so that it can activate resources
392
+			$this->Registry->shortcodes->{$shortcode_class}->run($WP);
393
+		}
394
+	}
395
+
396
+
397
+	/**
398
+	 *    pre_get_posts - basically a module factory for instantiating modules and selecting the final view template
399
+	 *
400
+	 * @access    public
401
+	 * @param   WP_Query $WP_Query
402
+	 * @return    void
403
+	 */
404
+	public function pre_get_posts($WP_Query)
405
+	{
406
+		// only load Module_Request_Router if this is the main query
407
+		if (
408
+			$this->Module_Request_Router instanceof EE_Module_Request_Router
409
+			&& $WP_Query->is_main_query()
410
+		) {
411
+			// cycle thru module routes
412
+			while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
413
+				// determine module and method for route
414
+				$module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
415
+				if ($module instanceof EED_Module) {
416
+					// get registered view for route
417
+					$this->_template_path = $this->Module_Request_Router->get_view($route);
418
+					// grab module name
419
+					$module_name = $module->module_name();
420
+					// map the module to the module objects
421
+					$this->Registry->modules->{$module_name} = $module;
422
+				}
423
+			}
424
+		}
425
+	}
426
+
427
+
428
+
429
+
430
+
431
+	/***********************************************        WP HOOK         ***********************************************/
432
+
433
+
434
+	/**
435
+	 *    wp - basically last chance to do stuff before headers sent
436
+	 *
437
+	 * @access    public
438
+	 * @return    void
439
+	 */
440
+	public function wp()
441
+	{
442
+	}
443
+
444
+
445
+
446
+	/***********************************************        WP_ENQUEUE_SCRIPTS && WP_HEAD HOOK         ***********************************************/
447
+
448
+
449
+	/**
450
+	 *    wp_enqueue_scripts
451
+	 *
452
+	 * @access    public
453
+	 * @return    void
454
+	 */
455
+	public function wp_enqueue_scripts()
456
+	{
457
+
458
+		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
459
+		if (apply_filters('FHEE_load_css', true)) {
460
+
461
+			$this->Registry->CFG->template_settings->enable_default_style = true;
462
+			//Load the ThemeRoller styles if enabled
463
+			if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
464
+
465
+				//Load custom style sheet if available
466
+				if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
467
+					wp_register_style('espresso_custom_css',
468
+						EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet,
469
+						EVENT_ESPRESSO_VERSION);
470
+					wp_enqueue_style('espresso_custom_css');
471
+				}
472
+
473
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')) {
474
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css',
475
+						array('dashicons'), EVENT_ESPRESSO_VERSION);
476
+				} else {
477
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
478
+						array('dashicons'), EVENT_ESPRESSO_VERSION);
479
+				}
480
+				wp_enqueue_style('espresso_default');
481
+
482
+				if (is_readable(get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css')) {
483
+					wp_register_style('espresso_style',
484
+						get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css',
485
+						array('dashicons', 'espresso_default'));
486
+				} else {
487
+					wp_register_style('espresso_style',
488
+						EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css',
489
+						array('dashicons', 'espresso_default'));
490
+				}
491
+
492
+			}
493
+
494
+		}
495
+
496
+		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
497
+		if (apply_filters('FHEE_load_js', true)) {
498
+
499
+			wp_enqueue_script('jquery');
500
+			//let's make sure that all required scripts have been setup
501
+			if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
502
+				$msg = sprintf(
503
+					__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.',
504
+						'event_espresso'),
505
+					'<em><br />',
506
+					'</em>'
507
+				);
508
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
509
+			}
510
+			// load core js
511
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'),
512
+				EVENT_ESPRESSO_VERSION, true);
513
+			wp_enqueue_script('espresso_core');
514
+			wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
515
+
516
+		}
517
+
518
+		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
519
+		if (apply_filters('FHEE_load_qtip', false)) {
520
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
521
+		}
522
+
523
+
524
+		//accounting.js library
525
+		// @link http://josscrowcroft.github.io/accounting.js/
526
+		if (apply_filters('FHEE_load_accounting_js', false)) {
527
+			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
528
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
529
+				array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, true);
530
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', true);
531
+			wp_enqueue_script('ee-accounting');
532
+
533
+			$currency_config = array(
534
+				'currency' => array(
535
+					'symbol'    => $this->Registry->CFG->currency->sign,
536
+					'format'    => array(
537
+						'pos'  => $this->Registry->CFG->currency->sign_b4 ? '%s%v' : '%v%s',
538
+						'neg'  => $this->Registry->CFG->currency->sign_b4 ? '- %s%v' : '- %v%s',
539
+						'zero' => $this->Registry->CFG->currency->sign_b4 ? '%s--' : '--%s',
540
+					),
541
+					'decimal'   => $this->Registry->CFG->currency->dec_mrk,
542
+					'thousand'  => $this->Registry->CFG->currency->thsnds,
543
+					'precision' => $this->Registry->CFG->currency->dec_plc,
544
+				),
545
+				'number'   => array(
546
+					'precision' => 0,
547
+					'thousand'  => $this->Registry->CFG->currency->thsnds,
548
+					'decimal'   => $this->Registry->CFG->currency->dec_mrk,
549
+				),
550
+			);
551
+			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
552
+		}
553
+
554
+		if ( ! function_exists('wp_head')) {
555
+			$msg = sprintf(
556
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
557
+					'event_espresso'),
558
+				'<em><br />',
559
+				'</em>'
560
+			);
561
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
562
+		}
563
+		if ( ! function_exists('wp_footer')) {
564
+			$msg = sprintf(
565
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.',
566
+					'event_espresso'),
567
+				'<em><br />',
568
+				'</em>'
569
+			);
570
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
571
+		}
572
+
573
+	}
574
+
575
+
576
+	/**
577
+	 *    header_meta_tag
578
+	 *
579
+	 * @access    public
580
+	 * @return    void
581
+	 */
582
+	public function header_meta_tag()
583
+	{
584
+		print(
585
+			apply_filters(
586
+				'FHEE__EE_Front_Controller__header_meta_tag',
587
+				'<meta name="generator" content="Event Espresso Version ' . EVENT_ESPRESSO_VERSION . "\" />\n")
588
+		);
589
+
590
+		//let's exclude all event type taxonomy term archive pages from search engine indexing
591
+		//@see https://events.codebasehq.com/projects/event-espresso/tickets/10249
592
+		if (
593
+			is_tax('espresso_event_type')
594
+			&& get_option( 'blog_public' ) !== '0'
595
+		) {
596
+			print(
597
+				apply_filters(
598
+					'FHEE__EE_Front_Controller__header_meta_tag__noindex_for_event_type',
599
+					'<meta name="robots" content="noindex,follow" />' . "\n"
600
+				)
601
+			);
602
+		}
603
+	}
604
+
605
+
606
+
607
+	/**
608
+	 * wp_print_scripts
609
+	 *
610
+	 * @return void
611
+	 */
612
+	public function wp_print_scripts()
613
+	{
614
+		global $post;
615
+		if (
616
+			get_post_type() === 'espresso_events' 
617
+			&& is_singular() 
618
+			&& isset($post->EE_Event)
619
+			&& $post->EE_Event instanceof EE_Event
620
+		) {
621
+			\EEH_Schema::add_json_linked_data_for_event($post->EE_Event);
622
+		}
623
+	}
624
+
625
+
626
+
627
+	/***********************************************        THE_CONTENT FILTER HOOK         ***********************************************/
628
+
629
+
630
+
631
+	/**
632
+	 *    the_content
633
+	 *
634
+	 * @access    public
635
+	 * @param   $the_content
636
+	 * @return    string
637
+	 */
638
+	// public function the_content( $the_content ) {
639
+	// 	// nothing gets loaded at this point unless other systems turn this hookpoint on by using:  add_filter( 'FHEE_run_EE_the_content', '__return_true' );
640
+	// 	if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) {
641
+	// 	}
642
+	// 	return $the_content;
643
+	// }
644
+
645
+
646
+	/***********************************************        WP_FOOTER         ***********************************************/
647
+
648
+
649
+	/**
650
+	 *    display_errors
651
+	 *
652
+	 * @access    public
653
+	 * @return    string
654
+	 */
655
+	public function display_errors()
656
+	{
657
+		static $shown_already = false;
658
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
659
+		if (
660
+			! $shown_already
661
+			&& apply_filters('FHEE__EE_Front_Controller__display_errors', true)
662
+			&& is_main_query()
663
+			&& ! is_feed()
664
+			&& in_the_loop()
665
+			&& $this->Request_Handler->is_espresso_page()
666
+		) {
667
+			echo EE_Error::get_notices();
668
+			$shown_already = true;
669
+			EEH_Template::display_template(EE_TEMPLATES . 'espresso-ajax-notices.template.php');
670
+		}
671
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
672
+	}
673
+
674
+
675
+
676
+
677
+
678
+	/***********************************************        UTILITIES         ***********************************************/
679
+	/**
680
+	 *    template_include
681
+	 *
682
+	 * @access    public
683
+	 * @param   string $template_include_path
684
+	 * @return    string
685
+	 */
686
+	public function template_include($template_include_path = null)
687
+	{
688
+		if ($this->Request_Handler->is_espresso_page()) {
689
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
690
+			$template_path        = EEH_Template::locate_template($this->_template_path, array(), false);
691
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
692
+			$this->_template      = basename($this->_template_path);
693
+			return $this->_template_path;
694
+		}
695
+		return $template_include_path;
696
+	}
697
+
698
+
699
+	/**
700
+	 *    get_selected_template
701
+	 *
702
+	 * @access    public
703
+	 * @param bool $with_path
704
+	 * @return    string
705
+	 */
706
+	public function get_selected_template($with_path = false)
707
+	{
708
+		return $with_path ? $this->_template_path : $this->_template;
709
+	}
710 710
 
711 711
 
712 712
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Schema.helper.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -17,62 +17,62 @@  discard block
 block discarded – undo
17 17
 class EEH_Schema {
18 18
 
19 19
 
20
-    /**
21
-     * generates JSON-based linked data for an event
22
-     *
23
-     * @param \EE_Event $event
24
-     */
25
-    public static function add_json_linked_data_for_event(\EE_Event $event)
26
-    {
27
-        $template_args = array(
28
-            'event_permalink' => '',
29
-            'event_name' => '',
30
-            'event_description' => '',
31
-            'event_start' => '',
32
-            'event_end' => '',
33
-            'currency' => '',
34
-            'event_tickets' => array(),
35
-            'venue_name' => '',
36
-            'venue_url' => '',
37
-            'venue_locality' => '',
38
-            'venue_region' => '',
39
-            'event_image' => '',
40
-        );
41
-        $template_args['event_permalink'] = $event->get_permalink();
42
-        $template_args['event_name'] = $event->name();
43
-        $template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
44
-        $template_args['event_start'] = $event->primary_datetime()->start_date(DateTime::ATOM);
45
-        $template_args['event_end'] = $event->primary_datetime()->end_date(DateTime::ATOM);
46
-        $template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
47
-        foreach ($event->tickets() as $ticket) {
48
-            $ID = $ticket->ID();
49
-            $template_args['event_tickets'][$ID]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
50
-            $template_args['event_tickets'][$ID]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
51
-            $template_args['event_tickets'][$ID]['price'] = number_format(
52
-                $ticket->price(),
53
-                EE_Registry::instance()->CFG->currency->dec_plc,
54
-                EE_Registry::instance()->CFG->currency->dec_mrk,
55
-                EE_Registry::instance()->CFG->currency->thsnds
56
-            );
57
-        }
58
-        $VNU_ID = espresso_venue_id();
59
-        if ( ! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
60
-            $venue = EEH_Venue_View::get_venue($VNU_ID);
61
-            $template_args['venue_name'] = get_the_title($VNU_ID);
62
-            $template_args['venue_url'] = get_permalink($VNU_ID);
63
-            $template_args['venue_locality'] = $venue->city();
64
-            $template_args['venue_region'] = $venue->state_name();
65
-        }
66
-        $template_args['event_image'] = $event->feature_image_url();
67
-        $template_args = apply_filters(
68
-            'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
69
-            $template_args,
70
-            $event,
71
-            $VNU_ID
72
-        );
73
-        extract($template_args, EXTR_OVERWRITE);
74
-        include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
75
-    }
20
+	/**
21
+	 * generates JSON-based linked data for an event
22
+	 *
23
+	 * @param \EE_Event $event
24
+	 */
25
+	public static function add_json_linked_data_for_event(\EE_Event $event)
26
+	{
27
+		$template_args = array(
28
+			'event_permalink' => '',
29
+			'event_name' => '',
30
+			'event_description' => '',
31
+			'event_start' => '',
32
+			'event_end' => '',
33
+			'currency' => '',
34
+			'event_tickets' => array(),
35
+			'venue_name' => '',
36
+			'venue_url' => '',
37
+			'venue_locality' => '',
38
+			'venue_region' => '',
39
+			'event_image' => '',
40
+		);
41
+		$template_args['event_permalink'] = $event->get_permalink();
42
+		$template_args['event_name'] = $event->name();
43
+		$template_args['event_description'] = wp_strip_all_tags($event->short_description(200));
44
+		$template_args['event_start'] = $event->primary_datetime()->start_date(DateTime::ATOM);
45
+		$template_args['event_end'] = $event->primary_datetime()->end_date(DateTime::ATOM);
46
+		$template_args['currency'] = EE_Registry::instance()->CFG->currency->code;
47
+		foreach ($event->tickets() as $ticket) {
48
+			$ID = $ticket->ID();
49
+			$template_args['event_tickets'][$ID]['start_date'] = $ticket->start_date(DateTime::ATOM, null);
50
+			$template_args['event_tickets'][$ID]['end_date'] = $ticket->end_date(DateTime::ATOM, null);
51
+			$template_args['event_tickets'][$ID]['price'] = number_format(
52
+				$ticket->price(),
53
+				EE_Registry::instance()->CFG->currency->dec_plc,
54
+				EE_Registry::instance()->CFG->currency->dec_mrk,
55
+				EE_Registry::instance()->CFG->currency->thsnds
56
+			);
57
+		}
58
+		$VNU_ID = espresso_venue_id();
59
+		if ( ! empty($VNU_ID) && ! espresso_is_venue_private($VNU_ID)) {
60
+			$venue = EEH_Venue_View::get_venue($VNU_ID);
61
+			$template_args['venue_name'] = get_the_title($VNU_ID);
62
+			$template_args['venue_url'] = get_permalink($VNU_ID);
63
+			$template_args['venue_locality'] = $venue->city();
64
+			$template_args['venue_region'] = $venue->state_name();
65
+		}
66
+		$template_args['event_image'] = $event->feature_image_url();
67
+		$template_args = apply_filters(
68
+			'FHEE__EEH_Schema__add_json_linked_data_for_event__template_args',
69
+			$template_args,
70
+			$event,
71
+			$VNU_ID
72
+		);
73
+		extract($template_args, EXTR_OVERWRITE);
74
+		include EE_TEMPLATES . 'json_linked_data_for_event.template.php';
75
+	}
76 76
 
77 77
 
78 78
 	/**
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public static function location( $location = null ) {
88 88
 		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'
89
-		                              . $location
90
-		                              . '</div>' : '';
89
+									  . $location
90
+									  . '</div>' : '';
91 91
 	}
92 92
 
93 93
 
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public static function postalCode( EEI_Address $obj_with_address = null ) {
209 209
 		return $obj_with_address->zip() !== null && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'
210
-		                                                                              . $obj_with_address->zip()
211
-		                                                                              . '</span>' : '';
210
+																					  . $obj_with_address->zip()
211
+																					  . '</span>' : '';
212 212
 	}
213 213
 
214 214
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,243 +40,243 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                ); ?>
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+				); ?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-        espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                            esc_html__(
79
-                                    'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                                    'event_espresso'
81
-                            ),
82
-                            EE_MIN_PHP_VER_REQUIRED,
83
-                            PHP_VERSION,
84
-                            '<br/>',
85
-                            '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+							esc_html__(
79
+									'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+									'event_espresso'
81
+							),
82
+							EE_MIN_PHP_VER_REQUIRED,
83
+							PHP_VERSION,
84
+							'<br/>',
85
+							'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.27.rc.006');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.27.rc.006');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
-        new EE_Bootstrap();
263
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
+		new EE_Bootstrap();
263
+	}
264 264
 }
265 265
 if ( ! function_exists('espresso_deactivate_plugin')) {
266
-    /**
267
-     *    deactivate_plugin
268
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
-     *
270
-     * @access public
271
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
-     * @return    void
273
-     */
274
-    function espresso_deactivate_plugin($plugin_basename = '')
275
-    {
276
-        if ( ! function_exists('deactivate_plugins')) {
277
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
-        }
279
-        unset($_GET['activate'], $_REQUEST['activate']);
280
-        deactivate_plugins($plugin_basename);
281
-    }
266
+	/**
267
+	 *    deactivate_plugin
268
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
+	 *
270
+	 * @access public
271
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
+	 * @return    void
273
+	 */
274
+	function espresso_deactivate_plugin($plugin_basename = '')
275
+	{
276
+		if ( ! function_exists('deactivate_plugins')) {
277
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
+		}
279
+		unset($_GET['activate'], $_REQUEST['activate']);
280
+		deactivate_plugins($plugin_basename);
281
+	}
282 282
 }
Please login to merge, or discard this patch.