Beispiel #1
0
 /**
  * check URL is enable using cache page or not.
  *
  * @param array $items
  * @param string $url
  * @return boolean is true if enable.
  */
 function isEnableCachedByUrl($items, $url, $params)
 {
     $menus =& JSite::getMenu();
     $uri =& JURI::getInstance();
     $host = $uri->toString(array('scheme', 'host', 'port'));
     // store data into cache
     $cache =& JFactory::getCache();
     $cache->setCaching(true);
     $cache->setLifeTime($params->get('cache_time', 30) * 60);
     $output = $cache->get(array('PlgIceSpeedHelper', '_renderLink'), array($host, $items));
     $output = PlgIceSpeedHelper::_renderLink($host, $items);
     if (empty($output)) {
         return false;
     }
     return isset($output[trim(str_replace($host, '', $url))]);
 }
Beispiel #2
0
 /**
  * process client requests to clear Joomla cache
  */
 function processClearCacheRequest()
 {
     if ($this->params->get('button_clearcache', 'allow_admin')) {
         global $_PROFILER;
         $mainframe = JFactory::getApplication();
         $rightToken = $this->params->get('token', 'ice');
         // echo $rightToken; die;
         if ($mainframe->isAdmin()) {
             return PlgIceSpeedHelper::clearAllCache($this->params);
         } else {
             if (trim(JRequest::getVar('token')) == $rightToken) {
                 return PlgIceSpeedHelper::clearAllCache($this->params);
             }
         }
     }
 }