@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Country_Select_Input |
4 | 4 | * |
@@ -11,23 +11,23 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Country_Select_Input extends EE_Select_Input{ |
|
14 | +class EE_Country_Select_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $country_options |
18 | 18 | * @param array $input_settings |
19 | 19 | * @return EE_Country_Select_Input |
20 | 20 | */ |
21 | - public function __construct( $country_options = NULL, $input_settings = array() ){ |
|
21 | + public function __construct($country_options = NULL, $input_settings = array()) { |
|
22 | 22 | $country_options = apply_filters( |
23 | 23 | 'FHEE__EE_Country_Select_Input____construct__country_options', |
24 | - $this->get_country_answer_options( $country_options ), |
|
24 | + $this->get_country_answer_options($country_options), |
|
25 | 25 | $this |
26 | 26 | ); |
27 | - $input_settings['html_class'] = isset( $input_settings['html_class'] ) |
|
28 | - ? $input_settings['html_class'] . ' ee-country-select-js' |
|
27 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
28 | + ? $input_settings['html_class'].' ee-country-select-js' |
|
29 | 29 | : 'ee-country-select-js'; |
30 | - parent::__construct( $country_options, $input_settings ); |
|
30 | + parent::__construct($country_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @param array $country_options |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - public function get_country_answer_options( $country_options = NULL ){ |
|
41 | + public function get_country_answer_options($country_options = NULL) { |
|
42 | 42 | // if passed something that is NOT an array |
43 | - if ( ! is_array( $country_options )) { |
|
43 | + if ( ! is_array($country_options)) { |
|
44 | 44 | // get possibly cached list of countries |
45 | 45 | $countries = EEM_Country::instance()->get_all_active_countries(); |
46 | - if ( ! empty( $countries )) { |
|
47 | - $country_options[ '' ] = ''; |
|
48 | - foreach( $countries as $country ){ |
|
49 | - if ( $country instanceof EE_Country ) { |
|
50 | - $country_options[ $country->ID() ] = $country->name(); |
|
46 | + if ( ! empty($countries)) { |
|
47 | + $country_options[''] = ''; |
|
48 | + foreach ($countries as $country) { |
|
49 | + if ($country instanceof EE_Country) { |
|
50 | + $country_options[$country->ID()] = $country->name(); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } else { |
@@ -6,22 +6,22 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_State_Select_Input extends EE_Select_Input{ |
|
9 | +class EE_State_Select_Input extends EE_Select_Input { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $state_options |
13 | 13 | * @param array $input_settings |
14 | 14 | */ |
15 | - function __construct( $state_options, $input_settings = array() ){ |
|
15 | + function __construct($state_options, $input_settings = array()) { |
|
16 | 16 | $state_options = apply_filters( |
17 | 17 | 'FHEE__EE_State_Select_Input____construct__state_options', |
18 | - $this->get_state_answer_options( $state_options ), |
|
18 | + $this->get_state_answer_options($state_options), |
|
19 | 19 | $this |
20 | 20 | ); |
21 | - $input_settings['html_class'] = isset( $input_settings['html_class'] ) |
|
22 | - ? $input_settings['html_class'] . ' ee-state-select-js' |
|
21 | + $input_settings['html_class'] = isset($input_settings['html_class']) |
|
22 | + ? $input_settings['html_class'].' ee-state-select-js' |
|
23 | 23 | : 'ee-state-select-js'; |
24 | - parent::__construct( $state_options, $input_settings ); |
|
24 | + parent::__construct($state_options, $input_settings); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * @param array $state_options |
33 | 33 | * @return array |
34 | 34 | */ |
35 | - public function get_state_answer_options( $state_options = NULL ){ |
|
35 | + public function get_state_answer_options($state_options = NULL) { |
|
36 | 36 | // if passed something that is NOT an array |
37 | - if ( ! is_array( $state_options )) { |
|
37 | + if ( ! is_array($state_options)) { |
|
38 | 38 | // get possibly cached list of states |
39 | 39 | $states = EEM_State::instance()->get_all_active_states(); |
40 | - if ( ! empty( $states )) { |
|
40 | + if ( ! empty($states)) { |
|
41 | 41 | //set the default |
42 | 42 | $state_options[''][''] = ''; |
43 | - foreach( $states as $state ){ |
|
44 | - if ( $state instanceof EE_State ) { |
|
45 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
43 | + foreach ($states as $state) { |
|
44 | + if ($state instanceof EE_State) { |
|
45 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } else { |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class EE_Payment_Processor extends EE_Processor_Base { |
15 | 15 | /** |
16 | - * @var EE_Payment_Processor $_instance |
|
16 | + * @var EE_Payment_Processor $_instance |
|
17 | 17 | * @access private |
18 | - */ |
|
18 | + */ |
|
19 | 19 | private static $_instance; |
20 | 20 | |
21 | 21 | |
@@ -51,7 +51,6 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately. |
53 | 53 | * Saves the payment that is generated |
54 | - |
|
55 | 54 | * |
56 | 55 | *@param EE_Payment_Method $payment_method |
57 | 56 | * @param EE_Transaction $transaction |
@@ -131,7 +130,6 @@ discard block |
||
131 | 130 | |
132 | 131 | |
133 | 132 | /** |
134 | - |
|
135 | 133 | * @param EE_Transaction|int $transaction |
136 | 134 | * @param EE_Payment_Method $payment_method |
137 | 135 | * @throws EE_Error |
@@ -694,12 +692,12 @@ discard block |
||
694 | 692 | } |
695 | 693 | |
696 | 694 | /** |
697 | - * Force posts to PayPal to use TLS v1.2. See: |
|
698 | - * https://core.trac.wordpress.org/ticket/36320 |
|
699 | - * https://core.trac.wordpress.org/ticket/34924#comment:15 |
|
700 | - * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US |
|
695 | + * Force posts to PayPal to use TLS v1.2. See: |
|
696 | + * https://core.trac.wordpress.org/ticket/36320 |
|
697 | + * https://core.trac.wordpress.org/ticket/34924#comment:15 |
|
698 | + * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US |
|
701 | 699 | * This will affect paypal standard, pro, express, and payflow. |
702 | - */ |
|
700 | + */ |
|
703 | 701 | public static function _curl_requests_to_paypal_use_tls( $handle, $r, $url ) { |
704 | 702 | if ( strstr( $url, 'https://' ) && strstr( $url, '.paypal.com' ) ) { |
705 | 703 | //Use the value of the constant CURL_SSLVERSION_TLSv1 = 1 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EE_Payment_Processor |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function instance() { |
29 | 29 | // check if class object is instantiated |
30 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
30 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
31 | 31 | self::$_instance = new self(); |
32 | 32 | } |
33 | 33 | return self::$_instance; |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | *@access private |
42 | 42 | */ |
43 | 43 | private function __construct() { |
44 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
45 | - add_action( 'http_api_curl', array( $this, '_curl_requests_to_paypal_use_tls' ), 10, 3 ); |
|
44 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
45 | + add_action('http_api_curl', array($this, '_curl_requests_to_paypal_use_tls'), 10, 3); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $update_txn = true, |
82 | 82 | $cancel_url = '' |
83 | 83 | ) { |
84 | - if( (float)$amount < 0 ) { |
|
84 | + if ((float) $amount < 0) { |
|
85 | 85 | throw new EE_Error( |
86 | 86 | sprintf( |
87 | 87 | __( |
@@ -94,33 +94,33 @@ discard block |
||
94 | 94 | ); |
95 | 95 | } |
96 | 96 | // verify payment method |
97 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
97 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
98 | 98 | // verify transaction |
99 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
100 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
99 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
100 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
101 | 101 | // verify payment method type |
102 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
102 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
103 | 103 | $payment = $payment_method->type_obj()->process_payment( |
104 | 104 | $transaction, |
105 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
105 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
106 | 106 | $billing_form, |
107 | 107 | $return_url, |
108 | - add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ), |
|
108 | + add_query_arg(array('ee_cancel_payment' => true), $cancel_url), |
|
109 | 109 | $method, |
110 | 110 | $by_admin |
111 | 111 | ); |
112 | 112 | // check if payment method uses an off-site gateway |
113 | - if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) { |
|
113 | + if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) { |
|
114 | 114 | // don't process payments for off-site gateways yet because no payment has occurred yet |
115 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
115 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
116 | 116 | } |
117 | 117 | return $payment; |
118 | 118 | } else { |
119 | 119 | EE_Error::add_error( |
120 | 120 | sprintf( |
121 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
121 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
122 | 122 | '<br/>', |
123 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
123 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
124 | 124 | ), __FILE__, __FUNCTION__, __LINE__ |
125 | 125 | ); |
126 | 126 | return NULL; |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * @throws EE_Error |
137 | 137 | * @return string |
138 | 138 | */ |
139 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
139 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
140 | 140 | /** @type \EE_Transaction $transaction */ |
141 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
141 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
142 | 142 | $primary_reg = $transaction->primary_registration(); |
143 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
143 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
144 | 144 | throw new EE_Error( |
145 | 145 | sprintf( |
146 | 146 | __( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ) |
152 | 152 | ); |
153 | 153 | } |
154 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
154 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
155 | 155 | $url = add_query_arg( |
156 | 156 | array( |
157 | 157 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -188,92 +188,92 @@ discard block |
||
188 | 188 | $update_txn = true, |
189 | 189 | $separate_IPN_request = true |
190 | 190 | ) { |
191 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
192 | - $_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data ); |
|
193 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
191 | + EE_Registry::instance()->load_model('Change_Log'); |
|
192 | + $_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data); |
|
193 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
194 | 194 | $obj_for_log = null; |
195 | - if( $transaction instanceof EE_Transaction ){ |
|
195 | + if ($transaction instanceof EE_Transaction) { |
|
196 | 196 | $obj_for_log = $transaction; |
197 | - if( $payment_method instanceof EE_Payment_Method ) { |
|
197 | + if ($payment_method instanceof EE_Payment_Method) { |
|
198 | 198 | $obj_for_log = EEM_Payment::instance()->get_one( |
199 | 199 | array( |
200 | - array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), |
|
201 | - 'order_by' => array( 'PAY_timestamp' => 'desc' ) |
|
200 | + array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), |
|
201 | + 'order_by' => array('PAY_timestamp' => 'desc') |
|
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | } |
205 | - } else if( $payment_method instanceof EE_Payment ) { |
|
205 | + } else if ($payment_method instanceof EE_Payment) { |
|
206 | 206 | $obj_for_log = $payment_method; |
207 | 207 | } |
208 | 208 | $log = EEM_Change_Log::instance()->log( |
209 | 209 | EEM_Change_Log::type_gateway, |
210 | - array( 'IPN data received' => $_req_data ), |
|
210 | + array('IPN data received' => $_req_data), |
|
211 | 211 | $obj_for_log |
212 | 212 | ); |
213 | - try{ |
|
213 | + try { |
|
214 | 214 | /** |
215 | 215 | * @var EE_Payment $payment |
216 | 216 | */ |
217 | 217 | $payment = NULL; |
218 | - if($transaction && $payment_method){ |
|
218 | + if ($transaction && $payment_method) { |
|
219 | 219 | /** @type EE_Transaction $transaction */ |
220 | 220 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
221 | 221 | /** @type EE_Payment_Method $payment_method */ |
222 | 222 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
223 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
224 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
223 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
224 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
225 | 225 | $log->set_object($payment); |
226 | 226 | } else { |
227 | 227 | // not a payment |
228 | 228 | EE_Error::add_error( |
229 | 229 | sprintf( |
230 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
230 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
231 | 231 | '<br/>', |
232 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
232 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
233 | 233 | ), |
234 | 234 | __FILE__, __FUNCTION__, __LINE__ |
235 | 235 | ); |
236 | 236 | } |
237 | - }else{ |
|
237 | + } else { |
|
238 | 238 | //that's actually pretty ok. The IPN just wasn't able |
239 | 239 | //to identify which transaction or payment method this was for |
240 | 240 | // give all active payment methods a chance to claim it |
241 | 241 | $active_payment_methods = EEM_Payment_Method::instance()->get_all_active(); |
242 | - foreach( $active_payment_methods as $active_payment_method ){ |
|
243 | - try{ |
|
244 | - $payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
242 | + foreach ($active_payment_methods as $active_payment_method) { |
|
243 | + try { |
|
244 | + $payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
245 | 245 | $payment_method = $active_payment_method; |
246 | 246 | EEM_Change_Log::instance()->log( |
247 | 247 | EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment |
248 | 248 | ); |
249 | 249 | break; |
250 | - } catch( EE_Error $e ) { |
|
250 | + } catch (EE_Error $e) { |
|
251 | 251 | //that's fine- it apparently couldn't handle the IPN |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | } |
256 | 256 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
257 | - if( $payment instanceof EE_Payment){ |
|
257 | + if ($payment instanceof EE_Payment) { |
|
258 | 258 | $payment->save(); |
259 | 259 | // update the TXN |
260 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
261 | - }else{ |
|
260 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
261 | + } else { |
|
262 | 262 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
263 | - if($payment_method){ |
|
263 | + if ($payment_method) { |
|
264 | 264 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
265 | - }elseif($transaction){ |
|
265 | + }elseif ($transaction) { |
|
266 | 266 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
267 | 267 | } |
268 | 268 | } |
269 | 269 | return $payment; |
270 | 270 | |
271 | - } catch( EE_Error $e ) { |
|
271 | + } catch (EE_Error $e) { |
|
272 | 272 | do_action( |
273 | 273 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
274 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
275 | - print_r( $transaction, TRUE ), |
|
276 | - print_r( $_req_data, TRUE ), |
|
274 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
275 | + print_r($transaction, TRUE), |
|
276 | + print_r($_req_data, TRUE), |
|
277 | 277 | $e->getMessage() |
278 | 278 | ) |
279 | 279 | ); |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | * @param array $request_data |
289 | 289 | * @return array |
290 | 290 | */ |
291 | - protected function _remove_unusable_characters_from_array( array $request_data ) { |
|
291 | + protected function _remove_unusable_characters_from_array(array $request_data) { |
|
292 | 292 | $return_data = array(); |
293 | - foreach( $request_data as $key => $value ) { |
|
294 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
293 | + foreach ($request_data as $key => $value) { |
|
294 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
295 | 295 | } |
296 | 296 | return $return_data; |
297 | 297 | } |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | * @param string $request_data |
304 | 304 | * @return string |
305 | 305 | */ |
306 | - protected function _remove_unusable_characters( $request_data ) { |
|
307 | - return preg_replace( '/[^[:print:]]/', '', $request_data ); |
|
306 | + protected function _remove_unusable_characters($request_data) { |
|
307 | + return preg_replace('/[^[:print:]]/', '', $request_data); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, |
327 | 327 | * to call handle_ipn() for offsite gateways that don't receive separate IPNs |
328 | 328 | */ |
329 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
329 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
330 | 330 | /** @var $transaction EE_Transaction */ |
331 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
331 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
332 | 332 | $last_payment_method = $transaction->payment_method(); |
333 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
334 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
335 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
333 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
334 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
335 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
336 | 336 | return $payment; |
337 | 337 | } else { |
338 | 338 | return NULL; |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | EE_Payment $payment_to_refund, |
356 | 356 | $refund_info = array() |
357 | 357 | ) { |
358 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
359 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
360 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
358 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
359 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
360 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
361 | 361 | } |
362 | 362 | return $payment_to_refund; |
363 | 363 | } |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | * TXN is locked before updating |
399 | 399 | * @throws \EE_Error |
400 | 400 | */ |
401 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
401 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
402 | 402 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
403 | 403 | /** @type EE_Transaction $transaction */ |
404 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
404 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
405 | 405 | // can we freely update the TXN at this moment? |
406 | - if ( $IPN && $transaction->is_locked() ) { |
|
406 | + if ($IPN && $transaction->is_locked()) { |
|
407 | 407 | // don't update the transaction at this exact moment |
408 | 408 | // because the TXN is active in another request |
409 | 409 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -413,38 +413,38 @@ discard block |
||
413 | 413 | ); |
414 | 414 | } else { |
415 | 415 | // verify payment and that it has been saved |
416 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
417 | - if( |
|
416 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
417 | + if ( |
|
418 | 418 | $payment->payment_method() instanceof EE_Payment_Method |
419 | 419 | && $payment->payment_method()->type_obj() instanceof EE_PMT_Base |
420 | - ){ |
|
421 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
420 | + ) { |
|
421 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
422 | 422 | // update TXN registrations with payment info |
423 | - $this->process_registration_payments( $transaction, $payment ); |
|
423 | + $this->process_registration_payments($transaction, $payment); |
|
424 | 424 | } |
425 | 425 | $do_action = $payment->just_approved() |
426 | 426 | ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' |
427 | 427 | : $do_action; |
428 | 428 | } else { |
429 | 429 | // send out notifications |
430 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
430 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
431 | 431 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
432 | 432 | } |
433 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
433 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
434 | 434 | /** @type EE_Transaction_Payments $transaction_payments */ |
435 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
435 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
436 | 436 | // set new value for total paid |
437 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
437 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
438 | 438 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
439 | - if ( $update_txn ) { |
|
440 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
439 | + if ($update_txn) { |
|
440 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | // granular hook for others to use. |
444 | - do_action( $do_action, $transaction, $payment ); |
|
445 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
444 | + do_action($do_action, $transaction, $payment); |
|
445 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
446 | 446 | //global hook for others to use. |
447 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
447 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
@@ -464,25 +464,25 @@ discard block |
||
464 | 464 | $registrations = array() |
465 | 465 | ) { |
466 | 466 | // only process if payment was successful |
467 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
467 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
468 | 468 | return; |
469 | 469 | } |
470 | 470 | //EEM_Registration::instance()->show_next_x_db_queries(); |
471 | - if ( empty( $registrations )) { |
|
471 | + if (empty($registrations)) { |
|
472 | 472 | // find registrations with monies owing that can receive a payment |
473 | 473 | $registrations = $transaction->registrations( |
474 | 474 | array( |
475 | 475 | array( |
476 | 476 | // only these reg statuses can receive payments |
477 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
478 | - 'REG_final_price' => array( '!=', 0 ), |
|
479 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
477 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
478 | + 'REG_final_price' => array('!=', 0), |
|
479 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
480 | 480 | ) |
481 | 481 | ) |
482 | 482 | ); |
483 | 483 | } |
484 | 484 | // still nothing ??!?? |
485 | - if ( empty( $registrations )) { |
|
485 | + if (empty($registrations)) { |
|
486 | 486 | return; |
487 | 487 | } |
488 | 488 | // todo: break out the following logic into a separate strategy class |
@@ -494,28 +494,28 @@ discard block |
||
494 | 494 | |
495 | 495 | $refund = $payment->is_a_refund(); |
496 | 496 | // how much is available to apply to registrations? |
497 | - $available_payment_amount = abs( $payment->amount() ); |
|
498 | - foreach ( $registrations as $registration ) { |
|
499 | - if ( $registration instanceof EE_Registration ) { |
|
497 | + $available_payment_amount = abs($payment->amount()); |
|
498 | + foreach ($registrations as $registration) { |
|
499 | + if ($registration instanceof EE_Registration) { |
|
500 | 500 | // nothing left? |
501 | - if ( $available_payment_amount <= 0 ) { |
|
501 | + if ($available_payment_amount <= 0) { |
|
502 | 502 | break; |
503 | 503 | } |
504 | - if ( $refund ) { |
|
505 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
504 | + if ($refund) { |
|
505 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
506 | 506 | } else { |
507 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
507 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | } |
511 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
511 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
512 | 512 | EE_Error::add_attention( |
513 | 513 | sprintf( |
514 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
515 | - EEH_Template::format_currency( $available_payment_amount ), |
|
516 | - implode( ', ', array_keys( $registrations ) ), |
|
514 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
515 | + EEH_Template::format_currency($available_payment_amount), |
|
516 | + implode(', ', array_keys($registrations)), |
|
517 | 517 | '<br/>', |
518 | - EEH_Template::format_currency( $payment->amount() ) |
|
518 | + EEH_Template::format_currency($payment->amount()) |
|
519 | 519 | ), |
520 | 520 | __FILE__, __FUNCTION__, __LINE__ |
521 | 521 | ); |
@@ -533,17 +533,17 @@ discard block |
||
533 | 533 | * @return float |
534 | 534 | * @throws \EE_Error |
535 | 535 | */ |
536 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
536 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
537 | 537 | $owing = $registration->final_price() - $registration->paid(); |
538 | - if ( $owing > 0 ) { |
|
538 | + if ($owing > 0) { |
|
539 | 539 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
540 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
540 | + $payment_amount = min($available_payment_amount, $owing); |
|
541 | 541 | // update $available_payment_amount |
542 | 542 | $available_payment_amount -= $payment_amount; |
543 | 543 | //calculate and set new REG_paid |
544 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
544 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
545 | 545 | // now save it |
546 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
546 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
547 | 547 | } |
548 | 548 | return $available_payment_amount; |
549 | 549 | } |
@@ -559,19 +559,19 @@ discard block |
||
559 | 559 | * @return void |
560 | 560 | * @throws \EE_Error |
561 | 561 | */ |
562 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
562 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
563 | 563 | // find any existing reg payment records for this registration and payment |
564 | 564 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
565 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
565 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
566 | 566 | ); |
567 | 567 | // if existing registration payment exists |
568 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
568 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
569 | 569 | // then update that record |
570 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
570 | + $existing_reg_payment->set_amount($payment_amount); |
|
571 | 571 | $existing_reg_payment->save(); |
572 | 572 | } else { |
573 | 573 | // or add new relation between registration and payment and set amount |
574 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
574 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
575 | 575 | // make it stick |
576 | 576 | $registration->save(); |
577 | 577 | } |
@@ -588,21 +588,21 @@ discard block |
||
588 | 588 | * @return float |
589 | 589 | * @throws \EE_Error |
590 | 590 | */ |
591 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
591 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
592 | 592 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
593 | - if ( $registration->paid() > 0 ) { |
|
593 | + if ($registration->paid() > 0) { |
|
594 | 594 | // ensure $available_refund_amount is NOT negative |
595 | - $available_refund_amount = (float)abs( $available_refund_amount ); |
|
595 | + $available_refund_amount = (float) abs($available_refund_amount); |
|
596 | 596 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
597 | - $refund_amount = min( $available_refund_amount, (float)$registration->paid() ); |
|
597 | + $refund_amount = min($available_refund_amount, (float) $registration->paid()); |
|
598 | 598 | // update $available_payment_amount |
599 | 599 | $available_refund_amount -= $refund_amount; |
600 | 600 | //calculate and set new REG_paid |
601 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
601 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
602 | 602 | // convert payment amount back to a negative value for storage in the db |
603 | - $refund_amount = (float)abs( $refund_amount ) * -1; |
|
603 | + $refund_amount = (float) abs($refund_amount) * -1; |
|
604 | 604 | // now save it |
605 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
605 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
606 | 606 | } |
607 | 607 | return $available_refund_amount; |
608 | 608 | } |
@@ -621,53 +621,53 @@ discard block |
||
621 | 621 | * @param bool $IPN |
622 | 622 | * @throws \EE_Error |
623 | 623 | */ |
624 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
624 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
625 | 625 | |
626 | 626 | /** @type EE_Transaction_Processor $transaction_processor */ |
627 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
627 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
628 | 628 | // is the Payment Options Reg Step completed ? |
629 | - $payment_options_step_completed = $transaction->reg_step_completed( 'payment_options' ); |
|
629 | + $payment_options_step_completed = $transaction->reg_step_completed('payment_options'); |
|
630 | 630 | // if the Payment Options Reg Step is completed... |
631 | 631 | $revisit = $payment_options_step_completed === true ? true : false; |
632 | 632 | // then this is kinda sorta a revisit with regards to payments at least |
633 | - $transaction_processor->set_revisit( $revisit ); |
|
633 | + $transaction_processor->set_revisit($revisit); |
|
634 | 634 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
635 | 635 | if ( |
636 | 636 | $IPN && |
637 | 637 | $payment_options_step_completed !== true && |
638 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
638 | + ($payment->is_approved() || $payment->is_pending()) |
|
639 | 639 | ) { |
640 | 640 | $payment_options_step_completed = $transaction->set_reg_step_completed( |
641 | 641 | 'payment_options' |
642 | 642 | ); |
643 | 643 | } |
644 | 644 | // maybe update status, but don't save transaction just yet |
645 | - $transaction->update_status_based_on_total_paid( false ); |
|
645 | + $transaction->update_status_based_on_total_paid(false); |
|
646 | 646 | // check if 'finalize_registration' step has been completed... |
647 | - $finalized = $transaction->reg_step_completed( 'finalize_registration' ); |
|
647 | + $finalized = $transaction->reg_step_completed('finalize_registration'); |
|
648 | 648 | // if this is an IPN and the final step has not been initiated |
649 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
649 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
650 | 650 | // and if it hasn't already been set as being started... |
651 | - $finalized = $transaction->set_reg_step_initiated( 'finalize_registration' ); |
|
651 | + $finalized = $transaction->set_reg_step_initiated('finalize_registration'); |
|
652 | 652 | } |
653 | 653 | $transaction->save(); |
654 | 654 | // because the above will return false if the final step was not fully completed, we need to check again... |
655 | - if ( $IPN && $finalized !== false ) { |
|
655 | + if ($IPN && $finalized !== false) { |
|
656 | 656 | // and if we are all good to go, then send out notifications |
657 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
657 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
658 | 658 | //ok, now process the transaction according to the payment |
659 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
659 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
660 | 660 | } |
661 | 661 | // DEBUG LOG |
662 | 662 | $payment_method = $payment->payment_method(); |
663 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
663 | + if ($payment_method instanceof EE_Payment_Method) { |
|
664 | 664 | $payment_method_type_obj = $payment_method->type_obj(); |
665 | - if ( $payment_method_type_obj instanceof EE_PMT_Base ) { |
|
665 | + if ($payment_method_type_obj instanceof EE_PMT_Base) { |
|
666 | 666 | $gateway = $payment_method_type_obj->get_gateway(); |
667 | - if ( $gateway instanceof EE_Gateway ){ |
|
667 | + if ($gateway instanceof EE_Gateway) { |
|
668 | 668 | $gateway->log( |
669 | 669 | array( |
670 | - 'message' => __( 'Post Payment Transaction Details', 'event_espresso' ), |
|
670 | + 'message' => __('Post Payment Transaction Details', 'event_espresso'), |
|
671 | 671 | 'transaction' => $transaction->model_field_array(), |
672 | 672 | 'finalized' => $finalized, |
673 | 673 | 'IPN' => $IPN, |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US |
690 | 690 | * This will affect paypal standard, pro, express, and payflow. |
691 | 691 | */ |
692 | - public static function _curl_requests_to_paypal_use_tls( $handle, $r, $url ) { |
|
693 | - if ( strstr( $url, 'https://' ) && strstr( $url, '.paypal.com' ) ) { |
|
692 | + public static function _curl_requests_to_paypal_use_tls($handle, $r, $url) { |
|
693 | + if (strstr($url, 'https://') && strstr($url, '.paypal.com')) { |
|
694 | 694 | //Use the value of the constant CURL_SSLVERSION_TLSv1 = 1 |
695 | 695 | //instead of the constant because it might not be defined |
696 | - curl_setopt( $handle, CURLOPT_SSLVERSION, 1 ); |
|
696 | + curl_setopt($handle, CURLOPT_SSLVERSION, 1); |
|
697 | 697 | } |
698 | 698 | } |
699 | 699 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | //does question have any answers? cause if it does then we have to disable type |
16 | 16 | $has_answers = $question->has_answers(); |
17 | 17 | |
18 | -if ( $QST_system === 'country' ) { |
|
18 | +if ($QST_system === 'country') { |
|
19 | 19 | echo EEH_HTML::div( |
20 | - EEH_HTML::h4( '<span class="dashicons dashicons-info"></span>' . esc_html__( 'Did you know...', 'event_espresso' ) ) . |
|
20 | + EEH_HTML::h4('<span class="dashicons dashicons-info"></span>'.esc_html__('Did you know...', 'event_espresso')). |
|
21 | 21 | EEH_HTML::p( |
22 | 22 | esc_html__( |
23 | 23 | 'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <tbody> |
35 | 35 | <tr> |
36 | 36 | <th> |
37 | - <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?> |
|
37 | + <label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?> |
|
38 | 38 | </th> |
39 | 39 | <td> |
40 | 40 | <input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/> |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | |
45 | 45 | <tr> |
46 | 46 | <th> |
47 | - <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?> |
|
47 | + <label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?> |
|
48 | 48 | </th> |
49 | 49 | <td> |
50 | 50 | <?php |
51 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
52 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
51 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
52 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
53 | 53 | ?> |
54 | 54 | <input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/> |
55 | 55 | <input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" /> |
56 | - <?php if ( ! empty( $QST_system )) { ?> |
|
56 | + <?php if ( ! empty($QST_system)) { ?> |
|
57 | 57 | <input type="hidden" id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/> |
58 | 58 | <?php } ?> |
59 | 59 | <br/> |
60 | 60 | <p class="description"> |
61 | - <?php if ( ! empty( $QST_system )) { ?> |
|
61 | + <?php if ( ! empty($QST_system)) { ?> |
|
62 | 62 | <span class="description" style="color:#D54E21;"> |
63 | - <?php esc_html_e('System question! This field cannot be changed.','event_espresso')?> |
|
63 | + <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?> |
|
64 | 64 | </span> |
65 | 65 | <?php } ?> |
66 | 66 | |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | |
71 | 71 | <tr> |
72 | 72 | <th> |
73 | - <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?> |
|
73 | + <label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?> |
|
74 | 74 | </th> |
75 | 75 | <td> |
76 | 76 | <?php |
77 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
78 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
77 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
78 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
79 | 79 | $admin_only = $question->get('QST_admin_only'); |
80 | - $checked = !empty( $admin_only ) ? ' checked="checked"' : ''; |
|
80 | + $checked = ! empty($admin_only) ? ' checked="checked"' : ''; |
|
81 | 81 | ?> |
82 | 82 | <input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/> |
83 | 83 | <br/> |
84 | 84 | <p class="description"> |
85 | - <?php if ( ! empty( $QST_system )) { ?> |
|
85 | + <?php if ( ! empty($QST_system)) { ?> |
|
86 | 86 | <span class="description" style="color:#D54E21;"> |
87 | - <?php esc_html_e('System question! This field cannot be changed.','event_espresso')?> |
|
87 | + <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?> |
|
88 | 88 | </span> |
89 | 89 | <?php } ?> |
90 | 90 | |
@@ -94,21 +94,21 @@ discard block |
||
94 | 94 | |
95 | 95 | <tr> |
96 | 96 | <th> |
97 | - <label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?> |
|
97 | + <label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?> |
|
98 | 98 | </th> |
99 | 99 | <td> |
100 | 100 | <?php |
101 | - $disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : ''; |
|
102 | - $id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
103 | - echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled ); |
|
104 | - if( ! empty( $QST_system ) ) { ?> |
|
101 | + $disabled = ! empty($QST_system) ? ' disabled="disabled"' : ''; |
|
102 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
103 | + echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled); |
|
104 | + if ( ! empty($QST_system)) { ?> |
|
105 | 105 | <input type="hidden" id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/> |
106 | 106 | <?php |
107 | - $explanatory_text = esc_html__('System question! This field cannot be changed.','event_espresso'); |
|
108 | - }else{ |
|
109 | - $explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso'); |
|
107 | + $explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso'); |
|
108 | + } else { |
|
109 | + $explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso'); |
|
110 | 110 | } |
111 | - if ( ! empty( $QST_system ) || $has_answers ) { ?> |
|
111 | + if ( ! empty($QST_system) || $has_answers) { ?> |
|
112 | 112 | <p><span class="description" style="color:#D54E21;"> |
113 | 113 | <?php echo $explanatory_text; ?> |
114 | 114 | </span></p> |
@@ -121,22 +121,22 @@ discard block |
||
121 | 121 | <tr id="text_input_question_options"> |
122 | 122 | <th> |
123 | 123 | <label> |
124 | - <?php esc_html_e( 'Maximum Allowed Response Size', 'event_espresso' );?> |
|
124 | + <?php esc_html_e('Maximum Allowed Response Size', 'event_espresso'); ?> |
|
125 | 125 | </label> |
126 | 126 | </th> |
127 | 127 | <td> |
128 | - <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1"> |
|
128 | + <input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1"> |
|
129 | 129 | <p> |
130 | 130 | <span class="description"> |
131 | - <?php esc_html_e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?> |
|
131 | + <?php esc_html_e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?> |
|
132 | 132 | </span> |
133 | 133 | </p> |
134 | - <?php if ( $QST_system ) { ?> |
|
134 | + <?php if ($QST_system) { ?> |
|
135 | 135 | <p> |
136 | 136 | <span class="description" style="color:#D54E21;"> |
137 | 137 | <?php printf( |
138 | - esc_html__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ), |
|
139 | - $max_max );?> |
|
138 | + esc_html__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'), |
|
139 | + $max_max ); ?> |
|
140 | 140 | </span> |
141 | 141 | </p> |
142 | 142 | <?php } ?> |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | <tr id="question_options"> |
146 | 146 | <th> |
147 | 147 | <label> |
148 | - <?php esc_html_e('Answer Options','event_espresso')?> |
|
148 | + <?php esc_html_e('Answer Options', 'event_espresso')?> |
|
149 | 149 | </label> |
150 | 150 | </th> |
151 | 151 | <td> |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | <thead> |
155 | 155 | <tr> |
156 | 156 | <th class="option-value-header"> |
157 | - <?php esc_html_e('Value','event_espresso')?> |
|
157 | + <?php esc_html_e('Value', 'event_espresso')?> |
|
158 | 158 | </th> |
159 | 159 | <th class="option-desc-header"> |
160 | - <?php esc_html_e('Description (optional, only shown on registration form)','event_espresso')?> |
|
160 | + <?php esc_html_e('Description (optional, only shown on registration form)', 'event_espresso')?> |
|
161 | 161 | </th> |
162 | 162 | <th> |
163 | 163 | </th> |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | </tr> |
181 | 181 | |
182 | 182 | <?php |
183 | - $count=0; |
|
183 | + $count = 0; |
|
184 | 184 | $question_options = $question->options(); |
185 | - if ( ! empty( $question_options )) { |
|
186 | - foreach( $question_options as $option_id => $option ) { |
|
187 | - $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
185 | + if ( ! empty($question_options)) { |
|
186 | + foreach ($question_options as $option_id => $option) { |
|
187 | + $disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : ''; |
|
188 | 188 | ?> |
189 | 189 | <tr class="question-option ee-options-sortable"> |
190 | 190 | <td class="option-value-cell"> |
191 | 191 | <input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>"> |
192 | 192 | <input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php $option->f('QSO_value')?>"<?php echo $disabled; ?>> |
193 | - <?php if ( $has_answers ) : ?> |
|
193 | + <?php if ($has_answers) : ?> |
|
194 | 194 | <input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" > |
195 | 195 | <?php endif; ?> |
196 | 196 | </td> |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | <input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>"> |
199 | 199 | </td> |
200 | 200 | <td> |
201 | - <?php if ( ! $option->system() ) { ?> |
|
201 | + <?php if ( ! $option->system()) { ?> |
|
202 | 202 | <span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span> |
203 | 203 | <?php } ?> |
204 | 204 | <span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span> |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | </table> |
238 | 238 | |
239 | 239 | <a id="new-question-option" class="button" style="margin:0 0 1em 3px;"> |
240 | - <?php esc_html_e('Add Another Answer Option','event_espresso')?> |
|
240 | + <?php esc_html_e('Add Another Answer Option', 'event_espresso')?> |
|
241 | 241 | </a><br/> |
242 | 242 | |
243 | 243 | <p class="description"> |
244 | - <?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?> |
|
244 | + <?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?> |
|
245 | 245 | </p> |
246 | - <?php if ( $has_answers ) : ?> |
|
246 | + <?php if ($has_answers) : ?> |
|
247 | 247 | <p class="description" style="color:#D54E21;"> |
248 | 248 | <?php esc_html_e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question. If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes. This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?> |
249 | 249 | </p> |
@@ -254,32 +254,32 @@ discard block |
||
254 | 254 | |
255 | 255 | <tr> |
256 | 256 | <th> |
257 | - <label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?> |
|
257 | + <label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?> |
|
258 | 258 | </th> |
259 | 259 | <td> |
260 | 260 | <?php |
261 | - $system_required = array( 'fname', 'email' ); |
|
262 | - $disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : ''; |
|
261 | + $system_required = array('fname', 'email'); |
|
262 | + $disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
263 | 263 | $required_on = $question->get('QST_admin_only'); |
264 | 264 | $show_required_msg = $required_on ? '' : ' display:none;'; |
265 | - $disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : ''; |
|
266 | - $id = ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : ''; |
|
267 | - $requiredOptions=array( |
|
268 | - array( 'text'=> esc_html__( 'Optional', 'event_espresso' ), 'id'=>0 ), |
|
269 | - array( 'text'=> esc_html__( 'Required', 'event_espresso' ), 'id'=>1 ) |
|
265 | + $disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : ''; |
|
266 | + $id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
267 | + $requiredOptions = array( |
|
268 | + array('text'=> esc_html__('Optional', 'event_espresso'), 'id'=>0), |
|
269 | + array('text'=> esc_html__('Required', 'event_espresso'), 'id'=>1) |
|
270 | 270 | ); |
271 | - echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled ); |
|
271 | + echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled); |
|
272 | 272 | ?> |
273 | 273 | <p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>"> |
274 | - <?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?> |
|
274 | + <?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?> |
|
275 | 275 | </span></p> |
276 | 276 | <p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
277 | - <?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?> |
|
277 | + <?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?> |
|
278 | 278 | </span></p> |
279 | - <?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?> |
|
279 | + <?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?> |
|
280 | 280 | <input type="hidden" id="QST_required" name="QST_required" value="1"/> |
281 | 281 | <p><span class="description" style="color:#D54E21;"> |
282 | - <?php esc_html_e('System question! This field cannot be changed.','event_espresso')?> |
|
282 | + <?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?> |
|
283 | 283 | </span></p> |
284 | 284 | <?php } ?> |
285 | 285 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | <tr> |
290 | 290 | <th> |
291 | - <label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?> |
|
291 | + <label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?> |
|
292 | 292 | </th> |
293 | 293 | <td> |
294 | 294 | <input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php $question->f('QST_required_text')?>"/> |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | * @return float total taxes to apply to ticket. |
39 | 39 | * @throws \EE_Error |
40 | 40 | */ |
41 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
41 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
42 | 42 | $tax = 0; |
43 | 43 | $total_tax = 0; |
44 | 44 | //This first checks to see if the given ticket is taxable. |
45 | - if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
45 | + if ( ! $ticket->get('TKT_taxable')) { |
|
46 | 46 | return $tax; |
47 | 47 | } |
48 | 48 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
49 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
49 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
50 | 50 | //get taxes |
51 | 51 | $taxes = self::get_taxes_for_admin(); |
52 | 52 | //apply taxes to subtotal |
53 | - foreach ( $taxes as $tax ) { |
|
53 | + foreach ($taxes as $tax) { |
|
54 | 54 | //assuming taxes are not cumulative |
55 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
55 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
56 | 56 | } |
57 | 57 | return $total_tax; |
58 | 58 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function get_total_taxes_percentage() { |
70 | 70 | $total_tax_percent = 0; |
71 | - foreach ( self::get_taxes_for_admin() as $tax_price ) { |
|
72 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
71 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
72 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
73 | 73 | } |
74 | 74 | return $total_tax_percent; |
75 | 75 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return float |
82 | 82 | * @throws \EE_Error |
83 | 83 | */ |
84 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $TKT_ID = $ticket->ID(); |
86 | - return isset( self::$_subtotal[ $TKT_ID ] ) |
|
87 | - ? self::$_subtotal[ $TKT_ID ] |
|
88 | - : self::_get_subtotal_for_admin( $ticket ); |
|
86 | + return isset(self::$_subtotal[$TKT_ID]) |
|
87 | + ? self::$_subtotal[$TKT_ID] |
|
88 | + : self::_get_subtotal_for_admin($ticket); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
100 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
101 | 101 | $subtotal = 0; |
102 | 102 | //get all prices |
103 | 103 | $prices = $ticket->get_many_related( |
104 | 104 | 'Price', |
105 | 105 | array( |
106 | 106 | 'default_where_conditions' => 'none', |
107 | - 'order_by' => array( 'PRC_order' => 'ASC' ), |
|
107 | + 'order_by' => array('PRC_order' => 'ASC'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | //let's loop through them (base price is always the first item) |
111 | - foreach ( $prices as $price ) { |
|
112 | - if ( $price instanceof EE_Price ) { |
|
111 | + foreach ($prices as $price) { |
|
112 | + if ($price instanceof EE_Price) { |
|
113 | 113 | $price_type = $price->type_obj(); |
114 | - if ( $price_type instanceof EE_Price_Type ) { |
|
115 | - switch ( $price->type_obj()->base_type() ) { |
|
114 | + if ($price_type instanceof EE_Price_Type) { |
|
115 | + switch ($price->type_obj()->base_type()) { |
|
116 | 116 | case 1: // base price |
117 | 117 | case 3: // surcharges |
118 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
119 | - : $price->get( 'PRC_amount' ); |
|
118 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
119 | + : $price->get('PRC_amount'); |
|
120 | 120 | break; |
121 | 121 | case 2: // discounts |
122 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 |
|
123 | - : $price->get( 'PRC_amount' ); |
|
122 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
123 | + : $price->get('PRC_amount'); |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $TKT_ID = $ticket->ID(); |
130 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
130 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
131 | 131 | return $subtotal; |
132 | 132 | } |
133 | 133 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | 142 | public static function get_taxes_for_admin() { |
143 | - if ( empty( self::$_default_taxes ) ) { |
|
144 | - self::$_default_taxes = EE_Registry::instance()->load_model( 'Price' )->get_all( |
|
145 | - array( array( 'Price_Type.PBT_ID' => 4 ) ) |
|
143 | + if (empty(self::$_default_taxes)) { |
|
144 | + self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
145 | + array(array('Price_Type.PBT_ID' => 4)) |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | return self::$_default_taxes; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @final |
485 | 485 | * @access protected |
486 | - * @return void |
|
486 | + * @return false|null |
|
487 | 487 | */ |
488 | 488 | final protected function _page_setup() { |
489 | 489 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
758 | 758 | * |
759 | 759 | * @access protected |
760 | - * @return void |
|
760 | + * @return false|null |
|
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | 763 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | /** |
820 | 820 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
821 | 821 | * @param string $route the route name we're verifying |
822 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
822 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
823 | 823 | */ |
824 | 824 | protected function _verify_route( $route ) { |
825 | 825 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | |
3412 | 3412 | |
3413 | 3413 | /** |
3414 | - * @return mixed |
|
3414 | + * @return string[] |
|
3415 | 3415 | */ |
3416 | 3416 | public function default_espresso_metaboxes() { |
3417 | 3417 | return $this->_default_espresso_metaboxes; |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | |
3430 | 3430 | |
3431 | 3431 | /** |
3432 | - * @return mixed |
|
3432 | + * @return string |
|
3433 | 3433 | */ |
3434 | 3434 | public function wp_page_slug() { |
3435 | 3435 | return $this->_wp_page_slug; |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | * verifies user access for this admin page |
1312 | 1312 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | - * @return BOOL|wp_die() |
|
1315 | - */ |
|
1314 | + * @return BOOL|wp_die() |
|
1315 | + */ |
|
1316 | 1316 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1317 | 1317 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1318 | 1318 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1698,11 +1698,11 @@ discard block |
||
1698 | 1698 | |
1699 | 1699 | |
1700 | 1700 | /** |
1701 | - * admin_footer_scripts_eei18n_js_strings |
|
1702 | - * |
|
1703 | - * @access public |
|
1704 | - * @return void |
|
1705 | - */ |
|
1701 | + * admin_footer_scripts_eei18n_js_strings |
|
1702 | + * |
|
1703 | + * @access public |
|
1704 | + * @return void |
|
1705 | + */ |
|
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | - * |
|
1763 | - * @access public |
|
1764 | - * @return void |
|
1765 | - */ |
|
1761 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | + * |
|
1763 | + * @access public |
|
1764 | + * @return void |
|
1765 | + */ |
|
1766 | 1766 | public function add_xdebug_style() { |
1767 | 1767 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1768 | 1768 | } |
@@ -1819,9 +1819,9 @@ discard block |
||
1819 | 1819 | |
1820 | 1820 | /** |
1821 | 1821 | * set current view for List Table |
1822 | - * @access public |
|
1823 | - * @return array |
|
1824 | - */ |
|
1822 | + * @access public |
|
1823 | + * @return array |
|
1824 | + */ |
|
1825 | 1825 | protected function _set_list_table_view() { |
1826 | 1826 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1827 | 1827 | |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | * @access protected |
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | - */ |
|
1913 | + */ |
|
1914 | 1914 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1915 | 1915 | |
1916 | 1916 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1955,9 +1955,9 @@ discard block |
||
1955 | 1955 | |
1956 | 1956 | /** |
1957 | 1957 | * _set_search_attributes |
1958 | - * @access protected |
|
1959 | - * @return void |
|
1960 | - */ |
|
1958 | + * @access protected |
|
1959 | + * @return void |
|
1960 | + */ |
|
1961 | 1961 | public function _set_search_attributes() { |
1962 | 1962 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1963 | 1963 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1978 | 1978 | * @access private |
1979 | 1979 | * @return void |
1980 | - */ |
|
1980 | + */ |
|
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | 1982 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1983 | 1983 | |
@@ -2027,13 +2027,13 @@ discard block |
||
2027 | 2027 | * @return void |
2028 | 2028 | */ |
2029 | 2029 | private function _add_screen_columns() { |
2030 | - if ( |
|
2031 | - is_array($this->_route_config) |
|
2032 | - && isset( $this->_route_config['columns'] ) |
|
2033 | - && is_array($this->_route_config['columns']) |
|
2034 | - && count( $this->_route_config['columns'] ) === 2 |
|
2035 | - ) { |
|
2036 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2030 | + if ( |
|
2031 | + is_array($this->_route_config) |
|
2032 | + && isset( $this->_route_config['columns'] ) |
|
2033 | + && is_array($this->_route_config['columns']) |
|
2034 | + && count( $this->_route_config['columns'] ) === 2 |
|
2035 | + ) { |
|
2036 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2037 | 2037 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2038 | 2038 | $screen_id = $this->_current_screen->id; |
2039 | 2039 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
@@ -2213,7 +2213,6 @@ discard block |
||
2213 | 2213 | * Note: currently there is no validation for this. However if you want the delete button, the |
2214 | 2214 | * save, and save and close buttons to work properly, then you will want to include a |
2215 | 2215 | * values for the name and id arguments. |
2216 | - |
|
2217 | 2216 | * |
2218 | 2217 | *@todo Add in validation for name/id arguments. |
2219 | 2218 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2272,9 +2271,9 @@ discard block |
||
2272 | 2271 | |
2273 | 2272 | /** |
2274 | 2273 | * displays an error message to ppl who have javascript disabled |
2275 | - * @access private |
|
2276 | - * @return string |
|
2277 | - */ |
|
2274 | + * @access private |
|
2275 | + * @return string |
|
2276 | + */ |
|
2278 | 2277 | private function _display_no_javascript_warning() { |
2279 | 2278 | ?> |
2280 | 2279 | <noscript> |
@@ -2297,9 +2296,9 @@ discard block |
||
2297 | 2296 | |
2298 | 2297 | /** |
2299 | 2298 | * displays espresso success and/or error notices |
2300 | - * @access private |
|
2301 | - * @return string |
|
2302 | - */ |
|
2299 | + * @access private |
|
2300 | + * @return string |
|
2301 | + */ |
|
2303 | 2302 | private function _display_espresso_notices() { |
2304 | 2303 | $notices = $this->_get_transient( TRUE ); |
2305 | 2304 | echo stripslashes($notices); |
@@ -2311,10 +2310,10 @@ discard block |
||
2311 | 2310 | |
2312 | 2311 | |
2313 | 2312 | /** |
2314 | - * spinny things pacify the masses |
|
2315 | - * @access private |
|
2316 | - * @return string |
|
2317 | - */ |
|
2313 | + * spinny things pacify the masses |
|
2314 | + * @access private |
|
2315 | + * @return string |
|
2316 | + */ |
|
2318 | 2317 | protected function _add_admin_page_ajax_loading_img() { |
2319 | 2318 | ?> |
2320 | 2319 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2328,10 +2327,10 @@ discard block |
||
2328 | 2327 | |
2329 | 2328 | |
2330 | 2329 | /** |
2331 | - * add admin page overlay for modal boxes |
|
2332 | - * @access private |
|
2333 | - * @return string |
|
2334 | - */ |
|
2330 | + * add admin page overlay for modal boxes |
|
2331 | + * @access private |
|
2332 | + * @return string |
|
2333 | + */ |
|
2335 | 2334 | protected function _add_admin_page_overlay() { |
2336 | 2335 | ?> |
2337 | 2336 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2393,10 +2392,10 @@ discard block |
||
2393 | 2392 | |
2394 | 2393 | |
2395 | 2394 | /** |
2396 | - * generates HTML wrapper for an admin details page |
|
2397 | - * @access public |
|
2398 | - * @return void |
|
2399 | - */ |
|
2395 | + * generates HTML wrapper for an admin details page |
|
2396 | + * @access public |
|
2397 | + * @return void |
|
2398 | + */ |
|
2400 | 2399 | public function display_admin_page_with_sidebar() { |
2401 | 2400 | |
2402 | 2401 | $this->_display_admin_page(TRUE); |
@@ -2406,10 +2405,10 @@ discard block |
||
2406 | 2405 | |
2407 | 2406 | |
2408 | 2407 | /** |
2409 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2410 | - * @access public |
|
2411 | - * @return void |
|
2412 | - */ |
|
2408 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2409 | + * @access public |
|
2410 | + * @return void |
|
2411 | + */ |
|
2413 | 2412 | public function display_admin_page_with_no_sidebar() { |
2414 | 2413 | $this->_display_admin_page(); |
2415 | 2414 | } |
@@ -2448,18 +2447,18 @@ discard block |
||
2448 | 2447 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2449 | 2448 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2450 | 2449 | $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route |
2451 | - ? 'poststuff' |
|
2452 | - : 'espresso-default-admin'; |
|
2450 | + ? 'poststuff' |
|
2451 | + : 'espresso-default-admin'; |
|
2453 | 2452 | |
2454 | - $template_path = $sidebar |
|
2455 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2456 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2453 | + $template_path = $sidebar |
|
2454 | + ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2455 | + : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2457 | 2456 | |
2458 | 2457 | if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
2459 | 2458 | $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
2460 | - } |
|
2459 | + } |
|
2461 | 2460 | |
2462 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2461 | + $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2463 | 2462 | |
2464 | 2463 | $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
2465 | 2464 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
@@ -2672,11 +2671,11 @@ discard block |
||
2672 | 2671 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | 2672 | if ( NULL === error_get_last() || ! headers_sent() ) |
2674 | 2673 | header('Content-Type: application/json; charset=UTF-8'); |
2675 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2676 | - echo wp_json_encode( $json ); |
|
2677 | - } else { |
|
2678 | - echo json_encode( $json ); |
|
2679 | - } |
|
2674 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2675 | + echo wp_json_encode( $json ); |
|
2676 | + } else { |
|
2677 | + echo json_encode( $json ); |
|
2678 | + } |
|
2680 | 2679 | exit(); |
2681 | 2680 | } |
2682 | 2681 | |
@@ -2715,11 +2714,11 @@ discard block |
||
2715 | 2714 | |
2716 | 2715 | |
2717 | 2716 | /** |
2718 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2719 | - * @access public |
|
2720 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2721 | - * @return void |
|
2722 | - */ |
|
2717 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2718 | + * @access public |
|
2719 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2720 | + * @return void |
|
2721 | + */ |
|
2723 | 2722 | public function admin_page_wrapper($about = FALSE) { |
2724 | 2723 | |
2725 | 2724 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2776,9 +2775,9 @@ discard block |
||
2776 | 2775 | */ |
2777 | 2776 | private function _sort_nav_tabs( $a, $b ) { |
2778 | 2777 | if ($a['order'] == $b['order']) { |
2779 | - return 0; |
|
2780 | - } |
|
2781 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2778 | + return 0; |
|
2779 | + } |
|
2780 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2782 | 2781 | } |
2783 | 2782 | |
2784 | 2783 |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //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. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // 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 |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $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'; |
|
511 | + $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'; |
|
512 | 512 | |
513 | 513 | //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. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //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 |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //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. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //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 |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $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 ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $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); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //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 |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $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 ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $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); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $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' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $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'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $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 ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $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); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $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__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $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__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,63 +872,63 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
875 | + if ( ! $this->_is_UI_request) |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
879 | 879 | |
880 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
880 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
881 | 881 | // set nonce from post data |
882 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
883 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
882 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
883 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
884 | 884 | } |
885 | 885 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
886 | + if ($this->_is_UI_request) |
|
887 | 887 | $this->_set_nav_tabs(); |
888 | 888 | |
889 | 889 | // grab callback function |
890 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
890 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
891 | 891 | |
892 | 892 | // check if callback has args |
893 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
893 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
894 | 894 | |
895 | 895 | $error_msg = ''; |
896 | 896 | |
897 | 897 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
898 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
898 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //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). |
903 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
903 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
904 | 904 | |
905 | - if ( ! empty( $func )) { |
|
905 | + if ( ! empty($func)) { |
|
906 | 906 | $base_call = $addon_call = FALSE; |
907 | 907 | //try to access page route via this class |
908 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
908 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
909 | 909 | // user error msg |
910 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
910 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
911 | 911 | // developer error msg |
912 | - $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 ); |
|
912 | + $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); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | //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) |
916 | 916 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
917 | 917 | |
918 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
919 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
920 | - $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 ); |
|
918 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
919 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
920 | + $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); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
924 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
925 | + throw new EE_Error($error_msg); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | //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. |
929 | 929 | //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. |
930 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
931 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
930 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
931 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * @param string $new_route New (non header) route to redirect to. |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - protected function _reset_routing_properties( $new_route ) { |
|
947 | + protected function _reset_routing_properties($new_route) { |
|
948 | 948 | $this->_is_UI_request = TRUE; |
949 | 949 | //now we set the current route to whatever the headers_sent_route is set at |
950 | 950 | $this->_req_data['action'] = $new_route; |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
991 | 991 | * @return string |
992 | 992 | */ |
993 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
993 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
994 | 994 | |
995 | 995 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
996 | - if ( $sticky ) { |
|
996 | + if ($sticky) { |
|
997 | 997 | $request = $_REQUEST; |
998 | - unset( $request['_wp_http_referer'] ); |
|
999 | - unset( $request['wp_referer'] ); |
|
1000 | - foreach ( $request as $key => $value ) { |
|
998 | + unset($request['_wp_http_referer']); |
|
999 | + unset($request['wp_referer']); |
|
1000 | + foreach ($request as $key => $value) { |
|
1001 | 1001 | //do not add nonces |
1002 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1002 | + if (strpos($key, 'nonce') !== false) { |
|
1003 | 1003 | continue; |
1004 | 1004 | } |
1005 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1005 | + $args['wp_referer['.$key.']'] = $value; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1009 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @uses EEH_Template::get_help_tab_link() |
1023 | 1023 | * @return string generated link |
1024 | 1024 | */ |
1025 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1026 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1025 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1026 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1040,30 +1040,30 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | protected function _add_help_tabs() { |
1042 | 1042 | $tour_buttons = ''; |
1043 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1043 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1044 | 1044 | $config = $this->_page_config[$this->_req_action]; |
1045 | 1045 | |
1046 | 1046 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1047 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1047 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1048 | 1048 | $tb = array(); |
1049 | 1049 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1050 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1051 | 1051 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1052 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1053 | 1053 | continue; |
1054 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1054 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1055 | 1055 | } |
1056 | 1056 | $tour_buttons .= implode('<br />', $tb); |
1057 | 1057 | $tour_buttons .= '</div></div>'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1061 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1062 | 1062 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - 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) ) ); |
|
1063 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1064 | + 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))); |
|
1065 | 1065 | |
1066 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1066 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1067 | 1067 | |
1068 | 1068 | $content .= $tour_buttons; //add help tour buttons. |
1069 | 1069 | |
@@ -1072,49 +1072,49 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1075 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1075 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1076 | 1076 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1080 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1080 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1081 | 1081 | $_ht['id'] = $this->page_slug; |
1082 | 1082 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1083 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1083 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1084 | 1084 | $this->_current_screen->add_help_tab($_ht); |
1085 | 1085 | }/**/ |
1086 | 1086 | |
1087 | 1087 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1088 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1089 | 1089 | |
1090 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1090 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1091 | 1091 | //we're here so there ARE help tabs! |
1092 | 1092 | |
1093 | 1093 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['title'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - 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') ); |
|
1098 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1099 | + 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')); |
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | //first priority goes to content. |
1104 | - if ( !empty($cfg['content'] ) ) { |
|
1105 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | + if ( ! empty($cfg['content'])) { |
|
1105 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1106 | 1106 | |
1107 | 1107 | //second priority goes to filename |
1108 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1109 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1108 | + } else if ( ! empty($cfg['filename'])) { |
|
1109 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | //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) |
1113 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1113 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1114 | 1114 | |
1115 | 1115 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1116 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1117 | - 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__ ); |
|
1116 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1117 | + 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__); |
|
1118 | 1118 | return; |
1119 | 1119 | } |
1120 | 1120 | $template_args['admin_page_obj'] = $this; |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | //check if callback is valid |
1128 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1129 | - 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__ ); |
|
1128 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1129 | + 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__); |
|
1130 | 1130 | return; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | //setup config array for help tab method |
1134 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1134 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1135 | 1135 | $_ht = array( |
1136 | 1136 | 'id' => $id, |
1137 | 1137 | 'title' => $cfg['title'], |
1138 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1138 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1139 | 1139 | 'content' => $content |
1140 | 1140 | ); |
1141 | 1141 | |
1142 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1142 | + $this->_current_screen->add_help_tab($_ht); |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1159,49 +1159,49 @@ discard block |
||
1159 | 1159 | $this->_help_tour = array(); |
1160 | 1160 | |
1161 | 1161 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1162 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1163 | 1163 | return; |
1164 | 1164 | |
1165 | 1165 | //loop through _page_config to find any help_tour defined |
1166 | - foreach ( $this->_page_config as $route => $config ) { |
|
1166 | + foreach ($this->_page_config as $route => $config) { |
|
1167 | 1167 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1168 | + if ($route !== $this->_req_action) |
|
1169 | 1169 | continue; |
1170 | 1170 | |
1171 | - if ( isset( $config['help_tour'] ) ) { |
|
1171 | + if (isset($config['help_tour'])) { |
|
1172 | 1172 | |
1173 | - foreach( $config['help_tour'] as $tour ) { |
|
1174 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1173 | + foreach ($config['help_tour'] as $tour) { |
|
1174 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1175 | 1175 | //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 |
1176 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1176 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1177 | 1177 | |
1178 | 1178 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1179 | - if ( !is_readable($file_path) ) { |
|
1180 | - 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__ ); |
|
1179 | + if ( ! is_readable($file_path)) { |
|
1180 | + 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__); |
|
1181 | 1181 | return; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | require_once $file_path; |
1185 | - if ( !class_exists( $tour ) ) { |
|
1186 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1187 | - $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) ); |
|
1188 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1185 | + if ( ! class_exists($tour)) { |
|
1186 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1187 | + $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)); |
|
1188 | + throw new EE_Error(implode('||', $error_msg)); |
|
1189 | 1189 | } |
1190 | 1190 | $a = new ReflectionClass($tour); |
1191 | 1191 | $tour_obj = $a->newInstance($this->_is_caf); |
1192 | 1192 | |
1193 | 1193 | $tours[] = $tour_obj; |
1194 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1194 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1198 | 1198 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1199 | 1199 | $tours[] = $end_stop_tour; |
1200 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1200 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - if ( !empty( $tours ) ) |
|
1204 | + if ( ! empty($tours)) |
|
1205 | 1205 | $this->_help_tour['tours'] = $tours; |
1206 | 1206 | |
1207 | 1207 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @return void |
1218 | 1218 | */ |
1219 | 1219 | protected function _add_qtips() { |
1220 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1220 | + if (isset($this->_route_config['qtips'])) { |
|
1221 | 1221 | $qtips = (array) $this->_route_config['qtips']; |
1222 | 1222 | //load qtip loader |
1223 | 1223 | $path = array( |
1224 | - $this->_get_dir() . '/qtips/', |
|
1225 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1224 | + $this->_get_dir().'/qtips/', |
|
1225 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1226 | 1226 | ); |
1227 | 1227 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1228 | 1228 | } |
@@ -1239,41 +1239,41 @@ discard block |
||
1239 | 1239 | * @return void |
1240 | 1240 | */ |
1241 | 1241 | protected function _set_nav_tabs() { |
1242 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1242 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1243 | 1243 | $i = 0; |
1244 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | + foreach ($this->_page_config as $slug => $config) { |
|
1245 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1246 | 1246 | continue; //no nav tab for this config |
1247 | 1247 | |
1248 | 1248 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1249 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1250 | 1250 | continue; //nav tab is only to appear when route requested. |
1251 | 1251 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1252 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1253 | 1253 | continue; //no nav tab becasue current user does not have access. |
1254 | 1254 | |
1255 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1255 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1256 | 1256 | $this->_nav_tabs[$slug] = array( |
1257 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1258 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1259 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1260 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1257 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1258 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1259 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1260 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1261 | 1261 | ); |
1262 | 1262 | $i++; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //if $this->_nav_tabs is empty then lets set the default |
1266 | - if ( empty( $this->_nav_tabs ) ) { |
|
1266 | + if (empty($this->_nav_tabs)) { |
|
1267 | 1267 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1268 | 1268 | 'url' => $this->admin_base_url, |
1269 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1269 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1270 | 1270 | 'css_class' => 'nav-tab-active', |
1271 | 1271 | 'order' => 10 |
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | //now let's sort the tabs according to order |
1276 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1276 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | */ |
1291 | 1291 | private function _set_current_labels() { |
1292 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1293 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1294 | - if ( is_array($text) ) { |
|
1295 | - foreach ( $text as $sublabel => $subtext ) { |
|
1292 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1293 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1294 | + if (is_array($text)) { |
|
1295 | + foreach ($text as $sublabel => $subtext) { |
|
1296 | 1296 | $this->_labels[$label][$sublabel] = $subtext; |
1297 | 1297 | } |
1298 | 1298 | } else { |
@@ -1313,24 +1313,24 @@ discard block |
||
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | 1314 | * @return BOOL|wp_die() |
1315 | 1315 | */ |
1316 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1317 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1318 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1319 | - $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; |
|
1316 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1317 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1318 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1319 | + $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; |
|
1320 | 1320 | |
1321 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1322 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1321 | + if (empty($capability) && empty($route_to_check)) { |
|
1322 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1323 | 1323 | } else { |
1324 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1324 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1327 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1328 | 1328 | |
1329 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1330 | - if ( $verify_only ) { |
|
1329 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1330 | + if ($verify_only) { |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } else { |
1333 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1333 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | return TRUE; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $this->_add_admin_page_overlay(); |
1408 | 1408 | |
1409 | 1409 | //if metaboxes are present we need to add the nonce field |
1410 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1410 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1411 | 1411 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1412 | 1412 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1413 | 1413 | } |
@@ -1426,19 +1426,19 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | public function admin_footer_global() { |
1428 | 1428 | //dialog container for dialog helper |
1429 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1429 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1430 | 1430 | $d_cont .= '<div class="ee-notices"></div>'; |
1431 | 1431 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1432 | 1432 | $d_cont .= '</div>'; |
1433 | 1433 | echo $d_cont; |
1434 | 1434 | |
1435 | 1435 | //help tour stuff? |
1436 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1436 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1437 | 1437 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | //current set timezone for timezone js |
1441 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1441 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | |
@@ -1462,18 +1462,18 @@ discard block |
||
1462 | 1462 | * @access protected |
1463 | 1463 | * @return string content |
1464 | 1464 | */ |
1465 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1465 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1466 | 1466 | $content = ''; |
1467 | 1467 | |
1468 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1469 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1468 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1469 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1470 | 1470 | |
1471 | 1471 | |
1472 | 1472 | //loop through the array and setup content |
1473 | - foreach ( $help_array as $trigger => $help ) { |
|
1473 | + foreach ($help_array as $trigger => $help) { |
|
1474 | 1474 | //make sure the array is setup properly |
1475 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1476 | - 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') ); |
|
1475 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1476 | + 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')); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1483,10 +1483,10 @@ discard block |
||
1483 | 1483 | 'help_popup_content' => $help['content'] |
1484 | 1484 | ); |
1485 | 1485 | |
1486 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1486 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | - if ( $display ) |
|
1489 | + if ($display) |
|
1490 | 1490 | echo $content; |
1491 | 1491 | else |
1492 | 1492 | return $content; |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | */ |
1504 | 1504 | private function _get_help_content() { |
1505 | 1505 | //what is the method we're looking for? |
1506 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1506 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1507 | 1507 | |
1508 | 1508 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1509 | + if ( ! method_exists($this, $method_name)) |
|
1510 | 1510 | return array(); |
1511 | 1511 | |
1512 | 1512 | //k we're good to go let's retrieve the help array |
1513 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1513 | + $help_array = call_user_func(array($this, $method_name)); |
|
1514 | 1514 | |
1515 | 1515 | //make sure we've got an array! |
1516 | - if ( !is_array($help_array) ) { |
|
1517 | - 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' ) ); |
|
1516 | + if ( ! is_array($help_array)) { |
|
1517 | + 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')); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | return $help_array; |
@@ -1536,27 +1536,27 @@ discard block |
||
1536 | 1536 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1539 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1540 | 1540 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1541 | + if (defined('DOING_AJAX')) return; |
|
1542 | 1542 | |
1543 | 1543 | //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 |
1544 | 1544 | $help_array = $this->_get_help_content(); |
1545 | 1545 | $help_content = ''; |
1546 | 1546 | |
1547 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1547 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1548 | 1548 | $help_array[$trigger_id] = array( |
1549 | 1549 | 'title' => __('Missing Content', 'event_espresso'), |
1550 | 1550 | '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') |
1551 | 1551 | ); |
1552 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1552 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | //let's setup the trigger |
1556 | - $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>'; |
|
1557 | - $content = $content . $help_content; |
|
1556 | + $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>'; |
|
1557 | + $content = $content.$help_content; |
|
1558 | 1558 | |
1559 | - if ( $display ) |
|
1559 | + if ($display) |
|
1560 | 1560 | echo $content; |
1561 | 1561 | else |
1562 | 1562 | return $content; |
@@ -1613,15 +1613,15 @@ discard block |
||
1613 | 1613 | public function load_global_scripts_styles() { |
1614 | 1614 | /** STYLES **/ |
1615 | 1615 | // add debugging styles |
1616 | - if ( WP_DEBUG ) { |
|
1617 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1616 | + if (WP_DEBUG) { |
|
1617 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | //register all styles |
1621 | - 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 ); |
|
1622 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | + 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); |
|
1622 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //helpers styles |
1624 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1624 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1625 | 1625 | //enqueue global styles |
1626 | 1626 | wp_enqueue_style('ee-admin-css'); |
1627 | 1627 | |
@@ -1629,66 +1629,66 @@ discard block |
||
1629 | 1629 | /** SCRIPTS **/ |
1630 | 1630 | |
1631 | 1631 | //register all scripts |
1632 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - 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 ); |
|
1632 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1633 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + 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); |
|
1635 | 1635 | |
1636 | - 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 ); |
|
1636 | + 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); |
|
1637 | 1637 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1638 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1638 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1639 | 1639 | add_filter('FHEE_load_joyride', '__return_true'); |
1640 | 1640 | |
1641 | 1641 | //script for sorting tables |
1642 | - 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); |
|
1642 | + 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); |
|
1643 | 1643 | //script for parsing uri's |
1644 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //and parsing associative serialized form elements |
1646 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | 1647 | //helpers scripts |
1648 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | 1652 | |
1653 | 1653 | //google charts |
1654 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1654 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1655 | 1655 | |
1656 | 1656 | //enqueue global scripts |
1657 | 1657 | |
1658 | 1658 | //taking care of metaboxes |
1659 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1659 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1660 | 1660 | wp_enqueue_script('dashboard'); |
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | //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 |
1664 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1664 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1665 | 1665 | wp_enqueue_script('ee_admin_js'); |
1666 | 1666 | wp_enqueue_style('ee-admin-css'); |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | //localize script for ajax lazy loading |
1671 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1672 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1672 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | /** |
1676 | 1676 | * help tour stuff |
1677 | 1677 | */ |
1678 | - if ( !empty( $this->_help_tour ) ) { |
|
1678 | + if ( ! empty($this->_help_tour)) { |
|
1679 | 1679 | |
1680 | 1680 | //register the js for kicking things off |
1681 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1681 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1682 | 1682 | |
1683 | 1683 | //setup tours for the js tour object |
1684 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1684 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1685 | 1685 | $tours[] = array( |
1686 | 1686 | 'id' => $tour->get_slug(), |
1687 | 1687 | 'options' => $tour->get_options() |
1688 | 1688 | ); |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1691 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1692 | 1692 | |
1693 | 1693 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1694 | 1694 | } |
@@ -1706,52 +1706,52 @@ discard block |
||
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1709 | - 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' ); |
|
1710 | - |
|
1711 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1735 | - |
|
1736 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1709 | + 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'); |
|
1710 | + |
|
1711 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1735 | + |
|
1736 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1750 | 1750 | |
1751 | 1751 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1752 | 1752 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1753 | 1753 | //espresso_core is listed as a dependency of ee_admin_js. |
1754 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1754 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1755 | 1755 | |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1785,23 +1785,23 @@ discard block |
||
1785 | 1785 | protected function _set_list_table() { |
1786 | 1786 | |
1787 | 1787 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1788 | + if ( ! isset($this->_route_config['list_table'])) |
|
1789 | 1789 | return; //not a list_table view so get out. |
1790 | 1790 | |
1791 | 1791 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1792 | |
1793 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1793 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1794 | 1794 | //user error msg |
1795 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1795 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1796 | 1796 | //developer error msg |
1797 | - $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 ); |
|
1798 | - throw new EE_Error( $error_msg ); |
|
1797 | + $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); |
|
1798 | + throw new EE_Error($error_msg); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1805 | 1805 | |
1806 | 1806 | $this->_set_list_table_view(); |
1807 | 1807 | $this->_set_list_table_object(); |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | * @return array |
1824 | 1824 | */ |
1825 | 1825 | protected function _set_list_table_view() { |
1826 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1826 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | // looking at active items or dumpster diving ? |
1830 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1831 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1830 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1831 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1832 | 1832 | } else { |
1833 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1833 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @throws \EE_Error |
1844 | 1844 | */ |
1845 | 1845 | protected function _set_list_table_object() { |
1846 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1847 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1846 | + if (isset($this->_route_config['list_table'])) { |
|
1847 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1848 | 1848 | throw new EE_Error( |
1849 | 1849 | sprintf( |
1850 | 1850 | __( |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | 'event_espresso' |
1853 | 1853 | ), |
1854 | 1854 | $this->_route_config['list_table'], |
1855 | - get_class( $this ) |
|
1855 | + get_class($this) |
|
1856 | 1856 | ) |
1857 | 1857 | ); |
1858 | 1858 | } |
1859 | 1859 | $list_table = $this->_route_config['list_table']; |
1860 | - $this->_list_table_object = new $list_table( $this ); |
|
1860 | + $this->_list_table_object = new $list_table($this); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1874,27 +1874,27 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1877 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1878 | 1878 | |
1879 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1879 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1880 | 1880 | |
1881 | - if ( empty( $this->_views )) { |
|
1881 | + if (empty($this->_views)) { |
|
1882 | 1882 | $this->_views = array(); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // cycle thru views |
1886 | - foreach ( $this->_views as $key => $view ) { |
|
1886 | + foreach ($this->_views as $key => $view) { |
|
1887 | 1887 | $query_args = array(); |
1888 | 1888 | // check for current view |
1889 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1889 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1890 | 1890 | $query_args['action'] = $this->_req_action; |
1891 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1891 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1892 | 1892 | $query_args['status'] = $view['slug']; |
1893 | 1893 | //merge any other arguments sent in. |
1894 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1895 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1894 | + if (isset($extra_query_args[$view['slug']])) { |
|
1895 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1896 | 1896 | } |
1897 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1897 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return $this->_views; |
@@ -1911,15 +1911,15 @@ discard block |
||
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | 1913 | */ |
1914 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1914 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1915 | 1915 | |
1916 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1917 | - $values = array( 10, 25, 50, 100 ); |
|
1918 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1916 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1917 | + $values = array(10, 25, 50, 100); |
|
1918 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1919 | 1919 | |
1920 | - if ( $max_entries ) { |
|
1920 | + if ($max_entries) { |
|
1921 | 1921 | $values[] = $max_entries; |
1922 | - sort( $values ); |
|
1922 | + sort($values); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | $entries_per_page_dropdown = ' |
@@ -1928,15 +1928,15 @@ discard block |
||
1928 | 1928 | Show |
1929 | 1929 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1930 | 1930 | |
1931 | - foreach ( $values as $value ) { |
|
1932 | - if ( $value < $max_entries ) { |
|
1933 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1931 | + foreach ($values as $value) { |
|
1932 | + if ($value < $max_entries) { |
|
1933 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1934 | 1934 | $entries_per_page_dropdown .= ' |
1935 | 1935 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1936 | 1936 | } |
1937 | 1937 | } |
1938 | 1938 | |
1939 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1939 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1940 | 1940 | $entries_per_page_dropdown .= ' |
1941 | 1941 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1942 | 1942 | |
@@ -1959,8 +1959,8 @@ discard block |
||
1959 | 1959 | * @return void |
1960 | 1960 | */ |
1961 | 1961 | public function _set_search_attributes() { |
1962 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1963 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1962 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1963 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | /*** END LIST TABLE METHODS **/ |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | * @return void |
1980 | 1980 | */ |
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1982 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1983 | 1983 | |
1984 | 1984 | //we only add meta boxes if the page_route calls for it |
1985 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1985 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1986 | 1986 | && is_array( |
1987 | 1987 | $this->_route_config['metaboxes'] |
1988 | 1988 | ) |
@@ -1990,27 +1990,27 @@ discard block |
||
1990 | 1990 | // this simply loops through the callbacks provided |
1991 | 1991 | // and checks if there is a corresponding callback registered by the child |
1992 | 1992 | // if there is then we go ahead and process the metabox loader. |
1993 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1993 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1994 | 1994 | // first check for Closures |
1995 | - if ( $metabox_callback instanceof Closure ) { |
|
1995 | + if ($metabox_callback instanceof Closure) { |
|
1996 | 1996 | $result = $metabox_callback(); |
1997 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1998 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1997 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1998 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1999 | 1999 | } else { |
2000 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2000 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2001 | 2001 | } |
2002 | - if ( $result === FALSE ) { |
|
2002 | + if ($result === FALSE) { |
|
2003 | 2003 | // user error msg |
2004 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2004 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2005 | 2005 | // developer error msg |
2006 | - $error_msg .= '||' . sprintf( |
|
2006 | + $error_msg .= '||'.sprintf( |
|
2007 | 2007 | __( |
2008 | 2008 | '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.', |
2009 | 2009 | 'event_espresso' |
2010 | 2010 | ), |
2011 | 2011 | $metabox_callback |
2012 | 2012 | ); |
2013 | - throw new EE_Error( $error_msg ); |
|
2013 | + throw new EE_Error($error_msg); |
|
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } |
@@ -2029,19 +2029,19 @@ discard block |
||
2029 | 2029 | private function _add_screen_columns() { |
2030 | 2030 | if ( |
2031 | 2031 | is_array($this->_route_config) |
2032 | - && isset( $this->_route_config['columns'] ) |
|
2032 | + && isset($this->_route_config['columns']) |
|
2033 | 2033 | && is_array($this->_route_config['columns']) |
2034 | - && count( $this->_route_config['columns'] ) === 2 |
|
2034 | + && count($this->_route_config['columns']) === 2 |
|
2035 | 2035 | ) { |
2036 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2036 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2037 | 2037 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2038 | 2038 | $screen_id = $this->_current_screen->id; |
2039 | 2039 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2040 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2041 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2040 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2041 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2042 | 2042 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2043 | 2043 | $this->_template_args['screen'] = $this->_current_screen; |
2044 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2044 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2045 | 2045 | |
2046 | 2046 | //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. |
2047 | 2047 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2058,11 +2058,11 @@ discard block |
||
2058 | 2058 | */ |
2059 | 2059 | |
2060 | 2060 | private function _espresso_news_post_box() { |
2061 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2062 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2061 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2062 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2063 | 2063 | $this, |
2064 | 2064 | 'espresso_news_post_box' |
2065 | - ), $this->_wp_page_slug, 'side' ); |
|
2065 | + ), $this->_wp_page_slug, 'side'); |
|
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | |
@@ -2070,14 +2070,14 @@ discard block |
||
2070 | 2070 | * Code for setting up espresso ratings request metabox. |
2071 | 2071 | */ |
2072 | 2072 | protected function _espresso_ratings_request() { |
2073 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2073 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2074 | 2074 | return ''; |
2075 | 2075 | } |
2076 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2077 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2076 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2077 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2078 | 2078 | $this, |
2079 | 2079 | 'espresso_ratings_request' |
2080 | - ), $this->_wp_page_slug, 'side' ); |
|
2080 | + ), $this->_wp_page_slug, 'side'); |
|
2081 | 2081 | } |
2082 | 2082 | |
2083 | 2083 | |
@@ -2085,34 +2085,34 @@ discard block |
||
2085 | 2085 | * Code for setting up espresso ratings request metabox content. |
2086 | 2086 | */ |
2087 | 2087 | public function espresso_ratings_request() { |
2088 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2089 | - EEH_Template::display_template( $template_path, array() ); |
|
2088 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2089 | + EEH_Template::display_template($template_path, array()); |
|
2090 | 2090 | } |
2091 | 2091 | |
2092 | 2092 | |
2093 | 2093 | |
2094 | 2094 | |
2095 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2096 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2097 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2098 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2099 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2100 | - $post = '</div>' . "\n"; |
|
2095 | + public static function cached_rss_display($rss_id, $url) { |
|
2096 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2097 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2098 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2099 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2100 | + $post = '</div>'."\n"; |
|
2101 | 2101 | |
2102 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2103 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2104 | - echo $pre . $output . $post; |
|
2102 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2103 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2104 | + echo $pre.$output.$post; |
|
2105 | 2105 | return TRUE; |
2106 | 2106 | } |
2107 | 2107 | |
2108 | - if ( ! $doing_ajax ) { |
|
2109 | - echo $pre . $loading . $post; |
|
2108 | + if ( ! $doing_ajax) { |
|
2109 | + echo $pre.$loading.$post; |
|
2110 | 2110 | return FALSE; |
2111 | 2111 | } |
2112 | 2112 | |
2113 | 2113 | ob_start(); |
2114 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2115 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2114 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2115 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2116 | 2116 | return TRUE; |
2117 | 2117 | |
2118 | 2118 | } |
@@ -2124,13 +2124,13 @@ discard block |
||
2124 | 2124 | <div id="espresso_news_post_box_content" class="infolinks"> |
2125 | 2125 | <?php |
2126 | 2126 | // Get RSS Feed(s) |
2127 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2127 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2128 | 2128 | $url = urlencode($feed_url); |
2129 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2129 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2130 | 2130 | |
2131 | 2131 | ?> |
2132 | 2132 | </div> |
2133 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2133 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2134 | 2134 | </div> |
2135 | 2135 | <?php |
2136 | 2136 | } |
@@ -2151,32 +2151,32 @@ discard block |
||
2151 | 2151 | |
2152 | 2152 | protected function _espresso_sponsors_post_box() { |
2153 | 2153 | |
2154 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2155 | - if ( $show_sponsors ) |
|
2156 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2154 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2155 | + if ($show_sponsors) |
|
2156 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2157 | 2157 | } |
2158 | 2158 | |
2159 | 2159 | |
2160 | 2160 | public function espresso_sponsors_post_box() { |
2161 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2162 | - EEH_Template::display_template( $templatepath ); |
|
2161 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2162 | + EEH_Template::display_template($templatepath); |
|
2163 | 2163 | } |
2164 | 2164 | |
2165 | 2165 | |
2166 | 2166 | |
2167 | 2167 | private function _publish_post_box() { |
2168 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2168 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2169 | 2169 | |
2170 | 2170 | //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) |
2171 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2172 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2171 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2172 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2173 | 2173 | } else { |
2174 | 2174 | $box_label = __('Publish', 'event_espresso'); |
2175 | 2175 | } |
2176 | 2176 | |
2177 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2177 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2178 | 2178 | |
2179 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2179 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2180 | 2180 | |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2184,9 +2184,9 @@ discard block |
||
2184 | 2184 | |
2185 | 2185 | public function editor_overview() { |
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'] : ''; |
|
2188 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2189 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2187 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2189 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2190 | 2190 | } |
2191 | 2191 | |
2192 | 2192 | |
@@ -2202,8 +2202,8 @@ discard block |
||
2202 | 2202 | * @see $this->_set_publish_post_box_vars for param details |
2203 | 2203 | * @since 4.6.0 |
2204 | 2204 | */ |
2205 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2206 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2205 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2206 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | |
@@ -2231,17 +2231,17 @@ discard block |
||
2231 | 2231 | $both_btns = true |
2232 | 2232 | ) { |
2233 | 2233 | // if Save & Close, use a custom redirect URL or default to the main page? |
2234 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2234 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2235 | 2235 | // create the Save & Close and Save buttons |
2236 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2236 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2237 | 2237 | //if we have extra content set let's add it in if not make sure its empty |
2238 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2238 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2239 | 2239 | |
2240 | 2240 | |
2241 | - if ( $delete && ! empty( $id ) ) { |
|
2241 | + if ($delete && ! empty($id)) { |
|
2242 | 2242 | //make sure we have a default if just true is sent. |
2243 | 2243 | $delete = ! empty($delete) ? $delete : 'delete'; |
2244 | - $delete_link_args = array( $name => $id ); |
|
2244 | + $delete_link_args = array($name => $id); |
|
2245 | 2245 | $delete = $this->get_action_link_or_button( |
2246 | 2246 | $delete, |
2247 | 2247 | $delete, |
@@ -2252,8 +2252,8 @@ discard block |
||
2252 | 2252 | ); |
2253 | 2253 | } |
2254 | 2254 | |
2255 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2256 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2255 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2256 | + if ( ! empty($name) && ! empty($id)) { |
|
2257 | 2257 | $hidden_field_arr[$name] = array( |
2258 | 2258 | 'type' => 'hidden', |
2259 | 2259 | 'value' => $id |
@@ -2263,7 +2263,7 @@ discard block |
||
2263 | 2263 | $hf = ''; |
2264 | 2264 | } |
2265 | 2265 | // add hidden field |
2266 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2266 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2267 | 2267 | |
2268 | 2268 | } |
2269 | 2269 | |
@@ -2280,8 +2280,8 @@ discard block |
||
2280 | 2280 | <noscript> |
2281 | 2281 | <div id="no-js-message" class="error"> |
2282 | 2282 | <p style="font-size:1.3em;"> |
2283 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2284 | - <?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' ); ?> |
|
2283 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2284 | + <?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'); ?> |
|
2285 | 2285 | </p> |
2286 | 2286 | </div> |
2287 | 2287 | </noscript> |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | * @return string |
2302 | 2302 | */ |
2303 | 2303 | private function _display_espresso_notices() { |
2304 | - $notices = $this->_get_transient( TRUE ); |
|
2304 | + $notices = $this->_get_transient(TRUE); |
|
2305 | 2305 | echo stripslashes($notices); |
2306 | 2306 | } |
2307 | 2307 | |
@@ -2353,11 +2353,11 @@ discard block |
||
2353 | 2353 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2354 | 2354 | * @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. |
2355 | 2355 | */ |
2356 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2357 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2356 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2357 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2358 | 2358 | |
2359 | 2359 | //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. |
2360 | - if ( empty( $callback_args ) && $create_func ) { |
|
2360 | + if (empty($callback_args) && $create_func) { |
|
2361 | 2361 | $callback_args = array( |
2362 | 2362 | 'template_path' => $this->_template_path, |
2363 | 2363 | 'template_args' => $this->_template_args, |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | //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) |
2368 | 2368 | $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; |
2369 | 2369 | |
2370 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2370 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2371 | 2371 | } |
2372 | 2372 | |
2373 | 2373 | |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | */ |
2381 | 2381 | public function display_admin_page_with_metabox_columns() { |
2382 | 2382 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2383 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2383 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2384 | 2384 | |
2385 | 2385 | //the final wrapper |
2386 | 2386 | $this->admin_page_wrapper(); |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | * @return void |
2424 | 2424 | */ |
2425 | 2425 | public function display_about_admin_page() { |
2426 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2426 | + $this->_display_admin_page(FALSE, TRUE); |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | |
@@ -2439,10 +2439,10 @@ discard block |
||
2439 | 2439 | * @return void |
2440 | 2440 | */ |
2441 | 2441 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2442 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2442 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2443 | 2443 | |
2444 | 2444 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2445 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2445 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2446 | 2446 | |
2447 | 2447 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2448 | 2448 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
@@ -2452,19 +2452,19 @@ discard block |
||
2452 | 2452 | : 'espresso-default-admin'; |
2453 | 2453 | |
2454 | 2454 | $template_path = $sidebar |
2455 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2456 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2455 | + ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' |
|
2456 | + : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2457 | 2457 | |
2458 | - if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
|
2459 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2458 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2459 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2460 | 2460 | } |
2461 | 2461 | |
2462 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2462 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2463 | 2463 | |
2464 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2464 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2465 | 2465 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2466 | 2466 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2467 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2467 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2468 | 2468 | |
2469 | 2469 | |
2470 | 2470 | // the final template wrapper |
@@ -2482,7 +2482,7 @@ discard block |
||
2482 | 2482 | * @return void |
2483 | 2483 | * @throws \EE_Error |
2484 | 2484 | */ |
2485 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2485 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2486 | 2486 | //let's generate a default preview action button if there isn't one already present. |
2487 | 2487 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2488 | 2488 | $buy_now_url = add_query_arg( |
@@ -2495,7 +2495,7 @@ discard block |
||
2495 | 2495 | ), |
2496 | 2496 | 'http://eventespresso.com/pricing/' |
2497 | 2497 | ); |
2498 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2498 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2499 | 2499 | ? $this->get_action_link_or_button( |
2500 | 2500 | '', |
2501 | 2501 | 'buy_now', |
@@ -2505,13 +2505,13 @@ discard block |
||
2505 | 2505 | true |
2506 | 2506 | ) |
2507 | 2507 | : $this->_template_args['preview_action_button']; |
2508 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2508 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2509 | 2509 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2510 | 2510 | $template_path, |
2511 | 2511 | $this->_template_args, |
2512 | 2512 | true |
2513 | 2513 | ); |
2514 | - $this->_display_admin_page( $display_sidebar ); |
|
2514 | + $this->_display_admin_page($display_sidebar); |
|
2515 | 2515 | } |
2516 | 2516 | |
2517 | 2517 | |
@@ -2545,49 +2545,49 @@ discard block |
||
2545 | 2545 | * @param boolean $sidebar whether to display with sidebar or not. |
2546 | 2546 | * @return void |
2547 | 2547 | */ |
2548 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2548 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2549 | 2549 | //setup search attributes |
2550 | 2550 | $this->_set_search_attributes(); |
2551 | 2551 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2552 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2552 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2553 | 2553 | |
2554 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2555 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2556 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2554 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2555 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2556 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2557 | 2557 | $this->_template_args['list_table'] = $this->_list_table_object; |
2558 | 2558 | $this->_template_args['current_route'] = $this->_req_action; |
2559 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2559 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2560 | 2560 | |
2561 | 2561 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2562 | - if( ! empty( $ajax_sorting_callback )) { |
|
2562 | + if ( ! empty($ajax_sorting_callback)) { |
|
2563 | 2563 | $sortable_list_table_form_fields = wp_nonce_field( |
2564 | - $ajax_sorting_callback . '_nonce', |
|
2565 | - $ajax_sorting_callback . '_nonce', |
|
2564 | + $ajax_sorting_callback.'_nonce', |
|
2565 | + $ajax_sorting_callback.'_nonce', |
|
2566 | 2566 | FALSE, |
2567 | 2567 | FALSE |
2568 | 2568 | ); |
2569 | 2569 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2570 | 2570 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2571 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2572 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2571 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2572 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2573 | 2573 | } else { |
2574 | 2574 | $sortable_list_table_form_fields = ''; |
2575 | 2575 | } |
2576 | 2576 | |
2577 | 2577 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2578 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2579 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2580 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2578 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2579 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2580 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2581 | 2581 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2582 | 2582 | |
2583 | 2583 | //display message about search results? |
2584 | 2584 | $this->_template_args['before_list_table'] .= apply_filters( |
2585 | 2585 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2586 | - ! empty( $this->_req_data['s'] ) |
|
2587 | - ? '<p class="ee-search-results">' . sprintf( |
|
2588 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2589 | - trim( $this->_req_data['s'], '%' ) |
|
2590 | - ) . '</p>' |
|
2586 | + ! empty($this->_req_data['s']) |
|
2587 | + ? '<p class="ee-search-results">'.sprintf( |
|
2588 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2589 | + trim($this->_req_data['s'], '%') |
|
2590 | + ).'</p>' |
|
2591 | 2591 | : '', |
2592 | 2592 | $this->page_slug, |
2593 | 2593 | $this->_req_data, |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | true |
2600 | 2600 | ); |
2601 | 2601 | // the final template wrapper |
2602 | - if ( $sidebar ) |
|
2602 | + if ($sidebar) |
|
2603 | 2603 | $this->display_admin_page_with_sidebar(); |
2604 | 2604 | else |
2605 | 2605 | $this->display_admin_page_with_no_sidebar(); |
@@ -2622,9 +2622,9 @@ discard block |
||
2622 | 2622 | * @param array $items see above for format of array |
2623 | 2623 | * @return string html string of legend |
2624 | 2624 | */ |
2625 | - protected function _display_legend( $items ) { |
|
2626 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2627 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2625 | + protected function _display_legend($items) { |
|
2626 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2627 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2628 | 2628 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2629 | 2629 | } |
2630 | 2630 | |
@@ -2649,33 +2649,33 @@ discard block |
||
2649 | 2649 | * |
2650 | 2650 | * @return void |
2651 | 2651 | */ |
2652 | - protected function _return_json( $sticky_notices = false ) { |
|
2652 | + protected function _return_json($sticky_notices = false) { |
|
2653 | 2653 | |
2654 | 2654 | //make sure any EE_Error notices have been handled. |
2655 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2655 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2656 | 2656 | |
2657 | 2657 | |
2658 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2658 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2659 | 2659 | unset($this->_template_args['data']); |
2660 | 2660 | $json = array( |
2661 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2662 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2663 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2664 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2661 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2662 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2663 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2664 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2665 | 2665 | 'notices' => EE_Error::get_notices(), |
2666 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2667 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2666 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2667 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2668 | 2668 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2669 | 2669 | ); |
2670 | 2670 | |
2671 | 2671 | |
2672 | 2672 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2673 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2674 | 2674 | header('Content-Type: application/json; charset=UTF-8'); |
2675 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2676 | - echo wp_json_encode( $json ); |
|
2675 | + if (function_exists('wp_json_encode')) { |
|
2676 | + echo wp_json_encode($json); |
|
2677 | 2677 | } else { |
2678 | - echo json_encode( $json ); |
|
2678 | + echo json_encode($json); |
|
2679 | 2679 | } |
2680 | 2680 | exit(); |
2681 | 2681 | } |
@@ -2689,11 +2689,11 @@ discard block |
||
2689 | 2689 | * @throws EE_Error |
2690 | 2690 | */ |
2691 | 2691 | public function return_json() { |
2692 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2692 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2693 | 2693 | $this->_return_json(); |
2694 | 2694 | |
2695 | 2695 | else { |
2696 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2696 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2697 | 2697 | } |
2698 | 2698 | } |
2699 | 2699 | |
@@ -2706,7 +2706,7 @@ discard block |
||
2706 | 2706 | * |
2707 | 2707 | * @access public |
2708 | 2708 | */ |
2709 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2709 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2710 | 2710 | $this->_hook_obj = $hook_obj; |
2711 | 2711 | } |
2712 | 2712 | |
@@ -2722,33 +2722,33 @@ discard block |
||
2722 | 2722 | */ |
2723 | 2723 | public function admin_page_wrapper($about = FALSE) { |
2724 | 2724 | |
2725 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2725 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2726 | 2726 | |
2727 | 2727 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2728 | 2728 | |
2729 | 2729 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2730 | 2730 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2731 | 2731 | |
2732 | - $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'] : ''); |
|
2733 | - $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'] : ''); |
|
2732 | + $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'] : ''); |
|
2733 | + $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'] : ''); |
|
2734 | 2734 | |
2735 | 2735 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2736 | 2736 | |
2737 | 2737 | |
2738 | 2738 | |
2739 | 2739 | // load settings page wrapper template |
2740 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2740 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2741 | 2741 | |
2742 | 2742 | //about page? |
2743 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2743 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2744 | 2744 | |
2745 | 2745 | |
2746 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2747 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2746 | + if (defined('DOING_AJAX')) { |
|
2747 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2748 | 2748 | |
2749 | 2749 | $this->_return_json(); |
2750 | 2750 | } else { |
2751 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2751 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2752 | 2752 | } |
2753 | 2753 | |
2754 | 2754 | } |
@@ -2774,7 +2774,7 @@ discard block |
||
2774 | 2774 | * @param $b |
2775 | 2775 | * @return int |
2776 | 2776 | */ |
2777 | - private function _sort_nav_tabs( $a, $b ) { |
|
2777 | + private function _sort_nav_tabs($a, $b) { |
|
2778 | 2778 | if ($a['order'] == $b['order']) { |
2779 | 2779 | return 0; |
2780 | 2780 | } |
@@ -2794,7 +2794,7 @@ discard block |
||
2794 | 2794 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2795 | 2795 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2796 | 2796 | */ |
2797 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2797 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2798 | 2798 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2799 | 2799 | return $content; |
2800 | 2800 | } |
@@ -2816,25 +2816,25 @@ discard block |
||
2816 | 2816 | * @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. |
2817 | 2817 | * @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). |
2818 | 2818 | */ |
2819 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2819 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2820 | 2820 | //make sure $text and $actions are in an array |
2821 | 2821 | $text = (array) $text; |
2822 | 2822 | $actions = (array) $actions; |
2823 | 2823 | $referrer_url = empty($referrer) ? '' : $referrer; |
2824 | - $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 .'" />'; |
|
2824 | + $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.'" />'; |
|
2825 | 2825 | |
2826 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2827 | - $default_names = array( 'save', 'save_and_close' ); |
|
2826 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2827 | + $default_names = array('save', 'save_and_close'); |
|
2828 | 2828 | |
2829 | 2829 | //add in a hidden index for the current page (so save and close redirects properly) |
2830 | 2830 | $this->_template_args['save_buttons'] = $referrer_url; |
2831 | 2831 | |
2832 | - foreach ( $button_text as $key => $button ) { |
|
2832 | + foreach ($button_text as $key => $button) { |
|
2833 | 2833 | $ref = $default_names[$key]; |
2834 | - $id = $this->_current_view . '_' . $ref; |
|
2835 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2836 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2837 | - if ( !$both ) break; |
|
2834 | + $id = $this->_current_view.'_'.$ref; |
|
2835 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2836 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2837 | + if ( ! $both) break; |
|
2838 | 2838 | } |
2839 | 2839 | |
2840 | 2840 | } |
@@ -2849,8 +2849,8 @@ discard block |
||
2849 | 2849 | * @param string $route |
2850 | 2850 | * @param array $additional_hidden_fields |
2851 | 2851 | */ |
2852 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2853 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2852 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2853 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2854 | 2854 | } |
2855 | 2855 | |
2856 | 2856 | |
@@ -2863,30 +2863,30 @@ discard block |
||
2863 | 2863 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2864 | 2864 | * @return void |
2865 | 2865 | */ |
2866 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2866 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2867 | 2867 | |
2868 | - if ( empty( $route )) { |
|
2868 | + if (empty($route)) { |
|
2869 | 2869 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2870 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2871 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2870 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2871 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2872 | 2872 | } |
2873 | 2873 | // open form |
2874 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2874 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2875 | 2875 | // add nonce |
2876 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2876 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2877 | 2877 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2878 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2878 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2879 | 2879 | // add REQUIRED form action |
2880 | 2880 | $hidden_fields = array( |
2881 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2881 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2882 | 2882 | ); |
2883 | 2883 | // merge arrays |
2884 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2884 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2885 | 2885 | // generate form fields |
2886 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2886 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2887 | 2887 | // add fields to form |
2888 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2889 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2888 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2889 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2890 | 2890 | } |
2891 | 2891 | |
2892 | 2892 | // close form |
@@ -2903,8 +2903,8 @@ discard block |
||
2903 | 2903 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2904 | 2904 | * @since 4.5.0 |
2905 | 2905 | */ |
2906 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2907 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2906 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2907 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2908 | 2908 | } |
2909 | 2909 | |
2910 | 2910 | |
@@ -2920,38 +2920,38 @@ discard block |
||
2920 | 2920 | * @access protected |
2921 | 2921 | * @return void |
2922 | 2922 | */ |
2923 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2923 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2924 | 2924 | |
2925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2926 | 2926 | |
2927 | 2927 | //class name for actions/filters. |
2928 | 2928 | $classname = get_class($this); |
2929 | 2929 | |
2930 | 2930 | //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 |
2931 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2932 | - $notices = EE_Error::get_notices( FALSE ); |
|
2931 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2932 | + $notices = EE_Error::get_notices(FALSE); |
|
2933 | 2933 | |
2934 | 2934 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2935 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2935 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2936 | 2936 | EE_Error::overwrite_success(); |
2937 | 2937 | } |
2938 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2938 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2939 | 2939 | // how many records affected ? more than one record ? or just one ? |
2940 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2940 | + if ($success > 1 && empty($notices['errors'])) { |
|
2941 | 2941 | // set plural msg |
2942 | 2942 | EE_Error::add_success( |
2943 | 2943 | sprintf( |
2944 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2944 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2945 | 2945 | $what, |
2946 | 2946 | $action_desc |
2947 | 2947 | ), |
2948 | 2948 | __FILE__, __FUNCTION__, __LINE__ |
2949 | 2949 | ); |
2950 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2950 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2951 | 2951 | // set singular msg |
2952 | 2952 | EE_Error::add_success( |
2953 | 2953 | sprintf( |
2954 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2954 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2955 | 2955 | $what, |
2956 | 2956 | $action_desc |
2957 | 2957 | ), |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | } |
2961 | 2961 | } |
2962 | 2962 | // check that $query_args isn't something crazy |
2963 | - if ( ! is_array( $query_args )) { |
|
2963 | + if ( ! is_array($query_args)) { |
|
2964 | 2964 | $query_args = array(); |
2965 | 2965 | } |
2966 | 2966 | |
@@ -2973,36 +2973,36 @@ discard block |
||
2973 | 2973 | * @param array $query_args The original query_args array coming into the |
2974 | 2974 | * method. |
2975 | 2975 | */ |
2976 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2976 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2977 | 2977 | |
2978 | 2978 | //calculate where we're going (if we have a "save and close" button pushed) |
2979 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2979 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2980 | 2980 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2981 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2981 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2982 | 2982 | // regenerate query args array from referrer URL |
2983 | - parse_str( $parsed_url['query'], $query_args ); |
|
2983 | + parse_str($parsed_url['query'], $query_args); |
|
2984 | 2984 | // correct page and action will be in the query args now |
2985 | - $redirect_url = admin_url( 'admin.php' ); |
|
2985 | + $redirect_url = admin_url('admin.php'); |
|
2986 | 2986 | } |
2987 | 2987 | |
2988 | 2988 | //merge any default query_args set in _default_route_query_args property |
2989 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2989 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2990 | 2990 | $args_to_merge = array(); |
2991 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2991 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2992 | 2992 | //is there a wp_referer array in our _default_route_query_args property? |
2993 | - if ( $query_param == 'wp_referer' ) { |
|
2993 | + if ($query_param == 'wp_referer') { |
|
2994 | 2994 | $query_value = (array) $query_value; |
2995 | - foreach ( $query_value as $reference => $value ) { |
|
2996 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2995 | + foreach ($query_value as $reference => $value) { |
|
2996 | + if (strpos($reference, 'nonce') !== false) { |
|
2997 | 2997 | continue; |
2998 | 2998 | } |
2999 | 2999 | |
3000 | 3000 | //finally we will override any arguments in the referer with |
3001 | 3001 | //what might be set on the _default_route_query_args array. |
3002 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
3003 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
3002 | + if (isset($this->_default_route_query_args[$reference])) { |
|
3003 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
3004 | 3004 | } else { |
3005 | - $args_to_merge[$reference] = urlencode( $value ); |
|
3005 | + $args_to_merge[$reference] = urlencode($value); |
|
3006 | 3006 | } |
3007 | 3007 | } |
3008 | 3008 | continue; |
@@ -3013,7 +3013,7 @@ discard block |
||
3013 | 3013 | |
3014 | 3014 | //now let's merge these arguments but override with what was specifically sent in to the |
3015 | 3015 | //redirect. |
3016 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3016 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3017 | 3017 | } |
3018 | 3018 | |
3019 | 3019 | $this->_process_notices($query_args); |
@@ -3022,19 +3022,19 @@ discard block |
||
3022 | 3022 | // generate redirect url |
3023 | 3023 | |
3024 | 3024 | // if redirecting to anything other than the main page, add a nonce |
3025 | - if ( isset( $query_args['action'] )) { |
|
3025 | + if (isset($query_args['action'])) { |
|
3026 | 3026 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3027 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3027 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3028 | 3028 | } |
3029 | 3029 | |
3030 | 3030 | //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). |
3031 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3031 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3032 | 3032 | |
3033 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3033 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3034 | 3034 | |
3035 | 3035 | |
3036 | 3036 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3037 | - if ( defined('DOING_AJAX' ) ) { |
|
3037 | + if (defined('DOING_AJAX')) { |
|
3038 | 3038 | $default_data = array( |
3039 | 3039 | 'close' => TRUE, |
3040 | 3040 | 'redirect_url' => $redirect_url, |
@@ -3043,11 +3043,11 @@ discard block |
||
3043 | 3043 | ); |
3044 | 3044 | |
3045 | 3045 | $this->_template_args['success'] = $success; |
3046 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3046 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3047 | 3047 | $this->_return_json(); |
3048 | 3048 | } |
3049 | 3049 | |
3050 | - wp_safe_redirect( $redirect_url ); |
|
3050 | + wp_safe_redirect($redirect_url); |
|
3051 | 3051 | exit(); |
3052 | 3052 | } |
3053 | 3053 | |
@@ -3063,30 +3063,30 @@ discard block |
||
3063 | 3063 | * @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. |
3064 | 3064 | * @return void |
3065 | 3065 | */ |
3066 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3066 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3067 | 3067 | |
3068 | 3068 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3069 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3070 | - $notices = EE_Error::get_notices( false ); |
|
3071 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3072 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3069 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3070 | + $notices = EE_Error::get_notices(false); |
|
3071 | + if (empty($this->_template_args['success'])) { |
|
3072 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3073 | 3073 | } |
3074 | 3074 | |
3075 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3076 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3075 | + if (empty($this->_template_args['errors'])) { |
|
3076 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3077 | 3077 | } |
3078 | 3078 | |
3079 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3080 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3079 | + if (empty($this->_template_args['attention'])) { |
|
3080 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3081 | 3081 | } |
3082 | 3082 | } |
3083 | 3083 | |
3084 | 3084 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3085 | 3085 | |
3086 | 3086 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3087 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3088 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3089 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3087 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3088 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3089 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3090 | 3090 | } |
3091 | 3091 | } |
3092 | 3092 | |
@@ -3116,7 +3116,7 @@ discard block |
||
3116 | 3116 | $exclude_nonce = false |
3117 | 3117 | ) { |
3118 | 3118 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3119 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3119 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3120 | 3120 | throw new EE_Error( |
3121 | 3121 | sprintf( |
3122 | 3122 | __( |
@@ -3127,7 +3127,7 @@ discard block |
||
3127 | 3127 | ) |
3128 | 3128 | ); |
3129 | 3129 | } |
3130 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3130 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3131 | 3131 | throw new EE_Error( |
3132 | 3132 | sprintf( |
3133 | 3133 | __( |
@@ -3139,8 +3139,8 @@ discard block |
||
3139 | 3139 | ); |
3140 | 3140 | } |
3141 | 3141 | //finally check user access for this button. |
3142 | - $has_access = $this->check_user_access( $action, true ); |
|
3143 | - if ( ! $has_access ) { |
|
3142 | + $has_access = $this->check_user_access($action, true); |
|
3143 | + if ( ! $has_access) { |
|
3144 | 3144 | return ''; |
3145 | 3145 | } |
3146 | 3146 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3148,11 +3148,11 @@ discard block |
||
3148 | 3148 | 'action' => $action |
3149 | 3149 | ); |
3150 | 3150 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3151 | - if ( ! empty( $extra_request ) ) { |
|
3152 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3151 | + if ( ! empty($extra_request)) { |
|
3152 | + $query_args = array_merge($extra_request, $query_args); |
|
3153 | 3153 | } |
3154 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3155 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3154 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3155 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | |
@@ -3167,11 +3167,11 @@ discard block |
||
3167 | 3167 | $args = array( |
3168 | 3168 | 'label' => $this->_admin_page_title, |
3169 | 3169 | 'default' => 10, |
3170 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3170 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3171 | 3171 | ); |
3172 | 3172 | //ONLY add the screen option if the user has access to it. |
3173 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3174 | - add_screen_option( $option, $args ); |
|
3173 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3174 | + add_screen_option($option, $args); |
|
3175 | 3175 | } |
3176 | 3176 | } |
3177 | 3177 | |
@@ -3187,36 +3187,36 @@ discard block |
||
3187 | 3187 | * @return void |
3188 | 3188 | */ |
3189 | 3189 | private function _set_per_page_screen_options() { |
3190 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3191 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3190 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3191 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3192 | 3192 | |
3193 | - if ( !$user = wp_get_current_user() ) |
|
3193 | + if ( ! $user = wp_get_current_user()) |
|
3194 | 3194 | return; |
3195 | 3195 | $option = $_POST['wp_screen_options']['option']; |
3196 | 3196 | $value = $_POST['wp_screen_options']['value']; |
3197 | 3197 | |
3198 | - if ( $option != sanitize_key( $option ) ) |
|
3198 | + if ($option != sanitize_key($option)) |
|
3199 | 3199 | return; |
3200 | 3200 | |
3201 | 3201 | $map_option = $option; |
3202 | 3202 | |
3203 | 3203 | $option = str_replace('-', '_', $option); |
3204 | 3204 | |
3205 | - switch ( $map_option ) { |
|
3206 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3205 | + switch ($map_option) { |
|
3206 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3207 | 3207 | $value = (int) $value; |
3208 | - if ( $value < 1 || $value > 999 ) |
|
3208 | + if ($value < 1 || $value > 999) |
|
3209 | 3209 | return; |
3210 | 3210 | break; |
3211 | 3211 | default: |
3212 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3213 | - if ( false === $value ) |
|
3212 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3213 | + if (false === $value) |
|
3214 | 3214 | return; |
3215 | 3215 | break; |
3216 | 3216 | } |
3217 | 3217 | |
3218 | 3218 | update_user_meta($user->ID, $option, $value); |
3219 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3219 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3220 | 3220 | exit; |
3221 | 3221 | } |
3222 | 3222 | } |
@@ -3227,8 +3227,8 @@ discard block |
||
3227 | 3227 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3228 | 3228 | * @param array $data array that will be assigned to template args. |
3229 | 3229 | */ |
3230 | - public function set_template_args( $data ) { |
|
3231 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3230 | + public function set_template_args($data) { |
|
3231 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3232 | 3232 | } |
3233 | 3233 | |
3234 | 3234 | |
@@ -3244,26 +3244,26 @@ discard block |
||
3244 | 3244 | * @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. |
3245 | 3245 | * @return void |
3246 | 3246 | */ |
3247 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3247 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3248 | 3248 | $user_id = get_current_user_id(); |
3249 | 3249 | |
3250 | - if ( !$skip_route_verify ) |
|
3250 | + if ( ! $skip_route_verify) |
|
3251 | 3251 | $this->_verify_route($route); |
3252 | 3252 | |
3253 | 3253 | |
3254 | 3254 | //now let's set the string for what kind of transient we're setting |
3255 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3256 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3255 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3256 | + $data = $notices ? array('notices' => $data) : $data; |
|
3257 | 3257 | //is there already a transient for this route? If there is then let's ADD to that transient |
3258 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3259 | - if ( $existing ) { |
|
3260 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3258 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3259 | + if ($existing) { |
|
3260 | + $data = array_merge((array) $data, (array) $existing); |
|
3261 | 3261 | } |
3262 | 3262 | |
3263 | - if ( is_multisite() && is_network_admin() ) { |
|
3264 | - set_site_transient( $transient, $data, 8 ); |
|
3263 | + if (is_multisite() && is_network_admin()) { |
|
3264 | + set_site_transient($transient, $data, 8); |
|
3265 | 3265 | } else { |
3266 | - set_transient( $transient, $data, 8 ); |
|
3266 | + set_transient($transient, $data, 8); |
|
3267 | 3267 | } |
3268 | 3268 | } |
3269 | 3269 | |
@@ -3275,18 +3275,18 @@ discard block |
||
3275 | 3275 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3276 | 3276 | * @return mixed data |
3277 | 3277 | */ |
3278 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3278 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3279 | 3279 | $user_id = get_current_user_id(); |
3280 | - $route = !$route ? $this->_req_action : $route; |
|
3281 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3282 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3280 | + $route = ! $route ? $this->_req_action : $route; |
|
3281 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3282 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3283 | 3283 | //delete transient after retrieval (just in case it hasn't expired); |
3284 | - if ( is_multisite() && is_network_admin() ) { |
|
3285 | - delete_site_transient( $transient ); |
|
3284 | + if (is_multisite() && is_network_admin()) { |
|
3285 | + delete_site_transient($transient); |
|
3286 | 3286 | } else { |
3287 | - delete_transient( $transient ); |
|
3287 | + delete_transient($transient); |
|
3288 | 3288 | } |
3289 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3289 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3290 | 3290 | } |
3291 | 3291 | |
3292 | 3292 | |
@@ -3303,12 +3303,12 @@ discard block |
||
3303 | 3303 | |
3304 | 3304 | //retrieve all existing transients |
3305 | 3305 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3306 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3307 | - foreach ( $results as $result ) { |
|
3308 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3309 | - get_transient( $transient ); |
|
3310 | - if ( is_multisite() && is_network_admin() ) { |
|
3311 | - get_site_transient( $transient ); |
|
3306 | + if ($results = $wpdb->get_results($query)) { |
|
3307 | + foreach ($results as $result) { |
|
3308 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3309 | + get_transient($transient); |
|
3310 | + if (is_multisite() && is_network_admin()) { |
|
3311 | + get_site_transient($transient); |
|
3312 | 3312 | } |
3313 | 3313 | } |
3314 | 3314 | } |
@@ -3458,23 +3458,23 @@ discard block |
||
3458 | 3458 | * @param string $line line no where error occurred |
3459 | 3459 | * @return boolean |
3460 | 3460 | */ |
3461 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3461 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3462 | 3462 | |
3463 | 3463 | //remove any options that are NOT going to be saved with the config settings. |
3464 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3464 | + if (isset($config->core->ee_ueip_optin)) { |
|
3465 | 3465 | $config->core->ee_ueip_has_notified = TRUE; |
3466 | 3466 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3467 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3468 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3467 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3468 | + update_option('ee_ueip_has_notified', TRUE); |
|
3469 | 3469 | } |
3470 | 3470 | // and save it (note we're also doing the network save here) |
3471 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3472 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3473 | - if ( $config_saved && $net_saved ) { |
|
3474 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3471 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3472 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3473 | + if ($config_saved && $net_saved) { |
|
3474 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3475 | 3475 | return TRUE; |
3476 | 3476 | } else { |
3477 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3477 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3478 | 3478 | return FALSE; |
3479 | 3479 | } |
3480 | 3480 | } |
@@ -3487,7 +3487,7 @@ discard block |
||
3487 | 3487 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3488 | 3488 | * @return array |
3489 | 3489 | */ |
3490 | - public function get_yes_no_values(){ |
|
3490 | + public function get_yes_no_values() { |
|
3491 | 3491 | return $this->_yes_no_values; |
3492 | 3492 | } |
3493 | 3493 | |
@@ -3509,8 +3509,8 @@ discard block |
||
3509 | 3509 | * |
3510 | 3510 | * @return string |
3511 | 3511 | */ |
3512 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3513 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3512 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3513 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3514 | 3514 | } |
3515 | 3515 | |
3516 | 3516 | |
@@ -3524,8 +3524,8 @@ discard block |
||
3524 | 3524 | * |
3525 | 3525 | * @return string |
3526 | 3526 | */ |
3527 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3528 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3527 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3528 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3529 | 3529 | } |
3530 | 3530 | |
3531 | 3531 | |
@@ -3544,8 +3544,8 @@ discard block |
||
3544 | 3544 | * @return bool success/fail |
3545 | 3545 | */ |
3546 | 3546 | protected function _process_resend_registration() { |
3547 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3548 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3547 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3548 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3549 | 3549 | return $this->_template_args['success']; |
3550 | 3550 | } |
3551 | 3551 | |
@@ -3558,11 +3558,11 @@ discard block |
||
3558 | 3558 | * @param \EE_Payment $payment |
3559 | 3559 | * @return bool success/fail |
3560 | 3560 | */ |
3561 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3562 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3563 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3564 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3565 | - return $this->_template_args[ 'success' ]; |
|
3561 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3562 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3563 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3564 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3565 | + return $this->_template_args['success']; |
|
3566 | 3566 | } |
3567 | 3567 | |
3568 | 3568 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -160,8 +162,9 @@ discard block |
||
160 | 162 | */ |
161 | 163 | public function __construct( $routing = TRUE ) { |
162 | 164 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
164 | - $this->_is_caf = TRUE; |
|
165 | + if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) { |
|
166 | + $this->_is_caf = TRUE; |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $this->_yes_no_values = array( |
167 | 170 | array('id' => TRUE, 'text' => __('Yes', 'event_espresso')), |
@@ -192,8 +195,9 @@ discard block |
||
192 | 195 | $this->_do_other_page_hooks(); |
193 | 196 | |
194 | 197 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
196 | - $this->_before_page_setup(); |
|
198 | + if ( method_exists( $this, '_before_page_setup' ) ) { |
|
199 | + $this->_before_page_setup(); |
|
200 | + } |
|
197 | 201 | |
198 | 202 | //set up page dependencies |
199 | 203 | $this->_page_setup(); |
@@ -500,7 +504,9 @@ discard block |
||
500 | 504 | global $ee_menu_slugs; |
501 | 505 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 506 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
507 | + if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) { |
|
508 | + return FALSE; |
|
509 | + } |
|
504 | 510 | |
505 | 511 | |
506 | 512 | // 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 |
@@ -535,12 +541,14 @@ discard block |
||
535 | 541 | } |
536 | 542 | |
537 | 543 | //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 |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
539 | - $this->_extend_page_config(); |
|
544 | + if ( method_exists( $this, '_extend_page_config' ) ) { |
|
545 | + $this->_extend_page_config(); |
|
546 | + } |
|
540 | 547 | |
541 | 548 | //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. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
543 | - $this->_extend_page_config_for_cpt(); |
|
549 | + if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) { |
|
550 | + $this->_extend_page_config_for_cpt(); |
|
551 | + } |
|
544 | 552 | |
545 | 553 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | 554 | $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
@@ -656,8 +664,9 @@ discard block |
||
656 | 664 | //add screen options - global, page child class, and view specific |
657 | 665 | $this->_add_global_screen_options(); |
658 | 666 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
667 | + if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) { |
|
668 | + call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
669 | + } |
|
661 | 670 | |
662 | 671 | |
663 | 672 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,28 +677,32 @@ discard block |
||
668 | 677 | //add feature_pointers - global, page child class, and view specific |
669 | 678 | $this->_add_feature_pointers(); |
670 | 679 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
680 | + if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) { |
|
681 | + call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
682 | + } |
|
673 | 683 | |
674 | 684 | //enqueue scripts/styles - global, page class, and view specific |
675 | 685 | add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
676 | 686 | add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
687 | + if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) { |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
689 | + } |
|
679 | 690 | |
680 | 691 | add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
681 | 692 | |
682 | 693 | //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 |
683 | 694 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
684 | 695 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
696 | + if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) { |
|
697 | + add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
698 | + } |
|
687 | 699 | |
688 | 700 | //admin footer scripts |
689 | 701 | add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
690 | 702 | add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
703 | + if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) { |
|
704 | + add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
705 | + } |
|
693 | 706 | |
694 | 707 | |
695 | 708 | do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
@@ -762,7 +775,9 @@ discard block |
||
762 | 775 | protected function _verify_routes() { |
763 | 776 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
764 | 777 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
778 | + if ( !$this->_current_page && !defined( 'DOING_AJAX')) { |
|
779 | + return FALSE; |
|
780 | + } |
|
766 | 781 | |
767 | 782 | $this->_route = FALSE; |
768 | 783 | $func = FALSE; |
@@ -872,8 +887,9 @@ discard block |
||
872 | 887 | * @return void |
873 | 888 | */ |
874 | 889 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
876 | - $this->_verify_routes(); |
|
890 | + if ( ! $this->_is_UI_request ) { |
|
891 | + $this->_verify_routes(); |
|
892 | + } |
|
877 | 893 | |
878 | 894 | $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
879 | 895 | |
@@ -883,8 +899,9 @@ discard block |
||
883 | 899 | $this->_verify_nonce( $nonce, $this->_req_nonce ); |
884 | 900 | } |
885 | 901 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
887 | - $this->_set_nav_tabs(); |
|
902 | + if ( $this->_is_UI_request ) { |
|
903 | + $this->_set_nav_tabs(); |
|
904 | + } |
|
888 | 905 | |
889 | 906 | // grab callback function |
890 | 907 | $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
@@ -921,8 +938,9 @@ discard block |
||
921 | 938 | } |
922 | 939 | |
923 | 940 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
941 | + if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) { |
|
942 | + throw new EE_Error( $error_msg ); |
|
943 | + } |
|
926 | 944 | } |
927 | 945 | |
928 | 946 | //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. |
@@ -1049,8 +1067,9 @@ discard block |
||
1049 | 1067 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | 1068 | foreach ( $this->_help_tour['tours'] as $tour ) { |
1051 | 1069 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1053 | - continue; |
|
1070 | + if ( $tour instanceof EE_Help_Tour_final_stop ) { |
|
1071 | + continue; |
|
1072 | + } |
|
1054 | 1073 | $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
1055 | 1074 | } |
1056 | 1075 | $tour_buttons .= implode('<br />', $tb); |
@@ -1060,8 +1079,9 @@ discard block |
||
1060 | 1079 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | 1080 | if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
1062 | 1081 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - 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) ) ); |
|
1082 | + if ( !method_exists($this, $config['help_sidebar'] ) ) { |
|
1083 | + 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) ) ); |
|
1084 | + } |
|
1065 | 1085 | |
1066 | 1086 | $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
1067 | 1087 | |
@@ -1085,18 +1105,23 @@ discard block |
||
1085 | 1105 | }/**/ |
1086 | 1106 | |
1087 | 1107 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1108 | + if ( !isset( $config['help_tabs'] ) ) { |
|
1109 | + return; |
|
1110 | + } |
|
1111 | + //no help tabs for this route |
|
1089 | 1112 | |
1090 | 1113 | foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
1091 | 1114 | //we're here so there ARE help tabs! |
1092 | 1115 | |
1093 | 1116 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1117 | + if ( !isset( $cfg['title'] ) ) { |
|
1118 | + throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1119 | + } |
|
1096 | 1120 | |
1097 | 1121 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - 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') ); |
|
1122 | + if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) { |
|
1123 | + 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') ); |
|
1124 | + } |
|
1100 | 1125 | |
1101 | 1126 | |
1102 | 1127 | |
@@ -1159,14 +1184,16 @@ discard block |
||
1159 | 1184 | $this->_help_tour = array(); |
1160 | 1185 | |
1161 | 1186 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1163 | - return; |
|
1187 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) { |
|
1188 | + return; |
|
1189 | + } |
|
1164 | 1190 | |
1165 | 1191 | //loop through _page_config to find any help_tour defined |
1166 | 1192 | foreach ( $this->_page_config as $route => $config ) { |
1167 | 1193 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1169 | - continue; |
|
1194 | + if ( $route !== $this->_req_action ) { |
|
1195 | + continue; |
|
1196 | + } |
|
1170 | 1197 | |
1171 | 1198 | if ( isset( $config['help_tour'] ) ) { |
1172 | 1199 | |
@@ -1201,8 +1228,9 @@ discard block |
||
1201 | 1228 | } |
1202 | 1229 | } |
1203 | 1230 | |
1204 | - if ( !empty( $tours ) ) |
|
1205 | - $this->_help_tour['tours'] = $tours; |
|
1231 | + if ( !empty( $tours ) ) { |
|
1232 | + $this->_help_tour['tours'] = $tours; |
|
1233 | + } |
|
1206 | 1234 | |
1207 | 1235 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
1208 | 1236 | } |
@@ -1242,15 +1270,21 @@ discard block |
||
1242 | 1270 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1243 | 1271 | $i = 0; |
1244 | 1272 | foreach ( $this->_page_config as $slug => $config ) { |
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1246 | - continue; //no nav tab for this config |
|
1273 | + if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) { |
|
1274 | + continue; |
|
1275 | + } |
|
1276 | + //no nav tab for this config |
|
1247 | 1277 | |
1248 | 1278 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1250 | - continue; //nav tab is only to appear when route requested. |
|
1279 | + if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) { |
|
1280 | + continue; |
|
1281 | + } |
|
1282 | + //nav tab is only to appear when route requested. |
|
1251 | 1283 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1253 | - continue; //no nav tab becasue current user does not have access. |
|
1284 | + if ( ! $this->check_user_access( $slug, TRUE ) ) { |
|
1285 | + continue; |
|
1286 | + } |
|
1287 | + //no nav tab becasue current user does not have access. |
|
1254 | 1288 | |
1255 | 1289 | $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
1256 | 1290 | $this->_nav_tabs[$slug] = array( |
@@ -1486,10 +1520,11 @@ discard block |
||
1486 | 1520 | $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
1487 | 1521 | } |
1488 | 1522 | |
1489 | - if ( $display ) |
|
1490 | - echo $content; |
|
1491 | - else |
|
1492 | - return $content; |
|
1523 | + if ( $display ) { |
|
1524 | + echo $content; |
|
1525 | + } else { |
|
1526 | + return $content; |
|
1527 | + } |
|
1493 | 1528 | } |
1494 | 1529 | |
1495 | 1530 | |
@@ -1506,8 +1541,9 @@ discard block |
||
1506 | 1541 | $method_name = '_help_popup_content_' . $this->_req_action; |
1507 | 1542 | |
1508 | 1543 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1510 | - return array(); |
|
1544 | + if ( !method_exists( $this, $method_name ) ) { |
|
1545 | + return array(); |
|
1546 | + } |
|
1511 | 1547 | |
1512 | 1548 | //k we're good to go let's retrieve the help array |
1513 | 1549 | $help_array = call_user_func( array( $this, $method_name ) ); |
@@ -1538,7 +1574,9 @@ discard block |
||
1538 | 1574 | */ |
1539 | 1575 | protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
1540 | 1576 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1577 | + if ( defined('DOING_AJAX') ) { |
|
1578 | + return; |
|
1579 | + } |
|
1542 | 1580 | |
1543 | 1581 | //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 |
1544 | 1582 | $help_array = $this->_get_help_content(); |
@@ -1556,10 +1594,11 @@ discard block |
||
1556 | 1594 | $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>'; |
1557 | 1595 | $content = $content . $help_content; |
1558 | 1596 | |
1559 | - if ( $display ) |
|
1560 | - echo $content; |
|
1561 | - else |
|
1562 | - return $content; |
|
1597 | + if ( $display ) { |
|
1598 | + echo $content; |
|
1599 | + } else { |
|
1600 | + return $content; |
|
1601 | + } |
|
1563 | 1602 | } |
1564 | 1603 | |
1565 | 1604 | |
@@ -1785,8 +1824,10 @@ discard block |
||
1785 | 1824 | protected function _set_list_table() { |
1786 | 1825 | |
1787 | 1826 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1789 | - return; //not a list_table view so get out. |
|
1827 | + if ( !isset($this->_route_config['list_table']) ) { |
|
1828 | + return; |
|
1829 | + } |
|
1830 | + //not a list_table view so get out. |
|
1790 | 1831 | |
1791 | 1832 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1833 | |
@@ -2152,8 +2193,9 @@ discard block |
||
2152 | 2193 | protected function _espresso_sponsors_post_box() { |
2153 | 2194 | |
2154 | 2195 | $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
2155 | - if ( $show_sponsors ) |
|
2156 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2196 | + if ( $show_sponsors ) { |
|
2197 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2198 | + } |
|
2157 | 2199 | } |
2158 | 2200 | |
2159 | 2201 | |
@@ -2599,10 +2641,11 @@ discard block |
||
2599 | 2641 | true |
2600 | 2642 | ); |
2601 | 2643 | // the final template wrapper |
2602 | - if ( $sidebar ) |
|
2603 | - $this->display_admin_page_with_sidebar(); |
|
2604 | - else |
|
2605 | - $this->display_admin_page_with_no_sidebar(); |
|
2644 | + if ( $sidebar ) { |
|
2645 | + $this->display_admin_page_with_sidebar(); |
|
2646 | + } else { |
|
2647 | + $this->display_admin_page_with_no_sidebar(); |
|
2648 | + } |
|
2606 | 2649 | } |
2607 | 2650 | |
2608 | 2651 | |
@@ -2670,8 +2713,9 @@ discard block |
||
2670 | 2713 | |
2671 | 2714 | |
2672 | 2715 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2674 | - header('Content-Type: application/json; charset=UTF-8'); |
|
2716 | + if ( NULL === error_get_last() || ! headers_sent() ) { |
|
2717 | + header('Content-Type: application/json; charset=UTF-8'); |
|
2718 | + } |
|
2675 | 2719 | if( function_exists( 'wp_json_encode' ) ) { |
2676 | 2720 | echo wp_json_encode( $json ); |
2677 | 2721 | } else { |
@@ -2689,10 +2733,9 @@ discard block |
||
2689 | 2733 | * @throws EE_Error |
2690 | 2734 | */ |
2691 | 2735 | public function return_json() { |
2692 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2693 | - $this->_return_json(); |
|
2694 | - |
|
2695 | - else { |
|
2736 | + if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2737 | + $this->_return_json(); |
|
2738 | + } else { |
|
2696 | 2739 | throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
2697 | 2740 | } |
2698 | 2741 | } |
@@ -2834,7 +2877,9 @@ discard block |
||
2834 | 2877 | $id = $this->_current_view . '_' . $ref; |
2835 | 2878 | $name = !empty($actions) ? $actions[$key] : $ref; |
2836 | 2879 | $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
2837 | - if ( !$both ) break; |
|
2880 | + if ( !$both ) { |
|
2881 | + break; |
|
2882 | + } |
|
2838 | 2883 | } |
2839 | 2884 | |
2840 | 2885 | } |
@@ -3190,13 +3235,15 @@ discard block |
||
3190 | 3235 | if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
3191 | 3236 | check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
3192 | 3237 | |
3193 | - if ( !$user = wp_get_current_user() ) |
|
3194 | - return; |
|
3238 | + if ( !$user = wp_get_current_user() ) { |
|
3239 | + return; |
|
3240 | + } |
|
3195 | 3241 | $option = $_POST['wp_screen_options']['option']; |
3196 | 3242 | $value = $_POST['wp_screen_options']['value']; |
3197 | 3243 | |
3198 | - if ( $option != sanitize_key( $option ) ) |
|
3199 | - return; |
|
3244 | + if ( $option != sanitize_key( $option ) ) { |
|
3245 | + return; |
|
3246 | + } |
|
3200 | 3247 | |
3201 | 3248 | $map_option = $option; |
3202 | 3249 | |
@@ -3205,13 +3252,15 @@ discard block |
||
3205 | 3252 | switch ( $map_option ) { |
3206 | 3253 | case $this->_current_page . '_' . $this->_current_view . '_per_page': |
3207 | 3254 | $value = (int) $value; |
3208 | - if ( $value < 1 || $value > 999 ) |
|
3209 | - return; |
|
3255 | + if ( $value < 1 || $value > 999 ) { |
|
3256 | + return; |
|
3257 | + } |
|
3210 | 3258 | break; |
3211 | 3259 | default: |
3212 | 3260 | $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
3213 | - if ( false === $value ) |
|
3214 | - return; |
|
3261 | + if ( false === $value ) { |
|
3262 | + return; |
|
3263 | + } |
|
3215 | 3264 | break; |
3216 | 3265 | } |
3217 | 3266 | |
@@ -3247,8 +3296,9 @@ discard block |
||
3247 | 3296 | protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
3248 | 3297 | $user_id = get_current_user_id(); |
3249 | 3298 | |
3250 | - if ( !$skip_route_verify ) |
|
3251 | - $this->_verify_route($route); |
|
3299 | + if ( !$skip_route_verify ) { |
|
3300 | + $this->_verify_route($route); |
|
3301 | + } |
|
3252 | 3302 | |
3253 | 3303 | |
3254 | 3304 | //now let's set the string for what kind of transient we're setting |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
2194 | 2194 | // get country code from organization settings or use default |
2195 | 2195 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2196 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2196 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
@@ -2907,8 +2907,8 @@ discard block |
||
2907 | 2907 | */ |
2908 | 2908 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2909 | 2909 | if ( ! empty( $this->php->max_input_vars ) |
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2910 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -2952,22 +2952,22 @@ discard block |
||
2952 | 2952 | class EE_Tax_Config extends EE_Config_Base |
2953 | 2953 | { |
2954 | 2954 | |
2955 | - /* |
|
2955 | + /* |
|
2956 | 2956 | * flag to indicate whether or not to display ticket prices with the taxes included |
2957 | 2957 | * |
2958 | 2958 | * @var boolean $prices_displayed_including_taxes |
2959 | 2959 | */ |
2960 | - public $prices_displayed_including_taxes; |
|
2960 | + public $prices_displayed_including_taxes; |
|
2961 | 2961 | |
2962 | 2962 | |
2963 | 2963 | |
2964 | - /** |
|
2965 | - * class constructor |
|
2966 | - */ |
|
2967 | - public function __construct() |
|
2968 | - { |
|
2969 | - $this->prices_displayed_including_taxes = true; |
|
2970 | - } |
|
2964 | + /** |
|
2965 | + * class constructor |
|
2966 | + */ |
|
2967 | + public function __construct() |
|
2968 | + { |
|
2969 | + $this->prices_displayed_including_taxes = true; |
|
2970 | + } |
|
2971 | 2971 | } |
2972 | 2972 | |
2973 | 2973 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -148,20 +148,20 @@ discard block |
||
148 | 148 | * site was put into maintenance mode) |
149 | 149 | * @return EE_Config |
150 | 150 | */ |
151 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
152 | - if ( $hard_reset ) { |
|
151 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
152 | + if ($hard_reset) { |
|
153 | 153 | self::$_instance->_addon_option_names = array(); |
154 | 154 | self::$_instance->_initialize_config(); |
155 | 155 | self::$_instance->update_espresso_config(); |
156 | 156 | } |
157 | - if ( self::$_instance instanceof EE_Config ) { |
|
157 | + if (self::$_instance instanceof EE_Config) { |
|
158 | 158 | self::$_instance->update_addon_option_names(); |
159 | 159 | } |
160 | 160 | self::$_instance = null; |
161 | 161 | //we don't need to reset the static properties imo because those should |
162 | 162 | //only change when a module is added or removed. Currently we don't |
163 | 163 | //support removing a module during a request when it previously existed |
164 | - if ( $reinstantiate ) { |
|
164 | + if ($reinstantiate) { |
|
165 | 165 | return self::instance(); |
166 | 166 | } else { |
167 | 167 | return null; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @access private |
177 | 177 | */ |
178 | 178 | private function __construct() { |
179 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
179 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
180 | 180 | // setup empty config classes |
181 | 181 | $this->_initialize_config(); |
182 | 182 | // load existing EE site settings |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | // register shortcodes and modules |
187 | 187 | add_action( |
188 | 188 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
189 | - array( $this, 'register_shortcodes_and_modules' ), |
|
189 | + array($this, 'register_shortcodes_and_modules'), |
|
190 | 190 | 999 |
191 | 191 | ); |
192 | 192 | // initialize shortcodes and modules |
193 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
193 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
194 | 194 | // register widgets |
195 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
195 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
196 | 196 | // shutdown |
197 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
197 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
198 | 198 | // construct__end hook |
199 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
199 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
200 | 200 | // hardcoded hack |
201 | 201 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
202 | 202 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string current theme set. |
210 | 210 | */ |
211 | 211 | public static function get_current_theme() { |
212 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
212 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
213 | 213 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private function _initialize_config() { |
225 | 225 | EE_Config::trim_log(); |
226 | 226 | //set defaults |
227 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
227 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
228 | 228 | $this->addons = new stdClass(); |
229 | 229 | // set _module_route_map |
230 | 230 | EE_Config::$_module_route_map = array(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | */ |
245 | 245 | private function _load_core_config() { |
246 | 246 | // load_core_config__start hook |
247 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
247 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
248 | 248 | $espresso_config = $this->get_espresso_config(); |
249 | - foreach ( $espresso_config as $config => $settings ) { |
|
249 | + foreach ($espresso_config as $config => $settings) { |
|
250 | 250 | // load_core_config__start hook |
251 | 251 | $settings = apply_filters( |
252 | 252 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -254,22 +254,22 @@ discard block |
||
254 | 254 | $config, |
255 | 255 | $this |
256 | 256 | ); |
257 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
258 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
257 | + if (is_object($settings) && property_exists($this, $config)) { |
|
258 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
259 | 259 | //call configs populate method to ensure any defaults are set for empty values. |
260 | - if ( method_exists( $settings, 'populate' ) ) { |
|
260 | + if (method_exists($settings, 'populate')) { |
|
261 | 261 | $this->{$config}->populate(); |
262 | 262 | } |
263 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
263 | + if (method_exists($settings, 'do_hooks')) { |
|
264 | 264 | $this->{$config}->do_hooks(); |
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
268 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
269 | 269 | $this->update_espresso_config(); |
270 | 270 | } |
271 | 271 | // load_core_config__end hook |
272 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
272 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | $this->core = $this->core instanceof EE_Core_Config |
285 | 285 | ? $this->core |
286 | 286 | : new EE_Core_Config(); |
287 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
287 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
288 | 288 | $this->organization = $this->organization instanceof EE_Organization_Config |
289 | 289 | ? $this->organization |
290 | 290 | : new EE_Organization_Config(); |
291 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
291 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
292 | 292 | $this->currency = $this->currency instanceof EE_Currency_Config |
293 | 293 | ? $this->currency |
294 | 294 | : new EE_Currency_Config(); |
295 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
295 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
296 | 296 | $this->registration = $this->registration instanceof EE_Registration_Config |
297 | 297 | ? $this->registration |
298 | 298 | : new EE_Registration_Config(); |
299 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
299 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
300 | 300 | $this->admin = $this->admin instanceof EE_Admin_Config |
301 | 301 | ? $this->admin |
302 | 302 | : new EE_Admin_Config(); |
303 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
303 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
304 | 304 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
305 | 305 | ? $this->template_settings |
306 | 306 | : new EE_Template_Config(); |
@@ -311,19 +311,19 @@ discard block |
||
311 | 311 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
312 | 312 | ? $this->map_settings |
313 | 313 | : new EE_Map_Config(); |
314 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
314 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
315 | 315 | $this->environment = $this->environment instanceof EE_Environment_Config |
316 | 316 | ? $this->environment |
317 | 317 | : new EE_Environment_Config(); |
318 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
318 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
319 | 319 | $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config |
320 | 320 | ? $this->tax_settings |
321 | 321 | : new EE_Tax_Config(); |
322 | - $this->tax_settings = apply_filters( 'FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings ); |
|
322 | + $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings', $this->tax_settings); |
|
323 | 323 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
324 | 324 | ? $this->gateway |
325 | 325 | : new EE_Gateway_Config(); |
326 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
326 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // grab espresso configuration |
339 | 339 | return apply_filters( |
340 | 340 | 'FHEE__EE_Config__get_espresso_config__CFG', |
341 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
341 | + get_option(EE_Config::OPTION_NAME, array()) |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param $old_value |
353 | 353 | * @param $value |
354 | 354 | */ |
355 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
355 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
356 | 356 | // make sure we're checking the ee config |
357 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
357 | + if ($option === EE_Config::OPTION_NAME) { |
|
358 | 358 | // run a loose comparison of the old value against the new value for type and properties, |
359 | 359 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
360 | - if ( $value != $old_value ) { |
|
360 | + if ($value != $old_value) { |
|
361 | 361 | // if they are NOT the same, then remove the hook, |
362 | 362 | // which means the subsequent update results will be based solely on the update query results |
363 | 363 | // the reason we do this is because, as stated above, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // the string it sees in the db looks the same as the new one it has been passed!!! |
373 | 373 | // This results in the query returning an "affected rows" value of ZERO, |
374 | 374 | // which gets returned immediately by WP update_option and looks like an error. |
375 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
375 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | } |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function _reset_espresso_addon_config() { |
388 | 388 | $this->_addon_option_names = array(); |
389 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
390 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
391 | - $config_class = get_class( $addon_config_obj ); |
|
392 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
393 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
389 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
390 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
391 | + $config_class = get_class($addon_config_obj); |
|
392 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
393 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
394 | 394 | } |
395 | 395 | $this->addons->{$addon_name} = null; |
396 | 396 | } |
@@ -406,22 +406,22 @@ discard block |
||
406 | 406 | * @param bool $add_error |
407 | 407 | * @return bool |
408 | 408 | */ |
409 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
409 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
410 | 410 | // don't allow config updates during WP heartbeats |
411 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
411 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
415 | 415 | //$clone = clone( self::$_instance ); |
416 | 416 | //self::$_instance = NULL; |
417 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
417 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
418 | 418 | $this->_reset_espresso_addon_config(); |
419 | 419 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
420 | 420 | // but BEFORE the actual update occurs |
421 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
421 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
422 | 422 | // now update "ee_config" |
423 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
424 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
423 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
424 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
425 | 425 | // if not saved... check if the hook we just added still exists; |
426 | 426 | // if it does, it means one of two things: |
427 | 427 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | // but just means no update occurred, so don't display an error to the user. |
433 | 433 | // BUT... if update_option returns FALSE, AND the hook is missing, |
434 | 434 | // then it means that something truly went wrong |
435 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
435 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
436 | 436 | // remove our action since we don't want it in the system anymore |
437 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
438 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
437 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
438 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
439 | 439 | //self::$_instance = $clone; |
440 | 440 | //unset( $clone ); |
441 | 441 | // if config remains the same or was updated successfully |
442 | - if ( $saved ) { |
|
443 | - if ( $add_success ) { |
|
442 | + if ($saved) { |
|
443 | + if ($add_success) { |
|
444 | 444 | EE_Error::add_success( |
445 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
445 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
446 | 446 | __FILE__, |
447 | 447 | __FUNCTION__, |
448 | 448 | __LINE__ |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | } |
451 | 451 | return true; |
452 | 452 | } else { |
453 | - if ( $add_error ) { |
|
453 | + if ($add_error) { |
|
454 | 454 | EE_Error::add_error( |
455 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
455 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
456 | 456 | __FILE__, |
457 | 457 | __FUNCTION__, |
458 | 458 | __LINE__ |
@@ -481,16 +481,16 @@ discard block |
||
481 | 481 | $name = '', |
482 | 482 | $config_class = '', |
483 | 483 | $config_obj = null, |
484 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
484 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
485 | 485 | $display_errors = true |
486 | 486 | ) { |
487 | 487 | try { |
488 | - foreach ( $tests_to_run as $test ) { |
|
489 | - switch ( $test ) { |
|
488 | + foreach ($tests_to_run as $test) { |
|
489 | + switch ($test) { |
|
490 | 490 | // TEST #1 : check that section was set |
491 | 491 | case 1 : |
492 | - if ( empty( $section ) ) { |
|
493 | - if ( $display_errors ) { |
|
492 | + if (empty($section)) { |
|
493 | + if ($display_errors) { |
|
494 | 494 | throw new EE_Error( |
495 | 495 | sprintf( |
496 | 496 | __( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | break; |
507 | 507 | // TEST #2 : check that settings section exists |
508 | 508 | case 2 : |
509 | - if ( ! isset( $this->{$section} ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if ( ! isset($this->{$section} )) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | 512 | sprintf( |
513 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
513 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
514 | 514 | $section |
515 | 515 | ) |
516 | 516 | ); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | // TEST #3 : check that section is the proper format |
522 | 522 | case 3 : |
523 | 523 | if ( |
524 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
524 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
525 | 525 | ) { |
526 | - if ( $display_errors ) { |
|
526 | + if ($display_errors) { |
|
527 | 527 | throw new EE_Error( |
528 | 528 | sprintf( |
529 | 529 | __( |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | break; |
540 | 540 | // TEST #4 : check that config section name has been set |
541 | 541 | case 4 : |
542 | - if ( empty( $name ) ) { |
|
543 | - if ( $display_errors ) { |
|
542 | + if (empty($name)) { |
|
543 | + if ($display_errors) { |
|
544 | 544 | throw new EE_Error( |
545 | 545 | __( |
546 | 546 | 'No name has been provided for the specific configuration section.', |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | break; |
554 | 554 | // TEST #5 : check that a config class name has been set |
555 | 555 | case 5 : |
556 | - if ( empty( $config_class ) ) { |
|
557 | - if ( $display_errors ) { |
|
556 | + if (empty($config_class)) { |
|
557 | + if ($display_errors) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | __( |
560 | 560 | 'No class name has been provided for the specific configuration section.', |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | break; |
568 | 568 | // TEST #6 : verify config class is accessible |
569 | 569 | case 6 : |
570 | - if ( ! class_exists( $config_class ) ) { |
|
571 | - if ( $display_errors ) { |
|
570 | + if ( ! class_exists($config_class)) { |
|
571 | + if ($display_errors) { |
|
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | 574 | __( |
@@ -584,11 +584,11 @@ discard block |
||
584 | 584 | break; |
585 | 585 | // TEST #7 : check that config has even been set |
586 | 586 | case 7 : |
587 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
588 | - if ( $display_errors ) { |
|
587 | + if ( ! isset($this->{$section}->{$name} )) { |
|
588 | + if ($display_errors) { |
|
589 | 589 | throw new EE_Error( |
590 | 590 | sprintf( |
591 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
591 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
592 | 592 | $section, |
593 | 593 | $name |
594 | 594 | ) |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | return false; |
598 | 598 | } else { |
599 | 599 | // and make sure it's not serialized |
600 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
600 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
601 | 601 | } |
602 | 602 | break; |
603 | 603 | // TEST #8 : check that config is the requested type |
604 | 604 | case 8 : |
605 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
606 | - if ( $display_errors ) { |
|
605 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
606 | + if ($display_errors) { |
|
607 | 607 | throw new EE_Error( |
608 | 608 | sprintf( |
609 | 609 | __( |
@@ -621,12 +621,12 @@ discard block |
||
621 | 621 | break; |
622 | 622 | // TEST #9 : verify config object |
623 | 623 | case 9 : |
624 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
625 | - if ( $display_errors ) { |
|
624 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
625 | + if ($display_errors) { |
|
626 | 626 | throw new EE_Error( |
627 | 627 | sprintf( |
628 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
629 | - print_r( $config_obj, true ) |
|
628 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
629 | + print_r($config_obj, true) |
|
630 | 630 | ) |
631 | 631 | ); |
632 | 632 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | break; |
636 | 636 | } |
637 | 637 | } |
638 | - } catch ( EE_Error $e ) { |
|
638 | + } catch (EE_Error $e) { |
|
639 | 639 | $e->get_error(); |
640 | 640 | } |
641 | 641 | // you have successfully run the gauntlet |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $name |
653 | 653 | * @return string |
654 | 654 | */ |
655 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
656 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
655 | + private function _generate_config_option_name($section = '', $name = '') { |
|
656 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | * @param string $name |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
671 | - return ! empty( $config_class ) |
|
670 | + private function _set_config_class($config_class = '', $name = '') { |
|
671 | + return ! empty($config_class) |
|
672 | 672 | ? $config_class |
673 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
673 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -685,36 +685,36 @@ discard block |
||
685 | 685 | * @param EE_Config_Base $config_obj |
686 | 686 | * @return EE_Config_Base |
687 | 687 | */ |
688 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
688 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
689 | 689 | // ensure config class is set to something |
690 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
690 | + $config_class = $this->_set_config_class($config_class, $name); |
|
691 | 691 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
692 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
692 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
693 | 693 | return null; |
694 | 694 | } |
695 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
695 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
696 | 696 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
697 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
698 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
697 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
698 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
699 | 699 | $this->update_addon_option_names(); |
700 | 700 | } |
701 | 701 | // verify the incoming config object but suppress errors |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
703 | 703 | $config_obj = new $config_class(); |
704 | 704 | } |
705 | - if ( get_option( $config_option_name ) ) { |
|
706 | - EE_Config::log( $config_option_name ); |
|
707 | - update_option( $config_option_name, $config_obj ); |
|
705 | + if (get_option($config_option_name)) { |
|
706 | + EE_Config::log($config_option_name); |
|
707 | + update_option($config_option_name, $config_obj); |
|
708 | 708 | $this->{$section}->{$name} = $config_obj; |
709 | 709 | return $this->{$section}->{$name}; |
710 | 710 | } else { |
711 | 711 | // create a wp-option for this config |
712 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
713 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
712 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
713 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
714 | 714 | return $this->{$section}->{$name}; |
715 | 715 | } else { |
716 | 716 | EE_Error::add_error( |
717 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
717 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
718 | 718 | __FILE__, |
719 | 719 | __FUNCTION__, |
720 | 720 | __LINE__ |
@@ -737,46 +737,46 @@ discard block |
||
737 | 737 | * @param bool $throw_errors |
738 | 738 | * @return bool |
739 | 739 | */ |
740 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
740 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
741 | 741 | // don't allow config updates during WP heartbeats |
742 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
742 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
743 | 743 | return false; |
744 | 744 | } |
745 | - $config_obj = maybe_unserialize( $config_obj ); |
|
745 | + $config_obj = maybe_unserialize($config_obj); |
|
746 | 746 | // get class name of the incoming object |
747 | - $config_class = get_class( $config_obj ); |
|
747 | + $config_class = get_class($config_obj); |
|
748 | 748 | // run tests 1-5 and 9 to verify config |
749 | 749 | if ( ! $this->_verify_config_params( |
750 | 750 | $section, |
751 | 751 | $name, |
752 | 752 | $config_class, |
753 | 753 | $config_obj, |
754 | - array( 1, 2, 3, 4, 7, 9 ) |
|
754 | + array(1, 2, 3, 4, 7, 9) |
|
755 | 755 | ) |
756 | 756 | ) { |
757 | 757 | return false; |
758 | 758 | } |
759 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
759 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
760 | 760 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
761 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
761 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
762 | 762 | // save new config to db |
763 | - if( $this->set_config( $section, $name, $config_class, $config_obj ) ) { |
|
763 | + if ($this->set_config($section, $name, $config_class, $config_obj)) { |
|
764 | 764 | return true; |
765 | 765 | } |
766 | 766 | } else { |
767 | 767 | // first check if the record already exists |
768 | - $existing_config = get_option( $config_option_name ); |
|
769 | - $config_obj = serialize( $config_obj ); |
|
768 | + $existing_config = get_option($config_option_name); |
|
769 | + $config_obj = serialize($config_obj); |
|
770 | 770 | // just return if db record is already up to date (NOT type safe comparison) |
771 | - if ( $existing_config == $config_obj ) { |
|
771 | + if ($existing_config == $config_obj) { |
|
772 | 772 | $this->{$section}->{$name} = $config_obj; |
773 | 773 | return true; |
774 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
775 | - EE_Config::log( $config_option_name ); |
|
774 | + } else if (update_option($config_option_name, $config_obj)) { |
|
775 | + EE_Config::log($config_option_name); |
|
776 | 776 | // update wp-option for this config class |
777 | 777 | $this->{$section}->{$name} = $config_obj; |
778 | 778 | return true; |
779 | - } elseif ( $throw_errors ) { |
|
779 | + } elseif ($throw_errors) { |
|
780 | 780 | EE_Error::add_error( |
781 | 781 | sprintf( |
782 | 782 | __( |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | 'event_espresso' |
785 | 785 | ), |
786 | 786 | $config_class, |
787 | - 'EE_Config->' . $section . '->' . $name |
|
787 | + 'EE_Config->'.$section.'->'.$name |
|
788 | 788 | ), |
789 | 789 | __FILE__, |
790 | 790 | __FUNCTION__, |
@@ -806,34 +806,34 @@ discard block |
||
806 | 806 | * @param string $config_class |
807 | 807 | * @return mixed EE_Config_Base | NULL |
808 | 808 | */ |
809 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
809 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
810 | 810 | // ensure config class is set to something |
811 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
811 | + $config_class = $this->_set_config_class($config_class, $name); |
|
812 | 812 | // run tests 1-4, 6 and 7 to verify that all params have been set |
813 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
813 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
814 | 814 | return null; |
815 | 815 | } |
816 | 816 | // now test if the requested config object exists, but suppress errors |
817 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
817 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
818 | 818 | // config already exists, so pass it back |
819 | 819 | return $this->{$section}->{$name}; |
820 | 820 | } |
821 | 821 | // load config option from db if it exists |
822 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
822 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
823 | 823 | // verify the newly retrieved config object, but suppress errors |
824 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
824 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
825 | 825 | // config is good, so set it and pass it back |
826 | 826 | $this->{$section}->{$name} = $config_obj; |
827 | 827 | return $this->{$section}->{$name}; |
828 | 828 | } |
829 | 829 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
830 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
830 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
831 | 831 | // verify the newly created config object |
832 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
832 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
833 | 833 | return $this->{$section}->{$name}; |
834 | 834 | } else { |
835 | 835 | EE_Error::add_error( |
836 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
836 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
837 | 837 | __FILE__, |
838 | 838 | __FUNCTION__, |
839 | 839 | __LINE__ |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | * @param string $config_option_name |
852 | 852 | * @return mixed EE_Config_Base | FALSE |
853 | 853 | */ |
854 | - public function get_config_option( $config_option_name = '' ) { |
|
854 | + public function get_config_option($config_option_name = '') { |
|
855 | 855 | // retrieve the wp-option for this config class. |
856 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
857 | - if ( empty( $config_option ) ) { |
|
858 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
856 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
857 | + if (empty($config_option)) { |
|
858 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
859 | 859 | } |
860 | 860 | return $config_option; |
861 | 861 | } |
@@ -867,17 +867,17 @@ discard block |
||
867 | 867 | * |
868 | 868 | * @param string $config_option_name |
869 | 869 | */ |
870 | - public static function log( $config_option_name = '' ) { |
|
871 | - if ( ! empty( $config_option_name ) ) { |
|
872 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
870 | + public static function log($config_option_name = '') { |
|
871 | + if ( ! empty($config_option_name)) { |
|
872 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
873 | 873 | //copy incoming $_REQUEST and sanitize it so we can save it |
874 | 874 | $_request = $_REQUEST; |
875 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
876 | - $config_log[ (string) microtime( true ) ] = array( |
|
875 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
876 | + $config_log[(string) microtime(true)] = array( |
|
877 | 877 | 'config_name' => $config_option_name, |
878 | 878 | 'request' => $_request, |
879 | 879 | ); |
880 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
889 | 889 | */ |
890 | 890 | public static function trim_log() { |
891 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
892 | - $log_length = count( $config_log ); |
|
893 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
894 | - ksort( $config_log ); |
|
895 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
896 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
891 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
892 | + $log_length = count($config_log); |
|
893 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
894 | + ksort($config_log); |
|
895 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
896 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | * @return string |
909 | 909 | */ |
910 | 910 | public static function get_page_for_posts() { |
911 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
912 | - if ( ! $page_for_posts ) { |
|
911 | + $page_for_posts = get_option('page_for_posts'); |
|
912 | + if ( ! $page_for_posts) { |
|
913 | 913 | return 'posts'; |
914 | 914 | } |
915 | 915 | /** @type WPDB $wpdb */ |
916 | 916 | global $wpdb; |
917 | 917 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
918 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
918 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
@@ -971,17 +971,17 @@ discard block |
||
971 | 971 | ) |
972 | 972 | ) { |
973 | 973 | // grab list of installed widgets |
974 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
974 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
975 | 975 | // filter list of modules to register |
976 | 976 | $widgets_to_register = apply_filters( |
977 | 977 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
978 | 978 | $widgets_to_register |
979 | 979 | ); |
980 | - if ( ! empty( $widgets_to_register ) ) { |
|
980 | + if ( ! empty($widgets_to_register)) { |
|
981 | 981 | // cycle thru widget folders |
982 | - foreach ( $widgets_to_register as $widget_path ) { |
|
982 | + foreach ($widgets_to_register as $widget_path) { |
|
983 | 983 | // add to list of installed widget modules |
984 | - EE_Config::register_ee_widget( $widget_path ); |
|
984 | + EE_Config::register_ee_widget($widget_path); |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | // filter list of installed modules |
@@ -1001,57 +1001,57 @@ discard block |
||
1001 | 1001 | * @param string $widget_path - full path up to and including widget folder |
1002 | 1002 | * @return void |
1003 | 1003 | */ |
1004 | - public static function register_ee_widget( $widget_path = null ) { |
|
1005 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
1004 | + public static function register_ee_widget($widget_path = null) { |
|
1005 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
1006 | 1006 | $widget_ext = '.widget.php'; |
1007 | 1007 | // make all separators match |
1008 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
1008 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
1009 | 1009 | // does the file path INCLUDE the actual file name as part of the path ? |
1010 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
1010 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1011 | 1011 | // grab and shortcode file name from directory name and break apart at dots |
1012 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1012 | + $file_name = explode('.', basename($widget_path)); |
|
1013 | 1013 | // take first segment from file name pieces and remove class prefix if it exists |
1014 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1014 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1015 | 1015 | // sanitize shortcode directory name |
1016 | - $widget = sanitize_key( $widget ); |
|
1016 | + $widget = sanitize_key($widget); |
|
1017 | 1017 | // now we need to rebuild the shortcode path |
1018 | - $widget_path = explode( DS, $widget_path ); |
|
1018 | + $widget_path = explode(DS, $widget_path); |
|
1019 | 1019 | // remove last segment |
1020 | - array_pop( $widget_path ); |
|
1020 | + array_pop($widget_path); |
|
1021 | 1021 | // glue it back together |
1022 | - $widget_path = implode( DS, $widget_path ); |
|
1022 | + $widget_path = implode(DS, $widget_path); |
|
1023 | 1023 | } else { |
1024 | 1024 | // grab and sanitize widget directory name |
1025 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1025 | + $widget = sanitize_key(basename($widget_path)); |
|
1026 | 1026 | } |
1027 | 1027 | // create classname from widget directory name |
1028 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1028 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1029 | 1029 | // add class prefix |
1030 | - $widget_class = 'EEW_' . $widget; |
|
1030 | + $widget_class = 'EEW_'.$widget; |
|
1031 | 1031 | // does the widget exist ? |
1032 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1032 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1033 | 1033 | $msg = sprintf( |
1034 | 1034 | __( |
1035 | 1035 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1036 | 1036 | 'event_espresso' |
1037 | 1037 | ), |
1038 | 1038 | $widget_class, |
1039 | - $widget_path . DS . $widget_class . $widget_ext |
|
1039 | + $widget_path.DS.$widget_class.$widget_ext |
|
1040 | 1040 | ); |
1041 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1041 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | // load the widget class file |
1045 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1045 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1046 | 1046 | // verify that class exists |
1047 | - if ( ! class_exists( $widget_class ) ) { |
|
1048 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1049 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1047 | + if ( ! class_exists($widget_class)) { |
|
1048 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1049 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1050 | 1050 | return; |
1051 | 1051 | } |
1052 | - register_widget( $widget_class ); |
|
1052 | + register_widget($widget_class); |
|
1053 | 1053 | // add to array of registered widgets |
1054 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1054 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1064,17 +1064,17 @@ discard block |
||
1064 | 1064 | */ |
1065 | 1065 | private function _register_shortcodes() { |
1066 | 1066 | // grab list of installed shortcodes |
1067 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1067 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1068 | 1068 | // filter list of modules to register |
1069 | 1069 | $shortcodes_to_register = apply_filters( |
1070 | 1070 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1071 | 1071 | $shortcodes_to_register |
1072 | 1072 | ); |
1073 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1073 | + if ( ! empty($shortcodes_to_register)) { |
|
1074 | 1074 | // cycle thru shortcode folders |
1075 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1075 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1076 | 1076 | // add to list of installed shortcode modules |
1077 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1077 | + EE_Config::register_shortcode($shortcode_path); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | // filter list of installed modules |
@@ -1093,64 +1093,64 @@ discard block |
||
1093 | 1093 | * @param string $shortcode_path - full path up to and including shortcode folder |
1094 | 1094 | * @return bool |
1095 | 1095 | */ |
1096 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1097 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1096 | + public static function register_shortcode($shortcode_path = null) { |
|
1097 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1098 | 1098 | $shortcode_ext = '.shortcode.php'; |
1099 | 1099 | // make all separators match |
1100 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1100 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1101 | 1101 | // does the file path INCLUDE the actual file name as part of the path ? |
1102 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1102 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1103 | 1103 | // grab shortcode file name from directory name and break apart at dots |
1104 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1104 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1105 | 1105 | // take first segment from file name pieces and remove class prefix if it exists |
1106 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1107 | - ? substr( $shortcode_file[0], 4 ) |
|
1106 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1107 | + ? substr($shortcode_file[0], 4) |
|
1108 | 1108 | : $shortcode_file[0]; |
1109 | 1109 | // sanitize shortcode directory name |
1110 | - $shortcode = sanitize_key( $shortcode ); |
|
1110 | + $shortcode = sanitize_key($shortcode); |
|
1111 | 1111 | // now we need to rebuild the shortcode path |
1112 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1112 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1113 | 1113 | // remove last segment |
1114 | - array_pop( $shortcode_path ); |
|
1114 | + array_pop($shortcode_path); |
|
1115 | 1115 | // glue it back together |
1116 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1116 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1117 | 1117 | } else { |
1118 | 1118 | // we need to generate the filename based off of the folder name |
1119 | 1119 | // grab and sanitize shortcode directory name |
1120 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1121 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1120 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1121 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1122 | 1122 | } |
1123 | 1123 | // create classname from shortcode directory or file name |
1124 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1124 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1125 | 1125 | // add class prefix |
1126 | - $shortcode_class = 'EES_' . $shortcode; |
|
1126 | + $shortcode_class = 'EES_'.$shortcode; |
|
1127 | 1127 | // does the shortcode exist ? |
1128 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1128 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1129 | 1129 | $msg = sprintf( |
1130 | 1130 | __( |
1131 | 1131 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1132 | 1132 | 'event_espresso' |
1133 | 1133 | ), |
1134 | 1134 | $shortcode_class, |
1135 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1135 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | 1140 | // load the shortcode class file |
1141 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1141 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1142 | 1142 | // verify that class exists |
1143 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1143 | + if ( ! class_exists($shortcode_class)) { |
|
1144 | 1144 | $msg = sprintf( |
1145 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1145 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1146 | 1146 | $shortcode_class |
1147 | 1147 | ); |
1148 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1148 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1149 | 1149 | return false; |
1150 | 1150 | } |
1151 | - $shortcode = strtoupper( $shortcode ); |
|
1151 | + $shortcode = strtoupper($shortcode); |
|
1152 | 1152 | // add to array of registered shortcodes |
1153 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1153 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1164,22 +1164,22 @@ discard block |
||
1164 | 1164 | */ |
1165 | 1165 | private function _register_modules() { |
1166 | 1166 | // grab list of installed modules |
1167 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1167 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1168 | 1168 | // filter list of modules to register |
1169 | 1169 | $modules_to_register = apply_filters( |
1170 | 1170 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1171 | 1171 | $modules_to_register |
1172 | 1172 | ); |
1173 | - if ( ! empty( $modules_to_register ) ) { |
|
1173 | + if ( ! empty($modules_to_register)) { |
|
1174 | 1174 | // loop through folders |
1175 | - foreach ( $modules_to_register as $module_path ) { |
|
1175 | + foreach ($modules_to_register as $module_path) { |
|
1176 | 1176 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1177 | 1177 | if ( |
1178 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1179 | - && $module_path !== EE_MODULES . 'gateways' |
|
1178 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1179 | + && $module_path !== EE_MODULES.'gateways' |
|
1180 | 1180 | ) { |
1181 | 1181 | // add to list of installed modules |
1182 | - EE_Config::register_module( $module_path ); |
|
1182 | + EE_Config::register_module($module_path); |
|
1183 | 1183 | } |
1184 | 1184 | } |
1185 | 1185 | } |
@@ -1199,39 +1199,39 @@ discard block |
||
1199 | 1199 | * @param string $module_path - full path up to and including module folder |
1200 | 1200 | * @return bool |
1201 | 1201 | */ |
1202 | - public static function register_module( $module_path = null ) { |
|
1203 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1202 | + public static function register_module($module_path = null) { |
|
1203 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1204 | 1204 | $module_ext = '.module.php'; |
1205 | 1205 | // make all separators match |
1206 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1206 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1207 | 1207 | // does the file path INCLUDE the actual file name as part of the path ? |
1208 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1208 | + if (strpos($module_path, $module_ext) !== false) { |
|
1209 | 1209 | // grab and shortcode file name from directory name and break apart at dots |
1210 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1210 | + $module_file = explode('.', basename($module_path)); |
|
1211 | 1211 | // now we need to rebuild the shortcode path |
1212 | - $module_path = explode( DS, $module_path ); |
|
1212 | + $module_path = explode(DS, $module_path); |
|
1213 | 1213 | // remove last segment |
1214 | - array_pop( $module_path ); |
|
1214 | + array_pop($module_path); |
|
1215 | 1215 | // glue it back together |
1216 | - $module_path = implode( DS, $module_path ) . DS; |
|
1216 | + $module_path = implode(DS, $module_path).DS; |
|
1217 | 1217 | // take first segment from file name pieces and sanitize it |
1218 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1218 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1219 | 1219 | // ensure class prefix is added |
1220 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1220 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1221 | 1221 | } else { |
1222 | 1222 | // we need to generate the filename based off of the folder name |
1223 | 1223 | // grab and sanitize module name |
1224 | - $module = strtolower( basename( $module_path ) ); |
|
1225 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1224 | + $module = strtolower(basename($module_path)); |
|
1225 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1226 | 1226 | // like trailingslashit() |
1227 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1227 | + $module_path = rtrim($module_path, DS).DS; |
|
1228 | 1228 | // create classname from module directory name |
1229 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1229 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1230 | 1230 | // add class prefix |
1231 | - $module_class = 'EED_' . $module; |
|
1231 | + $module_class = 'EED_'.$module; |
|
1232 | 1232 | } |
1233 | 1233 | // does the module exist ? |
1234 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1234 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1235 | 1235 | $msg = sprintf( |
1236 | 1236 | __( |
1237 | 1237 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1239,19 +1239,19 @@ discard block |
||
1239 | 1239 | ), |
1240 | 1240 | $module |
1241 | 1241 | ); |
1242 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1242 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1243 | 1243 | return false; |
1244 | 1244 | } |
1245 | 1245 | // load the module class file |
1246 | - require_once( $module_path . $module_class . $module_ext ); |
|
1246 | + require_once($module_path.$module_class.$module_ext); |
|
1247 | 1247 | // verify that class exists |
1248 | - if ( ! class_exists( $module_class ) ) { |
|
1249 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1250 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1248 | + if ( ! class_exists($module_class)) { |
|
1249 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1250 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | return false; |
1252 | 1252 | } |
1253 | 1253 | // add to array of registered modules |
1254 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1254 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1255 | 1255 | do_action( |
1256 | 1256 | 'AHEE__EE_Config__register_module__complete', |
1257 | 1257 | $module_class, |
@@ -1271,26 +1271,26 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | private function _initialize_shortcodes() { |
1273 | 1273 | // cycle thru shortcode folders |
1274 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1274 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1275 | 1275 | // add class prefix |
1276 | - $shortcode_class = 'EES_' . $shortcode; |
|
1276 | + $shortcode_class = 'EES_'.$shortcode; |
|
1277 | 1277 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1278 | 1278 | // which set hooks ? |
1279 | - if ( is_admin() ) { |
|
1279 | + if (is_admin()) { |
|
1280 | 1280 | // fire immediately |
1281 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1281 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1282 | 1282 | } else { |
1283 | 1283 | // delay until other systems are online |
1284 | 1284 | add_action( |
1285 | 1285 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1286 | - array( $shortcode_class, 'set_hooks' ) |
|
1286 | + array($shortcode_class, 'set_hooks') |
|
1287 | 1287 | ); |
1288 | 1288 | // convert classname to UPPERCASE and create WP shortcode. |
1289 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1289 | + $shortcode_tag = strtoupper($shortcode); |
|
1290 | 1290 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1291 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1291 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1292 | 1292 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1293 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1293 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | } |
@@ -1307,17 +1307,17 @@ discard block |
||
1307 | 1307 | */ |
1308 | 1308 | private function _initialize_modules() { |
1309 | 1309 | // cycle thru shortcode folders |
1310 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1310 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1311 | 1311 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1312 | 1312 | // which set hooks ? |
1313 | - if ( is_admin() ) { |
|
1313 | + if (is_admin()) { |
|
1314 | 1314 | // fire immediately |
1315 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1315 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1316 | 1316 | } else { |
1317 | 1317 | // delay until other systems are online |
1318 | 1318 | add_action( |
1319 | 1319 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1320 | - array( $module_class, 'set_hooks' ) |
|
1320 | + array($module_class, 'set_hooks') |
|
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | } |
@@ -1335,29 +1335,29 @@ discard block |
||
1335 | 1335 | * @param string $key - url param key indicating a route is being called |
1336 | 1336 | * @return bool |
1337 | 1337 | */ |
1338 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1339 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1340 | - $module = str_replace( 'EED_', '', $module ); |
|
1341 | - $module_class = 'EED_' . $module; |
|
1342 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1343 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1344 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1339 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1340 | + $module = str_replace('EED_', '', $module); |
|
1341 | + $module_class = 'EED_'.$module; |
|
1342 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1343 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1344 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1345 | 1345 | return false; |
1346 | 1346 | } |
1347 | - if ( empty( $route ) ) { |
|
1348 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1349 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1347 | + if (empty($route)) { |
|
1348 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1349 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1350 | 1350 | return false; |
1351 | 1351 | } |
1352 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1352 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1353 | 1353 | $msg = sprintf( |
1354 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1354 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1355 | 1355 | $route |
1356 | 1356 | ); |
1357 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1357 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1358 | 1358 | return false; |
1359 | 1359 | } |
1360 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1360 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1361 | 1361 | return true; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1371,11 +1371,11 @@ discard block |
||
1371 | 1371 | * @param string $key - url param key indicating a route is being called |
1372 | 1372 | * @return string |
1373 | 1373 | */ |
1374 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1375 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1376 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1377 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1378 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1374 | + public static function get_route($route = null, $key = 'ee') { |
|
1375 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1376 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1377 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1378 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1379 | 1379 | } |
1380 | 1380 | return null; |
1381 | 1381 | } |
@@ -1405,49 +1405,49 @@ discard block |
||
1405 | 1405 | * @param string $key - url param key indicating a route is being called |
1406 | 1406 | * @return bool |
1407 | 1407 | */ |
1408 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1409 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1410 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1408 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1409 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1410 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1411 | 1411 | $msg = sprintf( |
1412 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1412 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1413 | 1413 | $route |
1414 | 1414 | ); |
1415 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1415 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1416 | 1416 | return false; |
1417 | 1417 | } |
1418 | - if ( empty( $forward ) ) { |
|
1419 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1420 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + if (empty($forward)) { |
|
1419 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1420 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1421 | 1421 | return false; |
1422 | 1422 | } |
1423 | - if ( is_array( $forward ) ) { |
|
1424 | - if ( ! isset( $forward[1] ) ) { |
|
1423 | + if (is_array($forward)) { |
|
1424 | + if ( ! isset($forward[1])) { |
|
1425 | 1425 | $msg = sprintf( |
1426 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1426 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1427 | 1427 | $route |
1428 | 1428 | ); |
1429 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1429 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1430 | 1430 | return false; |
1431 | 1431 | } |
1432 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1432 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1433 | 1433 | $msg = sprintf( |
1434 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1434 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1435 | 1435 | $forward[1], |
1436 | 1436 | $route |
1437 | 1437 | ); |
1438 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1438 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1439 | 1439 | return false; |
1440 | 1440 | } |
1441 | - } else if ( ! function_exists( $forward ) ) { |
|
1441 | + } else if ( ! function_exists($forward)) { |
|
1442 | 1442 | $msg = sprintf( |
1443 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1443 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1444 | 1444 | $forward, |
1445 | 1445 | $route |
1446 | 1446 | ); |
1447 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1447 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1448 | 1448 | return false; |
1449 | 1449 | } |
1450 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1450 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1451 | 1451 | return true; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | * @param string $key - url param key indicating a route is being called |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1467 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1468 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1466 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1467 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1468 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1469 | 1469 | return apply_filters( |
1470 | 1470 | 'FHEE__EE_Config__get_forward', |
1471 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1471 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1472 | 1472 | $route, |
1473 | 1473 | $status |
1474 | 1474 | ); |
@@ -1490,17 +1490,17 @@ discard block |
||
1490 | 1490 | * @param string $key - url param key indicating a route is being called |
1491 | 1491 | * @return bool |
1492 | 1492 | */ |
1493 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1494 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1495 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1493 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1494 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1495 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1496 | 1496 | $msg = sprintf( |
1497 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1497 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1498 | 1498 | $route |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - if ( ! is_readable( $view ) ) { |
|
1503 | + if ( ! is_readable($view)) { |
|
1504 | 1504 | $msg = sprintf( |
1505 | 1505 | __( |
1506 | 1506 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1508,10 +1508,10 @@ discard block |
||
1508 | 1508 | ), |
1509 | 1509 | $view |
1510 | 1510 | ); |
1511 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1511 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1512 | 1512 | return false; |
1513 | 1513 | } |
1514 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1514 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1515 | 1515 | return true; |
1516 | 1516 | } |
1517 | 1517 | |
@@ -1527,12 +1527,12 @@ discard block |
||
1527 | 1527 | * @param string $key - url param key indicating a route is being called |
1528 | 1528 | * @return string |
1529 | 1529 | */ |
1530 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1531 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1532 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1530 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1531 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1532 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1533 | 1533 | return apply_filters( |
1534 | 1534 | 'FHEE__EE_Config__get_view', |
1535 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1535 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1536 | 1536 | $route, |
1537 | 1537 | $status |
1538 | 1538 | ); |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | |
1544 | 1544 | |
1545 | 1545 | public function update_addon_option_names() { |
1546 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1546 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | |
@@ -1571,22 +1571,22 @@ discard block |
||
1571 | 1571 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1572 | 1572 | * @throws \EE_Error |
1573 | 1573 | */ |
1574 | - public function get_pretty( $property ) { |
|
1575 | - if ( ! property_exists( $this, $property ) ) { |
|
1574 | + public function get_pretty($property) { |
|
1575 | + if ( ! property_exists($this, $property)) { |
|
1576 | 1576 | throw new EE_Error( |
1577 | 1577 | sprintf( |
1578 | 1578 | __( |
1579 | 1579 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1580 | 1580 | 'event_espresso' |
1581 | 1581 | ), |
1582 | - get_class( $this ), |
|
1582 | + get_class($this), |
|
1583 | 1583 | $property |
1584 | 1584 | ) |
1585 | 1585 | ); |
1586 | 1586 | } |
1587 | 1587 | //just handling escaping of strings for now. |
1588 | - if ( is_string( $this->{$property} ) ) { |
|
1589 | - return stripslashes( $this->{$property} ); |
|
1588 | + if (is_string($this->{$property} )) { |
|
1589 | + return stripslashes($this->{$property} ); |
|
1590 | 1590 | } |
1591 | 1591 | return $this->{$property}; |
1592 | 1592 | } |
@@ -1595,17 +1595,17 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | public function populate() { |
1597 | 1597 | //grab defaults via a new instance of this class. |
1598 | - $class_name = get_class( $this ); |
|
1598 | + $class_name = get_class($this); |
|
1599 | 1599 | $defaults = new $class_name; |
1600 | 1600 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1601 | 1601 | //default from our $defaults object. |
1602 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1603 | - if ( $this->{$property} === null ) { |
|
1602 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1603 | + if ($this->{$property} === null) { |
|
1604 | 1604 | $this->{$property} = $value; |
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | //cleanup |
1608 | - unset( $defaults ); |
|
1608 | + unset($defaults); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | * @param $a |
1622 | 1622 | * @return bool |
1623 | 1623 | */ |
1624 | - public function __isset( $a ) { |
|
1624 | + public function __isset($a) { |
|
1625 | 1625 | return false; |
1626 | 1626 | } |
1627 | 1627 | |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | * @param $a |
1634 | 1634 | * @return bool |
1635 | 1635 | */ |
1636 | - public function __unset( $a ) { |
|
1636 | + public function __unset($a) { |
|
1637 | 1637 | return false; |
1638 | 1638 | } |
1639 | 1639 | |
@@ -1743,7 +1743,7 @@ discard block |
||
1743 | 1743 | $this->current_blog_id = get_current_blog_id(); |
1744 | 1744 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1745 | 1745 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1746 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1746 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1747 | 1747 | $this->post_shortcodes = array(); |
1748 | 1748 | $this->module_route_map = array(); |
1749 | 1749 | $this->module_forward_map = array(); |
@@ -1759,9 +1759,9 @@ discard block |
||
1759 | 1759 | $this->thank_you_page_url = ''; |
1760 | 1760 | $this->cancel_page_url = ''; |
1761 | 1761 | //cpt slugs |
1762 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1762 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1763 | 1763 | //ueip constant check |
1764 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1764 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1765 | 1765 | $this->ee_ueip_optin = false; |
1766 | 1766 | $this->ee_ueip_has_notified = true; |
1767 | 1767 | } |
@@ -1804,11 +1804,11 @@ discard block |
||
1804 | 1804 | * @return string |
1805 | 1805 | */ |
1806 | 1806 | public function reg_page_url() { |
1807 | - if ( ! $this->reg_page_url ) { |
|
1807 | + if ( ! $this->reg_page_url) { |
|
1808 | 1808 | $this->reg_page_url = add_query_arg( |
1809 | - array( 'uts' => time() ), |
|
1810 | - get_permalink( $this->reg_page_id ) |
|
1811 | - ) . '#checkout'; |
|
1809 | + array('uts' => time()), |
|
1810 | + get_permalink($this->reg_page_id) |
|
1811 | + ).'#checkout'; |
|
1812 | 1812 | } |
1813 | 1813 | return $this->reg_page_url; |
1814 | 1814 | } |
@@ -1823,12 +1823,12 @@ discard block |
||
1823 | 1823 | * @access public |
1824 | 1824 | * @return string |
1825 | 1825 | */ |
1826 | - public function txn_page_url( $query_args = array() ) { |
|
1827 | - if ( ! $this->txn_page_url ) { |
|
1828 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1826 | + public function txn_page_url($query_args = array()) { |
|
1827 | + if ( ! $this->txn_page_url) { |
|
1828 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1829 | 1829 | } |
1830 | - if ( $query_args ) { |
|
1831 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1830 | + if ($query_args) { |
|
1831 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1832 | 1832 | } else { |
1833 | 1833 | return $this->txn_page_url; |
1834 | 1834 | } |
@@ -1844,12 +1844,12 @@ discard block |
||
1844 | 1844 | * @access public |
1845 | 1845 | * @return string |
1846 | 1846 | */ |
1847 | - public function thank_you_page_url( $query_args = array() ) { |
|
1848 | - if ( ! $this->thank_you_page_url ) { |
|
1849 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1847 | + public function thank_you_page_url($query_args = array()) { |
|
1848 | + if ( ! $this->thank_you_page_url) { |
|
1849 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1850 | 1850 | } |
1851 | - if ( $query_args ) { |
|
1852 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1851 | + if ($query_args) { |
|
1852 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1853 | 1853 | } else { |
1854 | 1854 | return $this->thank_you_page_url; |
1855 | 1855 | } |
@@ -1864,8 +1864,8 @@ discard block |
||
1864 | 1864 | * @return string |
1865 | 1865 | */ |
1866 | 1866 | public function cancel_page_url() { |
1867 | - if ( ! $this->cancel_page_url ) { |
|
1868 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1867 | + if ( ! $this->cancel_page_url) { |
|
1868 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1869 | 1869 | } |
1870 | 1870 | return $this->cancel_page_url; |
1871 | 1871 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | protected function _get_main_ee_ueip_optin() { |
1896 | 1896 | //if this is the main site then we can just bypass our direct query. |
1897 | - if ( is_main_site() ) { |
|
1898 | - return get_option( 'ee_ueip_optin', false ); |
|
1897 | + if (is_main_site()) { |
|
1898 | + return get_option('ee_ueip_optin', false); |
|
1899 | 1899 | } |
1900 | 1900 | |
1901 | 1901 | //is this already cached for this request? If so use it. |
1902 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1902 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1903 | 1903 | return EE_Core_Config::$ee_ueip_option; |
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | global $wpdb; |
1907 | 1907 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1908 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1908 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1909 | 1909 | $option = 'ee_ueip_optin'; |
1910 | 1910 | |
1911 | 1911 | //set correct table for query |
1912 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1912 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1913 | 1913 | |
1914 | 1914 | |
1915 | 1915 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1917,20 +1917,20 @@ discard block |
||
1917 | 1917 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1918 | 1918 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1919 | 1919 | //for the purpose of caching. |
1920 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1921 | - if ( false !== $pre ) { |
|
1920 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1921 | + if (false !== $pre) { |
|
1922 | 1922 | EE_Core_Config::$ee_ueip_option = $pre; |
1923 | 1923 | return EE_Core_Config::$ee_ueip_option; |
1924 | 1924 | } |
1925 | 1925 | |
1926 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1927 | - if ( is_object( $row ) ) { |
|
1926 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1927 | + if (is_object($row)) { |
|
1928 | 1928 | $value = $row->option_value; |
1929 | 1929 | } else { //option does not exist so use default. |
1930 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1930 | + return apply_filters('default_option_'.$option, false, $option); |
|
1931 | 1931 | } |
1932 | 1932 | |
1933 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1933 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1934 | 1934 | return EE_Core_Config::$ee_ueip_option; |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1946,7 +1946,7 @@ discard block |
||
1946 | 1946 | //reset all url properties |
1947 | 1947 | $this->_reset_urls(); |
1948 | 1948 | //return what to save to db |
1949 | - return array_keys( get_object_vars( $this ) ); |
|
1949 | + return array_keys(get_object_vars($this)); |
|
1950 | 1950 | } |
1951 | 1951 | |
1952 | 1952 | } |
@@ -2093,14 +2093,14 @@ discard block |
||
2093 | 2093 | */ |
2094 | 2094 | public function __construct() { |
2095 | 2095 | // set default organization settings |
2096 | - $this->name = get_bloginfo( 'name' ); |
|
2096 | + $this->name = get_bloginfo('name'); |
|
2097 | 2097 | $this->address_1 = '123 Onna Road'; |
2098 | 2098 | $this->address_2 = 'PO Box 123'; |
2099 | 2099 | $this->city = 'Inna City'; |
2100 | 2100 | $this->STA_ID = 4; |
2101 | 2101 | $this->CNT_ISO = 'US'; |
2102 | 2102 | $this->zip = '12345'; |
2103 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2103 | + $this->email = get_bloginfo('admin_email'); |
|
2104 | 2104 | $this->phone = ''; |
2105 | 2105 | $this->vat = '123456789'; |
2106 | 2106 | $this->logo_url = ''; |
@@ -2188,46 +2188,46 @@ discard block |
||
2188 | 2188 | * @param string $CNT_ISO |
2189 | 2189 | * @throws \EE_Error |
2190 | 2190 | */ |
2191 | - public function __construct( $CNT_ISO = '' ) { |
|
2191 | + public function __construct($CNT_ISO = '') { |
|
2192 | 2192 | /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */ |
2193 | - $table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
2193 | + $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
2194 | 2194 | // get country code from organization settings or use default |
2195 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2195 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2196 | 2196 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2197 | 2197 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2198 | 2198 | : ''; |
2199 | 2199 | // but override if requested |
2200 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2200 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2201 | 2201 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2202 | 2202 | if ( |
2203 | - ! empty( $CNT_ISO ) |
|
2203 | + ! empty($CNT_ISO) |
|
2204 | 2204 | && EE_Maintenance_Mode::instance()->models_can_query() |
2205 | - && $table_analysis->tableExists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2205 | + && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table()) |
|
2206 | 2206 | ) { |
2207 | 2207 | // retrieve the country settings from the db, just in case they have been customized |
2208 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2209 | - if ( $country instanceof EE_Country ) { |
|
2210 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | - $this->name = $country->currency_name_single(); // Dollar |
|
2212 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2208 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2209 | + if ($country instanceof EE_Country) { |
|
2210 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2211 | + $this->name = $country->currency_name_single(); // Dollar |
|
2212 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2213 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2214 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2215 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2216 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2217 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2218 | 2218 | } |
2219 | 2219 | } |
2220 | 2220 | // fallback to hardcoded defaults, in case the above failed |
2221 | - if ( empty( $this->code ) ) { |
|
2221 | + if (empty($this->code)) { |
|
2222 | 2222 | // set default currency settings |
2223 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2225 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2226 | - $this->sign = '$'; // currency sign: $ |
|
2227 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2223 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2224 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2225 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2226 | + $this->sign = '$'; // currency sign: $ |
|
2227 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2228 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2229 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2230 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2231 | 2231 | } |
2232 | 2232 | } |
2233 | 2233 | } |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | * @since 4.8.8.rc.019 |
2390 | 2390 | */ |
2391 | 2391 | public function do_hooks() { |
2392 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2392 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2393 | 2393 | } |
2394 | 2394 | |
2395 | 2395 | |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | * @return void |
2399 | 2399 | */ |
2400 | 2400 | public function set_default_reg_status_on_EEM_Event() { |
2401 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2401 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2402 | 2402 | } |
2403 | 2403 | |
2404 | 2404 | |
@@ -2502,10 +2502,10 @@ discard block |
||
2502 | 2502 | * @param bool $reset |
2503 | 2503 | * @return string |
2504 | 2504 | */ |
2505 | - public function log_file_name( $reset = false ) { |
|
2506 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2507 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2508 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2505 | + public function log_file_name($reset = false) { |
|
2506 | + if (empty($this->log_file_name) || $reset) { |
|
2507 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2508 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2509 | 2509 | } |
2510 | 2510 | return $this->log_file_name; |
2511 | 2511 | } |
@@ -2516,10 +2516,10 @@ discard block |
||
2516 | 2516 | * @param bool $reset |
2517 | 2517 | * @return string |
2518 | 2518 | */ |
2519 | - public function debug_file_name( $reset = false ) { |
|
2520 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2521 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2522 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2519 | + public function debug_file_name($reset = false) { |
|
2520 | + if (empty($this->debug_file_name) || $reset) { |
|
2521 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2522 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2523 | 2523 | } |
2524 | 2524 | return $this->debug_file_name; |
2525 | 2525 | } |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | * @return string |
2531 | 2531 | */ |
2532 | 2532 | public function affiliate_id() { |
2533 | - return ! empty( $this->affiliate_id ) ? $this->affiliate_id : 'default'; |
|
2533 | + return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default'; |
|
2534 | 2534 | } |
2535 | 2535 | |
2536 | 2536 | |
@@ -2710,21 +2710,21 @@ discard block |
||
2710 | 2710 | $this->use_google_maps = true; |
2711 | 2711 | $this->google_map_api_key = ''; |
2712 | 2712 | // for event details pages (reg page) |
2713 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2713 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2714 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2715 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2716 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2717 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2718 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2719 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2720 | 2720 | // for event list pages |
2721 | - $this->event_list_map_width = 300; // ee_map_width |
|
2722 | - $this->event_list_map_height = 185; // ee_map_height |
|
2723 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2721 | + $this->event_list_map_width = 300; // ee_map_width |
|
2722 | + $this->event_list_map_height = 185; // ee_map_height |
|
2723 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2724 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2725 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2726 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2727 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2728 | 2728 | } |
2729 | 2729 | |
2730 | 2730 | } |
@@ -2886,7 +2886,7 @@ discard block |
||
2886 | 2886 | * @return void |
2887 | 2887 | */ |
2888 | 2888 | protected function _set_php_values() { |
2889 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2889 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2890 | 2890 | $this->php->version = phpversion(); |
2891 | 2891 | } |
2892 | 2892 | |
@@ -2905,10 +2905,10 @@ discard block |
||
2905 | 2905 | * @type string $msg Any message to be displayed. |
2906 | 2906 | * } |
2907 | 2907 | */ |
2908 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2909 | - if ( ! empty( $this->php->max_input_vars ) |
|
2910 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2911 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2908 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2909 | + if ( ! empty($this->php->max_input_vars) |
|
2910 | + && ($input_count >= $this->php->max_input_vars) |
|
2911 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2912 | 2912 | ) { |
2913 | 2913 | return sprintf( |
2914 | 2914 | __( |
@@ -3004,7 +3004,7 @@ discard block |
||
3004 | 3004 | */ |
3005 | 3005 | public function __construct() { |
3006 | 3006 | $this->payment_settings = array(); |
3007 | - $this->active_gateways = array( 'Invoice' => false ); |
|
3007 | + $this->active_gateways = array('Invoice' => false); |
|
3008 | 3008 | } |
3009 | 3009 | } |
3010 | 3010 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Default_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since $VID:$ |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since $VID:$ |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display { |
16 | 16 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // quantity td |
165 | 165 | $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
167 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
168 | 168 | ? 1 + ( $this->_tax_rate / 100 ) |
169 | 169 | : 1; |
170 | 170 | // price td |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param array $options |
58 | 58 | * @return mixed |
59 | 59 | */ |
60 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
60 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
61 | 61 | |
62 | 62 | $html = ''; |
63 | 63 | // set some default options and merge with incoming |
64 | 64 | $default_options = array( |
65 | - 'show_desc' => TRUE, // TRUE FALSE |
|
65 | + 'show_desc' => TRUE, // TRUE FALSE |
|
66 | 66 | 'odd' => FALSE |
67 | 67 | ); |
68 | - $options = array_merge( $default_options, (array)$options ); |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | 69 | |
70 | - switch( $line_item->type() ) { |
|
70 | + switch ($line_item->type()) { |
|
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_line_item: |
73 | 73 | // item row |
74 | - $html .= $this->_item_row( $line_item, $options ); |
|
74 | + $html .= $this->_item_row($line_item, $options); |
|
75 | 75 | // got any kids? |
76 | - foreach ( $line_item->children() as $child_line_item ) { |
|
77 | - $this->display_line_item( $child_line_item, $options ); |
|
76 | + foreach ($line_item->children() as $child_line_item) { |
|
77 | + $this->display_line_item($child_line_item, $options); |
|
78 | 78 | } |
79 | 79 | break; |
80 | 80 | |
81 | 81 | case EEM_Line_Item::type_sub_line_item: |
82 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
82 | + $html .= $this->_sub_item_row($line_item, $options); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case EEM_Line_Item::type_sub_total: |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | break; |
91 | 91 | |
92 | 92 | case EEM_Line_Item::type_tax_sub_total: |
93 | - foreach ( $line_item->children() as $child_line_item ) { |
|
94 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
93 | + foreach ($line_item->children() as $child_line_item) { |
|
94 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
95 | 95 | // recursively feed children back into this method |
96 | - $this->display_line_item( $child_line_item, $options ); |
|
96 | + $this->display_line_item($child_line_item, $options); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | break; |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | case EEM_Line_Item::type_total: |
102 | 102 | // get all child line items |
103 | 103 | $children = $line_item->children(); |
104 | - if ( $options[ 'set_tax_rate' ] === true ) { |
|
104 | + if ($options['set_tax_rate'] === true) { |
|
105 | 105 | // loop thru tax child line items just to determine tax rate |
106 | - foreach ( $children as $child_line_item ) { |
|
107 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
106 | + foreach ($children as $child_line_item) { |
|
107 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
108 | 108 | // recursively feed children back into this method |
109 | - $this->display_line_item( $child_line_item, $options ); |
|
109 | + $this->display_line_item($child_line_item, $options); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | // now loop thru all non-tax child line items |
114 | - foreach ( $children as $child_line_item ) { |
|
115 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
114 | + foreach ($children as $child_line_item) { |
|
115 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
116 | 116 | // recursively feed children back into this method |
117 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
117 | + $html .= $this->display_line_item($child_line_item, $options); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param array $options |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
137 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
138 | 138 | // start of row |
139 | 139 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
140 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
140 | + $html = EEH_HTML::tr('', '', $row_class); |
|
141 | 141 | // name && desc |
142 | 142 | $name_and_desc = apply_filters( |
143 | 143 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | ); |
147 | 147 | $name_and_desc .= apply_filters( |
148 | 148 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
149 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
149 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
150 | 150 | $line_item, |
151 | 151 | $options |
152 | 152 | ); |
153 | - if ( $line_item->is_taxable() ) { |
|
153 | + if ($line_item->is_taxable()) { |
|
154 | 154 | $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
155 | - ? __( '* price includes taxes', 'event_espresso' ) |
|
156 | - : __( '* price does not include taxes', 'event_espresso' ); |
|
155 | + ? __('* price includes taxes', 'event_espresso') |
|
156 | + : __('* price does not include taxes', 'event_espresso'); |
|
157 | 157 | $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
158 | 158 | . $ticket_price_includes_taxes |
159 | 159 | . '</span>'; |
160 | 160 | } |
161 | 161 | |
162 | 162 | // name td |
163 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
163 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
164 | 164 | // quantity td |
165 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
165 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
166 | 166 | $tax_rate = $line_item->is_taxable() |
167 | 167 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
168 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
168 | + ? 1 + ($this->_tax_rate / 100) |
|
169 | 169 | : 1; |
170 | 170 | // price td |
171 | - $unit_price = EEH_Template::format_currency( $line_item->unit_price() * $tax_rate, false, false ); |
|
172 | - $html .= EEH_HTML::td( $unit_price, '', 'item_c jst-rght' ); |
|
171 | + $unit_price = EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false); |
|
172 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
173 | 173 | // total td |
174 | - $total = EEH_Template::format_currency( $line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false ); |
|
175 | - $html .= EEH_HTML::td( $total, '', 'item_r jst-rght' ); |
|
174 | + $total = EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false); |
|
175 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
176 | 176 | // end of row |
177 | 177 | $html .= EEH_HTML::trx(); |
178 | 178 | |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | * @param array $options |
189 | 189 | * @return mixed |
190 | 190 | */ |
191 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
191 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
192 | 192 | // start of row |
193 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
193 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
194 | 194 | // name && desc |
195 | 195 | $name_and_desc = $line_item->name(); |
196 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
196 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
197 | 197 | // name td |
198 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
198 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
199 | 199 | // discount/surcharge td |
200 | - if ( $line_item->is_percent() ) { |
|
201 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
200 | + if ($line_item->is_percent()) { |
|
201 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
202 | 202 | } else { |
203 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
203 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
204 | 204 | } |
205 | 205 | // total td |
206 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
206 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
207 | 207 | // end of row |
208 | 208 | $html .= EEH_HTML::trx(); |
209 | 209 | return $html; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | 'capability' => 'ee_delete_default_price_type', |
186 | 186 | 'obj_id' => $prt_id |
187 | 187 | ), |
188 | - 'tax_settings' => array( |
|
189 | - 'func' => '_tax_settings', |
|
190 | - 'capability' => 'manage_options' |
|
191 | - ), |
|
192 | - 'update_tax_settings' => array( |
|
193 | - 'func' => '_update_tax_settings', |
|
194 | - 'capability' => 'manage_options', |
|
195 | - 'noheader' => true |
|
196 | - ), |
|
197 | - ); |
|
188 | + 'tax_settings' => array( |
|
189 | + 'func' => '_tax_settings', |
|
190 | + 'capability' => 'manage_options' |
|
191 | + ), |
|
192 | + 'update_tax_settings' => array( |
|
193 | + 'func' => '_update_tax_settings', |
|
194 | + 'capability' => 'manage_options', |
|
195 | + 'noheader' => true |
|
196 | + ), |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'order' => 10 |
210 | 210 | ), |
211 | 211 | 'list_table' => 'Prices_List_Table', |
212 | - 'help_tabs' => array( |
|
212 | + 'help_tabs' => array( |
|
213 | 213 | 'pricing_default_pricing_help_tab' => array( |
214 | 214 | 'title' => __('Default Pricing', 'event_espresso'), |
215 | 215 | 'filename' => 'pricing_default_pricing' |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | 'order' => 20, |
233 | 233 | 'persistent' => FALSE |
234 | 234 | ), |
235 | - 'help_tabs' => array( |
|
235 | + 'help_tabs' => array( |
|
236 | 236 | 'add_new_default_price_help_tab' => array( |
237 | 237 | 'title' => __('Add New Default Price', 'event_espresso'), |
238 | 238 | 'filename' => 'pricing_add_new_default_price' |
239 | 239 | ) |
240 | 240 | ), |
241 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
241 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
242 | 242 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | 252 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
253 | - 'help_tabs' => array( |
|
253 | + 'help_tabs' => array( |
|
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'order' => 30 |
266 | 266 | ), |
267 | 267 | 'list_table' => 'Price_Types_List_Table', |
268 | - 'help_tabs' => array( |
|
268 | + 'help_tabs' => array( |
|
269 | 269 | 'pricing_price_types_help_tab' => array( |
270 | 270 | 'title' => __('Price Types', 'event_espresso'), |
271 | 271 | 'filename' => 'pricing_price_types' |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | 'order' => 40, |
290 | 290 | 'persistent' => FALSE |
291 | 291 | ), |
292 | - 'help_tabs' => array( |
|
292 | + 'help_tabs' => array( |
|
293 | 293 | 'add_new_price_type_help_tab' => array( |
294 | 294 | 'title' => __('Add New Price Type', 'event_espresso'), |
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
298 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | 299 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
@@ -305,36 +305,36 @@ discard block |
||
305 | 305 | 'order' => 40, |
306 | 306 | 'persistent' => FALSE |
307 | 307 | ), |
308 | - 'help_tabs' => array( |
|
308 | + 'help_tabs' => array( |
|
309 | 309 | 'edit_price_type_help_tab' => array( |
310 | 310 | 'title' => __('Edit Price Type', 'event_espresso'), |
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
314 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | 315 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
319 | - 'tax_settings' => array( |
|
320 | - 'nav' => array( |
|
321 | - 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | - 'order' => 40 |
|
323 | - ), |
|
324 | - 'labels' => array( |
|
325 | - 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | - ), |
|
327 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | - // 'help_tabs' => array( |
|
329 | - // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | - // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | - // 'filename' => 'registration_form_reg_form_settings' |
|
332 | - // ), |
|
333 | - // ), |
|
334 | - // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | - 'require_nonce' => true |
|
336 | - ) |
|
337 | - ); |
|
319 | + 'tax_settings' => array( |
|
320 | + 'nav' => array( |
|
321 | + 'label' => esc_html__('Tax Settings', 'event_espresso'), |
|
322 | + 'order' => 40 |
|
323 | + ), |
|
324 | + 'labels' => array( |
|
325 | + 'publishbox' => esc_html__('Update Tax Settings', 'event_espresso') |
|
326 | + ), |
|
327 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
328 | + // 'help_tabs' => array( |
|
329 | + // 'registration_form_reg_form_settings_help_tab' => array( |
|
330 | + // 'title' => esc_html__('Registration Form Settings', 'event_espresso'), |
|
331 | + // 'filename' => 'registration_form_reg_form_settings' |
|
332 | + // ), |
|
333 | + // ), |
|
334 | + // 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
335 | + 'require_nonce' => true |
|
336 | + ) |
|
337 | + ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -460,16 +460,16 @@ discard block |
||
460 | 460 | |
461 | 461 | /** |
462 | 462 | * generates HTML for main Prices Admin page |
463 | - * @access protected |
|
464 | - * @return void |
|
465 | - */ |
|
463 | + * @access protected |
|
464 | + * @return void |
|
465 | + */ |
|
466 | 466 | protected function _price_overview_list_table() { |
467 | 467 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
468 | - 'add_new_price', |
|
469 | - 'add', |
|
470 | - array(), |
|
471 | - 'add-new-h2' |
|
472 | - ); |
|
468 | + 'add_new_price', |
|
469 | + 'add', |
|
470 | + array(), |
|
471 | + 'add-new-h2' |
|
472 | + ); |
|
473 | 473 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
474 | 474 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
475 | 475 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | |
482 | 482 | |
483 | 483 | /** |
484 | - * retrieve data for Prices List table |
|
485 | - * @access public |
|
486 | - * @param int $per_page how many prices displayed per page |
|
487 | - * @param boolean $count return the count or objects |
|
488 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | - * @return mixed (int|array) int = count || array of price objects |
|
490 | - */ |
|
484 | + * retrieve data for Prices List table |
|
485 | + * @access public |
|
486 | + * @param int $per_page how many prices displayed per page |
|
487 | + * @param boolean $count return the count or objects |
|
488 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
489 | + * @return mixed (int|array) int = count || array of price objects |
|
490 | + */ |
|
491 | 491 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
492 | 492 | |
493 | 493 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | |
558 | 558 | /** |
559 | 559 | * _price_details |
560 | - * @access protected |
|
561 | - * @return void |
|
562 | - */ |
|
560 | + * @access protected |
|
561 | + * @return void |
|
562 | + */ |
|
563 | 563 | protected function _edit_price_details() { |
564 | 564 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
565 | 565 | // grab price ID |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | |
629 | 629 | /** |
630 | 630 | * declare price details page metaboxes |
631 | - * @access protected |
|
632 | - * @return void |
|
633 | - */ |
|
631 | + * @access protected |
|
632 | + * @return void |
|
633 | + */ |
|
634 | 634 | protected function _price_details_meta_boxes() { |
635 | 635 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
636 | 636 | } |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | |
643 | 643 | /** |
644 | 644 | * _edit_price_details_meta_box |
645 | - * @access public |
|
646 | - * @return void |
|
647 | - */ |
|
645 | + * @access public |
|
646 | + * @return void |
|
647 | + */ |
|
648 | 648 | public function _edit_price_details_meta_box() { |
649 | 649 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
650 | 650 | } |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | |
656 | 656 | /** |
657 | 657 | * set_price_column_values |
658 | - * @access protected |
|
659 | - * @return array |
|
660 | - */ |
|
658 | + * @access protected |
|
659 | + * @return array |
|
660 | + */ |
|
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | 663 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | |
685 | 685 | /** |
686 | 686 | * insert_or_update_price |
687 | - * @param boolean $insert - whether to insert or update |
|
688 | - * @access protected |
|
689 | - * @return void |
|
690 | - */ |
|
687 | + * @param boolean $insert - whether to insert or update |
|
688 | + * @access protected |
|
689 | + * @return void |
|
690 | + */ |
|
691 | 691 | protected function _insert_or_update_price( $insert = FALSE ) { |
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | /** |
762 | 762 | * _trash_or_restore_price |
763 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | - * @access protected |
|
765 | - * @return void |
|
766 | - */ |
|
763 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
764 | + * @access protected |
|
765 | + * @return void |
|
766 | + */ |
|
767 | 767 | protected function _trash_or_restore_price( $trash = TRUE ) { |
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | |
844 | 844 | /** |
845 | 845 | * _delete_price |
846 | - * @access protected |
|
847 | - * @return void |
|
848 | - */ |
|
846 | + * @access protected |
|
847 | + * @return void |
|
848 | + */ |
|
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -922,16 +922,16 @@ discard block |
||
922 | 922 | |
923 | 923 | /** |
924 | 924 | * generates HTML for main Prices Admin page |
925 | - * @access protected |
|
926 | - * @return void |
|
927 | - */ |
|
925 | + * @access protected |
|
926 | + * @return void |
|
927 | + */ |
|
928 | 928 | protected function _price_types_overview_list_table() { |
929 | 929 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
930 | - 'add_new_price_type', |
|
931 | - 'add_type', |
|
932 | - array(), |
|
933 | - 'add-new-h2' |
|
934 | - ); |
|
930 | + 'add_new_price_type', |
|
931 | + 'add_type', |
|
932 | + array(), |
|
933 | + 'add-new-h2' |
|
934 | + ); |
|
935 | 935 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
936 | 936 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
937 | 937 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -943,13 +943,13 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | /** |
946 | - * retrieve data for Price Types List table |
|
947 | - * @access public |
|
948 | - * @param int $per_page how many prices displayed per page |
|
949 | - * @param boolean $count return the count or objects |
|
950 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | - * @return mixed (int|array) int = count || array of price objects |
|
952 | - */ |
|
946 | + * retrieve data for Price Types List table |
|
947 | + * @access public |
|
948 | + * @param int $per_page how many prices displayed per page |
|
949 | + * @param boolean $count return the count or objects |
|
950 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
951 | + * @return mixed (int|array) int = count || array of price objects |
|
952 | + */ |
|
953 | 953 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
954 | 954 | |
955 | 955 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1004,9 +1004,9 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | /** |
1006 | 1006 | * _edit_price_type_details |
1007 | - * @access protected |
|
1008 | - * @return void |
|
1009 | - */ |
|
1007 | + * @access protected |
|
1008 | + * @return void |
|
1009 | + */ |
|
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | 1012 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1070,9 +1070,9 @@ discard block |
||
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * declare price type details page metaboxes |
1073 | - * @access protected |
|
1074 | - * @return void |
|
1075 | - */ |
|
1073 | + * @access protected |
|
1074 | + * @return void |
|
1075 | + */ |
|
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | 1077 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1078 | 1078 | } |
@@ -1083,9 +1083,9 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | /** |
1085 | 1085 | * _edit_price_type_details_meta_box |
1086 | - * @access public |
|
1087 | - * @return void |
|
1088 | - */ |
|
1086 | + * @access public |
|
1087 | + * @return void |
|
1088 | + */ |
|
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | 1090 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1091 | 1091 | } |
@@ -1095,9 +1095,9 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | /** |
1097 | 1097 | * set_price_type_column_values |
1098 | - * @access protected |
|
1099 | - * @return void |
|
1100 | - */ |
|
1098 | + * @access protected |
|
1099 | + * @return void |
|
1100 | + */ |
|
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | 1103 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1145,10 +1145,10 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * _insert_or_update_price_type |
1148 | - * @param boolean $new_price_type - whether to insert or update |
|
1149 | - * @access protected |
|
1150 | - * @return void |
|
1151 | - */ |
|
1148 | + * @param boolean $new_price_type - whether to insert or update |
|
1149 | + * @access protected |
|
1150 | + * @return void |
|
1151 | + */ |
|
1152 | 1152 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1189,10 +1189,10 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | /** |
1191 | 1191 | * _trash_or_restore_price_type |
1192 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | - * @access protected |
|
1194 | - * @return void |
|
1195 | - */ |
|
1192 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1193 | + * @access protected |
|
1194 | + * @return void |
|
1195 | + */ |
|
1196 | 1196 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1246,9 +1246,9 @@ discard block |
||
1246 | 1246 | |
1247 | 1247 | /** |
1248 | 1248 | * _delete_price_type |
1249 | - * @access protected |
|
1250 | - * @return void |
|
1251 | - */ |
|
1249 | + * @access protected |
|
1250 | + * @return void |
|
1251 | + */ |
|
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1285,76 +1285,76 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | /** |
1287 | 1287 | * _learn_more_about_pricing_link |
1288 | - * @access protected |
|
1289 | - * @return string |
|
1290 | - */ |
|
1288 | + * @access protected |
|
1289 | + * @return string |
|
1290 | + */ |
|
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | 1292 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | |
1297 | - protected function _tax_settings() { |
|
1298 | - $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | - $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | - $this->display_admin_page_with_sidebar(); |
|
1302 | - } |
|
1303 | - |
|
1304 | - |
|
1305 | - |
|
1306 | - /** |
|
1307 | - * @return \EE_Form_Section_Proper |
|
1308 | - * @throws \EE_Error |
|
1309 | - */ |
|
1310 | - protected function tax_settings_form() { |
|
1311 | - return new EE_Form_Section_Proper( |
|
1312 | - array( |
|
1313 | - 'name' => 'tax_settings_form', |
|
1314 | - 'html_id' => 'tax_settings_form', |
|
1315 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | - 'subsections' => apply_filters( |
|
1317 | - 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | - array( |
|
1319 | - 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | - array( |
|
1321 | - 'name' => 'tax_settings_tbl', |
|
1322 | - 'html_id' => 'tax_settings_tbl', |
|
1323 | - 'html_class' => 'form-table', |
|
1324 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | - 'subsections' => array( |
|
1326 | - 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | - array( |
|
1328 | - 'html_label_text' => __( |
|
1329 | - "Show Prices With Taxes Included?", |
|
1330 | - 'event_espresso' |
|
1331 | - ), |
|
1332 | - 'html_help_text' => __( |
|
1333 | - 'Indicates whether or not to display prices with the taxes included', |
|
1334 | - 'event_espresso' |
|
1335 | - ), |
|
1336 | - 'default' => isset( |
|
1337 | - EE_Registry::instance() |
|
1338 | - ->CFG |
|
1339 | - ->tax_settings |
|
1340 | - ->prices_displayed_including_taxes |
|
1341 | - ) |
|
1342 | - ? EE_Registry::instance() |
|
1343 | - ->CFG |
|
1344 | - ->tax_settings |
|
1345 | - ->prices_displayed_including_taxes |
|
1346 | - : true, |
|
1347 | - 'display_html_label_text' => false |
|
1348 | - ) |
|
1349 | - ), |
|
1350 | - ) |
|
1351 | - ) |
|
1352 | - ) |
|
1353 | - ) |
|
1354 | - ) |
|
1355 | - ) |
|
1356 | - ); |
|
1357 | - } |
|
1297 | + protected function _tax_settings() { |
|
1298 | + $this->_set_add_edit_form_tags('update_tax_settings'); |
|
1299 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1300 | + $this->_template_args['admin_page_content'] = $this->tax_settings_form()->get_html(); |
|
1301 | + $this->display_admin_page_with_sidebar(); |
|
1302 | + } |
|
1303 | + |
|
1304 | + |
|
1305 | + |
|
1306 | + /** |
|
1307 | + * @return \EE_Form_Section_Proper |
|
1308 | + * @throws \EE_Error |
|
1309 | + */ |
|
1310 | + protected function tax_settings_form() { |
|
1311 | + return new EE_Form_Section_Proper( |
|
1312 | + array( |
|
1313 | + 'name' => 'tax_settings_form', |
|
1314 | + 'html_id' => 'tax_settings_form', |
|
1315 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
1316 | + 'subsections' => apply_filters( |
|
1317 | + 'FHEE__Pricing_Admin_Page__tax_settings_form__form_subsections', |
|
1318 | + array( |
|
1319 | + 'tax_settings' => new EE_Form_Section_Proper( |
|
1320 | + array( |
|
1321 | + 'name' => 'tax_settings_tbl', |
|
1322 | + 'html_id' => 'tax_settings_tbl', |
|
1323 | + 'html_class' => 'form-table', |
|
1324 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1325 | + 'subsections' => array( |
|
1326 | + 'prices_displayed_including_taxes' => new EE_Yes_No_Input( |
|
1327 | + array( |
|
1328 | + 'html_label_text' => __( |
|
1329 | + "Show Prices With Taxes Included?", |
|
1330 | + 'event_espresso' |
|
1331 | + ), |
|
1332 | + 'html_help_text' => __( |
|
1333 | + 'Indicates whether or not to display prices with the taxes included', |
|
1334 | + 'event_espresso' |
|
1335 | + ), |
|
1336 | + 'default' => isset( |
|
1337 | + EE_Registry::instance() |
|
1338 | + ->CFG |
|
1339 | + ->tax_settings |
|
1340 | + ->prices_displayed_including_taxes |
|
1341 | + ) |
|
1342 | + ? EE_Registry::instance() |
|
1343 | + ->CFG |
|
1344 | + ->tax_settings |
|
1345 | + ->prices_displayed_including_taxes |
|
1346 | + : true, |
|
1347 | + 'display_html_label_text' => false |
|
1348 | + ) |
|
1349 | + ), |
|
1350 | + ) |
|
1351 | + ) |
|
1352 | + ) |
|
1353 | + ) |
|
1354 | + ) |
|
1355 | + ) |
|
1356 | + ); |
|
1357 | + } |
|
1358 | 1358 | |
1359 | 1359 | |
1360 | 1360 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
224 | 224 | ) |
225 | 225 | ), |
226 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
226 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
227 | 227 | 'require_nonce' => FALSE |
228 | 228 | ), |
229 | 229 | 'add_new_price' => array( |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | ) |
240 | 240 | ), |
241 | 241 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
242 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
242 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
243 | 243 | 'require_nonce' => FALSE |
244 | 244 | ), |
245 | 245 | 'edit_price' => array( |
246 | 246 | 'nav' => array( |
247 | 247 | 'label' => __('Edit Default Price', 'event_espresso'), |
248 | 248 | 'order' => 20, |
249 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
249 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
250 | 250 | 'persistent' => FALSE |
251 | 251 | ), |
252 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
252 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
253 | 253 | 'help_tabs' => array( |
254 | 254 | 'edit_default_price_help_tab' => array( |
255 | 255 | 'title' => __('Edit Default Price', 'event_espresso'), |
256 | 256 | 'filename' => 'pricing_edit_default_price' |
257 | 257 | ) |
258 | 258 | ), |
259 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
259 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
260 | 260 | 'require_nonce' => FALSE |
261 | 261 | ), |
262 | 262 | 'price_types' => array( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
280 | 280 | ), |
281 | 281 | ), |
282 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
282 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
283 | 283 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | 'filename' => 'pricing_add_new_price_type' |
296 | 296 | ) |
297 | 297 | ), |
298 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
299 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
298 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
299 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
300 | 300 | 'require_nonce' => FALSE |
301 | 301 | ), |
302 | 302 | 'edit_price_type' => array( |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | 'filename' => 'pricing_edit_price_type' |
312 | 312 | ) |
313 | 313 | ), |
314 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
315 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
314 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
315 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
316 | 316 | |
317 | 317 | 'require_nonce' => FALSE |
318 | 318 | ), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public function load_scripts_styles() { |
368 | 368 | //styles |
369 | 369 | wp_enqueue_style('espresso-ui-theme'); |
370 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
370 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
371 | 371 | wp_enqueue_style('espresso_PRICING'); |
372 | 372 | |
373 | 373 | //scripts |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | //wp_enqueue_script('jquery-ui-dialog'); |
378 | 378 | //wp_enqueue_script('jquery-ui-draggable'); |
379 | 379 | //wp_enqueue_script('jquery-ui-datepicker'); |
380 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
381 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
380 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
381 | + wp_enqueue_script('espresso_PRICING'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | public function load_scripts_styles_default() { |
389 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
389 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
417 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
418 | 418 | $this->_views['trashed'] = array( |
419 | 419 | 'slug' => 'trashed', |
420 | 420 | 'label' => __('Trash', 'event_espresso'), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | |
447 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
447 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
448 | 448 | $this->_views['trashed'] = array( |
449 | 449 | 'slug' => 'trashed', |
450 | 450 | 'label' => __('Trash', 'event_espresso'), |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return void |
465 | 465 | */ |
466 | 466 | protected function _price_overview_list_table() { |
467 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
467 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
468 | 468 | 'add_new_price', |
469 | 469 | 'add', |
470 | 470 | array(), |
@@ -488,18 +488,18 @@ discard block |
||
488 | 488 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
489 | 489 | * @return mixed (int|array) int = count || array of price objects |
490 | 490 | */ |
491 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
491 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
492 | 492 | |
493 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
493 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
494 | 494 | // start with an empty array |
495 | 495 | $event_pricing = array(); |
496 | 496 | |
497 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
498 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
497 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
498 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
499 | 499 | //$PRC = EEM_Price::instance(); |
500 | 500 | |
501 | 501 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
502 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
502 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
503 | 503 | |
504 | 504 | switch ($this->_req_data['orderby']) { |
505 | 505 | case 'name': |
@@ -512,27 +512,27 @@ discard block |
||
512 | 512 | $orderby = array('PRC_amount'=>$order); |
513 | 513 | break; |
514 | 514 | default: |
515 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
515 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
516 | 516 | } |
517 | 517 | |
518 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
519 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
518 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
519 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
520 | 520 | |
521 | 521 | $_where = array( |
522 | 522 | 'PRC_is_default' => 1, |
523 | 523 | 'PRC_deleted' => $trashed |
524 | 524 | ); |
525 | 525 | |
526 | - $offset = ($current_page-1)*$per_page; |
|
527 | - $limit = array( $offset, $per_page ); |
|
526 | + $offset = ($current_page - 1) * $per_page; |
|
527 | + $limit = array($offset, $per_page); |
|
528 | 528 | |
529 | - if ( isset( $this->_req_data['s'] ) ) { |
|
530 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
529 | + if (isset($this->_req_data['s'])) { |
|
530 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
531 | 531 | $_where['OR'] = array( |
532 | - 'PRC_name' => array('LIKE',$sstr ), |
|
533 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
534 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
535 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
532 | + 'PRC_name' => array('LIKE', $sstr), |
|
533 | + 'PRC_desc' => array('LIKE', $sstr), |
|
534 | + 'PRC_amount' => array('LIKE', $sstr), |
|
535 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | 'group_by'=>'PRC_ID' |
544 | 544 | ); |
545 | 545 | |
546 | - if($count){ |
|
547 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | - }else{ |
|
546 | + if ($count) { |
|
547 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
548 | + } else { |
|
549 | 549 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
550 | 550 | } |
551 | 551 | } |
@@ -561,49 +561,49 @@ discard block |
||
561 | 561 | * @return void |
562 | 562 | */ |
563 | 563 | protected function _edit_price_details() { |
564 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
564 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
565 | 565 | // grab price ID |
566 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
566 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
567 | 567 | // change page title based on request action |
568 | - switch( $this->_req_action ) { |
|
568 | + switch ($this->_req_action) { |
|
569 | 569 | case 'add_new_price' : |
570 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
570 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
571 | 571 | break; |
572 | 572 | case 'edit_price' : |
573 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
573 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
574 | 574 | break; |
575 | 575 | default : |
576 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
576 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
577 | 577 | } |
578 | 578 | // add PRC_ID to title if editing |
579 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
579 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
580 | 580 | |
581 | 581 | // get prices |
582 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
582 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
583 | 583 | $PRC = EEM_Price::instance(); |
584 | 584 | |
585 | - if ( $PRC_ID ) { |
|
586 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
585 | + if ($PRC_ID) { |
|
586 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
587 | 587 | $additional_hidden_fields = array( |
588 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
588 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
589 | 589 | ); |
590 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
590 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
591 | 591 | } else { |
592 | 592 | $price = $PRC->get_new_price(); |
593 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
593 | + $this->_set_add_edit_form_tags('insert_price'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | $this->_template_args['PRC_ID'] = $PRC_ID; |
597 | 597 | $this->_template_args['price'] = $price; |
598 | 598 | |
599 | 599 | // get price types |
600 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
600 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
601 | 601 | $PRT = EEM_Price_Type::instance(); |
602 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
602 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
603 | 603 | $price_type_names = array(); |
604 | 604 | if (empty($price_types)) { |
605 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
606 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
605 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
606 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
607 | 607 | exit(); |
608 | 608 | } else { |
609 | 609 | foreach ($price_types as $type) { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $this->_template_args['price_types'] = $price_type_names; |
617 | 617 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
618 | 618 | |
619 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
619 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
620 | 620 | // the details template wrapper |
621 | 621 | $this->display_admin_page_with_sidebar(); |
622 | 622 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @return void |
633 | 633 | */ |
634 | 634 | protected function _price_details_meta_boxes() { |
635 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
635 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @return void |
647 | 647 | */ |
648 | 648 | public function _edit_price_details_meta_box() { |
649 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
649 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | protected function set_price_column_values() { |
662 | 662 | |
663 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
663 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
664 | 664 | |
665 | 665 | $set_column_values = array( |
666 | 666 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | * @access protected |
689 | 689 | * @return void |
690 | 690 | */ |
691 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
691 | + protected function _insert_or_update_price($insert = FALSE) { |
|
692 | 692 | |
693 | 693 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
694 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
694 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
695 | 695 | |
696 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
696 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
697 | 697 | $PRC = EEM_Price::instance(); |
698 | 698 | |
699 | 699 | // why be so pessimistic ??? : ( |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | |
702 | 702 | $set_column_values = $this->set_price_column_values(); |
703 | 703 | // is this a new Price ? |
704 | - if ( $insert ) { |
|
704 | + if ($insert) { |
|
705 | 705 | // run the insert |
706 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
706 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
707 | 707 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
708 | 708 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
709 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
709 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
710 | 710 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
711 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
711 | + $ticket->_add_relation_to($PR, 'Price'); |
|
712 | 712 | $ticket->save(); |
713 | 713 | } |
714 | 714 | $success = 1; |
@@ -718,29 +718,29 @@ discard block |
||
718 | 718 | } |
719 | 719 | $action_desc = 'created'; |
720 | 720 | } else { |
721 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
721 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
722 | 722 | // run the update |
723 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
724 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
723 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
724 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
725 | 725 | $success = 1; |
726 | 726 | } |
727 | 727 | |
728 | 728 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
729 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
729 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
730 | 730 | |
731 | 731 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
732 | - if ( $PRC_ID === 1 ) { |
|
732 | + if ($PRC_ID === 1) { |
|
733 | 733 | $ticket = $PR->get_first_related('Ticket'); |
734 | - if ( $ticket ) { |
|
735 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
736 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
734 | + if ($ticket) { |
|
735 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
736 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
737 | 737 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
738 | 738 | $ticket->save(); |
739 | 739 | } |
740 | 740 | } else { |
741 | 741 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
742 | 742 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
743 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
743 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
744 | 744 | $ticket->save(); |
745 | 745 | } |
746 | 746 | } |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | $action_desc = 'updated'; |
749 | 749 | } |
750 | 750 | |
751 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
751 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
752 | 752 | |
753 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
753 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
754 | 754 | |
755 | 755 | } |
756 | 756 | |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | * @access protected |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
767 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
768 | 768 | |
769 | 769 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
770 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
770 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
771 | 771 | |
772 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
772 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
773 | 773 | $PRC = EEM_Price::instance(); |
774 | 774 | |
775 | 775 | $success = 1; |
@@ -778,18 +778,18 @@ discard block |
||
778 | 778 | //get base ticket for updating |
779 | 779 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
780 | 780 | //Checkboxes |
781 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
781 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
782 | 782 | // if array has more than one element than success message should be plural |
783 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
783 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
784 | 784 | // cycle thru checkboxes |
785 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
786 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
785 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
786 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
787 | 787 | $success = 0; |
788 | 788 | } else { |
789 | 789 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
790 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
790 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
791 | 791 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
792 | - if ( $PRC_deleted ) { |
|
792 | + if ($PRC_deleted) { |
|
793 | 793 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
794 | 794 | } else { |
795 | 795 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | |
802 | 802 | } else { |
803 | 803 | // grab single id and delete |
804 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
805 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
804 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
805 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
806 | 806 | $success = 0; |
807 | 807 | } else { |
808 | 808 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
809 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
809 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
810 | 810 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
811 | - if ( $PRC_deleted ) { |
|
811 | + if ($PRC_deleted) { |
|
812 | 812 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
813 | 813 | } else { |
814 | 814 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -822,17 +822,17 @@ discard block |
||
822 | 822 | 'action' => 'default' |
823 | 823 | ); |
824 | 824 | |
825 | - if ( $success ) { |
|
826 | - if ( $trash ) { |
|
825 | + if ($success) { |
|
826 | + if ($trash) { |
|
827 | 827 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
828 | 828 | } else { |
829 | 829 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
830 | 830 | } |
831 | 831 | |
832 | - EE_Error::add_success( $msg ); |
|
832 | + EE_Error::add_success($msg); |
|
833 | 833 | } |
834 | 834 | |
835 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
835 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
836 | 836 | |
837 | 837 | } |
838 | 838 | |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | protected function _delete_price() { |
850 | 850 | |
851 | 851 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
852 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
852 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
853 | 853 | |
854 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
854 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
855 | 855 | $PRC = EEM_Price::instance(); |
856 | 856 | |
857 | 857 | $success = 1; |
858 | 858 | //Checkboxes |
859 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
859 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
860 | 860 | // if array has more than one element than success message should be plural |
861 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
861 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
862 | 862 | // cycle thru bulk action checkboxes |
863 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
864 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
863 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
864 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
865 | 865 | $success = 0; |
866 | 866 | } |
867 | 867 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | |
876 | 876 | } |
877 | 877 | |
878 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
878 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | |
@@ -883,16 +883,16 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | public function update_price_order() { |
886 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
886 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
887 | 887 | |
888 | 888 | // grab our row IDs |
889 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
889 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
890 | 890 | |
891 | - if ( is_array( $row_ids )) { |
|
892 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
891 | + if (is_array($row_ids)) { |
|
892 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
893 | 893 | //Update the prices when re-ordering |
894 | 894 | $id = absint($row_ids[$i]); |
895 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
895 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
896 | 896 | $success = FALSE; |
897 | 897 | } |
898 | 898 | } |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | $success = FALSE; |
901 | 901 | } |
902 | 902 | |
903 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
903 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
904 | 904 | |
905 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
905 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
906 | 906 | die(); |
907 | 907 | } |
908 | 908 | |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | * @return void |
927 | 927 | */ |
928 | 928 | protected function _price_types_overview_list_table() { |
929 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
929 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
930 | 930 | 'add_new_price_type', |
931 | 931 | 'add_type', |
932 | 932 | array(), |
@@ -950,46 +950,46 @@ discard block |
||
950 | 950 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
951 | 951 | * @return mixed (int|array) int = count || array of price objects |
952 | 952 | */ |
953 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
953 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
954 | 954 | |
955 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
955 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
956 | 956 | // start with an empty array |
957 | 957 | |
958 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
959 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
958 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
959 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
960 | 960 | |
961 | 961 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
962 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
962 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
963 | 963 | switch ($this->_req_data['orderby']) { |
964 | 964 | case 'name': |
965 | - $orderby = array( 'PRT_name' => $order); |
|
965 | + $orderby = array('PRT_name' => $order); |
|
966 | 966 | break; |
967 | 967 | default: |
968 | - $orderby = array( 'PRT_order' => $order); |
|
968 | + $orderby = array('PRT_order' => $order); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | |
972 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
973 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
972 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
973 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
974 | 974 | |
975 | - $offset = ($current_page-1)*$per_page; |
|
976 | - $limit = array( $offset, $per_page ); |
|
975 | + $offset = ($current_page - 1) * $per_page; |
|
976 | + $limit = array($offset, $per_page); |
|
977 | 977 | |
978 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
978 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
979 | 979 | |
980 | - if ( isset( $this->_req_data['s'] ) ) { |
|
981 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
980 | + if (isset($this->_req_data['s'])) { |
|
981 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
982 | 982 | $_where['OR'] = array( |
983 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
983 | + 'PRT_name' => array('LIKE', $sstr) |
|
984 | 984 | ); |
985 | 985 | } |
986 | 986 | $query_params = array( |
987 | 987 | $_where, |
988 | 988 | 'order_by'=>$orderby, |
989 | 989 | 'limit'=>$limit); |
990 | - if($count){ |
|
990 | + if ($count) { |
|
991 | 991 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
992 | - }else{ |
|
992 | + } else { |
|
993 | 993 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
994 | 994 | } |
995 | 995 | |
@@ -1009,34 +1009,34 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | protected function _edit_price_type_details() { |
1011 | 1011 | |
1012 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1012 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1013 | 1013 | |
1014 | 1014 | |
1015 | 1015 | // grab price type ID |
1016 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
1016 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
1017 | 1017 | // change page title based on request action |
1018 | - switch( $this->_req_action ) { |
|
1018 | + switch ($this->_req_action) { |
|
1019 | 1019 | case 'add_new_price_type' : |
1020 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
1020 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
1021 | 1021 | break; |
1022 | 1022 | case 'edit_price_type' : |
1023 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
1023 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
1024 | 1024 | break; |
1025 | 1025 | default : |
1026 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
1026 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1027 | 1027 | } |
1028 | 1028 | // add PRT_ID to title if editing |
1029 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1029 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1030 | 1030 | |
1031 | 1031 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1032 | 1032 | |
1033 | - if ( $PRT_ID ) { |
|
1034 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1035 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1036 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1033 | + if ($PRT_ID) { |
|
1034 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1035 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1036 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1037 | 1037 | } else { |
1038 | 1038 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1039 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1039 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1045,19 +1045,19 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1047 | 1047 | $select_values = array(); |
1048 | - foreach ( $base_types as $ref => $text ) { |
|
1049 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1048 | + foreach ($base_types as $ref => $text) { |
|
1049 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1050 | 1050 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1051 | 1051 | continue; |
1052 | 1052 | } |
1053 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1053 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | 1057 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1058 | 1058 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1059 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1060 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1059 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1060 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1061 | 1061 | // the details template wrapper |
1062 | 1062 | $this->display_admin_page_with_sidebar(); |
1063 | 1063 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * @return void |
1075 | 1075 | */ |
1076 | 1076 | protected function _price_type_details_meta_boxes() { |
1077 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1077 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | * @return void |
1088 | 1088 | */ |
1089 | 1089 | public function _edit_price_type_details_meta_box() { |
1090 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1090 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
@@ -1100,9 +1100,9 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | protected function set_price_type_column_values() { |
1102 | 1102 | |
1103 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1103 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1104 | 1104 | |
1105 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1105 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1106 | 1106 | |
1107 | 1107 | switch ($base_type) { |
1108 | 1108 | |
@@ -1149,12 +1149,12 @@ discard block |
||
1149 | 1149 | * @access protected |
1150 | 1150 | * @return void |
1151 | 1151 | */ |
1152 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1152 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1153 | 1153 | |
1154 | 1154 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1155 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1155 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1156 | 1156 | |
1157 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1157 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1158 | 1158 | $PRT = EEM_Price_Type::instance(); |
1159 | 1159 | |
1160 | 1160 | // why be so pessimistic ??? : ( |
@@ -1162,24 +1162,24 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | $set_column_values = $this->set_price_type_column_values(); |
1164 | 1164 | // is this a new Price ? |
1165 | - if ( $new_price_type ) { |
|
1165 | + if ($new_price_type) { |
|
1166 | 1166 | // run the insert |
1167 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1167 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1168 | 1168 | $success = 1; |
1169 | 1169 | } |
1170 | 1170 | $action_desc = 'created'; |
1171 | 1171 | } else { |
1172 | 1172 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1173 | 1173 | // run the update |
1174 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1175 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1174 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1175 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1176 | 1176 | $success = 1; |
1177 | 1177 | } |
1178 | 1178 | $action_desc = 'updated'; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1182 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1181 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1182 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1183 | 1183 | |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1193,49 +1193,49 @@ discard block |
||
1193 | 1193 | * @access protected |
1194 | 1194 | * @return void |
1195 | 1195 | */ |
1196 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1196 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1197 | 1197 | |
1198 | 1198 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1199 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1199 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1200 | 1200 | |
1201 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1201 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | $PRT_deleted = $trash ? TRUE : FALSE; |
1206 | 1206 | //Checkboxes |
1207 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1207 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1208 | 1208 | // if array has more than one element than success message should be plural |
1209 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1210 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1209 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1210 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1211 | 1211 | // cycle thru checkboxes |
1212 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1213 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1212 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1213 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1214 | 1214 | $success = 0; |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | } else { |
1219 | 1219 | // grab single id and delete |
1220 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1221 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1220 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1221 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1222 | 1222 | $success = 0; |
1223 | 1223 | } |
1224 | 1224 | $what = 'Price Type'; |
1225 | 1225 | |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - $query_args = array( 'action' => 'price_types' ); |
|
1229 | - if ( $success ) { |
|
1230 | - if ( $trash ) { |
|
1228 | + $query_args = array('action' => 'price_types'); |
|
1229 | + if ($success) { |
|
1230 | + if ($trash) { |
|
1231 | 1231 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1232 | 1232 | } else { |
1233 | 1233 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1234 | 1234 | } |
1235 | - EE_Error::add_success( $msg ); |
|
1235 | + EE_Error::add_success($msg); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1238 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1239 | 1239 | |
1240 | 1240 | } |
1241 | 1241 | |
@@ -1252,19 +1252,19 @@ discard block |
||
1252 | 1252 | protected function _delete_price_type() { |
1253 | 1253 | |
1254 | 1254 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1255 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1255 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1256 | 1256 | |
1257 | 1257 | $PRT = EEM_Price_Type::instance(); |
1258 | 1258 | |
1259 | 1259 | $success = 1; |
1260 | 1260 | //Checkboxes |
1261 | - if (!empty($this->_req_data['checkbox'])) { |
|
1261 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1262 | 1262 | // if array has more than one element than success message should be plural |
1263 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1263 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1264 | 1264 | $what = $PRT->item_name($success); |
1265 | 1265 | // cycle thru bulk action checkboxes |
1266 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1267 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1266 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1267 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1268 | 1268 | $success = 0; |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1272,8 +1272,8 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | - $query_args = array( 'action'=> 'price_types' ); |
|
1276 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1275 | + $query_args = array('action'=> 'price_types'); |
|
1276 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | * @return string |
1290 | 1290 | */ |
1291 | 1291 | protected function _learn_more_about_pricing_link() { |
1292 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1292 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
@@ -1365,17 +1365,17 @@ discard block |
||
1365 | 1365 | * @return void |
1366 | 1366 | */ |
1367 | 1367 | public function _update_tax_settings() { |
1368 | - if ( ! isset( EE_Registry::instance()->CFG->tax_settings ) ) { |
|
1368 | + if ( ! isset(EE_Registry::instance()->CFG->tax_settings)) { |
|
1369 | 1369 | EE_Registry::instance()->CFG->tax_settings = new EE_Tax_Config(); |
1370 | 1370 | } |
1371 | 1371 | try { |
1372 | 1372 | $tax_form = $this->tax_settings_form(); |
1373 | 1373 | //check for form submission |
1374 | - if ( $tax_form->was_submitted() ) { |
|
1374 | + if ($tax_form->was_submitted()) { |
|
1375 | 1375 | //capture form data |
1376 | 1376 | $tax_form->receive_form_submission(); |
1377 | 1377 | //validate form data |
1378 | - if ( $tax_form->is_valid() ) { |
|
1378 | + if ($tax_form->is_valid()) { |
|
1379 | 1379 | //grab validated data from form |
1380 | 1380 | $valid_data = $tax_form->valid_data(); |
1381 | 1381 | //set data on config |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | ->prices_displayed_including_taxes |
1386 | 1386 | = $valid_data['tax_settings']['prices_displayed_including_taxes']; |
1387 | 1387 | } else { |
1388 | - if ( $tax_form->submission_error_message() !== '' ) { |
|
1388 | + if ($tax_form->submission_error_message() !== '') { |
|
1389 | 1389 | EE_Error::add_error( |
1390 | 1390 | $tax_form->submission_error_message(), |
1391 | 1391 | __FILE__, |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | } |
1396 | 1396 | } |
1397 | 1397 | } |
1398 | - } catch ( EE_Error $e ) { |
|
1399 | - EE_Error::add_error( $e->get_error(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1398 | + } catch (EE_Error $e) { |
|
1399 | + EE_Error::add_error($e->get_error(), __FILE__, __FUNCTION__, __LINE__); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | $what = 'Tax Settings'; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | __FUNCTION__, |
1408 | 1408 | __LINE__ |
1409 | 1409 | ); |
1410 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'tax_settings' ) ); |
|
1410 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'tax_settings')); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 |