@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function set_hooks() { |
94 | - add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 ); |
|
94 | + add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function set_hooks_admin() { |
104 | 104 | // AJAX for IPN monitoring |
105 | - add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
106 | - add_filter( 'heartbeat_nopriv_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
107 | - add_action( 'wp_ajax_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 ); |
|
108 | - add_action( 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 ); |
|
105 | + add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
106 | + add_filter('heartbeat_nopriv_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
107 | + add_action('wp_ajax_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2); |
|
108 | + add_action('wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @return void |
118 | 118 | */ |
119 | 119 | public static function set_definitions() { |
120 | - define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
121 | - define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
120 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
121 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | * @return EE_Transaction |
131 | 131 | */ |
132 | 132 | public function get_txn() { |
133 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
133 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
134 | 134 | return $this->_current_txn; |
135 | 135 | } |
136 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
137 | - if ( ! $TXN_model instanceof EEM_Transaction ) { |
|
136 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
137 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
138 | 138 | EE_Error::add_error( |
139 | - __( 'The transaction model could not be established.', 'event_espresso' ), |
|
139 | + __('The transaction model could not be established.', 'event_espresso'), |
|
140 | 140 | __FILE__, __FUNCTION__, __LINE__ |
141 | 141 | ); |
142 | 142 | return NULL; |
143 | 143 | } |
144 | 144 | //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
145 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link ); |
|
145 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
146 | 146 | // verify TXN |
147 | - if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) { |
|
147 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
148 | 148 | EE_Error::add_error( |
149 | - __( 'No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso' ), |
|
149 | + __('No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso'), |
|
150 | 150 | __FILE__, __FUNCTION__, __LINE__ |
151 | 151 | ); |
152 | 152 | return NULL; |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | * @param int $since |
164 | 164 | * @return mixed array of EE_Payment || FALSE |
165 | 165 | */ |
166 | - public function get_txn_payments( $since = 0 ) { |
|
167 | - if ( ! $this->get_txn() ) { |
|
166 | + public function get_txn_payments($since = 0) { |
|
167 | + if ( ! $this->get_txn()) { |
|
168 | 168 | return FALSE; |
169 | 169 | } |
170 | - $args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
|
171 | - if ( $since > 0 ) { |
|
172 | - $args[0] = array( 'PAY_timestamp' => array( '>', $since )); |
|
170 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
171 | + if ($since > 0) { |
|
172 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
173 | 173 | } |
174 | 174 | // get array of payments with most recent first |
175 | - $payments = $this->_current_txn->payments( $args ); |
|
175 | + $payments = $this->_current_txn->payments($args); |
|
176 | 176 | // global $wpdb; |
177 | 177 | // echo $wpdb->last_query; |
178 | 178 | // EEH_Debug_Tools::printr( $payments, '$payments <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | * @return void |
189 | 189 | */ |
190 | 190 | private function _get_reg_url_link() { |
191 | - if ( ! empty( $this->_reg_url_link )) { |
|
191 | + if ( ! empty($this->_reg_url_link)) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | // only do thank you page stuff if we have a REG_url_link in the url |
195 | - if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' )) { |
|
195 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
196 | 196 | EE_Error::add_error( |
197 | - __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ), |
|
197 | + __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso'), |
|
198 | 198 | __FILE__, __FUNCTION__, __LINE__ |
199 | 199 | ); |
200 | 200 | return; |
201 | 201 | } |
202 | 202 | // check for reg_url_link |
203 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' ); |
|
203 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @param string $reg_url_link |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - public function set_reg_url_link( $reg_url_link = NULL ) { |
|
216 | - $this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link; |
|
215 | + public function set_reg_url_link($reg_url_link = NULL) { |
|
216 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -226,25 +226,25 @@ discard block |
||
226 | 226 | * @param WP $WP |
227 | 227 | * @return void |
228 | 228 | */ |
229 | - public function run( WP $WP ) { |
|
229 | + public function run(WP $WP) { |
|
230 | 230 | // remove site_url() from thank you page URL |
231 | - $thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) ); |
|
231 | + $thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url())); |
|
232 | 232 | // remove other non-essential details from URL |
233 | - $thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' ); |
|
233 | + $thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/'); |
|
234 | 234 | // ensure this shortcode doesn't trigger on anything BUT the thank you page |
235 | - if ( isset( $WP->request ) && trim( $WP->request, '/' ) != $thank_you_page_URL ) { |
|
235 | + if (isset($WP->request) && trim($WP->request, '/') != $thank_you_page_URL) { |
|
236 | 236 | return; |
237 | - } else if ( isset( $WP->query_vars['page_id'] ) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
237 | + } else if (isset($WP->query_vars['page_id']) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | $this->_get_reg_url_link(); |
241 | 241 | // resend_reg_confirmation_email ? |
242 | - if ( EE_Registry::instance()->REQ->is_set( 'resend' )) { |
|
242 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
243 | 243 | EES_Espresso_Thank_You::resend_reg_confirmation_email(); |
244 | 244 | } |
245 | 245 | // load assets |
246 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 ); |
|
247 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
246 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
247 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
248 | 248 | $this->_translate_strings(); |
249 | 249 | } |
250 | 250 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | * @return void |
258 | 258 | */ |
259 | 259 | protected function _translate_strings() { |
260 | - EE_Registry::$i18n_js_strings[ 'e_reg_url_link' ] = $this->_reg_url_link; |
|
261 | - EE_Registry::$i18n_js_strings[ 'initial_access' ] = time(); |
|
262 | - EE_Registry::$i18n_js_strings[ 'IPN_wait_time' ] = EES_Espresso_Thank_You::IPN_wait_time; |
|
263 | - EE_Registry::$i18n_js_strings[ 'TXN_complete' ] = EEM_Transaction::complete_status_code; |
|
264 | - EE_Registry::$i18n_js_strings[ 'TXN_incomplete' ] = EEM_Transaction::incomplete_status_code; |
|
265 | - EE_Registry::$i18n_js_strings[ 'checking_for_new_payments' ] = __( 'checking for new payments...', 'event_espresso' ); |
|
266 | - EE_Registry::$i18n_js_strings[ 'loading_payment_info' ] = __( 'loading payment information...', 'event_espresso' ); |
|
267 | - EE_Registry::$i18n_js_strings[ 'server_error' ] = __( 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso' ); |
|
268 | - EE_Registry::$i18n_js_strings[ 'slow_IPN' ] = apply_filters( |
|
260 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
261 | + EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
262 | + EE_Registry::$i18n_js_strings['IPN_wait_time'] = EES_Espresso_Thank_You::IPN_wait_time; |
|
263 | + EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
264 | + EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
265 | + EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __('checking for new payments...', 'event_espresso'); |
|
266 | + EE_Registry::$i18n_js_strings['loading_payment_info'] = __('loading payment information...', 'event_espresso'); |
|
267 | + EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso'); |
|
268 | + EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
269 | 269 | 'EES_Espresso_Thank_You__load_js__slow_IPN', |
270 | 270 | sprintf( |
271 | - __( '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso' ), |
|
271 | + __('%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso'), |
|
272 | 272 | '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
273 | 273 | '</div>' |
274 | 274 | ) |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | * @return void |
286 | 286 | */ |
287 | 287 | public function load_js() { |
288 | - wp_register_script( 'thank_you_page', THANK_YOU_ASSETS_URL . 'thank_you_page.js', array( 'espresso_core', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
289 | - wp_enqueue_script( 'thank_you_page' ); |
|
288 | + wp_register_script('thank_you_page', THANK_YOU_ASSETS_URL.'thank_you_page.js', array('espresso_core', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
289 | + wp_enqueue_script('thank_you_page'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function init() { |
301 | 301 | $this->_get_reg_url_link(); |
302 | - if ( ! $this->get_txn() ) { |
|
303 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
302 | + if ( ! $this->get_txn()) { |
|
303 | + EE_Registry::instance()->load_helper('HTML'); |
|
304 | 304 | |
305 | 305 | echo EEH_HTML::div( |
306 | - EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) . |
|
306 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
307 | 307 | sprintf( |
308 | - __( 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso' ), |
|
308 | + __('This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso'), |
|
309 | 309 | '<br/>' |
310 | 310 | ), |
311 | 311 | '', 'ee-attention' |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | return NULL; |
314 | 314 | } |
315 | 315 | // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
316 | - if ( $this->_current_txn->status_ID() == EEM_Transaction::failed_status_code ) { |
|
317 | - $this->_current_txn->set_status( EEM_Transaction::incomplete_status_code ); |
|
316 | + if ($this->_current_txn->status_ID() == EEM_Transaction::failed_status_code) { |
|
317 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
318 | 318 | $this->_current_txn->save(); |
319 | 319 | } |
320 | 320 | $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration ? $this->_current_txn->primary_registration() : NULL; |
321 | 321 | $this->_is_primary = $this->_primary_registrant->reg_url_link() == $this->_reg_url_link ? TRUE : FALSE; |
322 | 322 | |
323 | - $show_try_pay_again_link_default = apply_filters( 'AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE ); |
|
323 | + $show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE); |
|
324 | 324 | // txn status ? |
325 | - if( $this->_current_txn->is_completed() ){ |
|
325 | + if ($this->_current_txn->is_completed()) { |
|
326 | 326 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
327 | - } else if ( $this->_current_txn->is_incomplete() && ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() )){ |
|
327 | + } else if ($this->_current_txn->is_incomplete() && ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment())) { |
|
328 | 328 | $this->_show_try_pay_again_link = TRUE; |
329 | - } else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) { |
|
329 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
330 | 330 | // its pending |
331 | - $this->_show_try_pay_again_link = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default; |
|
331 | + $this->_show_try_pay_again_link = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default; |
|
332 | 332 | } else { |
333 | 333 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
334 | 334 | } |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | } |
351 | 351 | // link to SPCO |
352 | 352 | $revisit_spco_url = add_query_arg( |
353 | - array( 'ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link ), |
|
353 | + array('ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link), |
|
354 | 354 | EE_Registry::instance()->CFG->core->reg_page_url() |
355 | 355 | ); |
356 | 356 | // link to SPCO payment_options |
357 | - $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg( array('step'=>'payment_options' ), $revisit_spco_url ); |
|
357 | + $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg(array('step'=>'payment_options'), $revisit_spco_url); |
|
358 | 358 | // link to SPCO attendee_information |
359 | 359 | $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->edit_attendee_information_url() : FALSE; |
360 | 360 | |
361 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
362 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
361 | + EE_Registry::instance()->load_helper('Template'); |
|
362 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
363 | 363 | |
364 | - do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn ); |
|
364 | + do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn); |
|
365 | 365 | // set no cache headers and constants |
366 | 366 | EE_System::do_not_cache(); |
367 | 367 | |
@@ -377,31 +377,31 @@ discard block |
||
377 | 377 | * @param array $attributes |
378 | 378 | * @return string |
379 | 379 | */ |
380 | - public function process_shortcode( $attributes = array() ) { |
|
380 | + public function process_shortcode($attributes = array()) { |
|
381 | 381 | |
382 | 382 | $this->init(); |
383 | 383 | |
384 | - if ( ! $this->_current_txn instanceof EE_Transaction ) { |
|
384 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
385 | 385 | return EE_Error::get_notices(); |
386 | 386 | } |
387 | 387 | //EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
388 | 388 | //EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 'EE_Transaction: ' . $this->_current_txn->ID() ); |
389 | 389 | // link to receipt |
390 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' ); |
|
391 | - if ( ! empty( $template_args['TXN_receipt_url'] )) { |
|
392 | - $template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso' ); |
|
390 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
391 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
392 | + $template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso'); |
|
393 | 393 | } else { |
394 | - $template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso' ); |
|
394 | + $template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso'); |
|
395 | 395 | } |
396 | 396 | $template_args['transaction'] = $this->_current_txn; |
397 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
397 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
398 | 398 | |
399 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' )); |
|
400 | - if ( $this->_is_primary && ! $this->_current_txn->is_free() ) { |
|
401 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' )); |
|
399 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
400 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
401 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
402 | 402 | } |
403 | 403 | |
404 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', $template_args, TRUE, TRUE ); |
|
404 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', $template_args, TRUE, TRUE); |
|
405 | 405 | |
406 | 406 | } |
407 | 407 | |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | * @param array $data |
419 | 419 | * @return array |
420 | 420 | */ |
421 | - public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
|
421 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) { |
|
422 | 422 | // does this heartbeat contain our data ? |
423 | - if ( ! isset( $data['espresso_thank_you_page'] )) { |
|
423 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
424 | 424 | return $response; |
425 | 425 | } |
426 | 426 | // check for reg_url_link in the incoming heartbeat data |
427 | - if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] )) { |
|
428 | - $response['espresso_thank_you_page'] = array ( |
|
429 | - 'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ) |
|
427 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
428 | + $response['espresso_thank_you_page'] = array( |
|
429 | + 'errors' => ! empty($notices['errors']) ? $notices['errors'] : __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso') |
|
430 | 430 | ); |
431 | 431 | return $response; |
432 | 432 | } |
@@ -436,24 +436,24 @@ discard block |
||
436 | 436 | EES_Espresso_Thank_You::set_definitions(); |
437 | 437 | /** @var $espresso_thank_you_page EES_Espresso_Thank_You */ |
438 | 438 | $espresso_thank_you_page = EES_Espresso_Thank_You::instance(); |
439 | - $espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] ); |
|
439 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
440 | 440 | $espresso_thank_you_page->init(); |
441 | 441 | //get TXN |
442 | 442 | $TXN = $espresso_thank_you_page->get_txn(); |
443 | 443 | // no TXN? then get out |
444 | - if ( ! $TXN instanceof EE_Transaction ) { |
|
444 | + if ( ! $TXN instanceof EE_Transaction) { |
|
445 | 445 | $notices = EE_Error::get_notices(); |
446 | - $response['espresso_thank_you_page'] = array ( |
|
447 | - 'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : sprintf( __( 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso' ), __LINE__ ) |
|
446 | + $response['espresso_thank_you_page'] = array( |
|
447 | + 'errors' => ! empty($notices['errors']) ? $notices['errors'] : sprintf(__('The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso'), __LINE__) |
|
448 | 448 | ); |
449 | 449 | return $response; |
450 | 450 | } |
451 | 451 | // grab transient of TXN's status |
452 | - $txn_status = isset( $data['espresso_thank_you_page']['txn_status'] ) ? $data['espresso_thank_you_page']['txn_status'] : NULL; |
|
452 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) ? $data['espresso_thank_you_page']['txn_status'] : NULL; |
|
453 | 453 | // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
454 | - if ( $txn_status !== $TXN->status_ID() ) { |
|
454 | + if ($txn_status !== $TXN->status_ID()) { |
|
455 | 455 | // switch between two possible basic outcomes |
456 | - switch( $TXN->status_ID()) { |
|
456 | + switch ($TXN->status_ID()) { |
|
457 | 457 | // TXN has been updated in some way |
458 | 458 | case EEM_Transaction::overpaid_status_code: |
459 | 459 | case EEM_Transaction::complete_status_code: |
@@ -468,29 +468,29 @@ discard block |
||
468 | 468 | case EEM_Transaction::failed_status_code: |
469 | 469 | default: |
470 | 470 | // keep on waiting... |
471 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
471 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | // or is the TXN still failed (never been updated) ??? |
475 | - } else if ( $TXN->failed() ) { |
|
475 | + } else if ($TXN->failed()) { |
|
476 | 476 | // keep on waiting... |
477 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
477 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
478 | 478 | } |
479 | 479 | // TXN is happening so let's get the payments now |
480 | 480 | // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
481 | - $since = isset( $data['espresso_thank_you_page']['get_payments_since'] ) ? $data['espresso_thank_you_page']['get_payments_since'] : 0; |
|
481 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) ? $data['espresso_thank_you_page']['get_payments_since'] : 0; |
|
482 | 482 | // then check for payments |
483 | - $payments = $espresso_thank_you_page->get_txn_payments( $since ); |
|
483 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
484 | 484 | // has a payment been processed ? |
485 | - if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) { |
|
486 | - if ( $since ) { |
|
485 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
486 | + if ($since) { |
|
487 | 487 | $response['espresso_thank_you_page'] = array( |
488 | - 'new_payments' => $espresso_thank_you_page->get_new_payments( $payments ), |
|
488 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
489 | 489 | 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
490 | 490 | 'txn_status' => $TXN->status_ID() |
491 | 491 | ); |
492 | 492 | } else { |
493 | - $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( $payments ); |
|
493 | + $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details($payments); |
|
494 | 494 | } |
495 | 495 | // reset time to check for payments |
496 | 496 | $response['espresso_thank_you_page']['get_payments_since'] = time(); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
511 | 511 | * @return array |
512 | 512 | */ |
513 | - private function _update_server_wait_time( $thank_you_page_data = array() ) { |
|
514 | - $response['espresso_thank_you_page'] = array ( |
|
515 | - 'still_waiting' => isset( $thank_you_page_data['initial_access'] ) ? time() - $thank_you_page_data['initial_access'] : 0, |
|
513 | + private function _update_server_wait_time($thank_you_page_data = array()) { |
|
514 | + $response['espresso_thank_you_page'] = array( |
|
515 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) ? time() - $thank_you_page_data['initial_access'] : 0, |
|
516 | 516 | 'txn_status' => $this->_current_txn->status_ID() |
517 | 517 | ); |
518 | 518 | return $response; |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
536 | 536 | |
537 | 537 | $template_args['resend_reg_confirmation_url'] = add_query_arg( |
538 | - array( 'token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true' ), |
|
538 | + array('token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
539 | 539 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
540 | 540 | ); |
541 | 541 | // verify template arguments |
542 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
543 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url'); |
|
544 | - echo EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE ); |
|
542 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
543 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url'); |
|
544 | + echo EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -550,38 +550,38 @@ discard block |
||
550 | 550 | * resend_reg_confirmation_email |
551 | 551 | */ |
552 | 552 | public static function resend_reg_confirmation_email() { |
553 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
554 | - $reg_url_link = EE_Registry::instance()->REQ->get( 'token' ); |
|
553 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
554 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
555 | 555 | |
556 | 556 | // was a REG_ID passed ? |
557 | - if ( $reg_url_link ) { |
|
558 | - $registration = EE_Registry::instance()->load_model( 'Registration' )->get_one( array( array( 'REG_url_link' => $reg_url_link ))); |
|
559 | - if ( $registration instanceof EE_Registration ) { |
|
557 | + if ($reg_url_link) { |
|
558 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one(array(array('REG_url_link' => $reg_url_link))); |
|
559 | + if ($registration instanceof EE_Registration) { |
|
560 | 560 | // resend email |
561 | - EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() )); |
|
561 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
562 | 562 | } else { |
563 | 563 | EE_Error::add_error( |
564 | - __( 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso' ), |
|
564 | + __('The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso'), |
|
565 | 565 | __FILE__, __FUNCTION__, __LINE__ |
566 | 566 | ); |
567 | 567 | } |
568 | 568 | } else { |
569 | 569 | EE_Error::add_error( |
570 | - __( 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso' ), |
|
570 | + __('The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso'), |
|
571 | 571 | __FILE__, __FUNCTION__, __LINE__ |
572 | 572 | ); |
573 | 573 | } |
574 | 574 | // request sent via AJAX ? |
575 | - if ( EE_FRONT_AJAX ) { |
|
576 | - echo json_encode( EE_Error::get_notices( FALSE )); |
|
575 | + if (EE_FRONT_AJAX) { |
|
576 | + echo json_encode(EE_Error::get_notices(FALSE)); |
|
577 | 577 | die(); |
578 | 578 | // or was JS disabled ? |
579 | 579 | } else { |
580 | 580 | // save errors so that they get picked up on the next request |
581 | - EE_Error::get_notices( TRUE, TRUE ); |
|
581 | + EE_Error::get_notices(TRUE, TRUE); |
|
582 | 582 | wp_safe_redirect( |
583 | 583 | add_query_arg( |
584 | - array( 'e_reg_url_link'=> $reg_url_link ), |
|
584 | + array('e_reg_url_link'=> $reg_url_link), |
|
585 | 585 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
586 | 586 | ) |
587 | 587 | ); |
@@ -597,26 +597,26 @@ discard block |
||
597 | 597 | * @return void |
598 | 598 | */ |
599 | 599 | public function get_ajax_content() { |
600 | - if ( ! $this->get_txn() ) { |
|
600 | + if ( ! $this->get_txn()) { |
|
601 | 601 | return; |
602 | 602 | } |
603 | 603 | // first determine which event(s) require pre-approval or not |
604 | 604 | $events = array(); |
605 | 605 | $events_requiring_pre_approval = array(); |
606 | - foreach ( $this->_current_txn->registrations() as $registration ) { |
|
607 | - if ( $registration instanceof EE_Registration ) { |
|
606 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
607 | + if ($registration instanceof EE_Registration) { |
|
608 | 608 | $event = $registration->event(); |
609 | - if ( $event instanceof EE_Event ) { |
|
610 | - if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) { |
|
611 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
609 | + if ($event instanceof EE_Event) { |
|
610 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
611 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
612 | 612 | } else { |
613 | - $events[ $event->ID() ] = $event; |
|
613 | + $events[$event->ID()] = $event; |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
617 | 617 | } |
618 | - $this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval ); |
|
619 | - $this->display_details_for_events( $events ); |
|
618 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
619 | + $this->display_details_for_events($events); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | * @param EE_Event[] $events |
629 | 629 | * @return string |
630 | 630 | */ |
631 | - public function display_details_for_events( $events = array() ) { |
|
632 | - if ( ! empty( $events ) ) { |
|
631 | + public function display_details_for_events($events = array()) { |
|
632 | + if ( ! empty($events)) { |
|
633 | 633 | ?> |
634 | 634 | <div id="espresso-thank-you-page-ajax-content-dv"> |
635 | 635 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
636 | 636 | <div id="espresso-thank-you-page-ajax-payment-dv"></div> |
637 | 637 | <div id="espresso-thank-you-page-ajax-loading-dv"> |
638 | 638 | <div id="ee-ajax-loading-dv" class="left lt-blue-text"> |
639 | - <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e( 'loading transaction and payment information...', 'event_espresso' ); ?></span> |
|
639 | + <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e('loading transaction and payment information...', 'event_espresso'); ?></span> |
|
640 | 640 | </div> |
641 | - <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?> |
|
641 | + <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
642 | 642 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
643 | - <?php echo apply_filters( 'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __( 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso' ) ); ?> |
|
643 | + <?php echo apply_filters('EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __('Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso')); ?> |
|
644 | 644 | <br/> |
645 | - <span class="jst-rght ee-block small-text lt-grey-text"><?php _e( 'current wait time ', 'event_espresso' ); ?> |
|
645 | + <span class="jst-rght ee-block small-text lt-grey-text"><?php _e('current wait time ', 'event_espresso'); ?> |
|
646 | 646 | <span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span> |
647 | 647 | </p> |
648 | 648 | <?php endif; ?> |
@@ -662,20 +662,20 @@ discard block |
||
662 | 662 | * @param EE_Event[] $events |
663 | 663 | * @return string |
664 | 664 | */ |
665 | - public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
|
666 | - if ( ! empty( $events ) ) { |
|
665 | + public function display_details_for_events_requiring_pre_approval($events = array()) { |
|
666 | + if ( ! empty($events)) { |
|
667 | 667 | ?> |
668 | 668 | <div id = "espresso-thank-you-page-not-approved-message-dv" > |
669 | - <h4 class="orange-text" ><?php _e( 'Important Notice:', 'event_espresso' );?></h4> |
|
669 | + <h4 class="orange-text" ><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
|
670 | 670 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
671 | 671 | <?php echo apply_filters( |
672 | 672 | 'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message', |
673 | - __( 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
673 | + __('The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
674 | 674 | ); ?> |
675 | 675 | </p> |
676 | 676 | <ul class="events-requiring-pre-approval-ul"> |
677 | - <?php foreach ( $events as $event ) { |
|
678 | - if ( $event instanceof EE_Event ) { |
|
677 | + <?php foreach ($events as $event) { |
|
678 | + if ($event instanceof EE_Event) { |
|
679 | 679 | echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', $event->name(), '</li>'; |
680 | 680 | } |
681 | 681 | } ?> |
@@ -699,15 +699,15 @@ discard block |
||
699 | 699 | $template_args = array(); |
700 | 700 | $template_args['transaction'] = $this->_current_txn; |
701 | 701 | $template_args['reg_url_link'] = $this->_reg_url_link; |
702 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( TRUE ); |
|
702 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(TRUE); |
|
703 | 703 | // link to SPCO payment_options |
704 | 704 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
705 | 705 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
706 | 706 | // verify template arguments |
707 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
708 | - EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' ); |
|
709 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url' ); |
|
710 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE ); |
|
707 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
708 | + EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); |
|
709 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
710 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -719,9 +719,9 @@ discard block |
||
719 | 719 | * @param EE_Payment $payment |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function get_payment_row_html( $payment = NULL ) { |
|
722 | + public function get_payment_row_html($payment = NULL) { |
|
723 | 723 | $html = ''; |
724 | - if ( $payment instanceof EE_Payment ) { |
|
724 | + if ($payment instanceof EE_Payment) { |
|
725 | 725 | if ( |
726 | 726 | $payment->payment_method() instanceof EE_Payment_Method |
727 | 727 | && $payment->payment_method()->is_off_site() |
@@ -730,25 +730,25 @@ discard block |
||
730 | 730 | // considering the registrant has made it to the Thank You page, |
731 | 731 | // any failed payments may actually be pending and the IPN is just slow |
732 | 732 | // so let's |
733 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
733 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
734 | 734 | } |
735 | - $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' : ''; |
|
735 | + $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' : ''; |
|
736 | 736 | $html .= ' |
737 | 737 | <tr> |
738 | 738 | <td> |
739 | - ' . $payment->timestamp() . ' |
|
739 | + ' . $payment->timestamp().' |
|
740 | 740 | </td> |
741 | 741 | <td> |
742 | - ' . ( $payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __( 'Unknown', 'event_espresso' ) ) . ' |
|
742 | + ' . ($payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __('Unknown', 'event_espresso')).' |
|
743 | 743 | </td> |
744 | 744 | <td class="jst-rght"> |
745 | - ' . EEH_Template::format_currency( $payment->amount() ) . ' |
|
745 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
746 | 746 | </td> |
747 | 747 | <td class="jst-rght" style="line-height:1;"> |
748 | - ' . $payment->pretty_status( TRUE ) . $payment_declined_msg . ' |
|
748 | + ' . $payment->pretty_status(TRUE).$payment_declined_msg.' |
|
749 | 749 | </td> |
750 | 750 | </tr>'; |
751 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment ); |
|
751 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
752 | 752 | } |
753 | 753 | return $html; |
754 | 754 | } |
@@ -762,17 +762,17 @@ discard block |
||
762 | 762 | * @param array $payments |
763 | 763 | * @return string |
764 | 764 | */ |
765 | - public function get_payment_details( $payments = array() ) { |
|
765 | + public function get_payment_details($payments = array()) { |
|
766 | 766 | //prepare variables for displaying |
767 | 767 | $template_args = array(); |
768 | 768 | $template_args['transaction'] = $this->_current_txn; |
769 | 769 | $template_args['reg_url_link'] = $this->_reg_url_link; |
770 | 770 | $template_args['payments'] = array(); |
771 | - foreach ( $payments as $payment ) { |
|
772 | - $template_args['payments'][] = $this->get_payment_row_html( $payment ); |
|
771 | + foreach ($payments as $payment) { |
|
772 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
773 | 773 | } |
774 | 774 | //create a hacky payment object, but dont save it |
775 | - $payment = EE_Payment::new_instance( array( |
|
775 | + $payment = EE_Payment::new_instance(array( |
|
776 | 776 | 'TXN_ID'=>$this->_current_txn->ID(), |
777 | 777 | 'STS_ID'=>EEM_Payment::status_id_pending, |
778 | 778 | 'PAY_timestamp'=>time(), |
@@ -780,21 +780,21 @@ discard block |
||
780 | 780 | 'PMD_ID'=>$this->_current_txn->payment_method_ID() |
781 | 781 | )); |
782 | 782 | $payment_method = $this->_current_txn->payment_method(); |
783 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
784 | - $template_args[ 'gateway_content' ] = $payment_method->type_obj()->payment_overview_content( $payment ); |
|
783 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
784 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
785 | 785 | } else { |
786 | - $template_args[ 'gateway_content' ] = ''; |
|
786 | + $template_args['gateway_content'] = ''; |
|
787 | 787 | } |
788 | 788 | // link to SPCO payment_options |
789 | 789 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
790 | 790 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
791 | 791 | // verify template arguments |
792 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
793 | - EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' ); |
|
794 | - EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' ); |
|
795 | - EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content'); |
|
796 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
797 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE ); |
|
792 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
793 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
794 | + EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); |
|
795 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
796 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
797 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | |
@@ -806,11 +806,11 @@ discard block |
||
806 | 806 | * @param array $payments |
807 | 807 | * @return string |
808 | 808 | */ |
809 | - public function get_new_payments( $payments = array() ) { |
|
809 | + public function get_new_payments($payments = array()) { |
|
810 | 810 | $payments_html = ''; |
811 | 811 | //prepare variables for displaying |
812 | - foreach ( $payments as $payment ) { |
|
813 | - $payments_html .= $this->get_payment_row_html( $payment ); |
|
812 | + foreach ($payments as $payment) { |
|
813 | + $payments_html .= $this->get_payment_row_html($payment); |
|
814 | 814 | } |
815 | 815 | return $payments_html; |
816 | 816 | } |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Event Espresso |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * EES_Espresso_Thank_You |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage /shortcodes/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Event Espresso |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * EES_Espresso_Thank_You |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage /shortcodes/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | class EES_Espresso_Thank_You extends EES_Shortcode { |
25 | 25 | |
26 | 26 | /** |
@@ -5,75 +5,75 @@ discard block |
||
5 | 5 | /** @type string $SPCO_attendee_information_url */ |
6 | 6 | ?> |
7 | 7 | <h3 class="ee-registration-details-h3"><?php _e('Registration Details', 'event_espresso'); ?></h3> |
8 | -<?php do_action( 'AHEE__thank_you_page_registration_details_template__after_heading' ); ?> |
|
8 | +<?php do_action('AHEE__thank_you_page_registration_details_template__after_heading'); ?> |
|
9 | 9 | |
10 | 10 | <div class="ee-registration-details-dv"> |
11 | 11 | <?php |
12 | 12 | $registrations = $transaction->registrations(); |
13 | -$registrations = is_array( $registrations ) ? $registrations : array(); |
|
14 | -$reg_count = count( $registrations ); |
|
13 | +$registrations = is_array($registrations) ? $registrations : array(); |
|
14 | +$reg_count = count($registrations); |
|
15 | 15 | $reg_cntr = 0; |
16 | 16 | $event_name = ''; |
17 | -foreach ( $registrations as $registration ) { |
|
18 | - if ( $registration instanceof EE_Registration ) { |
|
19 | - if ( $event_name != $registration->event_name() && ! empty( $event_name )) { ?> |
|
17 | +foreach ($registrations as $registration) { |
|
18 | + if ($registration instanceof EE_Registration) { |
|
19 | + if ($event_name != $registration->event_name() && ! empty($event_name)) { ?> |
|
20 | 20 | </tbody> |
21 | 21 | </table> |
22 | 22 | <?php |
23 | 23 | } |
24 | 24 | $reg_cntr++; |
25 | - if ( $event_name != $registration->event_name() ) { |
|
25 | + if ($event_name != $registration->event_name()) { |
|
26 | 26 | ?> |
27 | 27 | <h5> |
28 | - <span class="smaller-text grey-text"><?php _e('for','event_espresso');?>: </span> <?php echo htmlentities( $registration->event_name(), ENT_QUOTES, 'UTF-8' );?> |
|
28 | + <span class="smaller-text grey-text"><?php _e('for', 'event_espresso'); ?>: </span> <?php echo htmlentities($registration->event_name(), ENT_QUOTES, 'UTF-8'); ?> |
|
29 | 29 | </h5> |
30 | 30 | <table class='ee-table ee-registrations-list'> |
31 | 31 | <thead> |
32 | 32 | <tr> |
33 | 33 | <th width="40%"> |
34 | - <?php _e("Registrant Name",'event_espresso')?> |
|
34 | + <?php _e("Registrant Name", 'event_espresso')?> |
|
35 | 35 | </th> |
36 | 36 | <th width="25%" class="jst-left"> |
37 | - <?php _e("REG Code",'event_espresso');?> |
|
37 | + <?php _e("REG Code", 'event_espresso'); ?> |
|
38 | 38 | </th> |
39 | 39 | <th width="35%" class="jst-left"> |
40 | - <?php _e("REG Status",'event_espresso');?> |
|
40 | + <?php _e("REG Status", 'event_espresso'); ?> |
|
41 | 41 | </th> |
42 | 42 | </tr> |
43 | 43 | </thead> |
44 | 44 | <tbody> |
45 | 45 | <?php |
46 | 46 | } |
47 | - if ( $is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link() )) { ?> |
|
47 | + if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?> |
|
48 | 48 | <tr> |
49 | 49 | <td width="40%"> |
50 | 50 | <?php |
51 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
52 | - echo $registration->attendee()->full_name( TRUE ); |
|
51 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
52 | + echo $registration->attendee()->full_name(TRUE); |
|
53 | 53 | } |
54 | 54 | ?> |
55 | 55 | <p class="tiny-text" style="margin: .75em 0 0;"> |
56 | 56 | <?php |
57 | - if ( $registration->count_question_groups() ) { |
|
57 | + if ($registration->count_question_groups()) { |
|
58 | 58 | ?> |
59 | - <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url();?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso');?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso');?></a> |
|
59 | + <a class="ee-icon-only-lnk" href="<?php echo $registration->edit_attendee_information_url(); ?>" title="<?php esc_attr_e('Click here to edit Attendee Information', 'event_espresso'); ?>"><span class="ee-icon ee-icon-user-edit"></span><?php _e('edit info', 'event_espresso'); ?></a> |
|
60 | 60 | <?php } ?> |
61 | - <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg( array( 'token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true' ), EE_Registry::instance()->CFG->core->thank_you_page_url() );?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso');?>" rel="<?php echo $registration->reg_url_link();?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso');?></a> |
|
61 | + <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk" href="<?php echo add_query_arg(array('token'=>$registration->reg_url_link(), 'resend_reg_confirmation' => 'true'), EE_Registry::instance()->CFG->core->thank_you_page_url()); ?>" title="<?php esc_attr_e('Click here to resend the Registration Confirmation email', 'event_espresso'); ?>" rel="<?php echo $registration->reg_url_link(); ?>"><span class="dashicons dashicons-email-alt"></span><?php _e('resend email', 'event_espresso'); ?></a> |
|
62 | 62 | </p> |
63 | 63 | </td> |
64 | 64 | <td width="25%" class="jst-left"> |
65 | 65 | <?php $registration->e('REG_code') ?> |
66 | 66 | </td> |
67 | 67 | <td width="35%" class="jst-left"> |
68 | - <?php $registration->e_pretty_status( TRUE )?> |
|
68 | + <?php $registration->e_pretty_status(TRUE)?> |
|
69 | 69 | </td> |
70 | 70 | </tr> |
71 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration ); ?> |
|
71 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_table_row', $registration); ?> |
|
72 | 72 | <?php |
73 | 73 | $event_name = $registration->event_name(); |
74 | 74 | |
75 | 75 | } |
76 | - if ( $reg_cntr >= $reg_count ) { |
|
76 | + if ($reg_cntr >= $reg_count) { |
|
77 | 77 | ?> |
78 | 78 | </tbody> |
79 | 79 | </table> |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | } |
83 | 83 | } |
84 | 84 | ?> |
85 | -<?php if ( $is_primary && $SPCO_attendee_information_url ) { ?> |
|
85 | +<?php if ($is_primary && $SPCO_attendee_information_url) { ?> |
|
86 | 86 | <p class="small-text jst-rght"> |
87 | 87 | <a href='<?php echo $SPCO_attendee_information_url?>'><?php _e("Click here to edit All Attendee Information", 'event_espresso'); ?></a> |
88 | 88 | </p> |
89 | 89 | <?php } ?> |
90 | 90 | |
91 | - <?php do_action( 'AHEE__thank_you_page_registration_details_template__after_registration_details' ); ?> |
|
91 | + <?php do_action('AHEE__thank_you_page_registration_details_template__after_registration_details'); ?> |
|
92 | 92 | |
93 | 93 | </div> |
94 | 94 | <!-- end of .registration-details --> |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 | 28 | */ |
29 | 29 | /** |
30 | - * Event Espresso |
|
31 | - * |
|
32 | - * Event Registration and Management Plugin for WordPress |
|
33 | - * |
|
34 | - * @package Event Espresso |
|
35 | - * @author Seth Shoultes |
|
36 | - * @copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
37 | - * @license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
38 | - * @link {@link http://www.eventespresso.com} |
|
39 | - * @since 4.0 |
|
40 | - * |
|
41 | - */ |
|
30 | + * Event Espresso |
|
31 | + * |
|
32 | + * Event Registration and Management Plugin for WordPress |
|
33 | + * |
|
34 | + * @package Event Espresso |
|
35 | + * @author Seth Shoultes |
|
36 | + * @copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
37 | + * @license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
38 | + * @link {@link http://www.eventespresso.com} |
|
39 | + * @since 4.0 |
|
40 | + * |
|
41 | + */ |
|
42 | 42 | |
43 | 43 | if ( function_exists( 'espresso_version' ) ) { |
44 | 44 | |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | |
236 | 236 | if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
237 | 237 | /** |
238 | - * deactivate_plugin |
|
239 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | - * |
|
241 | - * @access public |
|
242 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | - * @return void |
|
244 | - */ |
|
238 | + * deactivate_plugin |
|
239 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | + * |
|
241 | + * @access public |
|
242 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | + * @return void |
|
244 | + */ |
|
245 | 245 | function espresso_deactivate_plugin( $plugin_basename = '' ) { |
246 | 246 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
247 | 247 | require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | */ |
42 | 42 | |
43 | -if ( function_exists( 'espresso_version' ) ) { |
|
43 | +if (function_exists('espresso_version')) { |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * espresso_duplicate_plugin_error |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | function espresso_duplicate_plugin_error() { |
50 | 50 | ?> |
51 | 51 | <div class="error"> |
52 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
52 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
53 | 53 | </div> |
54 | 54 | <?php |
55 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
55 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
56 | 56 | } |
57 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
57 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
58 | 58 | |
59 | 59 | } else { |
60 | 60 | |
@@ -69,98 +69,98 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // define versions |
72 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
73 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.0' ); |
|
74 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.1' ); |
|
75 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
76 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
77 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
78 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
72 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
73 | + define('EE_MIN_WP_VER_REQUIRED', '4.0'); |
|
74 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.1'); |
|
75 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
76 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
77 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
78 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
79 | 79 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
80 | - if ( ! defined( 'DS' ) ) { |
|
81 | - define( 'DS', '/' ); |
|
80 | + if ( ! defined('DS')) { |
|
81 | + define('DS', '/'); |
|
82 | 82 | } |
83 | - if ( ! defined( 'PS' ) ) { |
|
84 | - define( 'PS', PATH_SEPARATOR ); |
|
83 | + if ( ! defined('PS')) { |
|
84 | + define('PS', PATH_SEPARATOR); |
|
85 | 85 | } |
86 | - if ( ! defined( 'SP' ) ) { |
|
87 | - define( 'SP', ' ' ); |
|
86 | + if ( ! defined('SP')) { |
|
87 | + define('SP', ' '); |
|
88 | 88 | } |
89 | - if ( ! defined( 'EENL' ) ) { |
|
90 | - define( 'EENL', "\n" ); |
|
89 | + if ( ! defined('EENL')) { |
|
90 | + define('EENL', "\n"); |
|
91 | 91 | } |
92 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
92 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
93 | 93 | // define the plugin directory and URL |
94 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
94 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
95 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | 97 | // main root folder paths |
98 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
99 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
100 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
101 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
102 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
103 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
104 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
105 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
98 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
99 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
100 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
101 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
102 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
103 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
104 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
105 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
106 | 106 | // core system paths |
107 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
108 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
109 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
110 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
111 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
112 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
113 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
114 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
115 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
116 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
117 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
118 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
107 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
108 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
109 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
110 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
111 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
112 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
113 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
114 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
115 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
116 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
117 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
118 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
119 | 119 | // gateways |
120 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
121 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
120 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
121 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
122 | 122 | // asset URL paths |
123 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
124 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
125 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
126 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
127 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
128 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
123 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
124 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
125 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
126 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
127 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
128 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
129 | 129 | // define upload paths |
130 | 130 | $uploads = wp_upload_dir(); |
131 | 131 | // define the uploads directory and URL |
132 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
133 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
132 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
134 | 134 | // define the templates directory and URL |
135 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
135 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
137 | 137 | // define the gateway directory and URL |
138 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
138 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | 140 | // languages folder/path |
141 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
142 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
141 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
142 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
143 | 143 | //check for dompdf fonts in uploads |
144 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
145 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
144 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
145 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
146 | 146 | } |
147 | 147 | //ajax constants |
148 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
149 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
148 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
149 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
150 | 150 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
151 | 151 | //you're better to use this than its straight value (currently -1) in case you ever |
152 | 152 | //want to change its default value! or find when -1 means infinity |
153 | - define( 'EE_INF_IN_DB', -1 ); |
|
154 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
153 | + define('EE_INF_IN_DB', -1); |
|
154 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * espresso_plugin_activation |
158 | 158 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
159 | 159 | */ |
160 | 160 | function espresso_plugin_activation() { |
161 | - update_option( 'ee_espresso_activation', true ); |
|
161 | + update_option('ee_espresso_activation', true); |
|
162 | 162 | } |
163 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
163 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // } |
175 | 175 | // |
176 | 176 | } |
177 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
177 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
178 | 178 | |
179 | 179 | |
180 | 180 | |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | */ |
185 | 185 | function espresso_load_error_handling() { |
186 | 186 | // load debugging tools |
187 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
188 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
187 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
188 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
189 | 189 | EEH_Debug_Tools::instance(); |
190 | 190 | } |
191 | 191 | // load error handling |
192 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
193 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
192 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
193 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
194 | 194 | } else { |
195 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
195 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -206,25 +206,25 @@ discard block |
||
206 | 206 | * @param string $full_path_to_file |
207 | 207 | * @throws EE_Error |
208 | 208 | */ |
209 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
209 | + function espresso_load_required($classname, $full_path_to_file) { |
|
210 | 210 | static $error_handling_loaded = false; |
211 | - if ( ! $error_handling_loaded ) { |
|
211 | + if ( ! $error_handling_loaded) { |
|
212 | 212 | espresso_load_error_handling(); |
213 | 213 | $error_handling_loaded = true; |
214 | 214 | } |
215 | - if ( is_readable( $full_path_to_file ) ) { |
|
216 | - require_once( $full_path_to_file ); |
|
215 | + if (is_readable($full_path_to_file)) { |
|
216 | + require_once($full_path_to_file); |
|
217 | 217 | } else { |
218 | - throw new EE_Error ( sprintf( |
|
219 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
218 | + throw new EE_Error(sprintf( |
|
219 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
220 | 220 | $classname |
221 | - ) ); |
|
221 | + )); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
226 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
227 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
225 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
226 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
227 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
228 | 228 | new EE_Bootstrap(); |
229 | 229 | |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | |
235 | 235 | |
236 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
236 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
237 | 237 | /** |
238 | 238 | * deactivate_plugin |
239 | 239 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
243 | 243 | * @return void |
244 | 244 | */ |
245 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
246 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
247 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
245 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
246 | + if ( ! function_exists('deactivate_plugins')) { |
|
247 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
248 | 248 | } |
249 | - unset( $_GET[ 'activate' ] ); |
|
250 | - unset( $_REQUEST[ 'activate' ] ); |
|
251 | - deactivate_plugins( $plugin_basename ); |
|
249 | + unset($_GET['activate']); |
|
250 | + unset($_REQUEST['activate']); |
|
251 | + deactivate_plugins($plugin_basename); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 |
@@ -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 | * |
4 | 4 | * Event Espresso |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * array for defining default session vars |
105 | 105 | * @var array |
106 | 106 | */ |
107 | - private $_default_session_vars = array ( |
|
107 | + private $_default_session_vars = array( |
|
108 | 108 | 'id' => NULL, |
109 | 109 | 'user_id' => NULL, |
110 | 110 | 'ip_address' => NULL, |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @return EE_Session |
128 | 128 | */ |
129 | - public static function instance ( ) { |
|
129 | + public static function instance( ) { |
|
130 | 130 | // check if class object is instantiated |
131 | - if ( ! self::$_instance instanceof EE_Session ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Session) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | private function __construct() { |
146 | 146 | |
147 | 147 | // session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' ); |
148 | - if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) { |
|
148 | + if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) { |
|
149 | 149 | return NULL; |
150 | 150 | } |
151 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' ); |
|
152 | - define( 'ESPRESSO_SESSION', TRUE ); |
|
151 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, ''); |
|
152 | + define('ESPRESSO_SESSION', TRUE); |
|
153 | 153 | // default session lifespan in seconds |
154 | 154 | $this->_lifespan = apply_filters( |
155 | 155 | 'FHEE__EE_Session__construct___lifespan', |
@@ -162,35 +162,35 @@ discard block |
||
162 | 162 | * } |
163 | 163 | */ |
164 | 164 | // retrieve session options from db |
165 | - $session_settings = get_option( 'ee_session_settings' ); |
|
166 | - if ( $session_settings !== FALSE ) { |
|
165 | + $session_settings = get_option('ee_session_settings'); |
|
166 | + if ($session_settings !== FALSE) { |
|
167 | 167 | // cycle though existing session options |
168 | - foreach ( $session_settings as $var_name => $session_setting ) { |
|
168 | + foreach ($session_settings as $var_name => $session_setting) { |
|
169 | 169 | // set values for class properties |
170 | - $var_name = '_' . $var_name; |
|
170 | + $var_name = '_'.$var_name; |
|
171 | 171 | $this->{$var_name} = $session_setting; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | // are we using encryption? |
175 | - if ( $this->_use_encryption ) { |
|
175 | + if ($this->_use_encryption) { |
|
176 | 176 | // instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt(); |
177 | - $this->encryption = EE_Registry::instance()->load_core( 'Encryption' ); |
|
177 | + $this->encryption = EE_Registry::instance()->load_core('Encryption'); |
|
178 | 178 | } |
179 | 179 | // filter hook allows outside functions/classes/plugins to change default empty cart |
180 | - $extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() ); |
|
181 | - array_merge( $this->_default_session_vars, $extra_default_session_vars ); |
|
180 | + $extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array()); |
|
181 | + array_merge($this->_default_session_vars, $extra_default_session_vars); |
|
182 | 182 | // apply default session vars |
183 | 183 | $this->_set_defaults(); |
184 | 184 | // check for existing session and retrieve it from db |
185 | - if ( ! $this->_espresso_session() ) { |
|
185 | + if ( ! $this->_espresso_session()) { |
|
186 | 186 | // or just start a new one |
187 | 187 | $this->_create_espresso_session(); |
188 | 188 | } |
189 | 189 | // check request for 'clear_session' param |
190 | - add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' )); |
|
190 | + add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded')); |
|
191 | 191 | // once everything is all said and done, |
192 | - add_action( 'shutdown', array( $this, 'update' ), 100 ); |
|
193 | - add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 ); |
|
192 | + add_action('shutdown', array($this, 'update'), 100); |
|
193 | + add_action('shutdown', array($this, 'garbage_collection'), 999); |
|
194 | 194 | |
195 | 195 | } |
196 | 196 | |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | */ |
223 | 223 | private function _set_defaults() { |
224 | 224 | // set some defaults |
225 | - foreach ( $this->_default_session_vars as $key => $default_var ) { |
|
226 | - if ( is_array( $default_var )) { |
|
227 | - $this->_session_data[ $key ] = array(); |
|
225 | + foreach ($this->_default_session_vars as $key => $default_var) { |
|
226 | + if (is_array($default_var)) { |
|
227 | + $this->_session_data[$key] = array(); |
|
228 | 228 | } else { |
229 | - $this->_session_data[ $key ] = ''; |
|
229 | + $this->_session_data[$key] = ''; |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param \EE_Cart $cart |
249 | 249 | * @return bool |
250 | 250 | */ |
251 | - public function set_cart( EE_Cart $cart ) { |
|
251 | + public function set_cart(EE_Cart $cart) { |
|
252 | 252 | $this->_session_data['cart'] = $cart; |
253 | 253 | return TRUE; |
254 | 254 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return \EE_Cart |
269 | 269 | */ |
270 | 270 | public function cart() { |
271 | - return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL; |
|
271 | + return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param \EE_Checkout $checkout |
278 | 278 | * @return bool |
279 | 279 | */ |
280 | - public function set_checkout( EE_Checkout $checkout ) { |
|
280 | + public function set_checkout(EE_Checkout $checkout) { |
|
281 | 281 | $this->_session_data['checkout'] = $checkout; |
282 | 282 | return TRUE; |
283 | 283 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return \EE_Checkout |
298 | 298 | */ |
299 | 299 | public function checkout() { |
300 | - return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL; |
|
300 | + return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @param \EE_Transaction $transaction |
307 | 307 | * @return bool |
308 | 308 | */ |
309 | - public function set_transaction( EE_Transaction $transaction ) { |
|
309 | + public function set_transaction(EE_Transaction $transaction) { |
|
310 | 310 | // first remove the session from the transaction before we save the transaction in the session |
311 | - $transaction->set_txn_session_data( NULL ); |
|
311 | + $transaction->set_txn_session_data(NULL); |
|
312 | 312 | $this->_session_data['transaction'] = $transaction; |
313 | 313 | return TRUE; |
314 | 314 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return \EE_Transaction |
329 | 329 | */ |
330 | 330 | public function transaction() { |
331 | - return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL; |
|
331 | + return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | * @param bool $reset_cache |
341 | 341 | * @return array |
342 | 342 | */ |
343 | - public function get_session_data( $key = NULL, $reset_cache = FALSE ) { |
|
344 | - if ( $reset_cache ) { |
|
343 | + public function get_session_data($key = NULL, $reset_cache = FALSE) { |
|
344 | + if ($reset_cache) { |
|
345 | 345 | $this->reset_cart(); |
346 | 346 | $this->reset_checkout(); |
347 | 347 | $this->reset_transaction(); |
348 | 348 | } |
349 | - if ( ! empty( $key )) { |
|
350 | - return isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL; |
|
351 | - } else { |
|
349 | + if ( ! empty($key)) { |
|
350 | + return isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL; |
|
351 | + } else { |
|
352 | 352 | return $this->_session_data; |
353 | 353 | } |
354 | 354 | } |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | * @param array $data |
362 | 362 | * @return TRUE on success, FALSE on fail |
363 | 363 | */ |
364 | - public function set_session_data( $data ) { |
|
364 | + public function set_session_data($data) { |
|
365 | 365 | |
366 | 366 | // nothing ??? bad data ??? go home! |
367 | - if ( empty( $data ) || ! is_array( $data )) { |
|
368 | - EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
367 | + if (empty($data) || ! is_array($data)) { |
|
368 | + EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
369 | 369 | return FALSE; |
370 | 370 | } |
371 | 371 | |
372 | - foreach ( $data as $key =>$value ) { |
|
373 | - if ( isset( $this->_default_session_vars[ $key ] )) { |
|
374 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ ); |
|
372 | + foreach ($data as $key =>$value) { |
|
373 | + if (isset($this->_default_session_vars[$key])) { |
|
374 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__); |
|
375 | 375 | return FALSE; |
376 | 376 | } else { |
377 | - $this->_session_data[ $key ] = $value; |
|
377 | + $this->_session_data[$key] = $value; |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | * @throws \EE_Error |
392 | 392 | */ |
393 | 393 | private function _espresso_session() { |
394 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
394 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
395 | 395 | // check that session has started |
396 | - if ( session_id() === '' ) { |
|
396 | + if (session_id() === '') { |
|
397 | 397 | //starts a new session if one doesn't already exist, or re-initiates an existing one |
398 | 398 | session_start(); |
399 | 399 | } |
@@ -402,57 +402,57 @@ discard block |
||
402 | 402 | // and the visitors IP |
403 | 403 | $this->_ip_address = $this->_visitor_ip(); |
404 | 404 | // set the "user agent" |
405 | - $this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE; |
|
405 | + $this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE; |
|
406 | 406 | // now let's retrieve what's in the db |
407 | 407 | // we're using WP's Transient API to store session data using the PHP session ID as the option name |
408 | - $session_data = get_transient( EE_Session::session_id_prefix . $this->_sid ); |
|
409 | - if ( $session_data ) { |
|
410 | - if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) { |
|
411 | - $hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid ); |
|
412 | - if ( $hash_check && $hash_check !== md5( $session_data ) ) { |
|
408 | + $session_data = get_transient(EE_Session::session_id_prefix.$this->_sid); |
|
409 | + if ($session_data) { |
|
410 | + if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) { |
|
411 | + $hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid); |
|
412 | + if ($hash_check && $hash_check !== md5($session_data)) { |
|
413 | 413 | EE_Error::add_error( |
414 | 414 | sprintf( |
415 | - __( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ), |
|
416 | - EE_Session::session_id_prefix . $this->_sid |
|
415 | + __('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'), |
|
416 | + EE_Session::session_id_prefix.$this->_sid |
|
417 | 417 | ), |
418 | 418 | __FILE__, __FUNCTION__, __LINE__ |
419 | 419 | ); |
420 | 420 | } |
421 | 421 | } |
422 | 422 | // un-encrypt the data |
423 | - $session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data; |
|
423 | + $session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data; |
|
424 | 424 | // unserialize |
425 | - $session_data = maybe_unserialize( $session_data ); |
|
425 | + $session_data = maybe_unserialize($session_data); |
|
426 | 426 | // just a check to make sure the session array is indeed an array |
427 | - if ( ! is_array( $session_data ) ) { |
|
427 | + if ( ! is_array($session_data)) { |
|
428 | 428 | // no?!?! then something is wrong |
429 | 429 | return FALSE; |
430 | 430 | } |
431 | 431 | // get the current time in UTC |
432 | - $this->_time = isset( $this->_time ) ? $this->_time : time(); |
|
432 | + $this->_time = isset($this->_time) ? $this->_time : time(); |
|
433 | 433 | // and reset the session expiration |
434 | - $this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan; |
|
434 | + $this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan; |
|
435 | 435 | |
436 | 436 | } else { |
437 | 437 | // set initial site access time and the session expiration |
438 | 438 | $this->_set_init_access_and_expiration(); |
439 | 439 | // set referer |
440 | - $this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : ''; |
|
440 | + $this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : ''; |
|
441 | 441 | // no previous session = go back and create one (on top of the data above) |
442 | 442 | return FALSE; |
443 | 443 | } |
444 | 444 | // now the user agent |
445 | - if ( $session_data['user_agent'] != $this->_user_agent ) { |
|
445 | + if ($session_data['user_agent'] != $this->_user_agent) { |
|
446 | 446 | return FALSE; |
447 | 447 | } |
448 | 448 | // wait a minute... how old are you? |
449 | - if ( $this->_time > $this->_expiration ) { |
|
449 | + if ($this->_time > $this->_expiration) { |
|
450 | 450 | // yer too old fer me! |
451 | 451 | // wipe out everything that isn't a default session datum |
452 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
452 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
453 | 453 | } |
454 | 454 | // make event espresso session data available to plugin |
455 | - $this->_session_data = array_merge( $this->_session_data, $session_data ); |
|
455 | + $this->_session_data = array_merge($this->_session_data, $session_data); |
|
456 | 456 | return TRUE; |
457 | 457 | |
458 | 458 | } |
@@ -470,12 +470,12 @@ discard block |
||
470 | 470 | */ |
471 | 471 | protected function _generate_session_id() { |
472 | 472 | // check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length |
473 | - if ( isset( $_REQUEST[ 'EESID' ] ) ) { |
|
474 | - $session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] ); |
|
473 | + if (isset($_REQUEST['EESID'])) { |
|
474 | + $session_id = sanitize_text_field($_REQUEST['EESID']); |
|
475 | 475 | } else { |
476 | - $session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() ); |
|
476 | + $session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt()); |
|
477 | 477 | } |
478 | - return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id ); |
|
478 | + return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
@@ -487,20 +487,20 @@ discard block |
||
487 | 487 | */ |
488 | 488 | protected function _get_sid_salt() { |
489 | 489 | // was session id salt already saved to db ? |
490 | - if ( empty( $this->_sid_salt ) ) { |
|
490 | + if (empty($this->_sid_salt)) { |
|
491 | 491 | // no? then maybe use WP defined constant |
492 | - if ( defined( 'AUTH_SALT' ) ) { |
|
492 | + if (defined('AUTH_SALT')) { |
|
493 | 493 | $this->_sid_salt = AUTH_SALT; |
494 | 494 | } |
495 | 495 | // if salt doesn't exist or is too short |
496 | - if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) { |
|
496 | + if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) { |
|
497 | 497 | // create a new one |
498 | - $this->_sid_salt = wp_generate_password( 64 ); |
|
498 | + $this->_sid_salt = wp_generate_password(64); |
|
499 | 499 | } |
500 | 500 | // and save it as a permanent session setting |
501 | - $session_settings = get_option( 'ee_session_settings' ); |
|
502 | - $session_settings[ 'sid_salt' ] = $this->_sid_salt; |
|
503 | - update_option( 'ee_session_settings', $session_settings ); |
|
501 | + $session_settings = get_option('ee_session_settings'); |
|
502 | + $session_settings['sid_salt'] = $this->_sid_salt; |
|
503 | + update_option('ee_session_settings', $session_settings); |
|
504 | 504 | } |
505 | 505 | return $this->_sid_salt; |
506 | 506 | } |
@@ -528,19 +528,19 @@ discard block |
||
528 | 528 | * @param bool $new_session |
529 | 529 | * @return TRUE on success, FALSE on fail |
530 | 530 | */ |
531 | - public function update( $new_session = FALSE ) { |
|
532 | - $this->_session_data = isset( $this->_session_data ) |
|
533 | - && is_array( $this->_session_data ) |
|
534 | - && isset( $this->_session_data['id']) |
|
531 | + public function update($new_session = FALSE) { |
|
532 | + $this->_session_data = isset($this->_session_data) |
|
533 | + && is_array($this->_session_data) |
|
534 | + && isset($this->_session_data['id']) |
|
535 | 535 | ? $this->_session_data |
536 | 536 | : NULL; |
537 | - if ( empty( $this->_session_data )) { |
|
537 | + if (empty($this->_session_data)) { |
|
538 | 538 | $this->_set_defaults(); |
539 | 539 | } |
540 | 540 | $session_data = array(); |
541 | - foreach ( $this->_session_data as $key => $value ) { |
|
541 | + foreach ($this->_session_data as $key => $value) { |
|
542 | 542 | |
543 | - switch( $key ) { |
|
543 | + switch ($key) { |
|
544 | 544 | |
545 | 545 | case 'id' : |
546 | 546 | // session ID |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | break; |
559 | 559 | |
560 | 560 | case 'init_access' : |
561 | - $session_data['init_access'] = absint( $value ); |
|
561 | + $session_data['init_access'] = absint($value); |
|
562 | 562 | break; |
563 | 563 | |
564 | 564 | case 'last_access' : |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | case 'expiration' : |
570 | 570 | // when the session expires |
571 | - $session_data['expiration'] = ! empty( $this->_expiration ) |
|
571 | + $session_data['expiration'] = ! empty($this->_expiration) |
|
572 | 572 | ? $this->_expiration |
573 | 573 | : $session_data['init_access'] + $this->_lifespan; |
574 | 574 | break; |
@@ -580,11 +580,11 @@ discard block |
||
580 | 580 | |
581 | 581 | case 'pages_visited' : |
582 | 582 | $page_visit = $this->_get_page_visit(); |
583 | - if ( $page_visit ) { |
|
583 | + if ($page_visit) { |
|
584 | 584 | // set pages visited where the first will be the http referrer |
585 | - $this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit; |
|
585 | + $this->_session_data['pages_visited'][$this->_time] = $page_visit; |
|
586 | 586 | // we'll only save the last 10 page visits. |
587 | - $session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 ); |
|
587 | + $session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10); |
|
588 | 588 | } |
589 | 589 | break; |
590 | 590 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | |
599 | 599 | $this->_session_data = $session_data; |
600 | 600 | // creating a new session does not require saving to the db just yet |
601 | - if ( ! $new_session ) { |
|
601 | + if ( ! $new_session) { |
|
602 | 602 | // ready? let's save |
603 | - if ( $this->_save_session_to_db() ) { |
|
603 | + if ($this->_save_session_to_db()) { |
|
604 | 604 | return TRUE; |
605 | 605 | } else { |
606 | 606 | return FALSE; |
@@ -621,9 +621,9 @@ discard block |
||
621 | 621 | * @return bool |
622 | 622 | */ |
623 | 623 | private function _create_espresso_session( ) { |
624 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' ); |
|
624 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, ''); |
|
625 | 625 | // use the update function for now with $new_session arg set to TRUE |
626 | - return $this->update( TRUE ) ? TRUE : FALSE; |
|
626 | + return $this->update(TRUE) ? TRUE : FALSE; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -647,15 +647,15 @@ discard block |
||
647 | 647 | return FALSE; |
648 | 648 | } |
649 | 649 | // first serialize all of our session data |
650 | - $session_data = serialize( $this->_session_data ); |
|
650 | + $session_data = serialize($this->_session_data); |
|
651 | 651 | // encrypt it if we are using encryption |
652 | - $session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data; |
|
652 | + $session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data; |
|
653 | 653 | // maybe save hash check |
654 | - if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) { |
|
655 | - set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan ); |
|
654 | + if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) { |
|
655 | + set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan); |
|
656 | 656 | } |
657 | 657 | // we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient( transient ID, data, expiry ) |
658 | - return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan ); |
|
658 | + return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan); |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | |
@@ -681,10 +681,10 @@ discard block |
||
681 | 681 | 'HTTP_FORWARDED', |
682 | 682 | 'REMOTE_ADDR' |
683 | 683 | ); |
684 | - foreach ( $server_keys as $key ){ |
|
685 | - if ( isset( $_SERVER[ $key ] )) { |
|
686 | - foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) { |
|
687 | - if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) { |
|
684 | + foreach ($server_keys as $key) { |
|
685 | + if (isset($_SERVER[$key])) { |
|
686 | + foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { |
|
687 | + if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) { |
|
688 | 688 | $visitor_ip = $ip; |
689 | 689 | } |
690 | 690 | } |
@@ -705,45 +705,45 @@ discard block |
||
705 | 705 | public function _get_page_visit() { |
706 | 706 | |
707 | 707 | // echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.' ( line no: ' . __LINE__ . ' )</h3>'; |
708 | - $page_visit = home_url('/') . 'wp-admin/admin-ajax.php'; |
|
708 | + $page_visit = home_url('/').'wp-admin/admin-ajax.php'; |
|
709 | 709 | |
710 | 710 | // check for request url |
711 | - if ( isset( $_SERVER['REQUEST_URI'] )) { |
|
711 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
712 | 712 | |
713 | - $request_uri = esc_url( $_SERVER['REQUEST_URI'] ); |
|
713 | + $request_uri = esc_url($_SERVER['REQUEST_URI']); |
|
714 | 714 | |
715 | - $ru_bits = explode( '?', $request_uri ); |
|
715 | + $ru_bits = explode('?', $request_uri); |
|
716 | 716 | $request_uri = $ru_bits[0]; |
717 | 717 | //echo '<h1>$request_uri ' . $request_uri . '</h1>'; |
718 | 718 | |
719 | 719 | // check for and grab host as well |
720 | - if ( isset( $_SERVER['HTTP_HOST'] )) { |
|
721 | - $http_host = esc_url( $_SERVER['HTTP_HOST'] ); |
|
720 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
721 | + $http_host = esc_url($_SERVER['HTTP_HOST']); |
|
722 | 722 | } else { |
723 | 723 | $http_host = ''; |
724 | 724 | } |
725 | 725 | //echo '<h1>$http_host ' . $http_host . '</h1>'; |
726 | 726 | |
727 | 727 | // check for page_id in SERVER REQUEST |
728 | - if ( isset( $_REQUEST['page_id'] )) { |
|
728 | + if (isset($_REQUEST['page_id'])) { |
|
729 | 729 | // rebuild $e_reg without any of the extra parameters |
730 | - $page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&'; |
|
730 | + $page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&'; |
|
731 | 731 | } else { |
732 | 732 | $page_id = '?'; |
733 | 733 | } |
734 | 734 | // check for $e_reg in SERVER REQUEST |
735 | - if ( isset( $_REQUEST['ee'] )) { |
|
735 | + if (isset($_REQUEST['ee'])) { |
|
736 | 736 | // rebuild $e_reg without any of the extra parameters |
737 | - $e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] ); |
|
737 | + $e_reg = 'ee='.esc_attr($_REQUEST['ee']); |
|
738 | 738 | } else { |
739 | 739 | $e_reg = ''; |
740 | 740 | } |
741 | 741 | |
742 | - $page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' ); |
|
742 | + $page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?'); |
|
743 | 743 | |
744 | 744 | } |
745 | 745 | |
746 | - return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : ''; |
|
746 | + return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : ''; |
|
747 | 747 | |
748 | 748 | } |
749 | 749 | |
@@ -772,14 +772,14 @@ discard block |
||
772 | 772 | * @param string $function |
773 | 773 | * @return void |
774 | 774 | */ |
775 | - public function clear_session( $class = '', $function = '' ) { |
|
775 | + public function clear_session($class = '', $function = '') { |
|
776 | 776 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
777 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' . $function . '()' ); |
|
777 | + do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()'); |
|
778 | 778 | $this->reset_cart(); |
779 | 779 | $this->reset_checkout(); |
780 | 780 | $this->reset_transaction(); |
781 | 781 | // wipe out everything that isn't a default session datum |
782 | - $this->reset_data( array_keys( $this->_session_data )); |
|
782 | + $this->reset_data(array_keys($this->_session_data)); |
|
783 | 783 | // reset initial site access time and the session expiration |
784 | 784 | $this->_set_init_access_and_expiration(); |
785 | 785 | $this->_save_session_to_db(); |
@@ -794,42 +794,42 @@ discard block |
||
794 | 794 | * @param bool $show_all_notices |
795 | 795 | * @return TRUE on success, FALSE on fail |
796 | 796 | */ |
797 | - public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) { |
|
797 | + public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) { |
|
798 | 798 | // if $data_to_reset is not in an array, then put it in one |
799 | - if ( ! is_array( $data_to_reset ) ) { |
|
800 | - $data_to_reset = array ( $data_to_reset ); |
|
799 | + if ( ! is_array($data_to_reset)) { |
|
800 | + $data_to_reset = array($data_to_reset); |
|
801 | 801 | } |
802 | 802 | // nothing ??? go home! |
803 | - if ( empty( $data_to_reset )) { |
|
804 | - EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
803 | + if (empty($data_to_reset)) { |
|
804 | + EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
805 | 805 | return FALSE; |
806 | 806 | } |
807 | 807 | $return_value = TRUE; |
808 | 808 | // since $data_to_reset is an array, cycle through the values |
809 | - foreach ( $data_to_reset as $reset ) { |
|
809 | + foreach ($data_to_reset as $reset) { |
|
810 | 810 | |
811 | 811 | // first check to make sure it is a valid session var |
812 | - if ( isset( $this->_session_data[ $reset ] )) { |
|
812 | + if (isset($this->_session_data[$reset])) { |
|
813 | 813 | // then check to make sure it is not a default var |
814 | - if ( ! array_key_exists( $reset, $this->_default_session_vars )) { |
|
814 | + if ( ! array_key_exists($reset, $this->_default_session_vars)) { |
|
815 | 815 | // remove session var |
816 | - unset( $this->_session_data[ $reset ] ); |
|
817 | - if ( $show_all_notices ) { |
|
818 | - EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
816 | + unset($this->_session_data[$reset]); |
|
817 | + if ($show_all_notices) { |
|
818 | + EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
819 | 819 | } |
820 | - $return_value = !isset($return_value) ? TRUE : $return_value; |
|
820 | + $return_value = ! isset($return_value) ? TRUE : $return_value; |
|
821 | 821 | |
822 | 822 | } else { |
823 | 823 | // yeeeeeeeeerrrrrrrrrrr OUT !!!! |
824 | - if ( $show_all_notices ) { |
|
825 | - EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
824 | + if ($show_all_notices) { |
|
825 | + EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
826 | 826 | } |
827 | 827 | $return_value = FALSE; |
828 | 828 | } |
829 | 829 | |
830 | - } else if ( $show_all_notices ) { |
|
830 | + } else if ($show_all_notices) { |
|
831 | 831 | // oops! that session var does not exist! |
832 | - EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ ); |
|
832 | + EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__); |
|
833 | 833 | $return_value = FALSE; |
834 | 834 | } |
835 | 835 | |
@@ -850,8 +850,8 @@ discard block |
||
850 | 850 | * @return string |
851 | 851 | */ |
852 | 852 | public function wp_loaded() { |
853 | - if ( isset( EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) { |
|
854 | - $this->clear_session( __CLASS__, __FUNCTION__ ); |
|
853 | + if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) { |
|
854 | + $this->clear_session(__CLASS__, __FUNCTION__); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
@@ -876,24 +876,24 @@ discard block |
||
876 | 876 | */ |
877 | 877 | public function garbage_collection() { |
878 | 878 | // only perform during regular requests |
879 | - if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) { |
|
879 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX) { |
|
880 | 880 | /** @type WPDB $wpdb */ |
881 | 881 | global $wpdb; |
882 | 882 | // since transient expiration timestamps are set in the future, we can compare against NOW |
883 | 883 | $expiration = time(); |
884 | - $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 ); |
|
884 | + $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2); |
|
885 | 885 | // filter the query limit. Set to 0 to turn off garbage collection |
886 | - $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 )); |
|
886 | + $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50)); |
|
887 | 887 | // non-zero LIMIT means take out the trash |
888 | - if ( $expired_session_transient_delete_query_limit ) { |
|
888 | + if ($expired_session_transient_delete_query_limit) { |
|
889 | 889 | //array of transient keys that require garbage collection |
890 | 890 | $session_keys = array( |
891 | 891 | EE_Session::session_id_prefix, |
892 | 892 | EE_Session::hash_check_prefix, |
893 | 893 | ); |
894 | - foreach ( $session_keys as $session_key ) { |
|
895 | - $session_key = str_replace( '_', '\_', $session_key ); |
|
896 | - $session_key = '\_transient\_timeout\_' . $session_key . '%'; |
|
894 | + foreach ($session_keys as $session_key) { |
|
895 | + $session_key = str_replace('_', '\_', $session_key); |
|
896 | + $session_key = '\_transient\_timeout\_'.$session_key.'%'; |
|
897 | 897 | $SQL = " |
898 | 898 | SELECT option_name |
899 | 899 | FROM {$wpdb->options} |
@@ -903,28 +903,28 @@ discard block |
||
903 | 903 | OR option_value > {$too_far_in_the_the_future} ) |
904 | 904 | LIMIT {$expired_session_transient_delete_query_limit} |
905 | 905 | "; |
906 | - $expired_sessions = $wpdb->get_col( $SQL ); |
|
906 | + $expired_sessions = $wpdb->get_col($SQL); |
|
907 | 907 | // valid results? |
908 | - if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) { |
|
908 | + if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) { |
|
909 | 909 | // format array of results into something usable within the actual DELETE query's IN clause |
910 | 910 | $expired = array(); |
911 | - foreach ( $expired_sessions as $expired_session ) { |
|
912 | - $expired[ ] = "'" . $expired_session . "'"; |
|
913 | - $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'"; |
|
911 | + foreach ($expired_sessions as $expired_session) { |
|
912 | + $expired[] = "'".$expired_session."'"; |
|
913 | + $expired[] = "'".str_replace('timeout_', '', $expired_session)."'"; |
|
914 | 914 | } |
915 | - $expired = implode( ', ', $expired ); |
|
915 | + $expired = implode(', ', $expired); |
|
916 | 916 | $SQL = " |
917 | 917 | DELETE FROM {$wpdb->options} |
918 | 918 | WHERE option_name |
919 | 919 | IN ( $expired ); |
920 | 920 | "; |
921 | - $results = $wpdb->query( $SQL ); |
|
921 | + $results = $wpdb->query($SQL); |
|
922 | 922 | // if something went wrong, then notify the admin |
923 | - if ( $results instanceof WP_Error && is_admin() ) { |
|
924 | - EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
923 | + if ($results instanceof WP_Error && is_admin()) { |
|
924 | + EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
925 | 925 | } |
926 | 926 | } |
927 | - do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit ); |
|
927 | + do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Invoice extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Invoice extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($pm_instance = NULL) { |
38 | 38 | $this->_pretty_name = __("Invoice", 'event_espresso'); |
39 | - $this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' ); |
|
39 | + $this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso'); |
|
40 | 40 | parent::__construct($pm_instance); |
41 | 41 | $this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png'; |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -61,53 +61,53 @@ discard block |
||
61 | 61 | public function generate_new_settings_form() { |
62 | 62 | $pdf_payee_input_name = 'pdf_payee_name'; |
63 | 63 | $confirmation_text_input_name = 'page_confirmation_text'; |
64 | - $form = new EE_Payment_Method_Form(array( |
|
64 | + $form = new EE_Payment_Method_Form(array( |
|
65 | 65 | // 'payment_method_type' => $this, |
66 | 66 | 'extra_meta_inputs'=>array( |
67 | 67 | $pdf_payee_input_name => new EE_Text_Input(array( |
68 | - 'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
|
68 | + 'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link()) |
|
69 | 69 | )), |
70 | 70 | 'pdf_payee_email' => new EE_Email_Input(array( |
71 | - 'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
71 | + 'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()), |
|
72 | 72 | )), |
73 | 73 | 'pdf_payee_tax_number' => new EE_Text_Input(array( |
74 | - 'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
74 | + 'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()), |
|
75 | 75 | )), |
76 | - 'pdf_payee_address' => new EE_Text_Area_Input( array( |
|
77 | - 'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
78 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
76 | + 'pdf_payee_address' => new EE_Text_Area_Input(array( |
|
77 | + 'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()), |
|
78 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
79 | 79 | )), |
80 | 80 | 'pdf_instructions'=>new EE_Text_Area_Input(array( |
81 | - 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
81 | + 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
82 | 82 | 'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
83 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
83 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
84 | 84 | )), |
85 | 85 | 'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
86 | - 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
86 | + 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
87 | 87 | 'default'=> EE_Config::instance()->organization->logo_url, |
88 | 88 | 'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
89 | 89 | )), |
90 | 90 | $confirmation_text_input_name =>new EE_Text_Area_Input(array( |
91 | - 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
91 | + 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
92 | 92 | 'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
93 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
93 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
94 | 94 | )), |
95 | 95 | 'page_extra_info'=>new EE_Text_Area_Input(array( |
96 | - 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
96 | + 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
98 | 98 | )), |
99 | 99 | ), |
100 | 100 | 'include'=>array( |
101 | - 'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
|
102 | - $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
|
101 | + 'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order', |
|
102 | + $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image', |
|
103 | 103 | $confirmation_text_input_name, 'page_extra_info'), |
104 | 104 | )); |
105 | 105 | $form->add_subsections( |
106 | - array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
|
106 | + array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')), |
|
107 | 107 | $pdf_payee_input_name |
108 | 108 | ); |
109 | 109 | $form->add_subsections( |
110 | - array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
|
110 | + array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')), |
|
111 | 111 | $confirmation_text_input_name |
112 | 112 | ); |
113 | 113 | return $form; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @see EE_PMT_Base::help_tabs_config() |
121 | 121 | * @return array |
122 | 122 | */ |
123 | - public function help_tabs_config(){ |
|
123 | + public function help_tabs_config() { |
|
124 | 124 | return array( |
125 | 125 | $this->get_help_tab_name() => array( |
126 | 126 | 'title' => __('Invoice Settings', 'event_espresso'), |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @param \EE_Payment $payment |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function payment_overview_content( EE_Payment $payment ){ |
|
141 | + public function payment_overview_content(EE_Payment $payment) { |
|
142 | 142 | EE_Registry::instance()->load_helper('Template'); |
143 | 143 | return EEH_Template::locate_template( |
144 | - 'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
|
144 | + 'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php', |
|
145 | 145 | array_merge( |
146 | 146 | array( |
147 | 147 | 'payment_method' => $this->_pm_instance, |
148 | 148 | 'payment' => $payment, |
149 | 149 | 'page_confirmation_text' => '', |
150 | 150 | 'page_extra_info' => '', |
151 | - 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
|
151 | + 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url('html') |
|
152 | 152 | ), |
153 | 153 | $this->_pm_instance->all_extra_meta_array() |
154 | 154 | ) |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public $map_settings = null; |
90 | 90 | |
91 | 91 | /** |
92 | - * |
|
93 | - * @deprecated |
|
94 | - * @var EE_Gateway_Config |
|
95 | - */ |
|
92 | + * |
|
93 | + * @deprecated |
|
94 | + * @var EE_Gateway_Config |
|
95 | + */ |
|
96 | 96 | public $gateway = null; |
97 | 97 | |
98 | 98 | /** |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | /** |
584 | 584 | * update_config |
585 | - * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
585 | + * Important: the config object must ALREADY be set, otherwise this will produce an error. |
|
586 | 586 | * |
587 | 587 | * @access public |
588 | 588 | * @param string $section |
@@ -1606,51 +1606,51 @@ discard block |
||
1606 | 1606 | class EE_Organization_Config extends EE_Config_Base { |
1607 | 1607 | |
1608 | 1608 | /** |
1609 | - * @var string $name |
|
1610 | - * eg EE4.1 |
|
1611 | - */ |
|
1609 | + * @var string $name |
|
1610 | + * eg EE4.1 |
|
1611 | + */ |
|
1612 | 1612 | public $name; |
1613 | 1613 | |
1614 | 1614 | /** |
1615 | - * @var string $address_1 |
|
1616 | - * eg 123 Onna Road |
|
1617 | - */ |
|
1615 | + * @var string $address_1 |
|
1616 | + * eg 123 Onna Road |
|
1617 | + */ |
|
1618 | 1618 | public $address_1; |
1619 | 1619 | |
1620 | 1620 | /** |
1621 | - * @var string $address_2 |
|
1622 | - * eg PO Box 123 |
|
1623 | - */ |
|
1621 | + * @var string $address_2 |
|
1622 | + * eg PO Box 123 |
|
1623 | + */ |
|
1624 | 1624 | public $address_2; |
1625 | 1625 | |
1626 | 1626 | /** |
1627 | - * @var string $city |
|
1628 | - * eg Inna City |
|
1629 | - */ |
|
1627 | + * @var string $city |
|
1628 | + * eg Inna City |
|
1629 | + */ |
|
1630 | 1630 | public $city; |
1631 | 1631 | |
1632 | 1632 | /** |
1633 | - * @var int $STA_ID |
|
1634 | - * eg 4 |
|
1635 | - */ |
|
1633 | + * @var int $STA_ID |
|
1634 | + * eg 4 |
|
1635 | + */ |
|
1636 | 1636 | public $STA_ID; |
1637 | 1637 | |
1638 | 1638 | /** |
1639 | - * @var string $CNT_ISO |
|
1640 | - * eg US |
|
1641 | - */ |
|
1639 | + * @var string $CNT_ISO |
|
1640 | + * eg US |
|
1641 | + */ |
|
1642 | 1642 | public $CNT_ISO; |
1643 | 1643 | |
1644 | 1644 | /** |
1645 | - * @var string $zip |
|
1646 | - * eg 12345 or V1A 2B3 |
|
1647 | - */ |
|
1645 | + * @var string $zip |
|
1646 | + * eg 12345 or V1A 2B3 |
|
1647 | + */ |
|
1648 | 1648 | public $zip; |
1649 | 1649 | |
1650 | 1650 | /** |
1651 | - * @var string $email |
|
1652 | - * eg [email protected] |
|
1653 | - */ |
|
1651 | + * @var string $email |
|
1652 | + * eg [email protected] |
|
1653 | + */ |
|
1654 | 1654 | public $email; |
1655 | 1655 | |
1656 | 1656 | |
@@ -1669,9 +1669,9 @@ discard block |
||
1669 | 1669 | public $vat; |
1670 | 1670 | |
1671 | 1671 | /** |
1672 | - * @var string $logo_url |
|
1673 | - * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | - */ |
|
1672 | + * @var string $logo_url |
|
1673 | + * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg |
|
1674 | + */ |
|
1675 | 1675 | public $logo_url; |
1676 | 1676 | |
1677 | 1677 | |
@@ -1765,55 +1765,55 @@ discard block |
||
1765 | 1765 | class EE_Currency_Config extends EE_Config_Base { |
1766 | 1766 | |
1767 | 1767 | /** |
1768 | - * @var string $code |
|
1769 | - * eg 'US' |
|
1770 | - */ |
|
1768 | + * @var string $code |
|
1769 | + * eg 'US' |
|
1770 | + */ |
|
1771 | 1771 | public $code; |
1772 | 1772 | |
1773 | 1773 | /** |
1774 | - * @var string $name |
|
1775 | - * eg 'Dollar' |
|
1776 | - */ |
|
1774 | + * @var string $name |
|
1775 | + * eg 'Dollar' |
|
1776 | + */ |
|
1777 | 1777 | public $name; |
1778 | 1778 | |
1779 | 1779 | /** |
1780 | - * plural name |
|
1781 | - * @var string $plural |
|
1782 | - * eg 'Dollars' |
|
1783 | - */ |
|
1780 | + * plural name |
|
1781 | + * @var string $plural |
|
1782 | + * eg 'Dollars' |
|
1783 | + */ |
|
1784 | 1784 | public $plural; |
1785 | 1785 | |
1786 | 1786 | /** |
1787 | - * currency sign |
|
1788 | - * @var string $sign |
|
1789 | - * eg '$' |
|
1790 | - */ |
|
1787 | + * currency sign |
|
1788 | + * @var string $sign |
|
1789 | + * eg '$' |
|
1790 | + */ |
|
1791 | 1791 | public $sign; |
1792 | 1792 | |
1793 | 1793 | /** |
1794 | - * Whether the currency sign should come before the number or not |
|
1795 | - * @var boolean $sign_b4 |
|
1796 | - */ |
|
1794 | + * Whether the currency sign should come before the number or not |
|
1795 | + * @var boolean $sign_b4 |
|
1796 | + */ |
|
1797 | 1797 | public $sign_b4; |
1798 | 1798 | |
1799 | 1799 | /** |
1800 | - * How many digits should come after the decimal place |
|
1801 | - * @var int $dec_plc |
|
1802 | - */ |
|
1800 | + * How many digits should come after the decimal place |
|
1801 | + * @var int $dec_plc |
|
1802 | + */ |
|
1803 | 1803 | public $dec_plc; |
1804 | 1804 | |
1805 | 1805 | /** |
1806 | - * Symbol to use for decimal mark |
|
1807 | - * @var string $dec_mrk |
|
1808 | - * eg '.' |
|
1809 | - */ |
|
1806 | + * Symbol to use for decimal mark |
|
1807 | + * @var string $dec_mrk |
|
1808 | + * eg '.' |
|
1809 | + */ |
|
1810 | 1810 | public $dec_mrk; |
1811 | 1811 | |
1812 | 1812 | /** |
1813 | - * Symbol to use for thousands |
|
1814 | - * @var string $thsnds |
|
1815 | - * eg ',' |
|
1816 | - */ |
|
1813 | + * Symbol to use for thousands |
|
1814 | + * @var string $thsnds |
|
1815 | + * eg ',' |
|
1816 | + */ |
|
1817 | 1817 | public $thsnds; |
1818 | 1818 | |
1819 | 1819 | |
@@ -1881,13 +1881,13 @@ discard block |
||
1881 | 1881 | * whether or not to show alternate payment options during the reg process if payment status is pending |
1882 | 1882 | * @var boolean $show_pending_payment_options |
1883 | 1883 | */ |
1884 | - public $show_pending_payment_options; |
|
1884 | + public $show_pending_payment_options; |
|
1885 | 1885 | |
1886 | 1886 | /** |
1887 | 1887 | * Whether to skip the registration confirmation page |
1888 | 1888 | * @var boolean $skip_reg_confirmation |
1889 | 1889 | */ |
1890 | - public $skip_reg_confirmation; |
|
1890 | + public $skip_reg_confirmation; |
|
1891 | 1891 | |
1892 | 1892 | /** |
1893 | 1893 | * an array of SPCO reg steps where: |
@@ -1898,64 +1898,64 @@ discard block |
||
1898 | 1898 | * "slug" => the URL param used to trigger the reg step |
1899 | 1899 | * @var array $reg_steps |
1900 | 1900 | */ |
1901 | - public $reg_steps; |
|
1901 | + public $reg_steps; |
|
1902 | 1902 | |
1903 | 1903 | /** |
1904 | 1904 | * Whether registration confirmation should be the last page of SPCO |
1905 | 1905 | * @var boolean $reg_confirmation_last |
1906 | 1906 | */ |
1907 | - public $reg_confirmation_last; |
|
1907 | + public $reg_confirmation_last; |
|
1908 | 1908 | |
1909 | 1909 | /** |
1910 | 1910 | * Whether or not to enable the EE Bot Trap |
1911 | 1911 | * @var boolean $use_bot_trap |
1912 | 1912 | */ |
1913 | - public $use_bot_trap; |
|
1913 | + public $use_bot_trap; |
|
1914 | 1914 | |
1915 | 1915 | /** |
1916 | 1916 | * Whether or not to encrypt some data sent by the EE Bot Trap |
1917 | 1917 | * @var boolean $use_encryption |
1918 | 1918 | */ |
1919 | - public $use_encryption; |
|
1919 | + public $use_encryption; |
|
1920 | 1920 | |
1921 | 1921 | /** |
1922 | 1922 | * Whether or not to use ReCaptcha |
1923 | 1923 | * @var boolean $use_captcha |
1924 | 1924 | */ |
1925 | - public $use_captcha; |
|
1925 | + public $use_captcha; |
|
1926 | 1926 | |
1927 | 1927 | /** |
1928 | 1928 | * ReCaptcha Theme |
1929 | 1929 | * @var string $recaptcha_theme |
1930 | 1930 | * options: 'dark ', 'light' |
1931 | 1931 | */ |
1932 | - public $recaptcha_theme; |
|
1932 | + public $recaptcha_theme; |
|
1933 | 1933 | |
1934 | 1934 | /** |
1935 | 1935 | * ReCaptcha Type |
1936 | 1936 | * @var string $recaptcha_type |
1937 | 1937 | * options: 'audio', 'image' |
1938 | 1938 | */ |
1939 | - public $recaptcha_type; |
|
1939 | + public $recaptcha_type; |
|
1940 | 1940 | |
1941 | 1941 | /** |
1942 | 1942 | * ReCaptcha language |
1943 | 1943 | * @var string $recaptcha_language |
1944 | 1944 | * eg 'en' |
1945 | 1945 | */ |
1946 | - public $recaptcha_language; |
|
1946 | + public $recaptcha_language; |
|
1947 | 1947 | |
1948 | 1948 | /** |
1949 | 1949 | * ReCaptcha public key |
1950 | 1950 | * @var string $recaptcha_publickey |
1951 | 1951 | */ |
1952 | - public $recaptcha_publickey; |
|
1952 | + public $recaptcha_publickey; |
|
1953 | 1953 | |
1954 | 1954 | /** |
1955 | 1955 | * ReCaptcha private key |
1956 | 1956 | * @var string $recaptcha_privatekey |
1957 | 1957 | */ |
1958 | - public $recaptcha_privatekey; |
|
1958 | + public $recaptcha_privatekey; |
|
1959 | 1959 | |
1960 | 1960 | /** |
1961 | 1961 | * ReCaptcha width |
@@ -2021,58 +2021,58 @@ discard block |
||
2021 | 2021 | class EE_Admin_Config extends EE_Config_Base { |
2022 | 2022 | |
2023 | 2023 | /** |
2024 | - * @var boolean $use_personnel_manager |
|
2025 | - */ |
|
2024 | + * @var boolean $use_personnel_manager |
|
2025 | + */ |
|
2026 | 2026 | public $use_personnel_manager; |
2027 | 2027 | |
2028 | 2028 | /** |
2029 | - * @var boolean $use_dashboard_widget |
|
2030 | - */ |
|
2029 | + * @var boolean $use_dashboard_widget |
|
2030 | + */ |
|
2031 | 2031 | public $use_dashboard_widget; |
2032 | 2032 | |
2033 | 2033 | /** |
2034 | - * @var int $events_in_dashboard |
|
2035 | - */ |
|
2034 | + * @var int $events_in_dashboard |
|
2035 | + */ |
|
2036 | 2036 | public $events_in_dashboard; |
2037 | 2037 | |
2038 | 2038 | /** |
2039 | - * @var boolean $use_event_timezones |
|
2040 | - */ |
|
2039 | + * @var boolean $use_event_timezones |
|
2040 | + */ |
|
2041 | 2041 | public $use_event_timezones; |
2042 | 2042 | |
2043 | 2043 | /** |
2044 | - * @var boolean $use_full_logging |
|
2045 | - */ |
|
2044 | + * @var boolean $use_full_logging |
|
2045 | + */ |
|
2046 | 2046 | public $use_full_logging; |
2047 | 2047 | |
2048 | 2048 | /** |
2049 | - * @var string $log_file_name |
|
2050 | - */ |
|
2049 | + * @var string $log_file_name |
|
2050 | + */ |
|
2051 | 2051 | public $log_file_name; |
2052 | 2052 | |
2053 | 2053 | /** |
2054 | - * @var string $debug_file_name |
|
2055 | - */ |
|
2054 | + * @var string $debug_file_name |
|
2055 | + */ |
|
2056 | 2056 | public $debug_file_name; |
2057 | 2057 | |
2058 | 2058 | /** |
2059 | - * @var boolean $use_remote_logging |
|
2060 | - */ |
|
2059 | + * @var boolean $use_remote_logging |
|
2060 | + */ |
|
2061 | 2061 | public $use_remote_logging; |
2062 | 2062 | |
2063 | 2063 | /** |
2064 | - * @var string $remote_logging_url |
|
2065 | - */ |
|
2064 | + * @var string $remote_logging_url |
|
2065 | + */ |
|
2066 | 2066 | public $remote_logging_url; |
2067 | 2067 | |
2068 | 2068 | /** |
2069 | - * @var boolean $show_reg_footer |
|
2070 | - */ |
|
2069 | + * @var boolean $show_reg_footer |
|
2070 | + */ |
|
2071 | 2071 | public $show_reg_footer; |
2072 | 2072 | |
2073 | 2073 | /** |
2074 | - * @var string $affiliate_id |
|
2075 | - */ |
|
2074 | + * @var string $affiliate_id |
|
2075 | + */ |
|
2076 | 2076 | public $affiliate_id; |
2077 | 2077 | |
2078 | 2078 | |
@@ -2146,43 +2146,43 @@ discard block |
||
2146 | 2146 | class EE_Template_Config extends EE_Config_Base { |
2147 | 2147 | |
2148 | 2148 | /** |
2149 | - * @var boolean $enable_default_style |
|
2150 | - */ |
|
2149 | + * @var boolean $enable_default_style |
|
2150 | + */ |
|
2151 | 2151 | public $enable_default_style; |
2152 | 2152 | |
2153 | 2153 | /** |
2154 | - * @var string $custom_style_sheet |
|
2155 | - */ |
|
2154 | + * @var string $custom_style_sheet |
|
2155 | + */ |
|
2156 | 2156 | public $custom_style_sheet; |
2157 | 2157 | |
2158 | 2158 | /** |
2159 | - * @var boolean $display_address_in_regform |
|
2160 | - */ |
|
2159 | + * @var boolean $display_address_in_regform |
|
2160 | + */ |
|
2161 | 2161 | public $display_address_in_regform; |
2162 | 2162 | |
2163 | 2163 | /** |
2164 | - * @var int $display_description_on_multi_reg_page |
|
2165 | - */ |
|
2164 | + * @var int $display_description_on_multi_reg_page |
|
2165 | + */ |
|
2166 | 2166 | public $display_description_on_multi_reg_page; |
2167 | 2167 | |
2168 | 2168 | /** |
2169 | - * @var boolean $use_custom_templates |
|
2170 | - */ |
|
2169 | + * @var boolean $use_custom_templates |
|
2170 | + */ |
|
2171 | 2171 | public $use_custom_templates; |
2172 | 2172 | |
2173 | 2173 | /** |
2174 | - * @var string $current_espresso_theme |
|
2175 | - */ |
|
2174 | + * @var string $current_espresso_theme |
|
2175 | + */ |
|
2176 | 2176 | public $current_espresso_theme; |
2177 | 2177 | |
2178 | 2178 | /** |
2179 | - * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | - */ |
|
2179 | + * @var EE_Event_Single_Config $EED_Event_Single |
|
2180 | + */ |
|
2181 | 2181 | public $EED_Event_Single; |
2182 | 2182 | |
2183 | 2183 | /** |
2184 | - * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | - */ |
|
2184 | + * @var EE_Events_Archive_Config $EED_Events_Archive |
|
2185 | + */ |
|
2186 | 2186 | public $EED_Events_Archive; |
2187 | 2187 | |
2188 | 2188 | |
@@ -2215,78 +2215,78 @@ discard block |
||
2215 | 2215 | class EE_Map_Config extends EE_Config_Base { |
2216 | 2216 | |
2217 | 2217 | /** |
2218 | - * @var boolean $use_google_maps |
|
2219 | - */ |
|
2218 | + * @var boolean $use_google_maps |
|
2219 | + */ |
|
2220 | 2220 | public $use_google_maps; |
2221 | 2221 | |
2222 | 2222 | /** |
2223 | - * @var int $event_details_map_width |
|
2224 | - */ |
|
2223 | + * @var int $event_details_map_width |
|
2224 | + */ |
|
2225 | 2225 | public $event_details_map_width; |
2226 | 2226 | |
2227 | 2227 | /** |
2228 | - * @var int $event_details_map_height |
|
2229 | - */ |
|
2228 | + * @var int $event_details_map_height |
|
2229 | + */ |
|
2230 | 2230 | public $event_details_map_height; |
2231 | 2231 | |
2232 | 2232 | /** |
2233 | - * @var int $event_details_map_zoom |
|
2234 | - */ |
|
2233 | + * @var int $event_details_map_zoom |
|
2234 | + */ |
|
2235 | 2235 | public $event_details_map_zoom; |
2236 | 2236 | |
2237 | 2237 | /** |
2238 | - * @var boolean $event_details_display_nav |
|
2239 | - */ |
|
2238 | + * @var boolean $event_details_display_nav |
|
2239 | + */ |
|
2240 | 2240 | public $event_details_display_nav; |
2241 | 2241 | |
2242 | 2242 | /** |
2243 | - * @var boolean $event_details_nav_size |
|
2244 | - */ |
|
2243 | + * @var boolean $event_details_nav_size |
|
2244 | + */ |
|
2245 | 2245 | public $event_details_nav_size; |
2246 | 2246 | |
2247 | 2247 | /** |
2248 | - * @var string $event_details_control_type |
|
2249 | - */ |
|
2248 | + * @var string $event_details_control_type |
|
2249 | + */ |
|
2250 | 2250 | public $event_details_control_type; |
2251 | 2251 | |
2252 | 2252 | /** |
2253 | - * @var string $event_details_map_align |
|
2254 | - */ |
|
2253 | + * @var string $event_details_map_align |
|
2254 | + */ |
|
2255 | 2255 | public $event_details_map_align; |
2256 | 2256 | |
2257 | 2257 | /** |
2258 | - * @var int $event_list_map_width |
|
2259 | - */ |
|
2258 | + * @var int $event_list_map_width |
|
2259 | + */ |
|
2260 | 2260 | public $event_list_map_width; |
2261 | 2261 | |
2262 | 2262 | /** |
2263 | - * @var int $event_list_map_height |
|
2264 | - */ |
|
2263 | + * @var int $event_list_map_height |
|
2264 | + */ |
|
2265 | 2265 | public $event_list_map_height; |
2266 | 2266 | |
2267 | 2267 | /** |
2268 | - * @var int $event_list_map_zoom |
|
2269 | - */ |
|
2268 | + * @var int $event_list_map_zoom |
|
2269 | + */ |
|
2270 | 2270 | public $event_list_map_zoom; |
2271 | 2271 | |
2272 | 2272 | /** |
2273 | - * @var boolean $event_list_display_nav |
|
2274 | - */ |
|
2273 | + * @var boolean $event_list_display_nav |
|
2274 | + */ |
|
2275 | 2275 | public $event_list_display_nav; |
2276 | 2276 | |
2277 | 2277 | /** |
2278 | - * @var boolean $event_list_nav_size |
|
2279 | - */ |
|
2278 | + * @var boolean $event_list_nav_size |
|
2279 | + */ |
|
2280 | 2280 | public $event_list_nav_size; |
2281 | 2281 | |
2282 | 2282 | /** |
2283 | - * @var string $event_list_control_type |
|
2284 | - */ |
|
2283 | + * @var string $event_list_control_type |
|
2284 | + */ |
|
2285 | 2285 | public $event_list_control_type; |
2286 | 2286 | |
2287 | 2287 | /** |
2288 | - * @var string $event_list_map_align |
|
2289 | - */ |
|
2288 | + * @var string $event_list_map_align |
|
2289 | + */ |
|
2290 | 2290 | public $event_list_map_align; |
2291 | 2291 | |
2292 | 2292 |
@@ -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; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->$config->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->$config->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->$addon_name = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -881,11 +881,11 @@ discard block |
||
881 | 881 | * @return void |
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
884 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
885 | 885 | return; |
886 | 886 | } |
887 | 887 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
888 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
888 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
889 | 889 | // allow modules to set hooks for the rest of the system |
890 | 890 | EE_Registry::instance()->modules = $this->_register_modules(); |
891 | 891 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @return void |
900 | 900 | */ |
901 | 901 | public function initialize_shortcodes_and_modules() { |
902 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
902 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
903 | 903 | return; |
904 | 904 | } |
905 | 905 | // allow shortcodes to set hooks for the rest of the system |
@@ -918,26 +918,26 @@ discard block |
||
918 | 918 | * @return void |
919 | 919 | */ |
920 | 920 | public function widgets_init() { |
921 | - if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) { |
|
921 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | //only init widgets on admin pages when not in complete maintenance, and |
925 | 925 | //on frontend when not in any maintenance mode |
926 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
926 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
927 | 927 | // grab list of installed widgets |
928 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
928 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
929 | 929 | // filter list of modules to register |
930 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
930 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
931 | 931 | |
932 | - if ( ! empty( $widgets_to_register ) ) { |
|
932 | + if ( ! empty($widgets_to_register)) { |
|
933 | 933 | // cycle thru widget folders |
934 | - foreach ( $widgets_to_register as $widget_path ) { |
|
934 | + foreach ($widgets_to_register as $widget_path) { |
|
935 | 935 | // add to list of installed widget modules |
936 | - EE_Config::register_ee_widget( $widget_path ); |
|
936 | + EE_Config::register_ee_widget($widget_path); |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | // filter list of installed modules |
940 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
940 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
@@ -950,54 +950,54 @@ discard block |
||
950 | 950 | * @param string $widget_path - full path up to and including widget folder |
951 | 951 | * @return void |
952 | 952 | */ |
953 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
954 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
953 | + public static function register_ee_widget($widget_path = NULL) { |
|
954 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
955 | 955 | $widget_ext = '.widget.php'; |
956 | 956 | // make all separators match |
957 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
957 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
958 | 958 | // does the file path INCLUDE the actual file name as part of the path ? |
959 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
959 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
960 | 960 | // grab and shortcode file name from directory name and break apart at dots |
961 | - $file_name = explode( '.', basename( $widget_path )); |
|
961 | + $file_name = explode('.', basename($widget_path)); |
|
962 | 962 | // take first segment from file name pieces and remove class prefix if it exists |
963 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
963 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
964 | 964 | // sanitize shortcode directory name |
965 | - $widget = sanitize_key( $widget ); |
|
965 | + $widget = sanitize_key($widget); |
|
966 | 966 | // now we need to rebuild the shortcode path |
967 | - $widget_path = explode( DS, $widget_path ); |
|
967 | + $widget_path = explode(DS, $widget_path); |
|
968 | 968 | // remove last segment |
969 | - array_pop( $widget_path ); |
|
969 | + array_pop($widget_path); |
|
970 | 970 | // glue it back together |
971 | - $widget_path = implode( DS, $widget_path ); |
|
971 | + $widget_path = implode(DS, $widget_path); |
|
972 | 972 | } else { |
973 | 973 | // grab and sanitize widget directory name |
974 | - $widget = sanitize_key( basename( $widget_path )); |
|
974 | + $widget = sanitize_key(basename($widget_path)); |
|
975 | 975 | } |
976 | 976 | // create classname from widget directory name |
977 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
977 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
978 | 978 | // add class prefix |
979 | - $widget_class = 'EEW_' . $widget; |
|
979 | + $widget_class = 'EEW_'.$widget; |
|
980 | 980 | // does the widget exist ? |
981 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
981 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
982 | 982 | $msg = sprintf( |
983 | - __( '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', 'event_espresso' ), |
|
983 | + __('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', 'event_espresso'), |
|
984 | 984 | $widget_class, |
985 | - $widget_path . DS . $widget_class . $widget_ext |
|
985 | + $widget_path.DS.$widget_class.$widget_ext |
|
986 | 986 | ); |
987 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
987 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
988 | 988 | return; |
989 | 989 | } |
990 | 990 | // load the widget class file |
991 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
991 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
992 | 992 | // verify that class exists |
993 | - if ( ! class_exists( $widget_class )) { |
|
994 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
995 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
993 | + if ( ! class_exists($widget_class)) { |
|
994 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
995 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
996 | 996 | return; |
997 | 997 | } |
998 | - register_widget( $widget_class ); |
|
998 | + register_widget($widget_class); |
|
999 | 999 | // add to array of registered widgets |
1000 | - EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext; |
|
1000 | + EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1010,18 +1010,18 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | private function _register_shortcodes() { |
1012 | 1012 | // grab list of installed shortcodes |
1013 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1013 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1014 | 1014 | // filter list of modules to register |
1015 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1016 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1015 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1016 | + if ( ! empty($shortcodes_to_register)) { |
|
1017 | 1017 | // cycle thru shortcode folders |
1018 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1018 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1019 | 1019 | // add to list of installed shortcode modules |
1020 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1020 | + EE_Config::register_shortcode($shortcode_path); |
|
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | // filter list of installed modules |
1024 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1024 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
@@ -1033,56 +1033,56 @@ discard block |
||
1033 | 1033 | * @param string $shortcode_path - full path up to and including shortcode folder |
1034 | 1034 | * @return bool |
1035 | 1035 | */ |
1036 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1037 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1036 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1037 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1038 | 1038 | $shortcode_ext = '.shortcode.php'; |
1039 | 1039 | // make all separators match |
1040 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1040 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1041 | 1041 | // does the file path INCLUDE the actual file name as part of the path ? |
1042 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1042 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1043 | 1043 | // grab shortcode file name from directory name and break apart at dots |
1044 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1044 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1045 | 1045 | // take first segment from file name pieces and remove class prefix if it exists |
1046 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1046 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1047 | 1047 | // sanitize shortcode directory name |
1048 | - $shortcode = sanitize_key( $shortcode ); |
|
1048 | + $shortcode = sanitize_key($shortcode); |
|
1049 | 1049 | // now we need to rebuild the shortcode path |
1050 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1050 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1051 | 1051 | // remove last segment |
1052 | - array_pop( $shortcode_path ); |
|
1052 | + array_pop($shortcode_path); |
|
1053 | 1053 | // glue it back together |
1054 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1054 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1055 | 1055 | } else { |
1056 | 1056 | // we need to generate the filename based off of the folder name |
1057 | 1057 | // grab and sanitize shortcode directory name |
1058 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1059 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1058 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1059 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1060 | 1060 | } |
1061 | 1061 | // create classname from shortcode directory or file name |
1062 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1062 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1063 | 1063 | // add class prefix |
1064 | - $shortcode_class = 'EES_' . $shortcode; |
|
1064 | + $shortcode_class = 'EES_'.$shortcode; |
|
1065 | 1065 | // does the shortcode exist ? |
1066 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1066 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1067 | 1067 | $msg = sprintf( |
1068 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1068 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1069 | 1069 | $shortcode_class, |
1070 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1070 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1071 | 1071 | ); |
1072 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1072 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1073 | 1073 | return FALSE; |
1074 | 1074 | } |
1075 | 1075 | // load the shortcode class file |
1076 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1076 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1077 | 1077 | // verify that class exists |
1078 | - if ( ! class_exists( $shortcode_class )) { |
|
1079 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1080 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1078 | + if ( ! class_exists($shortcode_class)) { |
|
1079 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1080 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1081 | 1081 | return FALSE; |
1082 | 1082 | } |
1083 | - $shortcode = strtoupper( $shortcode ); |
|
1083 | + $shortcode = strtoupper($shortcode); |
|
1084 | 1084 | // add to array of registered shortcodes |
1085 | - EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1085 | + EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1086 | 1086 | return TRUE; |
1087 | 1087 | } |
1088 | 1088 | |
@@ -1097,23 +1097,23 @@ discard block |
||
1097 | 1097 | */ |
1098 | 1098 | private function _register_modules() { |
1099 | 1099 | // grab list of installed modules |
1100 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1100 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1101 | 1101 | // filter list of modules to register |
1102 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1102 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1103 | 1103 | |
1104 | 1104 | |
1105 | - if ( ! empty( $modules_to_register ) ) { |
|
1105 | + if ( ! empty($modules_to_register)) { |
|
1106 | 1106 | // loop through folders |
1107 | - foreach ( $modules_to_register as $module_path ) { |
|
1107 | + foreach ($modules_to_register as $module_path) { |
|
1108 | 1108 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1109 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1109 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1110 | 1110 | // add to list of installed modules |
1111 | - EE_Config::register_module( $module_path ); |
|
1111 | + EE_Config::register_module($module_path); |
|
1112 | 1112 | } |
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | // filter list of installed modules |
1116 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1116 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1126,54 +1126,54 @@ discard block |
||
1126 | 1126 | * @param string $module_path - full path up to and including module folder |
1127 | 1127 | * @return bool |
1128 | 1128 | */ |
1129 | - public static function register_module( $module_path = NULL ) { |
|
1130 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1129 | + public static function register_module($module_path = NULL) { |
|
1130 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1131 | 1131 | $module_ext = '.module.php'; |
1132 | 1132 | // make all separators match |
1133 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1133 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1134 | 1134 | // does the file path INCLUDE the actual file name as part of the path ? |
1135 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1135 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1136 | 1136 | // grab and shortcode file name from directory name and break apart at dots |
1137 | - $module_file = explode( '.', basename( $module_path )); |
|
1137 | + $module_file = explode('.', basename($module_path)); |
|
1138 | 1138 | // now we need to rebuild the shortcode path |
1139 | - $module_path = explode( DS, $module_path ); |
|
1139 | + $module_path = explode(DS, $module_path); |
|
1140 | 1140 | // remove last segment |
1141 | - array_pop( $module_path ); |
|
1141 | + array_pop($module_path); |
|
1142 | 1142 | // glue it back together |
1143 | - $module_path = implode( DS, $module_path ) . DS; |
|
1143 | + $module_path = implode(DS, $module_path).DS; |
|
1144 | 1144 | // take first segment from file name pieces and sanitize it |
1145 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1145 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1146 | 1146 | // ensure class prefix is added |
1147 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1147 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1148 | 1148 | } else { |
1149 | 1149 | // we need to generate the filename based off of the folder name |
1150 | 1150 | // grab and sanitize module name |
1151 | - $module = strtolower( basename( $module_path )); |
|
1152 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1151 | + $module = strtolower(basename($module_path)); |
|
1152 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1153 | 1153 | // like trailingslashit() |
1154 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1154 | + $module_path = rtrim($module_path, DS).DS; |
|
1155 | 1155 | // create classname from module directory name |
1156 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1156 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1157 | 1157 | // add class prefix |
1158 | - $module_class = 'EED_' . $module; |
|
1158 | + $module_class = 'EED_'.$module; |
|
1159 | 1159 | } |
1160 | 1160 | // does the module exist ? |
1161 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1162 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1163 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1161 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1162 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1163 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1164 | 1164 | return FALSE; |
1165 | 1165 | } |
1166 | 1166 | // load the module class file |
1167 | - require_once( $module_path . $module_class . $module_ext ); |
|
1167 | + require_once($module_path.$module_class.$module_ext); |
|
1168 | 1168 | // verify that class exists |
1169 | - if ( ! class_exists( $module_class )) { |
|
1170 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1171 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + if ( ! class_exists($module_class)) { |
|
1170 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1171 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1172 | 1172 | return FALSE; |
1173 | 1173 | } |
1174 | 1174 | // add to array of registered modules |
1175 | - EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext; |
|
1176 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class ); |
|
1175 | + EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext; |
|
1176 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class); |
|
1177 | 1177 | return TRUE; |
1178 | 1178 | } |
1179 | 1179 | |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | */ |
1188 | 1188 | private function _initialize_shortcodes() { |
1189 | 1189 | // cycle thru shortcode folders |
1190 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1190 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1191 | 1191 | // add class prefix |
1192 | - $shortcode_class = 'EES_' . $shortcode; |
|
1192 | + $shortcode_class = 'EES_'.$shortcode; |
|
1193 | 1193 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1194 | 1194 | // which set hooks ? |
1195 | - if ( is_admin() ) { |
|
1195 | + if (is_admin()) { |
|
1196 | 1196 | // fire immediately |
1197 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1197 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1198 | 1198 | } else { |
1199 | 1199 | // delay until other systems are online |
1200 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1200 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1201 | 1201 | // convert classname to UPPERCASE and create WP shortcode. |
1202 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1202 | + $shortcode_tag = strtoupper($shortcode); |
|
1203 | 1203 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1204 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1204 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1205 | 1205 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1206 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1206 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1207 | 1207 | } |
1208 | 1208 | } |
1209 | 1209 | } |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | private function _initialize_modules() { |
1222 | 1222 | // cycle thru shortcode folders |
1223 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1223 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1224 | 1224 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1225 | 1225 | // which set hooks ? |
1226 | - if ( is_admin() ) { |
|
1226 | + if (is_admin()) { |
|
1227 | 1227 | // fire immediately |
1228 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1228 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1229 | 1229 | } else { |
1230 | 1230 | // delay until other systems are online |
1231 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1231 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1232 | 1232 | } |
1233 | 1233 | } |
1234 | 1234 | } |
@@ -1246,26 +1246,26 @@ discard block |
||
1246 | 1246 | * @param string $key - url param key indicating a route is being called |
1247 | 1247 | * @return bool |
1248 | 1248 | */ |
1249 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1250 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1251 | - $module = str_replace( 'EED_', '', $module ); |
|
1252 | - $module_class = 'EED_' . $module; |
|
1253 | - if ( ! isset( EE_Registry::instance()->modules->$module_class )) { |
|
1254 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1255 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1250 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1251 | + $module = str_replace('EED_', '', $module); |
|
1252 | + $module_class = 'EED_'.$module; |
|
1253 | + if ( ! isset(EE_Registry::instance()->modules->$module_class)) { |
|
1254 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1255 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | return FALSE; |
1257 | 1257 | } |
1258 | - if ( empty( $route )) { |
|
1259 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1260 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1258 | + if (empty($route)) { |
|
1259 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1260 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1261 | 1261 | return FALSE; |
1262 | 1262 | } |
1263 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1264 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1265 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1263 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1264 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1265 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1266 | 1266 | return FALSE; |
1267 | 1267 | } |
1268 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1268 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1269 | 1269 | return TRUE; |
1270 | 1270 | } |
1271 | 1271 | |
@@ -1279,11 +1279,11 @@ discard block |
||
1279 | 1279 | * @param string $key - url param key indicating a route is being called |
1280 | 1280 | * @return string |
1281 | 1281 | */ |
1282 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1283 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1284 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1285 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1286 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1282 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1283 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1284 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1285 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1286 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1287 | 1287 | } |
1288 | 1288 | return NULL; |
1289 | 1289 | } |
@@ -1312,35 +1312,35 @@ discard block |
||
1312 | 1312 | * @param string $key - url param key indicating a route is being called |
1313 | 1313 | * @return bool |
1314 | 1314 | */ |
1315 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1316 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1317 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1318 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1319 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1315 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1316 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1317 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1318 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1319 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1320 | 1320 | return FALSE; |
1321 | 1321 | } |
1322 | - if ( empty( $forward )) { |
|
1323 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1324 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1322 | + if (empty($forward)) { |
|
1323 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1324 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1325 | 1325 | return FALSE; |
1326 | 1326 | } |
1327 | - if ( is_array( $forward )) { |
|
1328 | - if ( ! isset( $forward[1] )) { |
|
1329 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1330 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + if (is_array($forward)) { |
|
1328 | + if ( ! isset($forward[1])) { |
|
1329 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1330 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } |
1333 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1334 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1335 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1333 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1334 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1335 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1336 | 1336 | return FALSE; |
1337 | 1337 | } |
1338 | - } else if ( ! function_exists( $forward )) { |
|
1339 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1340 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1338 | + } else if ( ! function_exists($forward)) { |
|
1339 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1340 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1341 | 1341 | return FALSE; |
1342 | 1342 | } |
1343 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1343 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1344 | 1344 | return TRUE; |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1355,10 +1355,10 @@ discard block |
||
1355 | 1355 | * @param string $key - url param key indicating a route is being called |
1356 | 1356 | * @return string |
1357 | 1357 | */ |
1358 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1359 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1360 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1361 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1358 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1359 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1360 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1361 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1362 | 1362 | } |
1363 | 1363 | return NULL; |
1364 | 1364 | } |
@@ -1375,19 +1375,19 @@ discard block |
||
1375 | 1375 | * @param string $key - url param key indicating a route is being called |
1376 | 1376 | * @return bool |
1377 | 1377 | */ |
1378 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1379 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1380 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1381 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1382 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1378 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1379 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1380 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1381 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1382 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1383 | 1383 | return FALSE; |
1384 | 1384 | } |
1385 | - if ( ! is_readable( $view )) { |
|
1386 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1387 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1385 | + if ( ! is_readable($view)) { |
|
1386 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1387 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1388 | 1388 | return FALSE; |
1389 | 1389 | } |
1390 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1390 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1391 | 1391 | return TRUE; |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1404,10 +1404,10 @@ discard block |
||
1404 | 1404 | * @param string $key - url param key indicating a route is being called |
1405 | 1405 | * @return string |
1406 | 1406 | */ |
1407 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1408 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1409 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1410 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1407 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1408 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1409 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1410 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1411 | 1411 | } |
1412 | 1412 | return NULL; |
1413 | 1413 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | |
1417 | 1417 | public function shutdown() { |
1418 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1418 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1432 | 1432 | * basically, they should just be well-defined stdClasses |
1433 | 1433 | */ |
1434 | -class EE_Config_Base{ |
|
1434 | +class EE_Config_Base { |
|
1435 | 1435 | |
1436 | 1436 | /** |
1437 | 1437 | * Utility function for escaping the value of a property and returning. |
@@ -1440,13 +1440,13 @@ discard block |
||
1440 | 1440 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1441 | 1441 | * @throws \EE_Error |
1442 | 1442 | */ |
1443 | - public function get_pretty( $property ) { |
|
1444 | - if ( ! property_exists( $this, $property ) ) { |
|
1445 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1443 | + public function get_pretty($property) { |
|
1444 | + if ( ! property_exists($this, $property)) { |
|
1445 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1446 | 1446 | } |
1447 | 1447 | //just handling escaping of strings for now. |
1448 | - if ( is_string( $this->$property ) ) { |
|
1449 | - return stripslashes( $this->$property ); |
|
1448 | + if (is_string($this->$property)) { |
|
1449 | + return stripslashes($this->$property); |
|
1450 | 1450 | } |
1451 | 1451 | return $this->$property; |
1452 | 1452 | } |
@@ -1455,19 +1455,19 @@ discard block |
||
1455 | 1455 | |
1456 | 1456 | public function populate() { |
1457 | 1457 | //grab defaults via a new instance of this class. |
1458 | - $class_name = get_class( $this ); |
|
1458 | + $class_name = get_class($this); |
|
1459 | 1459 | $defaults = new $class_name; |
1460 | 1460 | |
1461 | 1461 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1462 | 1462 | //default from our $defaults object. |
1463 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1464 | - if ( is_null( $this->$property ) ) { |
|
1463 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1464 | + if (is_null($this->$property)) { |
|
1465 | 1465 | $this->$property = $value; |
1466 | 1466 | } |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | //cleanup |
1470 | - unset( $defaults ); |
|
1470 | + unset($defaults); |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | |
@@ -1559,12 +1559,12 @@ discard block |
||
1559 | 1559 | */ |
1560 | 1560 | public function __construct() { |
1561 | 1561 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1562 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1562 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1563 | 1563 | // set default organization settings |
1564 | 1564 | $this->current_blog_id = get_current_blog_id(); |
1565 | 1565 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1566 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1567 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1566 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1567 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1568 | 1568 | $this->post_shortcodes = array(); |
1569 | 1569 | $this->module_route_map = array(); |
1570 | 1570 | $this->module_forward_map = array(); |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1584 | 1584 | |
1585 | 1585 | //ueip constant check |
1586 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1586 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1587 | 1587 | $this->ee_ueip_optin = FALSE; |
1588 | 1588 | $this->ee_ueip_has_notified = TRUE; |
1589 | 1589 | } |
@@ -1623,8 +1623,8 @@ discard block |
||
1623 | 1623 | * @return string |
1624 | 1624 | */ |
1625 | 1625 | public function reg_page_url() { |
1626 | - if ( ! $this->reg_page_url ) { |
|
1627 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1626 | + if ( ! $this->reg_page_url) { |
|
1627 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1628 | 1628 | } |
1629 | 1629 | return $this->reg_page_url; |
1630 | 1630 | } |
@@ -1637,12 +1637,12 @@ discard block |
||
1637 | 1637 | * @return string |
1638 | 1638 | */ |
1639 | 1639 | public function txn_page_url($query_args = array()) { |
1640 | - if ( ! $this->txn_page_url ) { |
|
1641 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1640 | + if ( ! $this->txn_page_url) { |
|
1641 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1642 | 1642 | } |
1643 | - if($query_args){ |
|
1644 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1645 | - }else{ |
|
1643 | + if ($query_args) { |
|
1644 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1645 | + } else { |
|
1646 | 1646 | return $this->txn_page_url; |
1647 | 1647 | } |
1648 | 1648 | } |
@@ -1654,12 +1654,12 @@ discard block |
||
1654 | 1654 | * @return string |
1655 | 1655 | */ |
1656 | 1656 | public function thank_you_page_url($query_args = array()) { |
1657 | - if ( ! $this->thank_you_page_url ) { |
|
1658 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1657 | + if ( ! $this->thank_you_page_url) { |
|
1658 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1659 | 1659 | } |
1660 | - if($query_args){ |
|
1661 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1662 | - }else{ |
|
1660 | + if ($query_args) { |
|
1661 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1662 | + } else { |
|
1663 | 1663 | return $this->thank_you_page_url; |
1664 | 1664 | } |
1665 | 1665 | } |
@@ -1670,8 +1670,8 @@ discard block |
||
1670 | 1670 | * @return string |
1671 | 1671 | */ |
1672 | 1672 | public function cancel_page_url() { |
1673 | - if ( ! $this->cancel_page_url ) { |
|
1674 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1673 | + if ( ! $this->cancel_page_url) { |
|
1674 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1675 | 1675 | } |
1676 | 1676 | return $this->cancel_page_url; |
1677 | 1677 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | //reset all url properties |
1700 | 1700 | $this->_reset_urls(); |
1701 | 1701 | //return what to save to db |
1702 | - return array_keys( get_object_vars( $this ) ); |
|
1702 | + return array_keys(get_object_vars($this)); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | } |
@@ -1931,39 +1931,39 @@ discard block |
||
1931 | 1931 | * @param null $CNT_ISO |
1932 | 1932 | * @return \EE_Currency_Config |
1933 | 1933 | */ |
1934 | - public function __construct( $CNT_ISO = NULL ) { |
|
1934 | + public function __construct($CNT_ISO = NULL) { |
|
1935 | 1935 | |
1936 | 1936 | // get country code from organization settings or use default |
1937 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1937 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1938 | 1938 | // but override if requested |
1939 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1940 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
1939 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1940 | + EE_Registry::instance()->load_helper('Activation'); |
|
1941 | 1941 | // 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 |
1942 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1942 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1943 | 1943 | // retrieve the country settings from the db, just in case they have been customized |
1944 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1945 | - if ( $country instanceof EE_Country ) { |
|
1946 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | - $this->name = $country->currency_name_single(); // Dollar |
|
1948 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1944 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1945 | + if ($country instanceof EE_Country) { |
|
1946 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1947 | + $this->name = $country->currency_name_single(); // Dollar |
|
1948 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1949 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1950 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1951 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1952 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1953 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1954 | 1954 | } |
1955 | 1955 | } |
1956 | 1956 | // fallback to hardcoded defaults, in case the above failed |
1957 | - if ( empty( $this->code )) { |
|
1957 | + if (empty($this->code)) { |
|
1958 | 1958 | // set default currency settings |
1959 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1961 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1962 | - $this->sign = '$'; // currency sign: $ |
|
1963 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1959 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1960 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1961 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1962 | + $this->sign = '$'; // currency sign: $ |
|
1963 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1964 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1965 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1966 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1967 | 1967 | } |
1968 | 1968 | } |
1969 | 1969 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | * @since 4.8.8.rc.019 |
2104 | 2104 | */ |
2105 | 2105 | public function do_hooks() { |
2106 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2106 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | |
@@ -2111,7 +2111,7 @@ discard block |
||
2111 | 2111 | * @return void |
2112 | 2112 | */ |
2113 | 2113 | public function set_default_reg_status_on_EEM_Event() { |
2114 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2114 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2115 | 2115 | } |
2116 | 2116 | |
2117 | 2117 | |
@@ -2216,10 +2216,10 @@ discard block |
||
2216 | 2216 | * @param bool $reset |
2217 | 2217 | * @return string |
2218 | 2218 | */ |
2219 | - public function log_file_name( $reset = FALSE ) { |
|
2220 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2221 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2222 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2219 | + public function log_file_name($reset = FALSE) { |
|
2220 | + if (empty($this->log_file_name) || $reset) { |
|
2221 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2222 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2223 | 2223 | } |
2224 | 2224 | return $this->log_file_name; |
2225 | 2225 | } |
@@ -2231,10 +2231,10 @@ discard block |
||
2231 | 2231 | * @param bool $reset |
2232 | 2232 | * @return string |
2233 | 2233 | */ |
2234 | - public function debug_file_name( $reset = FALSE ) { |
|
2235 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2236 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2237 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2234 | + public function debug_file_name($reset = FALSE) { |
|
2235 | + if (empty($this->debug_file_name) || $reset) { |
|
2236 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2237 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2238 | 2238 | } |
2239 | 2239 | return $this->debug_file_name; |
2240 | 2240 | } |
@@ -2407,21 +2407,21 @@ discard block |
||
2407 | 2407 | // set default map settings |
2408 | 2408 | $this->use_google_maps = TRUE; |
2409 | 2409 | // for event details pages (reg page) |
2410 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2410 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2411 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2412 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2413 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2414 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2415 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2416 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2417 | 2417 | // for event list pages |
2418 | - $this->event_list_map_width = 300; // ee_map_width |
|
2419 | - $this->event_list_map_height = 185; // ee_map_height |
|
2420 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2418 | + $this->event_list_map_width = 300; // ee_map_width |
|
2419 | + $this->event_list_map_height = 185; // ee_map_height |
|
2420 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2421 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2422 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2423 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2424 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | } |
@@ -2432,7 +2432,7 @@ discard block |
||
2432 | 2432 | /** |
2433 | 2433 | * stores Events_Archive settings |
2434 | 2434 | */ |
2435 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2435 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2436 | 2436 | |
2437 | 2437 | public $display_status_banner; |
2438 | 2438 | public $display_description; |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | /** |
2452 | 2452 | * class constructor |
2453 | 2453 | */ |
2454 | - public function __construct(){ |
|
2454 | + public function __construct() { |
|
2455 | 2455 | $this->display_status_banner = 0; |
2456 | 2456 | $this->display_description = 1; |
2457 | 2457 | $this->display_ticket_selector = 0; |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | /** |
2472 | 2472 | * Stores Event_Single_Config settings |
2473 | 2473 | */ |
2474 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2474 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2475 | 2475 | |
2476 | 2476 | public $display_status_banner_single; |
2477 | 2477 | public $display_venue; |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | /** |
2501 | 2501 | * Stores Ticket_Selector_Config settings |
2502 | 2502 | */ |
2503 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2503 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2504 | 2504 | public $show_ticket_sale_columns; |
2505 | 2505 | public $show_ticket_details; |
2506 | 2506 | public $show_expired_tickets; |
@@ -2554,7 +2554,7 @@ discard block |
||
2554 | 2554 | * @return void |
2555 | 2555 | */ |
2556 | 2556 | protected function _set_php_values() { |
2557 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2557 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2558 | 2558 | $this->php->version = phpversion(); |
2559 | 2559 | } |
2560 | 2560 | |
@@ -2573,8 +2573,8 @@ discard block |
||
2573 | 2573 | * @type string $msg Any message to be displayed. |
2574 | 2574 | * } |
2575 | 2575 | */ |
2576 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2577 | - if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2576 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2577 | + if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2578 | 2578 | return __('The number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso'); |
2579 | 2579 | } else { |
2580 | 2580 | return ''; |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | * stores payment gateway info |
2611 | 2611 | * @deprecated |
2612 | 2612 | */ |
2613 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2613 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2614 | 2614 | |
2615 | 2615 | /** |
2616 | 2616 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2632,9 +2632,9 @@ discard block |
||
2632 | 2632 | * class constructor |
2633 | 2633 | * @deprecated |
2634 | 2634 | */ |
2635 | - public function __construct(){ |
|
2635 | + public function __construct() { |
|
2636 | 2636 | $this->payment_settings = array(); |
2637 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2637 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Aim extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Aim extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | require_once($this->file_folder().'EEG_Aim.gateway.php'); |
38 | 38 | $this->_gateway = new EEG_AIM(); |
39 | 39 | $this->_pretty_name = __("Authorize.net AIM", 'event_espresso'); |
40 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
40 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
41 | 41 | $this->_requires_https = true; |
42 | 42 | parent::__construct($pm_instance); |
43 | 43 | } |
@@ -47,60 +47,60 @@ discard block |
||
47 | 47 | * @param \EE_Transaction $transaction |
48 | 48 | * @return EE_Billing_Info_Form |
49 | 49 | */ |
50 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | - $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array( |
|
50 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
51 | + $billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array( |
|
52 | 52 | 'name'=>'AIM_Form', |
53 | 53 | 'subsections'=>array( |
54 | 54 | 'credit_card'=>new EE_Credit_Card_Input(array( |
55 | 55 | 'required'=>true, |
56 | - 'html_label_text' => __( 'Card Number', 'event_espresso' ) |
|
56 | + 'html_label_text' => __('Card Number', 'event_espresso') |
|
57 | 57 | )), |
58 | 58 | 'exp_month'=>new EE_Credit_Card_Month_Input(true, array( |
59 | 59 | 'required'=>true, |
60 | - 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) |
|
60 | + 'html_label_text' => __('Expiry Month', 'event_espresso') |
|
61 | 61 | )), |
62 | - 'exp_year'=>new EE_Credit_Card_Year_Input( array( |
|
62 | + 'exp_year'=>new EE_Credit_Card_Year_Input(array( |
|
63 | 63 | 'required'=>true, |
64 | - 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) |
|
64 | + 'html_label_text' => __('Expiry Year', 'event_espresso') |
|
65 | 65 | )), |
66 | - 'cvv'=>new EE_CVV_Input( array( |
|
66 | + 'cvv'=>new EE_CVV_Input(array( |
|
67 | 67 | 'required'=>true, |
68 | - 'html_label_text' => __( 'CVV', 'event_espresso' ) ) ), |
|
68 | + 'html_label_text' => __('CVV', 'event_espresso') )), |
|
69 | 69 | ) |
70 | 70 | )); |
71 | - $billing_form->add_subsections( array( |
|
72 | - 'company' => new EE_Text_Input( array( |
|
71 | + $billing_form->add_subsections(array( |
|
72 | + 'company' => new EE_Text_Input(array( |
|
73 | 73 | 'html_label_text' => __('Company', 'event_espresso') |
74 | 74 | )) |
75 | - ), 'email', false ); |
|
75 | + ), 'email', false); |
|
76 | 76 | $billing_form->add_subsections( |
77 | 77 | array( |
78 | - 'fax' => new EE_Text_Input( array( |
|
78 | + 'fax' => new EE_Text_Input(array( |
|
79 | 79 | 'html_label_text' => __('Fax', 'event_espresso') |
80 | 80 | )) |
81 | 81 | ), |
82 | 82 | 'phone', |
83 | 83 | false ); |
84 | 84 | $settings_form = $this->settings_form(); |
85 | - if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
86 | - $billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() ); |
|
85 | + if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
86 | + $billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value()); |
|
87 | 87 | } |
88 | - if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) { |
|
88 | + if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) { |
|
89 | 89 | $required_inputs = array_merge( |
90 | 90 | array( |
91 | 91 | 'credit_card', |
92 | 92 | 'exp_month', |
93 | 93 | 'exp_year' ), |
94 | - $settings_form->get_input( 'required_billing_inputs' )->normalized_value() ); |
|
95 | - foreach( $billing_form->inputs() as $input_name => $input ) { |
|
96 | - if( in_array( $input_name, $required_inputs ) ) { |
|
97 | - $input->set_required( true ); |
|
94 | + $settings_form->get_input('required_billing_inputs')->normalized_value() ); |
|
95 | + foreach ($billing_form->inputs() as $input_name => $input) { |
|
96 | + if (in_array($input_name, $required_inputs)) { |
|
97 | + $input->set_required(true); |
|
98 | 98 | } else { |
99 | - $input->set_required( false ); |
|
99 | + $input->set_required(false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
103 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,19 +112,19 @@ discard block |
||
112 | 112 | * @param \EE_Billing_Info_Form $billing_form |
113 | 113 | * @return \EE_Billing_Info_Form |
114 | 114 | */ |
115 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
116 | - if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) { |
|
117 | - $billing_form->get_input( 'credit_card' )->set_default( '4007000000027' ); |
|
118 | - $billing_form->get_input( 'exp_year' )->set_default( '2020' ); |
|
119 | - if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) { |
|
120 | - $billing_form->get_input( 'cvv' )->set_default(( '123' )); |
|
115 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
116 | + if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) { |
|
117 | + $billing_form->get_input('credit_card')->set_default('4007000000027'); |
|
118 | + $billing_form->get_input('exp_year')->set_default('2020'); |
|
119 | + if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) { |
|
120 | + $billing_form->get_input('cvv')->set_default(('123')); |
|
121 | 121 | } |
122 | 122 | $billing_form->add_subsections( |
123 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
123 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
124 | 124 | 'credit_card' |
125 | 125 | ); |
126 | 126 | $billing_form->add_subsections( |
127 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )), |
|
127 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')), |
|
128 | 128 | 'first_name' |
129 | 129 | ); |
130 | 130 | } |
@@ -144,17 +144,17 @@ discard block |
||
144 | 144 | 'extra_meta_inputs'=>array( |
145 | 145 | 'login_id'=>new EE_Text_Input( |
146 | 146 | array( |
147 | - 'html_label_text'=> sprintf( __("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link() ), |
|
147 | + 'html_label_text'=> sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()), |
|
148 | 148 | 'required' => true ) |
149 | 149 | ), |
150 | 150 | 'transaction_key'=>new EE_Text_Input( |
151 | 151 | array( |
152 | - 'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ), |
|
152 | + 'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()), |
|
153 | 153 | 'required' => true ) |
154 | 154 | ), |
155 | 155 | 'test_transactions'=>new EE_Yes_No_Input( |
156 | 156 | array( |
157 | - 'html_label_text'=> sprintf( __("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
157 | + 'html_label_text'=> sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()), |
|
158 | 158 | 'html_help_text'=> __("Send test transactions, even to live server", 'event_espresso'), |
159 | 159 | 'default' => false, |
160 | 160 | 'required' => true |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( |
164 | 164 | $billing_input_names, |
165 | 165 | array( |
166 | - 'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
166 | + 'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
167 | 167 | 'default' => array( |
168 | 168 | 'company', |
169 | 169 | 'fax', |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | 'required_billing_inputs' => new EE_Checkbox_Multi_Input( |
173 | 173 | $billing_input_names, |
174 | 174 | array( |
175 | - 'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link() ), |
|
175 | + 'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()), |
|
176 | 176 | 'default' => array_diff( |
177 | - array_keys( $billing_input_names ), |
|
178 | - array( 'address2', 'phone', 'company', 'fax' ) |
|
177 | + array_keys($billing_input_names), |
|
178 | + array('address2', 'phone', 'company', 'fax') |
|
179 | 179 | ), |
180 | 180 | 'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso') |
181 | 181 | )), |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function billing_input_names() { |
193 | 193 | return array( |
194 | - 'first_name' => __( 'First Name', 'event_espresso' ), |
|
194 | + 'first_name' => __('First Name', 'event_espresso'), |
|
195 | 195 | 'last_name' => __('Last Name', 'event_espresso'), |
196 | - 'email' => __( 'Email', 'event_espresso' ), |
|
197 | - 'company' => __( 'Company', 'event_espresso' ), |
|
196 | + 'email' => __('Email', 'event_espresso'), |
|
197 | + 'company' => __('Company', 'event_espresso'), |
|
198 | 198 | 'address' => __('Address', 'event_espresso'), |
199 | 199 | 'address2' => __('Address2', 'event_espresso'), |
200 | 200 | 'city' => __('City', 'event_espresso'), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'country' => __('Country', 'event_espresso'), |
203 | 203 | 'zip' => __('Zip', 'event_espresso'), |
204 | 204 | 'phone' => __('Phone', 'event_espresso'), |
205 | - 'fax' => __( 'Fax', 'event_espresso' ), |
|
205 | + 'fax' => __('Fax', 'event_espresso'), |
|
206 | 206 | 'cvv' => __('CVV', 'event_espresso') |
207 | 207 | ); |
208 | 208 | } |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | * @param type $billing_form |
214 | 214 | * @return array |
215 | 215 | */ |
216 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
216 | + protected function _get_billing_values_from_form($billing_form) { |
|
217 | 217 | $all_billing_values_empty = array(); |
218 | - foreach( array_keys( $this->billing_input_names() ) as $input_name ) { |
|
219 | - $all_billing_values_empty[ $input_name ] = ''; |
|
218 | + foreach (array_keys($this->billing_input_names()) as $input_name) { |
|
219 | + $all_billing_values_empty[$input_name] = ''; |
|
220 | 220 | } |
221 | 221 | return array_merge( |
222 | 222 | $all_billing_values_empty, |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see EE_PMT_Base::help_tabs_config() |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function help_tabs_config(){ |
|
234 | + public function help_tabs_config() { |
|
235 | 235 | return array( |
236 | 236 | $this->get_help_tab_name() => array( |
237 | 237 | 'title' => __('Authorize.net AIM Settings', 'event_espresso'), |
@@ -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; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | *@return EE_Payment_Processor |
43 | 43 | */ |
44 | 44 | private function __construct() { |
45 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
45 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -64,42 +64,42 @@ discard block |
||
64 | 64 | * @param string $cancel_url URL to return to if off-site payments are cancelled |
65 | 65 | * @return EE_Payment |
66 | 66 | */ |
67 | - public function process_payment( EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '' ) { |
|
68 | - if( $amount < 0 ) { |
|
67 | + public function process_payment(EE_Payment_Method $payment_method, EE_Transaction $transaction, $amount = NULL, $billing_form = NULL, $return_url = NULL, $method = 'CART', $by_admin = FALSE, $update_txn = TRUE, $cancel_url = '') { |
|
68 | + if ($amount < 0) { |
|
69 | 69 | throw new EE_Error( |
70 | 70 | sprintf( |
71 | - __( 'Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso' ), |
|
71 | + __('Attempting to make a payment for a negative amount of %1$d for transaction %2$d. That should be a refund', 'event_espresso'), |
|
72 | 72 | $amount, |
73 | 73 | $transaction->ID() ) ); |
74 | 74 | } |
75 | 75 | // verify payment method |
76 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
76 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
77 | 77 | // verify transaction |
78 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
79 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
78 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
79 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
80 | 80 | // verify payment method type |
81 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
81 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
82 | 82 | $payment = $payment_method->type_obj()->process_payment( |
83 | 83 | $transaction, |
84 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
84 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
85 | 85 | $billing_form, |
86 | 86 | $return_url, |
87 | - add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
87 | + add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
88 | 88 | $method, |
89 | 89 | $by_admin |
90 | 90 | ); |
91 | 91 | // check if payment method uses an off-site gateway |
92 | - if ( $payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite ) { |
|
92 | + if ($payment_method->type_obj()->payment_occurs() != EE_PMT_Base::offsite) { |
|
93 | 93 | // don't process payments for off-site gateways yet because no payment has occurred yet |
94 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
94 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
95 | 95 | } |
96 | 96 | return $payment; |
97 | 97 | } else { |
98 | 98 | EE_Error::add_error( |
99 | 99 | sprintf( |
100 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
100 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
101 | 101 | '<br/>', |
102 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
102 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
103 | 103 | ), __FILE__, __FUNCTION__, __LINE__ |
104 | 104 | ); |
105 | 105 | return NULL; |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | * @throws EE_Error |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
118 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
119 | 119 | /** @type EE_Transaction $transaction */ |
120 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
120 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
121 | 121 | $primary_reg = $transaction->primary_registration(); |
122 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
123 | - throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"),$transaction->ID())); |
|
122 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
123 | + throw new EE_Error(sprintf(__("Cannot get IPN URL for transaction with ID %d because it has no primary registration", "event_espresso"), $transaction->ID())); |
|
124 | 124 | } |
125 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
125 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
126 | 126 | $url = add_query_arg( |
127 | 127 | array( |
128 | 128 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -149,81 +149,81 @@ discard block |
||
149 | 149 | * @throws Exception |
150 | 150 | * @return EE_Payment |
151 | 151 | */ |
152 | - public function process_ipn( $_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true ){ |
|
153 | - $_req_data = $this->_remove_unusable_characters( $_req_data ); |
|
154 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
155 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
156 | - if( $transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method ){ |
|
157 | - $obj_for_log = EEM_Payment::instance()->get_one( array( array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), 'order_by' => array( 'PAY_timestamp' => 'desc' ) ) ); |
|
158 | - }elseif( $payment_method instanceof EE_Payment ){ |
|
152 | + public function process_ipn($_req_data, $transaction = NULL, $payment_method = NULL, $update_txn = true, $separate_IPN_request = true) { |
|
153 | + $_req_data = $this->_remove_unusable_characters($_req_data); |
|
154 | + EE_Registry::instance()->load_model('Change_Log'); |
|
155 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
156 | + if ($transaction instanceof EE_Transaction && $payment_method instanceof EE_Payment_Method) { |
|
157 | + $obj_for_log = EEM_Payment::instance()->get_one(array(array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), 'order_by' => array('PAY_timestamp' => 'desc'))); |
|
158 | + }elseif ($payment_method instanceof EE_Payment) { |
|
159 | 159 | $obj_for_log = $payment_method; |
160 | - }elseif( $transaction instanceof EE_Transaction ){ |
|
160 | + }elseif ($transaction instanceof EE_Transaction) { |
|
161 | 161 | $obj_for_log = $transaction; |
162 | - }else{ |
|
162 | + } else { |
|
163 | 163 | $obj_for_log = null; |
164 | 164 | } |
165 | 165 | $log = EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data received'=>$_req_data), $obj_for_log); |
166 | - try{ |
|
166 | + try { |
|
167 | 167 | /** |
168 | 168 | * @var EE_Payment $payment |
169 | 169 | */ |
170 | 170 | $payment = NULL; |
171 | - if($transaction && $payment_method){ |
|
171 | + if ($transaction && $payment_method) { |
|
172 | 172 | /** @type EE_Transaction $transaction */ |
173 | 173 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
174 | 174 | /** @type EE_Payment_Method $payment_method */ |
175 | 175 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
176 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
177 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
176 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
177 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
178 | 178 | $log->set_object($payment); |
179 | 179 | } else { |
180 | 180 | // not a payment |
181 | 181 | EE_Error::add_error( |
182 | 182 | sprintf( |
183 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
183 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
184 | 184 | '<br/>', |
185 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
185 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
186 | 186 | ), |
187 | 187 | __FILE__, __FUNCTION__, __LINE__ |
188 | 188 | ); |
189 | 189 | } |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | //that's actually pretty ok. The IPN just wasn't able |
192 | 192 | //to identify which transaction or payment method this was for |
193 | 193 | // give all active payment methods a chance to claim it |
194 | 194 | $active_pms = EEM_Payment_Method::instance()->get_all_active(); |
195 | - foreach( $active_pms as $payment_method ){ |
|
196 | - try{ |
|
197 | - $payment = $payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
195 | + foreach ($active_pms as $payment_method) { |
|
196 | + try { |
|
197 | + $payment = $payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
198 | 198 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment); |
199 | 199 | break; |
200 | - } catch( EE_Error $e ) { |
|
200 | + } catch (EE_Error $e) { |
|
201 | 201 | //that's fine- it apparently couldn't handle the IPN |
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | } |
206 | 206 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
207 | - if( $payment instanceof EE_Payment){ |
|
207 | + if ($payment instanceof EE_Payment) { |
|
208 | 208 | $payment->save(); |
209 | 209 | // update the TXN |
210 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
211 | - }else{ |
|
210 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
211 | + } else { |
|
212 | 212 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
213 | - if($payment_method){ |
|
213 | + if ($payment_method) { |
|
214 | 214 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
215 | - }elseif($transaction){ |
|
215 | + }elseif ($transaction) { |
|
216 | 216 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
217 | 217 | } |
218 | 218 | } |
219 | 219 | return $payment; |
220 | 220 | |
221 | - } catch( EE_Error $e ) { |
|
221 | + } catch (EE_Error $e) { |
|
222 | 222 | do_action( |
223 | 223 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
224 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
225 | - print_r( $transaction, TRUE ), |
|
226 | - print_r( $_req_data, TRUE ), |
|
224 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
225 | + print_r($transaction, TRUE), |
|
226 | + print_r($_req_data, TRUE), |
|
227 | 227 | $e->getMessage() |
228 | 228 | ) |
229 | 229 | ); |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | * @param array $request_data |
238 | 238 | * @return array|string |
239 | 239 | */ |
240 | - protected function _remove_unusable_characters( $request_data ) { |
|
241 | - if( is_array( $request_data ) ) { |
|
240 | + protected function _remove_unusable_characters($request_data) { |
|
241 | + if (is_array($request_data)) { |
|
242 | 242 | $return_data = array(); |
243 | - foreach( $request_data as $key => $value ) { |
|
244 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
243 | + foreach ($request_data as $key => $value) { |
|
244 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
245 | 245 | } |
246 | - }else{ |
|
247 | - $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
246 | + } else { |
|
247 | + $return_data = preg_replace('/[^[:print:]]/', '', $request_data); |
|
248 | 248 | } |
249 | 249 | return $return_data; |
250 | 250 | } |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | * @return EE_Payment |
267 | 267 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, to call handle_ipn() for offsite gateways that don't receive separate IPNs |
268 | 268 | */ |
269 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
269 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
270 | 270 | /** @var $transaction EE_Transaction */ |
271 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
271 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
272 | 272 | $last_payment_method = $transaction->payment_method(); |
273 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
274 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
275 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
273 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
274 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
275 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
276 | 276 | return $payment; |
277 | 277 | } else { |
278 | 278 | return NULL; |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * @internal param float $amount |
290 | 290 | * @return EE_Payment |
291 | 291 | */ |
292 | - public function process_refund( EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array() ){ |
|
293 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
294 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
295 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
292 | + public function process_refund(EE_Payment_Method $payment_method, EE_Payment $payment_to_refund, $refund_info = array()) { |
|
293 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
294 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
295 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
296 | 296 | } |
297 | 297 | return $payment_to_refund; |
298 | 298 | } |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * TXN is locked before updating |
335 | 335 | * @throws \EE_Error |
336 | 336 | */ |
337 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
337 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
338 | 338 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
339 | 339 | /** @type EE_Transaction $transaction */ |
340 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
340 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
341 | 341 | // can we freely update the TXN at this moment? |
342 | - if ( $IPN && $transaction->is_locked() ) { |
|
342 | + if ($IPN && $transaction->is_locked()) { |
|
343 | 343 | // don't update the transaction at this exact moment |
344 | 344 | // because the TXN is active in another request |
345 | 345 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -349,40 +349,40 @@ discard block |
||
349 | 349 | ); |
350 | 350 | } else { |
351 | 351 | // verify payment and that it has been saved |
352 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
353 | - if( $payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base ){ |
|
354 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
352 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
353 | + if ($payment->payment_method() instanceof EE_Payment_Method && $payment->payment_method()->type_obj() instanceof EE_PMT_Base) { |
|
354 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
355 | 355 | // update TXN registrations with payment info |
356 | - $this->process_registration_payments( $transaction, $payment ); |
|
356 | + $this->process_registration_payments($transaction, $payment); |
|
357 | 357 | } |
358 | 358 | $do_action = $payment->just_approved() ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' : $do_action; |
359 | 359 | } else { |
360 | 360 | // send out notifications |
361 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
361 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
362 | 362 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
363 | 363 | } |
364 | 364 | // if this is an IPN, then we want to know the initial TXN status prior to updating the TXN |
365 | 365 | // so that we know whether the status has changed and notifications should be triggered |
366 | - if ( $IPN ) { |
|
366 | + if ($IPN) { |
|
367 | 367 | /** @type EE_Transaction_Processor $transaction_processor */ |
368 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
369 | - $transaction_processor->set_old_txn_status( $transaction->status_ID() ); |
|
368 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
369 | + $transaction_processor->set_old_txn_status($transaction->status_ID()); |
|
370 | 370 | } |
371 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
371 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
372 | 372 | /** @type EE_Transaction_Payments $transaction_payments */ |
373 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
373 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
374 | 374 | // set new value for total paid |
375 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
375 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
376 | 376 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
377 | - if ( $update_txn ) { |
|
378 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
377 | + if ($update_txn) { |
|
378 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | // granular hook for others to use. |
382 | - do_action( $do_action, $transaction, $payment ); |
|
383 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
382 | + do_action($do_action, $transaction, $payment); |
|
383 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
384 | 384 | //global hook for others to use. |
385 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
385 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
@@ -396,25 +396,25 @@ discard block |
||
396 | 396 | * @param EE_Registration[] $registrations |
397 | 397 | * @throws \EE_Error |
398 | 398 | */ |
399 | - public function process_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $registrations = array() ) { |
|
399 | + public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array()) { |
|
400 | 400 | // only process if payment was successful |
401 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
401 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
402 | 402 | return; |
403 | 403 | } |
404 | 404 | //EEM_Registration::instance()->show_next_x_db_queries(); |
405 | - if ( empty( $registrations )) { |
|
405 | + if (empty($registrations)) { |
|
406 | 406 | // find registrations with monies owing that can receive a payment |
407 | - $registrations = $transaction->registrations( array( |
|
407 | + $registrations = $transaction->registrations(array( |
|
408 | 408 | array( |
409 | 409 | // only these reg statuses can receive payments |
410 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
411 | - 'REG_final_price' => array( '!=', 0 ), |
|
412 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
410 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
411 | + 'REG_final_price' => array('!=', 0), |
|
412 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
413 | 413 | ) |
414 | - ) ); |
|
414 | + )); |
|
415 | 415 | } |
416 | 416 | // still nothing ??!?? |
417 | - if ( empty( $registrations )) { |
|
417 | + if (empty($registrations)) { |
|
418 | 418 | return; |
419 | 419 | } |
420 | 420 | // todo: break out the following logic into a separate strategy class |
@@ -426,28 +426,28 @@ discard block |
||
426 | 426 | |
427 | 427 | $refund = $payment->is_a_refund(); |
428 | 428 | // how much is available to apply to registrations? |
429 | - $available_payment_amount = abs( $payment->amount() ); |
|
430 | - foreach ( $registrations as $registration ) { |
|
431 | - if ( $registration instanceof EE_Registration ) { |
|
429 | + $available_payment_amount = abs($payment->amount()); |
|
430 | + foreach ($registrations as $registration) { |
|
431 | + if ($registration instanceof EE_Registration) { |
|
432 | 432 | // nothing left? |
433 | - if ( $available_payment_amount <= 0 ) { |
|
433 | + if ($available_payment_amount <= 0) { |
|
434 | 434 | break; |
435 | 435 | } |
436 | - if ( $refund ) { |
|
437 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
436 | + if ($refund) { |
|
437 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
438 | 438 | } else { |
439 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
439 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | } |
443 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
443 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
444 | 444 | EE_Error::add_attention( |
445 | 445 | sprintf( |
446 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
447 | - EEH_Template::format_currency( $available_payment_amount ), |
|
448 | - implode( ', ', array_keys( $registrations ) ), |
|
446 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
447 | + EEH_Template::format_currency($available_payment_amount), |
|
448 | + implode(', ', array_keys($registrations)), |
|
449 | 449 | '<br/>', |
450 | - EEH_Template::format_currency( $payment->amount() ) |
|
450 | + EEH_Template::format_currency($payment->amount()) |
|
451 | 451 | ), |
452 | 452 | __FILE__, __FUNCTION__, __LINE__ |
453 | 453 | ); |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | * @param float $available_payment_amount |
465 | 465 | * @return float |
466 | 466 | */ |
467 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
467 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
468 | 468 | $owing = $registration->final_price() - $registration->paid(); |
469 | - if ( $owing > 0 ) { |
|
469 | + if ($owing > 0) { |
|
470 | 470 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
471 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
471 | + $payment_amount = min($available_payment_amount, $owing); |
|
472 | 472 | // update $available_payment_amount |
473 | 473 | $available_payment_amount = $available_payment_amount - $payment_amount; |
474 | 474 | //calculate and set new REG_paid |
475 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
475 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
476 | 476 | // now save it |
477 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
477 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
478 | 478 | } |
479 | 479 | return $available_payment_amount; |
480 | 480 | } |
@@ -489,19 +489,19 @@ discard block |
||
489 | 489 | * @param float $payment_amount |
490 | 490 | * @return float |
491 | 491 | */ |
492 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
492 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
493 | 493 | // find any existing reg payment records for this registration and payment |
494 | 494 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
495 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
495 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
496 | 496 | ); |
497 | 497 | // if existing registration payment exists |
498 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
498 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
499 | 499 | // then update that record |
500 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
500 | + $existing_reg_payment->set_amount($payment_amount); |
|
501 | 501 | $existing_reg_payment->save(); |
502 | 502 | } else { |
503 | 503 | // or add new relation between registration and payment and set amount |
504 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
504 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
505 | 505 | // make it stick |
506 | 506 | $registration->save(); |
507 | 507 | } |
@@ -517,21 +517,21 @@ discard block |
||
517 | 517 | * @param float $available_refund_amount - IMPORTANT !!! SEND AVAILABLE REFUND AMOUNT AS A POSITIVE NUMBER |
518 | 518 | * @return float |
519 | 519 | */ |
520 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
520 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
521 | 521 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
522 | - if ( $registration->paid() > 0 ) { |
|
522 | + if ($registration->paid() > 0) { |
|
523 | 523 | // ensure $available_refund_amount is NOT negative |
524 | - $available_refund_amount = abs( $available_refund_amount ); |
|
524 | + $available_refund_amount = abs($available_refund_amount); |
|
525 | 525 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
526 | - $refund_amount = min( $available_refund_amount, $registration->paid() ); |
|
526 | + $refund_amount = min($available_refund_amount, $registration->paid()); |
|
527 | 527 | // update $available_payment_amount |
528 | 528 | $available_refund_amount = $available_refund_amount - $refund_amount; |
529 | 529 | //calculate and set new REG_paid |
530 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
530 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
531 | 531 | // convert payment amount back to a negative value for storage in the db |
532 | - $refund_amount = abs( $refund_amount ) * -1; |
|
532 | + $refund_amount = abs($refund_amount) * -1; |
|
533 | 533 | // now save it |
534 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
534 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
535 | 535 | } |
536 | 536 | return $available_refund_amount; |
537 | 537 | } |
@@ -549,12 +549,12 @@ discard block |
||
549 | 549 | * @param EE_Payment $payment |
550 | 550 | * @param bool $IPN |
551 | 551 | */ |
552 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
552 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
553 | 553 | |
554 | 554 | /** @type EE_Transaction_Processor $transaction_processor */ |
555 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
555 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
556 | 556 | // is the Payment Options Reg Step completed ? |
557 | - $payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' ); |
|
557 | + $payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options'); |
|
558 | 558 | // DEBUG LOG |
559 | 559 | //$this->log( |
560 | 560 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -567,14 +567,14 @@ discard block |
||
567 | 567 | // if the Payment Options Reg Step is completed... |
568 | 568 | $revisit = $payment_options_step_completed === true ? true : false; |
569 | 569 | // then this is kinda sorta a revisit with regards to payments at least |
570 | - $transaction_processor->set_revisit( $revisit ); |
|
570 | + $transaction_processor->set_revisit($revisit); |
|
571 | 571 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
572 | 572 | if ( |
573 | 573 | $IPN && |
574 | 574 | $payment_options_step_completed !== true && |
575 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
575 | + ($payment->is_approved() || $payment->is_pending()) |
|
576 | 576 | ) { |
577 | - $payment_options_step_completed = $transaction_processor->set_reg_step_completed( $transaction, 'payment_options' ); |
|
577 | + $payment_options_step_completed = $transaction_processor->set_reg_step_completed($transaction, 'payment_options'); |
|
578 | 578 | } |
579 | 579 | // DEBUG LOG |
580 | 580 | //$this->log( |
@@ -586,11 +586,11 @@ discard block |
||
586 | 586 | // ) |
587 | 587 | //); |
588 | 588 | /** @type EE_Transaction_Payments $transaction_payments */ |
589 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
589 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
590 | 590 | // maybe update status, but don't save transaction just yet |
591 | - $transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false ); |
|
591 | + $transaction_payments->update_transaction_status_based_on_total_paid($transaction, false); |
|
592 | 592 | // check if 'finalize_registration' step has been completed... |
593 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
593 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
594 | 594 | // DEBUG LOG |
595 | 595 | //$this->log( |
596 | 596 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -601,9 +601,9 @@ discard block |
||
601 | 601 | // ) |
602 | 602 | //); |
603 | 603 | // if this is an IPN and the final step has not been initiated |
604 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
604 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
605 | 605 | // and if it hasn't already been set as being started... |
606 | - $finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' ); |
|
606 | + $finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration'); |
|
607 | 607 | // DEBUG LOG |
608 | 608 | //$this->log( |
609 | 609 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | } |
617 | 617 | $transaction->save(); |
618 | 618 | // because the above will return false if the final step was not fully completed, we need to check again... |
619 | - if ( $IPN && $finalized !== false ) { |
|
619 | + if ($IPN && $finalized !== false) { |
|
620 | 620 | // and if we are all good to go, then send out notifications |
621 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
621 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
622 | 622 | // DEBUG LOG |
623 | 623 | //$this->log( __CLASS__, __FUNCTION__, __LINE__, $transaction ); |
624 | 624 | //ok, now process the transaction according to the payment |
625 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
625 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
626 | 626 | } |
627 | 627 | // DEBUG LOG |
628 | 628 | //$this->log( |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
59 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
60 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
61 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
59 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
60 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
61 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
62 | 62 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
63 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
63 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
64 | 64 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
65 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
66 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
65 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
66 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
67 | 67 | )); |
68 | 68 | $this->_model_relations = array( |
69 | 69 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | 79 | //account for default tickets in the caps |
80 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - parent::__construct( $timezone ); |
|
80 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + parent::__construct($timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_all_default_tickets() { |
93 | 93 | /** @type EE_Ticket[] $tickets */ |
94 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) ); |
|
94 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC'))); |
|
95 | 95 | //we need to set the start date and end date to today's date and the start of the default dtt |
96 | - return $this->_set_default_dates( $tickets ); |
|
96 | + return $this->_set_default_dates($tickets); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Ticket[] $tickets |
104 | 104 | * @return EE_Ticket[] |
105 | 105 | */ |
106 | - private function _set_default_dates( $tickets ) { |
|
107 | - foreach ( $tickets as $ticket ) { |
|
108 | - $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) ); |
|
109 | - $ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
110 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
106 | + private function _set_default_dates($tickets) { |
|
107 | + foreach ($tickets as $ticket) { |
|
108 | + $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true)); |
|
109 | + $ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
110 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $tickets; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param array $query_params |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
126 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
125 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
126 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param EE_Ticket[] $tickets |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function update_tickets_sold($tickets){ |
|
137 | - foreach($tickets as $ticket){ |
|
136 | + public function update_tickets_sold($tickets) { |
|
137 | + foreach ($tickets as $ticket) { |
|
138 | 138 | /* @var $ticket EE_Ticket */ |
139 | 139 | $ticket->update_tickets_sold(); |
140 | 140 | } |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Ticket Model |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/models/EEM_Ticket.model.php |
|
20 | - * @author Darren Ethier |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Ticket Model |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/models/EEM_Ticket.model.php |
|
20 | + * @author Darren Ethier |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
25 | 25 | require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
26 | 26 |