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


PHP Cache::contains方法代码示例

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


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

示例1: getCode

 /**
  *
  * @return string 
  */
 public function getCode()
 {
     $res = "";
     if ($this->cacheName != "" && Cache::contains("tables", $this->cacheName)) {
         $res = Cache::getData("tables", $this->cacheName);
     } else {
         $res = "<table class='datatable'>";
         $this->columns->actions = $this->actions;
         $res .= $this->columns->getHeaderCode();
         $res .= "<tbody>";
         $rows_found = false;
         if ($rows = DataBase::Current()->ReadRows($this->getSelect())) {
             foreach ($rows as $row) {
                 $rows_found = true;
                 $res .= $this->columns->getBodyCode($row);
             }
         }
         if (!$rows_found) {
             $text = Language::GetGlobal()->Translate($this->noDataText);
             $res .= "<tr><td colspan='" . $this->columns->count() . "'>" . htmlentities($text) . "</td></tr>";
         }
         $res .= "</tbody>";
         $res .= "</table>";
         if ($this->cacheName) {
             Cache::setData("tables", $this->cacheName, $res);
         }
     }
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:33,代码来源:table.php

示例2: load

 public function load()
 {
     $this->headline = Language::DirectTranslate("plugin_menulistwidget_menus");
     if (Cache::contains("menu", "widget_" . $_GET['dir'])) {
         $this->content = Cache::getData("menu", "widget_" . $_GET['dir']);
     } else {
         if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
             $_GET['dir'] = "";
         }
         $template = new Template();
         $template->load("plugin_menulistwidget_menulist");
         $newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu");
         $template->assign_var("NEWMENUURL", $newmenuurl);
         $menus = sys::getMenues($_GET['dir']);
         foreach ($menus as $menu) {
             $index = $template->add_loop_item("MENUS");
             $template->assign_loop_var("MENUS", $index, "ID", $menu->id);
             $template->assign_loop_var("MENUS", $index, "TITLE", $menu->name);
             $template->assign_loop_var("MENUS", $index, "PAGES", $menu->count);
             $editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id);
             $template->assign_loop_var("MENUS", $index, "EDITURL", $editurl);
             $deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id);
             $template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl);
         }
         if (!$menus) {
             $template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus"));
         } else {
             $template->assign_var("NOMENUS", "");
         }
         $this->content = $template->getCode();
         Cache::setData("menu", "widget_" . $_GET['dir'], $this->content);
     }
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:33,代码来源:menulistwidget.php

示例3: loadResource

 /**
  * Loads a HTTP resource.
  *
  * @param string $url
  * @param array $parameters
  *
  * @return array
  */
 public function loadResource($url, $parameters)
 {
     $signature = $this->createSignature($url, $parameters);
     if ($this->cache->contains($signature)) {
         return $this->cache->fetch($signature);
     }
     $parameters['format'] = 'json';
     $parameters['api_key'] = $this->config->getApiKey();
     $url = $this->config->getApiEndpoint() . $this->buildQueryUrl($url, $parameters);
     $response = $this->guzzle->request('GET', $url);
     $body = $this->processResponse($response);
     $this->cache->save($signature, $body['results']);
     return $body['results'];
 }
开发者ID:dborsatto,项目名称:php-giantbomb,代码行数:22,代码来源:Client.php

示例4: load

 public function load()
 {
     $dir = '';
     if (isset($_GET['dir']) && substr($_GET['dir'], 0, 1) != '.') {
         $dir = $_GET['dir'];
     }
     $this->headline = Language::DirectTranslate("plugin_pagelistwidget_pages");
     if (Cache::contains("page", "widget_" . $dir)) {
         $this->content = Cache::getData("page", "widget_" . $dir);
     } else {
         $template = new Template();
         $template->load("plugin_pagelistwidget_pagelist");
         $pages = Page::getPagesByDir($dir);
         if (substr($dir, 0, 1) == "/") {
             $shortdir = substr($dir, 1);
         } else {
             $shortdir = $dir;
         }
         if ($pages) {
             foreach ($pages as $page) {
                 $shortalias = substr($page->alias, strlen($shortdir));
                 if (substr($shortalias, 0, 1) == "/") {
                     $shortalias = substr($shortalias, 1);
                 } else {
                     $shortalias = $shortalias;
                 }
                 if (!strpos($shortalias, "/")) {
                     $host = Settings::getInstance()->get("host");
                     $index = $template->add_loop_item("PAGES");
                     $template->assign_loop_var("PAGES", $index, "TITLE", $page->title);
                     $template->assign_loop_var("PAGES", $index, "ALIAS", $shortalias);
                     $editurl = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias);
                     $template->assign_loop_var("PAGES", $index, "EDITURL", $editurl);
                     $deleteurl = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . $page->alias);
                     $template->assign_loop_var("PAGES", $index, "DELETEURL", $deleteurl);
                     $showurl = UrlRewriting::GetUrlByAlias($page->alias);
                     $template->assign_loop_var("PAGES", $index, "SHOWURL", $showurl);
                 }
             }
             $template->assign_var("NOPAGES", "");
         } else {
             $template->assign_var("NOPAGES", Language::DirectTranslate("plugin_pagelistwidget_no_pages"));
         }
         $this->content = $template->getCode();
         if (isset($_GET['dir'])) {
             Cache::setData("page", "widget_" . $_GET['dir'], $this->content);
         }
     }
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:49,代码来源:pagelistwidget.php

