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


PHP Hook::getIdByName方法代码示例

本文整理汇总了PHP中Hook::getIdByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::getIdByName方法的具体用法?PHP Hook::getIdByName怎么用?PHP Hook::getIdByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hook的用法示例。


在下文中一共展示了Hook::getIdByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getModuleAssign

 public function getModuleAssign($module_name = '', $name_hook = '')
 {
     //$module_id = 7 ; $id_hook = 21 ;
     if (!$module_name || !$name_hook) {
         return;
     }
     $module = Module::getInstanceByName($module_name);
     $module_id = $module->id;
     $id_hook = Hook::getIdByName($name_hook);
     $hook_name = $name_hook;
     if (!$module) {
         return;
     }
     $module_name = $module->name;
     if (Validate::isLoadedObject($module) && $module->id) {
         $array = array();
         $array['id_hook'] = $id_hook;
         $array['module'] = $module_name;
         $array['id_module'] = $module->id;
         if (_PS_VERSION_ < "1.5") {
             return self::lofHookExec($hook_name, array(), $module->id, $array);
         } else {
             $hook_name = substr($hook_name, 7, strlen($hook_name));
             return self::renderModuleByHookV15($hook_name, array(), $module->id, $array);
         }
     }
     return '';
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:28,代码来源:Staticblock.php

示例2: renderForm

    public function renderForm($data)
    {
        $helper = $this->getFormHelper();
        $id_shop = Context::getContext()->shop->id;
        if (isset($data['params']['hookmodule'])) {
            $hid = Hook::getIdByName($data['params']['hookmodule']);
            if ($hid) {
                $hms = Hook::getModulesFromHook($hid);
                foreach ($hms as $hm) {
                    if ($data['params']['loadmodule'] == $hm['name']) {
                        $id_module = $hm['id_module'];
                        $module = Module::getInstanceById($id_module);
                        if (Validate::isLoadedObject($module)) {
                            !$module->unregisterHook((int) $hid, array($id_shop));
                        }
                    }
                }
            }
        }
        $modules = Module::getModulesInstalled(0);
        $output = array();
        $hooks = array('displayHome', 'displayLeftColumn', 'displayRightColumn', 'displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayMainmenu', 'displayPromoteTop', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav', 'displayFooterTop', 'displayMapLocal', 'displayFooterBottom');
        foreach ($hooks as $hook) {
            $output[] = array('name' => $hook, 'id' => $hook);
        }
        $this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Widget Form.')), 'input' => array(array('type' => 'select', 'label' => $this->l('Select A Module'), 'name' => 'loadmodule', 'options' => array('query' => $modules, 'id' => 'name', 'name' => 'name'), 'default' => '1', 'desc' => $this->l('Select A Module is used as widget. the hook of this module was unhooked.')), array('type' => 'select', 'label' => $this->l('Select A Hook'), 'name' => 'hookmodule', 'options' => array('query' => $output, 'id' => 'name', 'name' => 'name'), 'default' => '1', 'desc' => $this->l('Select A hook is used to render module\'s content. the hook of this module was unhooked. 
						You could not rollback it\'s position. So you need asign it in position management of prestashop.'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
        $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
        $a = $this->getConfigFieldsValues($data);
        $helper->tpl_vars = array('fields_value' => $a, 'languages' => Context::getContext()->controller->getLanguages(), 'id_language' => $default_lang);
        return $helper->generateForm($this->fields_form);
    }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:32,代码来源:module.php

示例3: ModuleHookExec

    private function ModuleHookExec($moduleName, $hook_name)
    {
        $output = '';
        $moduleInstance = Module::getInstanceByName($moduleName);
        if (Validate::isLoadedObject($moduleInstance) && $moduleInstance->id) {
            $altern = 0;
            $id_hook = Hook::getIdByName($hook_name);
            $retro_hook_name = Hook::getRetroHookName($hook_name);
            $disable_non_native_modules = (bool) Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
            if ($disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($moduleInstance->name, self::$native_module)) {
                return '';
            }
            //check disable module
            $device = (int) $this->context->getDevice();
            if (Db::getInstance()->getValue('
			SELECT COUNT(`id_module`) FROM ' . _DB_PREFIX_ . 'module_shop
			WHERE enable_device & ' . (int) $device . ' AND id_module=' . (int) $moduleInstance->id . Shop::addSqlRestriction()) == 0) {
                return '';
            }
            // Check permissions
            $exceptions = $moduleInstance->getExceptions($id_hook);
            $controller = Dispatcher::getInstance()->getController();
            $controller_obj = Context::getContext()->controller;
            //check if current controller is a module controller
            if (isset($controller_obj->module) && Validate::isLoadedObject($controller_obj->module)) {
                $controller = 'module-' . $controller_obj->module->name . '-' . $controller;
            }
            if (in_array($controller, $exceptions)) {
                return '';
            }
            //retro compat of controller names
            $matching_name = array('authentication' => 'auth', 'productscomparison' => 'compare');
            if (isset($matching_name[$controller]) && in_array($matching_name[$controller], $exceptions)) {
                return '';
            }
            if (Validate::isLoadedObject($this->context->employee) && !$moduleInstance->getPermission('view', $this->context->employee)) {
                return '';
            }
            if (!isset($hook_args['cookie']) or !$hook_args['cookie']) {
                $hook_args['cookie'] = $this->context->cookie;
            }
            if (!isset($hook_args['cart']) or !$hook_args['cart']) {
                $hook_args['cart'] = $this->context->cart;
            }
            $hook_callable = is_callable(array($moduleInstance, 'hook' . $hook_name));
            $hook_retro_callable = is_callable(array($moduleInstance, 'hook' . $retro_hook_name));
            if (($hook_callable || $hook_retro_callable) && Module::preCall($moduleInstance->name)) {
                $hook_args['altern'] = ++$altern;
                // Call hook method
                if ($hook_callable) {
                    $display = $moduleInstance->{'hook' . $hook_name}($hook_args);
                } elseif ($hook_retro_callable) {
                    $display = $moduleInstance->{'hook' . $retro_hook_name}($hook_args);
                }
                $output .= $display;
            }
        }
        return $output;
    }
开发者ID:zangles,项目名称:lennyba,代码行数:59,代码来源:ovichookmanager.php

示例4: upgrade_module_2_5_8

function upgrade_module_2_5_8($module)
{
    $hook_to_remove_id = Hook::getIdByName('advancedPaymentApi');
    if ($hook_to_remove_id) {
        $module->unregisterHook((int) $hook_to_remove_id);
    }
    return true;
}
开发者ID:prestashop,项目名称:ps_checkpayment,代码行数:8,代码来源:upgrade-2.5.8.php

示例5: install

 public function install()
 {
     self::$obj_ts_common->install();
     $return = parent::install() && $this->registerHook('displayBackOfficeHeader') && $this->registerHook('orderConfirmation') && $this->registerHook('newOrder') && $this->registerHook('actionOrderStatusPostUpdate') && $this->registerHook('Footer') && $this->registerHook('paymentTop') && $this->registerHook('orderConfirmation');
     $id_hook = _PS_VERSION_ < '1.5' ? Hook::get('payment') : Hook::getIdByName('payment');
     $this->updatePosition($id_hook, 0, 1);
     return $return;
 }
开发者ID:alexsimple,项目名称:trustedshops,代码行数:8,代码来源:trustedshops.php

示例6: upgrade_module_1_1

function upgrade_module_1_1($module)
{
    $hook_to_remove_id = Hook::getIdByName('displayAfterBodyOpeningTag');
    if ($hook_to_remove_id) {
        $module->unregisterHook((int) $hook_to_remove_id);
    }
    return Configuration::deleteByName('NW_CONFIRMATION_OPTIN');
}
开发者ID:prestashop,项目名称:ps_emailsubscription,代码行数:8,代码来源:install-1-1.php

示例7: upgrade_module_3_0_0

function upgrade_module_3_0_0($module)
{
    $result = true;
    $hook_to_remove_ids = [Hook::getIdByName('displayPaymentEU'), Hook::getIdByName('payment')];
    foreach ($hook_to_remove_ids as $hook_to_remove_id) {
        $result &= $module->unregisterHook((int) $hook_to_remove_id);
    }
    $result &= $module->registerHook('paymentOptions');
    return $result;
}
开发者ID:prestashop,项目名称:ps_checkpayment,代码行数:10,代码来源:upgrade-3.0.0.php

示例8: install

 public function install()
 {
     $homeHookID = $this->isPrestaShop15x ? $this->isPrestaShop16x ? Hook::getIdByName('displayTopColumn') : Hook::getIdByName('displayHome') : Hook::get('home');
     $headerHookID = $this->isPrestaShop15x ? Hook::getIdByName('displayHeader') : Hook::get('header');
     if (!parent::install() or !$this->registerHook($this->isPrestaShop15x ? 'displayHeader' : 'header') or !$this->registerHook($this->isPrestaShop15x ? 'displayFooterProduct' : 'productFooter') or !$this->registerHook($this->isPrestaShop15x ? 'displayFooter' : 'footer') or !$this->installDB() or !$this->fixCSS() or !$this->registerHook($this->isPrestaShop15x ? $this->isPrestaShop16x ? 'displayTopColumn' : 'displayHome' : 'home') or !$this->updatePosition($homeHookID, 0, 1) or !$this->createImageFolder('magicscroll') or !$this->updatePosition($headerHookID, 0, 1)) {
         return false;
     }
     $this->sendStat('install');
     return true;
 }
开发者ID:Eximagen,项目名称:3m,代码行数:10,代码来源:magicscroll.php

示例9: upgrade_module_1_5_1

function upgrade_module_1_5_1($module)
{
    if (Hook::getIdByName('displayPaymentEu')) {
        return true;
    }
    $new_hook = new Hook();
    $new_hook->name = 'displayPaymentEu';
    $new_hook->title = 'Display EU payment options (helper)';
    $new_hook->description = 'Hook to display payment options';
    $new_hook->position = true;
    $new_hook->live_edit = false;
    return (bool) $new_hook->add() && (bool) $module->registerModulesBackwardCompatHook();
}
开发者ID:prestashop,项目名称:advancedeucompliance,代码行数:13,代码来源:upgrade-1.5.1.php

示例10: checkOwnerHooks

 private function checkOwnerHooks()
 {
     $hookspos = array('displayTop', 'displayHeaderRight', 'displaySlideshow', 'topNavigation', 'displayPromoteTop', 'displayRightColumn', 'displayLeftColumn', 'displayHome', 'displayFooter', 'displayBottom', 'displayContentBottom', 'displayFootNav', 'displayFooterTop', 'displayFooterBottom');
     foreach ($hookspos as $hook) {
         if (Hook::getIdByName($hook)) {
         } else {
             $new_hook = new Hook();
             $new_hook->name = pSQL($hook);
             $new_hook->title = pSQL($hook);
             $new_hook->add();
         }
     }
     return true;
 }
开发者ID:downten,项目名称:ecomblockmanufacturer,代码行数:14,代码来源:ecomblockmanufacturer.php

示例11: _postProcess

 private function _postProcess()
 {
     if (Tools::isSubmit('submitBlockCategories')) {
         $pref = $_POST['pref'];
         $old_values = self::getPreferences();
         $new_values = array_merge(self::$default_values, $pref);
         Configuration::updateValue('PSBLOG_CATEGORIES_CONF', base64_encode(serialize($new_values)));
         if ($new_values['block_categories_position'] != $old_values['block_categories_position']) {
             $old_hook_id = Hook::getIdByName($old_values['block_categories_position']);
             $this->unregisterHook($old_hook_id);
             $this->registerHook($new_values['block_categories_position']);
         }
         $this->_html .= '<div class="conf confirm">' . $this->l('Settings updated') . '</div>';
     }
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:15,代码来源:psblogcategories.php

示例12: execHookStockManagerFactory

 /**
  *  Looks for a StockManager in the modules list.
  *
  *  @return StockManagerInterface
  */
 public static function execHookStockManagerFactory()
 {
     $modules_infos = Hook::getModulesFromHook(Hook::getIdByName('stockManager'));
     $stock_manager = false;
     foreach ($modules_infos as $module_infos) {
         $module_instance = Module::getInstanceByName($module_infos['name']);
         if (is_callable(array($module_instance, 'hookStockManager'))) {
             $stock_manager = $module_instance->hookStockManager();
         }
         if ($stock_manager) {
             break;
         }
     }
     return $stock_manager;
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:20,代码来源:StockManagerFactory.php

示例13: execHookTaxManagerFactory

 /**
  * Check for a tax manager able to handle this type of address in the module list
  *
  * @param Address $address
  * @param string $type
  *
  * @return TaxManager
  */
 public static function execHookTaxManagerFactory(Address $address, $type)
 {
     $modules_infos = Hook::getModulesFromHook(Hook::getIdByName('taxManager'));
     $tax_manager = false;
     foreach ($modules_infos as $module_infos) {
         $module_instance = Module::getInstanceByName($module_infos['name']);
         if (is_callable(array($module_instance, 'hookTaxManager'))) {
             $tax_manager = $module_instance->hookTaxManager(array('address' => $address, 'params' => $type));
         }
         if ($tax_manager) {
             break;
         }
     }
     return $tax_manager;
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:23,代码来源:TaxManagerFactory.php

示例14: moveRightColumn

 public function moveRightColumn($position)
 {
     if (_PS_VERSION_ < '1.5') {
         $hookRight = (int) Hook::get('rightColumn');
     } else {
         $hookRight = (int) Hook::getIdByName('rightColumn');
     }
     $moduleInstance = Module::getInstanceByName($this->name);
     if (_PS_VERSION_ < '1.5') {
         $moduleInfo = Hook::getModuleFromHook($hookRight, $moduleInstance->id);
     } else {
         $moduleInfo = Hook::getModulesFromHook($hookRight, $moduleInstance->id);
     }
     if (isset($moduleInfo['position']) && (int) $moduleInfo['position'] > (int) $position || isset($moduleInfo['m.position']) && (int) $moduleInfo['m.position'] > (int) $position) {
         return $moduleInstance->updatePosition($hookRight, 0, (int) $position);
     }
     return $moduleInstance->updatePosition($hookRight, 1, (int) $position);
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:18,代码来源:paypal_tools.php

示例15: remove_hook_by_hookname

 public function remove_hook_by_hookname($handle)
 {
     $fonts = $this->get_all_hooks();
     if (!empty($fonts)) {
         foreach ($fonts as $key => $font) {
             if ($font['hookname'] == $handle) {
                 unset($fonts[$key]);
                 //start unregister hook
                 $mod_obj = Module::getInstanceByName('revsliderprestashop');
                 $id_hook = Hook::getIdByName($handle);
                 $mod_obj->unregisterHook($id_hook);
                 //End unregister hook
                 $do = sdsconfig::setval('sds_rev_hooks', $fonts);
                 return true;
             }
         }
     }
     return __('Hook not found! Wrong Hook given.', REVSLIDER_TEXTDOMAIN);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:19,代码来源:hooks.class.php


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