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


PHP Store::has方法代码示例

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


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

示例1: load_classes

 protected static function load_classes()
 {
     $store_key = array(__DIR__, '__autoload');
     if (Store::has($store_key)) {
         $classes = Store::get($store_key);
     } else {
         $classes = array();
         $modules = array();
         $dir = path('libs');
         $itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
         $pattern = '/^' . preg_quote($dir, '/') . '\\/(.+?)\\.php$/';
         foreach ($itr as $elem) {
             if ($elem->isFile() && preg_match($pattern, $elem->getPathname(), $match)) {
                 $class_name = $elem->getBasename('.php');
                 if ($class_name == basename($elem->getPath())) {
                     $modules[$class_name] = str_replace('/', '.', substr($elem->getPath(), strlen($dir) + 1));
                 } else {
                     if ($class_name !== __CLASS__) {
                         $classes[$class_name] = str_replace('/', '.', $match[1]);
                     }
                 }
             }
         }
         foreach ($modules as $module_name => $module_path) {
             foreach ($classes as $class_name => $class_path) {
                 if (strpos($class_path, $module_path) === 0) {
                     unset($classes[$class_name]);
                 }
             }
         }
         $classes = $modules + $classes;
         Store::set($store_key, $classes);
     }
     self::$classes = $classes;
 }
开发者ID:riaf,项目名称:rhaco2-repository,代码行数:35,代码来源:AutoLoader.php

