Completed
Branch BETA-4.9-message-activity (c2a8e0)
by
unknown
18:28 queued 10s
created
core/libraries/shortcodes/EE_Transaction_Shortcodes.lib.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 		$this->_shortcodes = array(
43 43
 			'[TXN_ID]' => __('The transaction id for the purchase.', 'event_espresso'),
44 44
 			'[PAYMENT_URL]' => __('This is a link to make a payment for the event', 'event_espresso'),
45
-			'[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>'
46
-				. '<li>' . sprintf( __('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
47
-				. '<li>' . sprintf( __('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
48
-				. '<li>' . sprintf( __('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
45
+			'[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>'
46
+				. '<li>'.sprintf(__('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>'
47
+				. '<li>'.sprintf(__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>'
48
+				. '<li>'.sprintf(__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>'
49 49
 				. '</ul>',
50
-			'[PAYMENT_DUE_DATE_*]' => __( 'This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso' )
50
+			'[PAYMENT_DUE_DATE_*]' => __('This is a special dynamic shortcode that allows one to output a payment due date.  It will only result in a date shown if there is money owing.  Three parameters are available on this shortcode:', 'event_espresso')
51 51
 				. '<ul>'
52
-				. '<li>' . sprintf( __( '%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
53
-				. '<li>' . sprintf( __( '%days_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>'
54
-				. '<li>' . sprintf( __( '%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>',
52
+				. '<li>'.sprintf(__('%sformat:%s This is used to indicate what format the date is in.  Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>'
53
+				. '<li>'.sprintf(__('%days_until_due:%s This is the number of days form the transaction creation date that the payment is due.  Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>'
54
+				. '<li>'.sprintf(__('%sprefix_text:%s You can use this to indicate what text will prefix the date string.  Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>',
55 55
 			'[INVOICE_LINK]' => __('This is a full html link to the invoice', 'event_espresso'),
56 56
 			'[INVOICE_URL]' => __('This is just the url for the invoice', 'event_espresso'),
57 57
 			'[INVOICE_LOGO_URL]' => __('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'),
58 58
 			'[INVOICE_LOGO]' => __('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'),
59 59
 			'[INVOICE_PAYEE_NAME]' => __('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
60
-			'[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
61
-			'[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ),
62
-			'[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ),
63
-			'[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ),
60
+			'[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
61
+			'[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'),
62
+			'[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'),
63
+			'[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number.  It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56.  If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'),
64 64
 			'[TOTAL_COST]' => __('The total cost for the transaction', 'event_espresso'),
65 65
 			'[TXN_STATUS]' => __('The transaction status for the transaction.', 'event_espresso'),
66 66
 			'[TXN_STATUS_ID]' => __('The ID representing the transaction status as saved in the db.  This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'),
@@ -71,52 +71,52 @@  discard block
 block discarded – undo
71 71
 			'[TOTAL_OWING]' => __('The total owing on a transaction with no attributes.', 'event_espresso'),
72 72
 			'[TXN_SUBTOTAL]' => __('The subtotal for all txn line items.', 'event_espresso'),
73 73
 			'[TXN_TAX_SUBTOTAL]' => __('The subtotal for all tax line items.', 'event_espresso'),
74
-			'[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' .
75
-				'<li><strong>still_owing</strong>:' . __('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( __( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' .
76
-				'<li><strong>none_owing</strong>:' . __('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>',
74
+			'[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'.
75
+				'<li><strong>still_owing</strong>:'.__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'.
76
+				'<li><strong>none_owing</strong>:'.__('If the transaction is paid in full, then you can indicate how this gets displayed.  Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>',
77 77
 			'[TXN_TOTAL_TICKETS]' => __('The total number of all tickets purchased in a transaction', 'event_espresso'),
78 78
 			'[TKT_QTY_PURCHASED]' => __('The total number of all tickets purchased in a transaction. <strong>NOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.</strong>', 'event_espresso'),
79 79
 			'[TRANSACTION_ADMIN_URL]' => __('The url to the admin page for this transaction', 'event_espresso'),
80 80
 			'[RECEIPT_URL]' => __('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'),
81
-			'[INVOICE_RECEIPT_SWITCHER_URL]' => __( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
-			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( __( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' )
81
+			'[INVOICE_RECEIPT_SWITCHER_URL]' => __('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active  then will parse to an empty string.', 'event_espresso'),
82
+			'[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>')
83 83
 			);
84 84
 	}
85 85
 
86 86
 
87
-	protected function _parser( $shortcode ) {
87
+	protected function _parser($shortcode) {
88 88
 
89 89
 		//attempt to get the transaction.  Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction.
90 90
 		$transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null;
91
-		$transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction;
91
+		$transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction;
92 92
 
93 93
 		//payment
94 94
 		$payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null;
95
-		$payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) &&  isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment;
95
+		$payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment;
96 96
 
97 97
 
98
-		if ( ! $transaction instanceof EE_Transaction )
98
+		if ( ! $transaction instanceof EE_Transaction)
99 99
 			return '';
100 100
 
101
-		switch ( $shortcode ) {
101
+		switch ($shortcode) {
102 102
 			case '[TXN_ID]' :
103 103
 				return $transaction->ID();
104 104
 				break;
105 105
 
106 106
 			case '[PAYMENT_URL]' :
107 107
 				$payment_url = $transaction->payment_overview_url();
108
-				return empty( $payment_url ) ? __( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
108
+				return empty($payment_url) ? __('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url;
109 109
 				break;
110 110
 
111 111
 			case '[INVOICE_LINK]' :
112 112
 				$invoice_url = $transaction->invoice_url();
113
-				$invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
-				return sprintf( __('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' );
113
+				$invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
114
+				return sprintf(__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>');
115 115
 				break; /**/
116 116
 
117 117
 			case '[INVOICE_URL]' :
118 118
 				$invoice_url = $transaction->invoice_url();
119
-				return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
119
+				return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url;
120 120
 				break;
121 121
 
122 122
 			case '[INVOICE_LOGO_URL]' :
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				break;
125 125
 
126 126
 			case '[INVOICE_LOGO]' :
127
-				return $this->_get_invoice_logo( TRUE );
127
+				return $this->_get_invoice_logo(TRUE);
128 128
 				break;
129 129
 
130 130
 			case '[INVOICE_PAYEE_NAME]' :
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 
147 147
 			case "[TOTAL_COST]" :
148 148
 				$total = $transaction->total();
149
-				return ! empty($total) ? EEH_Template::format_currency( $total ) : '';
149
+				return ! empty($total) ? EEH_Template::format_currency($total) : '';
150 150
 				break;
151 151
 
152 152
 			case "[PAYMENT_STATUS]" :
153 153
 				$status = $transaction->pretty_status();
154
-				return !empty($status) ? $status : __('Unknown', 'event_espresso');
154
+				return ! empty($status) ? $status : __('Unknown', 'event_espresso');
155 155
 				break; /**/
156 156
 
157 157
 			// note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity.
158 158
 			case "[TXN_STATUS]" :
159 159
 				$status = $transaction->pretty_status();
160
-				return !empty( $status ) ? $status : __('Unknown', 'event_espresso');
160
+				return ! empty($status) ? $status : __('Unknown', 'event_espresso');
161 161
 				break;
162 162
 
163 163
 			case "[TXN_STATUS_ID]" :
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 				break;
166 166
 
167 167
 			case "[PAYMENT_GATEWAY]" :
168
-				return $this->_get_payment_gateway( $transaction );
168
+				return $this->_get_payment_gateway($transaction);
169 169
 				break;
170 170
 
171 171
 			case "[AMOUNT_PAID]" :
172 172
 				$amount = $payment instanceof EE_Payment ? $payment->amount() : 0;
173
-				return EEH_Template::format_currency( $amount );
173
+				return EEH_Template::format_currency($amount);
174 174
 				break;
175 175
 
176 176
 			case "[TOTAL_AMOUNT_PAID]" :
177
-				return EEH_Template::format_currency( $transaction->paid() );
177
+				return EEH_Template::format_currency($transaction->paid());
178 178
 				break;
179 179
 
180 180
 			case "[TOTAL_OWING]" :
181 181
 				$total_owing = $transaction->remaining();
182
-				return EEH_Template::format_currency( $total_owing );
182
+				return EEH_Template::format_currency($total_owing);
183 183
 				break;
184 184
 
185 185
 			case "[TXN_SUBTOTAL]" :
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				break;
188 188
 
189 189
 			case "[TXN_TAX_SUBTOTAL]" :
190
-				return EEH_Template::format_currency($this->_get_subtotal( TRUE ));
190
+				return EEH_Template::format_currency($this->_get_subtotal(TRUE));
191 191
 				break;
192 192
 
193 193
 			case "[TKT_QTY_PURCHASED]" :
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 				break;
197 197
 
198 198
 			case "[TRANSACTION_ADMIN_URL]" :
199
-				require_once EE_CORE . 'admin/EE_Admin_Page.core.php';
200
-				$query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() );
201
-				$url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') );
199
+				require_once EE_CORE.'admin/EE_Admin_Page.core.php';
200
+				$query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID());
201
+				$url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php'));
202 202
 				return $url;
203 203
 				break;
204 204
 
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 				//get primary_registration
207 207
 				$reg = $this->_data->primary_reg_obj;
208 208
 
209
-				if ( ! $reg instanceof EE_Registration ) {
209
+				if ( ! $reg instanceof EE_Registration) {
210 210
 					return '';
211 211
 				}
212 212
 				return $reg->receipt_url();
213 213
 				break;
214 214
 
215 215
 			case "[INVOICE_RECEIPT_SWITCHER_URL]" :
216
-				return $this->_get_invoice_receipt_switcher( FALSE );
216
+				return $this->_get_invoice_receipt_switcher(FALSE);
217 217
 				break;
218 218
 
219 219
 			case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" :
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 
224 224
 		}
225 225
 
226
-		if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) {
227
-			return $this->_get_custom_total_oweing( $shortcode );
226
+		if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) {
227
+			return $this->_get_custom_total_oweing($shortcode);
228 228
 		}
229 229
 
230
-		if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) {
231
-			return $this->_get_invoice_payee_tax_number( $shortcode );
230
+		if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) {
231
+			return $this->_get_invoice_payee_tax_number($shortcode);
232 232
 		}
233 233
 
234
-		if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) {
235
-			return $this->_get_payment_link_if_needed( $shortcode );
234
+		if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) {
235
+			return $this->_get_payment_link_if_needed($shortcode);
236 236
 		}
237 237
 
238
-		if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) {
239
-			return $this->_get_payment_due_date( $shortcode, $transaction );
238
+		if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) {
239
+			return $this->_get_payment_due_date($shortcode, $transaction);
240 240
 		}
241 241
 
242 242
 		return '';
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return string parsed.
255 255
 	 */
256
-	private function _get_custom_total_oweing( $shortcode ) {
257
-		$valid_shortcodes = array( 'transaction' );
258
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
256
+	private function _get_custom_total_oweing($shortcode) {
257
+		$valid_shortcodes = array('transaction');
258
+		$attrs = $this->_get_shortcode_attrs($shortcode);
259 259
 
260 260
 		//ensure default is set.
261 261
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
262 262
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
263 263
 
264
-		if ( $total_owing > 0 ) {
265
-			$owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( __( '%sPlease make a payment.%s', 'event_espresso'),  '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' );
266
-			$owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
264
+		if ($total_owing > 0) {
265
+			$owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>');
266
+			$owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
267 267
 		} else {
268
-			$owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : '';
268
+			$owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : '';
269 269
 		}
270 270
 
271 271
 		return $owing_content;
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 
274 274
 
275 275
 
276
-	private function _get_payment_gateway( $transaction ) {
277
-		$pm = $this->_get_payment_method( $transaction );
276
+	private function _get_payment_gateway($transaction) {
277
+		$pm = $this->_get_payment_method($transaction);
278 278
 		return $pm instanceof EE_Payment_Method ? $pm->name() : '';
279 279
 	}
280 280
 
@@ -289,37 +289,37 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return string url or html
291 291
 	 */
292
-	private function _get_invoice_logo( $img_tags = FALSE ) {
292
+	private function _get_invoice_logo($img_tags = FALSE) {
293 293
 		//try to get the invoice payment method's logo for this transaction image first
294 294
 		$pm = $this->_get_payment_method();
295
-		if ( $pm instanceof EE_Payment_Method ){
296
-			$invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE );
297
-		}else{
295
+		if ($pm instanceof EE_Payment_Method) {
296
+			$invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE);
297
+		} else {
298 298
 			$invoice_logo_url = NULL;
299 299
 		}
300
-		if( empty( $invoice_logo_url ) ){
300
+		if (empty($invoice_logo_url)) {
301 301
 			$invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url;
302 302
 		}
303 303
 
304
-		if ( empty( $invoice_logo_url ) ) {
304
+		if (empty($invoice_logo_url)) {
305 305
 			return '';
306 306
 		}
307 307
 
308
-		if ( ! $img_tags ) {
308
+		if ( ! $img_tags) {
309 309
 			return $invoice_logo_url;
310 310
 		}
311 311
 
312 312
 		//image tags have been requested.
313
-		$image_size = getimagesize( $invoice_logo_url );
313
+		$image_size = getimagesize($invoice_logo_url);
314 314
 		
315 315
 		//if image is wider than 200px, set the wideth to 200
316
-		if ( $image_size[0] > 300 ) {
316
+		if ($image_size[0] > 300) {
317 317
 			$image_width = 300;
318
-		}else{
318
+		} else {
319 319
 			$image_width = $image_size[0];
320 320
 		}
321 321
 
322
-		return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />';
322
+		return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />';
323 323
 	}
324 324
 
325 325
 
@@ -336,26 +336,26 @@  discard block
 block discarded – undo
336 336
 	private function _get_invoice_payee_name() {
337 337
 		$payee_name = NULL;
338 338
 		$pm = $this->_get_payment_method();
339
-		if( $pm instanceof EE_Payment_Method ){
340
-			$payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE );
339
+		if ($pm instanceof EE_Payment_Method) {
340
+			$payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE);
341 341
 		}
342
-		$payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name;
342
+		$payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name;
343 343
 		return $payee_name;
344 344
 	}
345 345
 
346 346
 	/**
347 347
 	 * gets the payment method for this transaction. Otherwise gets a default one.
348 348
 	 */
349
-	private function _get_payment_method( $transaction = null ){
350
-		if( $transaction instanceof EE_Transaction ) {
349
+	private function _get_payment_method($transaction = null) {
350
+		if ($transaction instanceof EE_Transaction) {
351 351
 			$payment_method = $transaction->payment_method();
352
-			if ( empty( $payment_method ) ) {
353
-				return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
352
+			if (empty($payment_method)) {
353
+				return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
354 354
 			}
355 355
 			return $payment_method;
356
-		}else{
356
+		} else {
357 357
 			//get the first payment method we can find
358
-			return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
358
+			return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice'));
359 359
 		}
360 360
 	}
361 361
 
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	private function _get_invoice_payee_email() {
373 373
 		$payee_email = NULL;
374 374
 		$pm = $this->_get_payment_method();
375
-		if( $pm instanceof EE_Payment_Method ){
376
-			$payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE );
375
+		if ($pm instanceof EE_Payment_Method) {
376
+			$payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE);
377 377
 		}
378
-		$payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email;
378
+		$payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email;
379 379
 		return $payee_email;
380 380
 	}
381 381
 
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @return string
393 393
 	 */
394
-	private function _get_invoice_payee_tax_number( $shortcode ) {
394
+	private function _get_invoice_payee_tax_number($shortcode) {
395 395
 		$payee_tax_number = NULL;
396 396
 		$pm = $this->_get_payment_method();
397
-		if( $pm instanceof EE_Payment_Method ){
398
-			$payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE );
397
+		if ($pm instanceof EE_Payment_Method) {
398
+			$payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE);
399 399
 		}
400
-		$payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
400
+		$payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number;
401 401
 
402
-		if ( empty( $payee_tax_number ) ) {
402
+		if (empty($payee_tax_number)) {
403 403
 			return '';
404 404
 		}
405 405
 
406 406
 		//any attributes?
407
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
407
+		$attrs = $this->_get_shortcode_attrs($shortcode);
408 408
 
409 409
 		//prefix?
410
-		$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : __( 'VAT/Tax Number: ', 'event_espresso' );
411
-		return $prefix . $payee_tax_number;
410
+		$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso');
411
+		return $prefix.$payee_tax_number;
412 412
 	}
413 413
 
414 414
 
@@ -425,22 +425,22 @@  discard block
 block discarded – undo
425 425
 	private function _get_invoice_payee_address() {
426 426
 		$payee_address = NULL;
427 427
 		$pm = $this->_get_payment_method();
428
-		if( $pm instanceof EE_Payment_Method ){
429
-			$payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE );
428
+		if ($pm instanceof EE_Payment_Method) {
429
+			$payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE);
430 430
 		}
431
-		if ( empty( $payee_address ) ) {
431
+		if (empty($payee_address)) {
432 432
 			$organization = EE_Registry::instance()->CFG->organization;
433
-			$payee_address = $organization->get_pretty( 'address_1' ) . '<br>';
434
-			$payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : '';
435
-			$payee_address .= $organization->get_pretty( 'city' ) . '<br>';
433
+			$payee_address = $organization->get_pretty('address_1').'<br>';
434
+			$payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : '';
435
+			$payee_address .= $organization->get_pretty('city').'<br>';
436 436
 
437 437
 			//state
438
-			$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID );
439
-			$payee_address .= $state instanceof EE_State ? $state->name()  : '';
438
+			$state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID);
439
+			$payee_address .= $state instanceof EE_State ? $state->name() : '';
440 440
 
441 441
 			//Country
442
-			$payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : '';
443
-			$payee_address .= ! empty( $organization->zip ) ? $organization->zip : '';
442
+			$payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : '';
443
+			$payee_address .= ! empty($organization->zip) ? $organization->zip : '';
444 444
 		}
445 445
 		return $payee_address;
446 446
 	}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	private function _get_invoice_payment_instructions() {
459 459
 		$instructions = NULL;
460 460
 		$pm = $this->_get_payment_method();
461
-		return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : '';
461
+		return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : '';
462 462
 	}
463 463
 
464 464
 
@@ -472,27 +472,27 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @return string
474 474
 	 */
475
-	protected function _get_invoice_receipt_switcher( $button = TRUE ) {
475
+	protected function _get_invoice_receipt_switcher($button = TRUE) {
476 476
 		$reg = $this->_data->primary_reg_obj;
477
-		$message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : '';
478
-		if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) {
477
+		$message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : '';
478
+		if ( ! $reg instanceof EE_Registration || empty($message_type)) {
479 479
 			return '';
480 480
 		}
481 481
 
482
-		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type  ? true : false;
483
-		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso' ) : __( 'Switch to Invoice', 'event_espresso' );
484
-		$switch_to_label = ! $switch_to_invoice ? __( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label;
482
+		$switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false;
483
+		$switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso') : __('Switch to Invoice', 'event_espresso');
484
+		$switch_to_label = ! $switch_to_invoice ? __('Switch to Receipt', 'event_espresso') : $switch_to_label;
485 485
 		$switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url();
486 486
 
487
-		if ( ! $button ) {
487
+		if ( ! $button) {
488 488
 			return $switch_to_url;
489 489
 		}
490 490
 
491
-		if ( ! empty( $switch_to_url ) ) {
491
+		if ( ! empty($switch_to_url)) {
492 492
 
493 493
 			return  '
494
-	<form method="post" action="' . $switch_to_url . '" >
495
-		<input class="print_button" type="submit" value="' . $switch_to_label . '" />
494
+	<form method="post" action="' . $switch_to_url.'" >
495
+		<input class="print_button" type="submit" value="' . $switch_to_label.'" />
496 496
 	</form>
497 497
 			';
498 498
 		}
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	 *
513 513
 	 * @return string
514 514
 	 */
515
-	private function _get_receipt_url( EE_Transaction $transaction ) {
515
+	private function _get_receipt_url(EE_Transaction $transaction) {
516 516
 		//get primary_registration
517 517
 		$reg = $this->_data->primary_reg_obj;
518 518
 
519
-		if ( ! $reg instanceof EE_Registration ) {
519
+		if ( ! $reg instanceof EE_Registration) {
520 520
 			return '';
521 521
 		}
522 522
 
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return int
534 534
 	 */
535
-	private function _get_subtotal( $tax = FALSE ) {
536
-		$grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL;
535
+	private function _get_subtotal($tax = FALSE) {
536
+		$grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL;
537 537
 
538
-		if ( ! $grand_total instanceof EE_Line_Item ) {
538
+		if ( ! $grand_total instanceof EE_Line_Item) {
539 539
 			return 0;
540 540
 		}
541 541
 
@@ -554,26 +554,26 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @return string parsed.
556 556
 	 */
557
-	private function _get_payment_link_if_needed( $shortcode ) {
558
-		$valid_shortcodes = array( 'transaction' );
559
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
557
+	private function _get_payment_link_if_needed($shortcode) {
558
+		$valid_shortcodes = array('transaction');
559
+		$attrs = $this->_get_shortcode_attrs($shortcode);
560 560
 
561 561
 		//ensure default is set.
562 562
 		$addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null;
563 563
 		$total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0;
564 564
 
565
-		if ( $total_owing > 0 ) {
566
-			$class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout';
567
-			$custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
-			$container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p';
569
-			$opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : '';
570
-			$opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag;
571
-			$opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag;
572
-			$closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : '';
573
-			$content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag;
565
+		if ($total_owing > 0) {
566
+			$class = isset($attrs['class']) ? $attrs['class'] : 'callout';
567
+			$custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.';
568
+			$container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p';
569
+			$opening_tag = ! empty($container_tag) ? '<'.$container_tag : '';
570
+			$opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag;
571
+			$opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag;
572
+			$closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : '';
573
+			$content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag;
574 574
 
575 575
 			//we need to re run this string through the parser to catch any shortcodes that are in it.
576
-			$owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message );
576
+			$owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message);
577 577
 		} else {
578 578
 			return '';
579 579
 		}
@@ -593,31 +593,31 @@  discard block
 block discarded – undo
593 593
 	 * @param EE_Transaction $transaction
594 594
 	 * @return string
595 595
 	 */
596
-	protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) {
596
+	protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) {
597 597
 		//if transaction is paid in full then we can just return an empty string
598
-		if ( $transaction->remaining() === 0 ) {
598
+		if ($transaction->remaining() === 0) {
599 599
 			return '';
600 600
 		}
601 601
 
602
-		$attrs = $this->_get_shortcode_attrs( $shortcode );
603
-		$format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' );
604
-		$days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30;
605
-		$prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : __( 'Payment in full due by: ', 'event_espresso' );
606
-		$transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' );
602
+		$attrs = $this->_get_shortcode_attrs($shortcode);
603
+		$format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format');
604
+		$days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30;
605
+		$prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : __('Payment in full due by: ', 'event_espresso');
606
+		$transaction_created = $transaction->get_DateTime_object('TXN_timestamp');
607 607
 
608 608
 		//setup date due:
609 609
 		try {
610
-			if ( $transaction_created instanceof DateTime ) {
611
-				$date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format );
610
+			if ($transaction_created instanceof DateTime) {
611
+				$date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format);
612 612
 			} else {
613 613
 				throw new Exception();
614 614
 			}
615
-		} catch( Exception $e ) {
615
+		} catch (Exception $e) {
616 616
 			//format was likely invalid.
617 617
 			$date_due = 'Unable to calculate date due, likely the format string is invalid.';
618 618
 		}
619 619
 
620
-		return $prefix_text . $date_due;
620
+		return $prefix_text.$date_due;
621 621
 	}
622 622
 
623 623
 } //end EE_Transaction Shortcodes library
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Shortcodes.lib.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 
173 173
 	public function get_shortcode_helper() {
174
-		if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes ) {
174
+		if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) {
175 175
 			$this->_set_shortcode_helper();
176 176
 		}
177 177
 		return $this->_shortcode_helper;
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 	 * @param  mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee)
186 186
 	 * @return string            parsed shortcode.
187 187
 	 */
188
-	public function parser($shortcode, $data, $extra_data = array() ) {
188
+	public function parser($shortcode, $data, $extra_data = array()) {
189 189
 
190 190
 		//filter setup shortcodes
191 191
 		$this->_shortcodes = $this->get_shortcodes();
192 192
 
193 193
 		//we need to setup any dynamic shortcodes so that they work with the array_key_exists
194
-		$sc = preg_match_all( '/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches );
195
-		$sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode;
194
+		$sc = preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches);
195
+		$sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode;
196 196
 
197 197
 		//first we want to make sure this is a valid shortcode
198
-		if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) )
198
+		if ( ! array_key_exists($sc_to_verify, $this->_shortcodes))
199 199
 			return false; //get out, this parser doesn't handle the incoming shortcode.
200 200
 		$this->_data = $data;
201 201
 		$this->_extra_data = $extra_data;
202 202
 		$this->_set_messages_properties();
203
-		$parsed = apply_filters( 'FHEE__' . get_class($this) . '__parser_after', $this->_parser($shortcode), $shortcode, $data, $extra_data, $this );
203
+		$parsed = apply_filters('FHEE__'.get_class($this).'__parser_after', $this->_parser($shortcode), $shortcode, $data, $extra_data, $this);
204 204
 
205 205
 		//note the below filter applies to ALL shortcode parsers... be careful!
206
-		$parsed = apply_filters( 'FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this );
206
+		$parsed = apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this);
207 207
 		return $parsed;
208 208
 	}
209 209
 
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	 * @return array array of shortcodes => description pairs
220 220
 	 */
221 221
 	public function get_shortcodes() {
222
-		$this->_shortcodes = apply_filters( 'FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this );
222
+		$this->_shortcodes = apply_filters('FHEE__'.get_class($this).'__shortcodes', $this->_shortcodes, $this);
223 223
 
224 224
 		//note the below filter applies to ALL shortcode parsers... be careful!
225
-		$this->_shortcodes = apply_filters( 'FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this );
225
+		$this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this);
226 226
 
227 227
 		return $this->_shortcodes;
228 228
 	}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param mixed (object|array) $data incoming data for the parser.  The data could be either an object or array because there are some shortcodes that might be replaced by prepared data that has multiple items in a list (i.e. list of attendees in an event and we're showing fname/lname for each attendee).  In this case data will be in an array.  Otherwise the data shoudl be in a properly formatted object.  The EEH_Parse_Shortcodes.helper.php describes the data object we're expecting.
253 253
 	 * @return string parsed shortcode
254 254
 	 */
255
-	abstract protected function _parser( $shortcode );
255
+	abstract protected function _parser($shortcode);
256 256
 
257 257
 
258 258
 
@@ -264,22 +264,22 @@  discard block
 block discarded – undo
264 264
 	protected function _validate_list_requirements() {
265 265
 
266 266
 		//first test to make sure we've got an array!
267
-		if ( !is_array($this->_data) ) {
268
-			throw new EE_Error( sprintf( __('Expecting an array for the data sent to %s. Instead it was %s', 'event_espresso'), get_class($this), gettype( $this->_data ) ) );
267
+		if ( ! is_array($this->_data)) {
268
+			throw new EE_Error(sprintf(__('Expecting an array for the data sent to %s. Instead it was %s', 'event_espresso'), get_class($this), gettype($this->_data)));
269 269
 		}
270 270
 
271 271
 		//next test to make sure we've got the required template in the index!
272
-		if ( !isset( $this->_data['template'] ) ) {
273
-			throw new EE_Error( sprintf( __('The incoming data does not have the required template index in its array', 'event_espresso') ) );
272
+		if ( ! isset($this->_data['template'])) {
273
+			throw new EE_Error(sprintf(__('The incoming data does not have the required template index in its array', 'event_espresso')));
274 274
 		}
275 275
 
276 276
 		//next test to make sure we've got got a data index in the incoming data array
277
-		if ( !isset( $this->_data['data'] ) )
278
-			throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') );
277
+		if ( ! isset($this->_data['data']))
278
+			throw new EE_Error(__('The incoming data does not have the required data index in its array', 'event_espresso'));
279 279
 
280 280
 		//all is well let's make sure _extra_data always has the values needed.
281 281
 		//let's make sure that extra_data includes all templates (for later parsing if necessary)
282
-		if ( empty( $this->_extra_data ) || ( empty( $this->_extra_data['data'] ) && empty( $this->_extra_data['template'] ) ) ) {
282
+		if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) {
283 283
 			$this->_extra_data['data'] = $this->_data['data'];
284 284
 			$this->_extra_data['template'] = $this->_data['template'];
285 285
 		}
@@ -296,16 +296,16 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return array An array with the attributes
298 298
 	 */
299
-	protected function _get_shortcode_attrs( $shortcode ) {
299
+	protected function _get_shortcode_attrs($shortcode) {
300 300
 		//make sure the required wp helper function is present
301 301
 		//require the shortcode file if necessary
302
-		if ( ! function_exists( 'shortcode_parse_atts' ) ) {
303
-			require_once( ABSPATH . WPINC . '/shortcodes.php');
302
+		if ( ! function_exists('shortcode_parse_atts')) {
303
+			require_once(ABSPATH.WPINC.'/shortcodes.php');
304 304
 		}
305 305
 
306 306
 		//let's get any attributes that may be present and set the defaults.
307
-		$shortcode_to_parse = str_replace( '[', '', str_replace( ']', '', $shortcode ) );
308
-		return shortcode_parse_atts( $shortcode_to_parse );
307
+		$shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode));
308
+		return shortcode_parse_atts($shortcode_to_parse);
309 309
 	}
310 310
 
311 311
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	protected function _set_messages_properties() {
322 322
 		//should be in _extra_data
323
-		if ( isset( $this->_extra_data['messenger'] ) ) {
323
+		if (isset($this->_extra_data['messenger'])) {
324 324
 			$this->_messenger = $this->_extra_data['messenger'];
325 325
 			$this->_message_type = $this->_extra_data['message_type'];
326 326
 			$this->_context = $this->_extra_data['message'] instanceof EE_Message ? $this->_extra_data['message']->context() : '';
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/model/Read.php 1 patch
Spacing   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\libraries\rest_api\Rest_Exception;
7 7
 use EventEspresso\core\libraries\rest_api\Model_Data_Translator;
8 8
 
9
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
10
-	exit( 'No direct script access allowed' );
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * @param \WP_REST_Request $request
47 47
 	 * @return \WP_REST_Response|\WP_Error
48 48
 	 */
49
-	public static function handle_request_get_all( \WP_REST_Request $request) {
49
+	public static function handle_request_get_all(\WP_REST_Request $request) {
50 50
 		$controller = new Read();
51
-		try{
51
+		try {
52 52
 			$matches = $controller->parse_route(
53 53
 				$request->get_route(),
54
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '(.*)~',
55
-				array( 'version', 'model' )
54
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'(.*)~',
55
+				array('version', 'model')
56 56
 			);
57
-			$controller->set_requested_version( $matches[ 'version' ] );
58
-			$model_name_singular = \EEH_Inflector::singularize_and_upper( $matches[ 'model' ] );
59
-			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version( $model_name_singular ) ) {
57
+			$controller->set_requested_version($matches['version']);
58
+			$model_name_singular = \EEH_Inflector::singularize_and_upper($matches['model']);
59
+			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version($model_name_singular)) {
60 60
 				return $controller->send_response(
61 61
 					new \WP_Error(
62 62
 						'endpoint_parsing_error',
63 63
 						sprintf(
64
-							__( 'There is no model for endpoint %s. Please contact event espresso support', 'event_espresso' ),
64
+							__('There is no model for endpoint %s. Please contact event espresso support', 'event_espresso'),
65 65
 							$model_name_singular
66 66
 						)
67 67
 					)
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 			return $controller->send_response(
71 71
 					$controller->get_entities_from_model(
72
-							$controller->get_model_version_info()->load_model( $model_name_singular ),
72
+							$controller->get_model_version_info()->load_model($model_name_singular),
73 73
 							$request
74 74
 					)
75 75
 			);
76
-		} catch( \Exception $e ) {
77
-			return $controller->send_response( $e );
76
+		} catch (\Exception $e) {
77
+			return $controller->send_response($e);
78 78
 		}
79 79
 	}
80 80
 
@@ -84,21 +84,21 @@  discard block
 block discarded – undo
84 84
 	 * @param \WP_REST_Request $request
85 85
 	 * @return \WP_REST_Response|\WP_Error
86 86
 	 */
87
-	public static function handle_request_get_one( \WP_REST_Request $request ) {
87
+	public static function handle_request_get_one(\WP_REST_Request $request) {
88 88
 		$controller = new Read();
89
-		try{
89
+		try {
90 90
 			$matches = $controller->parse_route(
91 91
 				$request->get_route(),
92
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '(.*)/(.*)~',
93
-				array( 'version', 'model', 'id' ) );
94
-			$controller->set_requested_version( $matches[ 'version' ] );
95
-			$model_name_singular = \EEH_Inflector::singularize_and_upper( $matches[ 'model' ] );
96
-			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version( $model_name_singular ) ) {
92
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'(.*)/(.*)~',
93
+				array('version', 'model', 'id') );
94
+			$controller->set_requested_version($matches['version']);
95
+			$model_name_singular = \EEH_Inflector::singularize_and_upper($matches['model']);
96
+			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version($model_name_singular)) {
97 97
 				return $controller->send_response(
98 98
 					new \WP_Error(
99 99
 						'endpoint_parsing_error',
100 100
 						sprintf(
101
-							__( 'There is no model for endpoint %s. Please contact event espresso support', 'event_espresso' ),
101
+							__('There is no model for endpoint %s. Please contact event espresso support', 'event_espresso'),
102 102
 							$model_name_singular
103 103
 						)
104 104
 					)
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 			}
107 107
 			return $controller->send_response(
108 108
 					$controller->get_entity_from_model(
109
-							$controller->get_model_version_info()->load_model( $model_name_singular ),
109
+							$controller->get_model_version_info()->load_model($model_name_singular),
110 110
 							$request
111 111
 						)
112 112
 				);
113
-		} catch( \Exception $e ) {
114
-			return $controller->send_response( $e );
113
+		} catch (\Exception $e) {
114
+			return $controller->send_response($e);
115 115
 		}
116 116
 	}
117 117
 
@@ -123,40 +123,40 @@  discard block
 block discarded – undo
123 123
 	 * @param \WP_REST_Request $request
124 124
 	 * @return \WP_REST_Response|\WP_Error
125 125
 	 */
126
-	public static function handle_request_get_related( \WP_REST_Request $request ) {
126
+	public static function handle_request_get_related(\WP_REST_Request $request) {
127 127
 		$controller = new Read();
128
-		try{
128
+		try {
129 129
 			$matches = $controller->parse_route(
130 130
 				$request->get_route(),
131
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . '(.*)/(.*)/(.*)~',
132
-				array( 'version', 'model', 'id', 'related_model' )
131
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'(.*)/(.*)/(.*)~',
132
+				array('version', 'model', 'id', 'related_model')
133 133
 			);
134
-			$controller->set_requested_version( $matches[ 'version' ] );
135
-			$main_model_name_singular = \EEH_Inflector::singularize_and_upper( $matches[ 'model' ] );
136
-			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version( $main_model_name_singular ) ) {
134
+			$controller->set_requested_version($matches['version']);
135
+			$main_model_name_singular = \EEH_Inflector::singularize_and_upper($matches['model']);
136
+			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version($main_model_name_singular)) {
137 137
 				return $controller->send_response(
138 138
 					new \WP_Error(
139 139
 						'endpoint_parsing_error',
140 140
 						sprintf(
141
-							__( 'There is no model for endpoint %s. Please contact event espresso support', 'event_espresso' ),
141
+							__('There is no model for endpoint %s. Please contact event espresso support', 'event_espresso'),
142 142
 							$main_model_name_singular
143 143
 						)
144 144
 					)
145 145
 				);
146 146
 			}
147
-			$main_model = $controller->get_model_version_info()->load_model( $main_model_name_singular );
147
+			$main_model = $controller->get_model_version_info()->load_model($main_model_name_singular);
148 148
 			//assume the related model name is plural and try to find the model's name
149
-			$related_model_name_singular = \EEH_Inflector::singularize_and_upper( $matches[ 'related_model' ] );
150
-			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version( $related_model_name_singular ) ) {
149
+			$related_model_name_singular = \EEH_Inflector::singularize_and_upper($matches['related_model']);
150
+			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version($related_model_name_singular)) {
151 151
 				//so the word didn't singularize well. Maybe that's just because it's a singular word?
152
-				$related_model_name_singular = \EEH_Inflector::humanize( $matches[ 'related_model' ] );
152
+				$related_model_name_singular = \EEH_Inflector::humanize($matches['related_model']);
153 153
 			}
154
-			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version( $related_model_name_singular ) ) {
154
+			if ( ! $controller->get_model_version_info()->is_model_name_in_this_version($related_model_name_singular)) {
155 155
 				return $controller->send_response(
156 156
 					new \WP_Error(
157 157
 						'endpoint_parsing_error',
158 158
 						sprintf(
159
-							__( 'There is no model for endpoint %s. Please contact event espresso support', 'event_espresso' ),
159
+							__('There is no model for endpoint %s. Please contact event espresso support', 'event_espresso'),
160 160
 							$related_model_name_singular
161 161
 						)
162 162
 					)
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 
166 166
 			return $controller->send_response(
167 167
 					$controller->get_entities_from_relation(
168
-						$request->get_param( 'id' ),
169
-						$main_model->related_settings_for( $related_model_name_singular ) ,
168
+						$request->get_param('id'),
169
+						$main_model->related_settings_for($related_model_name_singular),
170 170
 						$request
171 171
 					)
172 172
 				);
173
-		} catch( \Exception $e ) {
174
-			return $controller->send_response( $e );
173
+		} catch (\Exception $e) {
174
+			return $controller->send_response($e);
175 175
 		}
176 176
 	}
177 177
 
@@ -184,28 +184,28 @@  discard block
 block discarded – undo
184 184
 	 * @param \WP_REST_Request $request
185 185
 	 * @return array
186 186
 	 */
187
-	public function get_entities_from_model( $model, $request) {
188
-		$query_params = $this->create_model_query_params( $model, $request->get_params() );
189
-		if( ! Capabilities::current_user_has_partial_access_to( $model, $query_params[ 'caps' ] ) ) {
190
-			$model_name_plural = \EEH_Inflector::pluralize_and_lower( $model->get_this_model_name() );
187
+	public function get_entities_from_model($model, $request) {
188
+		$query_params = $this->create_model_query_params($model, $request->get_params());
189
+		if ( ! Capabilities::current_user_has_partial_access_to($model, $query_params['caps'])) {
190
+			$model_name_plural = \EEH_Inflector::pluralize_and_lower($model->get_this_model_name());
191 191
 			return new \WP_Error(
192
-				sprintf( 'rest_%s_cannot_list', $model_name_plural ),
192
+				sprintf('rest_%s_cannot_list', $model_name_plural),
193 193
 				sprintf(
194
-					__( 'Sorry, you are not allowed to list %1$s. Missing permissions: %2$s', 'event_espresso' ),
194
+					__('Sorry, you are not allowed to list %1$s. Missing permissions: %2$s', 'event_espresso'),
195 195
 					$model_name_plural,
196
-					Capabilities::get_missing_permissions_string( $model, $query_params[ 'caps' ] )
196
+					Capabilities::get_missing_permissions_string($model, $query_params['caps'])
197 197
 				),
198
-				array( 'status' => 403 )
198
+				array('status' => 403)
199 199
 			);
200 200
 		}
201
-		if( ! $request->get_header( 'no_rest_headers' ) ) {
202
-			$this->_set_headers_from_query_params( $model, $query_params );
201
+		if ( ! $request->get_header('no_rest_headers')) {
202
+			$this->_set_headers_from_query_params($model, $query_params);
203 203
 		}
204 204
 		/** @type array $results */
205
-		$results = $model->get_all_wpdb_results( $query_params );
205
+		$results = $model->get_all_wpdb_results($query_params);
206 206
 		$nice_results = array( );
207
-		foreach ( $results as $result ) {
208
-			$nice_results[ ] = $this->create_entity_from_wpdb_result(
207
+		foreach ($results as $result) {
208
+			$nice_results[] = $this->create_entity_from_wpdb_result(
209 209
 					$model,
210 210
 					$result,
211 211
 					$request
@@ -226,64 +226,64 @@  discard block
 block discarded – undo
226 226
 	 * @param \WP_REST_Request $request
227 227
 	 * @return array
228 228
 	 */
229
-	public function get_entities_from_relation( $id,  $relation, $request ) {
230
-		$context = $this->validate_context( $request->get_param( 'caps' ));
229
+	public function get_entities_from_relation($id, $relation, $request) {
230
+		$context = $this->validate_context($request->get_param('caps'));
231 231
 		$model = $relation->get_this_model();
232 232
 		$related_model = $relation->get_other_model();
233 233
 		//check if they can access the 1st model object
234
-		$query_params = array( array( $model->primary_key_name() => $id ),'limit' => 1 );
235
-		if( $model instanceof \EEM_Soft_Delete_Base ){
234
+		$query_params = array(array($model->primary_key_name() => $id), 'limit' => 1);
235
+		if ($model instanceof \EEM_Soft_Delete_Base) {
236 236
 			$query_params = $model->alter_query_params_so_deleted_and_undeleted_items_included($query_params);
237 237
 		}
238 238
 		$restricted_query_params = $query_params;
239
-		$restricted_query_params[ 'caps' ] = $context;
240
-		$this->_set_debug_info( 'main model query params', $restricted_query_params );
241
-		$this->_set_debug_info( 'missing caps', Capabilities::get_missing_permissions_string( $related_model, $context ) );
239
+		$restricted_query_params['caps'] = $context;
240
+		$this->_set_debug_info('main model query params', $restricted_query_params);
241
+		$this->_set_debug_info('missing caps', Capabilities::get_missing_permissions_string($related_model, $context));
242 242
 
243
-		if(
243
+		if (
244 244
 			! (
245
-				Capabilities::current_user_has_partial_access_to( $related_model, $context )
246
-				&& $model->exists( $restricted_query_params )
245
+				Capabilities::current_user_has_partial_access_to($related_model, $context)
246
+				&& $model->exists($restricted_query_params)
247 247
 			)
248
-		){
249
-			if( $relation instanceof \EE_Belongs_To_Relation ) {
250
-				$related_model_name_maybe_plural = strtolower( $related_model->get_this_model_name() );
251
-			}else{
252
-				$related_model_name_maybe_plural = \EEH_Inflector::pluralize_and_lower( $related_model->get_this_model_name() );
248
+		) {
249
+			if ($relation instanceof \EE_Belongs_To_Relation) {
250
+				$related_model_name_maybe_plural = strtolower($related_model->get_this_model_name());
251
+			} else {
252
+				$related_model_name_maybe_plural = \EEH_Inflector::pluralize_and_lower($related_model->get_this_model_name());
253 253
 			}
254 254
 			return new \WP_Error(
255
-				sprintf( 'rest_%s_cannot_list', $related_model_name_maybe_plural ),
255
+				sprintf('rest_%s_cannot_list', $related_model_name_maybe_plural),
256 256
 				sprintf(
257
-					__(	'Sorry, you are not allowed to list %1$s related to %2$s. Missing permissions: %3$s', 'event_espresso' ),
257
+					__('Sorry, you are not allowed to list %1$s related to %2$s. Missing permissions: %3$s', 'event_espresso'),
258 258
 					$related_model_name_maybe_plural,
259 259
 					$relation->get_this_model()->get_this_model_name(),
260 260
 					implode(
261 261
 						',',
262 262
 						array_keys(
263
-							Capabilities::get_missing_permissions( $related_model, $context )
263
+							Capabilities::get_missing_permissions($related_model, $context)
264 264
 						)
265 265
 					)
266 266
 				),
267
-				array( 'status' => 403 )
267
+				array('status' => 403)
268 268
 			);
269 269
 		}
270
-		$query_params = $this->create_model_query_params( $relation->get_other_model(), $request->get_params() );
271
-		$query_params[0][ $relation->get_this_model()->get_this_model_name() . '.' . $relation->get_this_model()->primary_key_name() ] = $id;
272
-		$query_params[ 'default_where_conditions' ] = 'none';
273
-		$query_params[ 'caps' ] = $context;
274
-		if( ! $request->get_header( 'no_rest_headers' ) ) {
275
-			$this->_set_headers_from_query_params( $relation->get_other_model(), $query_params );
270
+		$query_params = $this->create_model_query_params($relation->get_other_model(), $request->get_params());
271
+		$query_params[0][$relation->get_this_model()->get_this_model_name().'.'.$relation->get_this_model()->primary_key_name()] = $id;
272
+		$query_params['default_where_conditions'] = 'none';
273
+		$query_params['caps'] = $context;
274
+		if ( ! $request->get_header('no_rest_headers')) {
275
+			$this->_set_headers_from_query_params($relation->get_other_model(), $query_params);
276 276
 		}
277 277
 		/** @type array $results */
278
-		$results = $relation->get_other_model()->get_all_wpdb_results( $query_params );
278
+		$results = $relation->get_other_model()->get_all_wpdb_results($query_params);
279 279
 		$nice_results = array();
280
-		foreach( $results as $result ) {
280
+		foreach ($results as $result) {
281 281
 			$nice_result = $this->create_entity_from_wpdb_result(
282 282
 				$relation->get_other_model(),
283 283
 				$result,
284 284
 				$request
285 285
 			);
286
-			if( $relation instanceof \EE_HABTM_Relation ) {
286
+			if ($relation instanceof \EE_HABTM_Relation) {
287 287
 				//put the unusual stuff (properties from the HABTM relation) first, and make sure
288 288
 				//if there are conflicts we prefer the properties from the main model
289 289
 				$join_model_result = $this->create_entity_from_wpdb_result(
@@ -291,18 +291,18 @@  discard block
 block discarded – undo
291 291
 					$result,
292 292
 					$request
293 293
 				);
294
-				$joined_result = array_merge( $nice_result, $join_model_result );
294
+				$joined_result = array_merge($nice_result, $join_model_result);
295 295
 				//but keep the meta stuff from the main model
296
-				if( isset( $nice_result['meta'] ) ){
296
+				if (isset($nice_result['meta'])) {
297 297
 					$joined_result['meta'] = $nice_result['meta'];
298 298
 				}
299 299
 				$nice_result = $joined_result;
300 300
 			}
301 301
 			$nice_results[] = $nice_result;
302 302
 		}
303
-		if( $relation instanceof \EE_Belongs_To_Relation ){
304
-			return array_shift( $nice_results );
305
-		}else{
303
+		if ($relation instanceof \EE_Belongs_To_Relation) {
304
+			return array_shift($nice_results);
305
+		} else {
306 306
 			return $nice_results;
307 307
 		}
308 308
 	}
@@ -315,30 +315,30 @@  discard block
 block discarded – undo
315 315
 	 * @param array $query_params
316 316
 	 * @return void
317 317
 	 */
318
-	protected function _set_headers_from_query_params( $model, $query_params ) {
319
-		$this->_set_debug_info( 'model query params', $query_params );
320
-		$this->_set_debug_info( 'missing caps', Capabilities::get_missing_permissions_string( $model, $query_params[ 'caps' ] ) );
318
+	protected function _set_headers_from_query_params($model, $query_params) {
319
+		$this->_set_debug_info('model query params', $query_params);
320
+		$this->_set_debug_info('missing caps', Capabilities::get_missing_permissions_string($model, $query_params['caps']));
321 321
 		//normally the limit to a 2-part array, where the 2nd item is the limit
322
-		if( ! isset( $query_params[ 'limit' ] ) ) {
323
-			$query_params[ 'limit' ] = \EED_Core_Rest_Api::get_default_query_limit();
322
+		if ( ! isset($query_params['limit'])) {
323
+			$query_params['limit'] = \EED_Core_Rest_Api::get_default_query_limit();
324 324
 		}
325
-		if( is_array( $query_params[ 'limit' ] )  ) {
326
-			$limit_parts = $query_params[ 'limit' ];
325
+		if (is_array($query_params['limit'])) {
326
+			$limit_parts = $query_params['limit'];
327 327
 		} else {
328
-			$limit_parts = explode(',', $query_params[ 'limit' ] );
329
-			if( count( $limit_parts ) == 1 ){
330
-				$limit_parts = array(0, $limit_parts[ 0 ] );
328
+			$limit_parts = explode(',', $query_params['limit']);
329
+			if (count($limit_parts) == 1) {
330
+				$limit_parts = array(0, $limit_parts[0]);
331 331
 			}
332 332
 		}
333 333
 		//remove the group by and having parts of the query, as those will
334 334
 		//make the sql query return an array of values, instead of just a single value
335
-		unset( $query_params[ 'group_by' ], $query_params[ 'having' ], $query_params[ 'limit' ] );
336
-		$count = $model->count( $query_params, null, true );
335
+		unset($query_params['group_by'], $query_params['having'], $query_params['limit']);
336
+		$count = $model->count($query_params, null, true);
337 337
 
338
-		$pages = $count / $limit_parts[ 1 ];
339
-		$this->_set_response_header( 'Total', $count, false );
340
-		$this->_set_response_header( 'PageSize', $limit_parts[ 1 ], false );
341
-		$this->_set_response_header( 'TotalPages', ceil( $pages ), false );
338
+		$pages = $count / $limit_parts[1];
339
+		$this->_set_response_header('Total', $count, false);
340
+		$this->_set_response_header('PageSize', $limit_parts[1], false);
341
+		$this->_set_response_header('TotalPages', ceil($pages), false);
342 342
 	}
343 343
 
344 344
 
@@ -351,47 +351,47 @@  discard block
 block discarded – undo
351 351
 	 * @param string $deprecated no longer used
352 352
 	 * @return array ready for being converted into json for sending to client
353 353
 	 */
354
-	public function create_entity_from_wpdb_result( $model, $db_row, $rest_request, $deprecated = null ) {
355
-		if( ! $rest_request instanceof \WP_REST_Request ) {
354
+	public function create_entity_from_wpdb_result($model, $db_row, $rest_request, $deprecated = null) {
355
+		if ( ! $rest_request instanceof \WP_REST_Request) {
356 356
 			//ok so this was called in the old style, where the 3rd arg was
357 357
 			//$include, and the 4th arg was $context
358 358
 			//now setup the request just to avoid fatal errors, although we won't be able
359 359
 			//to truly make use of it because it's kinda devoid of info
360 360
 			$rest_request = new \WP_REST_Request();
361
-			$rest_request->set_param( 'include', $rest_request );
362
-			$rest_request->set_param( 'caps', $deprecated );
361
+			$rest_request->set_param('include', $rest_request);
362
+			$rest_request->set_param('caps', $deprecated);
363 363
 		}
364
-		if( $rest_request->get_param( 'caps' ) == null ) {
365
-			$rest_request->set_param( 'caps', \EEM_Base::caps_read );
364
+		if ($rest_request->get_param('caps') == null) {
365
+			$rest_request->set_param('caps', \EEM_Base::caps_read);
366 366
 		}
367
-		$entity_array = $this->_create_bare_entity_from_wpdb_results( $model, $db_row );
368
-		$entity_array = $this->_add_extra_fields( $model, $db_row, $entity_array );
369
-		$entity_array[ '_links' ] = $this->_get_entity_links( $model, $db_row, $entity_array );
370
-		$entity_array[ '_calculated_fields'] = $this->_get_entity_calculations( $model, $db_row, $rest_request );
371
-		$entity_array = $this->_include_requested_models( $model, $rest_request, $entity_array );
367
+		$entity_array = $this->_create_bare_entity_from_wpdb_results($model, $db_row);
368
+		$entity_array = $this->_add_extra_fields($model, $db_row, $entity_array);
369
+		$entity_array['_links'] = $this->_get_entity_links($model, $db_row, $entity_array);
370
+		$entity_array['_calculated_fields'] = $this->_get_entity_calculations($model, $db_row, $rest_request);
371
+		$entity_array = $this->_include_requested_models($model, $rest_request, $entity_array);
372 372
 		$entity_array = apply_filters(
373 373
 			'FHEE__Read__create_entity_from_wpdb_results__entity_before_inaccessible_field_removal',
374 374
 			$entity_array,
375 375
 			$model,
376
-			$rest_request->get_param( 'caps' ),
376
+			$rest_request->get_param('caps'),
377 377
 			$rest_request,
378 378
 			$this
379 379
 		);
380 380
 		$result_without_inaccessible_fields = Capabilities::filter_out_inaccessible_entity_fields(
381 381
 			$entity_array,
382 382
 			$model,
383
-			$rest_request->get_param( 'caps' ),
383
+			$rest_request->get_param('caps'),
384 384
 			$this->get_model_version_info()
385 385
 		);
386 386
 		$this->_set_debug_info(
387 387
 			'inaccessible fields',
388
-			array_keys( array_diff_key( $entity_array, $result_without_inaccessible_fields ) )
388
+			array_keys(array_diff_key($entity_array, $result_without_inaccessible_fields))
389 389
 		);
390 390
 		return apply_filters(
391 391
 			'FHEE__Read__create_entity_from_wpdb_results__entity_return',
392 392
 			$result_without_inaccessible_fields,
393 393
 			$model,
394
-			$rest_request->get_param( 'caps' )
394
+			$rest_request->get_param('caps')
395 395
 		);
396 396
 	}
397 397
 
@@ -403,38 +403,38 @@  discard block
 block discarded – undo
403 403
 	 * @param array $db_row
404 404
 	 * @return array entity mostly ready for converting to JSON and sending in the response
405 405
 	 */
406
-	protected function _create_bare_entity_from_wpdb_results( \EEM_Base $model, $db_row ) {
407
-		$result = $model->deduce_fields_n_values_from_cols_n_values( $db_row );
408
-		$result = array_intersect_key( $result, $this->get_model_version_info()->fields_on_model_in_this_version( $model ) );
409
-		foreach( $result as $field_name => $raw_field_value ) {
406
+	protected function _create_bare_entity_from_wpdb_results(\EEM_Base $model, $db_row) {
407
+		$result = $model->deduce_fields_n_values_from_cols_n_values($db_row);
408
+		$result = array_intersect_key($result, $this->get_model_version_info()->fields_on_model_in_this_version($model));
409
+		foreach ($result as $field_name => $raw_field_value) {
410 410
 			$field_obj = $model->field_settings_for($field_name);
411
-			$field_value = $field_obj->prepare_for_set_from_db( $raw_field_value );
412
-			if( $this->is_subclass_of_one(  $field_obj, $this->get_model_version_info()->fields_ignored() ) ){
413
-				unset( $result[ $field_name ] );
414
-			}elseif(
415
-				$this->is_subclass_of_one( $field_obj, $this->get_model_version_info()->fields_that_have_rendered_format() )
416
-			){
417
-				$result[ $field_name ] = array(
418
-					'raw' => $field_obj->prepare_for_get( $field_value ),
419
-					'rendered' => $field_obj->prepare_for_pretty_echoing( $field_value )
411
+			$field_value = $field_obj->prepare_for_set_from_db($raw_field_value);
412
+			if ($this->is_subclass_of_one($field_obj, $this->get_model_version_info()->fields_ignored())) {
413
+				unset($result[$field_name]);
414
+			}elseif (
415
+				$this->is_subclass_of_one($field_obj, $this->get_model_version_info()->fields_that_have_rendered_format())
416
+			) {
417
+				$result[$field_name] = array(
418
+					'raw' => $field_obj->prepare_for_get($field_value),
419
+					'rendered' => $field_obj->prepare_for_pretty_echoing($field_value)
420 420
 				);
421
-			}elseif(
422
-				$this->is_subclass_of_one( $field_obj, $this->get_model_version_info()->fields_that_have_pretty_format() )
423
-			){
424
-				$result[ $field_name ] = array(
425
-					'raw' => $field_obj->prepare_for_get( $field_value ),
426
-					'pretty' => $field_obj->prepare_for_pretty_echoing( $field_value )
421
+			}elseif (
422
+				$this->is_subclass_of_one($field_obj, $this->get_model_version_info()->fields_that_have_pretty_format())
423
+			) {
424
+				$result[$field_name] = array(
425
+					'raw' => $field_obj->prepare_for_get($field_value),
426
+					'pretty' => $field_obj->prepare_for_pretty_echoing($field_value)
427 427
 				);
428
-			} elseif ( $field_obj instanceof \EE_Datetime_Field ) {
429
-				$result[ $field_name ] = Model_Data_Translator::prepare_field_value_for_json(
428
+			} elseif ($field_obj instanceof \EE_Datetime_Field) {
429
+				$result[$field_name] = Model_Data_Translator::prepare_field_value_for_json(
430 430
 					$field_obj,
431 431
 					$field_value,
432 432
 					$this->get_model_version_info()->requested_version()
433 433
 				);
434 434
 			} else {
435
-				$result[ $field_name ] = Model_Data_Translator::prepare_field_value_for_json(
435
+				$result[$field_name] = Model_Data_Translator::prepare_field_value_for_json(
436 436
 					$field_obj,
437
-					$field_obj->prepare_for_get( $field_value ),
437
+					$field_obj->prepare_for_get($field_value),
438 438
 					$this->get_model_version_info()->requested_version()
439 439
 				);
440 440
 			}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	 * @param array $entity_array
450 450
 	 * @return array modified entity
451 451
 	 */
452
-	protected function _add_extra_fields( \EEM_Base $model, $db_row, $entity_array ) {
453
-		if( $model instanceof \EEM_CPT_Base ) {
454
-			$entity_array[ 'link' ] = get_permalink( $db_row[ $model->get_primary_key_field()->get_qualified_column() ] );
452
+	protected function _add_extra_fields(\EEM_Base $model, $db_row, $entity_array) {
453
+		if ($model instanceof \EEM_CPT_Base) {
454
+			$entity_array['link'] = get_permalink($db_row[$model->get_primary_key_field()->get_qualified_column()]);
455 455
 		}
456 456
 		return $entity_array;
457 457
 	}
@@ -465,20 +465,20 @@  discard block
 block discarded – undo
465 465
 	 * @param array $entity_array
466 466
 	 * @return array the _links item in the entity
467 467
 	 */
468
-	protected function _get_entity_links( $model, $db_row, $entity_array ) {
468
+	protected function _get_entity_links($model, $db_row, $entity_array) {
469 469
 		//add basic links
470 470
 		$links = array(
471 471
 			'self' => array(
472 472
 				array(
473 473
 					'href' => $this->get_versioned_link_to(
474
-						\EEH_Inflector::pluralize_and_lower( $model->get_this_model_name() ) . '/' . $entity_array[ $model->primary_key_name() ]
474
+						\EEH_Inflector::pluralize_and_lower($model->get_this_model_name()).'/'.$entity_array[$model->primary_key_name()]
475 475
 					)
476 476
 				)
477 477
 			),
478 478
 			'collection' => array(
479 479
 				array(
480 480
 					'href' => $this->get_versioned_link_to(
481
-						\EEH_Inflector::pluralize_and_lower( $model->get_this_model_name() )
481
+						\EEH_Inflector::pluralize_and_lower($model->get_this_model_name())
482 482
 					)
483 483
 				)
484 484
 			),
@@ -486,24 +486,24 @@  discard block
 block discarded – undo
486 486
 
487 487
 		//add link to the wp core endpoint, if wp api is active
488 488
 		global $wp_rest_server;
489
-		if( $model instanceof \EEM_CPT_Base &&
489
+		if ($model instanceof \EEM_CPT_Base &&
490 490
 			$wp_rest_server instanceof \WP_REST_Server &&
491
-			$wp_rest_server->get_route_options( '/wp/v2/posts' ) ) {
492
-			$links[ \EED_Core_Rest_Api::ee_api_link_namespace . 'self_wp_post' ] = array(
491
+			$wp_rest_server->get_route_options('/wp/v2/posts')) {
492
+			$links[\EED_Core_Rest_Api::ee_api_link_namespace.'self_wp_post'] = array(
493 493
 				array(
494
-					'href' => rest_url( '/wp/v2/posts/' . $db_row[ $model->get_primary_key_field()->get_qualified_column() ] ),
494
+					'href' => rest_url('/wp/v2/posts/'.$db_row[$model->get_primary_key_field()->get_qualified_column()]),
495 495
 					'single' => true
496 496
 				)
497 497
 			);
498 498
 		}
499 499
 
500 500
 		//add links to related models
501
-		foreach( $this->get_model_version_info()->relation_settings( $model ) as $relation_name => $relation_obj ) {
502
-			$related_model_part = Read::get_related_entity_name( $relation_name, $relation_obj );
503
-			$links[ \EED_Core_Rest_Api::ee_api_link_namespace . $related_model_part ] = array(
501
+		foreach ($this->get_model_version_info()->relation_settings($model) as $relation_name => $relation_obj) {
502
+			$related_model_part = Read::get_related_entity_name($relation_name, $relation_obj);
503
+			$links[\EED_Core_Rest_Api::ee_api_link_namespace.$related_model_part] = array(
504 504
 				array(
505 505
 					'href' => $this->get_versioned_link_to(
506
-						\EEH_Inflector::pluralize_and_lower( $model->get_this_model_name() ) . '/' . $entity_array[ $model->primary_key_name() ] . '/' . $related_model_part
506
+						\EEH_Inflector::pluralize_and_lower($model->get_this_model_name()).'/'.$entity_array[$model->primary_key_name()].'/'.$related_model_part
507 507
 					),
508 508
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false
509 509
 				)
@@ -519,51 +519,51 @@  discard block
 block discarded – undo
519 519
 	 * @param array $entity_array
520 520
 	 * @return array the modified entity
521 521
 	 */
522
-	protected function _include_requested_models( \EEM_Base $model, \WP_REST_Request $rest_request, $entity_array ) {
523
-		$includes_for_this_model = $this->explode_and_get_items_prefixed_with( $rest_request->get_param( 'include' ), '' );
524
-		$includes_for_this_model = $this->_remove_model_names_from_array( $includes_for_this_model );
522
+	protected function _include_requested_models(\EEM_Base $model, \WP_REST_Request $rest_request, $entity_array) {
523
+		$includes_for_this_model = $this->explode_and_get_items_prefixed_with($rest_request->get_param('include'), '');
524
+		$includes_for_this_model = $this->_remove_model_names_from_array($includes_for_this_model);
525 525
 		//if they passed in * or didn't specify any includes, return everything
526
-		if( ! in_array( '*', $includes_for_this_model )
527
-			&& ! empty( $includes_for_this_model ) ) {
528
-			if( $model->has_primary_key_field() ) {
526
+		if ( ! in_array('*', $includes_for_this_model)
527
+			&& ! empty($includes_for_this_model)) {
528
+			if ($model->has_primary_key_field()) {
529 529
 				//always include the primary key. ya just gotta know that at least
530 530
 				$includes_for_this_model[] = $model->primary_key_name();
531 531
 			}
532
-			if( $this->explode_and_get_items_prefixed_with( $rest_request->get_param( 'calculate' ), '' ) ) {
532
+			if ($this->explode_and_get_items_prefixed_with($rest_request->get_param('calculate'), '')) {
533 533
 				$includes_for_this_model[] = '_calculated_fields';
534 534
 			}
535
-			$entity_array = array_intersect_key( $entity_array, array_flip( $includes_for_this_model ) );
535
+			$entity_array = array_intersect_key($entity_array, array_flip($includes_for_this_model));
536 536
 		}
537
-		$relation_settings = $this->get_model_version_info()->relation_settings( $model );
538
-		foreach( $relation_settings as $relation_name => $relation_obj ) {
537
+		$relation_settings = $this->get_model_version_info()->relation_settings($model);
538
+		foreach ($relation_settings as $relation_name => $relation_obj) {
539 539
 			$related_fields_to_include = $this->explode_and_get_items_prefixed_with(
540
-				$rest_request->get_param( 'include' ),
540
+				$rest_request->get_param('include'),
541 541
 				$relation_name
542 542
 			);
543 543
 			$related_fields_to_calculate = $this->explode_and_get_items_prefixed_with(
544
-				$rest_request->get_param( 'calculate' ),
544
+				$rest_request->get_param('calculate'),
545 545
 				$relation_name
546 546
 			);
547 547
 			//did they specify they wanted to include a related model, or
548 548
 			//specific fields from a related model?
549 549
 			//or did they specify to calculate a field from a related model?
550
-			if( $related_fields_to_include || $related_fields_to_calculate ) {
550
+			if ($related_fields_to_include || $related_fields_to_calculate) {
551 551
 				//if so, we should include at least some part of the related model
552 552
 				$pretend_related_request = new \WP_REST_Request();
553 553
 				$pretend_related_request->set_query_params(
554 554
 					array(
555
-						'caps' => $rest_request->get_param( 'caps' ),
555
+						'caps' => $rest_request->get_param('caps'),
556 556
 						'include' => $related_fields_to_include,
557 557
 						'calculate' => $related_fields_to_calculate,
558 558
 					)
559 559
 				);
560
-				$pretend_related_request->add_header( 'no_rest_headers', true );
560
+				$pretend_related_request->add_header('no_rest_headers', true);
561 561
 				$related_results = $this->get_entities_from_relation(
562
-					$entity_array[ $model->primary_key_name() ],
562
+					$entity_array[$model->primary_key_name()],
563 563
 					$relation_obj,
564 564
 					$pretend_related_request
565 565
 				);
566
-				$entity_array[ Read::get_related_entity_name( $relation_name, $relation_obj ) ] = $related_results instanceof \WP_Error
566
+				$entity_array[Read::get_related_entity_name($relation_name, $relation_obj)] = $related_results instanceof \WP_Error
567 567
 					? null
568 568
 					: $related_results;
569 569
 			}
@@ -577,8 +577,8 @@  discard block
 block discarded – undo
577 577
 	 * @param array $arr
578 578
 	 * @return array
579 579
 	 */
580
-	private function _remove_model_names_from_array( $arr ) {
581
-		return array_diff( $arr, array_keys( \EE_Registry::instance()->non_abstract_db_models ) );
580
+	private function _remove_model_names_from_array($arr) {
581
+		return array_diff($arr, array_keys(\EE_Registry::instance()->non_abstract_db_models));
582 582
 	}
583 583
 	/**
584 584
 	 * Gets the calculated fields for the response
@@ -588,15 +588,15 @@  discard block
 block discarded – undo
588 588
 	 * @param \WP_REST_Request $rest_request
589 589
 	 * @return array the _calculations item in the entity
590 590
 	 */
591
-	protected function _get_entity_calculations( $model, $wpdb_row, $rest_request ) {
591
+	protected function _get_entity_calculations($model, $wpdb_row, $rest_request) {
592 592
 		$calculated_fields = $this->explode_and_get_items_prefixed_with(
593
-			$rest_request->get_param( 'calculate' ),
593
+			$rest_request->get_param('calculate'),
594 594
 			''
595 595
 		);
596 596
 		//note: setting calculate=* doesn't do anything
597 597
 		$calculated_fields_to_return = new \stdClass();
598
-		foreach( $calculated_fields as $field_to_calculate ) {
599
-			try{
598
+		foreach ($calculated_fields as $field_to_calculate) {
599
+			try {
600 600
 				$calculated_fields_to_return->$field_to_calculate = Model_Data_Translator::prepare_field_value_for_json(
601 601
 					null,
602 602
 					$this->_fields_calculator->retrieve_calculated_field_value(
@@ -608,10 +608,10 @@  discard block
 block discarded – undo
608 608
 					),
609 609
 					$this->get_model_version_info()->requested_version()
610 610
 				);
611
-			} catch( Rest_Exception $e ) {
611
+			} catch (Rest_Exception $e) {
612 612
 				//if we don't have permission to read it, just leave it out. but let devs know about the problem
613 613
 				$this->_set_response_header(
614
-					'Notices-Field-Calculation-Errors[' . $e->get_string_code() . '][' . $model->get_this_model_name() . '][' . $field_to_calculate . ']',
614
+					'Notices-Field-Calculation-Errors['.$e->get_string_code().']['.$model->get_this_model_name().']['.$field_to_calculate.']',
615 615
 					$e->getMessage(),
616 616
 					true
617 617
 				);
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	 * @param string $link_part_after_version_and_slash eg "events/10/datetimes"
626 626
 	 * @return string url eg "http://mysite.com/wp-json/ee/v4.6/events/10/datetimes"
627 627
 	 */
628
-	public function get_versioned_link_to( $link_part_after_version_and_slash ) {
628
+	public function get_versioned_link_to($link_part_after_version_and_slash) {
629 629
 		return rest_url(
630 630
 			\EED_Core_Rest_Api::ee_api_namespace
631 631
 			. $this->get_model_version_info()->requested_version()
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 	 * @param \EE_Model_Relation_Base $relation_obj
642 642
 	 * @return string
643 643
 	 */
644
-	public static function get_related_entity_name( $relation_name, $relation_obj ){
645
-		if( $relation_obj instanceof \EE_Belongs_To_Relation ) {
646
-			return strtolower( $relation_name );
647
-		}else{
648
-			return \EEH_Inflector::pluralize_and_lower( $relation_name );
644
+	public static function get_related_entity_name($relation_name, $relation_obj) {
645
+		if ($relation_obj instanceof \EE_Belongs_To_Relation) {
646
+			return strtolower($relation_name);
647
+		} else {
648
+			return \EEH_Inflector::pluralize_and_lower($relation_name);
649 649
 		}
650 650
 	}
651 651
 
@@ -658,43 +658,43 @@  discard block
 block discarded – undo
658 658
 	 * @param \WP_REST_Request $request
659 659
 	 * @return array
660 660
 	 */
661
-	public function get_entity_from_model( $model, $request ) {
662
-		$query_params = array( array( $model->primary_key_name() => $request->get_param( 'id' ) ),'limit' => 1);
663
-		if( $model instanceof \EEM_Soft_Delete_Base ){
661
+	public function get_entity_from_model($model, $request) {
662
+		$query_params = array(array($model->primary_key_name() => $request->get_param('id')), 'limit' => 1);
663
+		if ($model instanceof \EEM_Soft_Delete_Base) {
664 664
 			$query_params = $model->alter_query_params_so_deleted_and_undeleted_items_included($query_params);
665 665
 		}
666 666
 		$restricted_query_params = $query_params;
667
-		$restricted_query_params[ 'caps' ] =  $this->validate_context(  $request->get_param( 'caps' ) );
668
-		$this->_set_debug_info( 'model query params', $restricted_query_params );
669
-		$model_rows = $model->get_all_wpdb_results( $restricted_query_params );
670
-		if ( ! empty ( $model_rows ) ) {
667
+		$restricted_query_params['caps'] = $this->validate_context($request->get_param('caps'));
668
+		$this->_set_debug_info('model query params', $restricted_query_params);
669
+		$model_rows = $model->get_all_wpdb_results($restricted_query_params);
670
+		if ( ! empty ($model_rows)) {
671 671
 			return $this->create_entity_from_wpdb_result(
672 672
 				$model,
673
-				array_shift( $model_rows ),
673
+				array_shift($model_rows),
674 674
 				$request );
675 675
 		} else {
676 676
 			//ok let's test to see if we WOULD have found it, had we not had restrictions from missing capabilities
677
-			$lowercase_model_name = strtolower( $model->get_this_model_name() );
678
-			$model_rows_found_sans_restrictions = $model->get_all_wpdb_results( $query_params );
679
-			if( ! empty( $model_rows_found_sans_restrictions ) ) {
677
+			$lowercase_model_name = strtolower($model->get_this_model_name());
678
+			$model_rows_found_sans_restrictions = $model->get_all_wpdb_results($query_params);
679
+			if ( ! empty($model_rows_found_sans_restrictions)) {
680 680
 				//you got shafted- it existed but we didn't want to tell you!
681 681
 				return new \WP_Error(
682 682
 					'rest_user_cannot_read',
683 683
 					sprintf(
684
-						__( 'Sorry, you cannot read this %1$s. Missing permissions are: %2$s', 'event_espresso' ),
685
-						strtolower( $model->get_this_model_name() ),
684
+						__('Sorry, you cannot read this %1$s. Missing permissions are: %2$s', 'event_espresso'),
685
+						strtolower($model->get_this_model_name()),
686 686
 						Capabilities::get_missing_permissions_string(
687 687
 							$model,
688
-							$this->validate_context( $request->get_param( 'caps' ) ) )
688
+							$this->validate_context($request->get_param('caps')) )
689 689
 					),
690
-					array( 'status' => 403 )
690
+					array('status' => 403)
691 691
 				);
692 692
 			} else {
693 693
 				//it's not you. It just doesn't exist
694 694
 				return new \WP_Error(
695
-					sprintf( 'rest_%s_invalid_id', $lowercase_model_name ),
696
-					sprintf( __( 'Invalid %s ID.', 'event_espresso' ), $lowercase_model_name ),
697
-					array( 'status' => 404 )
695
+					sprintf('rest_%s_invalid_id', $lowercase_model_name),
696
+					sprintf(__('Invalid %s ID.', 'event_espresso'), $lowercase_model_name),
697
+					array('status' => 404)
698 698
 				);
699 699
 			}
700 700
 		}
@@ -707,14 +707,14 @@  discard block
 block discarded – undo
707 707
 	 * @param string $context
708 708
 	 * @return string array key of EEM_Base::cap_contexts_to_cap_action_map()
709 709
 	 */
710
-	public function validate_context( $context ) {
711
-		if( ! $context ) {
710
+	public function validate_context($context) {
711
+		if ( ! $context) {
712 712
 			$context = \EEM_Base::caps_read;
713 713
 		}
714 714
 		$valid_contexts = \EEM_Base::valid_cap_contexts();
715
-		if( in_array( $context, $valid_contexts )  ){
715
+		if (in_array($context, $valid_contexts)) {
716 716
 			return $context;
717
-		}else{
717
+		} else {
718 718
 			return \EEM_Base::caps_read;
719 719
 		}
720 720
 	}
@@ -733,77 +733,77 @@  discard block
 block discarded – undo
733 733
 	 *                          that absolutely no results should be returned
734 734
 	 * @throws \EE_Error
735 735
 	 */
736
-	public function create_model_query_params( $model, $query_parameters ) {
736
+	public function create_model_query_params($model, $query_parameters) {
737 737
 		$model_query_params = array( );
738
-		if ( isset( $query_parameters[ 'where' ] ) ) {
739
-			$model_query_params[ 0 ] = Model_Data_Translator::prepare_conditions_query_params_for_models(
740
-				$query_parameters[ 'where' ],
738
+		if (isset($query_parameters['where'])) {
739
+			$model_query_params[0] = Model_Data_Translator::prepare_conditions_query_params_for_models(
740
+				$query_parameters['where'],
741 741
 				$model,
742 742
 				$this->get_model_version_info()->requested_version()
743 743
 			);
744 744
 		}
745
-		if ( isset( $query_parameters[ 'order_by' ] ) ) {
746
-			$order_by = $query_parameters[ 'order_by' ];
747
-		} elseif ( isset( $query_parameters[ 'orderby' ] ) ) {
748
-			$order_by = $query_parameters[ 'orderby' ];
749
-		}else{
745
+		if (isset($query_parameters['order_by'])) {
746
+			$order_by = $query_parameters['order_by'];
747
+		} elseif (isset($query_parameters['orderby'])) {
748
+			$order_by = $query_parameters['orderby'];
749
+		} else {
750 750
 			$order_by = null;
751 751
 		}
752
-		if( $order_by !== null ){
753
-			$model_query_params[ 'order_by' ] =  $order_by;
752
+		if ($order_by !== null) {
753
+			$model_query_params['order_by'] = $order_by;
754 754
 		}
755
-		if ( isset( $query_parameters[ 'group_by' ] ) ) {
756
-			$group_by = $query_parameters[ 'group_by' ];
757
-		} elseif ( isset( $query_parameters[ 'groupby' ] ) ) {
758
-			$group_by = $query_parameters[ 'groupby' ];
759
-		}else{
760
-			$group_by = array_keys( $model->get_combined_primary_key_fields() );
755
+		if (isset($query_parameters['group_by'])) {
756
+			$group_by = $query_parameters['group_by'];
757
+		} elseif (isset($query_parameters['groupby'])) {
758
+			$group_by = $query_parameters['groupby'];
759
+		} else {
760
+			$group_by = array_keys($model->get_combined_primary_key_fields());
761 761
 		}
762
-		if( $group_by !== null ){
763
-			$model_query_params[ 'group_by' ] = $group_by;
762
+		if ($group_by !== null) {
763
+			$model_query_params['group_by'] = $group_by;
764 764
 		}
765
-		if ( isset( $query_parameters[ 'having' ] ) ) {
766
-			$model_query_params[ 'having' ] = Model_Data_Translator::prepare_conditions_query_params_for_models(
767
-				$query_parameters[ 'having' ],
765
+		if (isset($query_parameters['having'])) {
766
+			$model_query_params['having'] = Model_Data_Translator::prepare_conditions_query_params_for_models(
767
+				$query_parameters['having'],
768 768
 				$model,
769 769
 				$this->get_model_version_info()->requested_version()
770 770
 			);
771 771
 		}
772
-		if ( isset( $query_parameters[ 'order' ] ) ) {
773
-			$model_query_params[ 'order' ] = $query_parameters[ 'order' ];
772
+		if (isset($query_parameters['order'])) {
773
+			$model_query_params['order'] = $query_parameters['order'];
774 774
 		}
775
-		if ( isset( $query_parameters[ 'mine' ] ) ){
776
-			$model_query_params = $model->alter_query_params_to_only_include_mine( $model_query_params );
775
+		if (isset($query_parameters['mine'])) {
776
+			$model_query_params = $model->alter_query_params_to_only_include_mine($model_query_params);
777 777
 		}
778
-		if( isset( $query_parameters[ 'limit' ] ) ) {
778
+		if (isset($query_parameters['limit'])) {
779 779
 			//limit should be either a string like '23' or '23,43', or an array with two items in it
780
-			if( ! is_array( $query_parameters[ 'limit' ] ) ) {
781
-				$limit_array = explode(',', (string)$query_parameters['limit']);
782
-			}else {
783
-				$limit_array = $query_parameters[ 'limit' ];
780
+			if ( ! is_array($query_parameters['limit'])) {
781
+				$limit_array = explode(',', (string) $query_parameters['limit']);
782
+			} else {
783
+				$limit_array = $query_parameters['limit'];
784 784
 			}
785 785
 			$sanitized_limit = array();
786
-			foreach( $limit_array as $key => $limit_part ) {
787
-				if( $this->_debug_mode && ( ! is_numeric( $limit_part ) || count( $sanitized_limit ) > 2 ) ) {
786
+			foreach ($limit_array as $key => $limit_part) {
787
+				if ($this->_debug_mode && ( ! is_numeric($limit_part) || count($sanitized_limit) > 2)) {
788 788
 					throw new \EE_Error(
789 789
 						sprintf(
790
-							__( 'An invalid limit filter was provided. It was: %s. If the EE4 JSON REST API weren\'t in debug mode, this message would not appear.', 'event_espresso' ),
791
-							json_encode( $query_parameters[ 'limit' ] )
790
+							__('An invalid limit filter was provided. It was: %s. If the EE4 JSON REST API weren\'t in debug mode, this message would not appear.', 'event_espresso'),
791
+							json_encode($query_parameters['limit'])
792 792
 						)
793 793
 					);
794 794
 				}
795
-				$sanitized_limit[] = (int)$limit_part;
795
+				$sanitized_limit[] = (int) $limit_part;
796 796
 			}
797
-			$model_query_params[ 'limit' ] = implode( ',', $sanitized_limit );
798
-		}else{
799
-			$model_query_params[ 'limit' ] = \EED_Core_Rest_Api::get_default_query_limit();
797
+			$model_query_params['limit'] = implode(',', $sanitized_limit);
798
+		} else {
799
+			$model_query_params['limit'] = \EED_Core_Rest_Api::get_default_query_limit();
800 800
 		}
801
-		if( isset( $query_parameters[ 'caps' ] ) ) {
802
-			$model_query_params[ 'caps' ] = $this->validate_context( $query_parameters[ 'caps' ] );
803
-		}else{
804
-			$model_query_params[ 'caps' ] = \EEM_Base::caps_read;
801
+		if (isset($query_parameters['caps'])) {
802
+			$model_query_params['caps'] = $this->validate_context($query_parameters['caps']);
803
+		} else {
804
+			$model_query_params['caps'] = \EEM_Base::caps_read;
805 805
 		}
806
-		return apply_filters( 'FHEE__Read__create_model_query_params', $model_query_params, $query_parameters, $model );
806
+		return apply_filters('FHEE__Read__create_model_query_params', $model_query_params, $query_parameters, $model);
807 807
 	}
808 808
 
809 809
 
@@ -815,13 +815,13 @@  discard block
 block discarded – undo
815 815
 	 * @param array     $query_params sub-array from @see EEM_Base::get_all()
816 816
 	 * @return array
817 817
 	 */
818
-	public function prepare_rest_query_params_key_for_models( $model,  $query_params ) {
818
+	public function prepare_rest_query_params_key_for_models($model, $query_params) {
819 819
 		$model_ready_query_params = array();
820
-		foreach( $query_params as $key => $value ) {
821
-			if( is_array( $value ) ) {
822
-				$model_ready_query_params[ $key ] = $this->prepare_rest_query_params_key_for_models( $model, $value );
823
-			}else{
824
-				$model_ready_query_params[ $key ] = $value;
820
+		foreach ($query_params as $key => $value) {
821
+			if (is_array($value)) {
822
+				$model_ready_query_params[$key] = $this->prepare_rest_query_params_key_for_models($model, $value);
823
+			} else {
824
+				$model_ready_query_params[$key] = $value;
825 825
 			}
826 826
 		}
827 827
 		return $model_ready_query_params;
@@ -835,13 +835,13 @@  discard block
 block discarded – undo
835 835
 	 * @param $query_params
836 836
 	 * @return array
837 837
 	 */
838
-	public function prepare_rest_query_params_values_for_models( $model, $query_params ) {
838
+	public function prepare_rest_query_params_values_for_models($model, $query_params) {
839 839
 		$model_ready_query_params = array();
840
-		foreach( $query_params as $key => $value ) {
841
-			if( is_array( $value ) ) {
842
-				$model_ready_query_params[ $key ] = $this->prepare_rest_query_params_values_for_models( $model, $value );
840
+		foreach ($query_params as $key => $value) {
841
+			if (is_array($value)) {
842
+				$model_ready_query_params[$key] = $this->prepare_rest_query_params_values_for_models($model, $value);
843 843
 			} else {
844
-				$model_ready_query_params[ $key ] = $value;
844
+				$model_ready_query_params[$key] = $value;
845 845
 			}
846 846
 		}
847 847
 		return $model_ready_query_params;
@@ -856,33 +856,33 @@  discard block
 block discarded – undo
856 856
 	 * we only return strings starting with that and a period; if no prefix was specified
857 857
 	 * we return all items containing NO periods
858 858
 	 */
859
-	public function explode_and_get_items_prefixed_with( $string_to_explode, $prefix ) {
860
-		if( is_string( $string_to_explode ) ) {
861
-			$exploded_contents = explode( ',', $string_to_explode );
862
-		} else if( is_array( $string_to_explode ) ) {
859
+	public function explode_and_get_items_prefixed_with($string_to_explode, $prefix) {
860
+		if (is_string($string_to_explode)) {
861
+			$exploded_contents = explode(',', $string_to_explode);
862
+		} else if (is_array($string_to_explode)) {
863 863
 			$exploded_contents = $string_to_explode;
864 864
 		} else {
865 865
 			$exploded_contents = array();
866 866
 		}
867 867
 		//if the string was empty, we want an empty array
868
-		$exploded_contents = array_filter( $exploded_contents );
868
+		$exploded_contents = array_filter($exploded_contents);
869 869
 		$contents_with_prefix = array();
870
-		foreach( $exploded_contents as $item ) {
871
-			$item = trim( $item );
870
+		foreach ($exploded_contents as $item) {
871
+			$item = trim($item);
872 872
 			//if no prefix was provided, so we look for items with no "." in them
873
-			if( ! $prefix ) {
873
+			if ( ! $prefix) {
874 874
 				//does this item have a period?
875
-				if( strpos( $item, '.' ) === false ) {
875
+				if (strpos($item, '.') === false) {
876 876
 					//if not, then its what we're looking for
877 877
 					$contents_with_prefix[] = $item;
878 878
 				}
879
-			} else if( strpos( $item, $prefix . '.' ) === 0 ) {
879
+			} else if (strpos($item, $prefix.'.') === 0) {
880 880
 				//this item has the prefix and a period, grab it
881 881
 				$contents_with_prefix[] = substr(
882 882
 					$item,
883
-					strpos( $item, $prefix . '.' ) + strlen( $prefix . '.' )
883
+					strpos($item, $prefix.'.') + strlen($prefix.'.')
884 884
 					);
885
-			} else if( $item === $prefix ) {
885
+			} else if ($item === $prefix) {
886 886
 				//this item is JUST the prefix
887 887
 				//so let's grab everything after, which is a blank string
888 888
 				$contents_with_prefix[] = '';
@@ -905,33 +905,33 @@  discard block
 block discarded – undo
905 905
 	 * the fields for that model, with the model's name removed from each.
906 906
 	 * If $include_string was blank or '*' returns an empty array
907 907
 	 */
908
-	public function extract_includes_for_this_model( $include_string, $model_name = null ) {
909
-		if( is_array( $include_string ) ) {
910
-			$include_string = implode( ',', $include_string );
908
+	public function extract_includes_for_this_model($include_string, $model_name = null) {
909
+		if (is_array($include_string)) {
910
+			$include_string = implode(',', $include_string);
911 911
 		}
912
-		if( $include_string === '*' || $include_string === '' ) {
912
+		if ($include_string === '*' || $include_string === '') {
913 913
 			return array();
914 914
 		}
915
-		$includes = explode( ',', $include_string );
915
+		$includes = explode(',', $include_string);
916 916
 		$extracted_fields_to_include = array();
917
-		if( $model_name ){
918
-			foreach( $includes as $field_to_include ) {
919
-				$field_to_include = trim( $field_to_include );
920
-				if( strpos( $field_to_include, $model_name . '.' ) === 0 ) {
917
+		if ($model_name) {
918
+			foreach ($includes as $field_to_include) {
919
+				$field_to_include = trim($field_to_include);
920
+				if (strpos($field_to_include, $model_name.'.') === 0) {
921 921
 					//found the model name at the exact start
922
-					$field_sans_model_name = str_replace( $model_name . '.', '', $field_to_include );
922
+					$field_sans_model_name = str_replace($model_name.'.', '', $field_to_include);
923 923
 					$extracted_fields_to_include[] = $field_sans_model_name;
924
-				}elseif( $field_to_include == $model_name ){
924
+				}elseif ($field_to_include == $model_name) {
925 925
 					$extracted_fields_to_include[] = '*';
926 926
 				}
927 927
 			}
928
-		}else{
928
+		} else {
929 929
 			//look for ones with no period
930
-			foreach( $includes as $field_to_include ) {
931
-				$field_to_include = trim( $field_to_include );
930
+			foreach ($includes as $field_to_include) {
931
+				$field_to_include = trim($field_to_include);
932 932
 				if (
933
-					strpos( $field_to_include, '.' ) === false
934
-					&& ! $this->get_model_version_info()->is_model_name_in_this_version( $field_to_include )
933
+					strpos($field_to_include, '.') === false
934
+					&& ! $this->get_model_version_info()->is_model_name_in_this_version($field_to_include)
935 935
 				) {
936 936
 					$extracted_fields_to_include[] = $field_to_include;
937 937
 				}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 1 patch
Spacing   +594 added lines, -594 removed lines patch added patch discarded remove patch
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
148 148
 	 * 		@access public
149 149
 	 */
150
-	public function __construct( $routing = TRUE ) {
150
+	public function __construct($routing = TRUE) {
151 151
 
152
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
152
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
153 153
 			$this->_is_caf = TRUE;
154 154
 
155 155
 		$this->_yes_no_values = array(
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 
162 162
 		//set the _req_data property.
163
-		$this->_req_data = array_merge( $_GET, $_POST );
163
+		$this->_req_data = array_merge($_GET, $_POST);
164 164
 
165 165
 
166 166
 		//routing enabled?
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		$this->_do_other_page_hooks();
182 182
 
183 183
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
184
-		if ( method_exists( $this, '_before_page_setup' ) )
184
+		if (method_exists($this, '_before_page_setup'))
185 185
 			$this->_before_page_setup();
186 186
 
187 187
 		//set up page dependencies
@@ -451,16 +451,16 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	protected function _global_ajax_hooks() {
453 453
 		//for lazy loading of metabox content
454
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
454
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
455 455
 	}
456 456
 
457 457
 
458 458
 
459 459
 	public function ajax_metabox_content() {
460
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
461
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
460
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
461
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
462 462
 
463
-		self::cached_rss_display( $contentid, $url );
463
+		self::cached_rss_display($contentid, $url);
464 464
 		wp_die();
465 465
 	}
466 466
 
@@ -479,87 +479,87 @@  discard block
 block discarded – undo
479 479
 		//requires?
480 480
 
481 481
 		//admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
482
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
482
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
483 483
 
484 484
 
485 485
 		//next verify if we need to load anything...
486
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE;
487
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
486
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE;
487
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
488 488
 
489 489
 		global $ee_menu_slugs;
490 490
 		$ee_menu_slugs = (array) $ee_menu_slugs;
491 491
 
492
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
492
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
493 493
 
494 494
 
495 495
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
496
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
497
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
496
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
497
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
498 498
 		}
499 499
 		// then set blank or -1 action values to 'default'
500
-		$this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default';
500
+		$this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default';
501 501
 
502 502
 		//if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.  This covers cases where we're coming in from a list table that isn't on the default route.
503
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
503
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
504 504
 
505 505
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
506 506
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
507 507
 
508 508
 		$this->_current_view = $this->_req_action;
509
-		$this->_req_nonce = $this->_req_action . '_nonce';
509
+		$this->_req_nonce = $this->_req_action.'_nonce';
510 510
 		$this->_define_page_props();
511 511
 
512
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
512
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
513 513
 
514 514
 		//default things
515
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
515
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
516 516
 
517 517
 		//set page configs
518 518
 		$this->_set_page_routes();
519 519
 		$this->_set_page_config();
520 520
 
521 521
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
522
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
522
+		if (isset($this->_req_data['wp_referer'])) {
523 523
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
524 524
 		}
525 525
 
526 526
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
527
-		if ( method_exists( $this, '_extend_page_config' ) )
527
+		if (method_exists($this, '_extend_page_config'))
528 528
 			$this->_extend_page_config();
529 529
 
530 530
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
531
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
531
+		if (method_exists($this, '_extend_page_config_for_cpt'))
532 532
 			$this->_extend_page_config_for_cpt();
533 533
 
534 534
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
535
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
536
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
535
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
536
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
537 537
 
538 538
 
539 539
 		//if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
540
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
541
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
540
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
541
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
542 542
 		}
543 543
 
544 544
 
545 545
 		//next route only if routing enabled
546
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
546
+		if ($this->_routing && ! defined('DOING_AJAX')) {
547 547
 
548 548
 			$this->_verify_routes();
549 549
 
550 550
 			//next let's just check user_access and kill if no access
551 551
 			$this->check_user_access();
552 552
 
553
-			if ( $this->_is_UI_request ) {
553
+			if ($this->_is_UI_request) {
554 554
 				//admin_init stuff - global, all views for this page class, specific view
555
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
556
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
557
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
555
+				add_action('admin_init', array($this, 'admin_init'), 10);
556
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
557
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
558 558
 				}
559 559
 
560 560
 			} else {
561 561
 				//hijack regular WP loading and route admin request immediately
562
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
562
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
563 563
 				$this->route_admin_request();
564 564
 			}
565 565
 		}
@@ -576,18 +576,18 @@  discard block
 block discarded – undo
576 576
 	 * @return void
577 577
 	 */
578 578
 	private function _do_other_page_hooks() {
579
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
579
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
580 580
 
581
-		foreach ( $registered_pages as $page ) {
581
+		foreach ($registered_pages as $page) {
582 582
 
583 583
 			//now let's setup the file name and class that should be present
584 584
 			$classname = str_replace('.class.php', '', $page);
585 585
 
586 586
 			//autoloaders should take care of loading file
587
-			if ( !class_exists( $classname ) ) {
588
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
589
-				$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake 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, '<br />', $classname );
590
-				throw new EE_Error( implode( '||', $error_msg ));
587
+			if ( ! class_exists($classname)) {
588
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
589
+				$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake 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, '<br />', $classname);
590
+				throw new EE_Error(implode('||', $error_msg));
591 591
 			}
592 592
 
593 593
 			$a = new ReflectionClass($classname);
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	public function load_page_dependencies() {
603 603
 		try {
604 604
 			$this->_load_page_dependencies();
605
-		} catch ( EE_Error $e ) {
605
+		} catch (EE_Error $e) {
606 606
 			$e->get_error();
607 607
 		}
608 608
 	}
@@ -620,16 +620,16 @@  discard block
 block discarded – undo
620 620
 		$this->_current_screen = get_current_screen();
621 621
 
622 622
 		//load admin_notices - global, page class, and view specific
623
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
624
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
625
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
626
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
623
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
624
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
625
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
626
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
627 627
 		}
628 628
 
629 629
 		//load network admin_notices - global, page class, and view specific
630
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
631
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
632
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
630
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
631
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
632
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
633 633
 		}
634 634
 
635 635
 		//this will save any per_page screen options if they are present
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
 		//add screen options - global, page child class, and view specific
646 646
 		$this->_add_global_screen_options();
647 647
 		$this->_add_screen_options();
648
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
649
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
648
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
649
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
650 650
 
651 651
 
652 652
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -657,33 +657,33 @@  discard block
 block discarded – undo
657 657
 		//add feature_pointers - global, page child class, and view specific
658 658
 		$this->_add_feature_pointers();
659 659
 		$this->_add_global_feature_pointers();
660
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
661
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
660
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
661
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
662 662
 
663 663
 		//enqueue scripts/styles - global, page class, and view specific
664
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
665
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
666
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
667
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
664
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
665
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
666
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
667
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
668 668
 
669
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
669
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
670 670
 
671 671
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
672
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
673
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
674
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
675
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
672
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
673
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
674
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
675
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
676 676
 
677 677
 		//admin footer scripts
678
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
679
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
680
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
681
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
678
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
679
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
680
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
681
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
682 682
 
683 683
 
684
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
684
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
685 685
 		//targeted hook
686
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
686
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
687 687
 
688 688
 	}
689 689
 
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	private function _set_defaults() {
699 699
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
700 700
 
701
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
701
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
702 702
 
703 703
 		$this->default_nav_tab_name = 'overview';
704 704
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	public function route_admin_request() {
726 726
 		try {
727 727
 			$this->_route_admin_request();
728
-		} catch ( EE_Error $e ) {
728
+		} catch (EE_Error $e) {
729 729
 			$e->get_error();
730 730
 		}
731 731
 	}
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		$this->_wp_page_slug = $wp_page_slug;
737 737
 
738 738
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
739
-		if ( is_network_admin() ) {
739
+		if (is_network_admin()) {
740 740
 			$this->_wp_page_slug .= '-network';
741 741
 		}
742 742
 	}
@@ -749,53 +749,53 @@  discard block
 block discarded – undo
749 749
 	 * @return void
750 750
 	 */
751 751
 	protected function _verify_routes() {
752
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
752
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
753 753
 
754
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
754
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
755 755
 
756 756
 		$this->_route = FALSE;
757 757
 		$func = FALSE;
758 758
 		$args = array();
759 759
 
760 760
 		// check that the page_routes array is not empty
761
-		if ( empty( $this->_page_routes )) {
761
+		if (empty($this->_page_routes)) {
762 762
 			// user error msg
763
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
763
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
764 764
 			// developer error msg
765
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
766
-			throw new EE_Error( $error_msg );
765
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
766
+			throw new EE_Error($error_msg);
767 767
 		}
768 768
 
769 769
 		// and that the requested page route exists
770
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
771
-			$this->_route = $this->_page_routes[ $this->_req_action ];
770
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
771
+			$this->_route = $this->_page_routes[$this->_req_action];
772 772
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
773 773
 		} else {
774 774
 			// user error msg
775
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
775
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
776 776
 			// developer error msg
777
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action );
778
-			throw new EE_Error( $error_msg );
777
+			$error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action);
778
+			throw new EE_Error($error_msg);
779 779
 		}
780 780
 
781 781
 		// and that a default route exists
782
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
782
+		if ( ! array_key_exists('default', $this->_page_routes)) {
783 783
 			// user error msg
784
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
784
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
785 785
 			// developer error msg
786
-			$error_msg .=  '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' );
787
-			throw new EE_Error( $error_msg );
786
+			$error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso');
787
+			throw new EE_Error($error_msg);
788 788
 		}
789 789
 
790 790
 
791 791
 		//first lets' catch if the UI request has EVER been set.
792
-		if ( $this->_is_UI_request === NULL ) {
792
+		if ($this->_is_UI_request === NULL) {
793 793
 			//lets set if this is a UI request or not.
794
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
794
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
795 795
 
796 796
 
797 797
 			//wait a minute... we might have a noheader in the route array
798
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
798
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
799 799
 		}
800 800
 
801 801
 		$this->_set_current_labels();
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
 	 * @param  string $route the route name we're verifying
811 811
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
812 812
 	 */
813
-	protected function _verify_route( $route ) {
814
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
813
+	protected function _verify_route($route) {
814
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
815 815
 			return true;
816 816
 		} else {
817 817
 			// user error msg
818
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
818
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
819 819
 			// developer error msg
820
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route );
821
-			throw new EE_Error( $error_msg );
820
+			$error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route);
821
+			throw new EE_Error($error_msg);
822 822
 		}
823 823
 	}
824 824
 
@@ -832,18 +832,18 @@  discard block
 block discarded – undo
832 832
 	 * @param  string $nonce_ref The nonce reference string (name0)
833 833
 	 * @return mixed (bool|die)
834 834
 	 */
835
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
835
+	protected function _verify_nonce($nonce, $nonce_ref) {
836 836
 		// verify nonce against expected value
837
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
837
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
838 838
 			// these are not the droids you are looking for !!!
839
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
840
-			if ( WP_DEBUG ) {
841
-				$msg .= "\n  " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__  );
839
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
840
+			if (WP_DEBUG) {
841
+				$msg .= "\n  ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__);
842 842
 			}
843
-			if ( ! defined( 'DOING_AJAX' )) {
844
-				wp_die( $msg );
843
+			if ( ! defined('DOING_AJAX')) {
844
+				wp_die($msg);
845 845
 			} else {
846
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
846
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
847 847
 				$this->_return_json();
848 848
 			}
849 849
 		}
@@ -861,63 +861,63 @@  discard block
 block discarded – undo
861 861
 	 * @return void
862 862
 	 */
863 863
 	protected function _route_admin_request() {
864
-		if (  ! $this->_is_UI_request )
864
+		if ( ! $this->_is_UI_request)
865 865
 			$this->_verify_routes();
866 866
 
867
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
867
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
868 868
 
869
-		if ( $this->_req_action != 'default' && $nonce_check ) {
869
+		if ($this->_req_action != 'default' && $nonce_check) {
870 870
 			// set nonce from post data
871
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
872
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
871
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
872
+			$this->_verify_nonce($nonce, $this->_req_nonce);
873 873
 		}
874 874
 		//set the nav_tabs array but ONLY if this is  UI_request
875
-		if ( $this->_is_UI_request )
875
+		if ($this->_is_UI_request)
876 876
 			$this->_set_nav_tabs();
877 877
 
878 878
 		// grab callback function
879
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
879
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
880 880
 
881 881
 		// check if callback has args
882
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
882
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
883 883
 
884 884
 		$error_msg = '';
885 885
 
886 886
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
887
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
888
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
887
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
888
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
889 889
 		}
890 890
 
891 891
 		//right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
892
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
892
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
893 893
 
894
-		if ( ! empty( $func )) {
894
+		if ( ! empty($func)) {
895 895
 			$base_call = $addon_call = FALSE;
896 896
 			//try to access page route via this class
897
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
897
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
898 898
 				// user error msg
899
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
899
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
900 900
 				// developer error msg
901
-				$error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func );
901
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func);
902 902
 			}
903 903
 
904 904
 			//for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method)
905 905
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
906 906
 
907
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
908
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
909
-				$error_msg .= '||' . sprintf( __('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func );
907
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
908
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
909
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func);
910 910
 			}
911 911
 
912 912
 
913
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
914
-				throw new EE_Error( $error_msg );
913
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
914
+				throw new EE_Error($error_msg);
915 915
 		}
916 916
 
917 917
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
918 918
 		//now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
919
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
920
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
919
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
920
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
921 921
 		}
922 922
 	}
923 923
 
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	 * @param  string    $new_route   New (non header) route to redirect to.
934 934
 	 * @return   void
935 935
 	 */
936
-	protected function _reset_routing_properties( $new_route ) {
936
+	protected function _reset_routing_properties($new_route) {
937 937
 		$this->_is_UI_request = TRUE;
938 938
 		//now we set the current route to whatever the headers_sent_route is set at
939 939
 		$this->_req_data['action'] = $new_route;
@@ -979,23 +979,23 @@  discard block
 block discarded – undo
979 979
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
980 980
 	 * 	@return string
981 981
 	 */
982
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
982
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
983 983
 
984 984
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
985
-		if ( $sticky ) {
985
+		if ($sticky) {
986 986
 			$request = $_REQUEST;
987
-			unset( $request['_wp_http_referer'] );
988
-			unset( $request['wp_referer'] );
989
-			foreach ( $request as $key => $value ) {
987
+			unset($request['_wp_http_referer']);
988
+			unset($request['wp_referer']);
989
+			foreach ($request as $key => $value) {
990 990
 				//do not add nonces
991
-				if ( strpos( $key, 'nonce' ) !== false ) {
991
+				if (strpos($key, 'nonce') !== false) {
992 992
 					continue;
993 993
 				}
994
-				$args['wp_referer[' . $key . ']'] = $value;
994
+				$args['wp_referer['.$key.']'] = $value;
995 995
 			}
996 996
 		}
997 997
 
998
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
998
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
999 999
 	}
1000 1000
 
1001 1001
 
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
 	 * @uses EEH_Template::get_help_tab_link()
1012 1012
 	 * @return string              generated link
1013 1013
 	 */
1014
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1015
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1014
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1015
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1016 1016
 	}
1017 1017
 
1018 1018
 
@@ -1029,30 +1029,30 @@  discard block
 block discarded – undo
1029 1029
 	 */
1030 1030
 	protected function _add_help_tabs() {
1031 1031
 		$tour_buttons = '';
1032
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1032
+		if (isset($this->_page_config[$this->_req_action])) {
1033 1033
 			$config = $this->_page_config[$this->_req_action];
1034 1034
 
1035 1035
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1036
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1036
+			if (isset($this->_help_tour[$this->_req_action])) {
1037 1037
 				$tb = array();
1038 1038
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1039
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1039
+				foreach ($this->_help_tour['tours'] as $tour) {
1040 1040
 					//if this is the end tour then we don't need to setup a button
1041
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1041
+					if ($tour instanceof EE_Help_Tour_final_stop)
1042 1042
 						continue;
1043
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1043
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1044 1044
 				}
1045 1045
 				$tour_buttons .= implode('<br />', $tb);
1046 1046
 				$tour_buttons .= '</div></div>';
1047 1047
 			}
1048 1048
 
1049 1049
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1050
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1050
+			if (is_array($config) && isset($config['help_sidebar'])) {
1051 1051
 				//check that the callback given is valid
1052
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1053
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1052
+				if ( ! method_exists($this, $config['help_sidebar']))
1053
+					throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this)));
1054 1054
 
1055
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1055
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1056 1056
 
1057 1057
 				$content .= $tour_buttons; //add help tour buttons.
1058 1058
 
@@ -1061,49 +1061,49 @@  discard block
 block discarded – undo
1061 1061
 			}
1062 1062
 
1063 1063
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1064
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1064
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1065 1065
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1066 1066
 			}
1067 1067
 
1068 1068
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1069
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1069
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1070 1070
 				$_ht['id'] = $this->page_slug;
1071 1071
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1072
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1072
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1073 1073
 				$this->_current_screen->add_help_tab($_ht);
1074 1074
 				}/**/
1075 1075
 
1076 1076
 
1077
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1077
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1078 1078
 
1079
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1079
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1080 1080
 				//we're here so there ARE help tabs!
1081 1081
 
1082 1082
 				//make sure we've got what we need
1083
-				if ( !isset( $cfg['title'] ) )
1084
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1083
+				if ( ! isset($cfg['title']))
1084
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1085 1085
 
1086 1086
 
1087
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1088
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1087
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1088
+					throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso'));
1089 1089
 
1090 1090
 
1091 1091
 
1092 1092
 				//first priority goes to content.
1093
-				if ( !empty($cfg['content'] ) ) {
1094
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1093
+				if ( ! empty($cfg['content'])) {
1094
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1095 1095
 
1096 1096
 				//second priority goes to filename
1097
-				} else if ( !empty($cfg['filename'] ) ) {
1098
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1097
+				} else if ( ! empty($cfg['filename'])) {
1098
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1099 1099
 
1100 1100
 
1101 1101
 					//it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1102
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1102
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1103 1103
 
1104 1104
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1105
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1106
-						EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ );
1105
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1106
+						EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__);
1107 1107
 						return;
1108 1108
 					}
1109 1109
 					$template_args['admin_page_obj'] = $this;
@@ -1114,21 +1114,21 @@  discard block
 block discarded – undo
1114 1114
 
1115 1115
 
1116 1116
 				//check if callback is valid
1117
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1118
-					EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ );
1117
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1118
+					EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__);
1119 1119
 					return;
1120 1120
 				}
1121 1121
 
1122 1122
 				//setup config array for help tab method
1123
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1123
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1124 1124
 				$_ht = array(
1125 1125
 					'id' => $id,
1126 1126
 					'title' => $cfg['title'],
1127
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1127
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1128 1128
 					'content' => $content
1129 1129
 					);
1130 1130
 
1131
-				$this->_current_screen->add_help_tab( $_ht );
1131
+				$this->_current_screen->add_help_tab($_ht);
1132 1132
 			}
1133 1133
 		}
1134 1134
 	}
@@ -1148,49 +1148,49 @@  discard block
 block discarded – undo
1148 1148
 		$this->_help_tour = array();
1149 1149
 
1150 1150
 		//exit early if help tours are turned off globally
1151
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1151
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1152 1152
 			return;
1153 1153
 
1154 1154
 		//loop through _page_config to find any help_tour defined
1155
-		foreach ( $this->_page_config as $route => $config ) {
1155
+		foreach ($this->_page_config as $route => $config) {
1156 1156
 			//we're only going to set things up for this route
1157
-			if ( $route !== $this->_req_action )
1157
+			if ($route !== $this->_req_action)
1158 1158
 				continue;
1159 1159
 
1160
-			if ( isset( $config['help_tour'] ) ) {
1160
+			if (isset($config['help_tour'])) {
1161 1161
 
1162
-				foreach( $config['help_tour'] as $tour ) {
1163
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1162
+				foreach ($config['help_tour'] as $tour) {
1163
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1164 1164
 					//let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent
1165
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1165
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1166 1166
 
1167 1167
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1168
-					if ( !is_readable($file_path) ) {
1169
-						EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ );
1168
+					if ( ! is_readable($file_path)) {
1169
+						EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__);
1170 1170
 						return;
1171 1171
 					}
1172 1172
 
1173 1173
 					require_once $file_path;
1174
-					if ( !class_exists( $tour ) ) {
1175
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1176
-						$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) );
1177
-						throw new EE_Error( implode( '||', $error_msg ));
1174
+					if ( ! class_exists($tour)) {
1175
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1176
+						$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this));
1177
+						throw new EE_Error(implode('||', $error_msg));
1178 1178
 					}
1179 1179
 					$a = new ReflectionClass($tour);
1180 1180
 					$tour_obj = $a->newInstance($this->_is_caf);
1181 1181
 
1182 1182
 					$tours[] = $tour_obj;
1183
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1183
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1184 1184
 				}
1185 1185
 
1186 1186
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1187 1187
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1188 1188
 				$tours[] = $end_stop_tour;
1189
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1189
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1190 1190
 			}
1191 1191
 		}
1192 1192
 
1193
-		if ( !empty( $tours ) )
1193
+		if ( ! empty($tours))
1194 1194
 			$this->_help_tour['tours'] = $tours;
1195 1195
 
1196 1196
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1206,12 +1206,12 @@  discard block
 block discarded – undo
1206 1206
 	 * @return void
1207 1207
 	 */
1208 1208
 	protected function _add_qtips() {
1209
-		if ( isset( $this->_route_config['qtips'] ) ) {
1209
+		if (isset($this->_route_config['qtips'])) {
1210 1210
 			$qtips = (array) $this->_route_config['qtips'];
1211 1211
 			//load qtip loader
1212 1212
 			$path = array(
1213
-				$this->_get_dir() . '/qtips/',
1214
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1213
+				$this->_get_dir().'/qtips/',
1214
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1215 1215
 				);
1216 1216
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1217 1217
 		}
@@ -1228,41 +1228,41 @@  discard block
 block discarded – undo
1228 1228
 	 * @return void
1229 1229
 	 */
1230 1230
 	protected function _set_nav_tabs() {
1231
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1231
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1232 1232
 		$i = 0;
1233
-		foreach ( $this->_page_config as $slug => $config ) {
1234
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1233
+		foreach ($this->_page_config as $slug => $config) {
1234
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1235 1235
 				continue; //no nav tab for this config
1236 1236
 
1237 1237
 			//check for persistent flag
1238
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1238
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1239 1239
 				continue; //nav tab is only to appear when route requested.
1240 1240
 
1241
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1241
+			if ( ! $this->check_user_access($slug, TRUE))
1242 1242
 				continue; //no nav tab becasue current user does not have access.
1243 1243
 
1244
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1244
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1245 1245
 			$this->_nav_tabs[$slug] = array(
1246
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1247
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1248
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1249
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1246
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1247
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1248
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1249
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1250 1250
 				);
1251 1251
 			$i++;
1252 1252
 		}
1253 1253
 
1254 1254
 		//if $this->_nav_tabs is empty then lets set the default
1255
-		if ( empty( $this->_nav_tabs ) ) {
1255
+		if (empty($this->_nav_tabs)) {
1256 1256
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1257 1257
 				'url' => $this->admin_base_url,
1258
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1258
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1259 1259
 				'css_class' => 'nav-tab-active',
1260 1260
 				'order' => 10
1261 1261
 				);
1262 1262
 		}
1263 1263
 
1264 1264
 		//now let's sort the tabs according to order
1265
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1265
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1266 1266
 
1267 1267
 	}
1268 1268
 
@@ -1278,10 +1278,10 @@  discard block
 block discarded – undo
1278 1278
 	 * @return void
1279 1279
 	 */
1280 1280
 	private function _set_current_labels() {
1281
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1282
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1283
-				if ( is_array($text) ) {
1284
-					foreach ( $text as $sublabel => $subtext ) {
1281
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1282
+			foreach ($this->_route_config['labels'] as $label => $text) {
1283
+				if (is_array($text)) {
1284
+					foreach ($text as $sublabel => $subtext) {
1285 1285
 						$this->_labels[$label][$sublabel] = $subtext;
1286 1286
 					}
1287 1287
 				} else {
@@ -1302,24 +1302,24 @@  discard block
 block discarded – undo
1302 1302
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1303 1303
 	*		@return 		BOOL|wp_die()
1304 1304
 	*/
1305
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1306
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1307
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1308
-		$capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1305
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1306
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1307
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1308
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1309 1309
 
1310
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1311
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1310
+		if (empty($capability) && empty($route_to_check)) {
1311
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1312 1312
 		} else {
1313
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1313
+			$capability = empty($capability) ? 'manage_options' : $capability;
1314 1314
 		}
1315 1315
 
1316
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1316
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1317 1317
 
1318
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1319
-			if ( $verify_only ) {
1318
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1319
+			if ($verify_only) {
1320 1320
 				return FALSE;
1321 1321
 			} else {
1322
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1322
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1323 1323
 			}
1324 1324
 		}
1325 1325
 		return TRUE;
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 		$this->_add_admin_page_overlay();
1397 1397
 
1398 1398
 		//if metaboxes are present we need to add the nonce field
1399
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1399
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1400 1400
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1401 1401
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1402 1402
 		}
@@ -1415,19 +1415,19 @@  discard block
 block discarded – undo
1415 1415
 	 */
1416 1416
 	public function admin_footer_global() {
1417 1417
 		//dialog container for dialog helper
1418
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1418
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1419 1419
 		$d_cont .= '<div class="ee-notices"></div>';
1420 1420
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1421 1421
 		$d_cont .= '</div>';
1422 1422
 		echo $d_cont;
1423 1423
 
1424 1424
 		//help tour stuff?
1425
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1425
+		if (isset($this->_help_tour[$this->_req_action])) {
1426 1426
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1427 1427
 		}
1428 1428
 
1429 1429
 		//current set timezone for timezone js
1430
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1430
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1431 1431
 	}
1432 1432
 
1433 1433
 
@@ -1451,18 +1451,18 @@  discard block
 block discarded – undo
1451 1451
 	 * @access protected
1452 1452
 	 * @return string content
1453 1453
 	 */
1454
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1454
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1455 1455
 		$content = '';
1456 1456
 
1457
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1458
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1457
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1458
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1459 1459
 
1460 1460
 
1461 1461
 		//loop through the array and setup content
1462
-		foreach ( $help_array as $trigger => $help ) {
1462
+		foreach ($help_array as $trigger => $help) {
1463 1463
 			//make sure the array is setup properly
1464
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1465
-				throw new EE_Error( __('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') );
1464
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1465
+				throw new EE_Error(__('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso'));
1466 1466
 			}
1467 1467
 
1468 1468
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1472,10 +1472,10 @@  discard block
 block discarded – undo
1472 1472
 				'help_popup_content' => $help['content']
1473 1473
 				);
1474 1474
 
1475
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1475
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1476 1476
 		}
1477 1477
 
1478
-		if ( $display )
1478
+		if ($display)
1479 1479
 			echo $content;
1480 1480
 		else
1481 1481
 			return $content;
@@ -1492,18 +1492,18 @@  discard block
 block discarded – undo
1492 1492
 	 */
1493 1493
 	private function _get_help_content() {
1494 1494
 		//what is the method we're looking for?
1495
-		$method_name = '_help_popup_content_' . $this->_req_action;
1495
+		$method_name = '_help_popup_content_'.$this->_req_action;
1496 1496
 
1497 1497
 		//if method doesn't exist let's get out.
1498
-		if ( !method_exists( $this, $method_name ) )
1498
+		if ( ! method_exists($this, $method_name))
1499 1499
 			return array();
1500 1500
 
1501 1501
 		//k we're good to go let's retrieve the help array
1502
-		$help_array = call_user_func( array( $this, $method_name ) );
1502
+		$help_array = call_user_func(array($this, $method_name));
1503 1503
 
1504 1504
 		//make sure we've got an array!
1505
-		if ( !is_array($help_array) ) {
1506
-			throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) );
1505
+		if ( ! is_array($help_array)) {
1506
+			throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso'));
1507 1507
 		}
1508 1508
 
1509 1509
 		return $help_array;
@@ -1525,27 +1525,27 @@  discard block
 block discarded – undo
1525 1525
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1526 1526
 	 * @return string
1527 1527
 	 */
1528
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1528
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1529 1529
 
1530
-		if ( defined('DOING_AJAX') ) return;
1530
+		if (defined('DOING_AJAX')) return;
1531 1531
 
1532 1532
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1533 1533
 		$help_array = $this->_get_help_content();
1534 1534
 		$help_content = '';
1535 1535
 
1536
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1536
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1537 1537
 			$help_array[$trigger_id] = array(
1538 1538
 				'title' => __('Missing Content', 'event_espresso'),
1539 1539
 				'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso')
1540 1540
 				);
1541
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1541
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1542 1542
 		}
1543 1543
 
1544 1544
 		//let's setup the trigger
1545
-		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1546
-		$content = $content . $help_content;
1545
+		$content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1546
+		$content = $content.$help_content;
1547 1547
 
1548
-		if ( $display )
1548
+		if ($display)
1549 1549
 			echo $content;
1550 1550
 		else
1551 1551
 			return $content;
@@ -1602,15 +1602,15 @@  discard block
 block discarded – undo
1602 1602
 	public function load_global_scripts_styles() {
1603 1603
 		/** STYLES **/
1604 1604
 		// add debugging styles
1605
-		if ( WP_DEBUG ) {
1606
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1605
+		if (WP_DEBUG) {
1606
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1607 1607
 		}
1608 1608
 
1609 1609
 		//register all styles
1610
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION );
1611
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1610
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1611
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1612 1612
 		//helpers styles
1613
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1613
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1614 1614
 		//enqueue global styles
1615 1615
 		wp_enqueue_style('ee-admin-css');
1616 1616
 
@@ -1618,66 +1618,66 @@  discard block
 block discarded – undo
1618 1618
 		/** SCRIPTS **/
1619 1619
 
1620 1620
 		//register all scripts
1621
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1622
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1623
-		wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true );
1621
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1622
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1623
+		wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1624 1624
 
1625
-		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true );
1625
+		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true);
1626 1626
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1627
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1627
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1628 1628
 		add_filter('FHEE_load_joyride', '__return_true');
1629 1629
 
1630 1630
 		//script for sorting tables
1631
-		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1631
+		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1632 1632
 		//script for parsing uri's
1633
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1633
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1634 1634
 		//and parsing associative serialized form elements
1635
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1635
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1636 1636
 		//helpers scripts
1637
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1638
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1639
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1640
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1637
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1638
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1639
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1640
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1641 1641
 
1642 1642
 		//google charts
1643
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1643
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1644 1644
 
1645 1645
 		//enqueue global scripts
1646 1646
 
1647 1647
 		//taking care of metaboxes
1648
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1648
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1649 1649
 			wp_enqueue_script('dashboard');
1650 1650
 		}
1651 1651
 
1652 1652
 		//enqueue thickbox for ee help popups.  default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups
1653
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1653
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1654 1654
 			wp_enqueue_script('ee_admin_js');
1655 1655
 			wp_enqueue_style('ee-admin-css');
1656 1656
 		}
1657 1657
 
1658 1658
 
1659 1659
 		//localize script for ajax lazy loading
1660
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1661
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1660
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1661
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1662 1662
 
1663 1663
 
1664 1664
 		/**
1665 1665
 		 * help tour stuff
1666 1666
 		 */
1667
-		if ( !empty( $this->_help_tour ) ) {
1667
+		if ( ! empty($this->_help_tour)) {
1668 1668
 
1669 1669
 			//register the js for kicking things off
1670
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1670
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1671 1671
 
1672 1672
 			//setup tours for the js tour object
1673
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1673
+			foreach ($this->_help_tour['tours'] as $tour) {
1674 1674
 				$tours[] = array(
1675 1675
 					'id' => $tour->get_slug(),
1676 1676
 					'options' => $tour->get_options()
1677 1677
 					);
1678 1678
 			}
1679 1679
 
1680
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1680
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1681 1681
 
1682 1682
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1683 1683
 		}
@@ -1695,52 +1695,52 @@  discard block
 block discarded – undo
1695 1695
 	public function admin_footer_scripts_eei18n_js_strings() {
1696 1696
 
1697 1697
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1698
-		EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' );
1699
-
1700
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1701
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1702
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1703
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1704
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1705
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1706
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1707
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1708
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1709
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1710
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1711
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1724
-
1725
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1735
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1736
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1698
+		EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso');
1699
+
1700
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1701
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1702
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1703
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1704
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1705
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1706
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1707
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1708
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1709
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1710
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1711
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1724
+
1725
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1735
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1736
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1739 1739
 
1740 1740
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1741 1741
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1742 1742
 		//espresso_core is listed as a dependency of ee_admin_js.
1743
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1743
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1744 1744
 
1745 1745
 	}
1746 1746
 
@@ -1774,23 +1774,23 @@  discard block
 block discarded – undo
1774 1774
 	protected function _set_list_table() {
1775 1775
 
1776 1776
 		//first is this a list_table view?
1777
-		if ( !isset($this->_route_config['list_table']) )
1777
+		if ( ! isset($this->_route_config['list_table']))
1778 1778
 			return; //not a list_table view so get out.
1779 1779
 
1780 1780
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1781 1781
 
1782
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1782
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1783 1783
 			//user error msg
1784
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1784
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1785 1785
 			//developer error msg
1786
-			$error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action );
1787
-			throw new EE_Error( $error_msg );
1786
+			$error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action);
1787
+			throw new EE_Error($error_msg);
1788 1788
 		}
1789 1789
 
1790 1790
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1791
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1792
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1793
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1791
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1792
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1793
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1794 1794
 
1795 1795
 		$this->_set_list_table_view();
1796 1796
 		$this->_set_list_table_object();
@@ -1812,14 +1812,14 @@  discard block
 block discarded – undo
1812 1812
 	*		@return array
1813 1813
 	*/
1814 1814
 	protected function _set_list_table_view() {
1815
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1815
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1816 1816
 
1817 1817
 
1818 1818
 		// looking at active items or dumpster diving ?
1819
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1820
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1819
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1820
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1821 1821
 		} else {
1822
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1822
+			$this->_view = sanitize_key($this->_req_data['status']);
1823 1823
 		}
1824 1824
 	}
1825 1825
 
@@ -1830,9 +1830,9 @@  discard block
 block discarded – undo
1830 1830
 	 * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of.
1831 1831
 	 */
1832 1832
 	protected function _set_list_table_object() {
1833
-		if ( isset($this->_route_config['list_table'] ) ) {
1834
-			if ( !class_exists( $this->_route_config['list_table'] ) )
1835
-				throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) );
1833
+		if (isset($this->_route_config['list_table'])) {
1834
+			if ( ! class_exists($this->_route_config['list_table']))
1835
+				throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist.  Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this)));
1836 1836
 			$a = new ReflectionClass($this->_route_config['list_table']);
1837 1837
 			$this->_list_table_object = $a->newInstance($this);
1838 1838
 		}
@@ -1851,27 +1851,27 @@  discard block
 block discarded – undo
1851 1851
 	 *
1852 1852
 	 * @return array
1853 1853
 	 */
1854
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1854
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1855 1855
 
1856
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1856
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1857 1857
 
1858
-		if ( empty( $this->_views )) {
1858
+		if (empty($this->_views)) {
1859 1859
 			$this->_views = array();
1860 1860
 		}
1861 1861
 
1862 1862
 		// cycle thru views
1863
-		foreach ( $this->_views as $key => $view ) {
1863
+		foreach ($this->_views as $key => $view) {
1864 1864
 			$query_args = array();
1865 1865
 			// check for current view
1866
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1866
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1867 1867
 			$query_args['action'] = $this->_req_action;
1868
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1868
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1869 1869
 			$query_args['status'] = $view['slug'];
1870 1870
 			//merge any other arguments sent in.
1871
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1872
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1871
+			if (isset($extra_query_args[$view['slug']])) {
1872
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1873 1873
 			}
1874
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1874
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1875 1875
 		}
1876 1876
 
1877 1877
 		return $this->_views;
@@ -1888,15 +1888,15 @@  discard block
 block discarded – undo
1888 1888
 	 * @param int $max_entries total number of rows in the table
1889 1889
 	 * @return string
1890 1890
 	*/
1891
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1891
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1892 1892
 
1893
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1894
-		$values = array( 10, 25, 50, 100 );
1895
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1893
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1894
+		$values = array(10, 25, 50, 100);
1895
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1896 1896
 
1897
-		if ( $max_entries ) {
1897
+		if ($max_entries) {
1898 1898
 			$values[] = $max_entries;
1899
-			sort( $values );
1899
+			sort($values);
1900 1900
 		}
1901 1901
 
1902 1902
 		$entries_per_page_dropdown = '
@@ -1905,15 +1905,15 @@  discard block
 block discarded – undo
1905 1905
 					Show
1906 1906
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1907 1907
 
1908
-		foreach ( $values as $value ) {
1909
-			if ( $value < $max_entries ) {
1910
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1908
+		foreach ($values as $value) {
1909
+			if ($value < $max_entries) {
1910
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1911 1911
 				$entries_per_page_dropdown .= '
1912 1912
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1913 1913
 			}
1914 1914
 		}
1915 1915
 
1916
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1916
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1917 1917
 		$entries_per_page_dropdown .= '
1918 1918
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1919 1919
 
@@ -1936,8 +1936,8 @@  discard block
 block discarded – undo
1936 1936
 	*		@return 		void
1937 1937
 	*/
1938 1938
 	public function _set_search_attributes() {
1939
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1940
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1939
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1940
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1941 1941
 	}
1942 1942
 
1943 1943
 	/*** END LIST TABLE METHODS **/
@@ -1956,20 +1956,20 @@  discard block
 block discarded – undo
1956 1956
 	 * @return void
1957 1957
 	*/
1958 1958
 	private function _add_registered_meta_boxes() {
1959
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1959
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1960 1960
 
1961 1961
 		//we only add meta boxes if the page_route calls for it
1962
-		if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) {
1962
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) {
1963 1963
 
1964 1964
 
1965 1965
 			//this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader.
1966
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1967
-				if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) {
1966
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1967
+				if (call_user_func(array($this, &$metabox_callback)) === FALSE) {
1968 1968
 					// user error msg
1969
-				$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
1969
+				$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
1970 1970
 				// developer error msg
1971
-				$error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback );
1972
-				throw new EE_Error( $error_msg );
1971
+				$error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback);
1972
+				throw new EE_Error($error_msg);
1973 1973
 				}
1974 1974
 			}
1975 1975
 		}
@@ -1986,17 +1986,17 @@  discard block
 block discarded – undo
1986 1986
 	 * @return void
1987 1987
 	 */
1988 1988
 	private function _add_screen_columns() {
1989
-		if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) {
1989
+		if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) {
1990 1990
 
1991
-			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
1991
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
1992 1992
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
1993 1993
 			$screen_id = $this->_current_screen->id;
1994 1994
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
1995
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
1996
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
1995
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
1996
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
1997 1997
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
1998 1998
 			$this->_template_args['screen'] = $this->_current_screen;
1999
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
1999
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2000 2000
 
2001 2001
 			//finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2002 2002
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2013,11 +2013,11 @@  discard block
 block discarded – undo
2013 2013
 	 */
2014 2014
 
2015 2015
 	private function _espresso_news_post_box() {
2016
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2017
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2016
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2017
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2018 2018
 			$this,
2019 2019
 			'espresso_news_post_box'
2020
-		), $this->_wp_page_slug, 'side' );
2020
+		), $this->_wp_page_slug, 'side');
2021 2021
 	}
2022 2022
 
2023 2023
 
@@ -2025,14 +2025,14 @@  discard block
 block discarded – undo
2025 2025
 	 * Code for setting up espresso ratings request metabox.
2026 2026
 	 */
2027 2027
 	protected function _espresso_ratings_request() {
2028
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2028
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2029 2029
 			return '';
2030 2030
 		}
2031
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2032
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2031
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2032
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2033 2033
 			$this,
2034 2034
 			'espresso_ratings_request'
2035
-		), $this->_wp_page_slug, 'side' );
2035
+		), $this->_wp_page_slug, 'side');
2036 2036
 	}
2037 2037
 
2038 2038
 
@@ -2040,34 +2040,34 @@  discard block
 block discarded – undo
2040 2040
 	 * Code for setting up espresso ratings request metabox content.
2041 2041
 	 */
2042 2042
 	public function espresso_ratings_request() {
2043
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2044
-		EEH_Template::display_template( $template_path, array() );
2043
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2044
+		EEH_Template::display_template($template_path, array());
2045 2045
 	}
2046 2046
 
2047 2047
 
2048 2048
 
2049 2049
 
2050
-	public static function cached_rss_display( $rss_id, $url ) {
2051
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2052
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2053
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2054
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2055
-		$post = '</div>' . "\n";
2050
+	public static function cached_rss_display($rss_id, $url) {
2051
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2052
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2053
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2054
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2055
+		$post = '</div>'."\n";
2056 2056
 
2057
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2058
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2059
-			echo $pre . $output . $post;
2057
+		$cache_key = 'ee_rss_'.md5($rss_id);
2058
+		if (FALSE != ($output = get_transient($cache_key))) {
2059
+			echo $pre.$output.$post;
2060 2060
 			return TRUE;
2061 2061
 		}
2062 2062
 
2063
-		if ( ! $doing_ajax ) {
2064
-			echo $pre . $loading . $post;
2063
+		if ( ! $doing_ajax) {
2064
+			echo $pre.$loading.$post;
2065 2065
 			return FALSE;
2066 2066
 		}
2067 2067
 
2068 2068
 		ob_start();
2069
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2070
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2069
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2070
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2071 2071
 		return TRUE;
2072 2072
 
2073 2073
 	}
@@ -2079,13 +2079,13 @@  discard block
 block discarded – undo
2079 2079
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2080 2080
 	  		<?php
2081 2081
 	  		// Get RSS Feed(s)
2082
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2082
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2083 2083
 	  		$url = urlencode($feed_url);
2084
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2084
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2085 2085
 
2086 2086
 	  		?>
2087 2087
 	  	</div>
2088
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2088
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2089 2089
 	  </div>
2090 2090
 		<?php
2091 2091
 	}
@@ -2106,32 +2106,32 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 	protected function _espresso_sponsors_post_box() {
2108 2108
 
2109
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2110
-		if ( $show_sponsors )
2111
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2109
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2110
+		if ($show_sponsors)
2111
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2112 2112
 	}
2113 2113
 
2114 2114
 
2115 2115
 	public function espresso_sponsors_post_box() {
2116
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2117
-		EEH_Template::display_template( $templatepath );
2116
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2117
+		EEH_Template::display_template($templatepath);
2118 2118
 	}
2119 2119
 
2120 2120
 
2121 2121
 
2122 2122
 	private function _publish_post_box() {
2123
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2123
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2124 2124
 
2125 2125
 		//if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label.  Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2126
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2127
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2126
+		if ( ! empty($this->_labels['publishbox'])) {
2127
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2128 2128
 		} else {
2129 2129
 			$box_label = __('Publish', 'event_espresso');
2130 2130
 		}
2131 2131
 
2132
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2132
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2133 2133
 
2134
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2134
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2135 2135
 
2136 2136
 	}
2137 2137
 
@@ -2139,9 +2139,9 @@  discard block
 block discarded – undo
2139 2139
 
2140 2140
 	public function editor_overview() {
2141 2141
 		//if we have extra content set let's add it in if not make sure its empty
2142
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2143
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2144
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2142
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2143
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2144
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2145 2145
 	}
2146 2146
 
2147 2147
 
@@ -2157,8 +2157,8 @@  discard block
 block discarded – undo
2157 2157
 	 * @see $this->_set_publish_post_box_vars for param details
2158 2158
 	 * @since 4.6.0
2159 2159
 	 */
2160
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2161
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2160
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2161
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2162 2162
 	}
2163 2163
 
2164 2164
 
@@ -2177,24 +2177,24 @@  discard block
 block discarded – undo
2177 2177
 	 * @param	string	$post_save_redirect_URL	custom URL to redirect to after Save & Close has been completed
2178 2178
 	 * @param	boolean	$both_btns	whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button
2179 2179
 	 */
2180
-	protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) {
2180
+	protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) {
2181 2181
 
2182 2182
 		// if Save & Close, use a custom redirect URL or default to the main page?
2183
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2183
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2184 2184
 		// create the Save & Close and Save buttons
2185
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2185
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2186 2186
 		//if we have extra content set let's add it in if not make sure its empty
2187
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2187
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2188 2188
 
2189 2189
 
2190
-		if ( $delete && ! empty( $id )  ) {
2190
+		if ($delete && ! empty($id)) {
2191 2191
 			$delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent.
2192
-			$delete_link_args = array( $name => $id );
2193
-			$delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion');
2192
+			$delete_link_args = array($name => $id);
2193
+			$delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion');
2194 2194
 		}
2195 2195
 
2196
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2197
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2196
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2197
+		if ( ! empty($name) && ! empty($id)) {
2198 2198
 			$hidden_field_arr[$name] = array(
2199 2199
 				'type' => 'hidden',
2200 2200
 				'value' => $id
@@ -2204,7 +2204,7 @@  discard block
 block discarded – undo
2204 2204
 			$hf = '';
2205 2205
 		}
2206 2206
 		// add hidden field
2207
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2207
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2208 2208
 
2209 2209
 	}
2210 2210
 
@@ -2221,8 +2221,8 @@  discard block
 block discarded – undo
2221 2221
 		<noscript>
2222 2222
 			<div id="no-js-message" class="error">
2223 2223
 				<p style="font-size:1.3em;">
2224
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2225
-					<?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?>
2224
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2225
+					<?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?>
2226 2226
 				</p>
2227 2227
 			</div>
2228 2228
 		</noscript>
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 	*		@return 		string
2243 2243
 	*/
2244 2244
 	private function _display_espresso_notices() {
2245
-		$notices = $this->_get_transient( TRUE );
2245
+		$notices = $this->_get_transient(TRUE);
2246 2246
 		echo stripslashes($notices);
2247 2247
 	}
2248 2248
 
@@ -2294,11 +2294,11 @@  discard block
 block discarded – undo
2294 2294
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2295 2295
 	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box.
2296 2296
 	 */
2297
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2298
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2297
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2298
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2299 2299
 
2300 2300
 		//if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2301
-		if ( empty( $callback_args ) && $create_func ) {
2301
+		if (empty($callback_args) && $create_func) {
2302 2302
 			$callback_args = array(
2303 2303
 				'template_path' => $this->_template_path,
2304 2304
 				'template_args' => $this->_template_args,
@@ -2308,7 +2308,7 @@  discard block
 block discarded – undo
2308 2308
 		//if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2309 2309
 		$call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback;
2310 2310
 
2311
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2311
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2312 2312
 	}
2313 2313
 
2314 2314
 
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
 	 */
2322 2322
 	public function display_admin_page_with_metabox_columns() {
2323 2323
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2324
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2324
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2325 2325
 
2326 2326
 		//the final wrapper
2327 2327
 		$this->admin_page_wrapper();
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 	 * @return void
2365 2365
 	 */
2366 2366
 	public function display_about_admin_page() {
2367
-		$this->_display_admin_page( FALSE, TRUE );
2367
+		$this->_display_admin_page(FALSE, TRUE);
2368 2368
 	}
2369 2369
 
2370 2370
 
@@ -2380,26 +2380,26 @@  discard block
 block discarded – undo
2380 2380
 	 * @return html           admin_page
2381 2381
 	 */
2382 2382
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2383
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2383
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2384 2384
 
2385 2385
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2386
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2386
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2387 2387
 
2388 2388
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2389 2389
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2390 2390
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2391 2391
 
2392
-		$template_path = $sidebar ?  EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2392
+		$template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2393 2393
 
2394
-		if ( defined('DOING_AJAX' ) )
2395
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2394
+		if (defined('DOING_AJAX'))
2395
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2396 2396
 
2397
-		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2397
+		$template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2398 2398
 
2399
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2399
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2400 2400
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2401 2401
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2402
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2402
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2403 2403
 
2404 2404
 
2405 2405
 		// the final template wrapper
@@ -2419,7 +2419,7 @@  discard block
 block discarded – undo
2419 2419
 	 * @param bool   $display_sidebar whether to use the sidebar template or the full template for the page.  TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar.
2420 2420
 	 * @return void
2421 2421
 	 */
2422
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2422
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2423 2423
 		//let's generate a default preview action button if there isn't one already present.
2424 2424
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2425 2425
 		$buy_now_url = add_query_arg(
@@ -2432,10 +2432,10 @@  discard block
 block discarded – undo
2432 2432
 			),
2433 2433
 		'http://eventespresso.com/pricing/'
2434 2434
 		);
2435
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button'];
2436
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2437
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2438
-		$this->_display_admin_page( $display_sidebar );
2435
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button'];
2436
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2437
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2438
+		$this->_display_admin_page($display_sidebar);
2439 2439
 	}
2440 2440
 
2441 2441
 
@@ -2469,41 +2469,41 @@  discard block
 block discarded – undo
2469 2469
 	 * @param boolean $sidebar whether to display with sidebar or not.
2470 2470
 	 * @return html
2471 2471
 	 */
2472
-	private function _display_admin_list_table_page( $sidebar = false ) {
2472
+	private function _display_admin_list_table_page($sidebar = false) {
2473 2473
 		//setup search attributes
2474 2474
 		$this->_set_search_attributes();
2475 2475
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2476
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2476
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2477 2477
 
2478
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2478
+		$this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2479 2479
 		$this->_template_args['list_table'] = $this->_list_table_object;
2480 2480
 		$this->_template_args['current_route'] = $this->_req_action;
2481
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2481
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2482 2482
 
2483 2483
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2484
-		if( ! empty( $ajax_sorting_callback )) {
2485
-			$sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE );
2484
+		if ( ! empty($ajax_sorting_callback)) {
2485
+			$sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE);
2486 2486
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2487 2487
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2488
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2489
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2488
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2489
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2490 2490
 		} else {
2491 2491
 			$sortable_list_table_form_fields = '';
2492 2492
 		}
2493 2493
 
2494 2494
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2495
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2496
-		$nonce_ref = $this->_req_action . '_nonce';
2497
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2495
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2496
+		$nonce_ref = $this->_req_action.'_nonce';
2497
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2498 2498
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2499 2499
 
2500 2500
 		//display message about search results?
2501
-		$this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action );
2501
+		$this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action);
2502 2502
 
2503
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2503
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2504 2504
 
2505 2505
 		// the final template wrapper
2506
-		if ( $sidebar )
2506
+		if ($sidebar)
2507 2507
 			$this->display_admin_page_with_sidebar();
2508 2508
 		else
2509 2509
 			$this->display_admin_page_with_no_sidebar();
@@ -2526,9 +2526,9 @@  discard block
 block discarded – undo
2526 2526
 	 * @param  array $items  see above for format of array
2527 2527
 	 * @return string        html string of legend
2528 2528
 	 */
2529
-	protected function _display_legend( $items ) {
2530
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2531
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2529
+	protected function _display_legend($items) {
2530
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2531
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2532 2532
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2533 2533
 	}
2534 2534
 
@@ -2553,31 +2553,31 @@  discard block
 block discarded – undo
2553 2553
 	 *
2554 2554
 	 * @return string json object
2555 2555
 	 */
2556
-	protected function _return_json( $sticky_notices = FALSE ) {
2556
+	protected function _return_json($sticky_notices = FALSE) {
2557 2557
 
2558 2558
 		//make sure any EE_Error notices have been handled.
2559
-		$this->_process_notices( array(), true, $sticky_notices );
2559
+		$this->_process_notices(array(), true, $sticky_notices);
2560 2560
 
2561 2561
 
2562
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2562
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2563 2563
 		unset($this->_template_args['data']);
2564 2564
 		$json = array(
2565
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : FALSE,
2566
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : FALSE,
2565
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : FALSE,
2566
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : FALSE,
2567 2567
 			'notices' => EE_Error::get_notices(),
2568
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2569
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2568
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2569
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2570 2570
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2571 2571
 			);
2572 2572
 
2573 2573
 
2574 2574
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2575
-		if ( NULL === error_get_last() || ! headers_sent() )
2575
+		if (NULL === error_get_last() || ! headers_sent())
2576 2576
 			header('Content-Type: application/json; charset=UTF-8');
2577
-                if( function_exists( 'wp_json_encode' ) ) {
2578
-                    echo wp_json_encode( $json );
2577
+                if (function_exists('wp_json_encode')) {
2578
+                    echo wp_json_encode($json);
2579 2579
                 } else {
2580
-                    echo json_encode( $json );
2580
+                    echo json_encode($json);
2581 2581
                 }
2582 2582
 		exit();
2583 2583
 	}
@@ -2589,11 +2589,11 @@  discard block
 block discarded – undo
2589 2589
 	 * @return json_obj|EE_Error
2590 2590
 	 */
2591 2591
 	public function return_json() {
2592
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2592
+		if (defined('DOING_AJAX') && DOING_AJAX)
2593 2593
 			$this->_return_json();
2594 2594
 
2595 2595
 		else {
2596
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2596
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2597 2597
 		}
2598 2598
 	}
2599 2599
 
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
 	 * @access public
2609 2609
 	 * @return void
2610 2610
 	 */
2611
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2611
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2612 2612
 		$this->_hook_obj = $hook_obj;
2613 2613
 	}
2614 2614
 
@@ -2624,33 +2624,33 @@  discard block
 block discarded – undo
2624 2624
 	*/
2625 2625
 	public function admin_page_wrapper($about = FALSE) {
2626 2626
 
2627
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2627
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2628 2628
 
2629 2629
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2630 2630
 
2631 2631
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2632 2632
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2633 2633
 
2634
-		$this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : '');
2635
-		$this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : '');
2634
+		$this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '');
2635
+		$this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '');
2636 2636
 
2637 2637
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2638 2638
 
2639 2639
 
2640 2640
 
2641 2641
 		// load settings page wrapper template
2642
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2642
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2643 2643
 
2644 2644
 		//about page?
2645
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2645
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2646 2646
 
2647 2647
 
2648
-		if ( defined( 'DOING_AJAX' ) ) {
2649
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2648
+		if (defined('DOING_AJAX')) {
2649
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2650 2650
 
2651 2651
 			$this->_return_json();
2652 2652
 		} else {
2653
-			EEH_Template::display_template( $template_path, $this->_template_args );
2653
+			EEH_Template::display_template($template_path, $this->_template_args);
2654 2654
 		}
2655 2655
 
2656 2656
 	}
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 	*		@access public
2679 2679
 	*		@return void
2680 2680
 	*/
2681
-	private function _sort_nav_tabs( $a, $b ) {
2681
+	private function _sort_nav_tabs($a, $b) {
2682 2682
 		if ($a['order'] == $b['order']) {
2683 2683
 	        return 0;
2684 2684
 	    }
@@ -2699,7 +2699,7 @@  discard block
 block discarded – undo
2699 2699
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2700 2700
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2701 2701
 	 */
2702
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2702
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2703 2703
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2704 2704
 		return $content;
2705 2705
 	}
@@ -2721,25 +2721,25 @@  discard block
 block discarded – undo
2721 2721
 	 * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button).  We can also use this to just dump default actions by submitting some other value.
2722 2722
 	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling).
2723 2723
 	 */
2724
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2724
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2725 2725
 		//make sure $text and $actions are in an array
2726 2726
 		$text = (array) $text;
2727 2727
 		$actions = (array) $actions;
2728 2728
 		$referrer_url = empty($referrer) ? '' : $referrer;
2729
-		$referrer_url = !$referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />';
2729
+		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />';
2730 2730
 
2731
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2732
-		$default_names = array( 'save', 'save_and_close' );
2731
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2732
+		$default_names = array('save', 'save_and_close');
2733 2733
 
2734 2734
 		//add in a hidden index for the current page (so save and close redirects properly)
2735 2735
 		$this->_template_args['save_buttons'] = $referrer_url;
2736 2736
 
2737
-		foreach ( $button_text as $key => $button ) {
2737
+		foreach ($button_text as $key => $button) {
2738 2738
 			$ref = $default_names[$key];
2739
-			$id = $this->_current_view . '_' . $ref;
2740
-			$name = !empty($actions) ? $actions[$key] : $ref;
2741
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2742
-			if ( !$both ) break;
2739
+			$id = $this->_current_view.'_'.$ref;
2740
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2741
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2742
+			if ( ! $both) break;
2743 2743
 		}
2744 2744
 
2745 2745
 	}
@@ -2752,8 +2752,8 @@  discard block
 block discarded – undo
2752 2752
 	 * @since 4.6.0
2753 2753
 	 *
2754 2754
 	 */
2755
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2756
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2755
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2756
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2757 2757
 	}
2758 2758
 
2759 2759
 
@@ -2766,30 +2766,30 @@  discard block
 block discarded – undo
2766 2766
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2767 2767
 	 * @return void
2768 2768
 	 */
2769
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2769
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2770 2770
 
2771
-		if ( empty( $route )) {
2771
+		if (empty($route)) {
2772 2772
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2773
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2774
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2773
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2774
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2775 2775
 		}
2776 2776
 		// open form
2777
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2777
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2778 2778
 		// add nonce
2779
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2779
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2780 2780
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2781
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2781
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2782 2782
 		// add REQUIRED form action
2783 2783
 		$hidden_fields = array(
2784
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2784
+				'action' => array('type' => 'hidden', 'value' => $route),
2785 2785
 			);
2786 2786
 		// merge arrays
2787
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2787
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2788 2788
 		// generate form fields
2789
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2789
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2790 2790
 		// add fields to form
2791
-		foreach ( $form_fields as $field_name => $form_field ) {
2792
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2791
+		foreach ($form_fields as $field_name => $form_field) {
2792
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2793 2793
 		}
2794 2794
 
2795 2795
 		// close form
@@ -2806,8 +2806,8 @@  discard block
 block discarded – undo
2806 2806
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2807 2807
 	 * @since 4.5.0
2808 2808
 	 */
2809
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2810
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2809
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2810
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2811 2811
 	}
2812 2812
 
2813 2813
 
@@ -2823,32 +2823,32 @@  discard block
 block discarded – undo
2823 2823
 	 *	@access protected
2824 2824
 	 *	@return void
2825 2825
 	 */
2826
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2826
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2827 2827
 
2828
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2828
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2829 2829
 
2830 2830
 		//class name for actions/filters.
2831 2831
 		$classname = get_class($this);
2832 2832
 
2833 2833
 		//set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url
2834
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2835
-		$notices = EE_Error::get_notices( FALSE );
2834
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2835
+		$notices = EE_Error::get_notices(FALSE);
2836 2836
 
2837 2837
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2838
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2838
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2839 2839
 			EE_Error::overwrite_success();
2840 2840
 		}
2841 2841
 		// how many records affected ? more than one record ? or just one ?
2842
-		if ( $success > 1 && empty( $notices['errors'] )) {
2842
+		if ($success > 1 && empty($notices['errors'])) {
2843 2843
 			// set plural msg
2844
-			EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__);
2845
-		} else if ( $success == 1 && empty( $notices['errors'] )) {
2844
+			EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2845
+		} else if ($success == 1 && empty($notices['errors'])) {
2846 2846
 			// set singular msg
2847
-			EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ );
2847
+			EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__);
2848 2848
 		}
2849 2849
 
2850 2850
 		// check that $query_args isn't something crazy
2851
-		if ( ! is_array( $query_args )) {
2851
+		if ( ! is_array($query_args)) {
2852 2852
 			$query_args = array();
2853 2853
 		}
2854 2854
 
@@ -2861,36 +2861,36 @@  discard block
 block discarded – undo
2861 2861
 		 * @param array $query_args   The original query_args array coming into the
2862 2862
 		 *                          		method.
2863 2863
 		 */
2864
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2864
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2865 2865
 
2866 2866
 		//calculate where we're going (if we have a "save and close" button pushed)
2867
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2867
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2868 2868
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2869
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2869
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2870 2870
 			// regenerate query args array from refferer URL
2871
-			parse_str( $parsed_url['query'], $query_args );
2871
+			parse_str($parsed_url['query'], $query_args);
2872 2872
 			// correct page and action will be in the query args now
2873
-			$redirect_url = admin_url( 'admin.php' );
2873
+			$redirect_url = admin_url('admin.php');
2874 2874
 		}
2875 2875
 
2876 2876
 		//merge any default query_args set in _default_route_query_args property
2877
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2877
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2878 2878
 			$args_to_merge = array();
2879
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2879
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2880 2880
 				//is there a wp_referer array in our _default_route_query_args property?
2881
-				if ( $query_param == 'wp_referer'  ) {
2881
+				if ($query_param == 'wp_referer') {
2882 2882
 					$query_value = (array) $query_value;
2883
-					foreach ( $query_value as $reference => $value ) {
2884
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2883
+					foreach ($query_value as $reference => $value) {
2884
+						if (strpos($reference, 'nonce') !== false) {
2885 2885
 							continue;
2886 2886
 						}
2887 2887
 
2888 2888
 						//finally we will override any arguments in the referer with
2889 2889
 						//what might be set on the _default_route_query_args array.
2890
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
2891
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
2890
+						if (isset($this->_default_route_query_args[$reference])) {
2891
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
2892 2892
 						} else {
2893
-							$args_to_merge[$reference] = urlencode( $value );
2893
+							$args_to_merge[$reference] = urlencode($value);
2894 2894
 						}
2895 2895
 					}
2896 2896
 					continue;
@@ -2901,7 +2901,7 @@  discard block
 block discarded – undo
2901 2901
 
2902 2902
 			//now let's merge these arguments but override with what was specifically sent in to the
2903 2903
 			//redirect.
2904
-			$query_args = array_merge( $args_to_merge, $query_args );
2904
+			$query_args = array_merge($args_to_merge, $query_args);
2905 2905
 		}
2906 2906
 
2907 2907
 		$this->_process_notices($query_args);
@@ -2910,19 +2910,19 @@  discard block
 block discarded – undo
2910 2910
 		// generate redirect url
2911 2911
 
2912 2912
 		// if redirecting to anything other than the main page, add a nonce
2913
-		if ( isset( $query_args['action'] )) {
2913
+		if (isset($query_args['action'])) {
2914 2914
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
2915
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
2915
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
2916 2916
 		}
2917 2917
 
2918 2918
 		//we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that).
2919
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
2919
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
2920 2920
 
2921
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
2921
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
2922 2922
 
2923 2923
 
2924 2924
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
2925
-		if ( defined('DOING_AJAX' ) ) {
2925
+		if (defined('DOING_AJAX')) {
2926 2926
 			$default_data = array(
2927 2927
 				'close' => TRUE,
2928 2928
 				'redirect_url' => $redirect_url,
@@ -2931,11 +2931,11 @@  discard block
 block discarded – undo
2931 2931
 				);
2932 2932
 
2933 2933
 			$this->_template_args['success'] = $success;
2934
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
2934
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
2935 2935
 			$this->_return_json();
2936 2936
 		}
2937 2937
 
2938
-		wp_safe_redirect( $redirect_url );
2938
+		wp_safe_redirect($redirect_url);
2939 2939
 		exit();
2940 2940
 	}
2941 2941
 
@@ -2951,14 +2951,14 @@  discard block
 block discarded – undo
2951 2951
 	 * @param bool    $sticky_notices      This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice.
2952 2952
 	 * @return void
2953 2953
 	 */
2954
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
2954
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
2955 2955
 
2956 2956
 		$this->_template_args['notices'] = EE_Error::get_notices();
2957 2957
 
2958 2958
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
2959
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
2960
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
2961
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
2959
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
2960
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
2961
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
2962 2962
 		}
2963 2963
 	}
2964 2964
 
@@ -2980,32 +2980,32 @@  discard block
 block discarded – undo
2980 2980
 	 *
2981 2981
 	 * @return string html for button
2982 2982
 	 */
2983
-	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) {
2983
+	public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) {
2984 2984
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
2985
-		if ( !isset($this->_page_routes[$action]) && !$base_url )
2986
-			throw new EE_Error( sprintf( __('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action) );
2985
+		if ( ! isset($this->_page_routes[$action]) && ! $base_url)
2986
+			throw new EE_Error(sprintf(__('There is no page route for given action for the button.  This action was given: %s', 'event_espresso'), $action));
2987 2987
 
2988
-		if ( !isset( $this->_labels['buttons'][$type] ) )
2989
-			throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) );
2988
+		if ( ! isset($this->_labels['buttons'][$type]))
2989
+			throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type));
2990 2990
 
2991 2991
 		//finally check user access for this button.
2992
-		$has_access = $this->check_user_access( $action, TRUE );
2993
-		if ( ! $has_access ) {
2992
+		$has_access = $this->check_user_access($action, TRUE);
2993
+		if ( ! $has_access) {
2994 2994
 			return '';
2995 2995
 		}
2996 2996
 
2997
-		$_base_url = !$base_url ? $this->_admin_base_url : $base_url;
2997
+		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
2998 2998
 
2999 2999
 		$query_args = array(
3000 3000
 			'action' => $action  );
3001 3001
 
3002 3002
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3003
-		if ( !empty($extra_request) )
3004
-			$query_args = array_merge( $extra_request, $query_args );
3003
+		if ( ! empty($extra_request))
3004
+			$query_args = array_merge($extra_request, $query_args);
3005 3005
 
3006
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3006
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3007 3007
 
3008
-		$button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class );
3008
+		$button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3009 3009
 
3010 3010
 		return $button;
3011 3011
 	}
@@ -3025,11 +3025,11 @@  discard block
 block discarded – undo
3025 3025
 		$args = array(
3026 3026
 			'label' => $this->_admin_page_title,
3027 3027
 			'default' => 10,
3028
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3028
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3029 3029
 			);
3030 3030
 		//ONLY add the screen option if the user has access to it.
3031
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3032
-			add_screen_option( $option, $args );
3031
+		if ($this->check_user_access($this->_current_view, true)) {
3032
+			add_screen_option($option, $args);
3033 3033
 		}
3034 3034
 	}
3035 3035
 
@@ -3045,36 +3045,36 @@  discard block
 block discarded – undo
3045 3045
 	 * @return void
3046 3046
 	 */
3047 3047
 	private function _set_per_page_screen_options() {
3048
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3049
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3048
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3049
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3050 3050
 
3051
-			if ( !$user = wp_get_current_user() )
3051
+			if ( ! $user = wp_get_current_user())
3052 3052
 			return;
3053 3053
 			$option = $_POST['wp_screen_options']['option'];
3054 3054
 			$value = $_POST['wp_screen_options']['value'];
3055 3055
 
3056
-			if ( $option != sanitize_key( $option ) )
3056
+			if ($option != sanitize_key($option))
3057 3057
 				return;
3058 3058
 
3059 3059
 			$map_option = $option;
3060 3060
 
3061 3061
 			$option = str_replace('-', '_', $option);
3062 3062
 
3063
-			switch ( $map_option ) {
3064
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3063
+			switch ($map_option) {
3064
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3065 3065
 					$value = (int) $value;
3066
-					if ( $value < 1 || $value > 999 )
3066
+					if ($value < 1 || $value > 999)
3067 3067
 						return;
3068 3068
 					break;
3069 3069
 				default:
3070
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3071
-					if ( false === $value )
3070
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3071
+					if (false === $value)
3072 3072
 						return;
3073 3073
 					break;
3074 3074
 			}
3075 3075
 
3076 3076
 			update_user_meta($user->ID, $option, $value);
3077
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3077
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3078 3078
 			exit;
3079 3079
 		}
3080 3080
 	}
@@ -3085,8 +3085,8 @@  discard block
 block discarded – undo
3085 3085
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3086 3086
 	 * @param array $data array that will be assigned to template args.
3087 3087
 	 */
3088
-	public function set_template_args( $data ) {
3089
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3088
+	public function set_template_args($data) {
3089
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3090 3090
 	}
3091 3091
 
3092 3092
 
@@ -3102,26 +3102,26 @@  discard block
 block discarded – undo
3102 3102
 	 * @param bool $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used when we are adding a transient before page_routes have been defined.
3103 3103
 	 * @return void
3104 3104
 	 */
3105
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3105
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3106 3106
 		$user_id = get_current_user_id();
3107 3107
 
3108
-		if ( !$skip_route_verify )
3108
+		if ( ! $skip_route_verify)
3109 3109
 			$this->_verify_route($route);
3110 3110
 
3111 3111
 
3112 3112
 		//now let's set the string for what kind of transient we're setting
3113
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3114
-		$data = $notices ? array( 'notices' => $data ) : $data;
3113
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3114
+		$data = $notices ? array('notices' => $data) : $data;
3115 3115
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3116
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3117
-		if ( $existing ) {
3118
-			$data = array_merge( (array) $data, (array) $existing );
3116
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3117
+		if ($existing) {
3118
+			$data = array_merge((array) $data, (array) $existing);
3119 3119
 		}
3120 3120
 
3121
-		if ( is_multisite() && is_network_admin() ) {
3122
-			set_site_transient( $transient, $data, 8 );
3121
+		if (is_multisite() && is_network_admin()) {
3122
+			set_site_transient($transient, $data, 8);
3123 3123
 		} else {
3124
-			set_transient( $transient, $data, 8 );
3124
+			set_transient($transient, $data, 8);
3125 3125
 		}
3126 3126
 	}
3127 3127
 
@@ -3133,18 +3133,18 @@  discard block
 block discarded – undo
3133 3133
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3134 3134
 	 * @return mixed data
3135 3135
 	 */
3136
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3136
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3137 3137
 		$user_id = get_current_user_id();
3138
-		$route = !$route ? $this->_req_action : $route;
3139
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3140
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3138
+		$route = ! $route ? $this->_req_action : $route;
3139
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3140
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3141 3141
 		//delete transient after retrieval (just in case it hasn't expired);
3142
-		if ( is_multisite() && is_network_admin() ) {
3143
-			delete_site_transient( $transient );
3142
+		if (is_multisite() && is_network_admin()) {
3143
+			delete_site_transient($transient);
3144 3144
 		} else {
3145
-			delete_transient( $transient );
3145
+			delete_transient($transient);
3146 3146
 		}
3147
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3147
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3148 3148
 	}
3149 3149
 
3150 3150
 
@@ -3161,12 +3161,12 @@  discard block
 block discarded – undo
3161 3161
 
3162 3162
 		//retrieve all existing transients
3163 3163
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3164
-		if ( $results = $wpdb->get_results( $query ) ) {
3165
-			foreach ( $results as $result ) {
3166
-				$transient = str_replace( '_transient_', '', $result->option_name );
3167
-				get_transient( $transient );
3168
-				if ( is_multisite() && is_network_admin() ) {
3169
-					get_site_transient( $transient );
3164
+		if ($results = $wpdb->get_results($query)) {
3165
+			foreach ($results as $result) {
3166
+				$transient = str_replace('_transient_', '', $result->option_name);
3167
+				get_transient($transient);
3168
+				if (is_multisite() && is_network_admin()) {
3169
+					get_site_transient($transient);
3170 3170
 				}
3171 3171
 			}
3172 3172
 		}
@@ -3290,23 +3290,23 @@  discard block
 block discarded – undo
3290 3290
 	 * @param string $line	line no where error occurred
3291 3291
 	 * @return boolean
3292 3292
 	 */
3293
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3293
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3294 3294
 
3295 3295
 		//remove any options that are NOT going to be saved with the config settings.
3296
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3296
+		if (isset($config->core->ee_ueip_optin)) {
3297 3297
 			$config->core->ee_ueip_has_notified = TRUE;
3298 3298
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3299
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3300
-			update_option( 'ee_ueip_has_notified', TRUE );
3299
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3300
+			update_option('ee_ueip_has_notified', TRUE);
3301 3301
 		}
3302 3302
 		// and save it (note we're also doing the network save here)
3303
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3304
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3305
-		if ( $config_saved && $net_saved ) {
3306
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3303
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3304
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3305
+		if ($config_saved && $net_saved) {
3306
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3307 3307
 			return TRUE;
3308 3308
 		} else {
3309
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3309
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3310 3310
 			return FALSE;
3311 3311
 		}
3312 3312
 	}
@@ -3319,7 +3319,7 @@  discard block
 block discarded – undo
3319 3319
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3320 3320
 	 * @return array
3321 3321
 	 */
3322
-	public function get_yes_no_values(){
3322
+	public function get_yes_no_values() {
3323 3323
 		return $this->_yes_no_values;
3324 3324
 	}
3325 3325
 
@@ -3341,8 +3341,8 @@  discard block
 block discarded – undo
3341 3341
 	 *
3342 3342
 	 * @return string
3343 3343
 	 */
3344
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3345
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3344
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3345
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3346 3346
 	}
3347 3347
 
3348 3348
 
@@ -3356,8 +3356,8 @@  discard block
 block discarded – undo
3356 3356
 	 *
3357 3357
 	 * @return string
3358 3358
 	 */
3359
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3360
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3359
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3360
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3361 3361
 	}
3362 3362
 
3363 3363
 
@@ -3376,8 +3376,8 @@  discard block
 block discarded – undo
3376 3376
 	 * @return bool success/fail
3377 3377
 	 */
3378 3378
 	protected function _process_resend_registration() {
3379
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3380
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3379
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3380
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3381 3381
 		return $this->_template_args['success'];
3382 3382
 	}
3383 3383
 
@@ -3390,11 +3390,11 @@  discard block
 block discarded – undo
3390 3390
 	 * @param \EE_Payment $payment
3391 3391
 	 * @return bool success/fail
3392 3392
 	 */
3393
-	protected function _process_payment_notification( EE_Payment $payment ) {
3394
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3395
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3396
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3397
-		return $this->_template_args[ 'success' ];
3393
+	protected function _process_payment_notification(EE_Payment $payment) {
3394
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3395
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3396
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3397
+		return $this->_template_args['success'];
3398 3398
 	}
3399 3399
 
3400 3400
 
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Event_Strategy.core.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 * @param WP_Query $wp_query
40 40
 	 * @param array $CPT
41 41
 	 */
42
-	public function __construct( $wp_query, $CPT = array() ) {
43
-		if ( $wp_query instanceof WP_Query ) {
42
+	public function __construct($wp_query, $CPT = array()) {
43
+		if ($wp_query instanceof WP_Query) {
44 44
 			$WP_Query = $wp_query;
45 45
 			$this->CPT = $CPT;
46 46
 		} else {
47
-			$WP_Query = isset( $wp_query[ 'WP_Query' ] ) ? $wp_query[ 'WP_Query' ] : null;
48
-			$this->CPT = isset( $wp_query[ 'CPT' ] ) ? $wp_query[ 'CPT' ] : null;
47
+			$WP_Query = isset($wp_query['WP_Query']) ? $wp_query['WP_Query'] : null;
48
+			$this->CPT = isset($wp_query['CPT']) ? $wp_query['CPT'] : null;
49 49
 		}
50 50
 		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
51 51
 		// here's the list of available filters in the WP_Query object
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 		// 'posts_fields'
60 60
 		// 'posts_join'
61 61
 		$this->_add_filters();
62
-		if ( $WP_Query instanceof WP_Query ) {
63
-			$WP_Query->is_espresso_event_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE;
62
+		if ($WP_Query instanceof WP_Query) {
63
+			$WP_Query->is_espresso_event_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE;
64 64
 			$WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events') ? TRUE : FALSE;
65
-			$WP_Query->is_espresso_event_taxonomy = is_tax( 'espresso_event_categories' ) ? TRUE : FALSE;
65
+			$WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories') ? TRUE : FALSE;
66 66
 		}
67 67
 
68 68
 	}
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 	 * (which will get removed in case the next call to get_posts ISN'T
75 75
 	 * for event CPTs)
76 76
 	 */
77
-	protected function _add_filters(){
78
-		add_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 );
79
-		add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 );
80
-		add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
77
+	protected function _add_filters() {
78
+		add_filter('posts_fields', array($this, 'posts_fields'), 1, 2);
79
+		add_filter('posts_join', array($this, 'posts_join'), 1, 2);
80
+		add_filter('posts_where', array($this, 'posts_where'), 10, 2);
81 81
 		// add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
82
-		add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 );
83
-		add_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 );
82
+		add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2);
83
+		add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2);
84 84
 	}
85 85
 
86 86
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 	 * This is to avoid applying this CPT strategy for other posts or CPTs (eg,
91 91
 	 * we don't want to join to the datetime table when querying for venues, do we!?)
92 92
 	 */
93
-	protected function _remove_filters(){
94
-		remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1 );
95
-		remove_filter( 'posts_join', array( $this, 'posts_join' ), 1 );
96
-		remove_filter( 'posts_where', array( $this, 'posts_where' ), 10 );
93
+	protected function _remove_filters() {
94
+		remove_filter('posts_fields', array($this, 'posts_fields'), 1);
95
+		remove_filter('posts_join', array($this, 'posts_join'), 1);
96
+		remove_filter('posts_where', array($this, 'posts_where'), 10);
97 97
 		// remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 );
98
-		remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1 );
99
-		remove_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1 );
98
+		remove_filter('posts_orderby', array($this, 'posts_orderby'), 1);
99
+		remove_filter('posts_groupby', array($this, 'posts_groupby'), 1);
100 100
 	}
101 101
 
102 102
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @param WP_Query $wp_query
110 110
 	 * @return    string
111 111
 	 */
112
-	public function posts_fields( $SQL, WP_Query $wp_query ) {
112
+	public function posts_fields($SQL, WP_Query $wp_query) {
113 113
 		if (
114 114
 			$wp_query instanceof WP_Query
115 115
 			&&
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 			)
121 121
 		) {
122 122
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
123
-			$SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ' ;
124
-			if ( $wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy ) {
123
+			$SQL .= ', '.EEM_Datetime::instance()->table().'.* ';
124
+			if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) {
125 125
 				// because we only want to retrieve the next upcoming datetime for each event:
126 126
 				// add something like ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date " to WP Query SELECT statement
127
-				$SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ;
127
+				$SQL .= ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date ';
128 128
 			}
129 129
 		}
130 130
 		return $SQL;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @internal  param \WP_Query $WP_Query
142 142
 	 * @return    string
143 143
 	 */
144
-	public function posts_join( $SQL, WP_Query $wp_query ) {
144
+	public function posts_join($SQL, WP_Query $wp_query) {
145 145
 		if (
146 146
 			$wp_query instanceof WP_Query
147 147
 			&&
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			)
153 153
 		) {
154 154
 			// adds something like " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
155
-			$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) ';
155
+			$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name().' ) ';
156 156
 		}
157 157
 		return $SQL;
158 158
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param WP_Query $wp_query
168 168
 	 * @return    string
169 169
 	 */
170
-	public function posts_where( $SQL, WP_Query $wp_query ) {
170
+	public function posts_where($SQL, WP_Query $wp_query) {
171 171
 //		global $wpdb;
172 172
 		if (
173 173
 			$wp_query instanceof WP_Query
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 				|| $wp_query->is_espresso_event_taxonomy
178 178
 			)
179 179
 		) {
180
-			if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive ) || ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) {
181
-				$SQL .=  ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', true ) . '" ';
180
+			if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive) || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) {
181
+				$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', true).'" ';
182 182
 			}
183 183
 		}
184 184
 		return $SQL;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @param 	WP_Query $wp_query
195 195
 	 * @return 	string
196 196
 	 */
197
-	public function posts_orderby( $SQL, WP_Query $wp_query ) {
197
+	public function posts_orderby($SQL, WP_Query $wp_query) {
198 198
 		if (
199 199
 			$wp_query instanceof WP_Query
200 200
 			&&
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @param WP_Query $wp_query
219 219
 	 * @return    string
220 220
 	 */
221
-	public function posts_groupby( $SQL, WP_Query $wp_query ) {
221
+	public function posts_groupby($SQL, WP_Query $wp_query) {
222 222
 		if (
223 223
 			$wp_query instanceof WP_Query
224 224
 			&&
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			// we're joining to the datetimes table, where there can be MANY datetimes for a single event, but we want to only show each event only once
232 232
 			// (whereas if we didn't group them by the post's ID, then we would end up with many repeats)
233 233
 			global $wpdb;
234
-			$SQL = $wpdb->posts . '.ID ';
234
+			$SQL = $wpdb->posts.'.ID ';
235 235
 		}
236 236
 		return $SQL;
237 237
 	}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @param WP_Query $wp_query
247 247
 	 * @return    array
248 248
 	 */
249
-	public function the_posts( $posts, WP_Query $wp_query ) {
249
+	public function the_posts($posts, WP_Query $wp_query) {
250 250
 		return $posts;
251 251
 	}
252 252
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @param      $single
263 263
 	 * @return    string
264 264
 	 */
265
-	public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) {
265
+	public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) {
266 266
 		return $meta_value;
267 267
 	}
268 268
 
Please login to merge, or discard this patch.
core/helpers/EEH_Array.helper.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
3 3
 
4
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
4
+require_once(EE_HELPERS.'EEH_Base.helper.php');
5 5
 
6 6
 /**
7 7
  * EE_Array
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param  array $array2 an array of objects
27 27
 	 * @return array         an array of objects found in array 1 that aren't found in array 2.
28 28
 	 */
29
-	public static function object_array_diff( $array1, $array2 ) {
30
-		return array_udiff( $array1, $array2, array('self', '_compare_objects' ));
29
+	public static function object_array_diff($array1, $array2) {
30
+		return array_udiff($array1, $array2, array('self', '_compare_objects'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 * @param array $array
37 37
 	 * @return boolean
38 38
 	 */
39
-	public static function is_associative_array( array $array ) {
40
-		return array_keys( $array ) !== range( 0, count( $array ) - 1 );
39
+	public static function is_associative_array(array $array) {
40
+		return array_keys($array) !== range(0, count($array) - 1);
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param array $arr
47 47
 	 * @return mixed what ever is in the array
48 48
 	 */
49
-	public static function get_one_item_from_array($arr){
49
+	public static function get_one_item_from_array($arr) {
50 50
 		$item = end($arr);
51 51
 		reset($arr);
52 52
 		return $item;
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 * @param mixed $arr
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function is_multi_dimensional_array($arr){
61
-		if(is_array($arr)){
60
+	public static function is_multi_dimensional_array($arr) {
61
+		if (is_array($arr)) {
62 62
 			$first_item = reset($arr);
63
-			if(is_array($first_item)){
64
-				return true;//yep, there's at least 2 levels to this array
65
-			}else{
66
-				return false;//nope, only 1 level
63
+			if (is_array($first_item)) {
64
+				return true; //yep, there's at least 2 levels to this array
65
+			} else {
66
+				return false; //nope, only 1 level
67 67
 			}
68
-		}else{
69
-			return false;//its not an array at all!
68
+		} else {
69
+			return false; //its not an array at all!
70 70
 		}
71 71
 	}
72 72
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param mixed $default
78 78
 	 * @return mixed
79 79
 	 */
80
-	public static function is_set( $arr, $index, $default ) {
81
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
80
+	public static function is_set($arr, $index, $default) {
81
+		return isset($arr[$index]) ? $arr[$index] : $default;
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	 * @param mixed $value usually a string, but could be an array or object
87 87
 	 * @return mixed the UN-serialized data
88 88
 	 */
89
-	public static function maybe_unserialize( $value ) {
89
+	public static function maybe_unserialize($value) {
90 90
 		$data = maybe_unserialize($value);
91 91
 		//it's possible that this still has serialized data if its the session.  WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically.
92 92
 		$token = 'C';
93 93
 		$data = is_string($data) ? trim($data) : $data;
94
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
94
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
95 95
 			return unserialize($data);
96 96
 		} else {
97 97
 			return $data;
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
111 111
 	 * @return array
112 112
 	 */
113
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
113
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
114 114
 		// ensure incoming arrays are actually arrays
115
-		$target_array 		= (array)$target_array;
116
-		$array_to_insert	= (array)$array_to_insert;
115
+		$target_array = (array) $target_array;
116
+		$array_to_insert = (array) $array_to_insert;
117 117
 		// if no offset key was supplied
118
-		if ( empty( $offset )) {
118
+		if (empty($offset)) {
119 119
 			// use start or end of $target_array based on whether we are adding before or not
120
-			$offset = $add_before ? 0 : count( $target_array );
120
+			$offset = $add_before ? 0 : count($target_array);
121 121
 		}
122 122
 		// if offset key is a string, then find the corresponding numeric location for that element
123
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
123
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
124 124
 		// add one to the offset if adding after
125 125
 		$offset = $add_before ? $offset : $offset + 1;
126 126
 		// but ensure offset does not exceed the length of the array
127
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
127
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
128 128
 		// reindex array ???
129
-		if ( $preserve_keys ) {
129
+		if ($preserve_keys) {
130 130
 			// take a slice of the target array from the beginning till the offset,
131 131
 			// then add the new data
132 132
 			// then add another slice that starts at the offset and goes till the end
133
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
133
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
134 134
 		} else {
135 135
 			// since we don't want to preserve keys, we can use array_splice
136
-			array_splice( $target_array, $offset, 0, $array_to_insert );
136
+			array_splice($target_array, $offset, 0, $array_to_insert);
137 137
 			return $target_array;
138 138
 		}
139 139
 	}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * @param array $array2
152 152
 	 * @return array
153 153
 	 */
154
-	public static function merge_arrays_and_overwrite_keys( array $array1, array $array2 ) {
155
-		foreach ( $array2 as $key => $value ) {
156
-			$array1[ $key ] = $value;
154
+	public static function merge_arrays_and_overwrite_keys(array $array1, array $array2) {
155
+		foreach ($array2 as $key => $value) {
156
+			$array1[$key] = $value;
157 157
 		}
158 158
 		return $array1;
159 159
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Autoloader.helper.php 1 patch
Spacing   +52 added lines, -52 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
 /**
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 * @return \EEH_Autoloader
51 51
 	 */
52 52
 	private function __construct() {
53
-		if ( self::$_autoloaders === null ) {
53
+		if (self::$_autoloaders === null) {
54 54
 			self::$_autoloaders = array();
55 55
 			$this->_register_custom_autoloaders();
56
-			spl_autoload_register( array( $this, 'espresso_autoloader' ) );
56
+			spl_autoload_register(array($this, 'espresso_autoloader'));
57 57
 		}
58 58
 	}
59 59
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public static function instance() {
67 67
 		// check if class object is instantiated
68
-		if ( ! self::$_instance instanceof EEH_Autoloader ) {
68
+		if ( ! self::$_instance instanceof EEH_Autoloader) {
69 69
 			self::$_instance = new self();
70 70
 		}
71 71
 		return self::$_instance;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @internal  param string $class_name - simple class name ie: session
83 83
 	 * @return 	void
84 84
 	 */
85
-	public static function espresso_autoloader( $class_name ) {
86
-		if ( isset( self::$_autoloaders[ $class_name ] ) ) {
87
-			require_once( self::$_autoloaders[ $class_name ] );
85
+	public static function espresso_autoloader($class_name) {
86
+		if (isset(self::$_autoloaders[$class_name])) {
87
+			require_once(self::$_autoloaders[$class_name]);
88 88
 		}
89 89
 	}
90 90
 
@@ -99,26 +99,26 @@  discard block
 block discarded – undo
99 99
 	 * @param bool           $debug **deprecated**
100 100
 	 * @throws \EE_Error
101 101
 	 */
102
-	public static function register_autoloader( $class_paths, $read_check = true, $debug = false ) {
103
-		$class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths );
104
-		foreach ( $class_paths as $class => $path ) {
102
+	public static function register_autoloader($class_paths, $read_check = true, $debug = false) {
103
+		$class_paths = is_array($class_paths) ? $class_paths : array($class_paths);
104
+		foreach ($class_paths as $class => $path) {
105 105
 			// don't give up! you gotta...
106 106
 			// get some class
107
-			if ( empty( $class )) {
108
-				throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path ));
107
+			if (empty($class)) {
108
+				throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path));
109 109
 			}
110 110
 			// one day you will find the path young grasshopper
111
-			if ( empty( $path )) {
112
-				throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class ));
111
+			if (empty($path)) {
112
+				throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class));
113 113
 			}
114 114
 			// is file readable ?
115
-			if ( $read_check && ! is_readable( $path )) {
116
-				throw new EE_Error ( sprintf( __( 'The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s','event_espresso' ), $class, $path ));
115
+			if ($read_check && ! is_readable($path)) {
116
+				throw new EE_Error(sprintf(__('The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), $class, $path));
117 117
 			}
118
-			if ( ! isset( self::$_autoloaders[ $class ] )) {
119
-				self::$_autoloaders[ $class ] = str_replace( array( '/', '\\' ), DS, $path );
120
-				if ( EE_DEBUG && ( EEH_Autoloader::$debug === 'paths' || EEH_Autoloader::$debug === 'all' || $debug ) ) {
121
-					EEH_Debug_Tools::printr( self::$_autoloaders[ $class ], $class, __FILE__, __LINE__ );
118
+			if ( ! isset(self::$_autoloaders[$class])) {
119
+				self::$_autoloaders[$class] = str_replace(array('/', '\\'), DS, $path);
120
+				if (EE_DEBUG && (EEH_Autoloader::$debug === 'paths' || EEH_Autoloader::$debug === 'all' || $debug)) {
121
+					EEH_Debug_Tools::printr(self::$_autoloaders[$class], $class, __FILE__, __LINE__);
122 122
 				}
123 123
 			}
124 124
 		}
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	private function _register_custom_autoloaders() {
150 150
 		EEH_Autoloader::$debug = '';
151 151
 		\EEH_Autoloader::register_helpers_autoloaders();
152
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'interfaces' );
153
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE );
154
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_INTERFACES, true );
155
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, true );
156
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES );
157
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, true );
158
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'messages' );
159
-		if ( EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' ) {
152
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces');
153
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE);
154
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_INTERFACES, true);
155
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, true);
156
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES);
157
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, true);
158
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'messages');
159
+		if (EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all') {
160 160
 			EEH_Debug_Tools::instance()->show_times();
161 161
 		}
162 162
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @access public
170 170
 	 */
171 171
 	public static function register_helpers_autoloaders() {
172
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS );
172
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS);
173 173
 	}
174 174
 
175 175
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * 	@return void
196 196
 	 */
197 197
 	public static function register_line_item_display_autoloaders() {
198
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_display' , true );
198
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', true);
199 199
 	}
200 200
 
201 201
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * 	@return void
209 209
 	 */
210 210
 	public static function register_line_item_filter_autoloaders() {
211
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(  EE_LIBRARIES . 'line_item_filters' , true );
211
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_filters', true);
212 212
 	}
213 213
 
214 214
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * 	@return void
222 222
 	 */
223 223
 	public static function register_template_part_autoloaders() {
224
-		EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'template_parts', true );
224
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'template_parts', true);
225 225
 	}
226 226
 
227 227
 
@@ -238,35 +238,35 @@  discard block
 block discarded – undo
238 238
 	 * @param bool   $debug  **deprecated**
239 239
 	 * @throws \EE_Error
240 240
 	 */
241
-	public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = false, $debug = false ){
242
-		if ( EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' || $debug ) {
243
-			EEH_Debug_Tools::instance()->start_timer( basename( $folder ) );
241
+	public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = false, $debug = false) {
242
+		if (EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' || $debug) {
243
+			EEH_Debug_Tools::instance()->start_timer(basename($folder));
244 244
 		}
245 245
 		// make sure last char is a /
246
-		$folder .= $folder[strlen($folder)-1] !== DS ? DS : '';
246
+		$folder .= $folder[strlen($folder) - 1] !== DS ? DS : '';
247 247
 		$class_to_filepath_map = array();
248
-		$exclude = array( 'index' );
248
+		$exclude = array('index');
249 249
 		//get all the files in that folder that end in php
250
-		$filepaths = glob( $folder.'*');
250
+		$filepaths = glob($folder.'*');
251 251
 
252
-		if ( empty( $filepaths ) ) {
252
+		if (empty($filepaths)) {
253 253
 			return;
254 254
 		}
255 255
 
256
-		foreach( $filepaths as $filepath ) {
257
-			if ( substr( $filepath, -4, 4 ) === '.php' ) {
258
-				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath );
259
-				if ( ! in_array( $class_name, $exclude )) {
260
-					$class_to_filepath_map [ $class_name ] = $filepath;
256
+		foreach ($filepaths as $filepath) {
257
+			if (substr($filepath, -4, 4) === '.php') {
258
+				$class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath);
259
+				if ( ! in_array($class_name, $exclude)) {
260
+					$class_to_filepath_map [$class_name] = $filepath;
261 261
 				}
262
-			} else if ( $recursive ) {
263
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive, $debug );
262
+			} else if ($recursive) {
263
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive, $debug);
264 264
 			}
265 265
 		}
266 266
 		// we remove the necessity to do a is_readable() check via the $read_check flag because glob by nature will not return non_readable files/directories.
267
-		self::register_autoloader( $class_to_filepath_map, false, $debug );
268
-		if ( EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all' ) {
269
-			EEH_Debug_Tools::instance()->stop_timer( basename( $folder ) );
267
+		self::register_autoloader($class_to_filepath_map, false, $debug);
268
+		if (EEH_Autoloader::$debug === 'times' || EEH_Autoloader::$debug === 'all') {
269
+			EEH_Debug_Tools::instance()->stop_timer(basename($folder));
270 270
 		}
271 271
 	}
272 272
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 * @param string $class_name - simple class name ie: EE_Session
281 281
 	 * @param string $alias - variation on class name ie: EE_session, session, etc
282 282
 	 */
283
-	public static function add_alias( $class_name, $alias ) {
284
-		if ( isset( self::$_autoloaders[ $class_name ] ) ) {
285
-			self::$_autoloaders[ $alias ] = self::$_autoloaders[ $class_name ];
283
+	public static function add_alias($class_name, $alias) {
284
+		if (isset(self::$_autoloaders[$class_name])) {
285
+			self::$_autoloaders[$alias] = self::$_autoloaders[$class_name];
286 286
 		}
287 287
 	}
288 288
 
Please login to merge, or discard this patch.
core/EE_Load_Espresso_Core.core.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -65,26 +65,26 @@  discard block
 block discarded – undo
65 65
 	 * @param 	EE_Response $response
66 66
 	 * @return 	EE_Response
67 67
 	 */
68
-	public function handle_request( EE_Request $request, EE_Response $response ) {
68
+	public function handle_request(EE_Request $request, EE_Response $response) {
69 69
 		$this->request = $request;
70 70
 		$this->response = $response;
71 71
 		// info about how to load classes required by other classes
72 72
 		$this->dependency_map = $this->_load_dependency_map();
73 73
 		// central repository for classes
74 74
 		$this->registry = $this->_load_registry();
75
-		do_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading' );
75
+		do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading');
76 76
 		// PSR4 Autoloaders
77
-		$this->registry->load_core( 'EE_Psr4AutoloaderInit' );
77
+		$this->registry->load_core('EE_Psr4AutoloaderInit');
78 78
 		// workarounds for PHP < 5.3
79 79
 		$this->_load_class_tools();
80 80
 		// load interfaces
81
-		espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' );
81
+		espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php');
82 82
 		// deprecated functions
83
-		espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' );
83
+		espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php');
84 84
 		// WP cron jobs
85
-		$this->registry->load_core( 'Cron_Tasks' );
86
-		$this->registry->load_core( 'EE_Request_Handler' );
87
-		$this->registry->load_core( 'EE_System' );
85
+		$this->registry->load_core('Cron_Tasks');
86
+		$this->registry->load_core('EE_Request_Handler');
87
+		$this->registry->load_core('EE_System');
88 88
 
89 89
 		return $this->response;
90 90
 	}
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @throws \EE_Error
115 115
 	 */
116 116
 	public function dependency_map() {
117
-		if ( ! $this->dependency_map instanceof EE_Dependency_Map ) {
117
+		if ( ! $this->dependency_map instanceof EE_Dependency_Map) {
118 118
 			throw new EE_Error(
119 119
 				sprintf(
120
-					__( 'Invalid EE_Dependency_Map: "%1$s"', 'event_espresso' ),
121
-					print_r( $this->dependency_map, true )
120
+					__('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'),
121
+					print_r($this->dependency_map, true)
122 122
 				)
123 123
 			);
124 124
 		}
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	 * @throws \EE_Error
133 133
 	 */
134 134
 	public function registry() {
135
-		if ( ! $this->registry instanceof EE_Registry ) {
135
+		if ( ! $this->registry instanceof EE_Registry) {
136 136
 			throw new EE_Error(
137 137
 				sprintf(
138
-					__( 'Invalid EE_Registry: "%1$s"', 'event_espresso' ),
139
-					print_r( $this->registry, true )
138
+					__('Invalid EE_Registry: "%1$s"', 'event_espresso'),
139
+					print_r($this->registry, true)
140 140
 				)
141 141
 			);
142 142
 		}
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 * 	@return EE_Dependency_Map
153 153
 	 */
154 154
 	private function _load_dependency_map() {
155
-		if ( ! is_readable( EE_CORE . 'EE_Dependency_Map.core.php' ) ) {
155
+		if ( ! is_readable(EE_CORE.'EE_Dependency_Map.core.php')) {
156 156
 			EE_Error::add_error(
157
-				__( 'The EE_Dependency_Map core class could not be loaded.', 'event_espresso' ),
157
+				__('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'),
158 158
 				__FILE__, __FUNCTION__, __LINE__
159 159
 			);
160
-			wp_die( EE_Error::get_notices() );
160
+			wp_die(EE_Error::get_notices());
161 161
 		}
162
-		require_once( EE_CORE . 'EE_Dependency_Map.core.php' );
163
-		return EE_Dependency_Map::instance( $this->request, $this->response );
162
+		require_once(EE_CORE.'EE_Dependency_Map.core.php');
163
+		return EE_Dependency_Map::instance($this->request, $this->response);
164 164
 	}
165 165
 
166 166
 
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
 	 * 	@return EE_Registry
173 173
 	 */
174 174
 	private function _load_registry() {
175
-		if ( ! is_readable( EE_CORE . 'EE_Registry.core.php' )) {
175
+		if ( ! is_readable(EE_CORE.'EE_Registry.core.php')) {
176 176
 			EE_Error::add_error(
177
-				__( 'The EE_Registry core class could not be loaded.', 'event_espresso' ),
177
+				__('The EE_Registry core class could not be loaded.', 'event_espresso'),
178 178
 				__FILE__, __FUNCTION__, __LINE__
179 179
 			);
180
-			wp_die( EE_Error::get_notices() );
180
+			wp_die(EE_Error::get_notices());
181 181
 		}
182
-		require_once( EE_CORE . 'EE_Registry.core.php' );
183
-		return EE_Registry::instance( $this->dependency_map );
182
+		require_once(EE_CORE.'EE_Registry.core.php');
183
+		return EE_Registry::instance($this->dependency_map);
184 184
 	}
185 185
 
186 186
 
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 	 * 	@return void
192 192
 	 */
193 193
 	private function _load_class_tools() {
194
-		if ( ! is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) {
194
+		if ( ! is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) {
195 195
 			EE_Error::add_error(
196
-				__( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ),
196
+				__('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'),
197 197
 				__FILE__, __FUNCTION__, __LINE__
198 198
 			);
199 199
 		}
200
-		require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' );
200
+		require_once(EE_HELPERS.'EEH_Class_Tools.helper.php');
201 201
 	}
202 202
 
203 203
 
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 	 * @param \EE_Request $request
212 212
 	 * @param \EE_Response $response
213 213
 	 */
214
-	public function handle_response( EE_Request $request, EE_Response $response ) {
214
+	public function handle_response(EE_Request $request, EE_Response $response) {
215 215
 		//\EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 );
216 216
 		//EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ );
217 217
 		//EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ );
218 218
 		//die();
219
-		if ( $response->plugin_deactivated() ) {
220
-			espresso_deactivate_plugin( EE_PLUGIN_BASENAME );
219
+		if ($response->plugin_deactivated()) {
220
+			espresso_deactivate_plugin(EE_PLUGIN_BASENAME);
221 221
 		}
222 222
 	}
223 223
 
Please login to merge, or discard this patch.
core/EE_Error.core.php 1 patch
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 		self::$_error_count++;
550 550
 	}
551 551
 
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
564 564
 	* 	@return 		void
565 565
 	*/
566
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
567
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
566
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
567
+		self::_add_notice('success', $msg, $file, $func, $line);
568 568
 	}
569 569
 
570 570
 
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
582 582
 	* 	@return 		void
583 583
 	*/
584
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
585
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
584
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
585
+		self::_add_notice('attention', $msg, $file, $func, $line);
586 586
 	}
587 587
 
588 588
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
601 601
 	* 	@return 		void
602 602
 	*/
603
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
604
-		if ( empty( $msg )) {
603
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
604
+		if (empty($msg)) {
605 605
 			EE_Error::doing_it_wrong(
606
-				'EE_Error::add_' . $type . '()',
606
+				'EE_Error::add_'.$type.'()',
607 607
 				sprintf(
608
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
608
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
609 609
 					$type,
610 610
 					$file,
611 611
 					$line
@@ -613,32 +613,32 @@  discard block
 block discarded – undo
613 613
 				EVENT_ESPRESSO_VERSION
614 614
 			);
615 615
 		}
616
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
616
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
617 617
 			EE_Error::doing_it_wrong(
618 618
 				'EE_Error::add_error()',
619
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
619
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
620 620
 				EVENT_ESPRESSO_VERSION
621 621
 			);
622 622
 		}
623 623
 		// get separate user and developer messages if they exist
624
-		$msg = explode( '||', $msg );
624
+		$msg = explode('||', $msg);
625 625
 		$user_msg = $msg[0];
626
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
626
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
627 627
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
628 628
 		// add notice if message exists
629
-		if ( ! empty( $msg )) {
629
+		if ( ! empty($msg)) {
630 630
 			// get error code
631
-			$notice_code = EE_Error::generate_error_code( $file, $func, $line );
632
-			if ( WP_DEBUG && $type == 'errors' ) {
633
-				$msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>';
631
+			$notice_code = EE_Error::generate_error_code($file, $func, $line);
632
+			if (WP_DEBUG && $type == 'errors') {
633
+				$msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>';
634 634
 			}
635 635
 			// add notice. Index by code if it's not blank
636
-			if( $notice_code ) {
637
-				self::$_espresso_notices[ $type ][ $notice_code ] = $msg;
636
+			if ($notice_code) {
637
+				self::$_espresso_notices[$type][$notice_code] = $msg;
638 638
 			} else {
639
-				self::$_espresso_notices[ $type ][] = $msg;
639
+				self::$_espresso_notices[$type][] = $msg;
640 640
 			}
641
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
641
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
642 642
 		}
643 643
 
644 644
 	}
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	*	@access private
693 693
 	*	@return void
694 694
 	*/
695
-	public static function reset_notices(){
695
+	public static function reset_notices() {
696 696
     	self::$_espresso_notices['success'] = FALSE;
697 697
     	self::$_espresso_notices['attention'] = FALSE;
698 698
     	self::$_espresso_notices['errors'] = FALSE;
@@ -705,14 +705,14 @@  discard block
 block discarded – undo
705 705
 	*	@access public
706 706
 	*	@return int
707 707
 	*/
708
-    public static function has_notices(){
708
+    public static function has_notices() {
709 709
 		$has_notices = 0;
710 710
 		// check for success messages
711
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
711
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
712 712
 		// check for attention messages
713
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
713
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
714 714
 		// check for error messages
715
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
715
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
716 716
 		return $has_notices;
717 717
 	}
718 718
 
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public static function get_vanilla_notices() {
729 729
 		return array(
730
-			'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(),
731
-			'attention' => isset( self::$_espresso_notices['attention'] )  ? self::$_espresso_notices['attention'] : array(),
732
-			'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(),
730
+			'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(),
731
+			'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(),
732
+			'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(),
733 733
 		);
734 734
 	}
735 735
 
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
746 746
 	* 	@return 		array
747 747
 	*/
748
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
749
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
748
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
749
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
750 750
 
751 751
 		$success_messages = '';
752 752
 		$attention_messages = '';
@@ -756,44 +756,44 @@  discard block
 block discarded – undo
756 756
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
757 757
 
758 758
 		// either save notices to the db
759
-		if ( $save_to_transient ) {
760
-			update_option( 'ee_notices', self::$_espresso_notices );
759
+		if ($save_to_transient) {
760
+			update_option('ee_notices', self::$_espresso_notices);
761 761
 			return;
762 762
 		}
763 763
 		// grab any notices that have been previously saved
764
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
765
-			foreach ( $notices as $type => $notice ) {
766
-				if ( is_array( $notice ) && ! empty( $notice )) {
764
+		if ($notices = get_option('ee_notices', FALSE)) {
765
+			foreach ($notices as $type => $notice) {
766
+				if (is_array($notice) && ! empty($notice)) {
767 767
 					// make sure that existsing notice type is an array
768
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
768
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
769 769
 					// merge stored notices with any newly created ones
770
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
770
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
771 771
 					$print_scripts = TRUE;
772 772
 				}
773 773
 			}
774 774
 			// now clear any stored notices
775
-			update_option( 'ee_notices', FALSE );
775
+			update_option('ee_notices', FALSE);
776 776
 		}
777 777
 
778 778
 		// check for success messages
779
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
779
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
780 780
 			// combine messages
781
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
781
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
782 782
 			$print_scripts = TRUE;
783 783
 		}
784 784
 
785 785
 		// check for attention messages
786
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
786
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
787 787
 			// combine messages
788
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
788
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
789 789
 			$print_scripts = TRUE;
790 790
 		}
791 791
 
792 792
 		// check for error messages
793
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
794
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
793
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
794
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
795 795
 			// combine messages
796
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
796
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
797 797
 			$print_scripts = TRUE;
798 798
 		}
799 799
 
@@ -807,21 +807,21 @@  discard block
 block discarded – undo
807 807
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
808 808
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
809 809
 				//showMessage( $success_messages );
810
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
810
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
811 811
 			}
812 812
 
813 813
 			if ($attention_messages != '') {
814 814
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
815 815
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
816 816
 				//showMessage( $error_messages, TRUE );
817
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
817
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
818 818
 			}
819 819
 
820 820
 			if ($error_messages != '') {
821 821
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
822 822
 				$css_class = is_admin() ? 'error' : 'error fade-away';
823 823
 				//showMessage( $error_messages, TRUE );
824
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
824
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
825 825
 			}
826 826
 
827 827
 			$notices .= '</div>';
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 					'errors' => $error_messages
835 835
 			);
836 836
 
837
-			if ( $remove_empty ) {
837
+			if ($remove_empty) {
838 838
 				// remove empty notices
839 839
 				foreach ($notices as $type => $notice) {
840 840
 					if (empty($notice)) {
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 			}
845 845
 		}
846 846
 
847
-		if ( $print_scripts ) {
847
+		if ($print_scripts) {
848 848
 			self::_print_scripts();
849 849
 		}
850 850
 
@@ -864,17 +864,17 @@  discard block
 block discarded – undo
864 864
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
865 865
 	* 	@return 		void
866 866
 	*/
867
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
868
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
869
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
867
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
868
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
869
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
870 870
 			//maybe initialize persistent_admin_notices
871
-			if ( empty( $persistent_admin_notices )) {
872
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
871
+			if (empty($persistent_admin_notices)) {
872
+				add_option('ee_pers_admin_notices', array(), '', 'no');
873 873
 			}
874
-			$pan_name = sanitize_key( $pan_name );
875
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
876
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
877
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
874
+			$pan_name = sanitize_key($pan_name);
875
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
876
+				$persistent_admin_notices[$pan_name] = $pan_message;
877
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
878 878
 			}
879 879
 		}
880 880
 	}
@@ -890,34 +890,34 @@  discard block
 block discarded – undo
890 890
 	 * @param bool          $return_immediately
891 891
 	 * @return        void
892 892
 	 */
893
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
894
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
895
-		if ( ! empty( $pan_name )) {
896
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
893
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
894
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
895
+		if ( ! empty($pan_name)) {
896
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
897 897
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
898
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
898
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
899 899
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
900
-				if ( $purge ) {
901
-					unset( $persistent_admin_notices[ $pan_name ] );
900
+				if ($purge) {
901
+					unset($persistent_admin_notices[$pan_name]);
902 902
 				} else {
903
-					$persistent_admin_notices[ $pan_name ] = NULL;
903
+					$persistent_admin_notices[$pan_name] = NULL;
904 904
 				}
905
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
906
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
905
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
906
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
907 907
 				}
908 908
 			}
909 909
 		}
910
-		if ( $return_immediately ) {
910
+		if ($return_immediately) {
911 911
 			return;
912
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
912
+		} else if (EE_Registry::instance()->REQ->ajax) {
913 913
 			// grab any notices and concatenate into string
914
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
914
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
915 915
 			exit();
916 916
 		} else {
917 917
 			// save errors to a transient to be displayed on next request (after redirect)
918
-			EE_Error::get_notices( FALSE, TRUE );
919
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
920
-			wp_safe_redirect( urldecode( $return_url ));
918
+			EE_Error::get_notices(FALSE, TRUE);
919
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
920
+			wp_safe_redirect(urldecode($return_url));
921 921
 		}
922 922
 	}
923 923
 
@@ -932,20 +932,20 @@  discard block
 block discarded – undo
932 932
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
933 933
 	 *  	@return 		string
934 934
 	 */
935
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
936
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
935
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
936
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
937 937
 			$args = array(
938 938
 				'nag_notice' => $pan_name,
939
-				'return_url' => urlencode( $return_url ),
939
+				'return_url' => urlencode($return_url),
940 940
 				'ajax_url' => WP_AJAX_URL,
941
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
941
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
942 942
 			);
943
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
943
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
944 944
 			return '
945
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
946
-				<p>' . $pan_message . '</p>
947
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
948
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
945
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
946
+				<p>' . $pan_message.'</p>
947
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
948
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
949 949
 				</a>
950 950
 				<div style="clear:both;"></div>
951 951
 			</div>';
@@ -961,24 +961,24 @@  discard block
 block discarded – undo
961 961
 	 * @param string $return_url
962 962
 	 * @return    array
963 963
 	 */
964
-	public static function get_persistent_admin_notices( $return_url = '' ) {
964
+	public static function get_persistent_admin_notices($return_url = '') {
965 965
 		$notices = '';
966 966
 		// check for persistent admin notices
967 967
 		//filter the list though so plugins can notify the admin in a different way if they want
968 968
 		$persistent_admin_notices = apply_filters( 
969 969
 			'FHEE__EE_Error__get_persistent_admin_notices',
970
-			get_option( 'ee_pers_admin_notices', FALSE ),
970
+			get_option('ee_pers_admin_notices', FALSE),
971 971
 			'ee_pers_admin_notices',
972 972
 			$return_url
973 973
 		);
974
-		if ( $persistent_admin_notices ) {
974
+		if ($persistent_admin_notices) {
975 975
 			// load scripts
976
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
977
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
978
-			wp_enqueue_script( 'ee_error_js' );
976
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
977
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
978
+			wp_enqueue_script('ee_error_js');
979 979
 			// and display notices
980
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
981
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
980
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
981
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
982 982
 			}
983 983
 		}
984 984
 		return $notices;
@@ -993,26 +993,26 @@  discard block
 block discarded – undo
993 993
 	 * @param 	bool $force_print
994 994
 	 * @return 	void
995 995
 	 */
996
-	private static function _print_scripts( $force_print = FALSE ) {
997
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
998
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
996
+	private static function _print_scripts($force_print = FALSE) {
997
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
998
+			if (wp_script_is('ee_error_js', 'enqueued')) {
999 999
 				return;
1000
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
1001
-				add_filter( 'FHEE_load_css', '__return_true' );
1002
-				add_filter( 'FHEE_load_js', '__return_true' );
1003
-				wp_enqueue_script( 'ee_error_js' );
1004
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
1000
+			} else if (wp_script_is('ee_error_js', 'registered')) {
1001
+				add_filter('FHEE_load_css', '__return_true');
1002
+				add_filter('FHEE_load_js', '__return_true');
1003
+				wp_enqueue_script('ee_error_js');
1004
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
1005 1005
 			}
1006 1006
 		} else {
1007 1007
 			return '
1008 1008
 <script>
1009 1009
 /* <![CDATA[ */
1010
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
1010
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
1011 1011
 /* ]]> */
1012 1012
 </script>
1013
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
1014
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
1015
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
1013
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
1014
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
1015
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
1016 1016
 ';
1017 1017
 
1018 1018
 		}
@@ -1046,11 +1046,11 @@  discard block
 block discarded – undo
1046 1046
 	*	@ param string $line
1047 1047
 	*	@ return string
1048 1048
 	*/
1049
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1050
-		$file = explode( '.', basename( $file ));
1051
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1052
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1053
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1049
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1050
+		$file = explode('.', basename($file));
1051
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1052
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1053
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1054 1054
 		return $error_code;
1055 1055
 	}
1056 1056
 
@@ -1066,36 +1066,36 @@  discard block
 block discarded – undo
1066 1066
 	*	@ param object $ex
1067 1067
 	*	@ return void
1068 1068
 	*/
1069
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1069
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1070 1070
 
1071
-		if ( ! $ex ) {
1071
+		if ( ! $ex) {
1072 1072
 			return;
1073 1073
 		}
1074 1074
 
1075
-		if ( ! $time ) {
1075
+		if ( ! $time) {
1076 1076
 			$time = time();
1077 1077
 		}
1078 1078
 
1079
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1080
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1081
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1082
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1083
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1084
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1085
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1086
-		$exception_log .= $ex['string'] . PHP_EOL;
1087
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1079
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1080
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1081
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1082
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1083
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1084
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1085
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1086
+		$exception_log .= $ex['string'].PHP_EOL;
1087
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1088 1088
 
1089 1089
 		try {
1090
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1091
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); 
1092
-			if ( ! $clear ) {
1090
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1091
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); 
1092
+			if ( ! $clear) {
1093 1093
 				//get existing log file and append new log info
1094
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1094
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1095 1095
 			}
1096
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1097
-		} catch( EE_Error $e ){
1098
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1096
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1097
+		} catch (EE_Error $e) {
1098
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1099 1099
 			return;
1100 1100
 		}
1101 1101
 
@@ -1119,9 +1119,9 @@  discard block
 block discarded – undo
1119 1119
 	 * @param int     $error_type
1120 1120
 	 * @return void
1121 1121
 	 */
1122
-	public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
1123
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1124
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type );
1122
+	public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
1123
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1124
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type);
1125 1125
 		}
1126 1126
 	}
1127 1127
 	
@@ -1153,13 +1153,13 @@  discard block
 block discarded – undo
1153 1153
  */
1154 1154
 function espresso_error_enqueue_scripts() {
1155 1155
 	// js for error handling
1156
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1157
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1156
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1157
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1158 1158
 }
1159
-if ( is_admin() ) {
1160
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1159
+if (is_admin()) {
1160
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1161 1161
 } else {
1162
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1162
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1163 1163
 }
1164 1164
 
1165 1165
 
Please login to merge, or discard this patch.