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


PHP Storage::create方法代码示例

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


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

示例1: storage

 /**
  * @return Storage
  */
 static function storage()
 {
     global $argv;
     try {
         if (!isset($argv[1])) {
             throw new StorageException("No json file in arguments", StorageException::DATA_FILE_NOT_FOUND);
         }
         $storage = new Storage($argv[1]);
     } catch (StorageException $e) {
         if ($e->getCode() == StorageException::DATA_FILE_NOT_FOUND) {
             log_msg('Loader::storage >> no json file');
             // User input
             echo "Put your key:" . PHP_EOL;
             $handle = fopen("php://stdin", "r");
             $line = fgets($handle);
             $_input_key = trim($line);
             fclose($handle);
             echo "Put your secret:" . PHP_EOL;
             $handle = fopen("php://stdin", "r");
             $line = fgets($handle);
             $_input_secret = trim($line);
             fclose($handle);
             $storage = Storage::create($argv[1], $_input_key, $_input_secret);
             if (!$storage) {
                 log_msg('Access denied to create file storage', true);
             }
         } else {
             log_msg($e->getMessage(), true);
         }
     }
     return $storage;
 }
开发者ID:DrDriks,项目名称:btce-bot,代码行数:35,代码来源:helpers.php

示例2: buildComplete

 /**
  * Method description
  *
  * More detailed method description
  * @param    void
  * @return   void
  */
 function buildComplete()
 {
     if (!isset($this->tpl)) {
         $this->tpl = $this->createTemplate();
     }
     if (Config::get("CACHE_STATIC_PAGES")) {
         $page = Controller::getInstance()->getPage();
         $cn = Controller::getInstance()->getControllerName();
         $storage = Storage::create("WHTML cache");
         if (!$storage->is_set($cn . "_" . $page . "_" . $this->getId())) {
             $this->page_text = $this->getSrc() ? file_get_contents($this->getSrc()) : ($this->getText() ? $this->getText() : null);
             $storage->set($cn . "_" . $page . "_" . $this->getId(), array("text" => $this->page_text, "cache_time" => time()));
         } else {
             $p = $storage->get($cn . "_" . $page . "_" . $this->getId());
             $mtime = 0;
             $changed = 0;
             if ($this->getSrc()) {
                 if (fileChanged($this->getSrc(), $p['cache_time']) || Controller::getInstance()->XMLPageChanged($p['cache_time'])) {
                     $this->page_text = $this->getSrc() ? file_get_contents($this->getSrc()) : "";
                     $storage->set($cn . "_" . $page . "_" . $this->getId(), array("text" => $this->page_text, "cache_time" => time()));
                 } else {
                     $this->page_text = $p['text'];
                 }
             } else {
                 $this->page_text = $this->getText();
             }
         }
     } else {
         $this->page_text = $this->getSrc() ? file_get_contents($this->getSrc()) : ($this->getText() ? $this->getText() : null);
     }
     parent::buildComplete();
 }
开发者ID:point,项目名称:cassea,代码行数:39,代码来源:WHTML.php

示例3: init

 public function init()
 {
     if (Config::getInstance()->language->cache_langs) {
         self::$langs_cache = Storage::create('__Language::list__');
     }
     if (Config::getInstance()->language->cache_consts) {
         self::$const_cache = Storage::create('__Language::consts__');
     }
     if (!isset(self::$langs_cache['__default__']) || !isset(self::$langs_cache['__list__'])) {
         try {
             $r = DB::query('select * from ' . self::LANGUAGE_TABLE);
         } catch (DBException $e) {
             if ($e->getCode() == 1146) {
                 throw new LanguageException('Table "' . self::LANGUAGE_TABLE . '" not exists.', 1);
             }
             throw $e;
         }
         $list = array();
         for ($i = 0, $c = count($r); $i < $c; $i++) {
             $cl = $r[$i];
             $list[$cl['short_name']] = $cl['id'];
             self::$langs_cache[$cl['short_name']] = $cl['id'];
             if ($cl['default']) {
                 self::$langs_cache['__default__'] = $cl['id'];
             }
         }
         self::$langs_cache['__list__'] = $list;
     }
     if (count(self::$langs_cache['__list__']) == 0) {
         throw new LanguageException('There isn\'t langauges (rows) in table "' . self::LANGUAGE_TABLE . '"', 2);
     }
     if (!isset(self::$langs_cache['__default__'])) {
         throw new LanguageException('Default language is not defined in table "' . self::LANGUAGE_TABLE . '"', 3);
     }
     self::determine();
 }
开发者ID:point,项目名称:cassea,代码行数:36,代码来源:MultiLanguageProcessor.php

示例4: create

 function create($seg, $off, $name)
 {
     return parent::create(array('seg' => $seg, 'off' => $off, 'name' => $name));
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:4,代码来源:Albums.php

示例5: save

 /**
  * @param    array $param
  * @return   void
  */
 public function save($sid, array $params)
 {
     $this->storage = Storage::create($this->getStorageName($sid), $params['time']);
     unset($params['time']);
     $this->storage['params'] = $params;
 }
开发者ID:point,项目名称:cassea,代码行数:10,代码来源:MemcacheSession.php

示例6: flushCache

 /**
  * Flushes cached groups for given user. 
  * Used only if acl.use and acl.cache_groups config flags are set to true values
  *
  * @param int id of user to flush cache
  * @return null
  */
 static function flushCache($user_id)
 {
     if (!isset($user_id) || !is_numeric($user_id)) {
         throw new ACLException("Parameter 'user_id' has incorrect format");
     }
     if (Config::getInstance()->acl->use && Config::getInstance()->acl->cache_groups) {
         Storage::create('acl_groups')->un_set($user_id);
     }
 }
开发者ID:point,项目名称:cassea,代码行数:16,代码来源:ACL.php

示例7: getImgSizeCache

function getImgSizeCache($path = null)
{
    $v = Storage::create("images_size");
    if (($ret = $v->get($path)) !== false && ($stat = stat(Config::get("root_dir") . Config::get("IMAGES_DIR") . "/" . $path)) !== false && $stat['mtime'] <= $ret['mtime']) {
        return $ret;
    }
    if (($ret = getImgSizeNoCache($path)) !== false) {
        if (($stat = stat(Config::get("root_dir") . Config::get("IMAGES_DIR") . "/" . $path)) !== false) {
            $ret['mtime'] = $stat['mtime'];
        }
        $v->set($path, $ret);
        return $ret;
    }
    return false;
}
开发者ID:point,项目名称:cassea,代码行数:15,代码来源:functions.php

示例8: getStorage

 /**
  * returns storage (instantiate it if not yet).
  * @param string config section to take storage config from.
  * @return Storage
  * @author kstep
  */
 public function getStorage($section = "storage")
 {
     $section = (string) $section;
     if (!$this->_storages[$section] && $this->_config[$section]) {
         $this->_storages[$section] = Storage::create($this->_config[$section]);
     }
     return $this->_storages[$section];
 }
开发者ID:kstep,项目名称:pnut,代码行数:14,代码来源:Config.php


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