protected function isCacheValid(&$manifestData) { if (N2SmartSliderHelper::getInstance()->isSliderChanged($this->parameters['slider']->sliderId, 1)) { $this->clearCurrentGroup(); N2SmartSliderHelper::getInstance()->setSliderChanged($this->parameters['slider']->sliderId, 0); return false; } $time = N2Platform::getTime(); if ($manifestData['nextCacheRefresh'] < $time) { return false; } return true; }
public function isVisible() { if (!$this->visible) { return false; } $time = N2Platform::getTime(); $publish_up = strtotime($this->publish_up); $publish_down = strtotime($this->publish_down); if ($publish_down) { if ($publish_down > $time) { $this->setNextCacheRefresh($publish_down); } else { return false; } } if ($publish_up) { if ($publish_up > $time) { $this->setNextCacheRefresh($publish_up); return false; } } return true; }
protected function addManifestData(&$manifestData) { $manifestData['cacheTime'] = N2Platform::getTime(); $this->generator->setNextCacheRefresh($manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60); }
function duplicate($id) { $slider = $this->get($id); unset($slider['id']); $slider['title'] .= ' - copy'; $slider['time'] = date('Y-m-d H:i:s', N2Platform::getTime()); try { $this->db->insert($slider); $newSliderId = $this->db->insertId(); } catch (Exception $e) { throw new Exception($e->getMessage()); } if (!$newSliderId) { return false; } $slidesModel = new N2SmartsliderSlidesModel(); foreach ($slidesModel->getAll($id) as $slide) { $slidesModel->copy($slide['id'], $newSliderId); } return $newSliderId; }