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


PHP Configuration::LoadByKey方法代码示例

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


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

示例1: _getConfig

 /**
  * Get configuration
  *
  * @param string $passkey
  * @param string $confkey
  * @return string
  */
 private function _getConfig($confkey)
 {
     $conf = Configuration::LoadByKey($confkey);
     if (!$conf) {
         return self::NOT_FOUND;
     }
     return $conf->key_value;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:15,代码来源:ApiController.php

示例2: actionDatabaseUpgrade

 public function actionDatabaseUpgrade($online = 50, $total = 100, $tag = '')
 {
     Yii::log("Checking db to see if we're current", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     $oXML = $this->isDatabaseCurrent();
     if ($oXML->schema == 'current') {
         echo json_encode(array('result' => "success", 'makeline' => $total, 'tag' => $tag, 'total' => $total));
         return;
     }
     //If we're here, we have something to do
     switch ($oXML->changetype) {
         case 'yii':
             //Don't do anything here, it was already done by the framework
             break;
         case 'run_task':
             $this->runTask($oXML->schema);
             break;
         case 'add_column':
             $elements = explode(".", $oXML->elementname);
             $res = Yii::app()->db->createCommand("SHOW COLUMNS FROM " . $elements[0] . " WHERE Field='" . $elements[1] . "'")->execute();
             if (!$res) {
                 Yii::app()->db->createCommand($oXML->sqlstatement)->execute();
             }
             break;
         case 'drop_column':
             $elements = explode(".", $oXML->elementname);
             $res = Yii::app()->db->createCommand("SHOW COLUMNS FROM " . $elements[0] . " WHERE Field='" . $elements[1] . "'")->execute();
             if ($res) {
                 Yii::app()->db->createCommand($oXML->sqlstatement)->execute();
             }
             break;
         case 'add_configuration_key':
             $objKey = Configuration::LoadByKey($oXML->elementname);
             if (!$objKey) {
                 Yii::app()->db->createCommand($oXML->sqlstatement)->execute();
             }
             break;
         default:
             Yii::app()->db->createCommand($oXML->sqlstatement)->execute();
     }
     $oXML = $this->isDatabaseCurrent(true);
     if ($oXML->schema == "current") {
         echo json_encode(array('result' => "success", 'makeline' => $total, 'tag' => $tag, 'total' => $total));
         return;
     } else {
         $tag .= " " . $oXML->schema;
         $makeline = $online + 5;
         if ($makeline >= $total) {
             $makeline -= 5;
         }
         //keep it from artificially ending
         echo json_encode(array('result' => "success", 'makeline' => $makeline, 'tag' => $tag, 'total' => $total));
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:53,代码来源:UpgradeController.php

示例3: get_config

 /**
  * Get configuration
  *
  * @param string $passkey
  * @param string $confkey
  * @return string
  */
 public function get_config($passkey, $confkey)
 {
     if (!$this->check_passkey($passkey)) {
         return self::FAIL_AUTH;
     }
     $conf = Configuration::LoadByKey($confkey);
     if (!$conf) {
         return self::NOT_FOUND;
     }
     return $conf->Value;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:18,代码来源:LegacysoapController.php

示例4: actionUpdateConfiguration

 /**
  * 29 Cleanup details, config options that have changed, NULL where we had 0's, etc.
  * @return string
  */
 protected function actionUpdateConfiguration()
 {
     //Migrate our header image to the new folder
     $objConfig = Configuration::LoadByKey('HEADER_IMAGE');
     $objConfig->key_value = str_replace("/photos/", "/images/header/", $objConfig->key_value);
     $objConfig->save();
     $objConfig = Configuration::LoadByKey('PRODUCT_SORT_FIELD');
     $objConfig->key_value = str_replace("Name", "title", $objConfig->key_value);
     $objConfig->key_value = str_replace("Rowid", "id", $objConfig->key_value);
     $objConfig->key_value = str_replace("Modified", "modified", $objConfig->key_value);
     $objConfig->key_value = str_replace("Code", "code", $objConfig->key_value);
     $objConfig->key_value = str_replace("InventoryTotal", "inventory_total", $objConfig->key_value);
     $objConfig->key_value = str_replace("DescriptionShort", "description_short", $objConfig->key_value);
     $objConfig->key_value = str_replace("WebKeyword1", "title", $objConfig->key_value);
     $objConfig->key_value = str_replace("WebKeyword2", "title", $objConfig->key_value);
     $objConfig->key_value = str_replace("WebKeyword3", "title", $objConfig->key_value);
     $objConfig->save();
     //What we're gonna do right here is go back.... way back...
     return array('result' => "success", 'makeline' => 50, 'tag' => 'Migrating Database', 'total' => 50);
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:24,代码来源:InstallController.php

示例5: SetIdStr

 public function SetIdStr()
 {
     $strQueryFormat = 'SELECT COUNT(id) FROM xlsws_cart WHERE ' . '`id_str` = "%s" AND `id` != "%s";';
     if (!$this->id_str) {
         $this->id_str = Cart::GetCartNextIdStr();
     }
     $strQuery = sprintf($strQueryFormat, $this->id_str, $this->id);
     while (Yii::app()->db->createCommand($strQuery)->queryScalar() != '0') {
         $this->id_str++;
         $strQuery = sprintf($strQueryFormat, $this->id_str, $this->id);
     }
     try {
         $this->Save();
     } catch (Exception $objExc) {
         Yii::log('Failed to save cart with : ' . $objExc, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     $objConf = Configuration::LoadByKey('NEXT_ORDER_ID');
     $objConf->key_value = intval(preg_replace("/[^0-9]/", "", $this->id_str)) + 1;
     $objConf->save();
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:20,代码来源:Cart.php

示例6: _xls_insert_conf

function _xls_insert_conf($key, $title, $value, $helperText, $configType, $options, $sortOrder = NULL, $templateSpecific = 0)
{
    $conf = Configuration::LoadByKey($key);
    if (!$conf) {
        $conf = new Configuration();
    }
    $conf->key_name = $key;
    $conf->title = $title;
    $conf->key_value = $value;
    $conf->helper_text = $helperText;
    $conf->configuration_type_id = $configType;
    $conf->options = $options;
    $query = <<<EOS
\t\tSELECT IFNULL(MAX(sortOrder),0)+1
\t\tFROM xlsws_configuration
\t\tWHERE configuration_type_id = '{$configType}';
EOS;
    if (!$sortOrder) {
        $sortOrder = Configuration::model()->findBySql($query);
    }
    $conf->sort_order = $sortOrder;
    $conf->template_specific = $templateSpecific;
    $conf->created = new CDbExpression('NOW()');
    $conf->modified = new CDbExpression('NOW()');
    if (!$conf->save()) {
        print_r($conf->getErrors());
    }
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:28,代码来源:helpers.php


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