Completed
Branch BETA-4.9-message-activity (003a46)
by
unknown
16:41
created
core/EE_Payment_Processor.core.php 3 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 		EE_Processor_Base::set_IPN( $separate_IPN_request );
149 149
 		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
150 150
 			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
151
-		}elseif( $payment_method instanceof EE_Payment ){
151
+		} elseif( $payment_method instanceof EE_Payment ){
152 152
 			$obj_for_log = $payment_method;
153
-		}elseif( $transaction instanceof EE_Transaction ){
153
+		} elseif( $transaction instanceof EE_Transaction ){
154 154
 			$obj_for_log = $transaction;
155
-		}else{
155
+		} else{
156 156
 			$obj_for_log = null;
157 157
 		}
158 158
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 						__FILE__, __FUNCTION__, __LINE__
181 181
 					);
182 182
 				}
183
-			}else{
183
+			} else{
184 184
 				//that's actually pretty ok. The IPN just wasn't able
185 185
 				//to identify which transaction or payment method this was for
186 186
 				// give all active payment methods a chance to claim it
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 				$payment->save();
202 202
 				//  update the TXN
203 203
 				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
204
-			}else{
204
+			} else{
205 205
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
206 206
 				if($payment_method){
207 207
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
208
-				}elseif($transaction){
208
+				} elseif($transaction){
209 209
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
210 210
 				}
211 211
 			}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			foreach( $request_data as $key => $value ) {
237 237
 				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
238 238
 			}
239
-		}else{
239
+		} else{
240 240
 			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
241 241
 		}
242 242
 		return $return_data;
Please login to merge, or discard this patch.
Indentation   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
 EE_Registry::instance()->load_class( 'Processor_Base' );
3 3
 /**
4
- *
5
- * EE_Payment_Processor
6
- *
7
- * Class for handling processing of payments for transactions.
8
- *
9
- * @package			Event Espresso
10
- * @subpackage		core/libraries/payment_methods
11
- * @author			Mike Nelson
12
- *
13
- */
4
+	 *
5
+	 * EE_Payment_Processor
6
+	 *
7
+	 * Class for handling processing of payments for transactions.
8
+	 *
9
+	 * @package			Event Espresso
10
+	 * @subpackage		core/libraries/payment_methods
11
+	 * @author			Mike Nelson
12
+	 *
13
+	 */
14 14
 class EE_Payment_Processor extends EE_Processor_Base {
15 15
 	/**
16
-     * 	@var EE_Payment_Processor $_instance
16
+	 * 	@var EE_Payment_Processor $_instance
17 17
 	 * 	@access 	private
18
-     */
18
+	 */
19 19
 	private static $_instance = NULL;
20 20
 
21 21
 
@@ -48,9 +48,8 @@  discard block
 block discarded – undo
48 48
 
49 49
 
50 50
 	/**
51
-
52 51
 	 * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately.
53
- 	 * Saves the payment that is generated
52
+	 * Saves the payment that is generated
54 53
 	 *
55 54
 	 * @param EE_Payment_Method 	$payment_method
56 55
 	 * @param EE_Transaction 				$transaction
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2
-EE_Registry::instance()->load_class( 'Processor_Base' );
2
+EE_Registry::instance()->load_class('Processor_Base');
3 3
 /**
4 4
  *
5 5
  * EE_Payment_Processor
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function instance() {
29 29
 		// check if class object is instantiated
30
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
30
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
31 31
 			self::$_instance = new self();
32 32
 		}
33 33
 		return self::$_instance;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 *@return EE_Payment_Processor
43 43
 	 */
44 44
 	private function __construct() {
45
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
45
+		do_action('AHEE__EE_Payment_Processor__construct');
46 46
 	}
47 47
 
48 48
 
@@ -64,42 +64,42 @@  discard block
 block discarded – undo
64 64
 	 * @param string 	       						$cancel_url 	URL to return to if off-site payments are cancelled
65 65
 	 * @return EE_Payment
66 66
 	 */
67
-	public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) {
68
-		if( $amount < 0 ) {
67
+	public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') {
68
+		if ($amount < 0) {
69 69
 			throw new EE_Error( 
70 70
 					sprintf(
71
-							__( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ),
71
+							__('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'),
72 72
 							$amount,
73 73
 							$transaction->ID() ) );
74 74
 		}
75 75
 		// verify payment method
76
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
76
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
77 77
 		// verify transaction
78
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
79
-		$transaction->set_payment_method_ID( $payment_method->ID() );
78
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
79
+		$transaction->set_payment_method_ID($payment_method->ID());
80 80
 		// verify payment method type
81
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ){
81
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
82 82
 			$payment = $payment_method->type_obj()->process_payment(
83 83
 				$transaction,
84
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
84
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
85 85
 				$billing_form,
86 86
 				$return_url,
87
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
87
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
88 88
 				$method,
89 89
 				$by_admin
90 90
 			);
91 91
 			// check if payment method uses an off-site gateway
92
-			if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) {
92
+			if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) {
93 93
 				// don't process payments for off-site gateways yet because no payment has occurred yet
94
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
94
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
95 95
 			}
96 96
 			return $payment;
97 97
 		} else {
98 98
 			EE_Error::add_error(
99 99
 				sprintf(
100
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
100
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
101 101
 					'<br/>',
102
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
102
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
103 103
 				), __FILE__, __FUNCTION__, __LINE__
104 104
 			);
105 105
 			return NULL;
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	 * @throws EE_Error
116 116
 	 * @return string
117 117
 	 */
118
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
118
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
119 119
 		/** @type EE_Transaction $transaction */
120
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
120
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
121 121
 		$primary_reg = $transaction->primary_registration();
122
-		if( ! $primary_reg instanceof EE_Registration ){
123
-			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID()));
122
+		if ( ! $primary_reg instanceof EE_Registration) {
123
+			throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID()));
124 124
 		}
125
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
125
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
126 126
 		$url = add_query_arg(
127 127
 			array(
128 128
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -149,81 +149,81 @@  discard block
 block discarded – undo
149 149
 	 * @throws Exception
150 150
 	 * @return EE_Payment
151 151
 	 */
152
-	public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){
153
-		$_req_data = $this->_remove_unusable_characters( $_req_data );
154
-		EE_Registry::instance()->load_model( 'Change_Log' );
155
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
156
-		if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){
157
-			$obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) );
158
-		}elseif( $payment_method instanceof EE_Payment ){
152
+	public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) {
153
+		$_req_data = $this->_remove_unusable_characters($_req_data);
154
+		EE_Registry::instance()->load_model('Change_Log');
155
+		EE_Processor_Base::set_IPN($separate_IPN_request);
156
+		if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) {
157
+			$obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc')));
158
+		}elseif ($payment_method instanceof EE_Payment) {
159 159
 			$obj_for_log = $payment_method;
160
-		}elseif( $transaction instanceof EE_Transaction ){
160
+		}elseif ($transaction instanceof EE_Transaction) {
161 161
 			$obj_for_log = $transaction;
162
-		}else{
162
+		} else {
163 163
 			$obj_for_log = null;
164 164
 		}
165 165
 		$log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log);
