public static function getLibrary()
 {
     if (!PageCache::$library) {
         $class = '\\Concrete\\Core\\Cache\\Page\\' . Loader::helper('text')->camelcase(Config::get('concrete.cache.page.adapter')) . 'PageCache';
         PageCache::$library = new $class();
     }
     return PageCache::$library;
 }
Esempio n. 2
0
 public static function getLibrary()
 {
     if (!PageCache::$library) {
         $adapter = Config::get('concrete.cache.page.adapter');
         $class = overrideable_core_class('Core\\Cache\\Page\\' . camelcase($adapter) . 'PageCache', DIRNAME_CLASSES . '/Cache/Page/' . camelcase($adapter) . 'PageCache.php');
         PageCache::$library = new $class();
     }
     return PageCache::$library;
 }
 public function validate()
 {
     $diff = $this->expires - time();
     if ($diff > 0) {
         // it's still valid
         return true;
     } else {
         // invalidate and kill this record.
         $cache = PageCache::getLibrary();
         $cache->purgeByRecord($this);
     }
 }
Esempio n. 4
0
 public function view()
 {
     $config = $this->getSite()->getConfigRepository();
     $this->set('tracking_code_header', $config->get('seo.tracking.code.header'));
     $this->set('tracking_code_footer', $config->get('seo.tracking.code.footer'));
     if ($this->isPost()) {
         if ($this->token->validate('update_tracking_code')) {
             $config->save('seo.tracking.code.header', $this->post('tracking_code_header'));
             $config->save('seo.tracking.code.footer', $this->post('tracking_code_footer'));
             $pageCache = PageCache::getLibrary();
             if (is_object($pageCache)) {
                 $pageCache->flush();
             }
             $this->redirect('/dashboard/system/seo/codes', 'saved');
         } else {
             $this->error->add($this->token->getErrorMessage());
         }
     }
 }
Esempio n. 5
0
 public function view()
 {
     $this->set('tracking_code', Config::get('concrete.seo.tracking.code'));
     $tracking_code_position = Config::get('concrete.seo.tracking.code_position');
     if (!$tracking_code_position) {
         $tracking_code_position = 'bottom';
     }
     $this->set('tracking_code_position', $tracking_code_position);
     if ($this->isPost()) {
         if ($this->token->validate('update_tracking_code')) {
             Config::save('concrete.seo.tracking.code', $this->post('tracking_code'));
             Config::save('concrete.seo.tracking.code_position', $this->post('tracking_code_position'));
             $pageCache = PageCache::getLibrary();
             if (is_object($pageCache)) {
                 $pageCache->flush();
             }
             $this->redirect('/dashboard/system/seo/codes', 'saved');
         } else {
             $this->error->add($this->token->getErrorMessage());
         }
     }
 }
Esempio n. 6
0
 /**
  * Checks to see whether we should deliver a concrete5 response from the page cache.
  */
 public function checkPageCache(\Concrete\Core\Http\Request $request)
 {
     $library = PageCache::getLibrary();
     if ($library->shouldCheckCache($request)) {
         $record = $library->getRecord($request);
         if ($record instanceof PageCacheRecord) {
             if ($record->validate()) {
                 return $library->deliver($record);
             }
         }
     }
     return false;
 }
Esempio n. 7
0
 public function getCacheKey($mixed)
 {
     return parent::getCacheKey($mixed);
 }