本文整理汇总了PHP中Configuration::updateValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::updateValue方法的具体用法?PHP Configuration::updateValue怎么用?PHP Configuration::updateValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration::updateValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
public function getContent()
{
// If we try to update the settings
$output = '';
if (isset($_POST['submitModule'])) {
Configuration::updateValue('blocksocial_facebook', $_POST['facebook_url'] != '' ? $_POST['facebook_url'] : '');
Configuration::updateValue('blocksocial_twitter', $_POST['twitter_url'] != '' ? $_POST['twitter_url'] : '');
Configuration::updateValue('blocksocial_rss', $_POST['rss_url'] != '' ? $_POST['rss_url'] : '');
$output = '<div class="conf confirm">' . $this->l('Configuration updated') . '</div>';
}
return '
<h2>' . $this->displayName . '</h2>
' . $output . '
<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
<fieldset class="width2">
<label for="facebook_url">' . $this->l('Facebook URL: ') . '</label>
<input type="text" id="facebook_url" name="facebook_url" value="' . Tools::safeOutput(Configuration::get('blocksocial_facebook') != "" ? Configuration::get('blocksocial_facebook') : "") . '" />
<div class="clear"> </div>
<label for="twitter_url">' . $this->l('Twitter URL: ') . '</label>
<input type="text" id="twitter_url" name="twitter_url" value="' . Tools::safeOutput(Configuration::get('blocksocial_twitter') != "" ? Configuration::get('blocksocial_twitter') : "") . '" />
<div class="clear"> </div>
<label for="rss_url">' . $this->l('RSS URL: ') . '</label>
<input type="text" id="rss_url" name="rss_url" value="' . Tools::safeOutput(Configuration::get('blocksocial_rss') != "" ? Configuration::get('blocksocial_rss') : "") . '" />
<div class="clear"> </div>
<br /><center><input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
</fieldset>
</form>';
}
示例2: install
public function install()
{
if (parent::install() == false or $this->registerHook('header') == false or $this->registerHook('footer') == false or Configuration::updateValue('BLANK_FONT', 'Almelo') == false or Configuration::updateValue('BLANK_COLOUR', 'white') == false) {
return false;
}
return true;
}
示例3: getContent
public function getContent()
{
$html = '';
// If we try to update the settings
if (Tools::isSubmit('submitModule')) {
Configuration::updateValue('blockcontact_telnumber', Tools::getValue('telnumber'));
Configuration::updateValue('blockcontact_email', Tools::getValue('email'));
$html .= '<div class="confirm">' . $this->l('Configuration updated') . '</div>';
}
$html .= '
<h2>' . $this->displayName . '</h2>
<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
<fieldset>
<label for="telnumber">' . $this->l('Telephone number:') . '</label>
<input type="text" id="telnumber" name="telnumber" value="' . (Configuration::get('blockcontact_telnumber') != '' ? Tools::safeOutput(Configuration::get('blockcontact_telnumber')) : '') . '" />
<div class="clear"> </div>
<label for="email">' . $this->l('Email:') . '</label>
<input type="text" id="email" name="email" value="' . (Configuration::get('blockcontact_email') != '' ? Tools::safeOutput(Configuration::get('blockcontact_email')) : '') . '" />
<div class="clear"> </div>
<div class="margin-form">
<input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
</div>
</fieldset>
</form>';
return $html;
}
示例4: getContent
public function getContent()
{
$output = '<h2>' . $this->displayName . '</h2>';
if (Tools::isSubmit('submitBlockRss')) {
$urlfeed = strval(Tools::getValue('urlfeed'));
$title = strval(Tools::getValue('title'));
$nbr = intval(Tools::getValue('nbr'));
if ($urlfeed and !Validate::isUrl($urlfeed)) {
$errors[] = $this->l('Invalid feed URL');
} elseif (!$title or empty($title) or !Validate::isGenericName($title)) {
$errors[] = $this->l('Invalid title');
} elseif (!$nbr or $nbr <= 0 or !Validate::isInt($nbr)) {
$errors[] = $this->l('Invalid number of feeds');
} else {
Configuration::updateValue('RSS_FEED_URL', $urlfeed);
Configuration::updateValue('RSS_FEED_TITLE', $title);
Configuration::updateValue('RSS_FEED_NBR', $nbr);
}
if (isset($errors) and sizeof($errors)) {
$output .= $this->displayError(implode('<br />', $errors));
} else {
$output .= $this->displayConfirmation($this->l('Settings updated'));
}
}
return $output . $this->displayForm();
}
示例5: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitHomeFeatured')) {
$nbr = Tools::getValue('HOME_FEATURED_NBR');
if (!Validate::isInt($nbr) || $nbr <= 0) {
$errors[] = $this->l('The number of products is invalid. Please enter a positive number.');
}
$cat = Tools::getValue('HOME_FEATURED_CAT');
if (!Validate::isInt($cat) || $cat <= 0) {
$errors[] = $this->l('The category ID is invalid. Please choose an existing category ID.');
}
$rand = Tools::getValue('HOME_FEATURED_RANDOMIZE');
if (!Validate::isBool($rand)) {
$errors[] = $this->l('Invalid value for the "randomize" flag.');
}
if (isset($errors) && count($errors)) {
$output = $this->displayError(implode('<br />', $errors));
} else {
Configuration::updateValue('HOME_FEATURED_NBR', (int) $nbr);
Configuration::updateValue('HOME_FEATURED_CAT', (int) $cat);
Configuration::updateValue('HOME_FEATURED_RANDOMIZE', (bool) $rand);
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
$output = $this->displayConfirmation($this->l('Your settings have been updated.'));
}
}
return $output . $this->renderForm();
}
示例6: getContent
public function getContent()
{
$this->_html = '<h2>CCAvenue MCPG</h2>';
if (isset($_POST['submitccavenue'])) {
if (empty($_POST['merchant_id'])) {
$this->_postErrors[] = $this->l('CCAvenue Merchant id is required.');
}
if (empty($_POST['access_code'])) {
$this->_postErrors[] = $this->l('CCAvenue Access Code is required.');
}
if (empty($_POST['encryption_key'])) {
$this->_postErrors[] = $this->l('CCAvenue Encryption Key is required.');
}
if (!sizeof($this->_postErrors)) {
Configuration::updateValue('CCAVENUE_MERCHANT_ID', strval($_POST['merchant_id']));
Configuration::updateValue('CCAVENUE_ACCESS_CODE', strval($_POST['access_code']));
Configuration::updateValue('CCAVENUE_ENCRYPTION_KEY', strval($_POST['encryption_key']));
Configuration::updateValue('CCAVENUE_TITLE', strval($_POST['ccavenue_title']));
$this->displayConf();
} else {
$this->displayErrors();
}
}
$this->displayccavenue();
$this->displayFormSettings();
return $this->_html;
}
示例7: install
public function install()
{
if (!parent::install()) {
return false;
}
$carrier = new Carrier(null, $this->context->language->id);
$carrier->name = 'My carrier';
$carrier->active = 1;
$carrier->isFree = false;
$carrier->url = '';
$carrier->shipping_handling = false;
$carrier->shipping_method = 0;
$carrier->max_width = 0;
$carrier->max_height = 0;
$carrier->max_depth = 0;
$carrier->max_weight = 0;
$carrier->grade = 0;
$carrier->external_module_name = 'mycarrier';
$carrier->is_module = true;
$carrier->deleted = false;
$carrier->delay = 'string';
if (!$carrier->add()) {
return false;
}
if (!Configuration::updateValue('MY_CARRIER_ID', $carrier->id)) {
return false;
}
return true;
}
示例8: install
public function install()
{
if (!parent::install() || !$this->registerHook('top') || !$this->registerHook('possearch') || !$this->registerHook('header') || !Configuration::updateValue('CATE_ON', 1)) {
return false;
}
return true;
}
示例9: getContent
public function getContent()
{
$this->_html = '<h2>Paypal</h2>';
if (isset($_POST['submitPaypal'])) {
if (empty($_POST['business'])) {
$this->_postErrors[] = $this->l('Paypal business e-mail address is required.');
} elseif (!Validate::isEmail($_POST['business'])) {
$this->_postErrors[] = $this->l('Paypal business must be an e-mail address.');
}
if (!isset($_POST['sandbox'])) {
$_POST['sandbox'] = 1;
}
if (!sizeof($this->_postErrors)) {
Configuration::updateValue('PAYPAL_BUSINESS', strval($_POST['business']));
Configuration::updateValue('PAYPAL_SANDBOX', intval($_POST['sandbox']));
Configuration::updateValue('PAYPAL_HEADER', strval($_POST['header']));
$this->displayConf();
} else {
$this->displayErrors();
}
}
$this->displayPayPal();
$this->displayFormSettings();
return $this->_html;
}
示例10: getContent
/**
* Prestashop config page
*/
public function getContent()
{
global $smarty;
$errors = array();
if (Tools::isSubmit('submitMtgox')) {
foreach ($this->getConfigFields() as $field) {
$field_val = Tools::getValue(strtolower($field['config_name']));
if (isset($field['empty']) and $field['empty'] == false) {
if ($field_val != '0' and empty($field_val)) {
$errors[] = $this->l($field['display_name'] . ' field cannot be empty');
continue;
}
}
if (isset($field['boolean']) and $field['boolean'] == true) {
if (!in_array($field_val, array('0', '1'))) {
$errors[] = $this->l($field['display_name'] . ' field must be a string containing 0 or 1');
continue;
}
}
Configuration::updateValue($field['config_name'], $field_val);
}
if (!$errors) {
// Retro 1.4
global $currentIndex;
$curr_index = Tools::property_exists('AdminController', 'currentIndex') ? AdminController::$currentIndex : $currentIndex;
Tools::redirectAdmin($curr_index . '&configure=mtgox&token=' . Tools::safeOutput(Tools::getValue('token')) . '&conf=4');
}
}
$smarty->assign(array('displayName' => $this->displayName, 'requestUrl' => Tools::safeOutput($_SERVER['REQUEST_URI']), 'merchantId' => Tools::safeOutput(Tools::getValue('mtgox_merchant_id', Configuration::get('MTGOX_MERCHANT_ID'))), 'apiKey' => Tools::safeOutput(Tools::getValue('mtgox_api_key', Configuration::get('MTGOX_API_KEY'))), 'apiSecretKey' => Tools::safeOutput(Tools::getValue('mtgox_api_secret_key', Configuration::get('MTGOX_API_SECRET_KEY'))), 'paymentDescription' => Tools::safeOutput(Tools::getValue('mtgox_payment_description', Configuration::get('MTGOX_PAYMENT_DESCRIPTION'))), 'autosell' => Tools::safeOutput(Tools::getValue('mtgox_autosell', Configuration::get('MTGOX_AUTOSELL'))), 'email' => Tools::safeOutput(Tools::getValue('mtgox_email_on_success', Configuration::get('MTGOX_EMAIL_ON_SUCCESS'))), 'instantonly' => Tools::safeOutput(Tools::getValue('mtgox_instant_only', Configuration::get('MTGOX_INSTANT_ONLY'))), 'submit' => Tools::isSubmit('submitMtgox'), 'errors' => $errors));
return $this->display(__FILE__, 'views/templates/back/configure.tpl');
}
示例11: install
public function install()
{
/* Before creating a new tab "AdminSelfUpgrade" we need to remove any existing "AdminUpgrade" tab (present in v1.4.4.0 and v1.4.4.1) */
if ($id_tab = Tab::getIdFromClassName('AdminUpgrade')) {
$tab = new Tab((int) $id_tab);
if (!$tab->delete()) {
$this->_errors[] = sprintf($this->l('Unable to delete outdated AdminUpgrade tab %d'), (int) $id_tab);
}
}
/* If the "AdminSelfUpgrade" tab does not exist yet, create it */
if (!($id_tab = Tab::getIdFromClassName('AdminSelfUpgrade'))) {
$tab = new Tab();
$tab->class_name = 'AdminSelfUpgrade';
$tab->module = 'autoupgrade';
$tab->id_parent = (int) Tab::getIdFromClassName('AdminTools');
foreach (Language::getLanguages(false) as $lang) {
$tab->name[(int) $lang['id_lang']] = '1-Click Upgrade';
}
if (!$tab->save()) {
return $this->_abortInstall($this->l('Unable to create the "AdminSelfUpgrade" tab'));
}
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'logo.gif', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR . 'AdminSelfUpgrade.gif')) {
return $this->_abortInstall(sprintf($this->l('Unable to copy logo.gif in %s'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR));
}
} else {
$tab = new Tab((int) $id_tab);
}
/* Update the "AdminSelfUpgrade" tab id in database or exit */
if (Validate::isLoadedObject($tab)) {
Configuration::updateValue('PS_AUTOUPDATE_MODULE_IDTAB', (int) $tab->id);
} else {
return $this->_abortInstall($this->l('Unable to load the "AdminSelfUpgrade" tab'));
}
/* Check that the 1-click upgrade working directory is existing or create it */
$autoupgrade_dir = _PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'autoupgrade';
if (!file_exists($autoupgrade_dir) && !@mkdir($autoupgrade_dir, 0755)) {
return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), $autoupgrade_dir));
}
/* Make sure that the 1-click upgrade working directory is writeable */
if (!is_writable($autoupgrade_dir)) {
return $this->_abortInstall(sprintf($this->l('Unable to write in the directory "%s"'), $autoupgrade_dir));
}
/* If a previous version of ajax-upgradetab.php exists, delete it */
if (file_exists($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
@unlink($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
}
/* Then, try to copy the newest version from the module's directory */
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php', $autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
return $this->_abortInstall(sprintf($this->l('Unable to copy ajax-upgradetab.php in %s'), $autoupgrade_dir));
}
/* Make sure that the XML config directory exists */
if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml') && !@mkdir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml', 0755)) {
return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
}
/* Create a dummy index.php file in the XML config directory to avoid directory listing */
if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php') && (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php') && !@copy(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php'))) {
return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
}
return parent::install();
}
示例12: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitBlockTags')) {
$tagsNbr = Tools::getValue('BLOCKTAGS_NBR');
if (!strlen($tagsNbr)) {
$errors[] = $this->l('Please complete the "Displayed tags" field.');
} elseif (!Validate::isInt($tagsNbr) || (int) $tagsNbr <= 0) {
$errors[] = $this->l('Invalid number.');
}
$tagsLevels = Tools::getValue('BLOCKTAGS_MAX_LEVEL');
if (!strlen($tagsLevels)) {
$errors[] = $this->l('Please complete the "Tag levels" field.');
} elseif (!Validate::isInt($tagsLevels) || (int) $tagsLevels <= 0) {
$errors[] = $this->l('Invalid value for "Tag levels". Choose a positive integer number.');
}
$randomize = Tools::getValue('BLOCKTAGS_RANDOMIZE');
if (!strlen($randomize)) {
$errors[] = $this->l('Please complete the "Randomize" field.');
} elseif (!Validate::isBool($randomize)) {
$errors[] = $this->l('Invalid value for "Randomize". It has to be a boolean.');
}
if (count($errors)) {
$output = $this->displayError(implode('<br />', $errors));
} else {
Configuration::updateValue('BLOCKTAGS_NBR', (int) $tagsNbr);
Configuration::updateValue('BLOCKTAGS_MAX_LEVEL', (int) $tagsLevels);
Configuration::updateValue('BLOCKTAGS_RANDOMIZE', (bool) $randomize);
$output = $this->displayConfirmation($this->l('Settings updated'));
}
}
return $output . $this->renderForm();
}
示例13: install
public function install()
{
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
//Ajout d'un onglet à la racine du site
$parentTab = Tab::getIdFromClassName('AdminImporter');
if (empty($parentTab)) {
$parentTab = self::createTab(0, $this->name, 'EDC feeds importer', 'AdminImporter');
}
self::createTab($parentTab, $this->name, 'Import des produits', 'AdminImporterRunning');
self::createTab($parentTab, $this->name, 'Configuration', 'AdminImporterConfiguration');
self::createTab($parentTab, $this->name, 'Counter', 'AdminImporterCounter');
self::createTab($parentTab, $this->name, 'Labo', 'AdminImporterLab');
// self::createTab($parentTab, $this->name, 'CRON', 'AdminImporterCron');
Configuration::updateValue('IMPORTER_URL_FULL_FEED', 'http://graphics.edc-internet.nl/b2b_feed.php?key=[KEY]&sort=xml&type=xml&lang=[LANG]&version=2015');
Configuration::updateValue('IMPORTER_URL_NEW_PRODUCTS', 'http://graphics.edc-internet.nl/b2b_feed.php?key=[KEY]&sort=xml&type=xml&lang=[LANG]&version=2015&new=1');
Configuration::updateValue('IMPORTER_URL_STOCK', 'http://graphics.edc-internet.nl/xml/eg_xml_feed_stock.xml');
Configuration::updateValue('IMPORTER_DISCONTINUED', 'http://graphics.edc-internet.nl/xml/deleted_products.xml');
Configuration::updateValue('IMPORTER_IMPORT_CURRENT_STEP', 0);
Configuration::updateValue('IMPORTER_IMPORT_CURRENT_KEY_IN_XML', 0);
Configuration::updateValue('IMPORTER_XML_FILE', '');
Configuration::updateValue('IMPORTER_XML_COUNT');
//Créer le dossier import
if (!parent::install() || !$this->installDb()) {
return false;
}
return true;
}
示例14: add_order_state
function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unremovable, $logable, $delivery, $template = null)
{
$name_lang = array();
$template_lang = array();
foreach (explode('|', $name) as $item) {
$temp = explode(':', $item);
$name_lang[$temp[0]] = $temp[1];
}
if ($template) {
foreach (explode('|', $template) as $item) {
$temp = explode(':', $item);
$template_lang[$temp[0]] = $temp[1];
}
}
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'order_state` (`invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`)
VALUES (' . (int) $invoice . ', ' . (int) $send_email . ', \'' . pSQL($color) . '\', ' . (int) $unremovable . ', ' . (int) $logable . ', ' . (int) $delivery . ')');
$id_order_state = Db::getInstance()->getValue('
SELECT MAX(`id_order_state`)
FROM `' . _DB_PREFIX_ . 'order_state`
');
foreach (Language::getLanguages() as $lang) {
Db::getInstance()->Execute('
INSERT IGNORE INTO `' . _DB_PREFIX_ . 'order_state_lang` (`id_lang`, `id_order_state`, `name`, `template`)
VALUES (' . (int) $lang['id_lang'] . ', ' . (int) $id_order_state . ', \'' . pSQL(isset($name_lang[$lang['iso_code']]) ? $name_lang[$lang['iso_code']] : $name_lang['en']) . '\', \'' . pSQL(isset($template_lang[$lang['iso_code']]) ? $template_lang[$lang['iso_code']] : (isset($template_lang['en']) ? $template_lang['en'] : '')) . '\')
');
}
Configuration::updateValue($conf_name, $id_order_state);
}
示例15: getContent
public function getContent()
{
$html = '';
// If we try to update the settings
if (isset($_POST['submitModule'])) {
Configuration::updateValue('blockcontactinfos_company', isset($_POST['company']) && $_POST['company'] != '' ? $_POST['company'] : Configuration::get('PS_SHOP_NAME'));
Configuration::updateValue('blockcontactinfos_address', isset($_POST['address']) && $_POST['address'] != '' ? $_POST['address'] : '');
Configuration::updateValue('blockcontactinfos_phone', isset($_POST['phone']) && $_POST['phone'] != '' ? $_POST['phone'] : '');
Configuration::updateValue('blockcontactinfos_email', isset($_POST['email']) && $_POST['email'] != '' ? $_POST['email'] : Configuration::get('PS_SHOP_EMAIL'));
$html .= '<div class="confirm">' . $this->l('Configuration updated') . '</div>';
}
$html .= '
<h2>' . $this->displayName . '</h2>
<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
<fieldset>
<p><label for="company">' . $this->l('Company name') . ' :</label>
<input type="text" id="company" name="company" value="' . Tools::safeOutput(Configuration::get('blockcontactinfos_company')) . '" /></p>
<p><label for="address">' . $this->l('Address') . ' :</label>
<textarea id="address" name="address" cols="60" rows="4">' . Tools::safeOutput(Configuration::get('blockcontactinfos_address')) . '</textarea></p>
<p><label for="phone">' . $this->l('Phone number') . ' :</label>
<input type="text" id="phone" name="phone" value="' . Tools::safeOutput(Configuration::get('blockcontactinfos_phone')) . '" /></p>
<p><label for="email">' . $this->l('Email') . ' :</label>
<input type="text" id="email" name="email" value="' . Tools::safeOutput(Configuration::get('blockcontactinfos_email')) . '" /> </p>
<div class="margin-form">
<input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
</div>
</fieldset>
</form>
';
return $html;
}