本文整理汇总了PHP中Hook::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::exec方法的具体用法?PHP Hook::exec怎么用?PHP Hook::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->productSort();
// Override default configuration values: cause the new products page must display latest products first.
if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
$this->orderBy = 'date_add';
$this->orderWay = 'DESC';
}
$nbProducts = (int) Product::getNewProducts($this->context->language->id, null, null, true);
$this->pagination($nbProducts);
$products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displayLeftColumn'), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
if ($this->ajax) {
$product_list = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
$pagination = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl');
$nbLeftProducts = $nbProducts - ($this->n * ($this->p - 1) + count($products));
$nbLeftProductsPercentage = ($nbProducts - $nbLeftProducts) / $nbProducts * 100;
echo Tools::jsonEncode(array('productList' => utf8_encode($product_list), 'pagination' => $pagination, 'nbRenderedProducts' => $nbProducts, 'nbLeftProducts' => $nbLeftProducts, 'nbLeftProductsPercentage' => $nbLeftProductsPercentage));
die;
} else {
$this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
}
}
示例2: add
public function add($autodate = true, $null_values = true)
{
$order = new Order($this->id_order);
$cart = new Cart($order->id_cart);
Hook::exec('actionBeforeAddOrderInvoice', array('order_invoice' => $this, 'order' => $order, 'cart' => $cart));
return parent::add($autodate, $null_values);
}
示例3: initContent
public function initContent()
{
$this->display_column_left = false;
$this->process();
if (!isset($this->context->cart)) {
$this->context->cart = new Cart();
}
if (!$this->useMobileTheme()) {
$this->context->smarty->assign(array('HOOK_HEADER' => Hook::exec('displayHeader'), 'HOOK_LEFT_COLUMN' => $this->display_column_left ? Hook::exec('displayLeftColumn') : '', 'HOOK_RIGHT_COLUMN' => $this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''));
} else {
$this->context->smarty->assign('HOOK_MOBILE_HEADER', Hook::exec('displayMobileHeader'));
}
$contextLink = $this->context->link;
$postParameters = $this->getPostParameters();
try {
$sid = SkrillPaymentCore::getSid($postParameters);
} catch (Exception $e) {
Tools::redirect($contextLink->getPageLink('order', true, null, array('step' => '3', 'skrillerror' => 'ERROR_GENERAL_REDIRECT')));
}
if (!$sid) {
Tools::redirect($contextLink->getPageLink('order', true, null, array('step' => '3', 'skrillerror' => 'ERROR_GENERAL_REDIRECT')));
}
$redirectUrl = SkrillPaymentCore::getSkrillRedirectUrl($sid);
if (Configuration::get('SKRILL_GENERAL_DISPLAY') != "IFRAME") {
Tools::redirect($redirectUrl);
}
$this->context->smarty->assign(array('fullname' => $this->context->customer->firstname . " " . $this->context->customer->lastname, 'lang' => $this->getLang(), 'redirectUrl' => $redirectUrl, 'total' => $this->context->cart->getOrderTotal(true, Cart::BOTH), 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/'));
$this->setTemplate($this->getTemplateName());
}
示例4: initContent
public function initContent()
{
parent::initContent();
if ($id_category = Tools::getvalue('id_category') && Tools::getvalue('id_category') != Null) {
$this->context->smarty->assign(BlogCategory::GetMetaByCategory(Tools::getvalue('id_category')));
}
if ($id_post = Tools::getvalue('id_post') && Tools::getvalue('id_post') != Null) {
$this->context->smarty->assign(SmartBlogPost::GetPostMetaByPost(Tools::getvalue('id_post')));
}
if (Tools::getvalue('id_category') == Null && Tools::getvalue('id_post') == Null) {
$meta['meta_title'] = Configuration::get('smartblogmetatitle');
$meta['meta_description'] = Configuration::get('smartblogmetadescrip');
$meta['meta_keywords'] = Configuration::get('smartblogmetakeyword');
$this->context->smarty->assign($meta);
}
if (Configuration::get('smartshowcolumn') == 0) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
} elseif (Configuration::get('smartshowcolumn') == 1) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft')));
} elseif (Configuration::get('smartshowcolumn') == 2) {
$this->context->smarty->assign(array('HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
} elseif (Configuration::get('smartshowcolumn') == 3) {
$this->context->smarty->assign(array());
} else {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
}
}
示例5: getConditionsToApprove
private function getConditionsToApprove()
{
$allConditions = array();
$hookedConditions = Hook::exec('termsAndConditions', array(), null, true);
if (!is_array($hookedConditions)) {
$hookedConditions = array();
}
foreach ($hookedConditions as $hookedCondition) {
if ($hookedCondition instanceof TermsAndConditions) {
$allConditions[] = $hookedCondition;
} elseif (is_array($hookedCondition)) {
foreach ($hookedCondition as $hookedConditionObject) {
if ($hookedConditionObject instanceof TermsAndConditions) {
$allConditions[] = $hookedConditionObject;
}
}
}
}
if (Configuration::get('PS_CONDITIONS')) {
array_unshift($allConditions, $this->getDefaultTermsAndConditions());
}
/*
* If two TermsAndConditions objects have the same identifier,
* the one at the end of the list overrides the first one.
* This allows a module to override the default checkbox
* in a consistent manner.
*/
$reducedConditions = array();
foreach ($allConditions as $condition) {
if ($condition instanceof TermsAndConditions) {
$reducedConditions[$condition->getIdentifier()] = $condition;
}
}
return $reducedConditions;
}
示例6: display
public function display()
{
$order_invoice_list = $this->order->getInvoicesCollection();
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
$pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty);
$pdf->render();
}
示例7: hookFooter
public function hookFooter($params)
{
if (!$this->isCached('blockmyaccountfooter.tpl', $this->getCacheId())) {
$this->smarty->assign(array('voucherAllowed' => CartRule::isFeatureActive(), 'returnAllowed' => (int) Configuration::get('PS_ORDER_RETURN'), 'HOOK_BLOCK_MY_ACCOUNT' => Hook::exec('displayMyAccountBlockfooter')));
}
return $this->display(__FILE__, 'blockmyaccountfooter.tpl', $this->getCacheId());
}
示例8: setDeliveryNumber
public function setDeliveryNumber($order_invoice_id, $id_shop)
{
if (!$order_invoice_id)
return false;
$number = Configuration::get('PS_DELIVERY_NUMBER', null, null, $id_shop);
// If invoice start number has been set, you clean the value of this configuration
if ($number)
Configuration::updateValue('PS_DELIVERY_NUMBER', false, false, null, $id_shop);
$order_invoice = new OrderInvoice($order_invoice_id);
$order = new Order($order_invoice->id_order);
$cart = new Cart($order->id_cart);
if($ref = Hook::exec('actionBeforeAddDeliveryNumber', array('order'=>$order,'cart'=>$cart,'number'=>$number)))
$number = $ref;
$sql = 'UPDATE `'._DB_PREFIX_.'order_invoice` SET delivery_number =';
if ($number)
$sql .= (int)$number;
else
$sql .= '(SELECT new_number FROM (SELECT (MAX(`delivery_number`) + 1) AS new_number
FROM `'._DB_PREFIX_.'order_invoice`) AS result)';
$sql .=' WHERE `id_order_invoice` = '.(int)$order_invoice_id;
return Db::getInstance()->execute($sql);
}
示例9: getPaymentOptions
public function getPaymentOptions()
{
// Payment options coming from intermediate, deprecated version of the Advanced API
$rawDisplayPaymentEUOptions = Hook::exec('displayPaymentEU', array(), null, true);
if (!is_array($rawDisplayPaymentEUOptions)) {
$rawDisplayPaymentEUOptions = array();
}
$displayPaymentEUOptions = array_map(array('PrestaShop\\PrestaShop\\Core\\Payment\\PaymentOption', 'convertLegacyOption'), $rawDisplayPaymentEUOptions);
// Payment options coming from regular Advanced API
$advancedPaymentOptions = Hook::exec('advancedPaymentOptions', array(), null, true);
if (!is_array($advancedPaymentOptions)) {
$advancedPaymentOptions = array();
}
// Payment options coming from regular Advanced API
$newOption = Hook::exec('paymentOptions', array(), null, true);
if (!is_array($newOption)) {
$newOption = array();
}
$paymentOptions = array_merge($displayPaymentEUOptions, $advancedPaymentOptions, $newOption);
foreach ($paymentOptions as $paymentOptionKey => $paymentOption) {
if (!is_array($paymentOption)) {
unset($paymentOptions[$paymentOptionKey]);
}
}
return $paymentOptions;
}
示例10: initContent
public function initContent()
{
$meta = array();
parent::initContent();
$colums = Context::getContext()->theme->hasColumns(Context::getContext()->controller->page_name);
if ($colums) {
$hide_column_left = isset($colums['left_column']) && !empty($colums['left_column']) ? 0 : 1;
$hide_column_right = isset($colums['right_column']) && !empty($colums['right_column']) ? 0 : 1;
}
/* if ( Tools::getvalue('id_category') && Tools::getvalue('id_category') != Null) {
$this->context->smarty->assign(BlogCategory::GetMetaByCategory(Tools::getvalue('id_category')));
}
if (Tools::getvalue('id_post') && Tools::getvalue('id_post') != Null) {
$this->context->smarty->assign(SmartBlogPost::GetPostMetaByPost(Tools::getvalue('id_post')));
}
if (Tools::getvalue('id_category') == Null && Tools::getvalue('id_post') == Null) {
$meta['meta_title'] = Configuration::get('smartblogmetatitle');
$meta['meta_description'] = Configuration::get('smartblogmetadescrip');
$meta['meta_keywords'] = Configuration::get('smartblogmetakeyword');
$this->context->smarty->assign($meta);
}
*/
$this->context->smarty->assign($meta);
if (Configuration::get('smartshowcolumn') == 0) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'hide_right_column' => '', 'hide_left_column' => '', 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
} elseif (Configuration::get('smartshowcolumn') == 1) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'hide_right_column' => '1', 'hide_left_column' => '', 'HOOK_RIGHT_COLUMN' => ''));
} elseif (Configuration::get('smartshowcolumn') == 2) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => '', 'hide_right_column' => '', 'hide_left_column' => '1', 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
} elseif (Configuration::get('smartshowcolumn') == 3) {
$this->context->smarty->assign(array('hide_right_column' => $hide_column_right, 'hide_left_column' => $hide_column_left));
} else {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'hide_right_column' => '', 'hide_left_column' => '', 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
}
}
示例11: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->addJS(_THEME_JS_DIR_ . 'index.js');
$this->context->smarty->assign(array('HOOK_HOME' => Hook::exec('displayHome'), 'HOOK_HOME_TAB' => Hook::exec('displayHomeTab'), 'HOOK_HOME_TAB_CONTENT' => Hook::exec('displayHomeTabContent')));
$this->setTemplate(_PS_THEME_DIR_ . 'index.tpl');
}
示例12: loadRoutes
/**
* Load default routes group by languages
*/
protected function loadRoutes($id_shop = null)
{
$context = Context::getContext();
// Load custom routes from modules
$modules_routes = Hook::exec('moduleRoutes', array('id_shop' => $id_shop), null, true, false);
if (is_array($modules_routes) && count($modules_routes)) {
foreach ($modules_routes as $module_route) {
if (is_array($module_route) && count($module_route)) {
foreach ($module_route as $route => $route_details) {
if (array_key_exists('controller', $route_details) && array_key_exists('rule', $route_details) && array_key_exists('keywords', $route_details) && array_key_exists('params', $route_details)) {
if (!isset($this->default_routes[$route])) {
$this->default_routes[$route] = array();
$this->default_routes[$route] = array_merge($this->default_routes[$route], $route_details);
}
}
}
}
}
}
// Set default routes
//new edit by Ha!*!*y :: Select only active languages
foreach (Language::getLanguages(TRUE) as $lang) {
foreach ($this->default_routes as $id => $route) {
$this->addRoute($id, $route['rule'], $route['controller'], $lang['id_lang'], $route['keywords'], isset($route['params']) ? $route['params'] : array(), $id_shop);
}
}
if ($this->use_routes) {
// Get iso lang
$iso_lang = Tools::getValue('isolang');
$id_lang = $context->language->id;
if (!empty($iso_lang)) {
$id_lang = Language::getIdByIso($iso_lang);
}
// Load routes from meta table
$sql = 'SELECT m.page, ml.url_rewrite, ml.id_lang
FROM `' . _DB_PREFIX_ . 'meta` m
LEFT JOIN `' . _DB_PREFIX_ . 'meta_lang` ml ON (m.id_meta = ml.id_meta' . Shop::addSqlRestrictionOnLang('ml', $id_shop) . ')
ORDER BY LENGTH(ml.url_rewrite) DESC';
if ($results = Db::getInstance()->executeS($sql)) {
foreach ($results as $row) {
if ($row['url_rewrite']) {
$this->addRoute($row['page'], $row['url_rewrite'], $row['page'], $row['id_lang'], array(), array(), $id_shop);
}
}
}
// Set default empty route if no empty route (that's weird I know)
if (!$this->empty_route) {
$this->empty_route = array('routeID' => 'index', 'rule' => '', 'controller' => 'index');
}
// Load custom routes
foreach ($this->default_routes as $route_id => $route_data) {
if ($custom_route = Configuration::get('PS_ROUTE_' . $route_id, null, null, $id_shop)) {
foreach (Language::getLanguages() as $lang) {
$this->addRoute($route_id, $custom_route, $route_data['controller'], $lang['id_lang'], $route_data['keywords'], isset($route_data['params']) ? $route_data['params'] : array(), $id_shop);
}
}
}
}
}
示例13: displayOrderConfirmation
/**
* Execute the hook displayOrderConfirmation
*/
public function displayOrderConfirmation()
{
$params = $this->displayHook();
if ($params && is_array($params)) {
return Hook::exec('displayOrderConfirmation', $params);
}
return false;
}
示例14: add
public function add($autodate = true, $nullValues = false)
{
if (parent::add($autodate, $nullValues)) {
Hook::exec('actionPaymentCCAdd', array('paymentCC' => $this));
return true;
}
return false;
}
示例15: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$has_address = $this->context->customer->getAddresses($this->context->language->id);
$this->context->smarty->assign(array('has_customer_an_address' => empty($has_address), 'voucherAllowed' => (int) CartRule::isFeatureActive(), 'returnAllowed' => (int) Configuration::get('PS_ORDER_RETURN')));
$this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('displayCustomerAccount'));
$this->setTemplate(_PS_THEME_DIR_ . 'my-account.tpl');
}