本文整理汇总了PHP中Hook::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::get方法的具体用法?PHP Hook::get怎么用?PHP Hook::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hook
的用法示例。
在下文中一共展示了Hook::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
public function install()
{
if (!parent::install() or !$this->registerHook('header') or !$this->registerHook('productFooter') or !$this->registerHook('footer') or !$this->installDB() or !$this->fixCSS() or !$this->updatePosition(Hook::get('header'), 0, 1)) {
return false;
}
return true;
}
示例2: loadAddons
private function loadAddons()
{
$data = S('hooks');
if (!$data) {
$hooks = M('hooks')->getField('name,addons', true);
foreach ($hooks as $key => $value) {
if ($value) {
$map['status'] = 1;
$names = explode(',', $value);
$map['name'] = array('IN', $names);
$data = M('Addons')->where($map)->getField('id,name');
if ($data) {
$addons = array_intersect($names, $data);
Hook::add($key, $addons);
}
}
}
S('hooks', Hook::get());
//插件标签
$tpl_tags = array();
$data = M('addons')->getField('id,name');
if ($data) {
foreach ($data as $addon) {
if (is_file("HDCMS/Addons/{$addon}/Tag/{$addon}Tag.class.php")) {
$tpl_tags[] = "@.Addons.{$addon}.Tag.{$addon}Tag";
}
}
}
S('HookTag', array_unique($tpl_tags));
} else {
Hook::import($data, false);
C('TPL_TAGS', array_unique(array_merge(C('TPL_TAGS'), S('HookTag'))));
}
}
示例3: _checkValues
private function _checkValues()
{
$errors = array();
if (isset($_POST['submitPaypalSettings'])) {
if (!isset($_POST['sandbox'])) {
$_POST['sandbox'] = 1;
}
if (!isset($_POST['expressCheckout'])) {
$_POST['expressCheckout'] = 0;
}
if (!$this->_expressCheckout and intval($_POST['expressCheckout'])) {
if (!$this->registerHook('shoppingCartExtra')) {
$errors[] = $this->l('Cannot register module to validCart hook, ExpressCheckout not enabled');
$_POST['expressCheckout'] = 0;
}
}
if ($this->_expressCheckout and !intval($_POST['expressCheckout'])) {
if (!$this->unregisterHook(Hook::get('shoppingCartExtra'))) {
$errors[] = $this->l('Cannot unregister module to validCart hook, ExpressCheckout not disabled');
$_POST['expressCheckout'] = 1;
}
}
} elseif (isset($_POST['submitPaypalAPI'])) {
if (!isset($_POST['apiUser']) or !$_POST['apiUser']) {
$errors[] = $this->l('You need to configure your PayPal API username');
}
if (!isset($_POST['apiPassword']) or !$_POST['apiPassword']) {
$errors[] = $this->l('You need to configure your PayPal API password');
}
if (!isset($_POST['apiSignature']) or !$_POST['apiSignature']) {
$errors[] = $this->l('You need to configure your PayPal API signature');
}
}
return $errors;
}
示例4: 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;
}
示例5: 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;
}
示例6: install
public function install()
{
$return = true;
foreach (self::$objects_list as $object) {
$return = $object->install();
if (!$return) {
break;
}
}
$return = $return ? parent::install() and $this->registerHook('orderConfirmation') and $this->registerHook('newOrder') and $this->registerHook('rightColumn') and $this->registerHook('paymentTop') and $this->registerHook('orderConfirmation') : $return;
$id_hook = Hook::get('payment');
$this->updatePosition($id_hook, 0, 1);
return $return;
}
示例7: install
function install()
{
if (Hook::get('orderPages') == false) {
$hook = new Hook();
$hook->name = 'orderPages';
$hook->title = 'Order process pages';
$hook->description = 'Adds new pages in the order process';
$hook->add();
}
if (parent::install() == false or $this->registerHook('orderPages') == false) {
return false;
}
return true;
}
示例8: install
function install()
{
if (Hook::get('orderPriceAdjustment') == false) {
$hook = new Hook();
$hook->name = 'orderPriceAdjustment';
$hook->title = 'Order price adjustment';
$hook->description = 'Allows modules to adjust prices in an order after the user has logged in and registered an address, e.g. allows prices based on group memberships and the like.';
$hook->add();
}
if (parent::install() == false) {
return false;
}
return true;
}
示例9: install
function install()
{
if (Hook::get('extraCarrierDetails') == false) {
$hook = new Hook();
$hook->name = 'extraCarrierDetails';
$hook->title = 'Extra carrier dietails';
$hook->description = 'Extra carrier dietails display part';
$hook->add();
}
if (Hook::get('extraCarrierDetailsProcess') == false) {
$hook = new Hook();
$hook->name = 'extraCarrierDetailsProcess';
$hook->title = 'Extra carrier dietails';
$hook->description = 'Extra carrier dietails processing part';
$hook->add();
}
return parent::install();
}
示例10: 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);
}
示例11: run
public function run(&$content)
{
$data = S('hooks');
if (!$data) {
$hooks = M('Hooks')->getField('name,plugins');
foreach ($hooks as $key => $value) {
if ($value) {
$map['status'] = 1;
$names = explode(',', $value);
$map['name'] = array('IN', $names);
$data = M('Plugins')->where($map)->getField('id,name');
if ($data) {
$plugins = array_intersect($names, $data);
Hook::add($key, $plugins);
}
}
}
S('hooks', Hook::get());
} else {
Hook::import($data, false);
}
}
示例12: loadAddons
/**
* 加载系统插件
*/
private function loadAddons()
{
$data = S('hooks');
if (!$data || DEBUG) {
$hooks = M('hooks')->where("status=1")->getField('name,addons', true);
if ($hooks) {
foreach ($hooks as $key => $value) {
if ($value) {
$map['status'] = 1;
$names = explode(',', $value);
$map['name'] = array('IN', $names);
$data = M('addons')->where($map)->getField('id,name');
if ($data) {
$addons = array_intersect($names, $data);
Hook::add($key, $addons);
}
}
}
}
S('hooks', Hook::get());
} else {
Hook::import($data, false);
}
}
示例13: installHook
public function installHook()
{
return Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`, `description`)
VALUE (\'displayMobileHeader\', \'' . pSQL($this->l('Header of mobile pages')) . '\', \'' . pSQL($this->l('A hook which allow you to do things in the header of each pages of the Mobile version')) . '\')') && Configuration::updateValue('PS_MOBILE_HOOK_HEADER_ID', Hook::get('displayMobileHeader'));
}
示例14: array
<?php
/**
* Arxmin Config Option Can be Overrided
*
*/
return Hook::get('arxmin::config', array('prefix' => 'arxmin', 'theme' => 'arx/arxmin/dist', 'namespace' => 'Arxmin\\', 'database' => array('default' => Config::get('database.default')), 'paths' => array('packages' => app_path('packages'), 'workbench' => base_path('workbench'), 'modules' => base_path('modules'), 'theme' => public_path('packages/arx/arxmin/dist')), 'auth' => array('filter' => 'arxmin-auth', 'controller' => 'Arxmin\\AuthController', 'model' => 'Arxmin\\UserModel')));
示例15: _displayForm4
private function _displayForm4()
{
$xml = simplexml_load_file(_IMPORT_FOLDER_ . XMLFILENAME);
$this->xml = $xml;
self::getModules();
$hook = array();
$hookedModule = array();
$position = array();
$msg = '';
foreach ($this->xml->modules->hooks->hook as $row) {
$hookedModule[] = strval($row['module']);
$hook[] = strval($row['hook']);
$position[] = strval($row['position']);
$exceptions[] = isset($row['exceptions']) ? explode(',', strval($row['exceptions'])) : array();
}
if (file_exists(_IMPORT_FOLDER_ . 'doc') and sizeof($xml->docs->doc) != 0) {
self::_loadDocForm();
}
// install selected modules
$flag = 0;
if (isset($this->to_export) and $this->to_export) {
foreach ($this->to_export as $row) {
if (in_array($row, $this->native_modules)) {
continue;
}
if ($flag++ == 0) {
$msg .= '<b>' . $this->l('The following modules have been installed') . ' :</b><br />';
}
self::recurseCopy(_IMPORT_FOLDER_ . 'modules/' . $row, _PS_ROOT_DIR_ . '/modules/' . $row);
$obj = Module::getInstanceByName($row);
if (Validate::isLoadedObject($obj)) {
Db::getInstance()->Execute('
UPDATE `' . _DB_PREFIX_ . 'module`
SET `active`= 1
WHERE `name` = \'' . pSQL($row) . '\'');
} elseif (!$obj or !$obj->install()) {
continue;
}
$msg .= '<i>- ' . pSQL($row) . '</i><br />';
Db::getInstance()->Execute('
DELETE FROM `' . _DB_PREFIX_ . 'hook_module`
WHERE `id_module` = ' . pSQL($obj->id));
$count = -1;
while (isset($hookedModule[++$count])) {
if ($hookedModule[$count] == $row) {
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', ' . (int) $position[$count] . ')');
if ($exceptions[$count]) {
foreach ($exceptions[$count] as $file_name) {
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
VALUES (' . (int) $obj->id . ', ' . (int) Hook::get($hook[$count]) . ', "' . pSQL($file_name) . '")');
}
}
}
}
}
}
if (($val = (int) Tools::getValue('nativeModules')) != 1) {
$flag = 0;
// Disable native modules
if ($val == 2 and $this->to_disable and count($this->to_disable)) {
foreach ($this->to_disable as $row) {
$obj = Module::getInstanceByName($row);
if (Validate::isLoadedObject($obj)) {
if ($flag++ == 0) {
$msg .= '<b>' . $this->l('The following modules have been disabled') . ' :</b><br />';
}
$msg .= '<i>- ' . pSQL($row) . '</i><br />';
Db::getInstance()->Execute('
UPDATE `' . _DB_PREFIX_ . 'module`
SET `active`= 0
WHERE `name` = \'' . pSQL($row) . '\'');
}
}
}
$flag = 0;
if ($this->to_enable and count($this->to_enable)) {
foreach ($this->to_enable as $row) {
$obj = Module::getInstanceByName($row);
if (Validate::isLoadedObject($obj)) {
Db::getInstance()->Execute('
UPDATE `' . _DB_PREFIX_ . 'module`
SET `active`= 1
WHERE `name` = \'' . pSQL($row) . '\'');
} elseif (!is_object($obj) or !$obj->install()) {
continue;
}
if ($flag++ == 0) {
$msg .= '<b>' . $this->l('The following modules have been enabled') . ' :</b><br />';
}
$msg .= '<i>- ' . pSQL($row) . '</i><br />';
Db::getInstance()->Execute('
DELETE FROM `' . _DB_PREFIX_ . 'hook_module`
WHERE `id_module` = ' . pSQL($obj->id));
$count = -1;
while (isset($hookedModule[++$count])) {
if ($hookedModule[$count] == $row) {
Db::getInstance()->Execute('
//.........这里部分代码省略.........