Completed
Branch FET-3467-waitlists (94dbd6)
by
unknown
37:58 queued 26:19
created
core/services/formatters/Windows1252.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -20,33 +20,33 @@
 block discarded – undo
20 20
 class Windows1252 extends FormatterBase
21 21
 {
22 22
 
23
-    /**
24
-     * Converts the string to windows-1252 encoding.
25
-     *
26
-     * @param string|int|float $input anything easily cast into a string
27
-     * @return string
28
-     */
29
-    public function format($input)
30
-    {
31
-        //in case an int or float etc was passed in
32
-        $input = (string)$input;
33
-        if (function_exists('iconv')) {
34
-            $input = iconv('utf-8', 'cp1252//TRANSLIT', $input);
35
-        } elseif ( WP_DEBUG) {
36
-            trigger_error(
37
-                sprintf(
38
-                    // @codingStandardsIgnoreStart
39
-                    esc_html__('%1$s could not format the string "%2$s" because the function "%3$s" does not exist. Please verify PHP is installed with this function, see %4$s', 'event_espresso'),
40
-                    // @codingStandardsIgnoreEnd
41
-                    get_class($this),
42
-                    $input,
43
-                    'iconv',
44
-                    '<a href="http://php.net/manual/en/iconv.installation.php">http://php.net/manual/en/iconv.installation.php</a>'
45
-                )
46
-            );
47
-        }
48
-        return $input;
49
-    }
23
+	/**
24
+	 * Converts the string to windows-1252 encoding.
25
+	 *
26
+	 * @param string|int|float $input anything easily cast into a string
27
+	 * @return string
28
+	 */
29
+	public function format($input)
30
+	{
31
+		//in case an int or float etc was passed in
32
+		$input = (string)$input;
33
+		if (function_exists('iconv')) {
34
+			$input = iconv('utf-8', 'cp1252//TRANSLIT', $input);
35
+		} elseif ( WP_DEBUG) {
36
+			trigger_error(
37
+				sprintf(
38
+					// @codingStandardsIgnoreStart
39
+					esc_html__('%1$s could not format the string "%2$s" because the function "%3$s" does not exist. Please verify PHP is installed with this function, see %4$s', 'event_espresso'),
40
+					// @codingStandardsIgnoreEnd
41
+					get_class($this),
42
+					$input,
43
+					'iconv',
44
+					'<a href="http://php.net/manual/en/iconv.installation.php">http://php.net/manual/en/iconv.installation.php</a>'
45
+				)
46
+			);
47
+		}
48
+		return $input;
49
+	}
50 50
 }
51 51
 // End of file EmojiRemoval.php
52 52
 // Location: core\services\formatters/EmojiRemoval.php
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
     public function format($input)