示例5: getAllRoles

 /**
  *
  * @return Role 
  */
 public static function getAllRoles()
 {
     if (Cache::contains("roles", "all")) {
         $res = Cache::getData("roles", "all");
     } else {
         $roles = DataBase::Current()->ReadRows("SELECT id FROM {'dbprefix'}roles ORDER BY name, id");
         foreach ($roles as $role) {
             $newRole = new Role();
             $newRole->load($role->id);
             $res[] = $newRole;
         }
         Cache::setData("roles", "all", $res);
     }
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:19,代码来源:role.php

示例6: includeHeader

 static function includeHeader()
 {
     echo "<title>" . htmlentities(Page::Current()->title) . Settings::getValue("title_extention") . "</title>";
     if (Cache::contains("htmlmeta", Page::Current()->id)) {
         echo Cache::getData("htmlmeta", Page::Current()->id);
     } else {
         $cache = "";
         $rows = DataBase::Current()->ReadRows("SELECT name, content\n                            FROM {'dbprefix'}meta_global\n                            UNION SELECT name, content\n                            FROM {'dbprefix'}meta_local\n                            WHERE page = '" . Page::Current()->id . "'");
         if ($rows) {
             foreach ($rows as $row) {
                 echo "<meta name=\"" . htmlentities($row->name) . "\" content=\"" . htmlentities($row->content) . "\" />";
                 $cache .= "<meta name=\"" . htmlentities($row->name) . "\" content=\"" . htmlentities($row->content) . "\" />";
             }
         }
         Cache::setData("htmlmeta", Page::Current()->id, $cache);
     }
     echo Page::Current()->getHeader();
     EventManager::RaiseEvent("header_included", null);
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:19,代码来源:sys.php

示例7: GetAllHandler

 /**
  * 
  * @return array;
  */
 public static function GetAllHandler()
 {
     $res = self::$handler;
     if ($res == null) {
         if (Cache::contains("eventmanager", "handler")) {
             $res = Cache::getData("eventmanager", "handler");
         } else {
             $rows = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}events");
             foreach ($rows as $handler) {
                 if (!isset($item[$handler->event])) {
                     $res[$handler->event] = array();
                 }
                 $res[$handler->event][] = $handler->file;
             }
             Cache::setData("eventmanager", "handler", $res);
             self::$handler = $res;
         }
     }
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:24,代码来源:eventmanager.php

示例8: load

 public function load()
 {
     $this->headline = "Updater";
     include_once 'interfaces/iupdateimporter.php';
     include_once 'interfaces/iupdatecommand.php';
     if (Cache::contains("packages", "all")) {
         $installedPackages = $this->content = Cache::getData("packages", "all");
     } else {
         $installedPackages = Plugin_Updater_Package::readFromDB();
         Cache::setData("packages", "all", $installedPackages);
     }
     $path = "http://connect.contentlion.org/update.php?format=xml";
     $i = 0;
     if (is_array($installedPackages)) {
         foreach ($installedPackages as $package) {
             $path .= "&" . $package->getUpdateToken($i);
             $i++;
         }
     }
     $importer = new Plugin_Updater_UpdateXmlImporter();
     $importer->importPath($path);
     if ($importer->areUpdatesAvailible()) {
         $host = Settings::getInstance()->get("host");
         foreach ($importer->getUpdates() as $update) {
             if (isset($_GET['update']) && $_GET['update'] == $update->getName()) {
                 $this->content .= "<br />" . Language::DirectTranslate("install_it") . " " . $update->getName() . "...";
                 $update->runUpdate();
                 Cache::clear();
                 $this->content .= "<br />" . htmlentities(Language::DirectTranslate("plugin_updater_install_complete"));
             } else {
                 $this->content .= "<br />" . $update->getName() . " - <a href='" . $host . "admin/home.html?update=" . $update->getName() . "'>" . Language::DirectTranslate("plugin_updater_install") . "</a>";
             }
         }
     } else {
         $this->content = Language::DirectTranslate("plugin_updater_no_updates");
     }
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:37,代码来源:widget.php

示例9: getBreadcrumb

 /**
  *
  * @return string
  */
 function getBreadcrumb()
 {
     if (Cache::contains("breadcrumb", $this->id)) {
         $res = Cache::getData("breadcrumb", $this->id);
     } else {
         if (!$this->owner) {
             $this->getOwner(true);
         }
         if ($this->owner) {
             $res = $this->owner->getBreadcrumb();
         }
         $res[] = array($this->alias, $this->title);
         Cache::setData("breadcrumb", $this->id, $res);
     }
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:20,代码来源:page.php

示例10: getCached

 /**
  *
  * @param string $area
  * @param string $areatype
  * @param string $dir
  * @return Settings 
  */
 protected static function getCached($area, $areatype, $dir)
 {
     $res = null;
     $role = self::getRoleID();
     $res = new Settings();
     $res->setAreaType($areatype);
     $res->setArea($area);
     $res->setDir($dir);
     if (Cache::contains("settings", $area . "|" . $areatype . "|" . $dir . "|" . $role)) {
         $res->properties = Cache::getData("settings", $area . "|" . $areatype . "|" . $dir . "|" . $role);
     }
     return $res;
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:20,代码来源:settings.php


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