本文整理汇总了PHP中Configuration::hasKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::hasKey方法的具体用法?PHP Configuration::hasKey怎么用?PHP Configuration::hasKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::hasKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasKey
public static function hasKey($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
{
ConfigurationKPI::setKpiDefinition();
$r = parent::hasKey($key, $id_lang, $id_shop_group, $id_shop);
ConfigurationKPI::unsetKpiDefinition();
return $r;
}
示例2: upgrade_module_0_2
function upgrade_module_0_2($module)
{
/*
* new setting, select the oordre state were ordre is ok.!
* Validate the current order state
*/
$payment_states_accepted = (int) Configuration::get('SWIPP_PAYMENT_STATE');
if ($payment_states_accepted !== NULL && $payment_states_accepted !== FALSE) {
$_test_order_state = new OrderState((int) $payment_states_accepted);
if ($_test_order_state->id != $payment_states_accepted || $_test_order_state->deleted) {
/* bad status..., deleted or id has changed */
$payment_states_accepted = Configuration::get('PS_OS_PAYMENT');
} else {
$payment_states_accepted .= "," . Configuration::get('PS_OS_PAYMENT');
}
} else {
$payment_states_accepted = "," . Configuration::get('PS_OS_PAYMENT');
}
if (Configuration::hasKey('PS_OS_OUTOFSTOCK_UNPAID')) {
$payment_states_accepted .= "," . Configuration::get('PS_OS_OUTOFSTOCK_UNPAID');
}
if (Configuration::hasKey('PS_OS_OUTOFSTOCK')) {
$payment_states_accepted .= "," . Configuration::get('PS_OS_OUTOFSTOCK');
}
Configuration::updateValue('SWIPP_ORDER_STATES', $payment_states_accepted);
return $module->registerHook('displayPaymentEU');
}
示例3: initContent
public function initContent()
{
if (!Configuration::hasKey('ERP_LICENCE') || Configuration::get('ERP_LICENCE') == '') {
$this->warnings[] = '<a href="?controller=AdminModules&configure=erpillicopresta&token=' . Tools::getAdminTokenLite('AdminModules') . '">' . $this->l('Your license has not been validated yet, please go to your module configuration page to validate it.') . '</a>';
} elseif (Configuration::get('ERP_BLACKLIST') == '1') {
$this->errors[] = sprintf($this->l('Your license is blacklisted, please contact our technical support to this email: %s .'), ERP_EMAIL_SUPPORT);
} elseif (Configuration::get('ERP_LICENCE_VALIDITY') == '0') {
$this->errors[] = sprintf($this->l('Your license number is not valid, please contact our technical support to this mail adress: %s.'), ERP_EMAIL_SUPPORT);
} else {
$link_conf = '<br/><a href="?controller=AdminModules&configure=erpillicopresta&token=' . Tools::getAdminTokenLite('AdminModules') . '">' . $this->l('Go to your back-office, module tab, page 1-Click ERP.') . '</a>';
$this->informations[] = $this->l('Win up to 2hours a day in your store management with 1-Click ERP! Optimise your module in your Back-Office, Module tab, Page 1-Click ERP!') . $link_conf;
}
parent::initContent();
}
示例4: getFormBeforeActivation
public function getFormBeforeActivation()
{
$fields_form = array();
// create a new licence
if (!Configuration::hasKey('ERP_NEW_LICENCE') || Configuration::get('ERP_NEW_LICENCE') == '') {
$uniqid = uniqid(Configuration::get('PS_SHOP_DOMAIN'), true);
Configuration::updateValue('ERP_NEW_LICENCE', $uniqid);
}
// generate a new domaine name if is developper
if (!Configuration::hasKey('ERP_LICENCE_DOMAINE_GENERATE') || Configuration::get('ERP_LICENCE_DOMAINE_GENERATE') == '') {
// domaine name is a local domaine
if (self::isDevelopper()) {
$uniqid = uniqid(Configuration::get('PS_SHOP_DOMAIN') . '@@', true);
Configuration::updateValue('ERP_LICENCE_DOMAINE_GENERATE', $uniqid);
} else {
Configuration::updateValue('ERP_LICENCE_DOMAINE_GENERATE', Configuration::get('PS_SHOP_DOMAIN'));
}
}
// get default forcast orders
if (Configuration::get('ERP_COMMANDE_PREVISIONNEL') == '') {
Configuration::updateValue('ERP_COMMANDE_PREVISIONNEL', $this->getDefaultForcastOrders());
}
// hidden field to send the licence type : normal or developper
$fields_form[1]['form']['input'][] = array('type' => 'hidden', 'name' => 'erp_licence_is_free');
// hidden field to send the action type
$fields_form[1]['form']['input'][] = array('type' => 'hidden', 'name' => 'submitCreateNewLicence');
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Licence number'), 'name' => 'erp_new_licence', 'size' => 100, 'desc' => $this->l('This is your auto-generated license number'), 'required' => 'required', 'disabled' => true);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Licence password'), 'name' => 'erp_licence_password', 'size' => 100, 'desc' => $this->l('Please choose a password for your license'), 'required' => true, 'disabled' => false);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Domaine name'), 'name' => 'erp_licence_domaine_name', 'cast' => 'intval', 'required' => true, 'disabled' => false, 'readonly' => true, 'size' => 100, 'hint' => self::isDevelopper() ? $this->l('Your store is currently installed on a local environment, so your domain name has been automaticly generated. You could later ask for a free migration of your license on a real store.') : null, 'desc' => self::isDevelopper() ? $this->l('Your store is currently installed on a local environment. You will later be able to ask for a free transfer of your license to your actual store.') : null);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('E-shop email (licence email)'), 'name' => 'erp_licence_mail', 'size' => 100, 'required' => true, 'disabled' => true);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Contact email'), 'name' => 'erp_contact_mail', 'size' => 100, 'required' => true, 'disabled' => Configuration::get('ERP_LICENCE_VALIDITY') == '1' ? true : false);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Last Name'), 'name' => 'erp_contact_name', 'size' => 100, 'required' => true, 'disabled' => Configuration::get('ERP_LICENCE_VALIDITY') == '1' ? true : false);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('First Name'), 'name' => 'erp_contact_firstname', 'size' => 100, 'required' => false, 'disabled' => Configuration::get('ERP_LICENCE_VALIDITY') == '1' ? true : false);
$fields_form[1]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Partner code'), 'name' => 'erp_partner_code', 'size' => 100, 'required' => false, 'disabled' => Configuration::get('ERP_LICENCE_VALIDITY') == '1' ? true : false);
$fields_form[1]['form']['input'][] = array('type' => 'select', 'label' => $this->l('Average number of orders per month'), 'name' => 'erp_commande_previsionnel', 'required' => false, 'options' => array('query' => array(array('Id' => '0-100', 'Value' => '0-100'), array('Id' => '100-200', 'Value' => '100-200'), array('Id' => '200-300', 'Value' => '200-300'), array('Id' => '300-500', 'Value' => '300-500'), array('Id' => '500-1000', 'Value' => '500-1000'), array('Id' => '1000-2000', 'Value' => '1000-2000'), array('Id' => '2000+', 'Value' => '2000+')), 'id' => 'Id', 'name' => 'Value'), 'disabled' => false);
$fields_form[1]['form']['input'][] = array('type' => 'select', 'label' => $this->l('How do you known us?'), 'name' => 'erp_knowledge_source', 'required' => false, 'options' => array('query' => $this->erpLicence->getKnowledgeSource(), 'id' => 'Id', 'name' => 'Value'), 'disabled' => Configuration::get('ERP_LICENCE_VALIDITY') == '1' ? true : false);
// values to input cgv
$erp_cgv[] = array('id' => 'erp_cgv', 'name' => '');
$url_cgu = ERP_URL_CGU_EN;
if ($this->context->language->iso_code == 'fr') {
$url_cgu = ERP_URL_CGU_FR;
}
$fields_form[1]['form']['input'][] = array('type' => 'checkbox', 'label' => $this->l('GTU'), 'name' => '', 'values' => array('query' => $erp_cgv, 'id' => 'id', 'name' => 'name'), 'desc' => $this->l('Please agree to our ') . ' <a href="' . $url_cgu . '" target="_blank" >' . $this->l(' General Terms Of Use.') . '</a>', 'required' => true);
// values to newsletter cgv
$erp_newsletter[] = array('id' => 'erp_newsletter', 'name' => '');
$fields_form[1]['form']['input'][] = array('type' => 'checkbox', 'label' => $this->l('Newsletter'), 'name' => '', 'required' => false, 'values' => array('query' => $erp_newsletter, 'id' => 'id', 'name' => 'name'), 'desc' => $this->l('Subscribe to our newsletter and keep aware about improvements and offers.'));
$html = '<div style="font-size:1.2em">' . $this->l('Back up your comments and needs for future developments?') . '<br/>' . $this->l('Write an email to ') . '<a href="mailto:commercial@illicopresta.com">commercial@illicopresta.com</a>' . '</div>';
$fields_form[1]['form']['input'][] = array('type' => '', 'name' => '', 'required' => false, 'values' => array(), 'desc' => $html);
return $fields_form;
}
示例5: install
public function install()
{
if (!parent::install() || !$this->registerHook('displayPayment') || !$this->registerHook('displayPaymentReturn')) {
return false;
}
$db = Db::getInstance();
// Cria a tabela de cadastro de cep
$sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'redekomerci01` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`ativa_visa` int(1),
`Visa` varchar(30),
`ativa_master` int(1),
`Mastercard` varchar(30),
`ativa_diners` int(1),
`Diners Club` varchar(30),
`ativa_hiper` int(1),
`Hiper` varchar(30),
`ativa_hipercard` int(1),
`Hipercard` varchar(30),
PRIMARY KEY (`id`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;';
$db->Execute($sql);
if (!Configuration::hasKey('ativa_visa')) {
Configuration::updateValue('ativa_visa', '0');
}
if (!Configuration::hasKey('ativa_master')) {
Configuration::updateValue('ativa_master', '0');
}
if (!Configuration::hasKey('ativa_diners')) {
Configuration::updateValue('ativa_diners', '0');
}
if (!Configuration::hasKey('ativa_hipercard')) {
Configuration::updateValue('ativa_hipercard', '0');
}
if (!Configuration::hasKey('ativa_hiper')) {
Configuration::updateValue('ativa_hiper', '0');
}
return true;
}
示例6: initContent
public function initContent()
{
if ($this->display == 'list') {
$this->display = '';
}
if (isset($this->display) && method_exists($this, 'render' . $this->display)) {
$this->content .= $this->initPageHeaderToolbar();
$this->content .= $this->{'render' . $this->display}();
$this->context->smarty->assign(array('content' => $this->content, 'show_page_header_toolbar' => $this->show_page_header_toolbar, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
} else {
$themes = array();
foreach (Theme::getThemes() as $theme) {
$themes[] = $theme->directory;
}
foreach (scandir(_PS_ALL_THEMES_DIR_) as $theme_dir) {
if ($theme_dir[0] != '.' && Validate::isDirName($theme_dir) && is_dir(_PS_ALL_THEMES_DIR_ . $theme_dir) && file_exists(_PS_ALL_THEMES_DIR_ . $theme_dir . '/preview.jpg') && !in_array($theme_dir, $themes)) {
$config_file = false;
$default_config = _PS_ROOT_DIR_ . '/config/xml/themes/default.xml';
$theme_config = _PS_ROOT_DIR_ . '/config/xml/themes/' . $theme_dir . '.xml';
if (file_exists($theme_config)) {
$config_file = $theme_config;
} elseif (file_exists($default_config)) {
$config_file = $default_config;
}
if ($config_file) {
$this->importThemeXmlConfig(simplexml_load_file($config_file), $theme_dir);
}
}
}
$content = '';
if (Configuration::hasKey('PS_LOGO') && trim(Configuration::get('PS_LOGO')) != '' && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'))) {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'));
Configuration::updateValue('SHOP_LOGO_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_WIDTH', (int) round($width));
}
if (file_exists(_PS_IMG_DIR_ . 'logo_mobile.jpg') && Configuration::get('PS_LOGO_MOBILE') && trim(Configuration::get('PS_LOGO_MOBILE')) != '') {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE'));
Configuration::updateValue('SHOP_LOGO_MOBILE_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_MOBILE_WIDTH', (int) round($width));
}
$this->content .= $content;
return parent::initContent();
}
}
示例7: hasContext
/**
* Check if configuration var is defined in given context
*
* @param string $key
* @param int $id_lang
* @param int $context
*/
public static function hasContext($key, $id_lang, $context)
{
if (Shop::getContext() == Shop::CONTEXT_ALL) {
$id_shop = $id_shop_group = null;
} elseif (Shop::getContext() == Shop::CONTEXT_GROUP) {
$id_shop_group = Shop::getContextShopGroupID(true);
$id_shop = null;
} else {
$id_shop_group = Shop::getContextShopGroupID(true);
$id_shop = Shop::getContextShopID(true);
}
if ($context == Shop::CONTEXT_SHOP && Configuration::hasKey($key, $id_lang, null, $id_shop)) {
return true;
} elseif ($context == Shop::CONTEXT_GROUP && Configuration::hasKey($key, $id_lang, $id_shop_group)) {
return true;
} elseif ($context == Shop::CONTEXT_ALL && Configuration::hasKey($key, $id_lang)) {
return true;
}
return false;
}
示例8: getConfigValue
public function getConfigValue($key, $value = null)
{
return Configuration::hasKey($this->renderName($key)) ? Configuration::get($this->renderName($key)) : $value;
}
示例9: renderForm
/**
* build the admin configuration form
* @return string
*/
public function renderForm()
{
// get currencies in this shop
$_currencies = self::__getCurrencies();
$currencies = array();
$danishKroneName = 'Danish Krone (Kr.)';
foreach ($_currencies as $currenciesK => $currenciesV) {
if ((int) $currenciesV->iso_code_num == 208 || strtoupper($currenciesV->iso_code) == 'DKK') {
$danishKroneName = $currenciesV->name . ' (' . $currenciesV->iso_code . ')';
continue;
}
$currencies[] = array('id' => $currenciesV->id, 'name' => $currenciesV->name . '(' . $currenciesV->iso_code . ' : ' . $currenciesV->sign . ')', 'val' => $currenciesV->id);
}
unset($_currencies);
// all order states
$orderStates = OrderState::getOrderStates($this->context->language->id);
$order_state = $selected_order_states = array();
if (Configuration::hasKey('SWIPP_ORDER_STATES')) {
$selected_order_states = explode(',', Configuration::get('SWIPP_ORDER_STATES'));
}
foreach ($orderStates as $orderState) {
if (in_array($orderState['id_order_state'], $selected_order_states)) {
$order_state[] = array('selected' => true, 'disabled' => false, 'id_category' => $orderState['id_order_state'], 'name' => $orderState['name']);
} else {
$order_state[] = array('disabled' => false, 'id_category' => $orderState['id_order_state'], 'name' => $orderState['name']);
}
}
$tree = new Tree('swipp-order-state', $order_state);
//$tree->setTemplateDirectory(dirname(__FILE__) . '/views/templates/admin/_configure/helpers/tree/');
$tree->setNodeItemTemplate('../../../../../../modules/swipp/views/templates/admin/tree_node_item_order_state.tpl');
$tree->setContext($this->context);
$tree->getContext()->smarty->assign(array('input_name' => 'SWIPP_ORDER_STATES'));
$fields_form[0]['form']['legend'] = array('title' => $this->l('Swipp details'), 'icon' => 'icon-credit-card');
$fields_form[0]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Swipp owner/user'), 'name' => 'SWIPP_OWNER');
$fields_form[0]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Swipp Phone'), 'name' => 'SWIPP_PHONE', 'desc' => $this->l('The phone registred with swipp'));
$fields_form[0]['form']['input'][] = array('type' => 'text', 'label' => $this->l('Swipp Max Payment'), 'name' => 'SWIPP_MAX_AMOUNT', 'desc' => $this->l('The maximum amount allowed through swipp per order'), 'prefix' => $danishKroneName);
if (count($currencies) > 0) {
$fields_form[0]['form']['input'][] = array('type' => 'checkbox', 'label' => $this->l('Currencies witch we allow'), 'name' => 'SWIPP_CURRENCIES', 'desc' => $this->l('The currencies you select here will have the swipp payment option available but with the paymant amount converted to Danish Krone'), 'values' => array('query' => $currencies, 'id' => 'id', 'name' => 'name'), 'class' => 't');
}
$fields_form[0]['form']['input'][] = array('name' => 'SWIPP_ORDER_STATES', 'type' => 'categories_select', 'label' => $this->l('Accepted Order state'), 'category_tree' => $tree->render(), 'required' => true, 'desc' => $this->l('Order states where swipp payment is accepted'));
$fields_form[0]['form']['input'][] = array('name' => 'SWIPP_PAYMENT_STATE', 'type' => 'select', 'label' => $this->l('Status of payment when order is placed'), 'options' => array('default' => array('value' => 0, 'label' => $this->l('Choose status')), 'query' => $order_state, 'id' => 'id_category', 'name' => 'name'), 'required' => true, 'desc' => $this->l('The status the order is set to when the customer clicks the accept button.'));
$fields_form[0]['form']['input'][] = array('type' => 'switch', 'is_bool' => true, 'label' => $this->l('Show converted order amount on payment option'), 'name' => 'SWIPP_SHOW_CONVERTED', 'desc' => $this->l('Only usefull if you use multiple currencies'), 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('No'))));
$fields_form[0]['form']['input'][] = array('type' => 'switch', 'is_bool' => true, 'label' => $this->l('Show message on invoice'), 'name' => 'SWIPP_SHOW_INVIOCE', 'desc' => $this->l('Only usefull if you use multiple currencies'), 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('No'))));
$fields_form[0]['form']['submit'] = array('title' => $this->l('Save'));
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$this->fields_form = array();
$helper->id = (int) Tools::getValue('id_carrier');
$helper->identifier = $this->identifier;
$helper->submit_action = 'btnSubmit';
$helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues(), 'id_language' => $this->context->language->id);
return $helper->generateForm($fields_form);
}
示例10: initContent
public function initContent()
{
if ($this->display == 'list') {
$this->display = '';
}
if (isset($this->display) && method_exists($this, 'render' . $this->display)) {
$this->content .= $this->initPageHeaderToolbar();
$this->content .= $this->{'render' . $this->display}();
$this->context->smarty->assign(array('content' => $this->content, 'show_page_header_toolbar' => $this->show_page_header_toolbar, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
} else {
$content = '';
if (Configuration::hasKey('PS_LOGO') && trim(Configuration::get('PS_LOGO')) != '' && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO')) && filesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'))) {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO'));
Configuration::updateValue('SHOP_LOGO_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_WIDTH', (int) round($width));
}
if (Configuration::get('PS_LOGO_MOBILE') && trim(Configuration::get('PS_LOGO_MOBILE')) != '' && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE')) && filesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE'))) {
list($width, $height, $type, $attr) = getimagesize(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_MOBILE'));
Configuration::updateValue('SHOP_LOGO_MOBILE_HEIGHT', (int) round($height));
Configuration::updateValue('SHOP_LOGO_MOBILE_WIDTH', (int) round($width));
}
$this->content .= $content;
return parent::initContent();
}
}
示例11: doAfterFirstIntallV3
public function doAfterFirstIntallV3()
{
// first install if this conf does not exit
if (!Configuration::hasKey('ERP_FIRST_INSTALL_DATE') || Configuration::get('ERP_FIRST_INSTALL_DATE') == '' || Configuration::get('ERP_FIRST_INSTALL_DATE') == false) {
$this->loadLicenceIfExists();
Configuration::updateValue('ERP_FIRST_INSTALL_DATE', date("Y-m-d H:i:s"));
}
}
示例12: getConfigFieldsValue
public function getConfigFieldsValue($f)
{
$languages = Language::getLanguages(false);
$fields_values = array();
foreach ($f['form']['input'] as $input) {
$field = 'PTS_CP_' . Tools::strtoupper(trim($input['name']));
if (isset($input['lang'])) {
foreach ($languages as $lang) {
$values = Tools::getValue($input['name'] . '_' . $lang['id_lang'], Configuration::hasKey($field, $this->context->language->id) ? Configuration::get($field, $lang['id_lang']) : $input['default']);
$fields_values[$input['name']][$lang['id_lang']] = $values;
}
} else {
$values = Tools::getValue($input['name'], Configuration::hasKey($field) ? Configuration::get($field) : (isset($input['default']) ? $input['default'] : ''));
$fields_values[$input['name']] = $values;
}
}
return $fields_values;
}
示例13: getContent
/**
* BO main function
*
* @return string Html
*/
public function getContent()
{
// Web site id verification for older version
if (!$this->oPrediggoConfig->web_site_id_checked && !Configuration::hasKey('PREDIGGO_WEB_SITE_ID_CHECKED')) {
$this->checkWebSiteId();
}
if (count($_POST)) {
$this->_postProcess();
}
// Check Intermediary Database
$this->checkModuleConstraints();
// Display forms
$this->_displayForm();
return $this->_html;
}
示例14: install
public function install()
{
set_time_limit(0);
if (version_compare(phpversion(), '5.3', '<')) {
$this->_errors[] = sprintf($this->l('Requres PHP version %s or above. Currently running PHP %s version.'), '5.3', phpversion());
return false;
}
psmHelperIntegrate(array($this->name));
Tools::deleteFile(_PS_ROOT_DIR_ . '/classes/PP.php');
if (!psmIntegrateCore($this, dirname(__FILE__) . '/psm.php', $this->_errors) || !psmIntegrateCore($this, dirname(__FILE__) . '/PP.php', $this->_errors, 'PP_VERSION[')) {
return false;
}
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
$setup = $this->setupInstance();
$setup->cleanupOverriddenFiles();
if (!parent::install() || !$setup->installAdminTab('AdminPproperties')) {
return false;
}
if (!$this->registerHook('displayNav') || !$this->registerHook('displayHeader') || !$this->registerHook('displayFooter') || !$this->registerHook('displayProductPriceBlock') || !$this->registerHook('displayPpropertiesProduct') || !$this->registerHook('displayBackOfficeHeader') || !$this->registerHook('displayAdminProductsExtra') || !$this->registerHook('displayProductsListLeadin') || !$this->registerHook('actionModuleInstallAfter') || !$this->registerHook('actionModuleUpgradeAfter') || !$this->registerHook('actionProductAdd') || !$this->registerHook('actionProductUpdate') || !$this->registerHook('actionProductDelete') || !$this->registerHook('actionProductAttributeDelete') || !$this->registerHook('actionObjectCombinationDeleteAfter')) {
return false;
}
if ((int) Configuration::get('PP_MEASUREMENT_SYSTEM') == 0) {
$w = Configuration::get('PS_WEIGHT_UNIT');
Configuration::updateValue('PP_MEASUREMENT_SYSTEM', Tools::strtolower($w) == 'lb' ? 2 : 1);
}
if (!Configuration::hasKey('PP_POWEREDBY')) {
Configuration::updateValue('PP_POWEREDBY', 1);
}
if (!Configuration::hasKey('PP_TEMPLATE_NAME_IN_CATALOG')) {
Configuration::updateValue('PP_TEMPLATE_NAME_IN_CATALOG', 1);
}
Configuration::updateValue('PP_INSTALL_TIME', time());
$setup->install();
Configuration::deleteByName('PP_LAST_VERSION');
Configuration::updateValue('PP_VERSION', $this->version);
psmClearCache();
return true;
}
示例15: getConfigFieldsValues
/**
* Retrieve configuration values from database
* @return array
*/
public function getConfigFieldsValues()
{
$output = array();
$field_types = $this->getPstFieldTypes();
foreach ($this->getPstConfig() as $key => $fieldset_data) {
foreach ($fieldset_data['fields'] as $field_name => $data) {
$field_name = strtoupper($field_name);
if ($field_types[$data['type']]['is_multi_lang']) {
$default_value = array();
foreach (Language::getLanguages(false) as $lang) {
if (Configuration::hasKey($field_name, $lang['id_lang'])) {
$default_value[$lang['id_lang']] = Configuration::get($field_name, $lang['id_lang']);
} else {
$default_value[$lang['id_lang']] = $data['default_value'];
}
}
} else {
if (Configuration::hasKey($field_name)) {
$default_value = Configuration::get($field_name);
} else {
$default_value = $data['default_value'];
}
}
$output[strtolower($field_name)] = $default_value;
}
}
return $output;
}