30 30
     {
31 31
         //in case an int or float etc was passed in
32
-        $input = (string)$input;
32
+        $input = (string) $input;
33 33
         if (function_exists('iconv')) {
34 34
             $input = iconv('utf-8', 'cp1252//TRANSLIT', $input);
35
-        } elseif ( WP_DEBUG) {
35
+        } elseif (WP_DEBUG) {
36 36
             trigger_error(
37 37
                 sprintf(
38 38
                     // @codingStandardsIgnoreStart
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EEG_Aim.gateway.php 2 patches
Spacing   +43 added lines, -43 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_Aim extends EE_Onsite_Gateway{
28
+class EEG_Aim extends EE_Onsite_Gateway {
29 29
 
30 30
 	const LIVE_URL    = 'https://secure2.authorize.net/gateway/transact.dll'; //Authnet URL
31 31
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	 * @param EEG_Aim $gateway_object
158 158
 	 * @return string
159 159
 	 */
160
-	public function possibly_use_deprecated_aim_server( $url, EEG_Aim $gateway_object ) {
161
-		if(  $gateway_object->_server === 'authorize.net'
162
-			&& ! $gateway_object->_debug_mode ) {
160
+	public function possibly_use_deprecated_aim_server($url, EEG_Aim $gateway_object) {
161
+		if ($gateway_object->_server === 'authorize.net'
162
+			&& ! $gateway_object->_debug_mode) {
163 163
 			return 'https://secure.authorize.net/gateway/transact.dll';
164 164
 		} else {
165 165
 			return $url;
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 
184 184
 	public function do_direct_payment($payment, $billing_info = null) {
185
-			add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_deprecated_aim_server' ), 10, 2 );
185
+			add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_deprecated_aim_server'), 10, 2);
186 186
 			// Enable test mode if needed
187 187
 			//4007000000027  <-- test successful visa
188 188
 			//4222222222222  <-- test failure card number
189 189
 
190 190
 			$item_num = 1;
191 191
 			$transaction = $payment->transaction();
192
-			$order_description = $this->_format_order_description( $payment );
192
+			$order_description = $this->_format_order_description($payment);
193 193
 			$primary_registrant = $transaction->primary_registration();
194 194
 			//if we're are charging for the full amount, show the normal line items
195 195
 			//and the itemized total adds up properly
196
-			if( $this->_can_easily_itemize_transaction_for( $payment ) ){
196
+			if ($this->_can_easily_itemize_transaction_for($payment)) {
197 197
 				$total_line_item = $transaction->total_line_item();
198 198
 				foreach ($total_line_item->get_items() as $line_item) {
199
-					if( $line_item->quantity() == 0 ){
199
+					if ($line_item->quantity() == 0) {
200 200
 						continue;
201 201
 					}
202 202
 					$this->addLineItem(
203 203
 						$item_num++, 
204
-						$this->_format_line_item_name( $line_item, $payment ), 
205
-						$this->_format_line_item_desc( $line_item, $payment ), 
204
+						$this->_format_line_item_name($line_item, $payment), 
205
+						$this->_format_line_item_desc($line_item, $payment), 
206 206
 						$line_item->quantity(),
207 207
 						$line_item->unit_price(), 
208 208
 						'N');
209 209
 					$order_description .= $line_item->desc().', ';
210 210
 				}
211
-				foreach($total_line_item->tax_descendants() as $tax_line_item){
211
+				foreach ($total_line_item->tax_descendants() as $tax_line_item) {
212 212
 					$this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N');
213 213
 				}
214 214
 			}
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 			//start transaction
220 220
 			//if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id
221 221
 			$partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363';
222
-			$this->setField( 'solution_id', $partner_id );
222
+			$this->setField('solution_id', $partner_id);
223 223
 			$this->setField('amount', $this->format_currency($payment->amount()));
224
-			$this->setField('description',substr(rtrim($order_description, ', '), 0, 255));
225
-			$this->_set_sensitive_billing_data( $billing_info );
224
+			$this->setField('description', substr(rtrim($order_description, ', '), 0, 255));
225
+			$this->_set_sensitive_billing_data($billing_info);
226 226
 			$this->setField('first_name', $billing_info['first_name']);
227 227
 			$this->setField('last_name', $billing_info['last_name']);
228 228
 			$this->setField('email', $billing_info['email']);
229 229
 			$this->setField('company', $billing_info['company']);
230 230
 			$this->setField('address', $billing_info['address'].' '.$billing_info['address2']);
231 231
 			$this->setField('city', $billing_info['city']);
232
-			$this->setField('state', $billing_info['state'] );
233
-			$this->setField('country', $billing_info['country'] );
232
+			$this->setField('state', $billing_info['state']);
233
+			$this->setField('country', $billing_info['country']);
234 234
 			$this->setField('zip', $billing_info['zip']);
235 235
 			$this->setField('fax', $billing_info['fax']);
236 236
 			$this->setField('cust_id', $primary_registrant->ID());
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 			//invoice_num would be nice to have it be unique per SPCO page-load, that way if users
239 239
 			//press back, they don't submit a duplicate. However, we may be keeping the user on teh same spco page
240 240
 			//in which case, we need to generate teh invoice num per request right here...
241
-			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
241
+			$this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
242 242
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
243
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
243
+            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS);
244 244
 
245 245
 
246 246
 			if ($this->_test_transactions) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			//Capture response
251 251
 			$this->type = "AUTH_CAPTURE";
252 252
 			$response = $this->_sendRequest($payment);
253
-			if (!empty($response)){
253
+			if ( ! empty($response)) {
254 254
 				if ($response->error_message) {
255 255
                     $payment->set_status($this->_pay_model->failed_status());
256 256
                     $payment->set_gateway_response($response->error_message);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                     $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
259 259
                     $payment->set_status($payment_status);
260 260
                     //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
261
-                    $payment->set_amount( (float) $response->amount );
261
+                    $payment->set_amount((float) $response->amount);
262 262
                     $payment->set_gateway_response(
263 263
                         sprintf(
264 264
                             esc_html__('%1$s (Reason Code: %2$s)', 'event_espresso'),
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
                     } else {
272 272
                         $txn_id = $response->transaction_id;
273 273
                     }
274
-                    $payment->set_txn_id_chq_nmbr( $txn_id );
274
+                    $payment->set_txn_id_chq_nmbr($txn_id);
275 275
                 }
276 276
 				$payment->set_extra_accntng($primary_registrant->reg_code());
277
-				$payment->set_details(print_r($response,true));
277
+				$payment->set_details(print_r($response, true));
278 278
 			} else {
279 279
 				$payment->set_status($this->_pay_model->failed_status());
280 280
 				$payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso'));
281
-				$payment->set_details(print_r($response,true));
281
+				$payment->set_details(print_r($response, true));
282 282
 			}
283 283
 		return $payment;
284 284
 	}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * what billing data gets sent
290 290
 	 * @param array $billing_info
291 291
 	 */
292
-	protected function _set_sensitive_billing_data( $billing_info ) {
292
+	protected function _set_sensitive_billing_data($billing_info) {
293 293
 		$this->setField('card_num', $billing_info['credit_card']);
294 294
 		$this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']);
295 295
 		$this->setField('card_code', $billing_info['cvv']);
@@ -347,23 +347,23 @@  discard block
 block discarded – undo
347 347
 		$this->_x_post_fields['tran_key'] = $this->_transaction_key;
348 348
 		$x_keys = array();
349 349
 		foreach ($this->_x_post_fields as $key => $value) {
350
-			$x_keys[] = "x_$key=" . urlencode($this->_get_unsupported_character_remover()->format($value));
350
+			$x_keys[] = "x_$key=".urlencode($this->_get_unsupported_character_remover()->format($value));
351 351
 		}
352 352
 		// Add line items
353 353
 		foreach ($this->_additional_line_items as $key => $value) {
354
-			$x_keys[] =  "x_line_item=" . urlencode($this->_get_unsupported_character_remover()->format($value));
354
+			$x_keys[] = "x_line_item=".urlencode($this->_get_unsupported_character_remover()->format($value));
355 355
 		}
356 356
 		$this->_log_clean_request($x_keys, $payment);
357 357
 		$post_url = $this->_get_server_url();
358 358
 		$curl_request = curl_init($post_url);
359
-        $post_body = implode("&",$x_keys);
359
+        $post_body = implode("&", $x_keys);
360 360
 		curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post_body);
361 361
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
362 362
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
363 363
 		curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
364 364
 		curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2);
365 365
 		if ($this->VERIFY_PEER) {
366
-			curl_setopt($curl_request, CURLOPT_CAINFO, dirname( __DIR__ ) . '/ssl/cert.pem');
366
+			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(__DIR__).'/ssl/cert.pem');
367 367
 		} else {
368 368
 			curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
369 369
 		}
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 		$response = curl_exec($curl_request);
376 376
 
377 377
 		curl_close($curl_request);
378
-		$response_obj =  new EE_AuthorizeNetAIM_Response($response);
378
+		$response_obj = new EE_AuthorizeNetAIM_Response($response);
379 379
 
380 380
 		return $this->_log_and_clean_response($response_obj, $payment);
381 381
 	}
@@ -384,18 +384,18 @@  discard block
 block discarded – undo
384 384
 	 * @param array $request_array
385 385
 	 * @param EEI_Payment $payment
386 386
 	 */
387
-	protected function _log_clean_request($request_array,$payment){
388
-		$keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' );
389
-		foreach($request_array as $index => $keyvaltogether ) {
390
-			foreach( $keys_to_filter_out as $key ) {
391
-				if( strpos( $keyvaltogether, $key ) === 0 ){
387
+	protected function _log_clean_request($request_array, $payment) {
388
+		$keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date');
389
+		foreach ($request_array as $index => $keyvaltogether) {
390
+			foreach ($keys_to_filter_out as $key) {
391
+				if (strpos($keyvaltogether, $key) === 0) {
392 392
 					//found it at the first character
393 393
 					//so its one of them
394
-					unset( $request_array[ $index ] );
394
+					unset($request_array[$index]);
395 395
 				}
396 396
 			}
397 397
 		}
398
-		$this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url() ),$payment);
398
+		$this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url()), $payment);
399 399
 	}
400 400
 
401 401
 
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	 * @param EE_Payment                  $payment
408 408
 	 * @return \EE_AuthorizeNetAIM_Response
409 409
 	 */
410
-	private function _log_and_clean_response($response_obj,$payment){
410
+	private function _log_and_clean_response($response_obj, $payment) {
411 411
 		$response_obj->account_number = '';
412
-		$this->log(array('AIM Response received:'=>(array)$response_obj),$payment);
412
+		$this->log(array('AIM Response received:'=>(array) $response_obj), $payment);
413 413
 		return $response_obj;
414 414
 	}
415 415
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 			// Split Array
509 509
 			$this->response = $response;
510 510
 			if ($encap_char) {
511
-				$this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
511
+				$this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1));
512 512
 			} else {
513 513
 				$this->_response_array = explode($delimiter, $response);
514 514
 			}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 }
593 593
 
594
-if ( ! class_exists( 'AuthorizeNetException' ) ) {
594
+if ( ! class_exists('AuthorizeNetException')) {
595 595
 	/**
596 596
 	 * Class AuthorizeNetException
597 597
 	 *
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 		 * @param Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0
608 608
 		 * @since 5.1.0
609 609
 		 */
610
-		public function __construct( $message = "", $code = 0, Exception $previous = null ) {
611
-			parent::__construct( $message, $code, $previous );
610
+		public function __construct($message = "", $code = 0, Exception $previous = null) {
611
+			parent::__construct($message, $code, $previous);
612 612
 		}
613 613
 	}
614 614
 }
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			//in which case, we need to generate teh invoice num per request right here...
241 241
 			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
242 242
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
243
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
243
+			$this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
244 244
 
245 245
 
246 246
 			if ($this->_test_transactions) {
@@ -252,27 +252,27 @@  discard block
 block discarded – undo
252 252
 			$response = $this->_sendRequest($payment);
253 253
 			if (!empty($response)){
254 254
 				if ($response->error_message) {
255
-                    $payment->set_status($this->_pay_model->failed_status());
256
-                    $payment->set_gateway_response($response->error_message);
257
-                } else {
258
-                    $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
259
-                    $payment->set_status($payment_status);
260
-                    //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
261
-                    $payment->set_amount( (float) $response->amount );
262
-                    $payment->set_gateway_response(
263
-                        sprintf(
264
-                            esc_html__('%1$s (Reason Code: %2$s)', 'event_espresso'),
265
-                            $response->response_reason_text,
266
-                            $response->response_reason_code
267
-                        )
268
-                    );
269
-                    if ($this->_debug_mode) {
270
-                        $txn_id = $response->invoice_number;
271
-                    } else {
272
-                        $txn_id = $response->transaction_id;
273
-                    }
274
-                    $payment->set_txn_id_chq_nmbr( $txn_id );
275
-                }
255
+					$payment->set_status($this->_pay_model->failed_status());
256
+					$payment->set_gateway_response($response->error_message);
257
+				} else {
258
+					$payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
259
+					$payment->set_status($payment_status);
260
+					//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
261
+					$payment->set_amount( (float) $response->amount );
262
+					$payment->set_gateway_response(
263
+						sprintf(
264
+							esc_html__('%1$s (Reason Code: %2$s)', 'event_espresso'),
265
+							$response->response_reason_text,
266
+							$response->response_reason_code
267
+						)
268
+					);
269
+					if ($this->_debug_mode) {
270
+						$txn_id = $response->invoice_number;
271
+					} else {
272
+						$txn_id = $response->transaction_id;
273
+					}
274
+					$payment->set_txn_id_chq_nmbr( $txn_id );
275
+				}
276 276
 				$payment->set_extra_accntng($primary_registrant->reg_code());
277 277
 				$payment->set_details(print_r($response,true));
278 278
 			} else {
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 		$this->_log_clean_request($x_keys, $payment);
357 357
 		$post_url = $this->_get_server_url();
358 358
 		$curl_request = curl_init($post_url);
359
-        $post_body = implode("&",$x_keys);
359
+		$post_body = implode("&",$x_keys);
360 360
 		curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post_body);
361 361
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
362 362
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	public $requested_amount;
490 490
 	public $balance_on_card;
491 491
 	public $response; // The response string from AuthorizeNet.
492
-    public $error_message;
492
+	public $error_message;
493 493
 	private $_response_array = array(); // An array with the split response.
494 494
 
495 495
 	/**
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 				$this->approved = false;
522 522
 				$this->error = true;
523 523
 				$this->error_message = sprintf(
524
-				    esc_html__('Unrecognized response from Authorize.net: %1$s', 'event_espresso'),
525
-                    esc_html($response)
526
-                );
524
+					esc_html__('Unrecognized response from Authorize.net: %1$s', 'event_espresso'),
525
+					esc_html($response)
526
+				);
527 527
 				return;
528 528
 			}
529 529
 
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 			$this->approved = false;
585 585
 			$this->error = true;
586 586
 			$this->error_message = esc_html__(
587
-			    'Error connecting to Authorize.net',
588
-                'event_espresso'
589
-            );
587
+				'Error connecting to Authorize.net',
588
+				'event_espresso'
589
+			);
590 590
 		}
591 591
 	}
592 592
 
Please login to merge, or discard this patch.
core/helpers/EEH_Money.helper.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -8,71 +8,71 @@  discard block
 block discarded – undo
8 8
  */
9 9
 if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
10 10
  /**
11
- *
12
- * Money helper class.
13
- * This class has helper methods that help with money related conversions and calculations.
14
- *
15
- * @since %VER%
16
- *
17
- * @package		Event Espresso
18
- * @subpackage	helpers
19
- * @author		Darren Ethier
20
- *
21
- * ------------------------------------------------------------------------
22
- */
11
+  *
12
+  * Money helper class.
13
+  * This class has helper methods that help with money related conversions and calculations.
14
+  *
15
+  * @since %VER%
16
+  *
17
+  * @package		Event Espresso
18
+  * @subpackage	helpers
19
+  * @author		Darren Ethier
20
+  *
21
+  * ------------------------------------------------------------------------
22
+  */
23 23
 class EEH_Money extends EEH_Base  {
24 24
 
25 25
 
26
-    /**
27
-     * This removes all localized money formatting from the incoming value
28
-     *
29
-     * Note: uses this site's currency settings for deciding what is considered a
30
-     * "thousands separator" (usually the character "," )
31
-     * and what is a "decimal mark" (usually the character ".")
32
-     *
33
-     * @param int|float|string $money_value
34
-     * @param string           $CNT_ISO
35
-     * @return float
36
-     * @throws EE_Error
37
-     */
26
+	/**
27
+	 * This removes all localized money formatting from the incoming value
28
+	 *
29
+	 * Note: uses this site's currency settings for deciding what is considered a
30
+	 * "thousands separator" (usually the character "," )
31
+	 * and what is a "decimal mark" (usually the character ".")
32
+	 *
33
+	 * @param int|float|string $money_value
34
+	 * @param string           $CNT_ISO
35
+	 * @return float
36
+	 * @throws EE_Error
37
+	 */
38 38
 	public static function strip_localized_money_formatting($money_value, $CNT_ISO = '') {
39
-        $currency_config = EEH_Money::get_currency_config($CNT_ISO);
40
-        $money_value = str_replace(
41
-		    array(
42
-                $currency_config->thsnds,
43
-                $currency_config->dec_mrk,
44
-            ),
45
-            array(
46
-                '', // remove thousands separator
47
-                '.', // convert decimal mark to what PHP expects
48
-            ),
49
-            $money_value
50
-        );
51
-        $money_value = filter_var(
52
-            $money_value,
53
-            FILTER_SANITIZE_NUMBER_FLOAT,
54
-            FILTER_FLAG_ALLOW_FRACTION
55
-        );
56
-        return $money_value;
57
-    }
58
-
59
-
60
-
61
-    /**
62
-     * This converts an incoming localized money value into a standard float item (to three decimal places)
63
-     *
64
-     * Only use this if you know the $money_value follows your currency configuration's
65
-     * settings. Note: this uses this site's currency settings for deciding what is considered a
66
-     * "thousands separator" (usually the character "," )
67
-     * and what is a "decimal mark" (usually the character ".")
68
-     *
69
-     * @param int|string $money_value
70
-     * @return float
71
-     * @throws EE_Error
72
-     */
39
+		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
40
+		$money_value = str_replace(
41
+			array(
42
+				$currency_config->thsnds,
43
+				$currency_config->dec_mrk,
44
+			),
45
+			array(
46
+				'', // remove thousands separator
47
+				'.', // convert decimal mark to what PHP expects
48
+			),
49
+			$money_value
50
+		);
51
+		$money_value = filter_var(
52
+			$money_value,
53
+			FILTER_SANITIZE_NUMBER_FLOAT,
54
+			FILTER_FLAG_ALLOW_FRACTION
55
+		);
56
+		return $money_value;
57
+	}
58
+
59
+
60
+
61
+	/**
62
+	 * This converts an incoming localized money value into a standard float item (to three decimal places)
63
+	 *
64
+	 * Only use this if you know the $money_value follows your currency configuration's
65
+	 * settings. Note: this uses this site's currency settings for deciding what is considered a
66
+	 * "thousands separator" (usually the character "," )
67
+	 * and what is a "decimal mark" (usually the character ".")
68
+	 *
69
+	 * @param int|string $money_value
70
+	 * @return float
71
+	 * @throws EE_Error
72
+	 */
73 73
 	public static function convert_to_float_from_localized_money($money_value ) {
74 74
 		//float it! and round to three decimal places
75
-        return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 );
75
+		return round ( (float) EEH_Money::strip_localized_money_formatting($money_value), 3 );
76 76
 	}
77 77
 
78 78
 
@@ -160,19 +160,19 @@  discard block
 block discarded – undo
160 160
 
161 161
 
162 162
 
163
-    /**
164
-     * This returns a localized format string suitable for jQplot.
165
-     *
166
-     * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
167
-     *                         Otherwise will use currency settings for current active country on site.
168
-     * @return string
169
-     * @throws EE_Error
170
-     */
163
+	/**
164
+	 * This returns a localized format string suitable for jQplot.
165
+	 *
166
+	 * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
167
+	 *                         Otherwise will use currency settings for current active country on site.
168
+	 * @return string
169
+	 * @throws EE_Error
170
+	 */
171 171
 	public static function get_format_for_jqplot( $CNT_ISO = '') {
172 172
 		//default format
173 173
 		$format = 'f';
174 174
 		$currency_config = $currency_config = EEH_Money::get_currency_config($CNT_ISO);
175
-        //first get the decimal place and number of places
175
+		//first get the decimal place and number of places
176 176
 		$format = "%'." . $currency_config->dec_plc . $format;
177 177
 		//currency symbol on right side.
178 178
 		$format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign;
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
 
182 182
 
183 183
 
184
-    /**
185
-     * This returns a localized format string suitable for usage with the Google Charts API format param.
186
-     *
187
-     * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
188
-     *                         Otherwise will use currency settings for current active country on site.
189
-     *                         Note: GoogleCharts uses ICU pattern set
190
-     *                         (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
191
-     * @return string
192
-     * @throws EE_Error
193
-     */
184
+	/**
185
+	 * This returns a localized format string suitable for usage with the Google Charts API format param.
186
+	 *
187
+	 * @param string $CNT_ISO  If this is provided, then will attempt to get the currency settings for the country.
188
+	 *                         Otherwise will use currency settings for current active country on site.
189
+	 *                         Note: GoogleCharts uses ICU pattern set
190
+	 *                         (@see http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details)
191
+	 * @return string
192
+	 * @throws EE_Error
193
+	 */
194 194
 	public static function get_format_for_google_charts( $CNT_ISO = '' ) {
195 195
 		$currency_config = EEH_Money::get_currency_config($CNT_ISO);
196 196
 		$decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' );
@@ -217,24 +217,24 @@  discard block
 block discarded – undo
217 217
 
218 218
 
219 219
 
220
-    /**
221
-     * @param string $CNT_ISO
222
-     * @return EE_Currency_Config|null
223
-     * @throws EE_Error
224
-     */
225
-    public static function get_currency_config($CNT_ISO = '')
226
-    {
227
-        //if CNT_ISO passed lets try to get currency settings for it.
228
-        $currency_config = $CNT_ISO !== ''
229
-            ? new EE_Currency_Config($CNT_ISO)
230
-            : null;
231
-        //default currency settings for site if not set
232
-        if (! $currency_config instanceof EE_Currency_Config) {
233
-            $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
234
-                ? EE_Registry::instance()->CFG->currency
235
-                : new EE_Currency_Config();
236
-        }
237
-        return $currency_config;
238
-    }
220
+	/**
221
+	 * @param string $CNT_ISO
222
+	 * @return EE_Currency_Config|null
223
+	 * @throws EE_Error
224
+	 */
225
+	public static function get_currency_config($CNT_ISO = '')
226
+	{
227
+		//if CNT_ISO passed lets try to get currency settings for it.
228
+		$currency_config = $CNT_ISO !== ''
229
+			? new EE_Currency_Config($CNT_ISO)
230
+			: null;
231
+		//default currency settings for site if not set
232
+		if (! $currency_config instanceof EE_Currency_Config) {
233
+			$currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
234
+				? EE_Registry::instance()->CFG->currency
235
+				: new EE_Currency_Config();
236
+		}
237
+		return $currency_config;
238
+	}
239 239
 
240 240
 } //end class EEH_Money
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_data_reset_and_delete.template.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 <div class="padding">
44 44
 	<h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php esc_html_e('Permanently Delete ALL Event Espresso Data', 'event_espresso');?></h4>
45 45
     <p><?php esc_html_e(' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
46
-            'event_espresso');?></p>
46
+			'event_espresso');?></p>
47 47
 	<p><?php esc_html_e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso');?></p>
48 48
 	<p class="important-notice"><?php printf( esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<em>', '</em>' ); ?><br/></p>
49 49
 	<ol>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 /** @var string $delete_db_url */
8 8
 ?>
9 9
 <h2>
10
-	<?php esc_html_e( 'Reset/Delete Data for Event Espresso', 'event_espresso' );?>
10
+	<?php esc_html_e('Reset/Delete Data for Event Espresso', 'event_espresso'); ?>
11 11
 </h2>
12 12
 <br />
13 13
 
14 14
 <div class="padding">
15
-	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Ticket and Datetime Reserved Counts', 'event_espresso');?></h4>
16
-	<p><?php esc_html_e('Use this to reset the counts for ticket and datetime reservations.', 'event_espresso');?></p>
15
+	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Ticket and Datetime Reserved Counts', 'event_espresso'); ?></h4>
16
+	<p><?php esc_html_e('Use this to reset the counts for ticket and datetime reservations.', 'event_espresso'); ?></p>
17 17
 	<div class="float-right"><?php echo $reset_reservations_button; ?></div>
18 18
 	<div class="clear"></div>
19 19
 </div>
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 
23 23
 <!-- reset DB url is here. Just need to make it look pretty and unhide it-->
24 24
 <div class="padding">
25
-	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Capabilities', 'event_espresso');?></h4>
26
-	<p><?php esc_html_e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso');?></p>
25
+	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Capabilities', 'event_espresso'); ?></h4>
26
+	<p><?php esc_html_e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso'); ?></p>
27 27
 	<div class="float-right"><?php echo $reset_capabilities_button; ?></div>
28 28
 	<div class="clear"></div>
29 29
 </div>
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 <br />
32 32
 
33 33
 <div class="padding">
34
-	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Data', 'event_espresso');?></h4>
35
-    <p><?php esc_html_e(' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.', 'event_espresso');?></p>
36
-    <p><?php esc_html_e('Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.', 'event_espresso');?></p>
37
-	<div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url;?>"><?php esc_html_e('Reset Event Espresso Tables', 'event_espresso');?></a></div>
34
+	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Data', 'event_espresso'); ?></h4>
35
+    <p><?php esc_html_e(' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.', 'event_espresso'); ?></p>
36
+    <p><?php esc_html_e('Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.', 'event_espresso'); ?></p>
37
+	<div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url; ?>"><?php esc_html_e('Reset Event Espresso Tables', 'event_espresso'); ?></a></div>
38 38
 	<div class="clear"></div>
39 39
 </div>
40 40
 <br />
41 41
 <br />
42 42
 
43 43
 <div class="padding">
44
-	<h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php esc_html_e('Permanently Delete ALL Event Espresso Data', 'event_espresso');?></h4>
44
+	<h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php esc_html_e('Permanently Delete ALL Event Espresso Data', 'event_espresso'); ?></h4>
45 45
     <p><?php esc_html_e(' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
46
-            'event_espresso');?></p>
47
-	<p><?php esc_html_e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso');?></p>
48
-	<p class="important-notice"><?php printf( esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<em>', '</em>' ); ?><br/></p>
46
+            'event_espresso'); ?></p>
47
+	<p><?php esc_html_e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso'); ?></p>
48
+	<p class="important-notice"><?php printf(esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<em>', '</em>'); ?><br/></p>
49 49
 	<ol>
50
-		<li><?php  printf( esc_html__('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.', 'event_espresso'), '<strong>', '</strong>' );?></li>
51
-		<li><?php printf( esc_html__('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li>
52
-        <li><?php printf( esc_html__('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li>
50
+		<li><?php  printf(esc_html__('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.', 'event_espresso'), '<strong>', '</strong>'); ?></li>
51
+		<li><?php printf(esc_html__('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>'); ?></li>
52
+        <li><?php printf(esc_html__('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>'); ?></li>
53 53
 	</ol>
54
-	<div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php esc_html_e('Permanently Delete All Event Espresso Data', 'event_espresso');?></a></div>
54
+	<div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php esc_html_e('Permanently Delete All Event Espresso Data', 'event_espresso'); ?></a></div>
55 55
 	<div class="clear"></div>
56 56
 </div>
57 57
 <br/>
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 2 patches
Indentation   +299 added lines, -299 removed lines patch added patch discarded remove patch
@@ -14,326 +14,326 @@
 block discarded – undo
14 14
 class EEM_Ticket extends EEM_Soft_Delete_Base
15 15
 {
16 16
 
17
-    /**
18
-     * private instance of the EEM_Ticket object
19
-     *
20
-     * @var EEM_Ticket $_instance
21
-     */
22
-    protected static $_instance;
17
+	/**
18
+	 * private instance of the EEM_Ticket object
19
+	 *
20
+	 * @var EEM_Ticket $_instance
21
+	 */
22
+	protected static $_instance;
23 23
 
24 24
 
25 25
 
26
-    /**
27
-     * private constructor to prevent direct creation
28
-     *
29
-     * @Constructor
30
-     * @access private
31
-     * @param string $timezone string representing the timezone we want to set for returned Date Time Strings
32
-     *                         (and any incoming timezone data that gets saved).
33
-     *                         Note this just sends the timezone info to the date time model field objects.
34
-     *                         Default is NULL
35
-     *                         (and will be assumed using the set timezone in the 'timezone_string' wp option)
36
-     * @throws EE_Error
37
-     */
38
-    protected function __construct($timezone)
39
-    {
40
-        $this->singular_item = esc_html__('Ticket', 'event_espresso');
41
-        $this->plural_item = esc_html__('Tickets', 'event_espresso');
42
-        $this->_tables = array(
43
-            'Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID'),
44
-        );
45
-        $this->_fields = array(
46
-            'Ticket' => array(
47
-                'TKT_ID'          => new EE_Primary_Key_Int_Field(
48
-                    'TKT_ID',
49
-                    esc_html__('Ticket ID', 'event_espresso')
50
-                ),
51
-                'TTM_ID'          => new EE_Foreign_Key_Int_Field(
52
-                    'TTM_ID',
53
-                    esc_html__('Ticket Template ID', 'event_espresso'),
54
-                    false,
55
-                    0,
56
-                    'Ticket_Template'
57
-                ),
58
-                'TKT_name'        => new EE_Plain_Text_Field(
59
-                    'TKT_name',
60
-                    esc_html__('Ticket Name', 'event_espresso'),
61
-                    false,
62
-                    ''
63
-                ),
64
-                'TKT_description' => new EE_Post_Content_Field(
65
-                    'TKT_description',
66
-                    esc_html__('Description of Ticket', 'event_espresso'),
67
-                    false,
68
-                    ''
69
-                ),
70
-                'TKT_start_date'  => new EE_Datetime_Field(
71
-                    'TKT_start_date',
72
-                    esc_html__('Start time/date of Ticket', 'event_espresso'),
73
-                    false,
74
-                    EE_Datetime_Field::now,
75
-                    $timezone
76
-                ),
77
-                'TKT_end_date'    => new EE_Datetime_Field(
78
-                    'TKT_end_date',
79
-                    esc_html__('End time/date of Ticket', 'event_espresso'),
80
-                    false,
81
-                    EE_Datetime_Field::now,
82
-                    $timezone
83
-                ),
84
-                'TKT_min'         => new EE_Integer_Field(
85
-                    'TKT_min',
86
-                    esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso'),
87
-                    false,
88
-                    0
89
-                ),
90
-                'TKT_max'         => new EE_Infinite_Integer_Field(
91
-                    'TKT_max',
92
-                    esc_html__(
93
-                        'Maximum quantity of this ticket that can be purchased in one transaction',
94
-                        'event_espresso'
95
-                    ),
96
-                    false,
97
-                    EE_INF
98
-                ),
99
-                'TKT_price'       => new EE_Money_Field(
100
-                    'TKT_price',
101
-                    esc_html__('Final calculated price for ticket', 'event_espresso'),
102
-                    false,
103
-                    0
104
-                ),
105
-                'TKT_sold'        => new EE_Integer_Field(
106
-                    'TKT_sold',
107
-                    esc_html__('Number of this ticket sold', 'event_espresso'),
108
-                    false,
109
-                    0
110
-                ),
111
-                'TKT_qty'         => new EE_Infinite_Integer_Field(
112
-                    'TKT_qty',
113
-                    esc_html__('Quantity of this ticket that is available', 'event_espresso'),
114
-                    false,
115
-                    EE_INF
116
-                ),
117
-                'TKT_reserved'    => new EE_Integer_Field(
118
-                    'TKT_reserved',
119
-                    esc_html__(
120
-                        'Quantity of this ticket that is reserved, but not yet fully purchased',
121
-                        'event_espresso'
122
-                    ),
123
-                    false,
124
-                    0
125
-                ),
126
-                'TKT_uses'        => new EE_Infinite_Integer_Field(
127
-                    'TKT_uses',
128
-                    esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
129
-                    false,
130
-                    EE_INF
131
-                ),
132
-                'TKT_required'    => new EE_Boolean_Field(
133
-                    'TKT_required',
134
-                    esc_html__(
135
-                        'Flag indicating whether this ticket must be purchased with a transaction',
136
-                        'event_espresso'
137
-                    ),
138
-                    false,
139
-                    false
140
-                ),
141
-                'TKT_taxable'     => new EE_Boolean_Field(
142
-                    'TKT_taxable',
143
-                    esc_html__(
144
-                        'Flag indicating whether there is tax applied on this ticket',
145
-                        'event_espresso'
146
-                    ),
147
-                    false,
148
-                    false
149
-                ),
150
-                'TKT_is_default'  => new EE_Boolean_Field(
151
-                    'TKT_is_default',
152
-                    esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso'),
153
-                    false,
154
-                    false
155
-                ),
156
-                'TKT_order'       => new EE_Integer_Field(
157
-                    'TKT_order',
158
-                    esc_html__(
159
-                        'The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)',
160
-                        'event_espresso'
161
-                    ),
162
-                    false,
163
-                    0
164
-                ),
165
-                'TKT_row'         => new EE_Integer_Field(
166
-                    'TKT_row',
167
-                    esc_html__('How tickets are displayed in the ui', 'event_espresso'),
168
-                    false,
169
-                    0
170
-                ),
171
-                'TKT_deleted'     => new EE_Trashed_Flag_Field(
172
-                    'TKT_deleted',
173
-                    esc_html__('Flag indicating if this has been archived or not', 'event_espresso'),
174
-                    false,
175
-                    false
176
-                ),
177
-                'TKT_wp_user'     => new EE_WP_User_Field(
178
-                    'TKT_wp_user',
179
-                    esc_html__('Ticket Creator ID', 'event_espresso'),
180
-                    false
181
-                ),
182
-                'TKT_parent'      => new EE_Integer_Field(
183
-                    'TKT_parent',
184
-                    esc_html__(
185
-                        'Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)',
186
-                        'event_espresso'
187
-                    ),
188
-                    true,
189
-                    0
190
-                ),
191
-            ),
192
-        );
193
-        $this->_model_relations = array(
194
-            'Datetime'        => new EE_HABTM_Relation('Datetime_Ticket'),
195
-            'Datetime_Ticket' => new EE_Has_Many_Relation(),
196
-            'Price'           => new EE_HABTM_Relation('Ticket_Price'),
197
-            'Ticket_Template' => new EE_Belongs_To_Relation(),
198
-            'Registration'    => new EE_Has_Many_Relation(),
199
-            'WP_User'         => new EE_Belongs_To_Relation(),
200
-        );
201
-        //this model is generally available for reading
202
-        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public(
203
-            'TKT_is_default',
204
-            'Datetime.Event'
205
-        );
206
-        //account for default tickets in the caps
207
-        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected(
208
-            'TKT_is_default',
209
-            'Datetime.Event'
210
-        );
211
-        $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected(
212
-            'TKT_is_default',
213
-            'Datetime.Event'
214
-        );
215
-        $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected(
216
-            'TKT_is_default',
217
-            'Datetime.Event'
218
-        );
219
-        parent::__construct($timezone);
220
-    }
26
+	/**
27
+	 * private constructor to prevent direct creation
28
+	 *
29
+	 * @Constructor
30
+	 * @access private
31
+	 * @param string $timezone string representing the timezone we want to set for returned Date Time Strings
32
+	 *                         (and any incoming timezone data that gets saved).
33
+	 *                         Note this just sends the timezone info to the date time model field objects.
34
+	 *                         Default is NULL
35
+	 *                         (and will be assumed using the set timezone in the 'timezone_string' wp option)
36
+	 * @throws EE_Error
37
+	 */
38
+	protected function __construct($timezone)
39
+	{
40
+		$this->singular_item = esc_html__('Ticket', 'event_espresso');
41
+		$this->plural_item = esc_html__('Tickets', 'event_espresso');
42
+		$this->_tables = array(
43
+			'Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID'),
44
+		);
45
+		$this->_fields = array(
46
+			'Ticket' => array(
47
+				'TKT_ID'          => new EE_Primary_Key_Int_Field(
48
+					'TKT_ID',
49
+					esc_html__('Ticket ID', 'event_espresso')
50
+				),
51
+				'TTM_ID'          => new EE_Foreign_Key_Int_Field(
52
+					'TTM_ID',
53
+					esc_html__('Ticket Template ID', 'event_espresso'),
54
+					false,
55
+					0,
56
+					'Ticket_Template'
57
+				),
58
+				'TKT_name'        => new EE_Plain_Text_Field(
59
+					'TKT_name',
60
+					esc_html__('Ticket Name', 'event_espresso'),
61
+					false,
62
+					''
63
+				),
64
+				'TKT_description' => new EE_Post_Content_Field(
65
+					'TKT_description',
66
+					esc_html__('Description of Ticket', 'event_espresso'),
67
+					false,
68
+					''
69
+				),
70
+				'TKT_start_date'  => new EE_Datetime_Field(
71
+					'TKT_start_date',
72
+					esc_html__('Start time/date of Ticket', 'event_espresso'),
73
+					false,
74
+					EE_Datetime_Field::now,
75
+					$timezone
76
+				),
77
+				'TKT_end_date'    => new EE_Datetime_Field(
78
+					'TKT_end_date',
79
+					esc_html__('End time/date of Ticket', 'event_espresso'),
80
+					false,
81
+					EE_Datetime_Field::now,
82
+					$timezone
83
+				),
84
+				'TKT_min'         => new EE_Integer_Field(
85
+					'TKT_min',
86
+					esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso'),
87
+					false,
88
+					0
89
+				),
90
+				'TKT_max'         => new EE_Infinite_Integer_Field(
91
+					'TKT_max',
92
+					esc_html__(
93
+						'Maximum quantity of this ticket that can be purchased in one transaction',
94
+						'event_espresso'
95
+					),
96
+					false,
97
+					EE_INF
98
+				),
99
+				'TKT_price'       => new EE_Money_Field(
100
+					'TKT_price',
101
+					esc_html__('Final calculated price for ticket', 'event_espresso'),
102
+					false,
103
+					0
104
+				),
105
+				'TKT_sold'        => new EE_Integer_Field(
106
+					'TKT_sold',
107
+					esc_html__('Number of this ticket sold', 'event_espresso'),
108
+					false,
109
+					0
110
+				),
111
+				'TKT_qty'         => new EE_Infinite_Integer_Field(
112
+					'TKT_qty',
113
+					esc_html__('Quantity of this ticket that is available', 'event_espresso'),
114
+					false,
115
+					EE_INF
116
+				),
117
+				'TKT_reserved'    => new EE_Integer_Field(
118
+					'TKT_reserved',
119
+					esc_html__(
120
+						'Quantity of this ticket that is reserved, but not yet fully purchased',
121
+						'event_espresso'
122
+					),
123
+					false,
124
+					0
125
+				),
126
+				'TKT_uses'        => new EE_Infinite_Integer_Field(
127
+					'TKT_uses',
128
+					esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
129
+					false,
130
+					EE_INF
131
+				),
132
+				'TKT_required'    => new EE_Boolean_Field(
133
+					'TKT_required',
134
+					esc_html__(
135
+						'Flag indicating whether this ticket must be purchased with a transaction',
136
+						'event_espresso'
137
+					),
138
+					false,
139
+					false
140
+				),
141
+				'TKT_taxable'     => new EE_Boolean_Field(
142
+					'TKT_taxable',
143
+					esc_html__(
144
+						'Flag indicating whether there is tax applied on this ticket',
145
+						'event_espresso'
146
+					),
147
+					false,
148
+					false
149
+				),
150
+				'TKT_is_default'  => new EE_Boolean_Field(
151
+					'TKT_is_default',
152
+					esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso'),
153
+					false,
154
+					false
155
+				),
156
+				'TKT_order'       => new EE_Integer_Field(
157
+					'TKT_order',
158
+					esc_html__(
159
+						'The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)',
160
+						'event_espresso'
161
+					),
162
+					false,
163
+					0
164
+				),
165
+				'TKT_row'         => new EE_Integer_Field(
166
+					'TKT_row',
167
+					esc_html__('How tickets are displayed in the ui', 'event_espresso'),
168
+					false,
169
+					0
170
+				),
171
+				'TKT_deleted'     => new EE_Trashed_Flag_Field(
172
+					'TKT_deleted',
173
+					esc_html__('Flag indicating if this has been archived or not', 'event_espresso'),
174
+					false,
175
+					false
176
+				),
177
+				'TKT_wp_user'     => new EE_WP_User_Field(
178
+					'TKT_wp_user',
179
+					esc_html__('Ticket Creator ID', 'event_espresso'),
180
+					false
181
+				),
182
+				'TKT_parent'      => new EE_Integer_Field(
183
+					'TKT_parent',
184
+					esc_html__(
185
+						'Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)',
186
+						'event_espresso'
187
+					),
188
+					true,
189
+					0
190
+				),
191
+			),
192
+		);
193
+		$this->_model_relations = array(
194
+			'Datetime'        => new EE_HABTM_Relation('Datetime_Ticket'),
195
+			'Datetime_Ticket' => new EE_Has_Many_Relation(),
196
+			'Price'           => new EE_HABTM_Relation('Ticket_Price'),
197
+			'Ticket_Template' => new EE_Belongs_To_Relation(),
198
+			'Registration'    => new EE_Has_Many_Relation(),
199
+			'WP_User'         => new EE_Belongs_To_Relation(),
200
+		);
201
+		//this model is generally available for reading
202
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public(
203
+			'TKT_is_default',
204
+			'Datetime.Event'
205
+		);
206
+		//account for default tickets in the caps
207
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected(
208
+			'TKT_is_default',
209
+			'Datetime.Event'
210
+		);
211
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected(
212
+			'TKT_is_default',
213
+			'Datetime.Event'
214
+		);
215
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected(
216
+			'TKT_is_default',
217
+			'Datetime.Event'
218
+		);
219
+		parent::__construct($timezone);
220
+	}
221 221
 
222 222
 
223 223
 
224
-    /**
225
-     * This returns all tickets that are defaults from the db
226
-     *
227
-     * @return EE_Ticket[]
228
-     * @throws EE_Error
229
-     */
230
-    public function get_all_default_tickets()
231
-    {
232
-        /** @type EE_Ticket[] $tickets */
233
-        $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')));
234
-        //we need to set the start date and end date to today's date and the start of the default dtt
235
-        return $this->_set_default_dates($tickets);
236
-    }
224
+	/**
225
+	 * This returns all tickets that are defaults from the db
226
+	 *
227
+	 * @return EE_Ticket[]
228
+	 * @throws EE_Error
229
+	 */
230
+	public function get_all_default_tickets()
231
+	{
232
+		/** @type EE_Ticket[] $tickets */
233
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')));
234
+		//we need to set the start date and end date to today's date and the start of the default dtt
235
+		return $this->_set_default_dates($tickets);
236
+	}
237 237
 
238 238
 
239 239
 
240
-    /**
241
-     * sets up relevant start and end date for EE_Ticket (s)
242
-     *
243
-     * @param EE_Ticket[] $tickets
244
-     * @return EE_Ticket[]
245
-     * @throws EE_Error
246
-     */
247
-    private function _set_default_dates($tickets)
248
-    {
249
-        foreach ($tickets as $ticket) {
250
-            $ticket->set(
251
-                'TKT_start_date',
252
-                (int)$this->current_time_for_query('TKT_start_date', true)
253
-            );
254
-            $ticket->set('TKT_end_date',
255
-                (int)$this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS
256
-            );
257
-            $ticket->set_end_time($this->convert_datetime_for_query(
258
-                'TKT_end_date',
259
-                '11:59 pm',
260
-                'g:i a',
261
-                $this->_timezone)
262
-            );
263
-        }
264
-        return $tickets;
265
-    }
240
+	/**
241
+	 * sets up relevant start and end date for EE_Ticket (s)
242
+	 *
243
+	 * @param EE_Ticket[] $tickets
244
+	 * @return EE_Ticket[]
245
+	 * @throws EE_Error
246
+	 */
247
+	private function _set_default_dates($tickets)
248
+	{
249
+		foreach ($tickets as $ticket) {
250
+			$ticket->set(
251
+				'TKT_start_date',
252
+				(int)$this->current_time_for_query('TKT_start_date', true)
253
+			);
254
+			$ticket->set('TKT_end_date',
255
+				(int)$this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS
256
+			);
257
+			$ticket->set_end_time($this->convert_datetime_for_query(
258
+				'TKT_end_date',
259
+				'11:59 pm',
260
+				'g:i a',
261
+				$this->_timezone)
262
+			);
263
+		}
264
+		return $tickets;
265
+	}
266 266
 
267 267
 
268 268
 
269
-    /**
270
-     * Gets the total number of tickets available at a particular datetime (does
271
-     * NOT take int account the datetime's spaces available)
272
-     *
273
-     * @param int   $DTT_ID
274
-     * @param array $query_params
275
-     * @return int
276
-     */
277
-    public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array())
278
-    {
279
-        return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
280
-    }
269
+	/**
270
+	 * Gets the total number of tickets available at a particular datetime (does
271
+	 * NOT take int account the datetime's spaces available)
272
+	 *
273
+	 * @param int   $DTT_ID
274
+	 * @param array $query_params
275
+	 * @return int
276
+	 */
277
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array())
278
+	{
279
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
280
+	}
281 281
 
282 282
 
283 283
 
284
-    /**
285
-     * Updates the TKT_sold quantity on all the tickets matching $query_params
286
-     *
287
-     * @param EE_Ticket[] $tickets
288
-     * @return void
289
-     * @throws EE_Error
290
-     */
291
-    public function update_tickets_sold($tickets)
292
-    {
293
-        foreach ($tickets as $ticket) {
294
-            /* @var  $ticket EE_Ticket */
295
-            $ticket->update_tickets_sold();
296
-        }
297
-    }
284
+	/**
285
+	 * Updates the TKT_sold quantity on all the tickets matching $query_params
286
+	 *
287
+	 * @param EE_Ticket[] $tickets
288
+	 * @return void
289
+	 * @throws EE_Error
290
+	 */
291
+	public function update_tickets_sold($tickets)
292
+	{
293
+		foreach ($tickets as $ticket) {
294
+			/* @var  $ticket EE_Ticket */
295
+			$ticket->update_tickets_sold();
296
+		}
297
+	}
298 298
 
299 299
 
300 300
 
301
-    /**
302
-     * returns an array of EE_Ticket objects with a non-zero value for TKT_reserved
303
-     *
304
-     * @return EE_Base_Class[]|EE_Ticket[]
305
-     * @throws EE_Error
306
-     */
307
-    public function get_tickets_with_reservations()
308
-    {
309
-        return $this->get_all(
310
-            array(
311
-                array(
312
-                    'TKT_reserved' => array('>', 0),
313
-                ),
314
-            )
315
-        );
316
-    }
301
+	/**
302
+	 * returns an array of EE_Ticket objects with a non-zero value for TKT_reserved
303
+	 *
304
+	 * @return EE_Base_Class[]|EE_Ticket[]
305
+	 * @throws EE_Error
306
+	 */
307
+	public function get_tickets_with_reservations()
308
+	{
309
+		return $this->get_all(
310
+			array(
311
+				array(
312
+					'TKT_reserved' => array('>', 0),
313
+				),
314
+			)
315
+		);
316
+	}
317 317
 
318 318
 
319 319
 
320
-    /**
321
-     * returns an array of EE_Ticket objects matching the supplied list of IDs
322
-     *
323
-     * @param array $ticket_IDs
324
-     * @return EE_Base_Class[]|EE_Ticket[]
325
-     * @throws EE_Error
326
-     */
327
-    public function get_tickets_with_IDs(array $ticket_IDs)
328
-    {
329
-        return $this->get_all(
330
-            array(
331
-                array(
332
-                    'TKT_ID' => array('IN', $ticket_IDs)
333
-                )
334
-            )
335
-        );
336
-    }
320
+	/**
321
+	 * returns an array of EE_Ticket objects matching the supplied list of IDs
322
+	 *
323
+	 * @param array $ticket_IDs
324
+	 * @return EE_Base_Class[]|EE_Ticket[]
325
+	 * @throws EE_Error
326
+	 */
327
+	public function get_tickets_with_IDs(array $ticket_IDs)
328
+	{
329
+		return $this->get_all(
330
+			array(
331
+				array(
332
+					'TKT_ID' => array('IN', $ticket_IDs)
333
+				)
334
+			)
335
+		);
336
+	}
337 337
 
338 338
 
339 339
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
4 4
 
5
-require_once(EE_MODELS . 'EEM_Soft_Delete_Base.model.php');
6
-require_once(EE_CLASSES . 'EE_Ticket.class.php');
5
+require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php');
6
+require_once(EE_CLASSES.'EE_Ticket.class.php');
7 7
 /**
8 8
  * Ticket Model
9 9
  *
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
         foreach ($tickets as $ticket) {
250 250
             $ticket->set(
251 251
                 'TKT_start_date',
252
-                (int)$this->current_time_for_query('TKT_start_date', true)
252
+                (int) $this->current_time_for_query('TKT_start_date', true)
253 253
             );
254 254
             $ticket->set('TKT_end_date',
255
-                (int)$this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS
255
+                (int) $this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS
256 256
             );
257 257
             $ticket->set_end_time($this->convert_datetime_for_query(
258 258
                 'TKT_end_date',
Please login to merge, or discard this patch.
shortcodes/espresso_events/EES_Espresso_Events.shortcode.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             $default_espresso_events_shortcode_atts
102 102
         );
103 103
         // grab attributes and merge with defaults, then extract
104
-        $attributes = array_merge((array)$default_espresso_events_shortcode_atts, (array)$attributes);
104
+        $attributes = array_merge((array) $default_espresso_events_shortcode_atts, (array) $attributes);
105 105
         $attributes = \EES_Shortcode::sanitize_attributes(
106 106
             $attributes,
107 107
             // the following get sanitized/whitelisted in EEH_Event_Query
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     {
186 186
         // incoming args could be a mix of WP query args + EE shortcode args
187 187
         foreach ($args as $key => $value) {
188
-            $property = '_' . $key;
188
+            $property = '_'.$key;
189 189
             // if the arg is a property of this class, then it's an EE shortcode arg
190 190
             if (property_exists($this, $property)) {
191 191
                 // set the property value
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
      */
246 246
     public function event_list_title($event_list_title = '')
247 247
     {
248
-        if (! empty($this->_title)) {
248
+        if ( ! empty($this->_title)) {
249 249
             return $this->_title;
250 250
         }
251 251
         return $event_list_title;
Please login to merge, or discard this patch.
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -15,131 +15,131 @@  discard block
 block discarded – undo
15 15
 class EES_Espresso_Events extends EES_Shortcode
16 16
 {
17 17
 
18
-    /**
19
-     *    set_hooks - for hooking into EE Core, modules, etc
20
-     *
21
-     * @access    public
22
-     * @return    void
23
-     */
24
-    public static function set_hooks()
25
-    {
26
-    }
27
-
28
-
29
-
30
-    /**
31
-     *    set_hooks_admin - for hooking into EE Admin Core, modules, etc
32
-     *
33
-     * @access    public
34
-     * @return    void
35
-     */
36
-    public static function set_hooks_admin()
37
-    {
38
-    }
39
-
40
-
41
-
42
-    /**
43
-     *    run - initial module setup
44
-     *
45
-     * @access    public
46
-     * @param WP $WP
47
-     * @return    void
48
-     */
49
-    public function run(WP $WP)
50
-    {
51
-        if (did_action('pre_get_posts') && did_action('send_headers')) {
52
-            EED_Events_Archive::instance()->event_list();
53
-        } else {
54
-            // this will trigger the EED_Events_Archive module's event_list() method
55
-            // during the pre_get_posts hook point, this allows us to initialize things, enqueue assets, etc,
56
-            // as well, this saves an instantiation of the module in an array
57
-            // using 'espresso_events' as the key, so that we can retrieve it
58
-            add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list'));
59
-        }
60
-    }
61
-
62
-
63
-
64
-    /**
65
-     *    process_shortcode - ESPRESSO_EVENTS - Returns a list of events
66
-     *    [ESPRESSO_EVENTS]
67
-     *    [ESPRESSO_EVENTS title="My Super Event"]
68
-     *    [ESPRESSO_EVENTS limit=5]
69
-     *    [ESPRESSO_EVENTS css_class="my-custom-class"]
70
-     *    [ESPRESSO_EVENTS month="April 2014"]
71
-     *    [ESPRESSO_EVENTS show_expired=true]
72
-     *    [ESPRESSO_EVENTS category_slug="free-events"]
73
-     *    [ESPRESSO_EVENTS order_by="start_date,id"]
74
-     *    [ESPRESSO_EVENTS sort="ASC"]
75
-     *    [ESPRESSO_EVENTS show_title=true]
76
-     *
77
-     * @access    public
78
-     * @param    array $attributes
79
-     * @return    string
80
-     */
81
-    public function process_shortcode($attributes = array())
82
-    {
83
-        // make sure EED_Events_Archive is setup properly
84
-        if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', false)) {
85
-            EED_Events_Archive::instance()->event_list();
86
-        }
87
-        //set default attributes
88
-        $default_espresso_events_shortcode_atts = array(
89
-            'title'                        => null,
90
-            'limit'                        => 10,
91
-            'css_class'                    => null,
92
-            'show_expired'                 => false,
93
-            'month'                        => null,
94
-            'category_slug'                => null,
95
-            'order_by'                     => 'start_date',
96
-            'sort'                         => 'ASC',
97
-            'show_title'                   => true,
98
-            'fallback_shortcode_processor' => false,
99
-        );
100
-        // allow the defaults to be filtered
101
-        $default_espresso_events_shortcode_atts = apply_filters(
102
-            'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts',
103
-            $default_espresso_events_shortcode_atts
104
-        );
105
-        // grab attributes and merge with defaults, then extract
106
-        $attributes = array_merge((array)$default_espresso_events_shortcode_atts, (array)$attributes);
107
-        $attributes = \EES_Shortcode::sanitize_attributes(
108
-            $attributes,
109
-            // the following get sanitized/whitelisted in EEH_Event_Query
110
-            array(
111
-                'category_slug' => 'skip_sanitization',
112
-                'show_expired'  => 'skip_sanitization',
113
-                'order_by'      => 'skip_sanitization',
114
-                'month'         => 'skip_sanitization',
115
-                'sort'          => 'skip_sanitization',
116
-            )
117
-        );
118
-        // make sure we use the_excerpt()
119
-        add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true');
120
-        // apply query filters
121
-        add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true');
122
-        // run the query
123
-        global $wp_query;
124
-        $wp_query = new EE_Event_List_Query($attributes);
125
-        // check what template is loaded and load filters accordingly
126
-        EED_Events_Archive::instance()->template_include('loop-espresso_events.php');
127
-        // load our template
128
-        $event_list = EEH_Template::locate_template(
129
-            'loop-espresso_events.php',
130
-            array(),
131
-            true,
132
-            true
133
-        );
134
-        // now reset the query and postdata
135
-        wp_reset_query();
136
-        wp_reset_postdata();
137
-        EED_Events_Archive::remove_all_events_archive_filters();
138
-        // remove query filters
139
-        remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true');
140
-        // pull our content from the output buffer and return it
141
-        return $event_list;
142
-    }
18
+	/**
19
+	 *    set_hooks - for hooking into EE Core, modules, etc
20
+	 *
21
+	 * @access    public
22
+	 * @return    void
23
+	 */
24
+	public static function set_hooks()
25
+	{
26
+	}
27
+
28
+
29
+
30
+	/**
31
+	 *    set_hooks_admin - for hooking into EE Admin Core, modules, etc
32
+	 *
33
+	 * @access    public
34
+	 * @return    void
35
+	 */
36
+	public static function set_hooks_admin()
37
+	{
38
+	}
39
+
40
+
41
+
42
+	/**
43
+	 *    run - initial module setup
44
+	 *
45
+	 * @access    public
46
+	 * @param WP $WP
47
+	 * @return    void
48
+	 */
49
+	public function run(WP $WP)
50
+	{
51
+		if (did_action('pre_get_posts') && did_action('send_headers')) {
52
+			EED_Events_Archive::instance()->event_list();
53
+		} else {
54
+			// this will trigger the EED_Events_Archive module's event_list() method
55
+			// during the pre_get_posts hook point, this allows us to initialize things, enqueue assets, etc,
56
+			// as well, this saves an instantiation of the module in an array
57
+			// using 'espresso_events' as the key, so that we can retrieve it
58
+			add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list'));
59
+		}
60
+	}
61
+
62
+
63
+
64
+	/**
65
+	 *    process_shortcode - ESPRESSO_EVENTS - Returns a list of events
66
+	 *    [ESPRESSO_EVENTS]
67
+	 *    [ESPRESSO_EVENTS title="My Super Event"]
68
+	 *    [ESPRESSO_EVENTS limit=5]
69
+	 *    [ESPRESSO_EVENTS css_class="my-custom-class"]
70
+	 *    [ESPRESSO_EVENTS month="April 2014"]
71
+	 *    [ESPRESSO_EVENTS show_expired=true]
72
+	 *    [ESPRESSO_EVENTS category_slug="free-events"]
73
+	 *    [ESPRESSO_EVENTS order_by="start_date,id"]
74
+	 *    [ESPRESSO_EVENTS sort="ASC"]
75
+	 *    [ESPRESSO_EVENTS show_title=true]
76
+	 *
77
+	 * @access    public
78
+	 * @param    array $attributes
79
+	 * @return    string
80
+	 */
81
+	public function process_shortcode($attributes = array())
82
+	{
83
+		// make sure EED_Events_Archive is setup properly
84
+		if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', false)) {
85
+			EED_Events_Archive::instance()->event_list();
86
+		}
87
+		//set default attributes
88
+		$default_espresso_events_shortcode_atts = array(
89
+			'title'                        => null,
90
+			'limit'                        => 10,
91
+			'css_class'                    => null,
92
+			'show_expired'                 => false,
93
+			'month'                        => null,
94
+			'category_slug'                => null,
95
+			'order_by'                     => 'start_date',
96
+			'sort'                         => 'ASC',
97
+			'show_title'                   => true,
98
+			'fallback_shortcode_processor' => false,
99
+		);
100
+		// allow the defaults to be filtered
101
+		$default_espresso_events_shortcode_atts = apply_filters(
102
+			'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts',
103
+			$default_espresso_events_shortcode_atts
104
+		);
105
+		// grab attributes and merge with defaults, then extract
106
+		$attributes = array_merge((array)$default_espresso_events_shortcode_atts, (array)$attributes);
107
+		$attributes = \EES_Shortcode::sanitize_attributes(
108
+			$attributes,
109
+			// the following get sanitized/whitelisted in EEH_Event_Query
110
+			array(
111
+				'category_slug' => 'skip_sanitization',
112
+				'show_expired'  => 'skip_sanitization',
113
+				'order_by'      => 'skip_sanitization',
114
+				'month'         => 'skip_sanitization',
115
+				'sort'          => 'skip_sanitization',
116
+			)
117
+		);
118
+		// make sure we use the_excerpt()
119
+		add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true');
120
+		// apply query filters
121
+		add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true');
122
+		// run the query
123
+		global $wp_query;
124
+		$wp_query = new EE_Event_List_Query($attributes);
125
+		// check what template is loaded and load filters accordingly
126
+		EED_Events_Archive::instance()->template_include('loop-espresso_events.php');
127
+		// load our template
128
+		$event_list = EEH_Template::locate_template(
129
+			'loop-espresso_events.php',
130
+			array(),
131
+			true,
132
+			true
133
+		);
134
+		// now reset the query and postdata
135
+		wp_reset_query();
136
+		wp_reset_postdata();
137
+		EED_Events_Archive::remove_all_events_archive_filters();
138
+		// remove query filters
139
+		remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true');
140
+		// pull our content from the output buffer and return it
141
+		return $event_list;
142
+	}
143 143
 
144 144
 
145 145
 
@@ -159,141 +159,141 @@  discard block
 block discarded – undo
159 159
 class EE_Event_List_Query extends WP_Query
160 160
 {
161 161
 
162
-    private $_title         = null;
163
-
164
-    private $_limit         = 10;
165
-
166
-    private $_css_class     = null;
167
-
168
-    private $_show_expired  = false;
169
-
170
-    private $_month         = null;
171
-
172
-    private $_category_slug = null;
173
-
174
-    private $_order_by      = null;
175
-
176
-    private $_sort          = null;
177
-
178
-    private $_show_title    = true;
179
-
180
-
181
-
182
-    /**
183
-     * EE_Event_List_Query Constructor     *
184
-     * sets up a WordPress query
185
-     *
186
-     * @param array $args
187
-     */
188
-    public function __construct($args = array())
189
-    {
190
-        // incoming args could be a mix of WP query args + EE shortcode args
191
-        foreach ($args as $key => $value) {
192
-            $property = '_' . $key;
193
-            // if the arg is a property of this class, then it's an EE shortcode arg
194
-            if (property_exists($this, $property)) {
195
-                // set the property value
196
-                $this->{$property} = $value;
197
-                // then remove it from the array of args that will later be passed to WP_Query()
198
-                unset($args[$key]);
199
-            }
200
-        }
201
-        //add query filters
202
-        EEH_Event_Query::add_query_filters();
203
-        // set params that will get used by the filters
204
-        EEH_Event_Query::set_query_params(
205
-            $this->_month,
206
-            $this->_category_slug,
207
-            $this->_show_expired,
208
-            $this->_order_by,
209
-            $this->_sort
210
-        );
211
-        // first off, let's remove any filters from previous queries
212
-        remove_filter(
213
-            'FHEE__archive_espresso_events_template__show_header',
214
-            array($this, 'show_event_list_title')
215
-        );
216
-        remove_filter(
217
-            'FHEE__archive_espresso_events_template__upcoming_events_h1',
218
-            array($this, 'event_list_title')
219
-        );
220
-        remove_all_filters('FHEE__content_espresso_events__event_class');
221
-        // Event List Title ?
222
-        add_filter(
223
-            'FHEE__archive_espresso_events_template__show_header',
224
-            array($this, 'show_event_list_title')
225
-        );
226
-        add_filter(
227
-            'FHEE__archive_espresso_events_template__upcoming_events_h1',
228
-            array($this, 'event_list_title')
229
-        );
230
-        // add the css class
231
-        add_filter(
232
-            'FHEE__content_espresso_events__event_class',
233
-            array($this, 'event_list_css')
234
-        );
235
-        // the current "page" we are viewing
236
-        $paged = max(1, get_query_var('paged'));
237
-        // Force these args
238
-        $args = array_merge($args, array(
239
-            'post_type'              => 'espresso_events',
240
-            'posts_per_page'         => $this->_limit,
241
-            'update_post_term_cache' => false,
242
-            'update_post_meta_cache' => false,
243
-            'paged'                  => $paged,
244
-            'offset'                 => ($paged - 1) * $this->_limit,
245
-        ));
246
-        // run the query
247
-        parent::__construct($args);
248
-    }
249
-
250
-
251
-
252
-    /**
253
-     * event_list_title
254
-     *
255
-     * @param string $event_list_title
256
-     * @return string
257
-     */
258
-    public function event_list_title($event_list_title = '')
259
-    {
260
-        if (! empty($this->_title)) {
261
-            return $this->_title;
262
-        }
263
-        return $event_list_title;
264
-    }
265
-
266
-
267
-
268
-    /**
269
-     * show_event_list_title
270
-     *
271
-     * @param bool $show_title
272
-     * @return boolean
273
-     */
274
-    public function show_event_list_title($show_title = true)
275
-    {
276
-        return filter_var(
277
-            $this->_show_title,
278
-            FILTER_VALIDATE_BOOLEAN
279
-        );
280
-    }
281
-
282
-
283
-
284
-    /**
285
-     * event_list_css
286
-     *
287
-     * @param string $event_list_css
288
-     * @return string
289
-     */
290
-    public function event_list_css($event_list_css = '')
291
-    {
292
-        $event_list_css .= ! empty($event_list_css) ? ' ' : '';
293
-        $event_list_css .= ! empty($this->_css_class) ? $this->_css_class : '';
294
-        $event_list_css .= ! empty($event_list_css) ? ' ' : '';
295
-        $event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : '';
296
-        return $event_list_css;
297
-    }
162
+	private $_title         = null;
163
+
164
+	private $_limit         = 10;
165
+
166
+	private $_css_class     = null;
167
+
168
+	private $_show_expired  = false;
169
+
170
+	private $_month         = null;
171
+
172
+	private $_category_slug = null;
173
+
174
+	private $_order_by      = null;
175
+
176
+	private $_sort          = null;
177
+
178
+	private $_show_title    = true;
179
+
180
+
181
+
182
+	/**
183
+	 * EE_Event_List_Query Constructor     *
184
+	 * sets up a WordPress query
185
+	 *
186
+	 * @param array $args
187
+	 */
188
+	public function __construct($args = array())
189
+	{
190
+		// incoming args could be a mix of WP query args + EE shortcode args
191
+		foreach ($args as $key => $value) {
192
+			$property = '_' . $key;
193
+			// if the arg is a property of this class, then it's an EE shortcode arg
194
+			if (property_exists($this, $property)) {
195
+				// set the property value
196
+				$this->{$property} = $value;
197
+				// then remove it from the array of args that will later be passed to WP_Query()
198
+				unset($args[$key]);
199
+			}
200
+		}
201
+		//add query filters
202
+		EEH_Event_Query::add_query_filters();
203
+		// set params that will get used by the filters
204
+		EEH_Event_Query::set_query_params(
205
+			$this->_month,
206
+			$this->_category_slug,
207
+			$this->_show_expired,
208
+			$this->_order_by,
209
+			$this->_sort
210
+		);
211
+		// first off, let's remove any filters from previous queries
212
+		remove_filter(
213
+			'FHEE__archive_espresso_events_template__show_header',
214
+			array($this, 'show_event_list_title')
215
+		);
216
+		remove_filter(
217
+			'FHEE__archive_espresso_events_template__upcoming_events_h1',
218
+			array($this, 'event_list_title')
219
+		);
220
+		remove_all_filters('FHEE__content_espresso_events__event_class');
221
+		// Event List Title ?
222
+		add_filter(
223
+			'FHEE__archive_espresso_events_template__show_header',
224
+			array($this, 'show_event_list_title')
225
+		);
226
+		add_filter(
227
+			'FHEE__archive_espresso_events_template__upcoming_events_h1',
228
+			array($this, 'event_list_title')
229
+		);
230
+		// add the css class
231
+		add_filter(
232
+			'FHEE__content_espresso_events__event_class',
233
+			array($this, 'event_list_css')
234
+		);
235
+		// the current "page" we are viewing
236
+		$paged = max(1, get_query_var('paged'));
237
+		// Force these args
238
+		$args = array_merge($args, array(
239
+			'post_type'              => 'espresso_events',
240
+			'posts_per_page'         => $this->_limit,
241
+			'update_post_term_cache' => false,
242
+			'update_post_meta_cache' => false,
243
+			'paged'                  => $paged,
244
+			'offset'                 => ($paged - 1) * $this->_limit,
245
+		));
246
+		// run the query
247
+		parent::__construct($args);
248
+	}
249
+
250
+
251
+
252
+	/**
253
+	 * event_list_title
254
+	 *
255
+	 * @param string $event_list_title
256
+	 * @return string
257
+	 */
258
+	public function event_list_title($event_list_title = '')
259
+	{
260
+		if (! empty($this->_title)) {
261
+			return $this->_title;
262
+		}
263
+		return $event_list_title;
264
+	}
265
+
266
+
267
+
268
+	/**
269
+	 * show_event_list_title
270
+	 *
271
+	 * @param bool $show_title
272
+	 * @return boolean
273
+	 */
274
+	public function show_event_list_title($show_title = true)
275
+	{
276
+		return filter_var(
277
+			$this->_show_title,
278
+			FILTER_VALIDATE_BOOLEAN
279
+		);
280
+	}
281
+
282
+
283
+
284
+	/**
285
+	 * event_list_css
286
+	 *
287
+	 * @param string $event_list_css
288
+	 * @return string
289
+	 */
290
+	public function event_list_css($event_list_css = '')
291
+	{
292
+		$event_list_css .= ! empty($event_list_css) ? ' ' : '';
293
+		$event_list_css .= ! empty($this->_css_class) ? $this->_css_class : '';
294
+		$event_list_css .= ! empty($event_list_css) ? ' ' : '';
295
+		$event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : '';
296
+		return $event_list_css;
297
+	}
298 298
 
299 299
 }
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/loop-espresso_events.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -11,48 +11,48 @@
 block discarded – undo
11 11
  * @version     4+
12 12
  */
13 13
 if (have_posts()) :
14
-    if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?>
14
+	if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?>
15 15
         <header class="page-header">
16 16
             <h1 class="page-title">
17 17
                 <?php
18
-                if (is_day()) :
19
-                    printf(__('Today\'s Events: %s', 'event_espresso'), get_the_date());
20
-                elseif (is_month()) :
21
-                    printf(
22
-                        __('Events This Month: %s', 'event_espresso'),
23
-                        get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso'))
24
-                    );
25
-                elseif (is_year()) :
26
-                    printf(
27
-                        __('Events This Year: %s', 'event_espresso'),
28
-                        get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))
29
-                    );
30
-                else :
31
-                    echo apply_filters(
32
-                        'FHEE__archive_espresso_events_template__upcoming_events_h1',
33
-                        __('Upcoming Events', 'event_espresso')
34
-                    );
35
-                endif;
36
-                ?>
18
+				if (is_day()) :
19
+					printf(__('Today\'s Events: %s', 'event_espresso'), get_the_date());
20
+				elseif (is_month()) :
21
+					printf(
22
+						__('Events This Month: %s', 'event_espresso'),
23
+						get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso'))
24
+					);
25
+				elseif (is_year()) :
26
+					printf(
27
+						__('Events This Year: %s', 'event_espresso'),
28
+						get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))
29
+					);
30
+				else :
31
+					echo apply_filters(
32
+						'FHEE__archive_espresso_events_template__upcoming_events_h1',
33
+						__('Upcoming Events', 'event_espresso')
34
+					);
35
+				endif;
36
+				?>
37 37
             </h1>
38 38
 
39 39
         </header><!-- .page-header -->
40 40
 
41 41
         <?php
42
-    endif;
43
-    // allow other stuff
44
-    do_action('AHEE__archive_espresso_events_template__before_loop');
45
-    // Start the Loop.
46
-    while (have_posts()) : the_post();
47
-        // Include the post TYPE-specific template for the content.
48
-        espresso_get_template_part('content', 'espresso_events-shortcode');
49
-    endwhile;
50
-    // Previous/next page navigation.
51
-    espresso_pagination();
52
-    // allow moar other stuff
53
-    do_action('AHEE__archive_espresso_events_template__after_loop');
42
+	endif;
43
+	// allow other stuff
44
+	do_action('AHEE__archive_espresso_events_template__before_loop');
45
+	// Start the Loop.
46
+	while (have_posts()) : the_post();
47
+		// Include the post TYPE-specific template for the content.
48
+		espresso_get_template_part('content', 'espresso_events-shortcode');
49
+	endwhile;
50
+	// Previous/next page navigation.
51
+	espresso_pagination();
52
+	// allow moar other stuff
53
+	do_action('AHEE__archive_espresso_events_template__after_loop');
54 54
 else :
55
-    // If no content, include the "No posts found" template.
56
-    espresso_get_template_part('content', 'none');
55
+	// If no content, include the "No posts found" template.
56
+	espresso_get_template_part('content', 'none');
57 57
 endif;
58 58
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,11 +27,13 @@  discard block
 block discarded – undo
27 27
                         __('Events This Year: %s', 'event_espresso'),
28 28
                         get_the_date(_x('Y', 'yearly archives date format', 'event_espresso'))
29 29
                     );
30
-                else :
30
+                else {
31
+                	:
31 32
                     echo apply_filters(
32 33
                         'FHEE__archive_espresso_events_template__upcoming_events_h1',
33 34
                         __('Upcoming Events', 'event_espresso')
34 35
                     );
36
+                }
35 37
                 endif;
36 38
                 ?>
37 39
             </h1>
@@ -51,8 +53,10 @@  discard block
 block discarded – undo
51 53
     espresso_pagination();
52 54
     // allow moar other stuff
53 55
     do_action('AHEE__archive_espresso_events_template__after_loop');
54
-else :
56
+else {
57
+	:
55 58
     // If no content, include the "No posts found" template.
56 59
     espresso_get_template_part('content', 'none');
60
+}
57 61
 endif;
58 62
 
Please login to merge, or discard this patch.
templates/support_admin_details_shortcodes_event_listings.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<p>
3
-        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf( esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>' ); ?>
3
+        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf(esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>'); ?>
4 4
     </p>
5 5
 		<ul>
6 6
 			<li><strong><?php esc_html_e('Show a list of all of your events', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS]</li>
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 			<li><strong><?php esc_html_e('Don\'t display a title/heading before the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS show_title=false]</li>
9 9
 			<li><strong><?php esc_html_e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit=5]</li>
10 10
 			<li><strong><?php esc_html_e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class=my-custom-class]</li>
11
-			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li>
11
+			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li>
12 12
 			<li><strong><?php esc_html_e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired=true]</li>
13 13
 			<li><strong><?php esc_html_e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=ASC]</li>
14 14
 			<li><strong><?php esc_html_e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=DESC]</li>
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.39.rc.017');
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.39.rc.017');
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
 }
283 283
\ No newline at end of file
Please login to merge, or discard this patch.