166
-		try{
166
+		try {
167 167
 			/**
168 168
 			 * @var EE_Payment $payment
169 169
 			 */
170 170
 			$payment = NULL;
171
-			if($transaction && $payment_method){
171
+			if ($transaction && $payment_method) {
172 172
 				/** @type EE_Transaction $transaction */
173 173
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
174 174
 				/** @type EE_Payment_Method $payment_method */
175 175
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
176
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
177
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
176
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
177
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
178 178
 						$log->set_object($payment);
179 179
 				} else {
180 180
 					// not a payment
181 181
 					EE_Error::add_error(
182 182
 						sprintf(
183
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
183
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
184 184
 							'<br/>',
185
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
185
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
186 186
 						),
187 187
 						__FILE__, __FUNCTION__, __LINE__
188 188
 					);
189 189
 				}
190
-			}else{
190
+			} else {
191 191
 				//that's actually pretty ok. The IPN just wasn't able
192 192
 				//to identify which transaction or payment method this was for
193 193
 				// give all active payment methods a chance to claim it
194 194
 				$active_pms = EEM_Payment_Method::instance()->get_all_active();
195
-				foreach( $active_pms as $payment_method ){
196
-					try{
197
-						$payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
195
+				foreach ($active_pms as $payment_method) {
196
+					try {
197
+						$payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
198 198
 						EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment);
199 199
 						break;
200
-					} catch( EE_Error $e ) {
200
+					} catch (EE_Error $e) {
201 201
 						//that's fine- it apparently couldn't handle the IPN
202 202
 					}
203 203
 				}
204 204
 
205 205
 			}
206 206
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
207
-			if( $payment instanceof EE_Payment){
207
+			if ($payment instanceof EE_Payment) {
208 208
 				$payment->save();
209 209
 				//  update the TXN
210
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
211
-			}else{
210
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
211
+			} else {
212 212
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
213
-				if($payment_method){
213
+				if ($payment_method) {
214 214
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
215
-				}elseif($transaction){
215
+				}elseif ($transaction) {
216 216
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
217 217
 				}
218 218
 			}
219 219
 			return $payment;
220 220
 
221
-		} catch( EE_Error $e ) {
221
+		} catch (EE_Error $e) {
222 222
 			do_action(
223 223
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
224
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
225
-					print_r( $transaction, TRUE ),
226
-					print_r( $_req_data, TRUE ),
224
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
225
+					print_r($transaction, TRUE),
226
+					print_r($_req_data, TRUE),
227 227
 					$e->getMessage()
228 228
 				)
229 229
 			);
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
 	 * @param array $request_data
238 238
 	 * @return array|string
239 239
 	 */
240
-	protected function _remove_unusable_characters( $request_data ) {
241
-		if( is_array( $request_data ) ) {
240
+	protected function _remove_unusable_characters($request_data) {
241
+		if (is_array($request_data)) {
242 242
 			$return_data = array();
243
-			foreach( $request_data as $key => $value ) {
244
-				$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
243
+			foreach ($request_data as $key => $value) {
244
+				$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
245 245
 			}
246
-		}else{
247
-			$return_data =  preg_replace('/[^[:print:]]/', '', $request_data);
246
+		} else {
247
+			$return_data = preg_replace('/[^[:print:]]/', '', $request_data);
248 248
 		}
249 249
 		return $return_data;
250 250
 	}
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 	 * @return EE_Payment
267 267
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs
268 268
 	 */
269
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
269
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
270 270
 		/** @var $transaction EE_Transaction */
271
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
271
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
272 272
 		$last_payment_method = $transaction->payment_method();
273
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
274
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
275
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
273
+		if ($last_payment_method instanceof EE_Payment_Method) {
274
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
275
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
276 276
 			return $payment;
277 277
 		} else {
278 278
 			return NULL;
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @internal param float $amount
290 290
 	 * @return EE_Payment
291 291
 	 */
292
-	public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){
293
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
294
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
295
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
292
+	public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) {
293
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
294
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
295
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
296 296
 		}
297 297
 		return $payment_to_refund;
298 298
 	}
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 	 *                        TXN is locked before updating
335 335
 	 * @throws \EE_Error
336 336
 	 */
337
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
337
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
338 338
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
339 339
 		/** @type EE_Transaction $transaction */
340
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
340
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
341 341
 		// can we freely update the TXN at this moment?
342
-		if ( $IPN && $transaction->is_locked() ) {
342
+		if ($IPN && $transaction->is_locked()) {
343 343
 			// don't update the transaction at this exact moment
344 344
 			// because the TXN is active in another request
345 345
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -349,40 +349,40 @@  discard block
 block discarded – undo
349 349
 			);
350 350
 		} else {
351 351
 			// verify payment and that it has been saved
352
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
353
-				if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){
354
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
352
+			if ($payment instanceof EE_Payment && $payment->ID()) {
353
+				if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) {
354
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
355 355
 					// update TXN registrations with payment info
356
-					$this->process_registration_payments( $transaction, $payment );
356
+					$this->process_registration_payments($transaction, $payment);
357 357
 				}
358 358
 				$do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action;
359 359
 			} else {
360 360
 				// send out notifications
361
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
361
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
362 362
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
363 363
 			}
364 364
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
365 365
 			// so that we know whether the status has changed and notifications should be triggered
366
-			if ( $IPN ) {
366
+			if ($IPN) {
367 367
 				/** @type EE_Transaction_Processor $transaction_processor */
368
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
369
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
368
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
369
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
370 370
 			}
371
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
371
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
372 372
 				/** @type EE_Transaction_Payments $transaction_payments */
373
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
373
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
374 374
 				// set new value for total paid
375
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
375
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
376 376
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
377
-				if ( $update_txn ) {
378
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
377
+				if ($update_txn) {
378
+					$this->_post_payment_processing($transaction, $payment, $IPN);
379 379
 				}
380 380
 			}
381 381
 			// granular hook for others to use.
382
-			do_action( $do_action, $transaction, $payment );
383
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
382
+			do_action($do_action, $transaction, $payment);
383
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
384 384
 			//global hook for others to use.
385
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
385
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
386 386
 		}
387 387
 	}
388 388
 
@@ -396,25 +396,25 @@  discard block
 block discarded – undo
396 396
 	 * @param EE_Registration[] $registrations
397 397
 	 * @throws \EE_Error
398 398
 	 */
399
-	public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) {
399
+	public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) {
400 400
 		// only process if payment was successful
401
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
401
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
402 402
 			return;
403 403
 		}
404 404
 		//EEM_Registration::instance()->show_next_x_db_queries();
405
-		if ( empty( $registrations )) {
405
+		if (empty($registrations)) {
406 406
 			// find registrations with monies owing that can receive a payment
407
-			$registrations = $transaction->registrations( array(
407
+			$registrations = $transaction->registrations(array(
408 408
 				array(
409 409
 					// only these reg statuses can receive payments
410
-					'STS_ID'  => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
411
-					'REG_final_price'  => array( '!=', 0 ),
412
-					'REG_final_price*' => array( '!=', 'REG_paid', true ),
410
+					'STS_ID'  => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
411
+					'REG_final_price'  => array('!=', 0),
412
+					'REG_final_price*' => array('!=', 'REG_paid', true),
413 413
 				)
414
-			) );
414
+			));
415 415
 		}
416 416
 		// still nothing ??!??
417
-		if ( empty( $registrations )) {
417
+		if (empty($registrations)) {
418 418
 			return;
419 419
 		}
420 420
 		// todo: break out the following logic into a separate strategy class
@@ -426,28 +426,28 @@  discard block
 block discarded – undo
426 426
 
427 427
 		$refund = $payment->is_a_refund();
428 428
 		// how much is available to apply to registrations?
429
-		$available_payment_amount = abs( $payment->amount() );
430
-		foreach ( $registrations as $registration ) {
431
-			if ( $registration instanceof EE_Registration ) {
429
+		$available_payment_amount = abs($payment->amount());
430
+		foreach ($registrations as $registration) {
431
+			if ($registration instanceof EE_Registration) {
432 432
 				// nothing left?
433
-				if ( $available_payment_amount <= 0 ) {
433
+				if ($available_payment_amount <= 0) {
434 434
 					break;
435 435
 				}
436
-				if ( $refund ) {
437
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
436
+				if ($refund) {
437
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
438 438
 				} else {
439
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
439
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
440 440
 				}
441 441
 			}
442 442
 		}
443
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
443
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
444 444
 			EE_Error::add_attention(
445 445
 				sprintf(
446
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
447
-					EEH_Template::format_currency( $available_payment_amount ),
448
-					implode( ', ',  array_keys( $registrations ) ),
446
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
447
+					EEH_Template::format_currency($available_payment_amount),
448
+					implode(', ', array_keys($registrations)),
449 449
 					'<br/>',
450
-					EEH_Template::format_currency( $payment->amount() )
450
+					EEH_Template::format_currency($payment->amount())
451 451
 				),
452 452
 				__FILE__, __FUNCTION__, __LINE__
453 453
 			);
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 	 * @param float $available_payment_amount
465 465
 	 * @return float
466 466
 	 */
467
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
467
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
468 468
 		$owing = $registration->final_price() - $registration->paid();
469
-		if ( $owing > 0 ) {
469
+		if ($owing > 0) {
470 470
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
471
-			$payment_amount = min( $available_payment_amount, $owing );
471
+			$payment_amount = min($available_payment_amount, $owing);
472 472
 			// update $available_payment_amount
473 473
 			$available_payment_amount = $available_payment_amount - $payment_amount;
474 474
 			//calculate and set new REG_paid
475
-			$registration->set_paid( $registration->paid() + $payment_amount );
475
+			$registration->set_paid($registration->paid() + $payment_amount);
476 476
 			// now save it
477
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
477
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
478 478
 		}
479 479
 		return $available_payment_amount;
480 480
 	}
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 	 * @param float $payment_amount
490 490
 	 * @return float
491 491
 	 */
492
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
492
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
493 493
 		// find any existing reg payment records for this registration and payment
494 494
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
495
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
495
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
496 496
 		);
497 497
 		// if existing registration payment exists
498
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
498
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
499 499
 			// then update that record
500
-			$existing_reg_payment->set_amount( $payment_amount );
500
+			$existing_reg_payment->set_amount($payment_amount);
501 501
 			$existing_reg_payment->save();
502 502
 		} else {
503 503
 			// or add new relation between registration and payment and set amount
504
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
504
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
505 505
 			// make it stick
506 506
 			$registration->save();
507 507
 		}
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 	 * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER
518 518
 	 * @return float
519 519
 	 */
520
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
520
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
521 521
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
522
-		if ( $registration->paid() > 0 ) {
522
+		if ($registration->paid() > 0) {
523 523
 			// ensure $available_refund_amount is NOT negative
524
-			$available_refund_amount = abs( $available_refund_amount );
524
+			$available_refund_amount = abs($available_refund_amount);
525 525
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
526
-			$refund_amount = min( $available_refund_amount, $registration->paid() );
526
+			$refund_amount = min($available_refund_amount, $registration->paid());
527 527
 			// update $available_payment_amount
528 528
 			$available_refund_amount = $available_refund_amount - $refund_amount;
529 529
 			//calculate and set new REG_paid
530
-			$registration->set_paid( $registration->paid() - $refund_amount );
530
+			$registration->set_paid($registration->paid() - $refund_amount);
531 531
 			// convert payment amount back to a negative value for storage in the db
532
-			$refund_amount = abs( $refund_amount ) * -1;
532
+			$refund_amount = abs($refund_amount) * -1;
533 533
 			// now save it
534
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
534
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
535 535
 		}
536 536
 		return $available_refund_amount;
537 537
 	}
@@ -549,12 +549,12 @@  discard block
 block discarded – undo
549 549
 	 * @param EE_Payment     $payment
550 550
 	 * @param bool           $IPN
551 551
 	 */
552
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
552
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
553 553
 
554 554
 		/** @type EE_Transaction_Processor $transaction_processor */
555
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
555
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
556 556
 		// is the Payment Options Reg Step completed ?
557
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
557
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
558 558
 		// DEBUG LOG
559 559
 		//$this->log(
560 560
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
 		// if the Payment Options Reg Step is completed...
568 568
 		$revisit = $payment_options_step_completed === true ? true : false;
569 569
 		// then this is kinda sorta a revisit with regards to payments at least
570
-		$transaction_processor->set_revisit( $revisit );
570
+		$transaction_processor->set_revisit($revisit);
571 571
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
572 572
 		if (
573 573
 			$IPN &&
574 574
 			$payment_options_step_completed !== true &&
575
-			( $payment->is_approved() || $payment->is_pending() )
575
+			($payment->is_approved() || $payment->is_pending())
576 576
 		) {
577
-			$payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' );
577
+			$payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options');
578 578
 		}
579 579
 		// DEBUG LOG
580 580
 		//$this->log(
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 		//	)
587 587
 		//);
588 588
 		/** @type EE_Transaction_Payments $transaction_payments */
589
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
589
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
590 590
 		// maybe update status, but don't save transaction just yet
591
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
591
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
592 592
 		// check if 'finalize_registration' step has been completed...
593
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
593
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
594 594
 		// DEBUG LOG
595 595
 		//$this->log(
596 596
 		//	__CLASS__, __FUNCTION__, __LINE__,
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
 		//	)
602 602
 		//);
603 603
 		//  if this is an IPN and the final step has not been initiated
604
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
604
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
605 605
 			// and if it hasn't already been set as being started...
606
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
606
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
607 607
 			// DEBUG LOG
608 608
 			//$this->log(
609 609
 			//	__CLASS__, __FUNCTION__, __LINE__,
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 		}
617 617
 		$transaction->save();
618 618
 		// because the above will return false if the final step was not fully completed, we need to check again...
619
-		if ( $IPN && $finalized !== false ) {
619
+		if ($IPN && $finalized !== false) {
620 620
 			// and if we are all good to go, then send out notifications
621
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
621
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
622 622
 			// DEBUG LOG
623 623
 			//$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction );
624 624
 			//ok, now process the transaction according to the payment
625
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
625
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
626 626
 		}
627 627
 		// DEBUG LOG
628 628
 		//$this->log(
Please login to merge, or discard this patch.
core/EE_System.core.php 3 patches
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -578,7 +580,7 @@  discard block
 block discarded – undo
578 580
 				$espresso_db_update =  array( $espresso_db_update=>array() );
579 581
 				update_option( 'espresso_db_update', $espresso_db_update );
580 582
 			}
581
-		}else{
583
+		} else{
582 584
 			$corrected_db_update = array();
583 585
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584 586
 			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
@@ -588,7 +590,7 @@  discard block
 block discarded – undo
588 590
 					//fix it!
589 591
 					$version_string = $should_be_array;
590 592
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
593
+				} else{
592 594
 					//ok it checks out
593 595
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 596
 				}
@@ -633,7 +635,7 @@  discard block
 block discarded – undo
633 635
 					$addon->initialize_db_if_no_migrations_required();
634 636
 				}
635 637
 			}
636
-		}else{
638
+		} else{
637 639
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
638 640
 		}
639 641
 		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
 				//it a version we haven't seen before
704 706
 				if( $version_is_higher === 1 ){
705 707
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
708
+				} else{
707 709
 					$req_type = EE_System::req_type_downgrade;
708 710
 				}
709 711
 				delete_option( $activation_indicator_option_name );
@@ -712,10 +714,10 @@  discard block
 block discarded – undo
712 714
 				if( get_option( $activation_indicator_option_name, FALSE ) ){
713 715
 					if ( $version_is_higher === -1 ){
714 716
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
717
+					} elseif( $version_is_higher === 0 ){
716 718
 						//we've seen this version before, but it's an activation. must be a reactivation
717 719
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
720
+					} else{//$version_is_higher === 1
719 721
 						$req_type = EE_System::req_type_upgrade;
720 722
 					}
721 723
 					delete_option( $activation_indicator_option_name );
@@ -723,10 +725,10 @@  discard block
 block discarded – undo
723 725
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724 726
 					if ( $version_is_higher === -1 ){
725 727
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
728
+					} elseif( $version_is_higher === 0 ){
727 729
 						//we've seen this version before and it's not an activation. its normal request
728 730
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
731
+					} else{//$version_is_higher === 1
730 732
 						$req_type = EE_System::req_type_upgrade;
731 733
 					}
732 734
 				}
Please login to merge, or discard this patch.
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 	/**
199
-	* detect_if_activation_or_upgrade
200
-	*
201
-	* Takes care of detecting whether this is a brand new install or code upgrade,
202
-	* and either setting up the DB or setting up maintenance mode etc.
203
-	*
204
-	* @access public
205
-	* @return void
206
-	*/
199
+	 * detect_if_activation_or_upgrade
200
+	 *
201
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
202
+	 * and either setting up the DB or setting up maintenance mode etc.
203
+	 *
204
+	 * @access public
205
+	 * @return void
206
+	 */
207 207
 	public function detect_if_activation_or_upgrade() {
208 208
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
209 209
 
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 			$query_params =  array( 'page' => 'espresso_about' );
513 513
 
514 514
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
515
-			    $query_params['new_activation'] = TRUE;
515
+				$query_params['new_activation'] = TRUE;
516 516
 			}
517 517
 
518 518
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
519
-			    $query_params['reactivation'] = TRUE;
519
+				$query_params['reactivation'] = TRUE;
520 520
 			}
521 521
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
522 522
 			wp_safe_redirect( $url );
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 
620 620
 
621 621
 	/**
622
-	* _incompatible_addon_error
623
-	*
624
-	* @access public
625
-	* @return void
626
-	*/
622
+	 * _incompatible_addon_error
623
+	 *
624
+	 * @access public
625
+	 * @return void
626
+	 */
627 627
 	private function _incompatible_addon_error() {
628 628
 		// get array of classes hooking into here
629 629
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 
746 746
 
747 747
 	/**
748
-	* load_controllers
749
-	*
750
-	* this is the best place to load any additional controllers that needs access to EE core.
751
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
752
-	*
753
-	* @access public
754
-	* @return void
755
-	*/
748
+	 * load_controllers
749
+	 *
750
+	 * this is the best place to load any additional controllers that needs access to EE core.
751
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
752
+	 *
753
+	 * @access public
754
+	 * @return void
755
+	 */
756 756
 	public function load_controllers() {
757 757
 		do_action( 'AHEE__EE_System__load_controllers__start' );
758 758
 		// let's get it started
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
 
770 770
 
771 771
 	/**
772
-	* core_loaded_and_ready
773
-	*
774
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
775
-	*
776
-	* @access public
777
-	* @return void
778
-	*/
772
+	 * core_loaded_and_ready
773
+	 *
774
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
775
+	 *
776
+	 * @access public
777
+	 * @return void
778
+	 */
779 779
 	public function core_loaded_and_ready() {
780 780
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
781 781
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -786,13 +786,13 @@  discard block
 block discarded – undo
786 786
 
787 787
 
788 788
 	/**
789
-	* initialize
790
-	*
791
-	* this is the best place to begin initializing client code
792
-	*
793
-	* @access public
794
-	* @return void
795
-	*/
789
+	 * initialize
790
+	 *
791
+	 * this is the best place to begin initializing client code
792
+	 *
793
+	 * @access public
794
+	 * @return void
795
+	 */
796 796
 	public function initialize() {
797 797
 		do_action( 'AHEE__EE_System__initialize' );
798 798
 	}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 
801 801
 
802 802
 	/**
803
-	* initialize_last
804
-	*
805
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
806
-	*
807
-	* @access public
808
-	* @return void
809
-	*/
803
+	 * initialize_last
804
+	 *
805
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
806
+	 *
807
+	 * @access public
808
+	 * @return void
809
+	 */
810 810
 	public function initialize_last() {
811 811
 		do_action( 'AHEE__EE_System__initialize_last' );
812 812
 	}
@@ -815,14 +815,14 @@  discard block
 block discarded – undo
815 815
 
816 816
 
817 817
 	/**
818
-	* set_hooks_for_shortcodes_modules_and_addons
819
-	*
820
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
821
-	* this happens at the very beginning of the wp_loaded hookpoint
822
-	*
823
-	* @access public
824
-	* @return void
825
-	*/
818
+	 * set_hooks_for_shortcodes_modules_and_addons
819
+	 *
820
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
821
+	 * this happens at the very beginning of the wp_loaded hookpoint
822
+	 *
823
+	 * @access public
824
+	 * @return void
825
+	 */
826 826
 	public function set_hooks_for_shortcodes_modules_and_addons() {
827 827
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
828 828
 	}
@@ -831,13 +831,13 @@  discard block
 block discarded – undo
831 831
 
832 832
 
833 833
 	/**
834
-	* do_not_cache
835
-	*
836
-	* sets no cache headers and defines no cache constants for WP plugins
837
-	*
838
-	* @access public
839
-	* @return void
840
-	*/
834
+	 * do_not_cache
835
+	 *
836
+	 * sets no cache headers and defines no cache constants for WP plugins
837
+	 *
838
+	 * @access public
839
+	 * @return void
840
+	 */
841 841
 	public static function do_not_cache() {
842 842
 		// set no cache constants
843 843
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			//Current post
957 957
 			global $post;
958 958
 
959
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
959
+			if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
960 960
 				//Events Edit Current Event
961 961
 				$admin_bar->add_menu(array(
962 962
 						'id' => 'espresso-toolbar-events-edit',
Please login to merge, or discard this patch.
Spacing   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 * @param  \EE_Registry        $Registry
89 89
 	 * @return \EE_System
90 90
 	 */
91
-	public static function instance( EE_Registry $Registry = null ) {
91
+	public static function instance(EE_Registry $Registry = null) {
92 92
 		// check if class object is instantiated
93
-		if ( ! self::$_instance instanceof EE_System ) {
94
-			self::$_instance = new self( $Registry );
93
+		if ( ! self::$_instance instanceof EE_System) {
94
+			self::$_instance = new self($Registry);
95 95
 		}
96 96
 		return self::$_instance;
97 97
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 * resets the instance and returns it
102 102
 	 * @return EE_System
103 103
 	 */
104
-	public static function reset(){
104
+	public static function reset() {
105 105
 		self::$_instance->_req_type = NULL;
106 106
 		//we need to reset the migration manager in order for it to detect DMSs properly
107 107
 		EE_Data_Migration_Manager::reset();
108 108
 		//make sure none of the old hooks are left hanging around
109
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
109
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
110 110
 		self::instance()->detect_activations_or_upgrades();
111 111
 		self::instance()->perform_activations_upgrades_and_migrations();
112 112
 		return self::instance();
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	 * @access private
123 123
 	 * @param  \EE_Registry        $Registry
124 124
 	 */
125
-	private function __construct( EE_Registry $Registry ) {
125
+	private function __construct(EE_Registry $Registry) {
126 126
 		$this->registry = $Registry;
127
-		do_action( 'AHEE__EE_System__construct__begin', $this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
129
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
129
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
130 130
 		// when an ee addon is activated, we want to call the core hook(s) again
131 131
 		// because the newly-activated addon didn't get a chance to run at all
132
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
132
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
133 133
 		// detect whether install or upgrade
134
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
134
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
135 135
 		// load EE_Config, EE_Textdomain, etc
136
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
136
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
137 137
 		// load EE_Config, EE_Textdomain, etc
138
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
138
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
139 139
 		// you wanna get going? I wanna get going... let's get going!
140
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
140
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
141 141
 		//other housekeeping
142 142
 		//exclude EE critical pages from wp_list_pages
143
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
143
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
144 144
 		// ALL EE Addons should use the following hook point to attach their initial setup too
145 145
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
146
-		do_action( 'AHEE__EE_System__construct__complete', $this );
146
+		do_action('AHEE__EE_System__construct__complete', $this);
147 147
 	}
148 148
 
149 149
 
@@ -163,30 +163,30 @@  discard block
 block discarded – undo
163 163
 	public function load_espresso_addons() {
164 164
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
165 165
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
166
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
166
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
167 167
 		//load and setup EE_Capabilities
168
-		$this->registry->load_core( 'Capabilities' );
168
+		$this->registry->load_core('Capabilities');
169 169
 		//caps need to be initialized on every request so that capability maps are set.
170 170
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
171 171
 		$this->registry->CAP->init_caps();
172
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
172
+		do_action('AHEE__EE_System__load_espresso_addons');
173 173
 		//if the WP API basic auth plugin isn't already loaded, load it now. 
174 174
 		//We want it for mobile apps. Just include the entire plugin
175 175
 		//also, don't load the basic auth when a plugin is getting activated, because
176 176
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
177 177
 		//and causes a fatal error
178
-		if( !function_exists( 'json_basic_auth_handler' ) 
179
-			&& ! function_exists( 'json_basic_auth_error' )
178
+		if ( ! function_exists('json_basic_auth_handler') 
179
+			&& ! function_exists('json_basic_auth_error')
180 180
 			&& ! ( 
181
-				isset( $_GET[ 'action'] )
182
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
181
+				isset($_GET['action'])
182
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
183 183
 			)
184 184
 			&& ! (
185
-				isset( $_GET['activate' ] )
186
-				&& $_GET['activate' ] === 'true' 
185
+				isset($_GET['activate'])
186
+				&& $_GET['activate'] === 'true' 
187 187
 			)
188 188
 		) {
189
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
189
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
190 190
 		}
191 191
 	}
192 192
 
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 * @access public
203 203
 	 * @return void
204 204
 	 */
205
-	public function detect_activations_or_upgrades(){
205
+	public function detect_activations_or_upgrades() {
206 206
 		//first off: let's make sure to handle core
207 207
 		$this->detect_if_activation_or_upgrade();
208
-		foreach($this->registry->addons as $addon){
208
+		foreach ($this->registry->addons as $addon) {
209 209
 			//detect teh request type for that addon
210 210
 			$addon->detect_activation_or_upgrade();
211 211
 		}
@@ -226,44 +226,44 @@  discard block
 block discarded – undo
226 226
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
227 227
 
228 228
 		// load M-Mode class
229
-		$this->registry->load_core( 'Maintenance_Mode' );
229
+		$this->registry->load_core('Maintenance_Mode');
230 230
 		// check if db has been updated, or if its a brand-new installation
231 231
 
232 232
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
233
-		$request_type =  $this->detect_req_type($espresso_db_update);
233
+		$request_type = $this->detect_req_type($espresso_db_update);
234 234
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
235
-		if( $request_type != EE_System::req_type_normal){
235
+		if ($request_type != EE_System::req_type_normal) {
236 236
 			$this->registry->load_helper('Activation');
237 237
 		}
238 238
 
239
-		switch($request_type){
239
+		switch ($request_type) {
240 240
 			case EE_System::req_type_new_activation:
241
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
242
-				$this->_handle_core_version_change( $espresso_db_update );
241
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
242
+				$this->_handle_core_version_change($espresso_db_update);
243 243
 				break;
244 244
 			case EE_System::req_type_reactivation:
245
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
246
-				$this->_handle_core_version_change( $espresso_db_update );
245
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
246
+				$this->_handle_core_version_change($espresso_db_update);
247 247
 				break;
248 248
 			case EE_System::req_type_upgrade:
249
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
249
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
250 250
 				//migrations may be required now that we've upgraded
251 251
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
252
-				$this->_handle_core_version_change( $espresso_db_update );
252
+				$this->_handle_core_version_change($espresso_db_update);
253 253
 //				echo "done upgrade";die;
254 254
 				break;
255 255
 			case EE_System::req_type_downgrade:
256
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
256
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
257 257
 				//its possible migrations are no longer required
258 258
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
259
-				$this->_handle_core_version_change( $espresso_db_update );
259
+				$this->_handle_core_version_change($espresso_db_update);
260 260
 				break;
261 261
 			case EE_System::req_type_normal:
262 262
 			default:
263 263
 //				$this->_maybe_redirect_to_ee_about();
264 264
 				break;
265 265
 		}
266
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
266
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
267 267
 	}
268 268
 
269 269
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * initializing the database later during the request
272 272
 	 * @param array $espresso_db_update
273 273
 	 */
274
-	protected function _handle_core_version_change( $espresso_db_update ){
275
-		$this->update_list_of_installed_versions( $espresso_db_update );
274
+	protected function _handle_core_version_change($espresso_db_update) {
275
+		$this->update_list_of_installed_versions($espresso_db_update);
276 276
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
277
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
277
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
278 278
 	}
279 279
 
280 280
 
@@ -289,44 +289,44 @@  discard block
 block discarded – undo
289 289
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
290 290
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
291 291
 	 */
292
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
293
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
294
-		if( ! $espresso_db_update){
295
-			$espresso_db_update = get_option( 'espresso_db_update' );
292
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
293
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
294
+		if ( ! $espresso_db_update) {
295
+			$espresso_db_update = get_option('espresso_db_update');
296 296
 		}
297 297
 		// check that option is an array
298
-		if( ! is_array( $espresso_db_update )) {
298
+		if ( ! is_array($espresso_db_update)) {
299 299
 			// if option is FALSE, then it never existed
300
-			if ( $espresso_db_update === FALSE ) {
300
+			if ($espresso_db_update === FALSE) {
301 301
 				// make $espresso_db_update an array and save option with autoload OFF
302
-				$espresso_db_update =  array();
303
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
302
+				$espresso_db_update = array();
303
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
304 304
 			} else {
305 305
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
306
-				$espresso_db_update =  array( $espresso_db_update=>array() );
307
-				update_option( 'espresso_db_update', $espresso_db_update );
306
+				$espresso_db_update = array($espresso_db_update=>array());
307
+				update_option('espresso_db_update', $espresso_db_update);
308 308
 			}
309
-		}else{
309
+		} else {
310 310
 			$corrected_db_update = array();
311 311
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
312
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
313
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
312
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
313
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
314 314
 					//the key is an int, and the value IS NOT an array
315 315
 					//so it must be numerically-indexed, where values are versions installed...
316 316
 					//fix it!
317 317
 					$version_string = $should_be_array;
318 318
 					$corrected_db_update[$version_string] = array('unknown-date');
319
-				}else{
319
+				} else {
320 320
 					//ok it checks out
321 321
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
322 322
 				}
323 323
 			}
324 324
 			$espresso_db_update = $corrected_db_update;
325
-			update_option( 'espresso_db_update', $espresso_db_update );
325
+			update_option('espresso_db_update', $espresso_db_update);
326 326
 
327 327
 		}
328 328
 
329
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
329
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
330 330
 		return $espresso_db_update;
331 331
 	}
332 332
 
@@ -346,33 +346,33 @@  discard block
 block discarded – undo
346 346
 	 * so we prefer to only do it when necessary
347 347
 	 * @return void
348 348
 	 */
349
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
349
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
350 350
 		$request_type = $this->detect_req_type();
351 351
 		//only initialize system if we're not in maintenance mode.
352
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
353
-			update_option( 'ee_flush_rewrite_rules', TRUE );
352
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
353
+			update_option('ee_flush_rewrite_rules', TRUE);
354 354
 			EEH_Activation::system_initialization();
355
-			if( $verify_schema ) {
355
+			if ($verify_schema) {
356 356
 				EEH_Activation::initialize_db_and_folders();
357 357
 			}
358 358
 			EEH_Activation::initialize_db_content();
359
-			if( $initialize_addons_too ) {
359
+			if ($initialize_addons_too) {
360 360
 				$this->initialize_addons();
361 361
 			}
362
-		}else{
363
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
362
+		} else {
363
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
364 364
 		}
365
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
366
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
365
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
366
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
367 367
 		}
368 368
 	}
369 369
 
370 370
 	/**
371 371
 	 * Initializes the db for all registered addons
372 372
 	 */
373
-	public function initialize_addons(){
373
+	public function initialize_addons() {
374 374
 		//foreach registered addon, make sure its db is up-to-date too
375
-		foreach($this->registry->addons as $addon){
375
+		foreach ($this->registry->addons as $addon) {
376 376
 			$addon->initialize_db_if_no_migrations_required();
377 377
 		}
378 378
 	}
@@ -384,16 +384,16 @@  discard block
 block discarded – undo
384 384
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
385 385
 	 * @return 	boolean success as to whether or not this option was changed
386 386
 	 */
387
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
388
-		if( ! $version_history ) {
387
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
388
+		if ( ! $version_history) {
389 389
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
390 390
 		}
391
-		if( $current_version_to_add == NULL){
391
+		if ($current_version_to_add == NULL) {
392 392
 			$current_version_to_add = espresso_version();
393 393
 		}
394
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
394
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
395 395
 		// re-save
396
-		return update_option( 'espresso_db_update', $version_history );
396
+		return update_option('espresso_db_update', $version_history);
397 397
 	}
398 398
 
399 399
 
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 	 *                            but still know if this is a new install or not
411 411
 	 * @return int one of the constants on EE_System::req_type_
412 412
 	 */
413
-	public function detect_req_type( $espresso_db_update = NULL ){
414
-		if ( $this->_req_type === NULL ){
415
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
416
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
413
+	public function detect_req_type($espresso_db_update = NULL) {
414
+		if ($this->_req_type === NULL) {
415
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
416
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
417 417
 		}
418 418
 		return $this->_req_type;
419 419
 	}
@@ -429,39 +429,39 @@  discard block
 block discarded – undo
429 429
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
430 430
 	 * @return int one of the constants on EE_System::req_type_*
431 431
 	 */
432
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
433
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
434
-		if( $activation_history_for_addon ){
432
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
433
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
434
+		if ($activation_history_for_addon) {
435 435
 			//it exists, so this isn't a completely new install
436 436
 			//check if this version already in that list of previously installed versions
437
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
437
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
438 438
 				//it a version we haven't seen before
439
-				if( $version_is_higher === 1 ){
439
+				if ($version_is_higher === 1) {
440 440
 					$req_type = EE_System::req_type_upgrade;
441
-				}else{
441
+				} else {
442 442
 					$req_type = EE_System::req_type_downgrade;
443 443
 				}
444
-				delete_option( $activation_indicator_option_name );
444
+				delete_option($activation_indicator_option_name);
445 445
 			} else {
446 446
 				// its not an update. maybe a reactivation?
447
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
448
-					if ( $version_is_higher === -1 ){
447
+				if (get_option($activation_indicator_option_name, FALSE)) {
448
+					if ($version_is_higher === -1) {
449 449
 						$req_type = EE_System::req_type_downgrade;
450
-					}elseif( $version_is_higher === 0 ){
450
+					}elseif ($version_is_higher === 0) {
451 451
 						//we've seen this version before, but it's an activation. must be a reactivation
452 452
 						$req_type = EE_System::req_type_reactivation;
453
-					}else{//$version_is_higher === 1
453
+					} else {//$version_is_higher === 1
454 454
 						$req_type = EE_System::req_type_upgrade;
455 455
 					}
456
-					delete_option( $activation_indicator_option_name );
456
+					delete_option($activation_indicator_option_name);
457 457
 				} else {
458 458
 					//we've seen this version before and the activation indicate doesn't show it was just activated
459
-					if ( $version_is_higher === -1 ){
459
+					if ($version_is_higher === -1) {
460 460
 						$req_type = EE_System::req_type_downgrade;
461
-					}elseif( $version_is_higher === 0 ){
461
+					}elseif ($version_is_higher === 0) {
462 462
 						//we've seen this version before and it's not an activation. its normal request
463 463
 						$req_type = EE_System::req_type_normal;
464
-					}else{//$version_is_higher === 1
464
+					} else {//$version_is_higher === 1
465 465
 						$req_type = EE_System::req_type_upgrade;
466 466
 					}
467 467
 				}
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 		} else {
470 470
 			//brand new install
471 471
 			$req_type = EE_System::req_type_new_activation;
472
-			delete_option( $activation_indicator_option_name );
472
+			delete_option($activation_indicator_option_name);
473 473
 		}
474 474
 		return $req_type;
475 475
 	}
@@ -487,30 +487,30 @@  discard block
 block discarded – undo
487 487
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
488 488
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
489 489
 	 */
490
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
490
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
491 491
 		//find the most recently-activated version
492 492
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
493 493
 		$most_recently_active_version = '0.0.0.dev.000';
494
-		if( is_array( $activation_history_for_addon ) ){
495
-			foreach( $activation_history_for_addon as $version => $times_activated ){
494
+		if (is_array($activation_history_for_addon)) {
495
+			foreach ($activation_history_for_addon as $version => $times_activated) {
496 496
 				//check there is a record of when this version was activated. Otherwise,
497 497
 				//mark it as unknown
498
-				if( ! $times_activated ){
499
-					$times_activated = array( 'unknown-date');
498
+				if ( ! $times_activated) {
499
+					$times_activated = array('unknown-date');
500 500
 				}
501
-				if( is_string( $times_activated ) ){
502
-					$times_activated = array( $times_activated );
501
+				if (is_string($times_activated)) {
502
+					$times_activated = array($times_activated);
503 503
 				}
504
-				foreach( $times_activated as $an_activation ){
505
-					if( $an_activation != 'unknown-date' &&
506
-							$an_activation > $most_recently_active_version_activation  ){
504
+				foreach ($times_activated as $an_activation) {
505
+					if ($an_activation != 'unknown-date' &&
506
+							$an_activation > $most_recently_active_version_activation) {
507 507
 						$most_recently_active_version = $version;
508 508
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
509 509
 					}
510 510
 				}
511 511
 			}
512 512
 		}
513
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
513
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
514 514
 	}
515 515
 
516 516
 
@@ -520,24 +520,24 @@  discard block
 block discarded – undo
520 520
 	 * @return void
521 521
 	 */
522 522
 	public function redirect_to_about_ee() {
523
-		$notices = EE_Error::get_notices( FALSE );
523
+		$notices = EE_Error::get_notices(FALSE);
524 524
 		//if current user is an admin and it's not an ajax request
525 525
 		if (
526
-			$this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
527
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
528
-			&& ! isset( $notices[ 'errors' ] )
526
+			$this->registry->CAP->current_user_can('manage_options', 'espresso_about_default')
527
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
528
+			&& ! isset($notices['errors'])
529 529
 		) {
530
-			$query_params =  array( 'page' => 'espresso_about' );
530
+			$query_params = array('page' => 'espresso_about');
531 531
 
532
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
532
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
533 533
 			    $query_params['new_activation'] = TRUE;
534 534
 			}
535 535
 
536
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
536
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
537 537
 			    $query_params['reactivation'] = TRUE;
538 538
 			}
539
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
540
-			wp_safe_redirect( $url );
539
+			$url = add_query_arg($query_params, admin_url('admin.php'));
540
+			wp_safe_redirect($url);
541 541
 			exit();
542 542
 		}
543 543
 	}
@@ -551,31 +551,31 @@  discard block
 block discarded – undo
551 551
 	 *
552 552
 	 * @return void
553 553
 	 */
554
-	public function load_core_configuration(){
555
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
556
-		$this->registry->load_core( 'EE_Load_Textdomain' );
554
+	public function load_core_configuration() {
555
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
556
+		$this->registry->load_core('EE_Load_Textdomain');
557 557
 		//load textdomain
558 558
 		EE_Load_Textdomain::load_textdomain();
559 559
 		// load and setup EE_Config and EE_Network_Config
560
-		$this->registry->load_core( 'Config' );
561
-		$this->registry->load_core( 'Network_Config' );
560
+		$this->registry->load_core('Config');
561
+		$this->registry->load_core('Network_Config');
562 562
 		// setup autoloaders
563 563
 		// enable logging?
564
-		if ( $this->registry->CFG->admin->use_full_logging ) {
565
-			$this->registry->load_core( 'Log' );
564
+		if ($this->registry->CFG->admin->use_full_logging) {
565
+			$this->registry->load_core('Log');
566 566
 		}
567 567
 		// check for activation errors
568
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
569
-		if ( $activation_errors ) {
570
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
571
-			update_option( 'ee_plugin_activation_errors', FALSE );
568
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
569
+		if ($activation_errors) {
570
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
571
+			update_option('ee_plugin_activation_errors', FALSE);
572 572
 		}
573 573
 		// get model names
574 574
 		$this->_parse_model_names();
575 575
 
576 576
 		//load caf stuff a chance to play during the activation process too.
577 577
 		$this->_maybe_brew_regular();
578
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
578
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
579 579
 	}
580 580
 
581 581
 
@@ -584,23 +584,23 @@  discard block
 block discarded – undo
584 584
 	 *
585 585
 	 * @return void
586 586
 	 */
587
-	private function _parse_model_names(){
587
+	private function _parse_model_names() {
588 588
 		//get all the files in the EE_MODELS folder that end in .model.php
589
-		$models = glob( EE_MODELS.'*.model.php');
589
+		$models = glob(EE_MODELS.'*.model.php');
590 590
 		$model_names = array();
591 591
 		$non_abstract_db_models = array();
592
-		foreach( $models as $model ){
592
+		foreach ($models as $model) {
593 593
 			// get model classname
594
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
595
-			$short_name = str_replace( 'EEM_', '', $classname );
594
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
595
+			$short_name = str_replace('EEM_', '', $classname);
596 596
 			$reflectionClass = new ReflectionClass($classname);
597
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
598
-				$non_abstract_db_models[ $short_name ] = $classname;
597
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
598
+				$non_abstract_db_models[$short_name] = $classname;
599 599
 			}
600
-			$model_names[ $short_name ] = $classname;
600
+			$model_names[$short_name] = $classname;
601 601
 		}
602
-		$this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
603
-		$this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
602
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
603
+		$this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
604 604
 	}
605 605
 
606 606
 
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
 	 * @return void
611 611
 	 */
612 612
 	private function _maybe_brew_regular() {
613
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
614
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
613
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
614
+			require_once EE_CAFF_PATH.'brewing_regular.php';
615 615
 		}
616 616
 	}
617 617
 
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 	 * @return void
629 629
 	 */
630 630
 	public function register_shortcodes_modules_and_widgets() {
631
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
631
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
632 632
 		// check for addons using old hookpoint
633
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
633
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
634 634
 			$this->_incompatible_addon_error();
635 635
 		}
636 636
 	}
@@ -644,19 +644,19 @@  discard block
 block discarded – undo
644 644
 	*/
645 645
 	private function _incompatible_addon_error() {
646 646
 		// get array of classes hooking into here
647
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
648
-		if ( ! empty( $class_names )) {
649
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
647
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
648
+		if ( ! empty($class_names)) {
649
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
650 650
 			$msg .= '<ul>';
651
-			foreach ( $class_names as $class_name ) {
652
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
651
+			foreach ($class_names as $class_name) {
652
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
653 653
 			}
654 654
 			$msg .= '</ul>';
655
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
655
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
656 656
 			// save list of incompatible addons to wp-options for later use
657
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
658
-			if ( is_admin() ) {
659
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
657
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
658
+			if (is_admin()) {
659
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
660 660
 			}
661 661
 		}
662 662
 	}
@@ -673,25 +673,25 @@  discard block
 block discarded – undo
673 673
 	 *
674 674
 	 * @return void
675 675
 	 */
676
-	public function brew_espresso(){
677
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
676
+	public function brew_espresso() {
677
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
678 678
 		// load some final core systems
679
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
680
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
681
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
682
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
683
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
684
-		add_action( 'init', array( $this, 'initialize' ), 10 );
685
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
686
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
687
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
688
-
689
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
679
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
680
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
681
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
682
+		add_action('init', array($this, 'load_controllers'), 7);
683
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
684
+		add_action('init', array($this, 'initialize'), 10);
685
+		add_action('init', array($this, 'initialize_last'), 100);
686
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
687
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
688
+
689
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
690 690
 			// pew pew pew
691
-			$this->registry->load_core( 'PUE' );
692
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
691
+			$this->registry->load_core('PUE');
692
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
693 693
 		}
694
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
694
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
695 695
 	}
696 696
 
697 697
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	public function set_hooks_for_core() {
707 707
 		$this->_deactivate_incompatible_addons();
708
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
708
+		do_action('AHEE__EE_System__set_hooks_for_core');
709 709
 	}
710 710
 
711 711
 
@@ -714,15 +714,15 @@  discard block
 block discarded – undo
714 714
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
715 715
 	 * deactivates any addons considered incompatible with the current version of EE
716 716
 	 */
717
-	private function _deactivate_incompatible_addons(){
718
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
719
-		if ( ! empty( $incompatible_addons )) {
720
-			$active_plugins = get_option( 'active_plugins', array() );
721
-			foreach ( $active_plugins as $active_plugin ) {
722
-				foreach ( $incompatible_addons as $incompatible_addon ) {
723
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
724
-						unset( $_GET['activate'] );
725
-						espresso_deactivate_plugin( $active_plugin );
717
+	private function _deactivate_incompatible_addons() {
718
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
719
+		if ( ! empty($incompatible_addons)) {
720
+			$active_plugins = get_option('active_plugins', array());
721
+			foreach ($active_plugins as $active_plugin) {
722
+				foreach ($incompatible_addons as $incompatible_addon) {
723
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
724
+						unset($_GET['activate']);
725
+						espresso_deactivate_plugin($active_plugin);
726 726
 					}
727 727
 				}
728 728
 			}
@@ -739,10 +739,10 @@  discard block
 block discarded – undo
739 739
 	 */
740 740
 	public function perform_activations_upgrades_and_migrations() {
741 741
 		//first check if we had previously attempted to setup EE's directories but failed
742
-		if( EEH_Activation::upload_directories_incomplete() ) {
742
+		if (EEH_Activation::upload_directories_incomplete()) {
743 743
 			EEH_Activation::create_upload_directories();
744 744
 		}
745
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
745
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
746 746
 	}
747 747
 
748 748
 
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
 	 *  	@return 	void
755 755
 	 */
756 756
 	public function load_CPTs_and_session() {
757
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
757
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
758 758
 		// register Custom Post Types
759
-		$this->registry->load_core( 'Register_CPTs' );
760
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
759
+		$this->registry->load_core('Register_CPTs');
760
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
761 761
 	}
762 762
 
763 763
 
@@ -772,16 +772,16 @@  discard block
 block discarded – undo
772 772
 	* @return void
773 773
 	*/
774 774
 	public function load_controllers() {
775
-		do_action( 'AHEE__EE_System__load_controllers__start' );
775
+		do_action('AHEE__EE_System__load_controllers__start');
776 776
 		// let's get it started
777
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
778
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
779
-			$this->registry->load_core( 'Front_Controller', array(), false, true );
780
-		} else if ( ! EE_FRONT_AJAX ) {
781
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
782
-			$this->registry->load_core( 'Admin' );
777
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
778
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
779
+			$this->registry->load_core('Front_Controller', array(), false, true);
780
+		} else if ( ! EE_FRONT_AJAX) {
781
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
782
+			$this->registry->load_core('Admin');
783 783
 		}
784
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
784
+		do_action('AHEE__EE_System__load_controllers__complete');
785 785
 	}
786 786
 
787 787
 
@@ -795,9 +795,9 @@  discard block
 block discarded – undo
795 795
 	* @return void
796 796
 	*/
797 797
 	public function core_loaded_and_ready() {
798
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
799
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
800
-		$this->registry->load_core( 'Session' );
798
+		do_action('AHEE__EE_System__core_loaded_and_ready');
799
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
800
+		$this->registry->load_core('Session');
801 801
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
802 802
 	}
803 803
 
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 	* @return void
813 813
 	*/
814 814
 	public function initialize() {
815
-		do_action( 'AHEE__EE_System__initialize' );
815
+		do_action('AHEE__EE_System__initialize');
816 816
 	}
817 817
 
818 818
 
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 	* @return void
827 827
 	*/
828 828
 	public function initialize_last() {
829
-		do_action( 'AHEE__EE_System__initialize_last' );
829
+		do_action('AHEE__EE_System__initialize_last');
830 830
 	}
831 831
 
832 832
 
@@ -858,21 +858,21 @@  discard block
 block discarded – undo
858 858
 	*/
859 859
 	public static function do_not_cache() {
860 860
 		// set no cache constants
861
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
862
-			define( 'DONOTCACHEPAGE', true );
861
+		if ( ! defined('DONOTCACHEPAGE')) {
862
+			define('DONOTCACHEPAGE', true);
863 863
 		}
864
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
865
-			define( 'DONOTCACHCEOBJECT', true );
864
+		if ( ! defined('DONOTCACHCEOBJECT')) {
865
+			define('DONOTCACHCEOBJECT', true);
866 866
 		}
867
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
868
-			define( 'DONOTCACHEDB', true );
867
+		if ( ! defined('DONOTCACHEDB')) {
868
+			define('DONOTCACHEDB', true);
869 869
 		}
870 870
 		// add no cache headers
871
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
871
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
872 872
 		// plus a little extra for nginx and Google Chrome
873
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
873
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
874 874
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
875
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
875
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
876 876
 	}
877 877
 
878 878
 
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	 * @param $headers
885 885
 	 * @return    array
886 886
 	 */
887
-	public static function extra_nocache_headers ( $headers ) {
887
+	public static function extra_nocache_headers($headers) {
888 888
 		// for NGINX
889 889
 		$headers['X-Accel-Expires'] = 0;
890 890
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -913,15 +913,15 @@  discard block
 block discarded – undo
913 913
 	 * @param  WP_Admin_Bar $admin_bar
914 914
 	 * @return void
915 915
 	 */
916
-	public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) {
916
+	public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) {
917 917
 
918 918
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
919
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
919
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
920 920
 			return;
921 921
 		}
922 922
 
923
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
924
-		$this->registry->load_helper( 'URL' );
923
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
924
+		$this->registry->load_helper('URL');
925 925
 		$menu_class = 'espresso_menu_item_class';
926 926
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
927 927
 		//because they're only defined in each of their respective constructors
@@ -933,20 +933,20 @@  discard block
 block discarded – undo
933 933
 		//Top Level
934 934
 		$admin_bar->add_menu(array(
935 935
 				'id' => 'espresso-toolbar',
936
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
936
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
937 937
 				'href' => $events_admin_url,
938 938
 				'meta' => array(
939 939
 						'title' => __('Event Espresso', 'event_espresso'),
940
-						'class' => $menu_class . 'first'
940
+						'class' => $menu_class.'first'
941 941
 				),
942 942
 		));
943 943
 
944 944
 		//Events
945
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
945
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
946 946
 			$admin_bar->add_menu(array(
947 947
 					'id' => 'espresso-toolbar-events',
948 948
 					'parent' => 'espresso-toolbar',
949
-					'title' => __( 'Events', 'event_espresso' ),
949
+					'title' => __('Events', 'event_espresso'),
950 950
 					'href' => $events_admin_url,
951 951
 					'meta' => array(
952 952
 							'title' => __('Events', 'event_espresso'),
@@ -957,13 +957,13 @@  discard block
 block discarded – undo
957 957
 		}
958 958
 
959 959
 
960
-		if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
960
+		if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
961 961
 			//Events Add New
962 962
 			$admin_bar->add_menu(array(
963 963
 					'id' => 'espresso-toolbar-events-new',
964 964
 					'parent' => 'espresso-toolbar-events',
965 965
 					'title' => __('Add New', 'event_espresso'),
966
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
966
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
967 967
 					'meta' => array(
968 968
 							'title' => __('Add New', 'event_espresso'),
969 969
 							'target' => '',
@@ -972,18 +972,18 @@  discard block
 block discarded – undo
972 972
 			));
973 973
 		}
974 974
 
975
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
975
+		if (is_single() && (get_post_type() == 'espresso_events')) {
976 976
 
977 977
 			//Current post
978 978
 			global $post;
979 979
 
980
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
980
+	    	if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
981 981
 				//Events Edit Current Event
982 982
 				$admin_bar->add_menu(array(
983 983
 						'id' => 'espresso-toolbar-events-edit',
984 984
 						'parent' => 'espresso-toolbar-events',
985 985
 						'title' => __('Edit Event', 'event_espresso'),
986
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
986
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
987 987
 						'meta' => array(
988 988
 								'title' => __('Edit Event', 'event_espresso'),
989 989
 								'target' => '',
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 		}
996 996
 
997 997
 		//Events View
998
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
998
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
999 999
 			$admin_bar->add_menu(array(
1000 1000
 					'id' => 'espresso-toolbar-events-view',
1001 1001
 					'parent' => 'espresso-toolbar-events',
1002
-					'title' => __( 'View', 'event_espresso' ),
1002
+					'title' => __('View', 'event_espresso'),
1003 1003
 					'href' => $events_admin_url,
1004 1004
 					'meta' => array(
1005 1005
 							'title' => __('View', 'event_espresso'),
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 			));
1010 1010
 		}
1011 1011
 
1012
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1012
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1013 1013
 			//Events View All
1014 1014
 			$admin_bar->add_menu(array(
1015 1015
 					'id' => 'espresso-toolbar-events-all',
1016 1016
 					'parent' => 'espresso-toolbar-events-view',
1017
-					'title' => __( 'All', 'event_espresso' ),
1017
+					'title' => __('All', 'event_espresso'),
1018 1018
 					'href' => $events_admin_url,
1019 1019
 					'meta' => array(
1020 1020
 							'title' => __('All', 'event_espresso'),
@@ -1025,13 +1025,13 @@  discard block
 block discarded – undo
1025 1025
 		}
1026 1026
 
1027 1027
 
1028
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1028
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1029 1029
 			//Events View Today
1030 1030
 			$admin_bar->add_menu(array(
1031 1031
 					'id' => 'espresso-toolbar-events-today',
1032 1032
 					'parent' => 'espresso-toolbar-events-view',
1033 1033
 					'title' => __('Today', 'event_espresso'),
1034
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1034
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1035 1035
 					'meta' => array(
1036 1036
 							'title' => __('Today', 'event_espresso'),
1037 1037
 							'target' => '',
@@ -1041,13 +1041,13 @@  discard block
 block discarded – undo
1041 1041
 		}
1042 1042
 
1043 1043
 
1044
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1044
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1045 1045
 			//Events View This Month
1046 1046
 			$admin_bar->add_menu(array(
1047 1047
 					'id' => 'espresso-toolbar-events-month',
1048 1048
 					'parent' => 'espresso-toolbar-events-view',
1049
-					'title' => __( 'This Month', 'event_espresso'),
1050
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1049
+					'title' => __('This Month', 'event_espresso'),
1050
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1051 1051
 					'meta' => array(
1052 1052
 							'title' => __('This Month', 'event_espresso'),
1053 1053
 							'target' => '',
@@ -1057,11 +1057,11 @@  discard block
 block discarded – undo
1057 1057
 		}
1058 1058
 
1059 1059
 		//Registration Overview
1060
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1060
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1061 1061
 			$admin_bar->add_menu(array(
1062 1062
 					'id' => 'espresso-toolbar-registrations',
1063 1063
 					'parent' => 'espresso-toolbar',
1064
-					'title' => __( 'Registrations', 'event_espresso' ),
1064
+					'title' => __('Registrations', 'event_espresso'),
1065 1065
 					'href' => $reg_admin_url,
1066 1066
 					'meta' => array(
1067 1067
 							'title' => __('Registrations', 'event_espresso'),
@@ -1072,12 +1072,12 @@  discard block
 block discarded – undo
1072 1072
 		}
1073 1073
 
1074 1074
 		//Registration Overview Today
1075
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1075
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1076 1076
 			$admin_bar->add_menu(array(
1077 1077
 					'id' => 'espresso-toolbar-registrations-today',
1078 1078
 					'parent' => 'espresso-toolbar-registrations',
1079
-					'title' => __( 'Today', 'event_espresso'),
1080
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1079
+					'title' => __('Today', 'event_espresso'),
1080
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1081 1081
 					'meta' => array(
1082 1082
 							'title' => __('Today', 'event_espresso'),
1083 1083
 							'target' => '',
@@ -1087,14 +1087,14 @@  discard block
 block discarded – undo
1087 1087
 		}
1088 1088
 
1089 1089
 		//Registration Overview Today Completed
1090
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1090
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1091 1091
 			$admin_bar->add_menu(array(
1092 1092
 					'id' => 'espresso-toolbar-registrations-today-approved',
1093 1093
 					'parent' => 'espresso-toolbar-registrations-today',
1094
-					'title' => __( 'Approved', 'event_espresso' ),
1095
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1094
+					'title' => __('Approved', 'event_espresso'),
1095
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1096 1096
 					'meta' => array(
1097
-							'title' => __('Approved', 'event_espresso' ),
1097
+							'title' => __('Approved', 'event_espresso'),
1098 1098
 							'target' => '',
1099 1099
 							'class' => $menu_class
1100 1100
 					),
@@ -1102,14 +1102,14 @@  discard block
 block discarded – undo
1102 1102
 		}
1103 1103
 
1104 1104
 		//Registration Overview Today Pending\
1105
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1105
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1106 1106
 			$admin_bar->add_menu(array(
1107 1107
 					'id' => 'espresso-toolbar-registrations-today-pending',
1108 1108
 					'parent' => 'espresso-toolbar-registrations-today',
1109
-					'title' => __( 'Pending', 'event_espresso' ),
1110
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1109
+					'title' => __('Pending', 'event_espresso'),
1110
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1111 1111
 					'meta' => array(
1112
-							'title' => __('Pending Payment', 'event_espresso' ),
1112
+							'title' => __('Pending Payment', 'event_espresso'),
1113 1113
 							'target' => '',
1114 1114
 							'class' => $menu_class
1115 1115
 					),
@@ -1117,14 +1117,14 @@  discard block
 block discarded – undo
1117 1117
 		}
1118 1118
 
1119 1119
 		//Registration Overview Today Incomplete
1120
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1120
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1121 1121
 			$admin_bar->add_menu(array(
1122 1122
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1123 1123
 					'parent' => 'espresso-toolbar-registrations-today',
1124
-					'title' => __( 'Not Approved', 'event_espresso' ),
1125
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1124
+					'title' => __('Not Approved', 'event_espresso'),
1125
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1126 1126
 					'meta' => array(
1127
-							'title' => __('Not Approved', 'event_espresso' ),
1127
+							'title' => __('Not Approved', 'event_espresso'),
1128 1128
 							'target' => '',
1129 1129
 							'class' => $menu_class
1130 1130
 					),
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
 		}
1133 1133
 
1134 1134
 		//Registration Overview Today Incomplete
1135
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1135
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1136 1136
 			$admin_bar->add_menu(array(
1137 1137
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1138 1138
 					'parent' => 'espresso-toolbar-registrations-today',
1139
-					'title' => __( 'Cancelled', 'event_espresso'),
1140
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1139
+					'title' => __('Cancelled', 'event_espresso'),
1140
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1141 1141
 					'meta' => array(
1142 1142
 							'title' => __('Cancelled', 'event_espresso'),
1143 1143
 							'target' => '',
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 		}
1148 1148
 
1149 1149
 		//Registration Overview This Month
1150
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1150
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1151 1151
 			$admin_bar->add_menu(array(
1152 1152
 					'id' => 'espresso-toolbar-registrations-month',
1153 1153
 					'parent' => 'espresso-toolbar-registrations',
1154
-					'title' => __( 'This Month', 'event_espresso' ),
1155
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1154
+					'title' => __('This Month', 'event_espresso'),
1155
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1156 1156
 					'meta' => array(
1157 1157
 							'title' => __('This Month', 'event_espresso'),
1158 1158
 							'target' => '',
@@ -1162,12 +1162,12 @@  discard block
 block discarded – undo
1162 1162
 		}
1163 1163
 
1164 1164
 		//Registration Overview This Month Approved
1165
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1165
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1166 1166
 			$admin_bar->add_menu(array(
1167 1167
 					'id' => 'espresso-toolbar-registrations-month-approved',
1168 1168
 					'parent' => 'espresso-toolbar-registrations-month',
1169
-					'title' => __( 'Approved', 'event_espresso' ),
1170
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1169
+					'title' => __('Approved', 'event_espresso'),
1170
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1171 1171
 					'meta' => array(
1172 1172
 							'title' => __('Approved', 'event_espresso'),
1173 1173
 							'target' => '',
@@ -1177,12 +1177,12 @@  discard block
 block discarded – undo
1177 1177
 		}
1178 1178
 
1179 1179
 		//Registration Overview This Month Pending
1180
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1180
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1181 1181
 			$admin_bar->add_menu(array(
1182 1182
 					'id' => 'espresso-toolbar-registrations-month-pending',
1183 1183
 					'parent' => 'espresso-toolbar-registrations-month',
1184
-					'title' => __( 'Pending', 'event_espresso'),
1185
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1184
+					'title' => __('Pending', 'event_espresso'),
1185
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1186 1186
 					'meta' => array(
1187 1187
 							'title' => __('Pending', 'event_espresso'),
1188 1188
 							'target' => '',
@@ -1192,14 +1192,14 @@  discard block
 block discarded – undo
1192 1192
 		}
1193 1193
 
1194 1194
 		//Registration Overview This Month Not Approved
1195
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1195
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1196 1196
 			$admin_bar->add_menu(array(
1197 1197
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1198 1198
 					'parent' => 'espresso-toolbar-registrations-month',
1199
-					'title' => __( 'Not Approved', 'event_espresso'),
1200
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1199
+					'title' => __('Not Approved', 'event_espresso'),
1200
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1201 1201
 					'meta' => array(
1202
-							'title' => __('Not Approved', 'event_espresso' ),
1202
+							'title' => __('Not Approved', 'event_espresso'),
1203 1203
 							'target' => '',
1204 1204
 							'class' => $menu_class
1205 1205
 					),
@@ -1208,12 +1208,12 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 
1210 1210
 		//Registration Overview This Month Cancelled
1211
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1211
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1212 1212
 			$admin_bar->add_menu(array(
1213 1213
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1214 1214
 					'parent' => 'espresso-toolbar-registrations-month',
1215 1215
 					'title' => __('Cancelled', 'event_espresso'),
1216
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1216
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1217 1217
 					'meta' => array(
1218 1218
 							'title' => __('Cancelled', 'event_espresso'),
1219 1219
 							'target' => '',
@@ -1223,11 +1223,11 @@  discard block
 block discarded – undo
1223 1223
 		}
1224 1224
 
1225 1225
 		//Extensions & Services
1226
-		if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1226
+		if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1227 1227
 			$admin_bar->add_menu(array(
1228 1228
 					'id' => 'espresso-toolbar-extensions-and-services',
1229 1229
 					'parent' => 'espresso-toolbar',
1230
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1230
+					'title' => __('Extensions & Services', 'event_espresso'),
1231 1231
 					'href' => $extensions_admin_url,
1232 1232
 					'meta' => array(
1233 1233
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1249,8 +1249,8 @@  discard block
 block discarded – undo
1249 1249
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1250 1250
 	 * @return array
1251 1251
 	 */
1252
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1253
-		return  array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() );
1252
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1253
+		return  array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1254 1254
 	}
1255 1255
 
1256 1256
 
@@ -1270,11 +1270,11 @@  discard block
 block discarded – undo
1270 1270
 	 */
1271 1271
 	public function wp_enqueue_scripts() {
1272 1272
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1273
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1273
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1274 1274
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1275
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1275
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1276 1276
 				// register jQuery Validate
1277
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE );
1277
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
1278 1278
 			}
1279 1279
 		}
1280 1280
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 final class EE_Admin {
25 25
 
26 26
    /**
27
-     * 	EE_Admin Object
28
-     * 	@private _instance
29
-	 * 	@private 	protected
30
-     */
27
+    * 	EE_Admin Object
28
+    * 	@private _instance
29
+    * 	@private 	protected
30
+    */
31 31
 	private static $_instance = NULL;
32 32
 
33 33
 	/**
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
    /**
59
-     * class constructor
60
-     */
59
+    * class constructor
60
+    */
61 61
 	protected function __construct() {
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 
169 169
 
170 170
 	/**
171
-	* init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
172
-	*
173
-	* @access public
174
-	* @return void
175
-	*/
171
+	 * init- should fire after shortcode, module,  addon, other plugin (default priority), and even EE_Front_Controller's init phases have run
172
+	 *
173
+	 * @access public
174
+	 * @return void
175
+	 */
176 176
 	public function init() {
177 177
 
178 178
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 
464 464
 
465 465
 	/**
466
-	* admin_init
467
-	*
468
-	* @access public
469
-	* @return void
470
-	*/
466
+	 * admin_init
467
+	 *
468
+	 * @access public
469
+	 * @return void
470
+	 */
471 471
 	public function admin_init() {
472 472
 
473 473
 		/**
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
 
625 625
 
626 626
 	/**
627
-	* 	dismiss_persistent_admin_notice
628
-	*
629
-	*	@access 	public
630
-	* 	@return 		void
631
-	*/
627
+	 * 	dismiss_persistent_admin_notice
628
+	 *
629
+	 *	@access 	public
630
+	 * 	@return 		void
631
+	 */
632 632
 	public function dismiss_ee_nag_notice_callback() {
633 633
 		EE_Error::dismiss_persistent_admin_notice();
634 634
 	}
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -220,8 +222,9 @@  discard block
 block discarded – undo
220 222
 	 */
221 223
 	public function remove_pages_from_nav_menu( $post_type ) {
222 224
 		//if this isn't the "pages" post type let's get out
223
-		if ( $post_type->name !== 'page' )
224
-			return $post_type;
225
+		if ( $post_type->name !== 'page' ) {
226
+					return $post_type;
227
+		}
225 228
 
226 229
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
227 230
 
@@ -296,8 +299,9 @@  discard block
 block discarded – undo
296 299
 	 * @return string  the (maybe) modified link
297 300
 	 */
298 301
 	public function modify_edit_post_link( $link, $id, $context ) {
299
-		if ( ! $post = get_post( $id ) )
300
-			return $link;
302
+		if ( ! $post = get_post( $id ) ) {
303
+					return $link;
304
+		}
301 305
 
302 306
 		if ( $post->post_type == 'espresso_attendees' ) {
303 307
 			$query_args = array(
@@ -337,7 +341,10 @@  discard block
 block discarded – undo
337 341
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
338 342
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
339 343
 				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
340
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
344
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {
345
+	echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));
346
+}
347
+?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
341 348
 						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
342 349
 					</a>
343 350
 				</li>
@@ -870,8 +877,9 @@  discard block
 block discarded – undo
870 877
 	 */
871 878
 	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
872 879
 		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
873
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
874
-			$config['page_path'] = $page_path;
880
+		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
881
+					$config['page_path'] = $page_path;
882
+		}
875 883
 			EE_Register_Admin_Page::register( $page_basename, $config );
876 884
 	}
877 885
 
Please login to merge, or discard this patch.
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function instance() {
49 49
 		// check if class object is instantiated
50
-		if (  ! self::$_instance instanceof EE_Admin ) {
50
+		if ( ! self::$_instance instanceof EE_Admin) {
51 51
 			self::$_instance = new self();
52 52
 		}
53 53
 		return self::$_instance;
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
64 64
 		// set autoloaders for our admin page classes based on included path information
65
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
65
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
66 66
 		// admin hooks
67
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
67
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
68 68
 		// load EE_Request_Handler early
69
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
70
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
69
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
70
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103 103
 	}
104 104
 
105 105
 
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param 	string 	$plugin
113 113
 	 * @return 	array
114 114
 	 */
115
-	public function filter_plugin_actions( $links, $plugin ) {
115
+	public function filter_plugin_actions($links, $plugin) {
116 116
 		// set $main_file in stone
117 117
 		static $main_file;
118 118
 		// if $main_file is not set yet
119
-		if ( ! $main_file ) {
120
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
119
+		if ( ! $main_file) {
120
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
121 121
 		}
122
-		 if ( $plugin == $main_file ) {
122
+		 if ($plugin == $main_file) {
123 123
 		 	// compare current plugin to this one
124
-			if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
125
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
126
-				array_unshift( $links, $maintenance_link );
124
+			if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
125
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
126
+				array_unshift($links, $maintenance_link);
127 127
 			} else {
128
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
129
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
128
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
129
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
130 130
 				// add before other links
131
-				array_unshift( $links, $org_settings_link, $events_link );
131
+				array_unshift($links, $org_settings_link, $events_link);
132 132
 			}
133 133
 		}
134 134
 		return $links;
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 *	@return void
144 144
 	 */
145 145
 	public function get_request() {
146
-		EE_Registry::instance()->load_core( 'Request_Handler' );
147
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
146
+		EE_Registry::instance()->load_core('Request_Handler');
147
+		EE_Registry::instance()->load_core('CPT_Strategy');
148 148
 	}
149 149
 
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param array $admin_page_folder_names
157 157
 	 * @return array
158 158
 	 */
159
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
159
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
160 160
 		return array(
161
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
162
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
163
-			'support' => EE_ADMIN_PAGES . 'support' . DS
161
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
162
+			'about' => EE_ADMIN_PAGES.'about'.DS,
163
+			'support' => EE_ADMIN_PAGES.'support'.DS
164 164
 		);
165 165
 	}
166 166
 
@@ -175,36 +175,36 @@  discard block
 block discarded – undo
175 175
 	public function init() {
176 176
 
177 177
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
178
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
178
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
179 179
 			//ok so we want to enable the entire admin
180
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
181
-			add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 );
182
-			add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 );
183
-			add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
184
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
185
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
180
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
181
+			add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2);
182
+			add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3);
183
+			add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
184
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
185
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
186 186
 			//at a glance dashboard widget
187
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 );
187
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
188 188
 			//filter for get_edit_post_link used on comments for custom post types
189
-			add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 );
189
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
190 190
 		}
191 191
 
192 192
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
193
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
193
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
194 194
 			try {
195 195
 				//this loads the controller for the admin pages which will setup routing etc
196
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
197
-			} catch ( EE_Error $e ) {
196
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
197
+			} catch (EE_Error $e) {
198 198
 				$e->get_error();
199 199
 			}
200 200
 		}
201 201
 
202 202
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
203
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
204
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
203
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
204
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
205 205
 
206 206
 		//exclude EE critical pages from all nav menus and wp_list_pages
207
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
207
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
208 208
 	}
209 209
 
210 210
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param  object $post_type WP post type object
218 218
 	 * @return object            WP post type object
219 219
 	 */
220
-	public function remove_pages_from_nav_menu( $post_type ) {
220
+	public function remove_pages_from_nav_menu($post_type) {
221 221
 		//if this isn't the "pages" post type let's get out
222
-		if ( $post_type->name !== 'page' )
222
+		if ($post_type->name !== 'page')
223 223
 			return $post_type;
224 224
 
225 225
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -239,28 +239,28 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function enable_hidden_ee_nav_menu_metaboxes() {
241 241
 		global $wp_meta_boxes, $pagenow;
242
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
242
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
243 243
 			return;
244 244
 		}
245 245
 		$user = wp_get_current_user();
246 246
 		//has this been done yet?
247
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
247
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
248 248
 			return;
249 249
 		}
250 250
 
251
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
252
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
251
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
252
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
253 253
 
254
-		if ( is_array( $hidden_meta_boxes ) ) {
255
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
256
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
257
-					unset( $hidden_meta_boxes[ $key ] );
254
+		if (is_array($hidden_meta_boxes)) {
255
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
256
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
257
+					unset($hidden_meta_boxes[$key]);
258 258
 				}
259 259
 			}
260 260
 		}
261 261
 
262
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
263
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
262
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
263
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
264 264
 	}
265 265
 
266 266
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return void
280 280
 	 */
281 281
 	public function register_custom_nav_menu_boxes() {
282
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
282
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
283 283
 	}
284 284
 
285 285
 
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return string  the (maybe) modified link
298 298
 	 */
299
-	public function modify_edit_post_link( $link, $id, $context ) {
300
-		if ( ! $post = get_post( $id ) )
299
+	public function modify_edit_post_link($link, $id, $context) {
300
+		if ( ! $post = get_post($id))
301 301
 			return $link;
302 302
 
303
-		if ( $post->post_type == 'espresso_attendees' ) {
303
+		if ($post->post_type == 'espresso_attendees') {
304 304
 			$query_args = array(
305 305
 				'action' => 'edit_attendee',
306 306
 				'post' => $id
307 307
 				);
308 308
 			EE_Registry::instance()->load_helper('URL');
309
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
309
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
310 310
 		}
311 311
 		return $link;
312 312
 	}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		global $nav_menu_selected_id;
319 319
 
320 320
 		$db_fields = false;
321
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
321
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
322 322
 		$current_tab = 'event-archives';
323 323
 
324 324
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 		?>
338 338
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
339 339
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
340
-				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
341
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
342
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
340
+				<li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>>
341
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
342
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
343 343
 					</a>
344 344
 				</li>
345 345
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
  			<?php */ ?>
358 358
 
359 359
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
360
-			echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
360
+			echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
361 361
 			?>">
362 362
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
363 363
 					<?php
364 364
 					$pages = $this->_get_extra_nav_menu_pages_items();
365 365
 					$args['walker'] = $walker;
366
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
366
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
367 367
 					?>
368 368
 				</ul>
369 369
 			</div><!-- /.tabs-panel -->
@@ -371,18 +371,18 @@  discard block
 block discarded – undo
371 371
 			<p class="button-controls">
372 372
 				<span class="list-controls">
373 373
 					<a href="<?php
374
-						echo esc_url( add_query_arg(
374
+						echo esc_url(add_query_arg(
375 375
 							array(
376 376
 								'extra-nav-menu-pages-tab' => 'event-archives',
377 377
 								'selectall' => 1,
378 378
 							),
379
-							remove_query_arg( $removed_args )
379
+							remove_query_arg($removed_args)
380 380
 						));
381 381
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
382 382
 				</span>
383 383
 
384 384
 				<span class="add-to-menu">
385
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
385
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
386 386
 					<span class="spinner"></span>
387 387
 				</span>
388 388
 			</p>
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 	private function _get_extra_nav_menu_pages_items() {
404 404
 		$menuitems[] = array(
405 405
 			'title' => __('Event List', 'event_espresso'),
406
-			'url' => get_post_type_archive_link( 'espresso_events' ),
406
+			'url' => get_post_type_archive_link('espresso_events'),
407 407
 			'description' => __('Archive page for all events.', 'event_espresso')
408 408
 		);
409
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
409
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
410 410
 	}
411 411
 
412 412
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * @param $menu_item_values
419 419
 	 * @return stdClass
420 420
 	 */
421
-	private function _setup_extra_nav_menu_pages_items( $menu_item_values ) {
421
+	private function _setup_extra_nav_menu_pages_items($menu_item_values) {
422 422
 		$menu_item = new stdClass();
423 423
 		$keys = array(
424 424
 			'ID' => 0,
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 			'xfn' => ''
439 439
 		);
440 440
 
441
-		foreach ( $keys as $key => $value) {
442
-			$menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value;
441
+		foreach ($keys as $key => $value) {
442
+			$menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value;
443 443
 		}
444 444
 		return $menu_item;
445 445
 	}
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
 		 * - check if doing post processing of one of EE CPTs
479 479
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
480 480
 		 */
481
-		if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) {
482
-			if ( isset( $_POST['post_type'] ) ) {
483
-				EE_Registry::instance()->load_core( 'Register_CPTs' );
484
-				EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
481
+		if (isset($_POST['action']) && $_POST['action'] == 'editpost') {
482
+			if (isset($_POST['post_type'])) {
483
+				EE_Registry::instance()->load_core('Register_CPTs');
484
+				EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
485 485
 			}
486 486
 		}
487 487
 
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
492 492
 		 */
493 493
 		global $pagenow;
494
-		if ( $pagenow == 'options-reading.php' ) {
495
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
494
+		if ($pagenow == 'options-reading.php') {
495
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
496 496
 		}
497 497
 
498 498
 	}
@@ -504,25 +504,25 @@  discard block
 block discarded – undo
504 504
 	 * @param string $output  Current output.
505 505
 	 * @return string
506 506
 	 */
507
-	public function modify_dropdown_pages( $output ) {
507
+	public function modify_dropdown_pages($output) {
508 508
 		//get critical pages
509 509
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
510 510
 
511 511
 		//split current output by line break for easier parsing.
512
-		$split_output = explode( "\n", $output );
512
+		$split_output = explode("\n", $output);
513 513
 
514 514
 		//loop through to remove any critical pages from the array.
515
-		foreach ( $critical_pages as $page_id ) {
516
-			$needle = 'value="' . $page_id . '"';
517
-			foreach( $split_output as $key => $haystack ) {
518
-				if( strpos( $haystack, $needle ) !== false ) {
519
-					unset( $split_output[$key] );
515
+		foreach ($critical_pages as $page_id) {
516
+			$needle = 'value="'.$page_id.'"';
517
+			foreach ($split_output as $key => $haystack) {
518
+				if (strpos($haystack, $needle) !== false) {
519
+					unset($split_output[$key]);
520 520
 				}
521 521
 			}
522 522
 		}
523 523
 
524 524
 		//replace output with the new contents
525
-		$output = implode( "\n", $split_output );
525
+		$output = implode("\n", $split_output);
526 526
 
527 527
 		return $output;
528 528
 	}
@@ -538,37 +538,37 @@  discard block
 block discarded – undo
538 538
 	public function enqueue_admin_scripts() {
539 539
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
540 540
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
541
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
541
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
542 542
 		// register cookie script for future dependencies
543
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
543
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
544 544
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
545
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
545
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
546 546
 			// register jQuery Validate
547
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
547
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
548 548
 		}
549 549
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
550
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
550
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
551 551
 			//joyride style
552
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
553
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
554
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
552
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
553
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
554
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
555 555
 			//joyride JS
556
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
556
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
557 557
 			// wanna go for a joyride?
558 558
 			wp_enqueue_style('ee-joyride-css');
559 559
 			wp_enqueue_script('jquery-joyride');
560 560
 		}
561 561
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
562
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
562
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
563 563
 			EE_Registry::instance()->load_helper('Qtip_Loader');
564 564
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
565 565
 		}
566 566
 		//accounting.js library
567 567
 		// @link http://josscrowcroft.github.io/accounting.js/
568
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
569
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
570
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
571
-			wp_enqueue_script( 'ee-accounting' );
568
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
569
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
570
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
571
+			wp_enqueue_script('ee-accounting');
572 572
 			// array of settings to get converted to JSON array via wp_localize_script
573 573
 			$currency_config = array(
574 574
 				'currency' => array(
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 	public function get_persistent_admin_notices() {
616 616
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
617 617
 		$args = array(
618
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
619
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
618
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
619
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
620 620
 		);
621
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
622
-		echo EE_Error::get_persistent_admin_notices( $return_url );
621
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
622
+		echo EE_Error::get_persistent_admin_notices($return_url);
623 623
 	}
624 624
 
625 625
 
@@ -640,26 +640,26 @@  discard block
 block discarded – undo
640 640
 	 * @param $elements
641 641
 	 * @return array
642 642
 	 */
643
-	public function dashboard_glance_items( $elements ) {
643
+	public function dashboard_glance_items($elements) {
644 644
 		$events = EEM_Event::instance()->count();
645
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
646
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
645
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
646
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
647 647
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
648 648
 		$registrations = EEM_Registration::instance()->count(
649 649
 			array(
650 650
 				array(
651
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
651
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
652 652
 				)
653 653
 			)
654 654
 		);
655
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
656
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
655
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
656
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
657 657
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
658 658
 
659
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
659
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
660 660
 
661
-		foreach ( $items as $type => $item_properties ) {
662
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
661
+		foreach ($items as $type => $item_properties) {
662
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
663 663
 		}
664 664
 		return $elements;
665 665
 	}
@@ -678,63 +678,63 @@  discard block
 block discarded – undo
678 678
 	 * @param $post
679 679
 	 * @return    void
680 680
 	 */
681
-	public static function parse_post_content_on_save( $post_ID, $post ) {
681
+	public static function parse_post_content_on_save($post_ID, $post) {
682 682
 		// default post types
683
-		$post_types = array( 'post' => 0, 'page' => 1 );
683
+		$post_types = array('post' => 0, 'page' => 1);
684 684
 		// add CPTs
685 685
 		$CPTs = EE_Register_CPTs::get_CPTs();
686
-		$post_types = array_merge( $post_types, $CPTs );
686
+		$post_types = array_merge($post_types, $CPTs);
687 687
 		// for default or CPT posts...
688
-		if ( isset( $post_types[ $post->post_type ] )) {
688
+		if (isset($post_types[$post->post_type])) {
689 689
 			// post on frontpage ?
690 690
 			$page_for_posts = EE_Config::get_page_for_posts();
691 691
 			$maybe_remove_from_posts = array();
692 692
 			// critical page shortcodes that we do NOT want added to the Posts page (blog)
693 693
 			$critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
694 694
 			// array of shortcodes indexed by post name
695
-			EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
695
+			EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
696 696
 			// whether to proceed with update, if an entry already exists for this post, then we want to update
697
-			$update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false;
697
+			$update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false;
698 698
 			// empty both arrays
699
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array();
699
+			EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
700 700
 			// check that posts page is already being tracked
701
-			if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
701
+			if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
702 702
 				// if not, then ensure that it is properly added
703
-				EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array();
703
+				EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
704 704
 			}
705 705
 			// loop thru shortcodes
706
-			foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
706
+			foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
707 707
 				// convert to UPPERCASE to get actual shortcode
708
-				$EES_Shortcode = strtoupper( $EES_Shortcode );
708
+				$EES_Shortcode = strtoupper($EES_Shortcode);
709 709
 				// is the shortcode in the post_content ?
710
-				if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) {
710
+				if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
711 711
 					// map shortcode to post names and post IDs
712
-					EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
712
+					EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
713 713
 					// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
714
-					if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) {
714
+					if ( ! in_array($EES_Shortcode, $critical_shortcodes)) {
715 715
 						// add shortcode to "Posts page" tracking
716
-						EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID;
716
+						EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
717 717
 					}
718 718
 					$update_post_shortcodes = TRUE;
719
-					unset( $maybe_remove_from_posts[ $EES_Shortcode ] );
719
+					unset($maybe_remove_from_posts[$EES_Shortcode]);
720 720
 				} else {
721
-					$maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID;
721
+					$maybe_remove_from_posts[$EES_Shortcode] = $post_ID;
722 722
 				}
723 723
 			}
724
-			if ( $update_post_shortcodes ) {
724
+			if ($update_post_shortcodes) {
725 725
 				// remove shortcodes from $maybe_remove_from_posts that are still being used
726
-				foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) {
727
-					if ( $post_name == $page_for_posts ) {
726
+				foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) {
727
+					if ($post_name == $page_for_posts) {
728 728
 						continue;
729 729
 					}
730 730
 					// compute difference between active post_shortcodes array and $maybe_remove_from_posts array
731
-					$maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes );
731
+					$maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes);
732 732
 				}
733 733
 				// now unset unused shortcodes from the $page_for_posts post_shortcodes
734
-				foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) {
735
-					unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] );
734
+				foreach ($maybe_remove_from_posts as $shortcode => $post_ID) {
735
+					unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]);
736 736
 				}
737
-				EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts );
737
+				EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
738 738
 			}
739 739
 		}
740 740
 	}
@@ -752,32 +752,32 @@  discard block
 block discarded – undo
752 752
 	 * @throws EE_Error
753 753
 	 * @return    string
754 754
 	 */
755
-	public function check_for_invalid_datetime_formats( $value, $option ) {
756
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
755
+	public function check_for_invalid_datetime_formats($value, $option) {
756
+		EE_Registry::instance()->load_helper('DTT_Helper');
757 757
 		// check for date_format or time_format
758
-		switch ( $option ) {
758
+		switch ($option) {
759 759
 			case 'date_format' :
760
-				$date_time_format = $value . ' ' . get_option('time_format');
760
+				$date_time_format = $value.' '.get_option('time_format');
761 761
 				break;
762 762
 			case 'time_format' :
763
-				$date_time_format = get_option('date_format') . ' ' . $value;
763
+				$date_time_format = get_option('date_format').' '.$value;
764 764
 				break;
765 765
 			default :
766 766
 				$date_time_format = FALSE;
767 767
 		}
768 768
 		// do we have a date_time format to check ?
769
-		if ( $date_time_format ) {
770
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
769
+		if ($date_time_format) {
770
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
771 771
 
772
-			if ( is_array( $error_msg ) ) {
773
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
772
+			if (is_array($error_msg)) {
773
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
774 774
 
775 775
 
776
-				foreach ( $error_msg as $error ) {
777
-					$msg .= '<li>' . $error . '</li>';
776
+				foreach ($error_msg as $error) {
777
+					$msg .= '<li>'.$error.'</li>';
778 778
 				}
779 779
 
780
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
780
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
781 781
 
782 782
 				// trigger WP settings error
783 783
 				add_settings_error(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 				);
788 788
 
789 789
 				// set format to something valid
790
-				switch ( $option ) {
790
+				switch ($option) {
791 791
 					case 'date_format' :
792 792
 						$value = 'F j, Y';
793 793
 						break;
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 	 * @param 	$value
814 814
 	 * @return 	void
815 815
 	 */
816
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
817
-		if ( $option == 'page_for_posts' ) {
816
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
817
+		if ($option == 'page_for_posts') {
818 818
 			global $wpdb;
819
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
820
-			$old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts';
821
-			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts';
822
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ];
823
-			EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts );
819
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
820
+			$old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts';
821
+			$new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
822
+			EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts];
823
+			EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts);
824 824
 		}
825 825
 	}
826 826
 
@@ -833,8 +833,8 @@  discard block
 block discarded – undo
833 833
 	 * @param $content
834 834
 	 * @return    string
835 835
 	 */
836
-	public function its_eSpresso( $content ) {
837
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
836
+	public function its_eSpresso($content) {
837
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
838 838
 	}
839 839
 
840 840
 
@@ -847,9 +847,9 @@  discard block
 block discarded – undo
847 847
 	 */
848 848
 	public function espresso_admin_footer() {
849 849
 		return sprintf(
850
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
850
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
851 851
 			'<a href="https://eventespresso.com/" title="',
852
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
852
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
853 853
 		);
854 854
 	}
855 855
 
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
 	 * @param array $config
870 870
 	 * @return void
871 871
 	 */
872
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
873
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
874
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
872
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
873
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
874
+		if (class_exists('EE_Register_Admin_Page'))
875 875
 			$config['page_path'] = $page_path;
876
-			EE_Register_Admin_Page::register( $page_basename, $config );
876
+			EE_Register_Admin_Page::register($page_basename, $config);
877 877
 	}
878 878
 
879 879
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_List_Table.core.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
  */
33 33
 
34 34
 if ( ! class_exists( 'WP_List_Table' )) {
35
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
35
+	require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
36 36
 }
37 37
 
38 38
 abstract class EE_Admin_List_Table extends WP_List_Table {
Please login to merge, or discard this patch.
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 
6 7
 /**
@@ -362,8 +363,9 @@  discard block
 block discarded – undo
362 363
 
363 364
 		$sortable = array();
364 365
 		foreach ( $_sortable as $id => $data ) {
365
-			if ( empty( $data ) )
366
-				continue;
366
+			if ( empty( $data ) ) {
367
+							continue;
368
+			}
367 369
 
368 370
 			//fix for offset errors with WP_List_Table default get_columninfo()
369 371
 			if ( is_array($data) ) {
@@ -375,8 +377,9 @@  discard block
 block discarded – undo
375 377
 
376 378
 			$data = (array) $data;
377 379
 
378
-			if ( !isset( $data[1] ) )
379
-				$_data[1] = false;
380
+			if ( !isset( $data[1] ) ) {
381
+							$_data[1] = false;
382
+			}
380 383
 
381 384
 
382 385
 			$sortable[$id] = $_data;
@@ -399,11 +402,12 @@  discard block
 block discarded – undo
399 402
 		$actions = array();
400 403
 		//the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table();
401 404
 		foreach ( $this->_views as $view => $args) {
402
-			if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view )
403
-				//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
405
+			if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view ) {
406
+							//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
404 407
 				foreach ( $args['bulk_action'] as $route =>$label ) {
405 408
 					if ( $this->_admin_page->check_user_access( $route, true ) ) {
406 409
 						$actions[$route] = $label;
410
+			}
407 411
 					}
408 412
 				}
409 413
 		}
@@ -633,14 +637,12 @@  discard block
 block discarded – undo
633 637
 				echo '<th scope="row" class="check-column">';
634 638
 				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
635 639
 				echo '</th>';
636
-			}
637
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
640
+			} elseif ( method_exists( $this, 'column_' . $column_name ) ) {
638 641
 				echo "<td $attributes>";
639 642
 				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
640 643
 				echo $this->handle_row_actions( $item, $column_name, $primary );
641 644
 				echo "</td>";
642
-			}
643
-			else {
645
+			} else {
644 646
 				echo "<td $attributes>";
645 647
 				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
646 648
 				echo $this->handle_row_actions( $item, $column_name, $primary );
@@ -656,7 +658,7 @@  discard block
 block discarded – undo
656 658
 			$this->_filters();
657 659
 			echo $this->_get_hidden_fields();
658 660
 			echo '<br class="clear">';
659
-		}else{
661
+		} else{
660 662
 			echo '<div class="list-table-bottom-buttons alignleft actions">';
661 663
 			foreach($this->_bottom_buttons as $type => $action){
662 664
 				$route = isset( $action['route'] ) ? $action['route'] : '';
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
  * ------------------------------------------------------------------------
32 32
  */
33 33
 
34
-if ( ! class_exists( 'WP_List_Table' )) {
35
-    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
34
+if ( ! class_exists('WP_List_Table')) {
35
+    require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');
36 36
 }
37 37
 
38 38
 abstract class EE_Admin_List_Table extends WP_List_Table {
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 	 * constructor
235 235
 	 * @param EE_Admin_Page object $admin_page we use this for obtaining everything we need in the list table.
236 236
 	 */
237
-	public function __construct( EE_Admin_Page $admin_page ) {
237
+	public function __construct(EE_Admin_Page $admin_page) {
238 238
 		$this->_admin_page = $admin_page;
239 239
 		$this->_req_data = $this->_admin_page->get_request_data();
240 240
 		$this->_view = $this->_admin_page->get_view();
241
-		$this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
241
+		$this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views;
242 242
 		$this->_current_page = $this->get_pagenum();
243
-		$this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view();
244
-		$this->_yes_no = array(  __('No', 'event_espresso'), __('Yes', 'event_espresso'));
243
+		$this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view();
244
+		$this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso'));
245 245
 
246
-		$this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 );
246
+		$this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10);
247 247
 
248 248
 		$this->_setup_data();
249 249
 		$this->_add_view_counts();
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		$this->_set_properties();
254 254
 
255 255
 		//set primary column
256
-		add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) );
256
+		add_filter('list_table_primary_column', array($this, 'set_primary_column'));
257 257
 
258 258
 		//set parent defaults
259 259
 		parent::__construct($this->_wp_list_args);
@@ -329,17 +329,17 @@  discard block
 block discarded – undo
329 329
 	 * @return html string
330 330
 	 */
331 331
 	protected function _get_hidden_fields() {
332
-		$action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : '';
333
-		$action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action;
332
+		$action = isset($this->_req_data['route']) ? $this->_req_data['route'] : '';
333
+		$action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action;
334 334
 		//if action is STILL empty, then we set it to default
335
-		$action = empty( $action ) ? 'default' : $action;
336
-		$field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n";
337
-		$field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/
338
-		$field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n";
335
+		$action = empty($action) ? 'default' : $action;
336
+		$field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n";
337
+		$field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/
338
+		$field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n";
339 339
 
340 340
 		$bulk_actions = $this->_get_bulk_actions();
341
-		foreach ( $bulk_actions as $bulk_action => $label ) {
342
-			$field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce  ( $bulk_action . '_nonce' ) . '" />' . "\n";
341
+		foreach ($bulk_actions as $bulk_action => $label) {
342
+			$field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n";
343 343
 		}
344 344
 
345 345
 		return $field;
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
 		 *
370 370
 		 * @var array
371 371
 		 */
372
-		$_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen );
372
+		$_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen);
373 373
 
374 374
 		$sortable = array();
375
-		foreach ( $_sortable as $id => $data ) {
376
-			if ( empty( $data ) )
375
+		foreach ($_sortable as $id => $data) {
376
+			if (empty($data))
377 377
 				continue;
378 378
 
379 379
 			//fix for offset errors with WP_List_Table default get_columninfo()
380
-			if ( is_array($data) ) {
380
+			if (is_array($data)) {
381 381
 				$_data[0] = key($data);
382 382
 				$_data[1] = isset($data[1]) ? $data[1] : false;
383 383
 			} else {
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
 
387 387
 			$data = (array) $data;
388 388
 
389
-			if ( !isset( $data[1] ) )
389
+			if ( ! isset($data[1]))
390 390
 				$_data[1] = false;
391 391
 
392 392
 
393 393
 			$sortable[$id] = $_data;
394 394
 		}
395 395
 		$primary = $this->get_primary_column_name();
396
-		$this->_column_headers = array( $columns, $hidden, $sortable, $primary );
396
+		$this->_column_headers = array($columns, $hidden, $sortable, $primary);
397 397
 	}
398 398
 
399 399
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	 * @return string
403 403
 	 */
404 404
 	protected function get_primary_column_name() {
405
-		foreach( class_parents( $this ) as $parent ) {
406
-			if ( method_exists( $parent, 'get_primary_column_name' ) && $parent == 'WP_List_Table' ) {
405
+		foreach (class_parents($this) as $parent) {
406
+			if (method_exists($parent, 'get_primary_column_name') && $parent == 'WP_List_Table') {
407 407
 				return parent::get_primary_column_name();
408 408
 			}
409 409
 		}
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 	 * Added for WP4.1 backward compat (@see https://events.codebasehq.com/projects/event-espresso/tickets/8814)
416 416
 	 * @return string
417 417
 	 */
418
-	protected function handle_row_actions( $item, $column_name, $primary ) {
419
-		foreach( class_parents( $this ) as $parent ) {
420
-			if ( method_exists( $parent, 'handle_row_actions' ) && $parent == 'WP_List_Table' ) {
421
-				return parent::handle_row_actions( $item, $column_name, $primary );
418
+	protected function handle_row_actions($item, $column_name, $primary) {
419
+		foreach (class_parents($this) as $parent) {
420
+			if (method_exists($parent, 'handle_row_actions') && $parent == 'WP_List_Table') {
421
+				return parent::handle_row_actions($item, $column_name, $primary);
422 422
 			}
423 423
 		}
424 424
 		'';
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 	protected function _get_bulk_actions() {
437 437
 		$actions = array();
438 438
 		//the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table();
439
-		foreach ( $this->_views as $view => $args) {
440
-			if ( isset( $args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view )
439
+		foreach ($this->_views as $view => $args) {
440
+			if (isset($args['bulk_action']) && is_array($args['bulk_action']) && $this->_view == $view)
441 441
 				//each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user.
442
-				foreach ( $args['bulk_action'] as $route =>$label ) {
443
-					if ( $this->_admin_page->check_user_access( $route, true ) ) {
442
+				foreach ($args['bulk_action'] as $route =>$label) {
443
+					if ($this->_admin_page->check_user_access($route, true)) {
444 444
 						$actions[$route] = $label;
445 445
 					}
446 446
 				}
@@ -458,18 +458,18 @@  discard block
 block discarded – undo
458 458
 	 */
459 459
 	private function _filters() {
460 460
 		$classname = get_class($this);
461
-		$filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen );
461
+		$filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen);
462 462
 
463
-		if ( empty( $filters )) {
463
+		if (empty($filters)) {
464 464
 			return;
465 465
 		}
466
-		foreach ( $filters as $filter ) {
466
+		foreach ($filters as $filter) {
467 467
 			echo $filter;
468 468
 		}
469 469
 		//add filter button at end
470
-		echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />';
470
+		echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />';
471 471
 		//add reset filters button at end
472
-		echo '<a class="button button-secondary"  href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>';
472
+		echo '<a class="button button-secondary"  href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>';
473 473
 	}
474 474
 
475 475
 
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 	 * @param string $column_name
484 484
 	 * @return string
485 485
 	 */
486
-	public function set_primary_column( $column_name ) {
487
-		return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name;
486
+	public function set_primary_column($column_name) {
487
+		return ! empty($this->_primary_column) ? $this->_primary_column : $column_name;
488 488
 	}
489 489
 
490 490
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			array(
504 504
 				'total_items' => $total_items,
505 505
 				'per_page' => $this->_per_page,
506
-				'total_pages' => ceil($total_items / $this->_per_page )
506
+				'total_pages' => ceil($total_items / $this->_per_page)
507 507
 			)
508 508
 		);
509 509
 	}
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 *
520 520
 	 * @return string html content for the column
521 521
 	 */
522
-	public function column_default( $item, $column_name ) {
522
+	public function column_default($item, $column_name) {
523 523
 		/**
524 524
 		 * Dynamic hook allowing for adding additional column content in this list table.
525 525
 		 * Note that $this->screen->id is in the format
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		 * hook prefix ("event-espresso") will be different.
530 530
 		 *
531 531
 		 */
532
-		do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen );
532
+		do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen);
533 533
 	}
534 534
 
535 535
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		 *
546 546
 		 * @var array
547 547
 		 */
548
-		$columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen );
548
+		$columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen);
549 549
 		return $columns;
550 550
 	}
551 551
 
@@ -557,18 +557,18 @@  discard block
 block discarded – undo
557 557
 		$views = $this->get_views();
558 558
 		$assembled_views = '';
559 559
 
560
-		if ( empty( $views )) {
560
+		if (empty($views)) {
561 561
 			return;
562 562
 		}
563 563
 		echo "<ul class='subsubsub'>\n";
564
-		foreach ( $views as $view ) {
565
-			$count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] )  : 0;
566
-			if ( isset( $view['slug'] ) && isset( $view['class'] ) && isset( $view['url'] ) && isset( $view['label']) ) {
567
-				$assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>';
564
+		foreach ($views as $view) {
565
+			$count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0;
566
+			if (isset($view['slug']) && isset($view['class']) && isset($view['url']) && isset($view['label'])) {
567
+				$assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>';
568 568
 			}
569 569
 		}
570 570
 
571
-		echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : '';
571
+		echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : '';
572 572
 		echo "</ul>";
573 573
 	}
574 574
 
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @param object $item The current item
583 583
 	 */
584
-	public function single_row( $item ) {
585
-		$row_class = $this->_get_row_class( $item );
586
-		echo '<tr class="' . esc_attr( $row_class ) . '">';
587
-		$this->single_row_columns( $item );
584
+	public function single_row($item) {
585
+		$row_class = $this->_get_row_class($item);
586
+		echo '<tr class="'.esc_attr($row_class).'">';
587
+		$this->single_row_columns($item);
588 588
 		echo '</tr>';
589 589
 	}
590 590
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
 	 * @param  object $item the current item
596 596
 	 * @return string
597 597
 	 */
598
-	protected function _get_row_class( $item ) {
598
+	protected function _get_row_class($item) {
599 599
 		static $row_class = '';
600
-		$row_class = ( $row_class == '' ? 'alternate' : '' );
600
+		$row_class = ($row_class == '' ? 'alternate' : '');
601 601
 
602 602
 		$new_row_class = $row_class;
603 603
 
604
-		if ( !empty($this->_ajax_sorting_callback) ) {
604
+		if ( ! empty($this->_ajax_sorting_callback)) {
605 605
 			$new_row_class .= ' rowsortable';
606 606
 		}
607 607
 
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 
621 621
 	public function get_hidden_columns() {
622 622
 		$user_id = get_current_user_id();
623
-		$has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id);
624
-		if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) {
625
-			update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE);
626
-			update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE );
623
+		$has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id);
624
+		if (empty($has_default) && ! empty($this->_hidden_columns)) {
625
+			update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE);
626
+			update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE);
627 627
 		}
628
-		$ref = 'manage' . $this->screen->id . 'columnshidden';
629
-		$saved_columns = (array) get_user_option( $ref, $user_id );
628
+		$ref = 'manage'.$this->screen->id.'columnshidden';
629
+		$saved_columns = (array) get_user_option($ref, $user_id);
630 630
 		return $saved_columns;
631 631
 	}
632 632
 
@@ -641,47 +641,47 @@  discard block
 block discarded – undo
641 641
 	 *
642 642
 	 * @param object $item The current item
643 643
 	 */
644
-	public function single_row_columns( $item ) {
645
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
644
+	public function single_row_columns($item) {
645
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
646 646
 
647 647
 		global $wp_version;
648
-		$use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' );
648
+		$use_hidden_class = version_compare($wp_version, '4.3-RC', '>=');
649 649
 
650
-		foreach ( $columns as $column_name => $column_display_name ) {
650
+		foreach ($columns as $column_name => $column_display_name) {
651 651
 
652 652
 			/**
653 653
 			 * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are
654 654
 			 * hidden or not instead of using "display:none;".  This bit of code provides backward compat.
655 655
 			 */
656
-			$hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : '';
657
-			$style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : '';
656
+			$hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : '';
657
+			$style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : '';
658 658
 
659
-			$classes = $column_name . ' column-' . $column_name.$hidden_class;
660
-			if ( $primary == $column_name ) {
659
+			$classes = $column_name.' column-'.$column_name.$hidden_class;
660
+			if ($primary == $column_name) {
661 661
 				$classes .= ' has-row-actions column-primary';
662 662
 			}
663 663
 
664
-			$data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
664
+			$data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"';
665 665
 
666 666
 			$class = "class='$classes'";
667 667
 
668 668
 			$attributes = "$class$style$data";
669 669
 
670
-			if ( 'cb' === $column_name ) {
670
+			if ('cb' === $column_name) {
671 671
 				echo '<th scope="row" class="check-column">';
672
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this );
672
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this);
673 673
 				echo '</th>';
674 674
 			}
675
-			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
675
+			elseif (method_exists($this, 'column_'.$column_name)) {
676 676
 				echo "<td $attributes>";
677
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this );
678
-				echo $this->handle_row_actions( $item, $column_name, $primary );
677
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this);
678
+				echo $this->handle_row_actions($item, $column_name, $primary);
679 679
 				echo "</td>";
680 680
 			}
681 681
 			else {
682 682
 				echo "<td $attributes>";
683
-				echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this );
684
-				echo $this->handle_row_actions( $item, $column_name, $primary );
683
+				echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this);
684
+				echo $this->handle_row_actions($item, $column_name, $primary);
685 685
 				echo "</td>";
686 686
 			}
687 687
 		}
@@ -689,19 +689,19 @@  discard block
 block discarded – undo
689 689
 
690 690
 
691 691
 
692
-	public function extra_tablenav( $which ) {
693
-		if ( $which == 'top' ) {
692
+	public function extra_tablenav($which) {
693
+		if ($which == 'top') {
694 694
 			$this->_filters();
695 695
 			echo $this->_get_hidden_fields();
696 696
 			echo '<br class="clear">';
697
-		}else{
697
+		} else {
698 698
 			echo '<div class="list-table-bottom-buttons alignleft actions">';
699
-			foreach($this->_bottom_buttons as $type => $action){
700
-				$route = isset( $action['route'] ) ? $action['route'] : '';
701
-				$extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : '';
699
+			foreach ($this->_bottom_buttons as $type => $action) {
700
+				$route = isset($action['route']) ? $action['route'] : '';
701
+				$extra_request = isset($action['extra_request']) ? $action['extra_request'] : '';
702 702
 				echo $this->_admin_page->get_action_link_or_button($route, $type, $extra_request);
703 703
 			}
704
-			do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen );
704
+			do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen);
705 705
 			echo '</div>';
706 706
 		}
707 707
 		//echo $this->_entries_per_page_dropdown;
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @return string The assembled action elements container.
753 753
 	 */
754
-	protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) {
754
+	protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') {
755 755
 		$content = '';
756
-		$action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : '';
757
-		$action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : '';
758
-		$content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : '';
759
-		$content .= apply_filters( 'FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this );
760
-		$content .= ! empty( $container ) ? '</' . $container . '>' : '';
756
+		$action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : '';
757
+		$action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : '';
758
+		$content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : '';
759
+		$content .= apply_filters('FHEE__EE_Admin_List_Table___action_string__action_items', $action_items, $item, $this);
760
+		$content .= ! empty($container) ? '</'.$container.'>' : '';
761 761
 		return $content;
762 762
 	}
763 763
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -594,7 +594,7 @@
 block discarded – undo
594 594
 	 * @since 4.1
595 595
 	 * @access public
596 596
 	 *
597
-	 * @param object $item The current item
597
+	 * @param EE_Message_Template_Group $item The current item
598 598
 	 */
599 599
 	public function single_row( $item ) {
600 600
 		$row_class = $this->_get_row_class( $item );
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT.core.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@
 block discarded – undo
78 78
 
79 79
 
80 80
 	/**
81
-	* @var EE_CPT_Base
82
-	*/
81
+	 * @var EE_CPT_Base
82
+	 */
83 83
 	protected $_cpt_model_obj = FALSE;
84 84
 
85 85
 
Please login to merge, or discard this patch.
Braces   +52 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EE_Admin_Page_CPT class
4 6
  *
@@ -231,8 +233,9 @@  discard block
 block discarded – undo
231 233
 
232 234
 		$containers = array();
233 235
 
234
-		if ( empty( $wp_meta_boxes ) )
235
-			return;
236
+		if ( empty( $wp_meta_boxes ) ) {
237
+					return;
238
+		}
236 239
 
237 240
 		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
238 241
 
@@ -336,8 +339,9 @@  discard block
 block discarded – undo
336 339
 
337 340
 
338 341
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
339
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
340
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
342
+		if ( method_exists( $this, 'extra_permalink_field_buttons' ) ) {
343
+					add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
344
+		}
341 345
 
342 346
 		//add preview button
343 347
 		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
@@ -347,12 +351,14 @@  discard block
 block discarded – undo
347 351
 		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
348 352
 
349 353
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
350
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
351
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
354
+		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) ) {
355
+					add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
356
+		}
352 357
 
353 358
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
354
-		if ( method_exists( $this, 'edit_form_after_title' ) )
355
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
359
+		if ( method_exists( $this, 'edit_form_after_title' ) ) {
360
+					add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
361
+		}
356 362
 
357 363
 
358 364
 		/**
@@ -543,7 +549,9 @@  discard block
 block discarded – undo
543 549
 
544 550
 
545 551
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
546
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
552
+		if ( !defined('DOING_AUTOSAVE') ) {
553
+			define('DOING_AUTOSAVE', true);
554
+		}
547 555
 
548 556
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
549 557
 		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
@@ -573,8 +581,9 @@  discard block
 block discarded – undo
573 581
 	protected function _extend_page_config_for_cpt() {
574 582
 
575 583
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
576
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
577
-			return;
584
+		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) ) {
585
+					return;
586
+		}
578 587
 
579 588
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
580 589
 		if ( !empty( $this->_cpt_object ) ) {
@@ -606,8 +615,9 @@  discard block
 block discarded – undo
606 615
 		}
607 616
 
608 617
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
609
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
610
-			return;
618
+		if ( !isset( $this->_cpt_routes[$this->_req_action] ) ) {
619
+					return;
620
+		}
611 621
 
612 622
 
613 623
 		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
@@ -803,8 +813,9 @@  discard block
 block discarded – undo
803 813
 	public function insert_update( $post_id, $post ) {
804 814
 
805 815
 		//make sure that if this is a revision OR trash action that we don't do any updates!
806
-		if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) )
807
-			return;
816
+		if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) ) {
817
+					return;
818
+		}
808 819
 
809 820
 		//check for autosave and update our req_data property accordingly.
810 821
 		/*if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE && isset( $this->_req_data['ee_autosave_data'] ) ) {
@@ -828,8 +839,10 @@  discard block
 block discarded – undo
828 839
 			}
829 840
 		}
830 841
 
831
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
832
-			return; //TODO we'll remove this after reimplementing autosave in 4.2
842
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
843
+					return;
844
+		}
845
+		//TODO we'll remove this after reimplementing autosave in 4.2
833 846
 		$this->_insert_update_cpt_item( $post_id, $post );
834 847
 	}
835 848
 
@@ -900,7 +913,9 @@  discard block
 block discarded – undo
900 913
 	 */
901 914
 	public function modify_current_screen() {
902 915
 		//ONLY do this if the current page_route IS a cpt route
903
-		if ( !$this->_cpt_route ) return;
916
+		if ( !$this->_cpt_route ) {
917
+			return;
918
+		}
904 919
 		//routing things REALLY early b/c this is a cpt admin page
905 920
 		set_current_screen( $this->_cpt_routes[$this->_req_action]);
906 921
 		$this->_current_screen = get_current_screen();
@@ -940,8 +955,9 @@  discard block
 block discarded – undo
940 955
 	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
941 956
 		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
942 957
 			$post = get_post( $id );
943
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
944
-			$shortlink = home_url('?p=' . $post->ID);
958
+			if ( isset($post->post_type) && $this->page_slug == $post->post_type ) {
959
+						$shortlink = home_url('?p=' . $post->ID);
960
+			}
945 961
 		}
946 962
 		return $shortlink;
947 963
 	}
@@ -954,7 +970,9 @@  discard block
 block discarded – undo
954 970
 	 * @return void
955 971
 	 */
956 972
 	public function route_admin_request() {
957
-		if ( $this->_cpt_route ) return;
973
+		if ( $this->_cpt_route ) {
974
+			return;
975
+		}
958 976
 		try {
959 977
 			$this->_route_admin_request();
960 978
 		} catch ( EE_Error $e ) {
@@ -993,8 +1011,9 @@  discard block
 block discarded – undo
993 1011
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
994 1012
 
995 1013
 		//can't do anything without revision so let's get out if not present
996
-		if ( empty( $rev_id ) )
997
-			return $location;
1014
+		if ( empty( $rev_id ) ) {
1015
+					return $location;
1016
+		}
998 1017
 
999 1018
 		//get rev_post_data
1000 1019
 		$rev = get_post($rev_id);
@@ -1023,8 +1042,9 @@  discard block
 block discarded – undo
1023 1042
 	 */
1024 1043
 	public function modify_edit_post_link( $link, $id, $context ) {
1025 1044
 		$post = get_post( $id );
1026
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1027
-			return $link;
1045
+		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) {
1046
+					return $link;
1047
+		}
1028 1048
 		$query_args = array(
1029 1049
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1030 1050
 			'post' => $id
@@ -1044,8 +1064,9 @@  discard block
 block discarded – undo
1044 1064
 	 */
1045 1065
 	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1046 1066
 		$post = get_post($post_id);
1047
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1048
-			return $delete_link;
1067
+		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) ) {
1068
+					return $delete_link;
1069
+		}
1049 1070
 
1050 1071
 		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1051 1072
 	}
@@ -1059,8 +1080,9 @@  discard block
 block discarded – undo
1059 1080
 	 * @return string           url to redirect to
1060 1081
 	 */
1061 1082
 	public function cpt_trash_post_location_redirect( $location, $status ) {
1062
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1063
-			return $location;
1083
+		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) ) {
1084
+					return $location;
1085
+		}
1064 1086
 
1065 1087
 		$post = get_post( $this->_req_data['post'] );
1066 1088
 		$query_args = array( 'action' => 'default' );
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param  object $post    The post object of the cpt that was saved.
114 114
 	 * @return void
115 115
 	 */
116
-	abstract protected function _insert_update_cpt_item( $post_id, $post );
116
+	abstract protected function _insert_update_cpt_item($post_id, $post);
117 117
 
118 118
 
119 119
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param  string $post_id The ID of the cpt that was trashed
127 127
 	 * @return void
128 128
 	 */
129
-	abstract public function trash_cpt_item( $post_id );
129
+	abstract public function trash_cpt_item($post_id);
130 130
 
131 131
 
132 132
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $post_id theID of the cpt that was untrashed
138 138
 	 * @return void
139 139
 	 */
140
-	abstract public function restore_cpt_item( $post_id );
140
+	abstract public function restore_cpt_item($post_id);
141 141
 
142 142
 
143 143
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param  string $post_id the ID of the cpt that was deleted
149 149
 	 * @return void
150 150
 	 */
151
-	abstract public function delete_cpt_item( $post_id );
151
+	abstract public function delete_cpt_item($post_id);
152 152
 
153 153
 
154 154
 
@@ -161,32 +161,32 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function _before_page_setup() {
163 163
 
164
-		$page = isset( $this->_req_data['page'] ) ? $this->_req_data['page'] : $this->page_slug;
164
+		$page = isset($this->_req_data['page']) ? $this->_req_data['page'] : $this->page_slug;
165 165
 
166
-		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes );
166
+		$this->_cpt_routes = array_merge(array('create_new'=>$this->page_slug, 'edit' => $this->page_slug, 'trash' => $this->page_slug), $this->_cpt_routes);
167 167
 
168 168
 		//let's see if the current route has a value for cpt_object_slug if it does we use that instead of the page
169
-		$this->_cpt_object = isset($this->_req_data['action']) && isset( $this->_cpt_routes[$this->_req_data['action']] ) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object( $page );
169
+		$this->_cpt_object = isset($this->_req_data['action']) && isset($this->_cpt_routes[$this->_req_data['action']]) ? get_post_type_object($this->_cpt_routes[$this->_req_data['action']]) : get_post_type_object($page);
170 170
 
171 171
 		//tweak pagenow for page loading.
172
-		if( ! $this->_pagenow_map ) {
172
+		if ( ! $this->_pagenow_map) {
173 173
 			$this->_pagenow_map = array(
174 174
 				'create_new' => 'post-new.php',
175 175
 				'edit' => 'post.php',
176 176
 				'trash' => 'post.php'
177 177
 				);
178 178
 		}
179
-		add_action( 'current_screen', array( $this, 'modify_pagenow') );
179
+		add_action('current_screen', array($this, 'modify_pagenow'));
180 180
 
181 181
 
182 182
 		//TODO the below will need to be reworked to account for the cpt routes that are NOT based off of page but action param.
183 183
 		//get current page from autosave
184
-		$current_page = isset( $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] ) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
-		$this->_current_page = isset( $this->_req_data['current_page'] ) ? $this->_req_data['current_page'] : $current_page;
184
+		$current_page = isset($this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page']) ? $this->_req_data['ee_autosave_data']['ee-cpt-hidden-inputs']['current_page'] : NULL;
185
+		$this->_current_page = isset($this->_req_data['current_page']) ? $this->_req_data['current_page'] : $current_page;
186 186
 
187 187
 
188 188
 		//autosave... make sure its only for the correct page
189
-		if ( !empty($this->_current_page ) && $this->_current_page == $this->page_slug ) {
189
+		if ( ! empty($this->_current_page) && $this->_current_page == $this->page_slug) {
190 190
 			//setup autosave ajax hook
191 191
 			//add_action('wp_ajax_ee-autosave', array( $this, 'do_extra_autosave_stuff' ), 10 ); //TODO reactivate when 4.2 autosave is implemented
192 192
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return void
204 204
 	 */
205
-	public function modify_pagenow( $current_screen ) {
205
+	public function modify_pagenow($current_screen) {
206 206
 		global $pagenow;
207 207
 		//possibly reset pagenow.
208
-		if ( ! empty( $this->_req_data['page'] ) && $this->_req_data['page'] == $this->page_slug && !empty( $this->_req_data['action'] ) && isset( $this->_pagenow_map[$this->_req_data['action'] ] ) ) {
208
+		if ( ! empty($this->_req_data['page']) && $this->_req_data['page'] == $this->page_slug && ! empty($this->_req_data['action']) && isset($this->_pagenow_map[$this->_req_data['action']])) {
209 209
 			$pagenow = $this->_pagenow_map[$this->_req_data['action']];
210 210
 		}
211 211
 	}
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param  array $ids an array of ids for containers that hold form inputs we want autosave to pickup.  Typically you would send along the id of a metabox container.
221 221
 	 * @return void
222 222
 	 */
223
-	protected function _register_autosave_containers( $ids ) {
224
-		$this->_autosave_containers = array_merge( $this->_autosave_fields, (array) $ids );
223
+	protected function _register_autosave_containers($ids) {
224
+		$this->_autosave_containers = array_merge($this->_autosave_fields, (array) $ids);
225 225
 	}
226 226
 
227 227
 
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 
237 237
 		$containers = array();
238 238
 
239
-		if ( empty( $wp_meta_boxes ) )
239
+		if (empty($wp_meta_boxes))
240 240
 			return;
241 241
 
242
-		$current_metaboxes = isset( $wp_meta_boxes[$this->page_slug] ) ? $wp_meta_boxes[$this->page_slug] : array();
242
+		$current_metaboxes = isset($wp_meta_boxes[$this->page_slug]) ? $wp_meta_boxes[$this->page_slug] : array();
243 243
 
244
-		foreach ( $current_metaboxes as $box_context ) {
245
-			foreach ( $box_context as $box_details ) {
246
-				foreach ( $box_details as $box ) {
247
-					if ( is_array( $box['callback'] ) && ( $box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks ) ){
244
+		foreach ($current_metaboxes as $box_context) {
245
+			foreach ($box_context as $box_details) {
246
+				foreach ($box_details as $box) {
247
+					if (is_array($box['callback']) && ($box['callback'][0] instanceof EE_Admin_Page || $box['callback'][0] instanceof EE_Admin_Hooks)) {
248 248
 						$containers[] = $box['id'];
249 249
 					}
250 250
 				}
251 251
 			}
252 252
 		}
253 253
 
254
-		$this->_autosave_containers = array_merge( $this->_autosave_containers, $containers );
254
+		$this->_autosave_containers = array_merge($this->_autosave_containers, $containers);
255 255
 
256 256
 		//add hidden inputs container
257 257
 		$this->_autosave_containers[] = 'ee-cpt-hidden-inputs';
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 		wp_enqueue_script('cpt-autosave');/**/ //todo re-enable when we start doing autosave again in 4.2
269 269
 
270 270
 		//filter _autosave_containers
271
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this );
272
-		$containers = apply_filters( 'FHEE__EE_Admin_Page_CPT__' . get_class($this) . '___load_autosave_scripts_styles__containers', $containers, $this );
271
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT___load_autosave_scripts_styles__containers', $this->_autosave_containers, $this);
272
+		$containers = apply_filters('FHEE__EE_Admin_Page_CPT__'.get_class($this).'___load_autosave_scripts_styles__containers', $containers, $this);
273 273
 
274
-		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers ); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
274
+		wp_localize_script('event_editor_js', 'EE_AUTOSAVE_IDS', $containers); //todo once we enable autosaves, this needs to be switched to localize with "cpt-autosave"
275 275
 
276 276
 		$unsaved_data_msg = array(
277
-			'eventmsg' => sprintf( __("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
277
+			'eventmsg' => sprintf(__("The changes you made to this %s will be lost if you navigate away from this page.", 'event_espresso'), $this->_cpt_object->labels->singular_name),
278 278
 			'inputChanged' => 0
279 279
 			);
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	public function load_page_dependencies() {
287 287
 		try {
288 288
 			$this->_load_page_dependencies();
289
-		} catch ( EE_Error $e ) {
289
+		} catch (EE_Error $e) {
290 290
 			$e->get_error();
291 291
 		}
292 292
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	protected function _load_page_dependencies() {
303 303
 
304 304
 		//we only add stuff if this is a cpt_route!
305
-		if ( !$this->_cpt_route ) {
305
+		if ( ! $this->_cpt_route) {
306 306
 			parent::_load_page_dependencies();
307 307
 			return;
308 308
 		}
@@ -312,72 +312,72 @@  discard block
 block discarded – undo
312 312
 
313 313
 		//the following filters are for setting all the redirects on DEFAULT WP custom post type actions
314 314
 		//let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects!  Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
315
-		add_action('edit_form_after_title', array( $this, 'cpt_post_form_hidden_input') );
315
+		add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
316 316
 
317 317
 		//inject our Admin page nav tabs...
318 318
 		//let's make sure the nav tabs are set if they aren't already
319 319
 		//if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
320
-		add_action('post_edit_form_tag', array( $this, 'inject_nav_tabs' ) );
320
+		add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
321 321
 
322 322
 		//modify the post_updated messages array
323
-		add_action('post_updated_messages', array( $this, 'post_update_messages' ), 10 );
323
+		add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
324 324
 
325 325
 		//add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts!
326
-		add_filter( 'pre_get_shortlink', array( $this, 'add_shortlink_button_to_editor' ), 10, 4 );
326
+		add_filter('pre_get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
327 327
 
328 328
 		//This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
329
-		if ( !empty($this->_labels['publishbox'] ) ) {
329
+		if ( ! empty($this->_labels['publishbox'])) {
330 330
 
331
-			$box_label = is_array( $this->_labels['publishbox'] ) && isset( $this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
331
+			$box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
332 332
 
333
-			remove_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
334
-			add_meta_box( 'submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core' );
333
+			remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
334
+			add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
335 335
 		}
336 336
 
337 337
 		//let's add page_templates metabox if this cpt added support for it.
338
-		if ( $this->_supports_page_templates($this->_cpt_object->name) ) {
339
-			add_meta_box( 'page_templates', __('Page Template', 'event_espresso' ), array( $this, 'page_template_meta_box' ), $this->_cpt_routes[$this->_req_action], 'side', 'default' );
338
+		if ($this->_supports_page_templates($this->_cpt_object->name)) {
339
+			add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default');
340 340
 		}/**/
341 341
 
342 342
 
343 343
 		//this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
344
-		if ( method_exists( $this, 'extra_permalink_field_buttons' ) )
345
-			add_filter('get_sample_permalink_html', array( $this, 'extra_permalink_field_buttons' ), 10, 4 );
344
+		if (method_exists($this, 'extra_permalink_field_buttons'))
345
+			add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
346 346
 
347 347
 		//add preview button
348
-		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4 );
348
+		add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
349 349
 
350 350
 
351 351
 		//insert our own post_stati dropdown
352
-		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown' ), 10 );
352
+		add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
353 353
 
354 354
 		//This allows adding additional information to the publish post submitbox on the wp post edit form
355
-		if ( method_exists( $this, 'extra_misc_actions_publish_box' ) )
356
-			add_action('post_submitbox_misc_actions', array( $this, 'extra_misc_actions_publish_box' ), 10 );
355
+		if (method_exists($this, 'extra_misc_actions_publish_box'))
356
+			add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
357 357
 
358 358
 		//This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
359
-		if ( method_exists( $this, 'edit_form_after_title' ) )
360
-			add_action('edit_form_after_title', array( $this, 'edit_form_after_title' ), 10 );
359
+		if (method_exists($this, 'edit_form_after_title'))
360
+			add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
361 361
 
362 362
 
363 363
 		/**
364 364
 		 * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
365 365
 		 */
366
-		add_filter( 'clean_url', array( $this, 'switch_core_wp_urls_with_ours' ), 10, 3 );
366
+		add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
367 367
 
368 368
 
369 369
 		parent::_load_page_dependencies();
370 370
 
371 371
 		//notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes.
372 372
 		global $pagenow;
373
-		do_action( 'load-' . $pagenow );
373
+		do_action('load-'.$pagenow);
374 374
 
375 375
 		$this->modify_current_screen();
376
-		add_action( 'admin_enqueue_scripts', array( $this, 'setup_autosave_hooks'), 30 );
376
+		add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
377 377
 		//we route REALLY early.
378 378
 		try {
379 379
 			$this->_route_admin_request();
380
-		} catch ( EE_Error $e ) {
380
+		} catch (EE_Error $e) {
381 381
 			$e->get_error();
382 382
 		}
383 383
 	}
@@ -396,21 +396,21 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @return string possibly a new url for our route.
398 398
 	 */
399
-	public function switch_core_wp_urls_with_ours( $good_protocol_url, $original_url, $_context ) {
399
+	public function switch_core_wp_urls_with_ours($good_protocol_url, $original_url, $_context) {
400 400
 		$routes_to_match = array(
401 401
 			0 => array(
402 402
 				'edit.php?post_type=espresso_attendees',
403 403
 				'admin.php?page=espresso_registrations&action=contact_list'
404 404
 				),
405 405
 			 1 => array(
406
-			 	'edit.php?post_type=' . $this->_cpt_object->name,
407
-			 	'admin.php?page=' . $this->_cpt_object->name
406
+			 	'edit.php?post_type='.$this->_cpt_object->name,
407
+			 	'admin.php?page='.$this->_cpt_object->name
408 408
 				)
409 409
 			);
410 410
 
411
-		foreach( $routes_to_match as $route_matches ) {
412
-			if ( strpos( $good_protocol_url, $route_matches[0] ) !== false ) {
413
-				return str_replace( $route_matches[0], $route_matches[1], $good_protocol_url );
411
+		foreach ($routes_to_match as $route_matches) {
412
+			if (strpos($good_protocol_url, $route_matches[0]) !== false) {
413
+				return str_replace($route_matches[0], $route_matches[1], $good_protocol_url);
414 414
 
415 415
 			}
416 416
 		}
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	 * @param string $cpt_name The cpt slug we're checking on.
427 427
 	 * @return bool True supported, false not.
428 428
 	 */
429
-	private function _supports_page_templates( $cpt_name ) {
429
+	private function _supports_page_templates($cpt_name) {
430 430
 		$cpt_args = EE_Register_CPTs::get_CPTs();
431
-		$cpt_args = isset( $cpt_args[$cpt_name] ) ? $cpt_args[$cpt_name]['args'] : array();
432
-		return ! empty( $cpt_args['page_templates'] ) ? TRUE : FALSE;
431
+		$cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
432
+		return ! empty($cpt_args['page_templates']) ? TRUE : FALSE;
433 433
 	}
434 434
 
435 435
 
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 	public function page_template_meta_box() {
445 445
 		global $post;
446 446
 		$template = '';
447
-		if ( count( get_page_templates( $post ) ) != 0 ) {
448
-			$page_template = get_post_meta( $post->ID, '_wp_page_template', TRUE );
449
-			$template = !empty( $page_template ) ? $page_template : '';
447
+		if (count(get_page_templates($post)) != 0) {
448
+			$page_template = get_post_meta($post->ID, '_wp_page_template', TRUE);
449
+			$template = ! empty($page_template) ? $page_template : '';
450 450
 		}
451 451
 		?>
452 452
 		<p><strong><?php _e('Template') ?></strong></p>
@@ -470,10 +470,10 @@  discard block
 block discarded – undo
470 470
 	 * @param  string $new_slug  what the slug is
471 471
 	 * @return string            The new html string for the permalink area
472 472
 	 */
473
-	public function preview_button_html( $return, $id, $new_title, $new_slug ) {
474
-		$post = get_post( $id );
475
-		if ( 'publish' != get_post_status( $post ) ) {
476
-			$return .= '<span_id="view-post-btn"><a href="' . wp_get_shortlink($id, 'post') . '" class="button button-small">' . __('Preview', 'event_espresso') . '</a></span>' . "\n";
473
+	public function preview_button_html($return, $id, $new_title, $new_slug) {
474
+		$post = get_post($id);
475
+		if ('publish' != get_post_status($post)) {
476
+			$return .= '<span_id="view-post-btn"><a href="'.wp_get_shortlink($id, 'post').'" class="button button-small">'.__('Preview', 'event_espresso').'</a></span>'."\n";
477 477
 		}
478 478
 		return $return;
479 479
 	}
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 			'cur_status' =>  $this->_cpt_model_obj->status(),
494 494
 			'statuses' => $statuses,
495 495
 			'cur_status_label' => $cur_status_label,
496
-			'localized_status_save' => sprintf( __('Save %s', 'event_espresso'), $cur_status_label )
496
+			'localized_status_save' => sprintf(__('Save %s', 'event_espresso'), $cur_status_label)
497 497
 			);
498 498
 
499 499
 		//we'll add a trash post status (WP doesn't add one for some reason)
500
-		if ( $this->_cpt_model_obj->status() == 'trash' ) {
500
+		if ($this->_cpt_model_obj->status() == 'trash') {
501 501
 			$template_args['cur_status_label'] = __('Trashed', 'event_espresso');
502 502
 			$statuses['trash'] = __('Trashed', 'event_espresso');
503 503
 			$template_args['statuses'] = $statuses;
504 504
 		}
505 505
 
506
-		$template = EE_ADMIN_TEMPLATE . 'status_dropdown.template.php';
507
-		EEH_Template::display_template( $template, $template_args );
506
+		$template = EE_ADMIN_TEMPLATE.'status_dropdown.template.php';
507
+		EEH_Template::display_template($template, $template_args);
508 508
 	}
509 509
 
510 510
 
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 	public function do_extra_autosave_stuff() {
544 544
 
545 545
 		//next let's check for the autosave nonce (we'll use _verify_nonce )
546
-		$nonce = isset( $this->_req_data['autosavenonce'] ) ? $this->_req_data['autosavenonce'] : NULL;
547
-		$this->_verify_nonce( $nonce, 'autosave' );
546
+		$nonce = isset($this->_req_data['autosavenonce']) ? $this->_req_data['autosavenonce'] : NULL;
547
+		$this->_verify_nonce($nonce, 'autosave');
548 548
 
549 549
 
550 550
 		//make sure we define doing autosave (cause WP isn't triggering this we want to make sure we define it)
551
-		if ( !defined('DOING_AUTOSAVE') ) define('DOING_AUTOSAVE', true);
551
+		if ( ! defined('DOING_AUTOSAVE')) define('DOING_AUTOSAVE', true);
552 552
 
553 553
 		//if we made it here then the nonce checked out.  Let's run our methods and actions
554
-		if ( method_exists( $this, '_ee_autosave_' . $this->_current_view ) ) {
555
-			call_user_func( array( $this, '_ee_autosave_' . $this->_current_view ) );
554
+		if (method_exists($this, '_ee_autosave_'.$this->_current_view)) {
555
+			call_user_func(array($this, '_ee_autosave_'.$this->_current_view));
556 556
 		} else {
557 557
 			$this->_template_args['success'] = TRUE;
558 558
 		}
559 559
 
560
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this );
561
-		do_action( 'AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_' . get_class( $this ), $this );
560
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__global_after', $this);
561
+		do_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_'.get_class($this), $this);
562 562
 
563 563
 		//now let's return json
564 564
 		$this->_return_json();
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
 	protected function _extend_page_config_for_cpt() {
579 579
 
580 580
 		//before doing anything we need to make sure this runs ONLY when the loaded page matches the set page_slug
581
-		if ( ( isset( $this->_req_data['page'] ) && $this->_req_data['page'] != $this->page_slug ) )
581
+		if ((isset($this->_req_data['page']) && $this->_req_data['page'] != $this->page_slug))
582 582
 			return;
583 583
 
584 584
 		//set page routes and page config but ONLY if we're not viewing a custom setup cpt route as defined in _cpt_routes
585
-		if ( !empty( $this->_cpt_object ) ) {
586
-			$this->_page_routes = array_merge( array(
585
+		if ( ! empty($this->_cpt_object)) {
586
+			$this->_page_routes = array_merge(array(
587 587
 				'create_new' => '_create_new_cpt_item',
588 588
 				'edit' => '_edit_cpt_item'
589
-				), $this->_page_routes );
589
+				), $this->_page_routes);
590 590
 
591 591
 
592
-			$this->_page_config = array_merge( array(
592
+			$this->_page_config = array_merge(array(
593 593
 				'create_new' => array(
594 594
 					'nav' => array(
595 595
 						'label' => $this->_cpt_object->labels->add_new_item,
@@ -611,23 +611,23 @@  discard block
 block discarded – undo
611 611
 		}
612 612
 
613 613
 		//load the next section only if this is a matching cpt route as set in the cpt routes array.
614
-		if ( !isset( $this->_cpt_routes[$this->_req_action] ) )
614
+		if ( ! isset($this->_cpt_routes[$this->_req_action]))
615 615
 			return;
616 616
 
617 617
 
618
-		$this->_cpt_route = isset( $this->_cpt_routes[$this->_req_action] ) ? TRUE : FALSE;
618
+		$this->_cpt_route = isset($this->_cpt_routes[$this->_req_action]) ? TRUE : FALSE;
619 619
 		//add_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', array( $this, 'modify_current_screen') );
620 620
 
621 621
 
622
-		if ( empty( $this->_cpt_object ) ) {
623
-			$msg = sprintf( __('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this) );
624
-			throw new EE_Error( $msg );
622
+		if (empty($this->_cpt_object)) {
623
+			$msg = sprintf(__('This page has been set as being related to a registered custom post type, however, the custom post type object could not be retrieved. There are two possible reasons for this:  1. The "%s" does not match a registered post type. or 2. The custom post type is not registered for the "%s" action as indexed in the "$_cpt_routes" property on this class (%s).'), $this->page_slug, $this->_req_action, get_class($this));
624
+			throw new EE_Error($msg);
625 625
 		}
626 626
 
627 627
 
628
-		if ( $this->_cpt_route ) {
629
-			$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
630
-			$this->_set_model_object( $id );
628
+		if ($this->_cpt_route) {
629
+			$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
630
+			$this->_set_model_object($id);
631 631
 		}
632 632
 
633 633
 	}
@@ -643,17 +643,17 @@  discard block
 block discarded – undo
643 643
 	 * @param int $id The id to retrieve the model object for. If empty we set a default object.
644 644
 	 * @return void
645 645
 	 */
646
-	protected function _set_model_object( $id = NULL ) {
646
+	protected function _set_model_object($id = NULL) {
647 647
 
648
-		if ( empty( $this->_cpt_model_names ) || ! isset( $this->_cpt_routes[ $this->_req_action ] ) || ( is_object( $this->_cpt_model_obj ) && $this->_cpt_model_obj->ID() == $id )) {
648
+		if (empty($this->_cpt_model_names) || ! isset($this->_cpt_routes[$this->_req_action]) || (is_object($this->_cpt_model_obj) && $this->_cpt_model_obj->ID() == $id)) {
649 649
 			//get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
650 650
 			return;
651 651
 		}
652 652
 		// load CPT object model
653
-		$model = EE_Registry::instance()->load_model( $this->_cpt_model_names[$this->_req_action] );
654
-		$this->_cpt_model_obj = ! empty( $id ) ? $model->get_one_by_ID( $id ) : $model->create_default_object();
653
+		$model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
654
+		$this->_cpt_model_obj = ! empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
655 655
 		//d( $this->_cpt_model_obj );
656
-		do_action( 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object' );
656
+		do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object');
657 657
 	}
658 658
 
659 659
 
@@ -667,47 +667,47 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function admin_init_global() {
669 669
 
670
-		$post = isset( $this->_req_data['post'] ) ? get_post( $this->_req_data['post'] ) : NULL;
670
+		$post = isset($this->_req_data['post']) ? get_post($this->_req_data['post']) : NULL;
671 671
 
672 672
 		//its possible this is a new save so let's catch that instead
673
-		$post = isset( $this->_req_data['post_ID'] ) ? get_post( $this->_req_data['post_ID'] ) : $post;
673
+		$post = isset($this->_req_data['post_ID']) ? get_post($this->_req_data['post_ID']) : $post;
674 674
 		$post_type = $post ? $post->post_type : false;
675 675
 
676 676
 		$current_route = isset($this->_req_data['current_route']) ? $this->_req_data['current_route'] : 'shouldneverwork';
677 677
 
678
-		$route_to_check = $post_type && isset( $this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
678
+		$route_to_check = $post_type && isset($this->_cpt_routes[$current_route]) ? $this->_cpt_routes[$current_route] : '';
679 679
 
680
-		add_filter( 'get_delete_post_link', array( $this, 'modify_delete_post_link'), 10, 3 );
681
-		add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link'), 10, 3 );
680
+		add_filter('get_delete_post_link', array($this, 'modify_delete_post_link'), 10, 3);
681
+		add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
682 682
 
683 683
 
684
-		if ( $post_type === $route_to_check ) {
685
-			add_filter('redirect_post_location', array( $this, 'cpt_post_location_redirect'), 10, 2 );
684
+		if ($post_type === $route_to_check) {
685
+			add_filter('redirect_post_location', array($this, 'cpt_post_location_redirect'), 10, 2);
686 686
 			//catch trashed wp redirect
687
-			add_filter('wp_redirect', array( $this, 'cpt_trash_post_location_redirect' ), 10, 2 );
687
+			add_filter('wp_redirect', array($this, 'cpt_trash_post_location_redirect'), 10, 2);
688 688
 		}
689 689
 
690 690
 		//now let's filter redirect if we're on a revision page and the revision is for an event CPT.
691
-		$revision = isset( $this->_req_data['revision'] ) ? $this->_req_data['revision'] : NULL;
691
+		$revision = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
692 692
 
693 693
 		/**var_dump($this->_req_data);
694 694
 		exit();/**/
695 695
 
696
-		if ( !empty( $revision ) ) {
697
-			$action = isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : NULL;
696
+		if ( ! empty($revision)) {
697
+			$action = isset($this->_req_data['action']) ? $this->_req_data['action'] : NULL;
698 698
 
699 699
 			//doing a restore?
700
-			if ( !empty( $action ) && $action == 'restore' ) {
700
+			if ( ! empty($action) && $action == 'restore') {
701 701
 
702 702
 				//get post for revision
703
-				$rev_post = get_post( $revision );
704
-				$rev_parent = get_post( $rev_post->post_parent );
703
+				$rev_post = get_post($revision);
704
+				$rev_parent = get_post($rev_post->post_parent);
705 705
 
706 706
 				//only do our redirect filter AND our restore revision action if the post_type for the parent is one of our cpts.
707
-				if ( $rev_parent && $rev_parent->post_type == $this->page_slug ) {
708
-					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2 );
707
+				if ($rev_parent && $rev_parent->post_type == $this->page_slug) {
708
+					add_filter('wp_redirect', array($this, 'revision_redirect'), 10, 2);
709 709
 					//restores of revisions
710
-					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2 );
710
+					add_action('wp_restore_post_revision', array($this, 'restore_revision'), 10, 2);
711 711
 				}
712 712
 			}
713 713
 
@@ -716,15 +716,15 @@  discard block
 block discarded – undo
716 716
 		//NOTE we ONLY want to run these hooks if we're on the right class for the given post type.  Otherwise we could see some really freaky things happen!
717 717
 
718 718
 
719
-		if ( $post_type && $post_type === $route_to_check ) {
719
+		if ($post_type && $post_type === $route_to_check) {
720 720
 			//$post_id, $post
721
-			add_action('save_post', array( $this, 'insert_update'), 10, 2 );
721
+			add_action('save_post', array($this, 'insert_update'), 10, 2);
722 722
 
723 723
 			//$post_id
724
-			add_action('trashed_post', array( $this, 'trash_cpt_item' ), 10 );
725
-			add_action('trashed_post', array( $this, 'dont_permanently_delete_ee_cpts'), 10 );
726
-			add_action('untrashed_post', array( $this, 'restore_cpt_item'), 10 );
727
-			add_action('after_delete_post', array( $this, 'delete_cpt_item'), 10 );
724
+			add_action('trashed_post', array($this, 'trash_cpt_item'), 10);
725
+			add_action('trashed_post', array($this, 'dont_permanently_delete_ee_cpts'), 10);
726
+			add_action('untrashed_post', array($this, 'restore_cpt_item'), 10);
727
+			add_action('after_delete_post', array($this, 'delete_cpt_item'), 10);
728 728
 		}
729 729
 
730 730
 	}
@@ -739,15 +739,15 @@  discard block
 block discarded – undo
739 739
 	 * @return void
740 740
 	 */
741 741
 	public function verify_cpt_object() {
742
-		$label = !empty( $this->_cpt_object ) ? $this->_cpt_object->labels->singular_name : $this->page_label;
742
+		$label = ! empty($this->_cpt_object) ? $this->_cpt_object->labels->singular_name : $this->page_label;
743 743
 		// verify event object
744
-		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base ) {
745
-			throw new EE_Error( sprintf( __('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso' ), $label ) );
744
+		if ( ! $this->_cpt_model_obj instanceof EE_CPT_Base) {
745
+			throw new EE_Error(sprintf(__('Something has gone wrong with the page load because we are unable to set up the object for the %1$s.  This usually happens when the given id for the page route is NOT for the correct custom post type for this page', 'event_espresso'), $label));
746 746
 		}
747 747
 		//if auto-draft then throw an error
748
-		if ( $this->_cpt_model_obj->get('status') == 'auto-draft' ) {
748
+		if ($this->_cpt_model_obj->get('status') == 'auto-draft') {
749 749
 			EE_Error::overwrite_errors();
750
-			EE_Error::add_error( sprintf( __('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label ), __FILE__, __FUNCTION__, __LINE__ );
750
+			EE_Error::add_error(sprintf(__('This %1$s was saved without a title, description, or excerpt which means that none of the extra details you added were saved properly.  All autodrafts will show up in the "draft" view of your event list table.  You can delete them from there. Please click the "Add %1$s" button to refresh and restart.'), $label), __FILE__, __FUNCTION__, __LINE__);
751 751
 		}
752 752
 	}
753 753
 
@@ -776,22 +776,22 @@  discard block
 block discarded – undo
776 776
 	public function load_global_scripts_styles() {
777 777
 		parent::load_global_scripts_styles();
778 778
 
779
-		if ( $this->_cpt_model_obj instanceof EE_CPT_Base ) {
779
+		if ($this->_cpt_model_obj instanceof EE_CPT_Base) {
780 780
 			//setup custom post status object for localize script but only if we've got a cpt object
781 781
 			$statuses = $this->_cpt_model_obj->get_custom_post_statuses();
782 782
 
783
-			if ( !empty($statuses) ) {
783
+			if ( ! empty($statuses)) {
784 784
 				//get ALL statuses!
785 785
 				$statuses = $this->_cpt_model_obj->get_all_post_statuses();
786 786
 				//setup object
787 787
 				$ee_cpt_statuses = array();
788
-				foreach ( $statuses as $status => $label ) {
788
+				foreach ($statuses as $status => $label) {
789 789
 					$ee_cpt_statuses[$status] = array(
790 790
 						'label' => $label,
791
-						'save_label' => sprintf( __('Save as %s', 'event_espresso'), $label )
791
+						'save_label' => sprintf(__('Save as %s', 'event_espresso'), $label)
792 792
 						);
793 793
 				}
794
-				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses );
794
+				wp_localize_script('ee_admin_js', 'eeCPTstatuses', $ee_cpt_statuses);
795 795
 			}
796 796
 		}
797 797
 	}
@@ -805,10 +805,10 @@  discard block
 block discarded – undo
805 805
 	 * @param  WP_Post $post    Post object from WP
806 806
 	 * @return void
807 807
 	 */
808
-	public function insert_update( $post_id, $post ) {
808
+	public function insert_update($post_id, $post) {
809 809
 
810 810
 		//make sure that if this is a revision OR trash action that we don't do any updates!
811
-		if ( isset( $this->_req_data['action'] ) && ( $this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash' ) )
811
+		if (isset($this->_req_data['action']) && ($this->_req_data['action'] == 'restore' || $this->_req_data['action'] == 'trash'))
812 812
 			return;
813 813
 
814 814
 		//check for autosave and update our req_data property accordingly.
@@ -823,19 +823,19 @@  discard block
 block discarded – undo
823 823
 		}/**/ //TODO reactivate after autosave is implemented in 4.2
824 824
 
825 825
 		//take care of updating any selected page_template IF this cpt supports it.
826
-		if ( $this->_supports_page_templates($post->post_type ) && !empty( $this->_req_data['page_template'] ) ) {
826
+		if ($this->_supports_page_templates($post->post_type) && ! empty($this->_req_data['page_template'])) {
827 827
 			$post->page_template = $this->_req_data['page_template'];
828
-			$page_templates = wp_get_theme()->get_page_templates( $post );
829
-			if ( 'default' != $this->_req_data['page_template']  && ! isset( $page_templates[ $this->_req_data['page_template'] ] ) ) {
830
-				EE_Error::add_error( __('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
828
+			$page_templates = wp_get_theme()->get_page_templates($post);
829
+			if ('default' != $this->_req_data['page_template'] && ! isset($page_templates[$this->_req_data['page_template']])) {
830
+				EE_Error::add_error(__('Invalid Page Template.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
831 831
 			} else {
832
-				update_post_meta( $post_id, '_wp_page_template', $this->_req_data['page_template'] );
832
+				update_post_meta($post_id, '_wp_page_template', $this->_req_data['page_template']);
833 833
 			}
834 834
 		}
835 835
 
836
-		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
836
+		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
837 837
 			return; //TODO we'll remove this after reimplementing autosave in 4.2
838
-		$this->_insert_update_cpt_item( $post_id, $post );
838
+		$this->_insert_update_cpt_item($post_id, $post);
839 839
 	}
840 840
 
841 841
 
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	 * @param  int    $post_id ID of the post
849 849
 	 * @return void
850 850
 	 */
851
-	public function dont_permanently_delete_ee_cpts( $post_id ) {
852
-		delete_post_meta( $post_id, '_wp_trash_meta_status' );
851
+	public function dont_permanently_delete_ee_cpts($post_id) {
852
+		delete_post_meta($post_id, '_wp_trash_meta_status');
853 853
 		delete_post_meta($post_id, '_wp_trash_meta_time');
854 854
 
855 855
 		//our cpts may have comments so let's take care of that too
@@ -868,14 +868,14 @@  discard block
 block discarded – undo
868 868
 	 * @param  int    $revision_id ID of revision being restored
869 869
 	 * @return void
870 870
 	 */
871
-	public function restore_revision( $post_id, $revision_id ) {
872
-		$this->_restore_cpt_item( $post_id, $revision_id );
871
+	public function restore_revision($post_id, $revision_id) {
872
+		$this->_restore_cpt_item($post_id, $revision_id);
873 873
 
874 874
 		//global action
875
-		do_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
875
+		do_action('AHEE_EE_Admin_Page_CPT__restore_revision', $post_id, $revision_id);
876 876
 
877 877
 		//class specific action so you can limit hooking into a specific page.
878
-		do_action( 'AHEE_EE_Admin_Page_CPT_' . get_class($this) . '__restore_revision', $post_id, $revision_id );
878
+		do_action('AHEE_EE_Admin_Page_CPT_'.get_class($this).'__restore_revision', $post_id, $revision_id);
879 879
 	}
880 880
 
881 881
 
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 * @param  int $revision_id ID of revision for item
887 887
 	 * @return void
888 888
 	 */
889
-	abstract protected function _restore_cpt_item( $post_id, $revision_id );
889
+	abstract protected function _restore_cpt_item($post_id, $revision_id);
890 890
 
891 891
 
892 892
 
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 	 */
906 906
 	public function modify_current_screen() {
907 907
 		//ONLY do this if the current page_route IS a cpt route
908
-		if ( !$this->_cpt_route ) return;
908
+		if ( ! $this->_cpt_route) return;
909 909
 		//routing things REALLY early b/c this is a cpt admin page
910
-		set_current_screen( $this->_cpt_routes[$this->_req_action]);
910
+		set_current_screen($this->_cpt_routes[$this->_req_action]);
911 911
 		$this->_current_screen = get_current_screen();
912 912
 		$this->_current_screen->base = 'event-espresso';
913 913
 		$this->_add_help_tabs(); //we make sure we add any help tabs back in!
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 	 * @param string $title The new title (or existing if there is no editor_title defined)
929 929
 	 * @return string
930 930
 	 */
931
-	public function add_custom_editor_default_title( $title ) {
932
-		return isset( $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] ) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
931
+	public function add_custom_editor_default_title($title) {
932
+		return isset($this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]]) ? $this->_labels['editor_title'][$this->_cpt_routes[$this->_req_action]] : $title;
933 933
 	}
934 934
 
935 935
 
@@ -942,11 +942,11 @@  discard block
 block discarded – undo
942 942
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink.
943 943
 	 * @return string
944 944
 	 */
945
-	public function add_shortlink_button_to_editor( $shortlink, $id, $context, $allow_slugs ) {
946
-		if ( !empty( $id ) && '' != get_option('permalink_structure') ) {
947
-			$post = get_post( $id );
948
-			if ( isset($post->post_type) && $this->page_slug == $post->post_type )
949
-			$shortlink = home_url('?p=' . $post->ID);
945
+	public function add_shortlink_button_to_editor($shortlink, $id, $context, $allow_slugs) {
946
+		if ( ! empty($id) && '' != get_option('permalink_structure')) {
947
+			$post = get_post($id);
948
+			if (isset($post->post_type) && $this->page_slug == $post->post_type)
949
+			$shortlink = home_url('?p='.$post->ID);
950 950
 		}
951 951
 		return $shortlink;
952 952
 	}
@@ -959,10 +959,10 @@  discard block
 block discarded – undo
959 959
 	 * @return void
960 960
 	 */
961 961
 	public function route_admin_request() {
962
-		if ( $this->_cpt_route ) return;
962
+		if ($this->_cpt_route) return;
963 963
 		try {
964 964
 			$this->_route_admin_request();
965
-		} catch ( EE_Error $e ) {
965
+		} catch (EE_Error $e) {
966 966
 			$e->get_error();
967 967
 		}
968 968
 	}
@@ -975,12 +975,12 @@  discard block
 block discarded – undo
975 975
 	 * @return string html
976 976
 	 */
977 977
 	public function cpt_post_form_hidden_input() {
978
-		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="' . $this->_admin_base_url . '" />';
978
+		echo '<input type="hidden" name="ee_cpt_item_redirect_url" value="'.$this->_admin_base_url.'" />';
979 979
 
980 980
 		//we're also going to add the route value and the current page so we can direct autosave parsing correctly
981 981
 		echo '<div id="ee-cpt-hidden-inputs">';
982
-		echo '<input type="hidden" id="current_route" name="current_route" value="' . $this->_current_view . '" />';
983
-		echo '<input type="hidden" id="current_page" name="current_page" value="' . $this->page_slug . '" />';
982
+		echo '<input type="hidden" id="current_route" name="current_route" value="'.$this->_current_view.'" />';
983
+		echo '<input type="hidden" id="current_page" name="current_page" value="'.$this->page_slug.'" />';
984 984
 		echo '</div>';
985 985
 	}
986 986
 
@@ -993,12 +993,12 @@  discard block
 block discarded – undo
993 993
 	 * @param  int    $status   Status for http header
994 994
 	 * @return string           new (or original) url to redirect to.
995 995
 	 */
996
-	public function revision_redirect( $location, $status ) {
996
+	public function revision_redirect($location, $status) {
997 997
 		//get revision
998 998
 		$rev_id = isset($this->_req_data['revision']) ? $this->_req_data['revision'] : NULL;
999 999
 
1000 1000
 		//can't do anything without revision so let's get out if not present
1001
-		if ( empty( $rev_id ) )
1001
+		if (empty($rev_id))
1002 1002
 			return $location;
1003 1003
 
1004 1004
 		//get rev_post_data
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 				'message' => 5
1013 1013
 			);
1014 1014
 
1015
-		$this->_process_notices( $query_args, TRUE );
1016
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1015
+		$this->_process_notices($query_args, TRUE);
1016
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1017 1017
 	}
1018 1018
 
1019 1019
 
@@ -1026,16 +1026,16 @@  discard block
 block discarded – undo
1026 1026
 	 * @param  string $context optional, defaults to display.  How to write the '&'
1027 1027
 	 * @return string          the link
1028 1028
 	 */
1029
-	public function modify_edit_post_link( $link, $id, $context ) {
1030
-		$post = get_post( $id );
1031
-		if ( !isset( $this->_req_data['action'] ) || !isset( $this->_cpt_routes[$this->_req_data['action']] ) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] )
1029
+	public function modify_edit_post_link($link, $id, $context) {
1030
+		$post = get_post($id);
1031
+		if ( ! isset($this->_req_data['action']) || ! isset($this->_cpt_routes[$this->_req_data['action']]) || $post->post_type !== $this->_cpt_routes[$this->_req_data['action']])
1032 1032
 			return $link;
1033 1033
 		$query_args = array(
1034 1034
 			'action' => isset($this->_cpt_edit_routes[$post->post_type]) ? $this->_cpt_edit_routes[$post->post_type] : 'edit',
1035 1035
 			'post' => $id
1036 1036
 			);
1037 1037
 
1038
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1038
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1039 1039
 	}
1040 1040
 
1041 1041
 
@@ -1047,12 +1047,12 @@  discard block
 block discarded – undo
1047 1047
 	 * @param  bool   $force_delete whether this is forcing a hard delete instead of trash
1048 1048
 	 * @return string               new delete link
1049 1049
 	 */
1050
-	public function modify_delete_post_link( $delete_link, $post_id, $force_delete ) {
1050
+	public function modify_delete_post_link($delete_link, $post_id, $force_delete) {
1051 1051
 		$post = get_post($post_id);
1052
-		if ( !isset( $this->_req_data['action'] ) || ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']] ) )
1052
+		if ( ! isset($this->_req_data['action']) || (isset($this->_cpt_routes[$this->_req_data['action']]) && $post->post_type !== $this->_cpt_routes[$this->_req_data['action']]))
1053 1053
 			return $delete_link;
1054 1054
 
1055
-		return add_query_arg( array('current_route' => 'trash' ), $delete_link );
1055
+		return add_query_arg(array('current_route' => 'trash'), $delete_link);
1056 1056
 	}
1057 1057
 
1058 1058
 
@@ -1063,16 +1063,16 @@  discard block
 block discarded – undo
1063 1063
 	 * @param  string $status   status
1064 1064
 	 * @return string           url to redirect to
1065 1065
 	 */
1066
-	public function cpt_trash_post_location_redirect( $location, $status ) {
1067
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] !== 'trash' && empty( $this->_req_data['post'] ) )
1066
+	public function cpt_trash_post_location_redirect($location, $status) {
1067
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] !== 'trash' && empty($this->_req_data['post']))
1068 1068
 			return $location;
1069 1069
 
1070
-		$post = get_post( $this->_req_data['post'] );
1071
-		$query_args = array( 'action' => 'default' );
1070
+		$post = get_post($this->_req_data['post']);
1071
+		$query_args = array('action' => 'default');
1072 1072
 		$this->_cpt_object = get_post_type_object($post->post_type);
1073
-		EE_Error::add_success( sprintf( __('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name) );
1074
-		$this->_process_notices( $query_args, TRUE );
1075
-		return self::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1073
+		EE_Error::add_success(sprintf(__('%s trashed.', 'event_espresso'), $this->_cpt_object->labels->singular_name));
1074
+		$this->_process_notices($query_args, TRUE);
1075
+		return self::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1076 1076
 	}
1077 1077
 
1078 1078
 
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 	 * @param  string $post_id  This is the 'ID' value of the wp_posts table
1088 1088
 	 * @return string           the new location to redirect to
1089 1089
 	 */
1090
-	public function cpt_post_location_redirect( $location, $post_id ) {
1090
+	public function cpt_post_location_redirect($location, $post_id) {
1091 1091
 		//we DO have a match so let's setup the url
1092 1092
 
1093 1093
 		//we have to get the post to determine our route
@@ -1095,14 +1095,14 @@  discard block
 block discarded – undo
1095 1095
 		$edit_route = $this->_cpt_edit_routes[$post->post_type];
1096 1096
 
1097 1097
 		//shared query_args
1098
-		$query_args = array( 'action' => $edit_route, 'post' => $post_id );
1098
+		$query_args = array('action' => $edit_route, 'post' => $post_id);
1099 1099
 		$admin_url = $this->_admin_base_url;
1100 1100
 //		$append = '';
1101 1101
 
1102
-		if ( isset( $this->_req_data['save'] ) || isset( $this->_req_data['publish'] ) ) {
1103
-			$status = get_post_status( $post_id );
1104
-			if ( isset( $this->_req_data['publish'] ) ) {
1105
-				switch ( $status ) {
1102
+		if (isset($this->_req_data['save']) || isset($this->_req_data['publish'])) {
1103
+			$status = get_post_status($post_id);
1104
+			if (isset($this->_req_data['publish'])) {
1105
+				switch ($status) {
1106 1106
 					case 'pending':
1107 1107
 						$message = 8;
1108 1108
 						break;
@@ -1115,13 +1115,13 @@  discard block
 block discarded – undo
1115 1115
 			} else {
1116 1116
 					$message = 'draft' == $status ? 10 : 1;
1117 1117
 			}
1118
-		} else if ( isset( $this->_req_data['addmeta']) && $this->_req_data['addmeta'] ) {
1118
+		} else if (isset($this->_req_data['addmeta']) && $this->_req_data['addmeta']) {
1119 1119
 			$message = 2;
1120 1120
 //			$append = '#postcustom';
1121
-		} else if ( isset( $this->_req_data['deletemeta']) && $this->_req_data['deletemeta'] ) {
1121
+		} else if (isset($this->_req_data['deletemeta']) && $this->_req_data['deletemeta']) {
1122 1122
 			$message = 3;
1123 1123
 //			$append = '#postcustom';
1124
-		} elseif ( $this->_req_data['action'] == 'post-quickpress-save-cont' ) {
1124
+		} elseif ($this->_req_data['action'] == 'post-quickpress-save-cont') {
1125 1125
 			$message = 7;
1126 1126
 		} else {
1127 1127
 			$message = 4;
@@ -1129,12 +1129,12 @@  discard block
 block discarded – undo
1129 1129
 
1130 1130
 		//change the message if the post type is not viewable on the frontend
1131 1131
 		$this->_cpt_object = get_post_type_object($post->post_type);
1132
-		$message = $message === 1 && !$this->_cpt_object->publicly_queryable ? 4 : $message;
1132
+		$message = $message === 1 && ! $this->_cpt_object->publicly_queryable ? 4 : $message;
1133 1133
 
1134
-		$query_args = array_merge( array( 'message' => $message ), $query_args );
1134
+		$query_args = array_merge(array('message' => $message), $query_args);
1135 1135
 
1136
-		$this->_process_notices( $query_args, TRUE );
1137
-		return self::add_query_args_and_nonce( $query_args, $admin_url );
1136
+		$this->_process_notices($query_args, TRUE);
1137
+		return self::add_query_args_and_nonce($query_args, $admin_url);
1138 1138
 	}
1139 1139
 
1140 1140
 
@@ -1166,10 +1166,10 @@  discard block
 block discarded – undo
1166 1166
 	 * @param  array $messages the original messages array
1167 1167
 	 * @return array           the new messages array
1168 1168
 	 */
1169
-	public function post_update_messages( $messages ) {
1169
+	public function post_update_messages($messages) {
1170 1170
 		global $post;
1171
-		$id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1172
-		$id = empty( $id ) && is_object( $post ) ? $post->ID : NULL;
1171
+		$id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1172
+		$id = empty($id) && is_object($post) ? $post->ID : NULL;
1173 1173
 
1174 1174
 //		$post_type = $post ? $post->post_type : false;
1175 1175
 
@@ -1182,9 +1182,9 @@  discard block
 block discarded – undo
1182 1182
 			0 => '', //Unused. Messages start at index 1.
1183 1183
 
1184 1184
 			1 => sprintf(
1185
-				__( '%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1185
+				__('%1$s updated. %2$sView %1$s%3$s', 'event_espresso'),
1186 1186
 				$this->_cpt_object->labels->singular_name,
1187
-				'<a href="' . esc_url( get_permalink( $id )) . '">',
1187
+				'<a href="'.esc_url(get_permalink($id)).'">',
1188 1188
 				'</a>'
1189 1189
 			),
1190 1190
 
@@ -1192,38 +1192,38 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 			3 => __('Custom field deleted.'),
1194 1194
 
1195
-			4 => sprintf( __( '%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1195
+			4 => sprintf(__('%1$s updated.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1196 1196
 
1197
-			5 => isset( $_GET['revision'] ) ? sprintf( __('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title( (int) $_GET['revision'], FALSE ) ) : FALSE,
1197
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'event_espresso'), $this->_cpt_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], FALSE)) : FALSE,
1198 1198
 
1199 1199
 			6 => sprintf(
1200
-					__( '%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1200
+					__('%1$s published. %2$sView %1$s%3$s', 'event_espresso'),
1201 1201
 					$this->_cpt_object->labels->singular_name,
1202
-					'<a href="' . esc_url( get_permalink( $id )) . '">',
1202
+					'<a href="'.esc_url(get_permalink($id)).'">',
1203 1203
 					'</a>'
1204 1204
 				),
1205 1205
 
1206
-			7 => sprintf( __( '%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name ),
1206
+			7 => sprintf(__('%1$s saved.', 'event_espresso'), $this->_cpt_object->labels->singular_name),
1207 1207
 
1208 1208
 			8 => sprintf(
1209 1209
 				__('%1$s submitted. %2$sPreview %1$s%3$s', 'event_espresso'),
1210 1210
 				$this->_cpt_object->labels->singular_name,
1211
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) . '">',
1211
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))).'">',
1212 1212
 				'</a>'
1213 1213
 			),
1214 1214
 
1215 1215
 			9 => sprintf(
1216
-				__( '%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1216
+				__('%1$s scheduled for: %2$s. %3$s">Preview %1$s%3$s', 'event_espresso'),
1217 1217
 				$this->_cpt_object->labels->singular_name,
1218
-				'<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date )) . '</strong>',
1219
-				'<a target="_blank" href="' . esc_url( get_permalink( $id )),
1218
+				'<strong>'.date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)).'</strong>',
1219
+				'<a target="_blank" href="'.esc_url(get_permalink($id)),
1220 1220
 				'</a>'
1221 1221
 			),
1222 1222
 
1223 1223
 			10 => sprintf(
1224 1224
 				__('%1$s draft updated. %2$s">Preview page%3$s', 'event_espresso'),
1225 1225
 				$this->_cpt_object->labels->singular_name,
1226
-				'<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $id ))) ,
1226
+				'<a target="_blank" href="'.esc_url(add_query_arg('preview', 'true', get_permalink($id))),
1227 1227
 				'</a>'
1228 1228
 			)
1229 1229
 		);
@@ -1250,24 +1250,24 @@  discard block
 block discarded – undo
1250 1250
 		$post_type_object = $this->_cpt_object;
1251 1251
 		$title = $post_type_object->labels->add_new_item;
1252 1252
 		$editing = TRUE;
1253
-		wp_enqueue_script( 'autosave' );
1254
-		$post = $post = get_default_post_to_edit( $this->_cpt_routes[$this->_req_action], TRUE );
1253
+		wp_enqueue_script('autosave');
1254
+		$post = $post = get_default_post_to_edit($this->_cpt_routes[$this->_req_action], TRUE);
1255 1255
 		$post_ID = $post->ID;
1256 1256
 		$is_IE = $is_IE;
1257 1257
 
1258
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1258
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1259 1259
 
1260 1260
 		//modify the default editor title field with default title.
1261
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1261
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1262 1262
 
1263
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1263
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1264 1264
 	}
1265 1265
 
1266 1266
 
1267 1267
 
1268 1268
 
1269 1269
 	public function add_new_admin_page_global() {
1270
-		$admin_page = !empty( $this->_req_data['post'] ) ? 'post-php' : 'post-new-php';
1270
+		$admin_page = ! empty($this->_req_data['post']) ? 'post-php' : 'post-new-php';
1271 1271
 		?>
1272 1272
 		<script type="text/javascript">
1273 1273
 			adminpage = '<?php echo $admin_page; ?>';
@@ -1289,16 +1289,16 @@  discard block
 block discarded – undo
1289 1289
 	 */
1290 1290
 	protected function _edit_cpt_item() {
1291 1291
 		global $post, $title, $is_IE, $post_type, $post_type_object;
1292
-		$post_id = isset( $this->_req_data['post'] ) ? $this->_req_data['post'] : NULL;
1293
-		$post = !empty( $post_id ) ? get_post( $post_id, OBJECT, 'edit' ) : NULL;
1292
+		$post_id = isset($this->_req_data['post']) ? $this->_req_data['post'] : NULL;
1293
+		$post = ! empty($post_id) ? get_post($post_id, OBJECT, 'edit') : NULL;
1294 1294
 
1295
-		if ( empty ( $post ) ) {
1296
-			wp_die( __('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?') );
1295
+		if (empty ($post)) {
1296
+			wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
1297 1297
 		}
1298 1298
 
1299
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
1300
-			wp_set_post_lock( $post_id );
1301
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
1299
+		if ( ! empty($_GET['get-post-lock'])) {
1300
+			wp_set_post_lock($post_id);
1301
+			wp_redirect(get_edit_post_link($post_id, 'url'));
1302 1302
 			exit();
1303 1303
 		}
1304 1304
 
@@ -1310,32 +1310,32 @@  discard block
 block discarded – undo
1310 1310
 		$post_type_object = $this->_cpt_object;
1311 1311
 		$is_IE = $is_IE;
1312 1312
 
1313
-		if ( ! wp_check_post_lock( $post->ID ) ) {
1314
-			$active_post_lock = wp_set_post_lock( $post->ID );
1313
+		if ( ! wp_check_post_lock($post->ID)) {
1314
+			$active_post_lock = wp_set_post_lock($post->ID);
1315 1315
 			//wp_enqueue_script('autosave');
1316 1316
 		}
1317 1317
 
1318 1318
 		$title = $this->_cpt_object->labels->edit_item;
1319 1319
 
1320
-		add_action('admin_footer', '_admin_notice_post_locked' );
1320
+		add_action('admin_footer', '_admin_notice_post_locked');
1321 1321
 
1322
-		if ( isset( $this->_cpt_routes[$this->_req_data['action']] ) && !isset( $this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']] ) ) {
1323
-			$create_new_action = apply_filters( 'FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this );
1322
+		if (isset($this->_cpt_routes[$this->_req_data['action']]) && ! isset($this->_labels['hide_add_button_on_cpt_route'][$this->_req_data['action']])) {
1323
+			$create_new_action = apply_filters('FHEE__EE_Admin_Page_CPT___edit_cpt_item__create_new_action', 'create_new', $this);
1324 1324
 
1325
-			$post_new_file = EE_Admin_Page::add_query_args_and_nonce( array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php' );
1325
+			$post_new_file = EE_Admin_Page::add_query_args_and_nonce(array('action' => $create_new_action, 'page' => $this->page_slug), 'admin.php');
1326 1326
 		}
1327 1327
 
1328
-		if ( post_type_supports($this->_cpt_routes[$this->_req_action], 'comments') ) {
1328
+		if (post_type_supports($this->_cpt_routes[$this->_req_action], 'comments')) {
1329 1329
 			wp_enqueue_script('admin-comments');
1330 1330
 			enqueue_comment_hotkeys_js();
1331 1331
 		}
1332 1332
 
1333
-		add_action( 'admin_print_styles', array( $this, 'add_new_admin_page_global' ) );
1333
+		add_action('admin_print_styles', array($this, 'add_new_admin_page_global'));
1334 1334
 
1335 1335
 		//modify the default editor title field with default title.
1336
-		add_filter('enter_title_here', array( $this, 'add_custom_editor_default_title' ), 10 );
1336
+		add_filter('enter_title_here', array($this, 'add_custom_editor_default_title'), 10);
1337 1337
 
1338
-		include_once WP_ADMIN_PATH . 'edit-form-advanced.php';
1338
+		include_once WP_ADMIN_PATH.'edit-form-advanced.php';
1339 1339
 
1340 1340
 	}
1341 1341
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	public function do_initial_loads() {
33 33
 		//we want to use the corresponding admin page object (but not route it!).  To do this we just set _routing to false.  That way this page object is being loaded on all pages to make sure we hook into admin properly.  But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;)
34 34
 		//This is important because we have hooks that help redirect custom post type saves
35
-		if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) {
35
+		if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) {
36 36
 			$this->_routing = FALSE;
37 37
 			$this->_initialize_admin_page();
38 38
 		} else {
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 			$this->_initialize_admin_page();
41 41
 			//added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality
42 42
 			remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization');
43
-			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 );
43
+			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100);
44 44
 			//end removal of autosave functionality.
45 45
 		}
46 46
 	}
47 47
 
48 48
 	public function wp_just_in_time_script_localization() {
49
-		wp_localize_script( 'autosave', 'autosaveL10n', array(
49
+		wp_localize_script('autosave', 'autosaveL10n', array(
50 50
 			'autosaveInterval' => 172800,
51 51
 			'savingText' => __('Saving Draft&#8230;'),
52 52
 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')
53
-		) );
53
+		));
54 54
 	}
55 55
 
56 56
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Loader.core.php 2 patches
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 		//let's do a scan and see what installed pages we have
120 120
 		$this->_get_installed_pages();
121 121
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
122
-		add_action('admin_menu', array( $this, 'set_menus' ));
123
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
122
+		add_action('admin_menu', array($this, 'set_menus'));
123
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
124 124
 	}
125 125
 
126 126
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	private function _define_caffeinated_constants() {
136
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
137
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
138
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
140
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
136
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
137
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
138
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
140
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
143 143
 		}
144 144
 	}
145 145
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		//set array of EE_Admin_Page_Menu_Group objects
160 160
 		$groups = array(
161
-			'main' => new EE_Admin_Page_Menu_Group( array(
161
+			'main' => new EE_Admin_Page_Menu_Group(array(
162 162
 				'menu_label' => __('Main', 'event_espresso'),
163 163
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
164 164
 				'menu_slug' => 'main',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'menu_order' => 0,
167 167
 				'parent_slug' => 'espresso_events',
168 168
 				)),
169
-			'management' => new EE_Admin_Page_Menu_Group( array(
169
+			'management' => new EE_Admin_Page_Menu_Group(array(
170 170
 				'menu_label' => __('Management', 'event_espresso'),
171 171
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
172 172
 				'menu_slug' => 'management',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				'menu_order' => 10,
175 175
 				'parent_slug' => 'espresso_events'
176 176
 				)),
177
-			'settings' => new EE_Admin_Page_Menu_Group( array(
177
+			'settings' => new EE_Admin_Page_Menu_Group(array(
178 178
 				'menu_label' => __('Settings', 'event_espresso'),
179 179
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
180 180
 				'menu_slug' => 'settings',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'menu_order' => 30,
183 183
 				'parent_slug' => 'espresso_events'
184 184
 				)),
185
-			'templates' => new EE_Admin_Page_Menu_Group( array(
185
+			'templates' => new EE_Admin_Page_Menu_Group(array(
186 186
 				'menu_label' => __('Templates', 'event_espresso'),
187 187
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
188 188
 				'menu_slug' => 'templates',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'menu_order' => 40,
191 191
 				'parent_slug' => 'espresso_events'
192 192
 				)),
193
-			'extras' => new EE_Admin_Page_Menu_Group( array(
193
+			'extras' => new EE_Admin_Page_Menu_Group(array(
194 194
 				'menu_label' => __('Extras', 'event_espresso'),
195 195
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
196 196
 				'menu_slug' => 'extras',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				'parent_slug' => 'espresso_events',
200 200
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
201 201
 				)),
202
-			'tools' => new EE_Admin_Page_Menu_Group( array(
202
+			'tools' => new EE_Admin_Page_Menu_Group(array(
203 203
 				'menu_label' => __("Tools", "event_espresso"),
204 204
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
205 205
 				'menu_slug' => 'tools',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				'menu_order' => 60,
208 208
 				'parent_slug' => 'espresso_events'
209 209
 				)),
210
-			'addons' => new EE_Admin_Page_Menu_Group( array(
210
+			'addons' => new EE_Admin_Page_Menu_Group(array(
211 211
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
212 212
 				'menu_label' => __('Add-ons', 'event_espresso'),
213 213
 				'menu_slug' => 'addons',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				))
218 218
 			);
219 219
 
220
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
220
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
221 221
 	}
222 222
 
223 223
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	private function _rearrange_menu_groups() {
236 236
 		$groups = array();
237 237
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
-		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
238
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
239
+		foreach ($this->_admin_menu_groups as $group) {
240
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
241
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
242 242
 			$groups[$group->menu_slug] = $group;
243 243
 		}
244 244
 		return $groups;
@@ -256,48 +256,48 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private function _get_installed_pages() {
258 258
 		$installed_refs = array();
259
-		$exclude = array( 'assets', 'templates' );
259
+		$exclude = array('assets', 'templates');
260 260
 		// grab everything in the  admin core directory
261
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
262
-		if ( $admin_screens ) {
263
-			foreach( $admin_screens as $admin_screen ) {
261
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
262
+		if ($admin_screens) {
263
+			foreach ($admin_screens as $admin_screen) {
264 264
 				// files and anything in the exclude array need not apply
265
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
265
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
266 266
 					// these folders represent the different EE admin pages
267
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
267
+					$installed_refs[basename($admin_screen)] = $admin_screen;
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( empty( $installed_refs ) ) {
272
+		if (empty($installed_refs)) {
273 273
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
274
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
275
-			throw new EE_Error( implode( '||', $error_msg ));
274
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
275
+			throw new EE_Error(implode('||', $error_msg));
276 276
 		}
277 277
 
278 278
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
279 279
 		$installed_refs = $this->_set_caffeinated($installed_refs);
280 280
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
281
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
282
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
281
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
282
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
283 283
 
284 284
 		//loop through admin pages and setup the $_installed_pages array.
285 285
 		$hooks_ref = array();
286
-		foreach ( $installed_refs as $page => $path ) {
286
+		foreach ($installed_refs as $page => $path) {
287 287
 			// set autoloaders for our admin page classes based on included path information
288
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
288
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
289 289
 			// build list of installed pages
290
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
290
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
291 291
 			// verify returned object
292
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
293
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
292
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
293
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
294 294
 					continue;
295 295
 				}
296 296
 
297 297
 				//skip if in full maintenance mode and maintenance_mode_parent is set
298 298
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
299
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
300
-					unset( $installed_refs[$page] );
299
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
300
+					unset($installed_refs[$page]);
301 301
 					continue;
302 302
 				}
303 303
 
@@ -305,45 +305,45 @@  discard block
 block discarded – undo
305 305
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
306 306
 				$extend = FALSE;
307 307
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
308
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
308
+				if (isset($this->_caffeinated_extends[$page])) {
309 309
 					$this->_current_caf_extend_slug = $page;
310
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
311
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
312
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
313
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
310
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
311
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
312
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
313
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
314 314
 
315
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
316
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
315
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
316
+					$hook_function_page = create_function('$admin_page', $page_runtime);
317 317
 
318
-					add_filter( $path_hook, $hook_function_path );
319
-					add_filter( $page_hook, $hook_function_page );
318
+					add_filter($path_hook, $hook_function_path);
319
+					add_filter($page_hook, $hook_function_page);
320 320
 					$extend = TRUE;
321 321
 				}
322 322
 				//let's do the registered hooks
323
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
323
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
324 324
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
325 325
 			}
326 326
 		}
327 327
 
328 328
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
329 329
 		//first make sure we've got unique values
330
-		$hooks_ref = array_unique( $hooks_ref );
330
+		$hooks_ref = array_unique($hooks_ref);
331 331
 		//now let's loop and require!
332
-		foreach ( $hooks_ref as $path ) {
333
-			require_once( $path );
332
+		foreach ($hooks_ref as $path) {
333
+			require_once($path);
334 334
 		}
335 335
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
336 336
 		global $ee_menu_slugs;
337 337
 		$ee_menu_slugs = $this->_menu_slugs;
338 338
 
339 339
 		//we need to loop again to run any early code
340
-		foreach ( $installed_refs as $page => $path ) {
341
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
340
+		foreach ($installed_refs as $page => $path) {
341
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
342 342
 				$this->_installed_pages[$page]->do_initial_loads();
343 343
 			}
344 344
 		}
345 345
 
346
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
346
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
347 347
 
348 348
 	}
349 349
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 	 * @param string $page_slug
356 356
 	 * @return EE_Admin_Page
357 357
 	 */
358
-	public function get_admin_page_object( $page_slug = '' ) {
359
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
360
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
358
+	public function get_admin_page_object($page_slug = '') {
359
+		if (isset($this->_installed_pages[$page_slug])) {
360
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
361 361
 		}
362 362
 		return NULL;
363 363
 	}
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param $dir_name
371 371
 	 * @return string
372 372
 	 */
373
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
374
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
375
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
373
+	private function _get_classname_for_admin_page($dir_name = '') {
374
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
375
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
376 376
 	}
377 377
 
378 378
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	 * @param $dir_name
384 384
 	 * @return string
385 385
 	 */
386
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
387
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
388
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
386
+	private function _get_classname_for_admin_init_page($dir_name = '') {
387
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
388
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
389 389
 	}
390 390
 
391 391
 
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	 * @throws EE_Error
399 399
 	 * @return object|bool  return page object if valid, bool false if not.
400 400
 	 */
401
-	private function _load_admin_page( $page = '', $path = '' ) {
402
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
403
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404
-		if ( ! class_exists( $class_name )) {
405
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
406
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name );
407
-			throw new EE_Error( implode( '||', $error_msg ));
401
+	private function _load_admin_page($page = '', $path = '') {
402
+		$class_name = $this->_get_classname_for_admin_init_page($page);
403
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
404
+		if ( ! class_exists($class_name)) {
405
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
406
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name);
407
+			throw new EE_Error(implode('||', $error_msg));
408 408
 		}
409 409
 		$a = new ReflectionClass($class_name);
410 410
 		return  $a->newInstance();
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 	public function set_menus() {
424 424
 		//prep the menu pages (sort, group.)
425 425
 		$this->_prep_pages();
426
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
427
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
428
-				$menu_map->add_menu_page( FALSE );
426
+		foreach ($this->_prepped_menu_maps as $menu_map) {
427
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
428
+				$menu_map->add_menu_page(FALSE);
429 429
 			}
430 430
 		}
431 431
 	}
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
 	 *
439 439
 	 * @return void
440 440
 	 */
441
-	public function set_network_menus(){
441
+	public function set_network_menus() {
442 442
 		$this->_prep_pages();
443
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
444
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
445
-				$menu_map->add_menu_page( TRUE );
443
+		foreach ($this->_prepped_menu_maps as $menu_map) {
444
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
445
+				$menu_map->add_menu_page(TRUE);
446 446
 			}
447 447
 		}
448 448
 	}
@@ -463,22 +463,22 @@  discard block
 block discarded – undo
463 463
 		//rearrange _admin_menu_groups to be indexed by group slug.
464 464
 		$menu_groups = $this->_rearrange_menu_groups();
465 465
 
466
-		foreach( $this->_installed_pages as $page ) {
467
-			if ( $page instanceof EE_Admin_page_Init ) {
466
+		foreach ($this->_installed_pages as $page) {
467
+			if ($page instanceof EE_Admin_page_Init) {
468 468
 				$page_map = $page->get_menu_map();
469 469
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
470
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
471
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
470
+				if (is_array($page_map) || empty($page_map)) {
471
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
472 472
 					continue;
473 473
 				}
474 474
 
475 475
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
476
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
477
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
476
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
477
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
478 478
 				}
479 479
 
480 480
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
481
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
481
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
482 482
 					continue;
483 483
 				}
484 484
 
@@ -487,21 +487,21 @@  discard block
 block discarded – undo
487 487
 			}
488 488
 		}
489 489
 
490
-		if ( empty( $pages_array )) {
491
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
490
+		if (empty($pages_array)) {
491
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
492 492
 		}
493 493
 
494 494
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495
-		foreach ( $pages_array as $group => $menu_maps ) {
495
+		foreach ($pages_array as $group => $menu_maps) {
496 496
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
497
+			if ( ! array_key_exists($group, $menu_groups))
498 498
 				continue;
499 499
 
500 500
 			//sort pages.
501
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
501
+			usort($menu_maps, array($this, '_sort_menu_maps'));
502 502
 
503 503
 			//prepend header
504
-			array_unshift( $menu_maps, $menu_groups[$group] );
504
+			array_unshift($menu_maps, $menu_groups[$group]);
505 505
 
506 506
 			//reset $pages_array with prepped data
507 507
 			$pages_array[$group] = $menu_maps;
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 
510 510
 
511 511
 		//now let's setup the _prepped_menu_maps property
512
-		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
512
+		foreach ($menu_groups as $group => $group_objs) {
513
+			if (isset($pages_array[$group]))
514
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
515 515
 		}/**/
516 516
 
517 517
 	}
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
532 532
 	 * @return array
533 533
 	 */
534
-	private function _set_caffeinated( $installed_refs ) {
534
+	private function _set_caffeinated($installed_refs) {
535 535
 
536 536
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
537
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
537
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
538 538
 			return $installed_refs;
539 539
 		}
540 540
 
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 		$exclude = array('tickets');
544 544
 
545 545
 		//okay let's setup an "New" pages first (we'll return installed refs later)
546
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
547
-		if ( $new_admin_screens ) {
548
-			foreach( $new_admin_screens as $admin_screen ) {
546
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
547
+		if ($new_admin_screens) {
548
+			foreach ($new_admin_screens as $admin_screen) {
549 549
 				// files and anything in the exclude array need not apply
550
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
550
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
551 551
 					// these folders represent the different NEW EE admin pages
552
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
552
+					$installed_refs[basename($admin_screen)] = $admin_screen;
553 553
 					// set autoloaders for our admin page classes based on included path information
554
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
554
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
555 555
 //					$this->_caf_autoloader[] = array(
556 556
 //						'dir' => 'new',
557 557
 //						'folder' => basename( $admin_screen )
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
 		}
562 562
 
563 563
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
564
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
565
-		if ( $extends ) {
566
-			foreach( $extends as $extend ) {
567
-				if ( is_dir( $extend ) ) {
568
-					$extend_ref = basename( $extend );
564
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
565
+		if ($extends) {
566
+			foreach ($extends as $extend) {
567
+				if (is_dir($extend)) {
568
+					$extend_ref = basename($extend);
569 569
 					//now let's make sure there is a file that matches the expected format
570
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
571
-					$filename = 'Extend_' . $filename . '_Admin_Page';
572
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
570
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
571
+					$filename = 'Extend_'.$filename.'_Admin_Page';
572
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
573 573
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
574 574
 					// set autoloaders for our admin page classes based on included path information
575
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
575
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
576 576
 //					$this->_caf_autoloader[] = array(
577 577
 //						'dir' => 'extend',
578 578
 //						'folder' => $extend_ref
@@ -583,22 +583,22 @@  discard block
 block discarded – undo
583 583
 
584 584
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
585 585
 		$ee_admin_hooks = array();
586
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
587
-		if ( $hooks ) {
588
-			foreach ( $hooks as $hook ) {
589
-				if ( is_readable( $hook ) ) {
586
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
587
+		if ($hooks) {
588
+			foreach ($hooks as $hook) {
589
+				if (is_readable($hook)) {
590 590
 					require_once $hook;
591
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
591
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
592 592
 					$classname = str_replace('.class.php', '', $classname);
593
-					if ( class_exists( $classname ) ) {
594
-						$a = new ReflectionClass( $classname );
593
+					if (class_exists($classname)) {
594
+						$a = new ReflectionClass($classname);
595 595
 						$ee_admin_hooks[] = $a->newInstance();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}/**/
600 600
 
601
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
601
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
602 602
 
603 603
 		return $installed_refs;
604 604
 
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
656 656
 	 * @return int    sort order
657 657
 	 */
658
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
658
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
659
+		if ($a->menu_order == $b->menu_order)
660 660
 			return 0;
661 661
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 662
 	}
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -237,8 +238,9 @@  discard block
 block discarded – undo
237 238
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238 239
 		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239 240
 		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
241
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group ) {
242
+							throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
243
+			}
242 244
 			$groups[$group->menu_slug] = $group;
243 245
 		}
244 246
 		return $groups;
@@ -494,8 +496,9 @@  discard block
 block discarded – undo
494 496
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495 497
 		foreach ( $pages_array as $group => $menu_maps ) {
496 498
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
498
-				continue;
499
+			if ( ! array_key_exists( $group, $menu_groups ) ) {
500
+							continue;
501
+			}
499 502
 
500 503
 			//sort pages.
501 504
 			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
@@ -510,8 +513,9 @@  discard block
 block discarded – undo
510 513
 
511 514
 		//now let's setup the _prepped_menu_maps property
512 515
 		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
516
+			if ( isset( $pages_array[$group] ) ) {
517
+							$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
518
+			}
515 519
 		}/**/
516 520
 
517 521
 	}
@@ -656,8 +660,9 @@  discard block
 block discarded – undo
656 660
 	 * @return int    sort order
657 661
 	 */
658 662
 	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
660
-			return 0;
663
+		if ( $a->menu_order == $b->menu_order ) {
664
+					return 0;
665
+		}
661 666
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 667
 	}
663 668
 
Please login to merge, or discard this patch.
core/admin/EE_Help_Tour_final_stop.class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			'action' => 'admin_option_settings',
61 61
 			'page' => 'espresso_general_settings'
62 62
 			);
63
-		return '<p>' . sprintf( __('That\'s it for the tour!  At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons.  There are help tours available on all Event Espresso Admin pages.  If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>';
63
+		return '<p>'.sprintf(__('That\'s it for the tour!  At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons.  There are help tours available on all Event Espresso Admin pages.  If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>';
64 64
 	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
core/admin/templates/about_admin_wrapper.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin about-wrap">
2 2
 
3 3
 	<h1><?php  echo $admin_page_title; ?></h1>
4
-	<div class="about-text"><?php echo !empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5
-	<div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf( esc_attr__( '%s Logo', 'event_espresso' ), 'Event Espresso' ); ?>"/><br /><?php printf( __('Version %s', 'event_espresso' ),  EVENT_ESPRESSO_VERSION ); ?></div>
4
+	<div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5
+	<div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf(esc_attr__('%s Logo', 'event_espresso'), 'Event Espresso'); ?>"/><br /><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div>
6 6
 
7 7
 	<?php echo $nav_tabs; ?>
8 8
 
9 9
 
10 10
 <?php
11
-	do_action( 'AHEE__admin_wrapper__template__before_about_admin_page_content' );
11
+	do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
12 12
 	echo $about_admin_page_content;
13
-	do_action( 'AHEE__admin_wrapper__template__after_about_admin_page_content' );
13
+	do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
14 14
 ?>
15 15
 
16 16
 </div>
Please login to merge, or discard this patch.