示例2: unread_count

 public static function unread_count(OpenpearMaintainer $maintainer)
 {
     $key = array('openpear_message_unread', $maintainer->id());
     if (Store::has($key)) {
         return Store::get($key);
     }
     $unread_messages_count = C(__CLASS__)->find_count(Q::eq('maintainer_to_id', $maintainer->id()), Q::eq('unread', true));
     Store::set($key, $unread_messages_count);
     return $unread_messages_count;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:10,代码来源:OpenpearMessage.php

示例3: linktitleHandler

 /**
  * linktitleHandler
  */
 public static function linktitleHandler($url)
 {
     if (module_const('is_cache', false)) {
         $store_key = array('__hatenaformat_linktitlehandler', $url);
         if (Store::has($store_key)) {
             return Store::get($store_key);
         }
     }
     if (Tag::setof($title, Http::read($url), 'title')) {
         $url = $title->value();
         if (module_const('is_cache', false)) {
             Store::set($store_key, $url, self::CACHE_EXPIRE);
         }
     }
     return $url;
 }
开发者ID:riaf,项目名称:rhaco2-repository,代码行数:19,代码来源:HatenaFormat.php

示例4: get_changeset

 /**
  * チェンジセットを取得する
  * @param int $revision
  * @param bool $cache
  * @return OpenpearChangeset
  **/
 public static function get_changeset($revision, $cache = true)
 {
     $cache_key = self::cache_key($revision);
     if ($cache) {
         if (isset(self::$cached_changesets[$revision])) {
             return self::$cached_changesets[$revision];
         } else {
             if (Store::has($cache_key)) {
                 $changeset = Store::get($cache_key);
                 self::$cached_changesets[$revision] = $changeset;
                 return $changeset;
             }
         }
     }
     $changeset = C(__CLASS__)->find_get(Q::eq('revision', $revision));
     Store::set($cache_key, $changeset);
     return $changeset;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:24,代码来源:OpenpearChangeset.php

示例5: get_maintainer

 /**
  * メンテナ情報を取得する
  * @param int $id
  * @param bool $cache
  * @return OpenpearMaintainar
  **/
 public static function get_maintainer($id, $cache = true)
 {
     $cache_key = self::cache_key($id);
     if ($cache) {
         Log::debug('cache on');
         if (isset(self::$cached_maintainers[$id])) {
             return self::$cached_maintainers[$id];
         } else {
             if (Store::has($cache_key)) {
                 $maintainer = Store::get($cache_key);
                 self::$cached_maintainers[$id] = $maintainer;
                 return $maintainer;
             }
         }
     }
     $maintainer = C(__CLASS__)->find_get(Q::eq('id', $id));
     Store::set($cache_key, $maintainer, OpenpearConfig::object_cache_timeout(3600));
     return $maintainer;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:25,代码来源:OpenpearMaintainer.php

示例6: packages

 public static function packages(OpenpearMaintainer $maintainer)
 {
     $store_key = array('charges_maintainer', $maintainer->id());
     if (Store::has($store_key, self::CACHE_TIMEOUT)) {
         $packages = Store::get($store_key);
     } else {
         try {
             $packages = array();
             $charges = C(OpenpearCharge)->find_all(Q::eq('maintainer_id', $maintainer->id()));
             foreach ($charges as $charge) {
                 $packages[] = $charge->package();
             }
         } catch (Exception $e) {
             $packages = array();
         }
         Store::set($store_key, $packages, self::CACHE_TIMEOUT);
     }
     return $packages;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:19,代码来源:OpenpearCharge.php

示例7: load

 /**
  * xml定義からhandlerを処理する
  * @param string $file アプリケーションXMLのファイルパス
  */
 public static final function load($file = null)
 {
     if (!isset($file)) {
         $file = App::mode() . App::called_filename();
     }
     if (!self::$is_app_cache || !Store::has($file)) {
         $parse_app = self::parse_app($file, false);
         if (self::$is_app_cache) {
             Store::set($file, $parse_app);
         }
     }
     if (self::$is_app_cache) {
         $parse_app = Store::get($file);
     }
     if (empty($parse_app['apps'])) {
         throw new RuntimeException('undef app');
     }
     $app_result = null;
     $in_app = $match_handle = false;
     $app_index = 0;
     try {
         foreach ($parse_app['apps'] as $app) {
             switch ($app['type']) {
                 case 'handle':
                     $self = new self('_inc_session_=false');
                     foreach ($app['modules'] as $module) {
                         $self->add_module(self::import_instance($module));
                     }
                     if ($self->has_module('flow_handle_begin')) {
                         $self->call_module('flow_handle_begin', $self);
                     }
                     try {
                         if ($self->handler($app['maps'], $app_index++)->is_pattern()) {
                             $self->cp(self::execute_var($app['vars']));
                             $src = $self->read();
                             if ($self->has_module('flow_handle_end')) {
                                 $self->call_module('flow_handle_end', $src, $self);
                             }
                             print $src;
                             $in_app = true;
                             $match_handle = true;
                             if (!$parse_app["handler_multiple"]) {
                                 exit;
                             }
                         }
                     } catch (Exception $e) {
                         Log::warn($e);
                         if (isset($app['on_error']['status'])) {
                             Http::status_header((int) $app['on_error']['status']);
                         }
                         if (isset($app['on_error']['redirect'])) {
                             $this->save_exception($e);
                             $this->redirect($app['on_error']['redirect']);
                         } else {
                             if (isset($app['on_error']['template'])) {
                                 if (!$e instanceof Exceptions) {
                                     Exceptions::add($e);
                                 }
                                 $self->output($app['on_error']['template']);
                             } else {
                                 throw $e;
                             }
                         }
                     }
                     break;
                 case 'invoke':
                     $class_name = isset($app['class']) ? Lib::import($app['class']) : get_class($app_result);
                     $ref_class = new ReflectionClass($class_name);
                     foreach ($app['methods'] as $method) {
                         $invoke_class = $ref_class->getMethod($method['method'])->isStatic() ? $class_name : (isset($app['class']) ? new $class_name() : $app_result);
                         $args = array();
                         foreach ($method['args'] as $arg) {
                             if ($arg['type'] === 'result') {
                                 $args[] =& $app_result;
                             } else {
                                 $args[] = $arg['value'];
                             }
                         }
                         if (is_object($invoke_class)) {
                             foreach ($app['modules'] as $module) {
                                 $invoke_class->add_module(self::import_instance($module));
                             }
                         }
                         $app_result = call_user_func_array(array($invoke_class, $method['method']), $args);
                         $in_app = true;
                     }
                     break;
             }
         }
         if (!$match_handle) {
             Log::debug("nomatch");
             if ($parse_app["nomatch_redirect"] !== null) {
                 Http::redirect(App::url($parse_app["nomatch_redirect"]));
             }
             if ($parse_app["nomatch_template"] !== null) {
                 Http::status_header(404);
//.........这里部分代码省略.........
开发者ID:satully,项目名称:dev_socialapp,代码行数:101,代码来源:Flow.php

示例8: exists

 /**
  * Determine if any flashes exist in current session.
  * 
  * @return boolean
  */
 public function exists()
 {
     return $this->session->has($this->key);
 }
开发者ID:lukebro,项目名称:flash,代码行数:9,代码来源:FlashFactory.php

示例9: source_browse

 /**
  * ?????
  * @const string $svn_url リポジトリのURL
  */
 public function source_browse($package_name, $path = '')
 {
     if (empty($path)) {
         $this->redirect_method('source_browse', $package_name, '/trunk');
     }
     // TODO 仕様の確認
     // TODO SVNとの連携
     $package = C(OpenpearPackage)->find_get(Q::eq('name', $package_name));
     $path = rtrim(ltrim($path, ' /.'), '/');
     $local_root = File::absolute(OpenpearConfig::svn_root(), $package->name());
     $repo_path = File::absolute($local_root, $path);
     $info = Subversion::cmd('info', array($repo_path));
     if ($info['kind'] === 'dir') {
         $this->vars('tree', self::format_tree(Subversion::cmd('list', array($info['url']), array('revision' => $this->in_vars('rev', 'HEAD')))));
     } else {
         if ($info['kind'] === 'file') {
             $this->put_block('package/source_viewfile.html');
             $p = explode('.', $info['path']);
             $ext = array_pop($p);
             if (in_array($ext, $this->allowed_ext)) {
                 $source = Subversion::cmd('cat', array($info['url']), array('revision' => $this->in_vars('rev', 'HEAD')));
                 $this->vars('code', $source);
                 try {
                     $cache_key = array('syntax_highlight', md5($source));
                     if (Store::has($cache_key)) {
                         $this->vars('code', Store::get($cache_key));
                     } else {
                         include_once 'geshi/geshi.php';
                         $geshi = new Geshi($source, $ext);
                         $code = $geshi->parse_code();
                         Store::set($cache_key, $code);
                         $this->vars('code', $code);
                     }
                     $this->vars('geshi', true);
                 } catch (Exception $e) {
                     Log::debug($e);
                     $this->vars('geshi', false);
                 }
             }
         } else {
             $this->redirect_by_map('package', $package_name);
         }
     }
     $this->vars('path', $path);
     $this->vars('info', self::format_info($info));
     $this->vars('package', $package);
     $this->vars('real_url', File::absolute(OpenpearConfig::svn_url(), implode('/', array($package->name(), $path))));
     $this->vars('externals', Subversion::cmd('propget', array('svn:externals', $info['url'])));
     $this->add_vars_other_tree($package_name);
 }
开发者ID:nequal,项目名称:Openpear,代码行数:54,代码来源:OpenpearNoLogin.php

示例10: read

 /**
  * ファイルから生成する
  * @param string $filename テンプレートファイルパス
  * @param string $template_name 対象となるテンプレート名
  * @return string
  */
 public function read($filename = null, $template_name = null)
 {
     if (!empty($filename)) {
         $this->filename($filename);
     }
     $this->selected_template = $template_name;
     $cfilename = $this->filename() . $this->selected_template;
     if (!self::$is_cache || !Store::has($cfilename, true)) {
         if (strpos($filename, '://') === false) {
             $src = $this->parse(File::read($this->filename()));
         } else {
             if (empty($this->media_url)) {
                 $this->media_url($this->filename());
             }
             $src = $this->parse(Http::read($this->filename()));
         }
         if (self::$is_cache) {
             Store::set($cfilename, $src);
         }
     } else {
         $src = Store::get($cfilename);
     }
     $src = $this->html_reform($this->exec($src));
     $this->call_module('after_read_template', $src, $this);
     return $this->replace_ptag($src);
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:32,代码来源:Template.php


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