Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
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());
         }
     }
 }
Exemplo n.º 3
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());
         }
     }
 }
Exemplo n.º 4
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;
 }