本文整理汇总了PHP中Module::hookExec方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::hookExec方法的具体用法?PHP Module::hookExec怎么用?PHP Module::hookExec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::hookExec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayHeader
public function displayHeader()
{
global $css_files, $js_files;
if (!self::$initialized) {
$this->init();
}
// P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies)
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
/* Hooks are volontary out the initialize array (need those variables already assigned) */
self::$smarty->assign(array('time' => time(), 'static_token' => Tools::getToken(false), 'token' => Tools::getToken(), 'logo_image_width' => Configuration::get('SHOP_LOGO_WIDTH'), 'logo_image_height' => Configuration::get('SHOP_LOGO_HEIGHT'), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int) Tools::getValue('content_only')));
self::$smarty->assign(array('HOOK_HEADER' => Module::hookExec('header'), 'HOOK_TOP' => Module::hookExec('top'), 'HOOK_BELOWNAVH' => Module::hookExec('belownavh'), 'HOOK_FILTERBY_CENTER' => Module::hookExec('filterbyCenter')));
if ((Configuration::get('PS_CSS_THEME_CACHE') or Configuration::get('PS_JS_THEME_CACHE')) and is_writable(_PS_THEME_DIR_ . 'cache')) {
// CSS compressor management
if (Configuration::get('PS_CSS_THEME_CACHE')) {
Tools::cccCss();
}
//JS compressor management
if (Configuration::get('PS_JS_THEME_CACHE')) {
Tools::cccJs();
}
}
self::$smarty->assign('css_files', $css_files);
self::$smarty->assign('js_files', array_unique($js_files));
self::$smarty->display(_PS_THEME_DIR_ . 'header.tpl');
}
示例2: run
public function run()
{
$this->init();
$this->preProcess();
if (Tools::getValue('ajax') == 'true') {
if (Tools::getIsset('summary')) {
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
if (self::$cookie->id_customer) {
$customer = new Customer((int) self::$cookie->id_customer);
$groups = $customer->getGroups();
} else {
$groups = array(1);
}
if ((int) self::$cart->id_address_delivery) {
$deliveryAddress = new Address((int) self::$cart->id_address_delivery);
}
$result = array('carriers' => Carrier::getCarriersForOrder((int) Country::getIdZone((isset($deliveryAddress) and (int) $deliveryAddress->id) ? (int) $deliveryAddress->id_country : (int) Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
}
$result['summary'] = self::$cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas((int) self::$cart->id);
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
die(Tools::jsonEncode($result));
} else {
$this->includeCartModule();
}
} else {
$this->setMedia();
$this->displayHeader();
$this->process();
$this->displayContent();
$this->displayFooter();
}
}
示例3: update
public function update($nullValues = false)
{
self::$_nbProducts = 0;
$return = parent::update();
Module::hookExec('cart');
return $return;
}
示例4: displayOrderStep
function displayOrderStep($params)
{
global $smarty, $cart, $errors;
$smarty->assign('errors', $errors);
if (file_exists(_PS_SHIP_IMG_DIR_ . intval($cart->id_carrier) . '.jpg')) {
$smarty->assign('carrierPicture', 1);
}
$cart->save();
// Hack to get loyalty and other modules happy
$summary = $cart->getSummaryDetails();
$customizedDatas = Product::getAllCustomizedDatas(intval($cart->id));
Product::addCustomizationPrice($summary['products'], $customizedDatas);
if ($free_ship = intval(Configuration::get('PS_SHIPPING_FREE_PRICE'))) {
$discounts = $cart->getDiscounts();
$total_free_ship = $free_ship - ($summary['total_products_wt'] + $summary['total_discounts']);
foreach ($discounts as $discount) {
if ($discount['id_discount_type'] == 3) {
$total_free_ship = 0;
break;
}
}
$smarty->assign('free_ship', $total_free_ship);
}
$smarty->assign($summary);
$token = Tools::getToken(false);
$smarty->assign(array('token_cart' => $token, 'voucherAllowed' => Configuration::get('PS_VOUCHERS'), 'HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary), 'shippingCost' => $cart->getOrderTotalLC(true, 5), 'shippingCostTaxExc' => $cart->getOrderTotalLC(false, 5), 'customizedDatas' => $customizedDatas, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'lastProductAdded' => $cart->getLastProduct()));
Tools::safePostVars();
include_once dirname(__FILE__) . '/../../header.php';
echo $this->display(__FILE__, 'ordersummary.tpl');
}
示例5: canonicalRedirection
protected function canonicalRedirection()
{
global $link, $cookie;
if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
// Automatically redirect to the canonical URL if needed
if (isset($this->php_self) && !empty($this->php_self)) {
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
$canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $cookie->id_lang);
if (!Tools::getValue('ajax') && !preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', ($this->ssl && _PS_SSL_ENABLED_ ? 'https://' : 'http://') . urldecode($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']))) {
if ($_SERVER['REQUEST_URI'] == __PS_BASE_URI__) {
header('HTTP/1.0 303 See Other');
header('Cache-Control: no-cache');
} else {
header('HTTP/1.0 301 Moved Permanently');
header('Cache-Control: no-cache');
}
$params = '';
$excludedKey = array('isolang', 'id_lang');
foreach ($_GET as $key => $value) {
if (!in_array($key, $excludedKey)) {
$params .= ($params == '' ? '?' : '&') . $key . '=' . $value;
}
}
Module::hookExec('frontCanonicalRedirect');
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . $params . '">' . $canonicalURL . $params . '</a>');
}
Tools::redirectLink($canonicalURL . $params);
}
}
}
}
示例6: processOrderStep
function processOrderStep($params)
{
global $cart, $smarty, $errors;
if (!isset($_POST['id_address_delivery']) or !Address::isCountryActiveById(intval($_POST['id_address_delivery']))) {
$errors[] = 'this address is not in a valid area';
} else {
$cart->id_address_delivery = intval($_POST['id_address_delivery']);
$cart->id_address_invoice = isset($_POST['same']) ? intval($_POST['id_address_delivery']) : intval($_POST['id_address_invoice']);
if (!$cart->update()) {
$errors[] = Tools::displayError('an error occured while updating your cart');
}
Module::hookExec('orderAddressVerification', array());
if (isset($_POST['message']) and !empty($_POST['message'])) {
if (!Validate::isMessage($_POST['message'])) {
$errors[] = Tools::displayError('invalid message');
} elseif ($oldMessage = Message::getMessageByCartId(intval($cart->id))) {
$message = new Message(intval($oldMessage['id_message']));
$message->message = htmlentities($_POST['message'], ENT_COMPAT, 'UTF-8');
$message->update();
} else {
$message = new Message();
$message->message = htmlentities($_POST['message'], ENT_COMPAT, 'UTF-8');
$message->id_cart = intval($cart->id);
$message->id_customer = intval($cart->id_customer);
$message->add();
}
}
}
}
示例7: displayTopNews
public function displayTopNews()
{
if (!self::$initialized) {
parent::init();
}
self::$smarty->assign(array('NEWS_HOOK' => Module::hookExec('newshook')));
returnparent::displayTopNews();
}
示例8: add
public function add($autodate = true, $nullValues = false)
{
if (parent::add($autodate, $nullValues)) {
Module::hookExec('paymentCCAdded', array('paymentCC' => $this));
return true;
}
return false;
}
示例9: hookLeftColumn
public function hookLeftColumn($params)
{
global $smarty;
if (!$params['cookie']->isLogged()) {
return false;
}
$smarty->assign(array('voucherAllowed' => intval(Configuration::get('PS_VOUCHERS')), 'returnAllowed' => intval(Configuration::get('PS_ORDER_RETURN')), 'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock')));
return $this->display(__FILE__, $this->name . '.tpl');
}
示例10: process
public function process()
{
parent::process();
if ($id_order = Tools::getValue('id_order') and $email = Tools::getValue('email')) {
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order)) {
$this->errors[] = Tools::displayError('Invalid order');
} elseif (!$order->isAssociatedAtGuest($email)) {
$this->errors[] = Tools::displayError('Invalid order');
} else {
$customer = new Customer((int) $order->id_customer);
$id_order_state = (int) $order->getCurrentState();
$carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang);
$addressInvoice = new Address((int) $order->id_address_invoice);
$addressDelivery = new Address((int) $order->id_address_delivery);
$inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country);
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country);
$invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields);
$deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields);
if ($order->total_discounts > 0) {
self::$smarty->assign('total_old', (double) ($order->total_paid - $order->total_discounts));
}
$products = $order->getProducts();
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$this->processAddressFormat($addressDelivery, $addressInvoice);
self::$smarty->assign(array('shop_name' => Configuration::get('PS_SHOP_NAME'), 'order' => $order, 'return_allowed' => false, 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable((int) $id_order_state) and $order->invoice_number, 'order_history' => $order->getHistory((int) self::$cookie->id_lang, false, true), 'products' => $products, 'discounts' => $order->getDiscounts(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => (Validate::isLoadedObject($addressInvoice) and $addressInvoice->id_state) ? new State((int) $addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'deliveryState' => (Validate::isLoadedObject($addressDelivery) and $addressDelivery->id_state) ? new State((int) $addressDelivery->id_state) : false, 'is_guest' => true, 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, 'CUSTOMIZE_TEXTFIELD' => _CUSTOMIZE_TEXTFIELD_, 'use_tax' => Configuration::get('PS_TAX'), 'customizedDatas' => $customizedDatas, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues));
if ($carrier->url and $order->shipping_number) {
self::$smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url));
}
self::$smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order)));
Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order));
if (Tools::isSubmit('submitTransformGuestToCustomer')) {
$customer = new Customer((int) $order->id_customer);
if (!Validate::isLoadedObject($customer)) {
$this->errors[] = Tools::displayError('Invalid customer');
}
if (!$customer->transformToCustomer(self::$cookie->id_lang, Tools::getValue('password'))) {
$this->errors[] = Tools::displayError('An error occurred while transforming guest to customer.');
}
if (!Tools::getValue('password')) {
$this->errors[] = Tools::displayError('Invalid password');
} else {
self::$smarty->assign('transformSuccess', true);
}
}
}
if (sizeof($this->errors)) {
/* Handle brute force attacks */
sleep(1);
}
}
self::$smarty->assign(array('action' => 'guest-tracking.php', 'errors' => $this->errors));
}
示例11: process
public function process()
{
parent::process();
self::$smarty->assign('HOOK_HOME', Module::hookExec('home'));
self::$smarty->assign('HOOK_MAIN_TOP', Module::hookExec('displayMainTop'));
self::$smarty->assign('HOOK_CONTENT_SIDE1', Module::hookExec('displayContentSide1'));
//self::$smarty->assign('HOOK_CONTENT_TOP' , Module::hookExec('displayContentTop'));
//self::$smarty->assign('HOOK_CONTENT_BTM' , Module::hookExec('displayContentBtm'));
self::$smarty->assign('HOOK_CONTENT_SIDE2', Module::hookExec('displayContentSide2'));
self::$smarty->assign('HOOK_MAIN_BTM', Module::hookExec('displayMainBtm'));
}
示例12: preProcess
public function preProcess()
{
parent::preProcess();
if (Tools::isSubmit('submitReturnMerchandise')) {
$customizationQtyInput = Tools::getValue('customization_qty_input');
if (!($id_order = (int) Tools::getValue('id_order'))) {
Tools::redirect('history.php');
}
if (!($order_qte_input = Tools::getValue('order_qte_input'))) {
Tools::redirect('order-follow.php?errorDetail1');
}
if ($customizationIds = Tools::getValue('customization_ids') and !$customizationQtyInput) {
Tools::redirect('order-follow.php?errorDetail1');
}
if (!($ids_order_detail = Tools::getValue('ids_order_detail')) and !$customizationIds) {
Tools::redirect('order-follow.php?errorDetail2');
}
$order = new Order((int) $id_order);
if (!$order->isReturnable()) {
Tools::redirect('order-follow.php?errorNotReturnable');
}
if ($order->id_customer != self::$cookie->id_customer) {
die(Tools::displayError());
}
$orderReturn = new OrderReturn();
$orderReturn->id_customer = (int) self::$cookie->id_customer;
$orderReturn->id_order = $id_order;
$orderReturn->question = strval(Tools::getValue('returnText'));
if (empty($orderReturn->question)) {
Tools::redirect('order-follow.php?errorMsg');
}
if (!$orderReturn->checkEnoughProduct($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput)) {
Tools::redirect('order-follow.php?errorQuantity');
}
$orderReturn->state = 1;
$orderReturn->add();
$orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput);
Module::hookExec('orderReturn', array('orderReturn' => $orderReturn));
Tools::redirect('order-follow.php');
}
$ordersReturn = OrderReturn::getOrdersReturn((int) self::$cookie->id_customer);
if (Tools::isSubmit('errorQuantity')) {
self::$smarty->assign('errorQuantity', true);
} elseif (Tools::isSubmit('errorMsg')) {
self::$smarty->assign('errorMsg', true);
} elseif (Tools::isSubmit('errorDetail1')) {
self::$smarty->assign('errorDetail1', true);
} elseif (Tools::isSubmit('errorDetail2')) {
self::$smarty->assign('errorDetail2', true);
} elseif (Tools::isSubmit('errorNotReturnable')) {
self::$smarty->assign('errorNotReturnable', true);
}
self::$smarty->assign('ordersReturn', $ordersReturn);
}
示例13: init
public function init()
{
global $smarty;
parent::init();
if (Module::isInstalled('agilepricecomparison')) {
$HOOK_AGILE_PRICE_COMPARISON = '';
if (!intval(Configuration::get('AGILE_PC_USE_DEFAULT_HOOK'))) {
$HOOK_AGILE_PRICE_COMPARISON = Module::hookExec('agilepricecomparison', array());
}
$smarty->assign(array('HOOK_AGILE_PRICE_COMPARISON' => $HOOK_AGILE_PRICE_COMPARISON));
}
}
示例14: postProcess
public function postProcess()
{
global $currentIndex;
if (Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE')) {
$uploadMaxSize = (int) str_replace('M', '', ini_get('upload_max_filesize'));
$postMaxSize = (int) str_replace('M', '', ini_get('post_max_size'));
$maxSize = $uploadMaxSize < $postMaxSize ? $uploadMaxSize : $postMaxSize;
$_POST['PS_ATTACHMENT_MAXIMUM_SIZE'] = $maxSize < Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE') ? $maxSize : Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE');
}
if (isset($_POST['submitGeneral' . $this->table])) {
Module::hookExec('categoryUpdate');
// We call this hook, for regenerate cache of categories
if (Tools::getValue('PS_CONDITIONS') == true and (Tools::getValue('PS_CONDITIONS_CMS_ID') == 0 or !Db::getInstance()->getValue('
SELECT `id_cms` FROM `' . _DB_PREFIX_ . 'cms`
WHERE id_cms = ' . (int) Tools::getValue('PS_CONDITIONS_CMS_ID')))) {
$this->_errors[] = Tools::displayError('Assign a valid CMS page if you want it to be read.');
}
if ($this->tabAccess['edit'] === '1') {
$this->_postConfig($this->_fieldsGeneral);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (isset($_POST['submitShop' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
$this->_postConfig($this->_fieldsShop);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (isset($_POST['submitAppearance' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
$this->_postConfig($this->_fieldsAppearance);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (isset($_POST['submitThemes' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
if ($val = Tools::getValue('PS_THEME')) {
if (rewriteSettingsFile(NULL, $val, NULL)) {
Tools::redirectAdmin($currentIndex . '&conf=6' . '&token=' . $this->token);
} else {
$this->_errors[] = Tools::displayError('Cannot access settings file.');
}
} else {
$this->_errors[] = Tools::displayError('You must choose a graphical theme.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
parent::postProcess();
}
示例15: displayFooter
public function displayFooter()
{
if (!self::$initialized) {
$this->init();
}
self::$smarty->assign(array('HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => self::$cart)), 'HOOK_FOOTER' => Module::hookExec('footer'), 'content_only' => (int) Tools::getValue('content_only'), 'HOOK_CONTENT_BTM' => Module::hookExec('displayContentBtm'), 'HOOK_CONTENT_SIDE2' => Module::hookExec('displayContentSide2'), 'HOOK_MAIN_BTM' => Module::hookExec('displayMainBtm'), 'HOOK_BBODY_BTM' => Module::hookExec('displayBbodyBtm'), 'HOOK_BFOOT_TOP' => Module::hookExec('displayBfootTop'), 'HOOK_BFOOT_BTM' => Module::hookExec('displayBfootBtm')));
self::$smarty->display(_PS_THEME_DIR_ . 'footer.tpl');
//live edit
if (Tools::isSubmit('live_edit') && ($ad = Tools::getValue('ad') && Tools::getValue('liveToken') == sha1(Tools::getValue('ad') . _COOKIE_KEY_))) {
self::$smarty->assign(array('ad' => $ad, 'live_edit' => true));
self::$smarty->display(_PS_ALL_THEMES_DIR_ . 'live_edit.tpl');
} else {
Tools::displayError();
}
}