本文整理汇总了PHP中Hook::Exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::Exec方法的具体用法?PHP Hook::Exec怎么用?PHP Hook::Exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::Exec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadCustomer
/**
* loadCustomer() method load customer in PS
*
* @param numeric $nSocialId
*/
protected function loadCustomer($nSocialId)
{
// get customer ID
$iCustomerId = self::getCustomerId($nSocialId);
// auth customer
$oCustomer = new Customer($iCustomerId);
// is valid customer
if (Validate::isLoadedObject($oCustomer)) {
if (version_compare(_PS_VERSION_, '1.5', '>')) {
Context::getContext()->cookie->id_customer = intval($oCustomer->id);
Context::getContext()->cookie->customer_lastname = $oCustomer->lastname;
Context::getContext()->cookie->customer_firstname = $oCustomer->firstname;
Context::getContext()->cookie->logged = 1;
Context::getContext()->cookie->passwd = $oCustomer->passwd;
Context::getContext()->cookie->email = $oCustomer->email;
// Context::getContext()->cookie->is_guest = !Tools::getValue('is_new_customer', 1);
Context::getContext()->customer->logged = 1;
if (Configuration::get('PS_CART_FOLLOWING') && (empty(Context::getContext()->cookie->id_cart) || Cart::getNbProducts(Context::getContext()->cookie->id_cart) == 0)) {
Context::getContext()->cookie->id_cart = intval(Cart::lastNoneOrderedCart($oCustomer->id));
}
Hook::Exec('authentication');
} else {
global $cookie;
$cookie->id_customer = intval($oCustomer->id);
$cookie->customer_lastname = $oCustomer->lastname;
$cookie->customer_firstname = $oCustomer->firstname;
$cookie->logged = 1;
$cookie->passwd = $oCustomer->passwd;
$cookie->email = $oCustomer->email;
// $cookie->is_guest = !Tools::getValue('is_new_customer', 1);
$oCustomer->logged = 1;
if (Configuration::get('PS_CART_FOLLOWING') && (empty($cookie->id_cart) || Cart::getNbProducts($cookie->id_cart) == 0)) {
$cookie->id_cart = intval(Cart::lastNoneOrderedCart($oCustomer->id));
}
Module::HookExec('authentication');
}
} else {
throw new BT_ConnectorException(FacebookPsConnect::$oModule->l('Internal server error => authentication failed', 'base-connector_class'), 531);
}
}