本文整理汇总了PHP中Validate::isModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isModuleName方法的具体用法?PHP Validate::isModuleName怎么用?PHP Validate::isModuleName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validate
的用法示例。
在下文中一共展示了Validate::isModuleName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModulesByDirct
public static function getModulesByDirct($type)
{
$_modules = array();
$result = opendir(_TM_MODULES_DIR . $type);
while ($dir = readdir($result)) {
if (Validate::isModuleName($dir) && is_dir(_TM_MODULES_DIR . $type . '/' . $dir)) {
include _TM_MODULES_DIR . $type . '/' . $dir . '/config.php';
if (!($mod = Module::existsModule($dir))) {
$module = new Module();
$module->alias = pSQL($dir);
$module->name = pSQL($_modules[$type][$dir]['name']);
$module->type = pSQL($type);
$module->description = pSQL($_modules[$type][$dir]['description']);
$module->active = 0;
$module->add();
$_modules[$type][$dir]['id'] = $module->id;
} else {
$_modules[$type][$dir]['id'] = $mod['id_module'];
$_modules[$type][$dir]['active'] = $mod['active'];
$_modules[$type][$dir]['type'] = $mod['type'];
}
}
}
return $_modules[$type];
}
示例2: engine
public function engine($params)
{
if (!($render = Configuration::get('PS_STATS_GRID_RENDER'))) {
return Tools::displayError('No grid engine selected');
}
if (!Validate::isModuleName($render)) {
die(Tools::displayError());
}
if (!file_exists(_PS_ROOT_DIR_ . '/modules/' . $render . '/' . $render . '.php')) {
return Tools::displayError('Grid engine selected is unavailable.');
}
$grider = 'grider.php?render=' . $render . '&module=' . Tools::safeOutput(Tools::getValue('module'));
$context = Context::getContext();
$grider .= '&id_employee=' . (int) $context->employee->id;
$grider .= '&id_lang=' . (int) $context->language->id;
if (!isset($params['width']) || !Validate::IsUnsignedInt($params['width'])) {
$params['width'] = 600;
}
if (!isset($params['height']) || !Validate::IsUnsignedInt($params['height'])) {
$params['height'] = 920;
}
if (!isset($params['start']) || !Validate::IsUnsignedInt($params['start'])) {
$params['start'] = 0;
}
if (!isset($params['limit']) || !Validate::IsUnsignedInt($params['limit'])) {
$params['limit'] = 40;
}
$grider .= '&width=' . $params['width'];
$grider .= '&height=' . $params['height'];
if (isset($params['start']) && Validate::IsUnsignedInt($params['start'])) {
$grider .= '&start=' . $params['start'];
}
if (isset($params['limit']) && Validate::IsUnsignedInt($params['limit'])) {
$grider .= '&limit=' . $params['limit'];
}
if (isset($params['type']) && Validate::IsName($params['type'])) {
$grider .= '&type=' . $params['type'];
}
if (isset($params['option']) && Validate::IsGenericName($params['option'])) {
$grider .= '&option=' . $params['option'];
}
if (isset($params['sort']) && Validate::IsName($params['sort'])) {
$grider .= '&sort=' . $params['sort'];
}
if (isset($params['dir']) && Validate::isSortDirection($params['dir'])) {
$grider .= '&dir=' . $params['dir'];
}
require_once _PS_ROOT_DIR_ . '/modules/' . $render . '/' . $render . '.php';
return call_user_func(array($render, 'hookGridEngine'), $params, $grider);
}
示例3: ajaxProcessSaveTabModulePreferences
public function ajaxProcessSaveTabModulePreferences()
{
$values = Tools::getValue('value_pref');
$module = Tools::getValue('module_pref');
if (Validate::isModuleName($module)) {
Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'tab_module_preference` WHERE `id_employee` = ' . (int) $this->id_employee . ' AND `module` = \'' . pSQL($module) . '\'');
if (is_array($values) && count($values)) {
foreach ($values as $value) {
Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'tab_module_preference` (`id_tab_module_preference`, `id_employee`, `id_tab`, `module`)
VALUES (NULL, ' . (int) $this->id_employee . ', ' . (int) $value . ', \'' . pSQL($module) . '\');');
}
}
}
die('OK');
}
示例4: ajaxProcessremoveSideBarModule
public function ajaxProcessremoveSideBarModule()
{
$result = array();
$pagemeta = Tools::getValue('pagemeta');
$hookname = Tools::getValue('hookname');
$hookexec_name = Tools::getValue('hookexec_name');
$module_name = Tools::getValue('module_name');
if ($module_name && Validate::isModuleName($module_name) && $hookexec_name && Validate::isHookName($hookexec_name)) {
$HookedModulesArr = OvicLayoutControl::getSideBarModulesByPage($pagemeta, $hookname, false);
$moduleHook = array();
$moduleHook[] = $module_name;
$moduleHook[] = $hookexec_name;
if ($HookedModulesArr && is_array($HookedModulesArr) && sizeof($HookedModulesArr)) {
$key = array_search($moduleHook, $HookedModulesArr);
unset($HookedModulesArr[$key]);
}
$HookedModulesArr = array_values($HookedModulesArr);
$result['status'] = OvicLayoutControl::registerSidebarModule($pagemeta, $hookname, Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
$result['msg'] = $this->l('Successful deletion');
}
Tools::clearCache();
die(Tools::jsonEncode($result));
}
示例5: ajaxProcessSaveDashConfig
public function ajaxProcessSaveDashConfig()
{
$return = array('has_errors' => false, 'errors' => array());
$module = Tools::getValue('module');
$hook = Tools::getValue('hook');
$configs = Tools::getValue('configs');
$params = array('date_from' => $this->context->employee->stats_date_from, 'date_to' => $this->context->employee->stats_date_to);
if (Validate::isModuleName($module) && ($module_obj = Module::getInstanceByName($module))) {
if (Validate::isLoadedObject($module_obj) && method_exists($module_obj, 'validateDashConfig')) {
$return['errors'] = $module_obj->validateDashConfig($configs);
}
if (!count($return['errors'])) {
if (Validate::isLoadedObject($module_obj) && method_exists($module_obj, 'saveDashConfig')) {
$return['has_errors'] = $module_obj->saveDashConfig($configs);
} elseif (is_array($configs) && count($configs)) {
foreach ($configs as $name => $value) {
if (Validate::isConfigName($name)) {
Configuration::updateValue($name, $value);
}
}
}
} else {
$return['has_errors'] = true;
}
}
if (Validate::isHookName($hook) && method_exists($module_obj, $hook)) {
$return['widget_html'] = $module_obj->{$hook}($params);
}
die(Tools::jsonEncode($return));
}
示例6: getContent
public function getContent()
{
if (Tools::isSubmit('submitModule')) {
Configuration::updateValue('PS_QUICK_VIEW', (int) Tools::getValue('quick_view'));
Configuration::updateValue('PS_TC_ACTIVE', (int) Tools::getValue('live_conf'));
Configuration::updateValue('PS_GRID_PRODUCT', (int) Tools::getValue('grid_list'));
Configuration::updateValue('PS_SET_DISPLAY_SUBCATEGORIES', (int) Tools::getValue('sub_cat'));
foreach ($this->getConfigurableModules() as $module) {
if (!isset($module['is_module']) || !$module['is_module'] || !Validate::isModuleName($module['name']) || !Tools::isSubmit($module['name'])) {
continue;
}
$module_instance = Module::getInstanceByName($module['name']);
if ($module_instance === false || !is_object($module_instance)) {
continue;
}
$is_installed = (int) Validate::isLoadedObject($module_instance);
if ($is_installed) {
if (($active = (int) Tools::getValue($module['name'])) == $module_instance->active) {
continue;
}
if ($active) {
$module_instance->enable();
} else {
$module_instance->disable();
}
} else {
if ((int) Tools::getValue($module['name'])) {
$module_instance->install();
}
}
}
}
if (Tools::isSubmit('newItem')) {
$this->addItem();
} elseif (Tools::isSubmit('updateItem')) {
$this->updateItem();
} elseif (Tools::isSubmit('removeItem')) {
$this->removeItem();
}
$html = $this->renderConfigurationForm();
$html .= $this->renderThemeConfiguratorForm();
return $html;
}
示例7: genericImportWS
public function genericImportWS($className, $fields, $save = false)
{
$return = '';
$json = array();
$errors = array();
$json['hasError'] = false;
$json['datas'] = array_values($fields);
$languages = array();
$defaultLanguage = '';
$table = $this->supportedImports[strtolower($className)]['table'];
$object = new $className();
$rules = call_user_func(array($className, 'getValidationRules'), $className);
if (sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrency')) {
$moduleName = Tools::getValue('moduleName');
if (Validate::isModuleName($moduleName) && file_exists('../../modules/' . $moduleName . '/' . $moduleName . '.php')) {
require_once '../../modules/' . $moduleName . '/' . $moduleName . '.php';
$importModule = new $moduleName();
$defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$languages = $importModule->getLangagues();
if (Tools::isSubmit('syncLangWS')) {
$defaultIdLand = $importModule->getDefaultIdLang();
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code) {
$errors[] = $this->l('Default language doesn\'t match : ') . '<br>' . Configuration::get('PS_SHOP_NAME') . ' : ' . $defaultLanguage->name . ' ≠
' . $importModule->displayName . ' : ' . $defaultLanguageImport->name . '<br>' . $this->l('Please change default language in your configuration');
}
}
if (Tools::isSubmit('syncCurrency')) {
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
$currencies = $importModule->getCurrencies();
if (!empty($currencies[$defaultIdCurrency]['iso_code'])) {
$defaultCurrencyImport = new Currency((int) Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code']));
} else {
$defaultCurrencyImport = new Currency((int) Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num']));
}
$defaultCurrency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code) {
$errors[] = $this->l('Default currency doesn\'t match : ') . '<br>' . Configuration::get('PS_SHOP_NAME') . ' : ' . $defaultCurrency->name . ' ≠ ' . $importModule->displayName . ' : ' . $defaultCurrencyImport->name . '<br>' . $this->l('Please change default currency in your configuration');
}
}
if (!empty($errors)) {
die('{"hasError" : true, "error" : ' . Tools::jsonEncode($errors) . '}');
}
} else {
die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}');
}
}
foreach ($fields as $key => $field) {
$id = $this->supportedImports[strtolower($className)]['identifier'];
//remove wrong fields (ex : id_toto in Customer)
foreach ($field as $name => $value) {
if (!array_key_exists($name, get_object_vars($object)) and $name != $id and $name != 'association' and $name != 'images' and strtolower($className) != 'cart') {
unset($field[$name]);
}
}
$return = $this->validateRules($rules, $field, $className, $languages, $defaultLanguage);
$fields[$key] = $field;
if (!empty($return)) {
//skip mode
if (Tools::getValue('hasErrors') == 1) {
unset($fields[$key]);
}
$errors[] = $return;
array_unshift($errors[sizeof($errors) - 1], $field[$id]);
}
}
if (sizeof($errors) > 0) {
$json['hasError'] = true;
$json['error'] = $errors;
}
if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) {
//add language if not exist in prestashop
if ($className == 'Language') {
if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) {
$add = true;
} else {
$add = false;
}
$errors = $this->checkAndAddLang($fields, $add);
} elseif ($className == 'Cart') {
$this->saveOrders($fields);
} else {
$return = $this->saveObject($className, $fields);
$this->cleanPositions($table);
//insert association
if (array_key_exists('association', $this->supportedImports[strtolower($className)])) {
$this->insertAssociation(strtolower($className), $fields);
}
if (!empty($return)) {
$json['hasError'] = true;
$json['error'] = $return;
}
}
if ($className == 'Category' and sizeof($fields) != (int) Tools::getValue('nbr_import')) {
$this->updateCat();
}
}
if (sizeof($errors) > 0 and is_array($errors)) {
$json['hasError'] = true;
$json['error'] = $errors;
//.........这里部分代码省略.........
示例8: getLanguageLink
/**
* Create link after language change, for the change language block
*
* @param integer $id_lang Language ID
* @return string link
*/
public function getLanguageLink($id_lang, Context $context = null)
{
if (!$context) {
$context = Context::getContext();
}
$params = $_GET;
unset($params['isolang'], $params['controller']);
if (!$this->allow) {
$params['id_lang'] = $id_lang;
} else {
unset($params['id_lang']);
}
$controller = Dispatcher::getInstance()->getController();
if (!empty(Context::getContext()->controller->php_self)) {
$controller = Context::getContext()->controller->php_self;
}
if ($controller == 'product' && isset($params['id_product'])) {
return $this->getProductLink((int) $params['id_product'], null, null, null, (int) $id_lang);
} elseif ($controller == 'category' && isset($params['id_category'])) {
return $this->getCategoryLink((int) $params['id_category'], null, (int) $id_lang);
} elseif ($controller == 'supplier' && isset($params['id_supplier'])) {
return $this->getSupplierLink((int) $params['id_supplier'], null, (int) $id_lang);
} elseif ($controller == 'manufacturer' && isset($params['id_manufacturer'])) {
return $this->getManufacturerLink((int) $params['id_manufacturer'], null, (int) $id_lang);
} elseif ($controller == 'cms' && isset($params['id_cms'])) {
return $this->getCMSLink((int) $params['id_cms'], null, false, (int) $id_lang);
} elseif ($controller == 'cms' && isset($params['id_cms_category'])) {
return $this->getCMSCategoryLink((int) $params['id_cms_category'], null, (int) $id_lang);
} elseif (isset($params['fc']) && $params['fc'] == 'module') {
$module = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
if (!empty($module)) {
unset($params['fc'], $params['module']);
return $this->getModuleLink($module, $controller, $params, null, (int) $id_lang);
}
}
return $this->getPageLink($controller, null, $id_lang, $params);
}
示例9: displayStats
public function displayStats()
{
$tpl = $this->createTemplate('stats.tpl');
if ((!($module_name = Tools::getValue('module')) || !Validate::isModuleName($module_name)) && ($module_instance = Module::getInstanceByName('statsforecast')) && $module_instance->active) {
$module_name = 'statsforecast';
}
if ($module_name) {
$_GET['module'] = $module_name;
if (!isset($module_instance)) {
$module_instance = Module::getInstanceByName($module_name);
}
if ($module_instance && $module_instance->active) {
$hook = Hook::exec('displayAdminStatsModules', null, $module_instance->id);
}
}
$tpl->assign(array('module_name' => $module_name, 'module_instance' => isset($module_instance) ? $module_instance : null, 'hook' => isset($hook) ? $hook : null));
return $tpl->fetch();
}
示例10: submitTranslationsMails
/**
* This method is used to wright translation for mails.
* This wrights subject translation files
* (in root/mails/lang_choosen/lang.php or root/_PS_THEMES_DIR_/mails/lang_choosen/lang.php)
* and mails files.
*/
protected function submitTranslationsMails()
{
$arr_mail_content = array();
$arr_mail_path = array();
if (Tools::getValue('core_mail')) {
$arr_mail_content['core_mail'] = Tools::getValue('core_mail');
// Get path of directory for find a good path of translation file
if ($this->theme_selected != self::DEFAULT_THEME_NAME) {
$arr_mail_path['core_mail'] = $this->translations_informations[$this->type_selected]['override']['dir'];
} else {
$arr_mail_path['core_mail'] = $this->translations_informations[$this->type_selected]['dir'];
}
}
if (Tools::getValue('module_mail')) {
$arr_mail_content['module_mail'] = Tools::getValue('module_mail');
// Get path of directory for find a good path of translation file
if ($this->theme_selected != self::DEFAULT_THEME_NAME) {
$arr_mail_path['module_mail'] = $this->translations_informations['modules']['override']['dir'] . '{module}/mails/' . $this->lang_selected->iso_code . '/';
} else {
$arr_mail_path['module_mail'] = $this->translations_informations['modules']['dir'] . '{module}/mails/' . $this->lang_selected->iso_code . '/';
}
}
// Save each mail content
foreach ($arr_mail_content as $group_name => $all_content) {
foreach ($all_content as $type_content => $mails) {
foreach ($mails as $mail_name => $content) {
$module_name = false;
$module_name_pipe_pos = stripos($mail_name, '|');
if ($module_name_pipe_pos) {
$module_name = substr($mail_name, 0, $module_name_pipe_pos);
if (!Validate::isModuleName($module_name)) {
throw new PrestaShopException(sprinf(Tools::displayError('Invalid module name "%s"'), $module_name));
}
$mail_name = substr($mail_name, $module_name_pipe_pos + 1);
if (!Validate::isTplName($mail_name)) {
throw new PrestaShopException(sprintf(Tools::displayError('Invalid mail name "%s"'), $mail_name));
}
}
if ($type_content == 'html') {
$content = Tools::htmlentitiesUTF8($content);
$content = htmlspecialchars_decode($content);
// replace correct end of line
$content = str_replace("\r\n", PHP_EOL, $content);
$title = '';
if (Tools::getValue('title_' . $group_name . '_' . $mail_name)) {
$title = Tools::getValue('title_' . $group_name . '_' . $mail_name);
}
$string_mail = $this->getMailPattern();
$content = str_replace(array('#title', '#content'), array($title, $content), $string_mail);
// Magic Quotes shall... not.. PASS!
if (_PS_MAGIC_QUOTES_GPC_) {
$content = stripslashes($content);
}
}
if (Validate::isCleanHTML($content)) {
$path = $arr_mail_path[$group_name];
if ($module_name) {
$path = str_replace('{module}', $module_name, $path);
}
file_put_contents($path . $mail_name . '.' . $type_content, $content);
} else {
throw new PrestaShopException(Tools::displayError('HTML e-mail templates cannot contain JavaScript code.'));
}
}
}
}
// Update subjects
$array_subjects = array();
if (($subjects = Tools::getValue('subject')) && is_array($subjects)) {
$array_subjects['core_and_modules'] = array('translations' => array(), 'path' => $arr_mail_path['core_mail'] . 'lang.php');
foreach ($subjects as $subject_translation) {
$array_subjects['core_and_modules']['translations'] = array_merge($array_subjects['core_and_modules']['translations'], $subject_translation);
}
}
if (!empty($array_subjects)) {
foreach ($array_subjects as $infos) {
$this->writeSubjectTranslationFile($infos['translations'], $infos['path']);
}
}
if (Tools::isSubmit('submitTranslationsMailsAndStay')) {
$this->redirect(true);
} else {
$this->redirect();
}
}
示例11: processSave
public function processSave()
{
$id = Tools::getValue('block_identifier');
if (Validate::isModuleName($id)) {
return parent::processSave();
}
$this->errors[] = Tools::displayError('The field "block_identifier" is invalid. Allowed characters:') . ' a-z, A-Z, 0-9, _';
$this->display = 'edit';
return FALSE;
}
示例12: postProcess
public function postProcess()
{
// If id_order is sent, we instanciate a new Order object
if (Tools::isSubmit('id_order') && Tools::getValue('id_order') > 0) {
$order = new Order(Tools::getValue('id_order'));
if (!Validate::isLoadedObject($order)) {
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
}
ShopUrl::cacheMainDomainForShop((int) $order->id_shop);
}
/* Update shipping number */
if (Tools::isSubmit('submitAddOrder') && ($id_cart = Tools::getValue('id_cart')) && ($module_name = Tools::getValue('payment_module_name')) && ($id_order_state = Tools::getValue('id_order_state')) && Validate::isModuleName($module_name)) {
if ($this->tabAccess['edit'] === '1') {
if (!Configuration::get('PS_CATALOG_MODE')) {
$payment_module = Module::getInstanceByName($module_name);
} else {
$payment_module = new BoOrder();
}
$cart = new Cart((int) $id_cart);
Context::getContext()->currency = new Currency((int) $cart->id_currency);
Context::getContext()->customer = new Customer((int) $cart->id_customer);
$bad_delivery = false;
if (($bad_delivery = (bool) (!Address::isCountryActiveById((int) $cart->id_address_delivery))) || !Address::isCountryActiveById((int) $cart->id_address_invoice)) {
if ($bad_delivery) {
$this->errors[] = Tools::displayError('This delivery address country is not active.');
} else {
$this->errors[] = Tools::displayError('This invoice address country is not active.');
}
} else {
$employee = new Employee((int) Context::getContext()->cookie->id_employee);
$payment_module->validateOrder((int) $cart->id, (int) $id_order_state, $cart->getOrderTotal(true, Cart::BOTH), $payment_module->displayName, $this->l('Manual order -- Employee:') . ' ' . substr($employee->firstname, 0, 1) . '. ' . $employee->lastname, array(), null, false, $cart->secure_key);
if ($payment_module->currentOrder) {
Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $payment_module->currentOrder . '&vieworder' . '&token=' . $this->token);
}
}
} else {
$this->errors[] = Tools::displayError('You do not have permission to add this.');
}
} else {
parent::postProcess();
}
}
示例13: getModulesDirOnDisk
/**
* Return modules directory list
*
* @return array Modules Directory List
*/
public static function getModulesDirOnDisk()
{
$module_list = array();
$modules = scandir(_PS_MODULE_DIR_);
foreach ($modules as $name) {
if (is_file(_PS_MODULE_DIR_ . $name)) {
continue;
} elseif (is_dir(_PS_MODULE_DIR_ . $name . DIRECTORY_SEPARATOR) && Tools::file_exists_cache(_PS_MODULE_DIR_ . $name . '/' . $name . '.php')) {
if (!Validate::isModuleName($name)) {
throw new PrestaShopException(sprintf('Module %s is not a valid module name', $name));
}
$module_list[] = $name;
}
}
return $module_list;
}
示例14: hookdisplayOvicCategorySizeChart
public function hookdisplayOvicCategorySizeChart($params)
{
$module_name = '';
if (Validate::isModuleName(Tools::getValue('module'))) {
$module_name = Tools::getValue('module');
}
if (!empty($this->context->controller->php_self)) {
$page_name = $this->context->controller->php_self;
} elseif (Tools::getValue('fc') == 'module' && $module_name != '' && Module::getInstanceByName($module_name) instanceof PaymentModule) {
$page_name = 'module-payment-submit';
} elseif (preg_match('#^' . preg_quote($this->context->shop->physical_uri, '#') . 'modules/([a-zA-Z0-9_-]+?)/(.*)$#', $_SERVER['REQUEST_URI'], $m)) {
$page_name = 'module-' . $m[1] . '-' . str_replace(array('.php', '/'), array('', '-'), $m[2]);
} else {
$page_name = Dispatcher::getInstance()->getController();
$page_name = preg_match('/^[0-9]/', $page_name) ? 'page_' . $page_name : $page_name;
}
if (strlen($page_name) <= 0) {
return '';
}
if ($page_name == 'category') {
$id_category = (int) Tools::getValue('id_category');
} elseif ($page_name == 'product') {
$id_product = (int) Tools::getValue('id_product');
$product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
$id_category = $product->id_category_default;
}
if (!isset($id_category) or is_null($id_category)) {
return;
}
$sizecharts = $this->getSizechart(true, $id_category);
$check_sizechart = true;
if (!$sizecharts && count($sizecharts) < 1) {
$check_sizechart = false;
}
if ($page_name == 'category' || $page_name == 'product') {
$this->smarty->assign('category_sizechart', $sizecharts);
} else {
return;
}
if (!$check_sizechart) {
return;
}
// Check if not a mobile theme
if ($this->context->getMobileDevice() != false) {
return false;
}
return $this->display(__FILE__, 'oviccategorysizechart.tpl');
}
示例15: ajaxProcessremoveModuleHook
/**
* remove a module from a hook
*/
public function ajaxProcessremoveModuleHook()
{
$result = array();
$hookname = Tools::getValue('hookname');
$id_option = (int) Tools::getValue('id_option');
$option = new Options($id_option);
$hookexec_name = Tools::getValue('hookexec_name');
$module_name = Tools::getValue('module_name');
if ($option && Validate::isLoadedObject($option) && $module_name && Validate::isModuleName($module_name) && $hookname && Validate::isHookName($hookname) && $hookexec_name && Validate::isHookName($hookexec_name)) {
$HookedModulesArr = OvicLayoutControl::getModulesHook($option->theme, $option->alias, $hookname);
$HookedModulesArr = Tools::jsonDecode($HookedModulesArr['modules'], true);
$HookedModulesArr = array_values($HookedModulesArr);
$moduleHook = array();
$moduleHook[] = $module_name;
$moduleHook[] = $hookexec_name;
if ($HookedModulesArr && is_array($HookedModulesArr) && sizeof($HookedModulesArr)) {
$key = array_search($moduleHook, $HookedModulesArr);
unset($HookedModulesArr[$key]);
}
$HookedModulesArr = array_values($HookedModulesArr);
$result['status'] = OvicLayoutControl::registerHookModule($option, $hookname, Tools::jsonEncode($HookedModulesArr), $this->context->shop->id);
$result['msg'] = $this->l('Successful deletion');
//$this->displayError
}
Tools::clearCache();
die(Tools::jsonEncode($result));
}