Exemple #1
0
 /**
  * Redirect to content processing on new message
  *
  * @param string $content
  * @return bool
  */
 public function applyWithoutApp(&$content)
 {
     if ($this->_isNewMessageRecived()) {
         return false;
     }
     return parent::applyWithoutApp($content);
 }
Exemple #2
0
 /**
  * Save data to cache storage. Store many block instances in one cache record depending on additional cache ids.
  *
  * @param string $data
  * @param string $id
  * @param array $tags
  * @param null|int $lifetime
  * @return Ves_Optimize_Model_Container_Advanced_Abstract
  */
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     $additionalCacheId = $this->_getAdditionalCacheId();
     if (!$additionalCacheId) {
         Mage::throwException(Mage::helper('ves_optimize')->__('Additional id should not be empty'));
     }
     $tags[] = Ves_Optimize_Model_Processor::CACHE_TAG;
     $tags = array_merge($tags, $this->_getPlaceHolderBlock()->getCacheTags());
     if (is_null($lifetime)) {
         $lifetime = $this->_placeholder->getAttribute('cache_lifetime') ? $this->_placeholder->getAttribute('cache_lifetime') : false;
     }
     Ves_Optimize_Helper_Data::prepareContentPlaceholders($data);
     $result = array();
     $cacheRecord = parent::_loadCache($id);
     if ($cacheRecord) {
         $cacheRecord = json_decode($cacheRecord, true);
         if ($cacheRecord) {
             $result = $cacheRecord;
         }
     }
     $result[$additionalCacheId] = $data;
     Ves_Optimize_Model_Cache::getCacheInstance()->save(json_encode($result), $id, $tags, $lifetime);
     return $this;
 }
Exemple #3
0
 /**
  * Save data to cache storage and set cache lifetime equal with customer session lifetime
  *
  * @param string $data
  * @param string $id
  * @param array $tags
  */
 protected function _saveCache($data, $id, $tags = array(), $lifetime = null)
 {
     $lifetime = Mage::getConfig()->getNode(Mage_Core_Model_Session_Abstract::XML_PATH_COOKIE_LIFETIME);
     return parent::_saveCache($data, $id, $tags, $lifetime);
 }
 /**
  * Saves informational cache, containing parameters used to show lists.
  *
  * @return Ves_Optimize_Model_Container_CatalogProductItem
  */
 protected function _saveInfoCache()
 {
     $placeholderName = $this->_placeholder->getName();
     if (is_null(self::$_sharedInfoData[$placeholderName]['info'])) {
         return $this;
     }
     $data = array();
     $cacheRecord = Ves_Optimize_Model_Container_Abstract::_loadCache($this->_getCacheId());
     if ($cacheRecord) {
         $cacheRecord = json_decode($cacheRecord, true);
         if ($cacheRecord) {
             $data = $cacheRecord;
         }
     }
     $data[$this->_getInfoCacheId()] = self::$_sharedInfoData[$placeholderName]['info'];
     $data = json_encode($data);
     $tags = array(Ves_Optimize_Model_Processor::CACHE_TAG);
     $lifetime = $this->_placeholder->getAttribute('cache_lifetime');
     if (!$lifetime) {
         $lifetime = false;
     }
     Ves_Optimize_Model_Cache::getCacheInstance()->save($data, $this->_getCacheId(), $tags, $lifetime);
     return $this;
 }