当前位置: 首页>>代码示例>>PHP>>正文


PHP Hook::exec方法代码示例

本文整理汇总了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');
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:29,代码来源:NewProductsController.php

示例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);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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());
 }
开发者ID:PluginSales,项目名称:Prestashop-Skrill,代码行数:29,代码来源:paymentAbstract.php

示例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')));
     }
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:27,代码来源:FrontController.php

示例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;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:35,代码来源:ConditionsToApproveFinder.php

示例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();
 }
开发者ID:NathanGiesbrecht,项目名称:PrestaShopAutomationFramework,代码行数:7,代码来源:PdfInvoiceController.php

示例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());
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:7,代码来源:blockmyaccountfooter.php

示例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);
	}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例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;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:26,代码来源:PaymentOptionsFinder.php

示例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')));
     }
 }
开发者ID:johnulist,项目名称:smartblog,代码行数:35,代码来源:FrontController.php

示例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');
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:11,代码来源:IndexController.php

示例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);
                    }
                }
            }
        }
    }
开发者ID:Arikito,项目名称:barbator,代码行数:62,代码来源:Dispatcher.php

示例13: displayOrderConfirmation

 /**
  * Execute the hook displayOrderConfirmation
  */
 public function displayOrderConfirmation()
 {
     $params = $this->displayHook();
     if ($params && is_array($params)) {
         return Hook::exec('displayOrderConfirmation', $params);
     }
     return false;
 }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:11,代码来源:submit.php

示例14: add

 public function add($autodate = true, $nullValues = false)
 {
     if (parent::add($autodate, $nullValues)) {
         Hook::exec('actionPaymentCCAdd', array('paymentCC' => $this));
         return true;
     }
     return false;
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:8,代码来源:OrderPayment.php

示例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');
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:12,代码来源:MyAccountController.php


注:本文中的Hook::exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。