本文整理汇总了PHP中EE_Transaction::clear_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::clear_cache方法的具体用法?PHP EE_Transaction::clear_cache怎么用?PHP EE_Transaction::clear_cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::clear_cache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refresh_entity_map
/**
* refresh_entity_map
* simply loops through the current transaction and updates
* each model's entity map using EEM_Base::refresh_entity_map_with()
*
* @access public
* @return bool
*/
protected function refresh_entity_map()
{
// verify the transaction
if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
// never cache payment info
$this->transaction->clear_cache('Payment');
/** @type EE_Transaction_Processor $transaction_processor */
$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
// is the Payment Options Reg Step completed ?
if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) {
// then check for payments and update TXN accordingly
/** @type EE_Transaction_Payments $transaction_payments */
$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
}
// grab the saved registrations from the transaction
foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) {
$this->_refresh_registration($reg_cache_ID, $registration);
}
// make sure our cached TXN is added to the model entity mapper
$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
} else {
EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return FALSE;
}
if ($this->cart instanceof EE_Cart) {
$grand_total = $this->cart->get_grand_total();
if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
$grand_total = $grand_total->get_model()->refresh_entity_map_with($this->cart->get_grand_total()->ID(), $this->cart->get_grand_total());
}
if ($grand_total instanceof EE_Line_Item) {
$this->cart = EE_Cart::instance($grand_total);
} else {
EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return false;
}
}
return TRUE;
}
示例2: init
/**
* init - initial module setup
*
* @access public
* @return void
*/
public function init()
{
// add no cache headers
add_action('wp_head', array('EED_Single_Page_Checkout', 'nocache_headers'), 10);
// plus a little extra for nginx
add_filter('nocache_headers', array('EED_Single_Page_Checkout', 'nocache_headers_nginx'), 10, 1);
// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
// load classes
if (!isset(EE_Registry::instance()->REQ)) {
EE_Registry::instance()->load_core('Request_Handler');
}
EE_Registry::instance()->REQ->set_espresso_page(TRUE);
// printr( EE_Registry::instance()->REQ, 'EE_Registry::instance()->REQ <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
// make sure reg steps array is setup
if (empty(self::$_reg_steps)) {
EED_Single_Page_Checkout::setup_reg_steps_array();
}
$this->_continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE);
$this->set_templates();
$this->_reg_page_base_url = get_permalink(EE_Registry::instance()->CFG->core->reg_page_id);
// grab what step we're on
$this->_current_step = !empty($this->_current_step) ? $this->_current_step : 'attendee_information';
$this->_current_step = EE_Registry::instance()->REQ->is_set('step') ? EE_Registry::instance()->REQ->get('step') : $this->_current_step;
// returning from the thank you page ?
$this->_reg_url_link = EE_Registry::instance()->REQ->is_set('e_reg_url_link') ? EE_Registry::instance()->REQ->get('e_reg_url_link') : FALSE;
// if reg_url_link is present in the request, then we are only being sent back to SPCO to retry the payment
if ($this->_reg_url_link) {
// are we returning to the page to edit attendee info or retry a payment?
$this->_revisit = EE_Registry::instance()->REQ->is_set('revisit') && EE_Registry::instance()->REQ->get('revisit') == 1 ? TRUE : FALSE;
if ($this->_revisit) {
// remove all other pages from the reg steps array except the one required by the revisit
self::$_reg_steps = array_intersect_key(self::$_reg_steps, array($this->_current_step => TRUE));
}
// let's get that transaction data
$this->_transaction = EE_Registry::instance()->load_model('Transaction')->get_transaction_from_reg_url_link();
// printr( $this->_transaction, 'transaction_from_reg_url_link <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
// d( $this->_transaction );
// verify transaction
if ($this->_transaction instanceof EE_Transaction) {
// d( $this->_transaction );
// and get the cart that was used in the original txn
$this->_cart = EE_Cart::get_cart_from_txn($this->_transaction);
// if ( $this->_transaction instanceof EE_Transaction && $this->_revisit ) {
$registrations = $this->_transaction->registrations(array(), TRUE);
usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
foreach ($registrations as $registration) {
//d( $registration );
// verify registration
if ($registration instanceof EE_Registration) {
// we display all attendee info for the primary registrant
if ($this->_reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
$this->_primary_revisit = TRUE;
break;
} else {
if ($this->_reg_url_link != $registration->reg_url_link()) {
// but hide info if it doesn't belong to you
$this->_transaction->clear_cache('Registration', $registration->ID());
}
}
}
}
// }
} else {
EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
}
} else {
$this->_transaction = EE_Registry::instance()->SSN->get_session_data('transaction');
// printr( $this->_transaction, '$this->_transaction <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
$this->_cart = EE_Registry::instance()->load_core('Cart');
// printr( $this->_transaction->registrations(), '$this->_transaction->registrations() <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
}
// verify cart
if (!$this->_cart instanceof EE_Cart) {
$this->_cart = EE_Registry::instance()->load_core('Cart');
}
// verify transaction
if ($this->_transaction instanceof EE_Transaction) {
//printr( $this->_transaction->registrations(), '$transaction->registrations() <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
$ID = $this->_transaction->ID();
if (!$this->_revisit && $ID) {
// but if this transaction has already been saved to the db earlier in the same session (ie: it's not a revisit)... then let's pull that
if (!($this->_transaction = EEM_Transaction::instance()->get_one_by_ID($ID))) {
EE_Error::add_error(__('The Transaction could not be retrieved from the db when attempting to process your registration information', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return;
}
}
} elseif (!$this->_revisit) {
$this->_initialize_transaction();
} else {
}
// and verify registrations have been set (first check cached REGs)
if ($this->_transaction instanceof EE_Transaction && $this->_transaction->registrations(array(), TRUE) == NULL) {
// then check the db
//.........这里部分代码省略.........