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


PHP JCache::makeId方法代码示例

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


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

示例1: _makeId

 /**
  * Generate a page cache id
  *
  * @return  string  MD5 Hash : page cache id
  *
  * @since   11.1
  * @todo    Discuss whether this should be coupled to a data hash or a request
  * hash ... perhaps hashed with a serialized request
  */
 protected function _makeId()
 {
     return JCache::makeId();
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:13,代码来源:page.php

示例2: _makeId

 /**
  * Generate a view cache id.
  *
  * @param   object  &$view   The view object to cache output for
  * @param   string  $method  The method name to cache for the view object
  *
  * @return  string  MD5 Hash : view cache id
  *
  * @since   11.1
  */
 protected function _makeId(&$view, $method)
 {
     return md5(serialize(array(JCache::makeId(), get_class($view), $method)));
 }
开发者ID:exntu,项目名称:joomla-cms,代码行数:14,代码来源:view.php

示例3: display

 /**
  * Default task. Assigns a model to the view and asks the view to render
  * itself.
  *
  * YOU MUST NOT USETHIS TASK DIRECTLY IN A URL. It is supposed to be
  * used ONLY inside your code. In the URL, use task=browse instead.
  *
  * @param   bool    $cachable   Is this view cacheable?
  * @param   bool    $urlparams  Add your safe URL parameters (see further down in the code)
  * @param   string  $tpl        The name of the template file to parse
  *
  * @return  bool
  */
 public function display($cachable = false, $urlparams = false, $tpl = null)
 {
     $document = F0FPlatform::getInstance()->getDocument();
     if ($document instanceof JDocument) {
         $viewType = $document->getType();
     } else {
         $viewType = $this->input->getCmd('format', 'html');
     }
     $view = $this->getThisView();
     // Get/Create the model
     if ($model = $this->getThisModel()) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     // Set the layout
     $view->setLayout(is_null($this->layout) ? 'default' : $this->layout);
     // Display the view
     $conf = F0FPlatform::getInstance()->getConfig();
     if (F0FPlatform::getInstance()->isFrontend() && $cachable && $viewType != 'feed' && $conf->get('caching') >= 1) {
         // Get a JCache object
         $option = $this->input->get('option', 'com_foobar', 'cmd');
         $cache = JFactory::getCache($option, 'view');
         // Set up a cache ID based on component, view, task and user group assignment
         $user = F0FPlatform::getInstance()->getUser();
         if ($user->guest) {
             $groups = array();
         } else {
             $groups = $user->groups;
         }
         // Set up safe URL parameters
         if (!is_array($urlparams)) {
             $urlparams = array('option' => 'CMD', 'view' => 'CMD', 'task' => 'CMD', 'format' => 'CMD', 'layout' => 'CMD', 'id' => 'INT');
         }
         if (is_array($urlparams)) {
             $app = JFactory::getApplication();
             $registeredurlparams = null;
             if (version_compare(JVERSION, '3.0', 'ge')) {
                 if (property_exists($app, 'registeredurlparams')) {
                     $registeredurlparams = $app->registeredurlparams;
                 }
             } else {
                 $registeredurlparams = $app->get('registeredurlparams');
             }
             if (empty($registeredurlparams)) {
                 $registeredurlparams = new stdClass();
             }
             foreach ($urlparams as $key => $value) {
                 // Add your safe url parameters with variable type as value {@see JFilterInput::clean()}.
                 $registeredurlparams->{$key} = $value;
             }
             if (version_compare(JVERSION, '3.0', 'ge')) {
                 $app->registeredurlparams = $registeredurlparams;
             } else {
                 $app->set('registeredurlparams', $registeredurlparams);
             }
         }
         // Create the cache ID after setting the registered URL params, as they are used to generate the ID
         $cacheId = md5(serialize(array(JCache::makeId(), $view->getName(), $this->doTask, $groups)));
         // Get the cached view or cache the current view
         $cache->get($view, 'display', $cacheId);
     } else {
         // Display without caching
         $view->display($tpl);
     }
     return true;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:79,代码来源:controller.php

示例4: _makeId

 /**
  * Generate a page cache id
  *
  * @todo	TODO: Discuss whether this should be coupled to a data hash or a request hash ... perhaps hashed with a serialized request
  *
  * @return	string	MD5 Hash : page cache id
  * @since	1.6
  */
 private function _makeId()
 {
     //return md5(JRequest::getURI());
     return JCache::makeId();
 }
开发者ID:akksi,项目名称:jcg,代码行数:13,代码来源:page.php

示例5: _makeId

 /**
  * Generate a page cache id
  *
  * @todo    Discuss whether this should be coupled to a data hash or a request
  *          hash ... perhaps hashed with a serialized request
  *
  * @return  string   MD5 Hash : page cache id
  *
  * @since   11.1
  */
 protected function _makeId()
 {
     //return md5(JRequest::getURI());
     return JCache::makeId();
 }
开发者ID:nibra,项目名称:joomla-platform,代码行数:15,代码来源:page.php

示例6: display

 /**
  * Typical view method for MVC based architecture
  *
  * This function is provide as a default implementation, in most cases
  * you will need to override it in your own controllers.
  *
  * @param   boolean  $cachable   If true, the view output will be cached
  * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  JController  A JController object to support chaining.
  *
  * @since   11.1
  */
 public function display($cachable = false, $urlparams = false)
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', $this->default_view);
     $viewLayout = JRequest::getString('layout', 'default');
     $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
     // Get/Create the model
     if ($model = $this->getModel($viewName)) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     $view->assignRef('document', $document);
     $conf = JFactory::getConfig();
     // Display the view
     if ($cachable && $viewType != 'feed' && $conf->get('caching') >= 1) {
         $option = JRequest::getCmd('option');
         //$cache = JFactory::getCache($option, 'view');
         if (is_array($urlparams)) {
             $app = JFactory::getApplication();
             if (!empty($app->registeredurlparams)) {
                 $registeredurlparams = $app->registeredurlparams;
             } else {
                 $registeredurlparams = new stdClass();
             }
             foreach ($urlparams as $key => $value) {
                 // Add your safe url parameters with variable type as value {@see JFilterInput::clean()}.
                 $registeredurlparams->{$key} = $value;
             }
             $app->registeredurlparams = $registeredurlparams;
         }
         //$cache->get($view, 'display');
         $id = md5(serialize(array(\JCache::makeId(), get_class($view), 'display')));
         $data = \Cache::get($option . '.' . $id);
         if (!$data || empty($data)) {
             //$content = $view->loadTemplate();
             ob_start();
             ob_implicit_flush(false);
             $view->display();
             $content = ob_get_contents();
             ob_end_clean();
             $data = array('content' => $content, 'head' => Document::getHeadData());
             \Cache::put($option . '.' . $id, $data, \Config::get('cachetime'));
         }
         echo $data['content'];
         Document::setHeadData($data['head']);
     } else {
         $view->display();
     }
     return $this;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:64,代码来源:controller.php

示例7: display

 /**
  * Default task. Assigns a model to the view and asks the view to render
  * itself.
  *
  * YOU MUST NOT USETHIS TASK DIRECTLY IN A URL. It is supposed to be
  * used ONLY inside your code. In the URL, use task=browse instead.
  *
  * @param   bool  $cachable   Is this view cacheable?
  * @param   bool  $urlparams  Add your safe URL parameters (see further down in the code)
  *
  * @return  void
  */
 public function display($cachable = false, $urlparams = false)
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $view = $this->getThisView();
     // Get/Create the model
     if ($model = $this->getThisModel()) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     // Set the layout
     $view->setLayout(is_null($this->layout) ? 'default' : $this->layout);
     // Display the view
     $conf = JFactory::getConfig();
     list($isCli, ) = FOFDispatcher::isCliAdmin();
     if (!$isCli && JFactory::getApplication()->isSite() && $cachable && $viewType != 'feed' && $conf->get('caching') >= 1) {
         // Get a JCache object
         $option = $this->input->get('option', 'com_foobar', 'cmd');
         $cache = JFactory::getCache($option, 'view');
         // Set up a cache ID based on component, view, task and user group assignment
         $user = JFactory::getUser();
         if ($user->guest) {
             $groups = array();
         } else {
             $groups = $user->groups;
         }
         $cacheId = md5(serialize(array(JCache::makeId(), $view->getName(), $this->doTask, $groups)));
         // Set up safe URL parameters
         if (is_array($urlparams)) {
             $app = JFactory::getApplication();
             $registeredurlparams = $app->get('registeredurlparams');
             if (empty($registeredurlparams)) {
                 $registeredurlparams = new stdClass();
             }
             foreach ($urlparams as $key => $value) {
                 // Add your safe url parameters with variable type as value {@see JFilterInput::clean()}.
                 $registeredurlparams->{$key} = $value;
             }
             $app->set('registeredurlparams', $registeredurlparams);
         }
         // Get the cached view or cache the current view
         $cache->get($view, 'display', $cacheId);
     } else {
         // Display without caching
         $view->display();
     }
     return true;
 }
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:60,代码来源:controller.php

示例8: display

 /**
  * Default task. Assigns a model to the view and asks the view to render
  * itself.
  *
  * YOU MUST NOT USE THIS TASK DIRECTLY IN A URL. It is supposed to be
  * used ONLY inside your code. In the URL, use task=browse instead.
  *
  * @param   bool    $cachable   Is this view cacheable?
  * @param   bool    $urlparams  Add your safe URL parameters (see further down in the code)
  * @param   string  $tpl        The name of the template file to parse
  *
  * @return  void
  */
 public function display($cachable = false, $urlparams = false, $tpl = null)
 {
     $document = $this->container->platform->getDocument();
     if ($document instanceof \JDocument) {
         $viewType = $document->getType();
     } else {
         $viewType = $this->input->getCmd('format', 'html');
     }
     $view = $this->getView();
     $view->setTask($this->task);
     $view->setDoTask($this->doTask);
     // Get/Create the model
     if ($model = $this->getModel()) {
         // Push the model into the view (as default)
         $view->setDefaultModel($model);
     }
     // Set the layout
     if (!is_null($this->layout)) {
         $view->setLayout($this->layout);
     }
     $conf = $this->container->platform->getConfig();
     if ($this->container->platform->isFrontend() && $cachable && $viewType != 'feed' && $conf->get('caching') >= 1) {
         // Get a JCache object
         $option = $this->input->get('option', 'com_foobar', 'cmd');
         $cache = \JFactory::getCache($option, 'view');
         // Set up a cache ID based on component, view, task and user group assignment
         $user = $this->container->platform->getUser();
         if ($user->guest) {
             $groups = array();
         } else {
             $groups = $user->groups;
         }
         $importantParameters = array();
         // Set up safe URL parameters
         if (!is_array($urlparams)) {
             $urlparams = array('option' => 'CMD', 'view' => 'CMD', 'task' => 'CMD', 'format' => 'CMD', 'layout' => 'CMD', 'id' => 'INT');
         }
         if (is_array($urlparams)) {
             /** @var \JApplicationCms $app */
             $app = \JFactory::getApplication();
             $registeredurlparams = null;
             if (!empty($app->registeredurlparams)) {
                 $registeredurlparams = $app->registeredurlparams;
             } else {
                 $registeredurlparams = new \stdClass();
             }
             foreach ($urlparams as $key => $value) {
                 // Add your safe url parameters with variable type as value {@see JFilterInput::clean()}.
                 $registeredurlparams->{$key} = $value;
                 // Add the URL-important parameters into the array
                 $importantParameters[$key] = $this->input->get($key, null, $value);
             }
             $app->registeredurlparams = $registeredurlparams;
         }
         // Create the cache ID after setting the registered URL params, as they are used to generate the ID
         $cacheId = md5(serialize(array(\JCache::makeId(), $view->getName(), $this->doTask, $groups, $importantParameters)));
         // Get the cached view or cache the current view
         $cache->get($view, 'display', $cacheId);
     } else {
         // Display without caching
         $view->display($tpl);
     }
 }
开发者ID:akeeba,项目名称:fof,代码行数:76,代码来源:Controller.php


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