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


PHP Configuration::add方法代码示例

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


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

示例1: put

 public function put($key, $value, $ns = 'conf')
 {
     $configurationManager = new Configuration();
     if (isset($this->confTab[$ns][$key])) {
         $configurationManager->change(array('value' => $value), array('key' => $ns . ':' . $key));
     } else {
         $configurationManager->add($key, $value, $ns);
     }
     $this->confTab[$ns][$key] = $value;
     unset($_SESSION['configuration']);
 }
开发者ID:thib3113,项目名称:yana-server,代码行数:11,代码来源:Configuration.class.php

示例2: _addConfiguration

 /**
  * Insert configuration key and value into database
  *
  * @param string $key Key
  * @param string $value Value
  * @eturn boolean Insert result
  */
 protected static function _addConfiguration($key, $value = null)
 {
     $newConfig = new Configuration();
     $newConfig->name = $key;
     if (!is_null($value)) {
         $newConfig->value = $value;
     }
     return $newConfig->add() ? (int) $newConfig->id : false;
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:16,代码来源:Configuration.php

示例3: Folder

 $folderManager->create();
 if ($folderManager->rowCount() == 0) {
     //Création du dossier général
     $folder = new Folder();
     $folder->setName(_t('GENERAL_FOLDER'));
     $folder->setParent(-1);
     $folder->setIsopen(1);
     $folder->save();
 }
 // REMET À ZÉRO LA CONFIGURATION
 $configurationManager = new Configuration();
 if ($configurationManager->tableExists()) {
     $configurationManager->truncate();
 }
 $configurationManager->create();
 $configurationManager->add('articleDisplayAnonymous', '0');
 $configurationManager->add('articleDisplayAuthor', '1');
 $configurationManager->add('articleDisplayDate', '1');
 $configurationManager->add('articleDisplayFolderSort', '1');
 $configurationManager->add('articleDisplayHomeSort', '1');
 $configurationManager->add('articleDisplayLink', '1');
 $configurationManager->add('articleDisplayMode', 'summary');
 $configurationManager->add('articlePerPages', '5');
 $configurationManager->add('cryptographicSalt', $cryptographicSalt);
 $configurationManager->add('displayOnlyUnreadFeedFolder', 'false');
 $configurationManager->add('feedMaxEvents', '50');
 $configurationManager->add('language', $_POST['install_changeLngLeed']);
 $configurationManager->add('optionFeedIsVerbose', 1);
 $configurationManager->add('paginationScale', 5);
 $configurationManager->add('syncGradCount', '10');
 $configurationManager->add('synchronisationCode', $synchronisationCode);
开发者ID:Chouchen,项目名称:Leed,代码行数:31,代码来源:install.php

示例4: _addConfiguration

 /**
  * Insert configuration key and value into database
  *
  * @param string $key Key
  * @param string $value Value
  * @eturn boolean Insert result
  */
 private static function _addConfiguration($key, $value = NULL)
 {
     $newConfig = new Configuration();
     $newConfig->name = $key;
     if (!is_null($value)) {
         $newConfig->value = $value;
     }
     return $newConfig->add();
 }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:16,代码来源:Configuration.php

示例5: updateValue

    /**
     * Update configuration key and value into database (automatically insert if key does not exist)
     *
     * @param string $key Key
     * @param mixed $values $values is an array if the configuration is multilingual, a single string else.
     * @param boolean $html Specify if html is authorized in value
     * @param int $id_shop_group
     * @param int $id_shop
     * @return boolean Update result
     */
    public static function updateValue($key, $values, $html = false, $id_shop_group = null, $id_shop = null)
    {
        if (!Validate::isConfigName($key)) {
            die(Tools::displayError());
        }
        if ($id_shop === null) {
            $id_shop = Shop::getContextShopID(true);
        }
        if ($id_shop_group === null) {
            $id_shop_group = Shop::getContextShopGroupID(true);
        }
        if (!is_array($values)) {
            $is_i18n = false;
            $values = array($values);
        } else {
            $is_i18n = true;
        }
        $result = true;
        foreach ($values as $lang => $value) {
            if ($value === Configuration::get($key, $lang, $id_shop_group, $id_shop)) {
                continue;
            }
            // If key already exists, update value
            if (Configuration::hasKey($key, $lang, $id_shop_group, $id_shop)) {
                if (!$lang) {
                    // Update config not linked to lang
                    $result &= Db::getInstance()->update('configuration', array('value' => pSQL($value, $html), 'date_upd' => date('Y-m-d H:i:s')), '`name` = \'' . pSQL($key) . '\'' . Configuration::sqlRestriction($id_shop_group, $id_shop), true, true);
                } else {
                    // Update multi lang
                    $sql = 'UPDATE ' . _DB_PREFIX_ . 'configuration_lang cl
							SET cl.value = \'' . pSQL($value, $html) . '\',
								cl.date_upd = NOW()
							WHERE cl.id_lang = ' . (int) $lang . '
								AND cl.id_configuration = (
									SELECT c.id_configuration
									FROM ' . _DB_PREFIX_ . 'configuration c
									WHERE c.name = \'' . pSQL($key) . '\'' . Configuration::sqlRestriction($id_shop_group, $id_shop) . ')';
                    $result &= Db::getInstance()->execute($sql);
                }
            } else {
                if (!($configID = Configuration::getIdByName($key, $id_shop_group, $id_shop))) {
                    $newConfig = new Configuration();
                    $newConfig->name = $key;
                    if ($id_shop) {
                        $newConfig->id_shop = (int) $id_shop;
                    }
                    if ($id_shop_group) {
                        $newConfig->id_shop_group = (int) $id_shop_group;
                    }
                    if (!$lang) {
                        $newConfig->value = $value;
                    }
                    $result &= $newConfig->add(true, true);
                    $configID = $newConfig->id;
                }
                if ($lang) {
                    $result &= Db::getInstance()->insert('configuration_lang', array('id_configuration' => $configID, 'id_lang' => $lang, 'value' => pSQL($value, $html), 'date_upd' => date('Y-m-d H:i:s')));
                }
            }
            if (!$is_i18n) {
                Configuration::set($key, $value, $id_shop_group, $id_shop);
            }
        }
        if ($is_i18n) {
            Configuration::set($key, $values, $id_shop_group, $id_shop);
        }
        return $result;
    }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:78,代码来源:Configuration.php

示例6: updateValue

    /**
     * Update configuration key and value into database (automatically insert if key does not exist)
     *
     * @param string $key Key
     * @param mixed $values $values is an array if the configuration is multilingual, a single string else.
     * @param boolean $html Specify if html is authorized in value
     * @param int $id_shop_group
     * @param int $id_shop
     * @return boolean Update result
     */
    public static function updateValue($key, $values, $html = false, $id_shop_group = null, $id_shop = null)
    {
        if (!Validate::isConfigName($key)) {
            die(Tools::displayError());
        }
        if ($id_shop === null) {
            $id_shop = Shop::getContextShopID(true);
        }
        if ($id_shop_group === null) {
            $id_shop_group = Shop::getContextShopGroupID(true);
        }
        if (!is_array($values)) {
            $is_i18n = false;
            $values = array($values);
        } else {
            $is_i18n = true;
        }
        $result = true;
        foreach ($values as $lang => $value) {
            $stored_value = Configuration::get($key, $lang, $id_shop_group, $id_shop);
            // if there isn't a $stored_value, we must insert $value
            if (!is_numeric($value) && $value === $stored_value || is_numeric($value) && $value == $stored_value && Configuration::hasKey($key, $lang)) {
                continue;
            }
            // If key already exists, update value
            if (Configuration::hasKey($key, $lang, $id_shop_group, $id_shop)) {
                if (!$lang) {
                    // Update config not linked to lang
                    $result &= Db::getInstance()->update(self::$definition['table'], array('value' => pSQL($value, $html), 'date_upd' => date('Y-m-d H:i:s')), '`name` = \'' . pSQL($key) . '\'' . Configuration::sqlRestriction($id_shop_group, $id_shop), 1, true);
                } else {
                    // Update multi lang
                    $sql = 'UPDATE `' . _DB_PREFIX_ . bqSQL(self::$definition['table']) . '_lang` cl
							SET cl.value = \'' . pSQL($value, $html) . '\',
								cl.date_upd = NOW()
							WHERE cl.id_lang = ' . (int) $lang . '
								AND cl.`' . bqSQL(self::$definition['primary']) . '` = (
									SELECT c.`' . bqSQL(self::$definition['primary']) . '`
									FROM `' . _DB_PREFIX_ . bqSQL(self::$definition['table']) . '` c
									WHERE c.name = \'' . pSQL($key) . '\'' . Configuration::sqlRestriction($id_shop_group, $id_shop) . ')';
                    $result &= Db::getInstance()->execute($sql);
                }
            } else {
                if (!($configID = Configuration::getIdByName($key, $id_shop_group, $id_shop))) {
                    $newConfig = new Configuration();
                    $newConfig->name = $key;
                    if ($id_shop) {
                        $newConfig->id_shop = (int) $id_shop;
                    }
                    if ($id_shop_group) {
                        $newConfig->id_shop_group = (int) $id_shop_group;
                    }
                    if (!$lang) {
                        $newConfig->value = $value;
                    }
                    $result &= $newConfig->add(true, true);
                    $configID = $newConfig->id;
                }
                if ($lang) {
                    $result &= Db::getInstance()->insert(self::$definition['table'] . '_lang', array(self::$definition['primary'] => $configID, 'id_lang' => $lang, 'value' => pSQL($value, $html), 'date_upd' => date('Y-m-d H:i:s')));
                }
            }
        }
        Configuration::set($key, $values, $id_shop_group, $id_shop);
        return $result;
    }
开发者ID:dev-lav,项目名称:htdocs,代码行数:75,代码来源:Configuration.php

示例7: Folder

 $folderManager->create();
 if ($folderManager->rowCount() == 0) {
     //Création du dossier général
     $folder = new Folder();
     $folder->setName(_t('GENERAL_FOLDER'));
     $folder->setParent(-1);
     $folder->setIsopen(1);
     $folder->save();
 }
 // REMET À ZÉRO LA CONFIGURATION
 $configurationManager = new Configuration();
 if ($configurationManager->tableExists()) {
     $configurationManager->truncate();
 }
 $configurationManager->create();
 $configurationManager->add('root', $root);
 $configurationManager->add('articleView', 'partial');
 $configurationManager->add('articleDisplayContent', '1');
 $configurationManager->add('articleDisplayAnonymous', '0');
 $configurationManager->add('articlePerPages', '5');
 $configurationManager->add('articleDisplayLink', '1');
 $configurationManager->add('articleDisplayDate', '1');
 $configurationManager->add('articleDisplayAuthor', '1');
 $configurationManager->add('articleDisplayHomeSort', '1');
 $configurationManager->add('articleDisplayFolderSort', '1');
 $configurationManager->add('displayOnlyUnreadFeedFolder', 'false');
 $configurationManager->add('optionFeedIsVerbose', 1);
 $configurationManager->add('synchronisationType', 'auto');
 $configurationManager->add('feedMaxEvents', '50');
 $configurationManager->add('synchronisationCode', $synchronisationCode);
 $configurationManager->add('synchronisationEnableCache', '1');
开发者ID:Rorto,项目名称:Leed,代码行数:31,代码来源:install.php


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