Exemple #1
0
 /**
  * @magentoDataFixture Mage/Cms/_files/block.php
  * @magentoDataFixture Mage/Core/_files/variable.php
  * @magentoConfigFixture current_store web/unsecure/base_url http://example.com/
  * @magentoConfigFixture current_store web/unsecure/base_link_url http://example.com/
  */
 public function testToHtml()
 {
     $cmsBlock = new Mage_Cms_Model_Block();
     $cmsBlock->load('fixture_block', 'identifier');
     $block = new Mage_Cms_Block_Block();
     $block->setBlockId($cmsBlock->getId());
     $result = $block->toHtml();
     $this->assertContains('<a href="http://example.com/', $result);
     $this->assertContains('<p>Config value: "http://example.com/".</p>', $result);
     $this->assertContains('<p>Custom variable: "HTML Value".</p>', $result);
 }
 public function getCacheKeyInfo()
 {
     if ($this->getBlockId()) {
         return array(Mage_Cms_Model_Block::CACHE_TAG, Mage::app()->getStore()->getId(), $this->getBlockId(), (int) Mage::app()->getStore()->isCurrentlySecure());
     } else {
         return parent::getCacheKeyInfo();
     }
 }
Exemple #3
0
 /**
  * Prepare Content HTML.
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (!in_array(Mirasvit_SeoAutolink_Model_Config_Source_Target::CMS_BLOCK, $this->getConfig()->getTarget())) {
         return parent::_toHtml();
     }
     $html = parent::_toHtml();
     $html = Mage::helper('seoautolink')->addLinks($html);
     return $html;
 }
 public function getCacheKeyInfo()
 {
     $blockId = $this->getBlockId();
     if ($blockId) {
         $result = array($blockId, Mage::app()->getStore()->getCode());
     } else {
         $result = parent::getCacheKeyInfo();
     }
     return $result;
 }
Exemple #5
0
 /**
  * Get tags array for saving cache
  *
  * @return array
  */
 public function getCacheTags()
 {
     if (!$this->hasData('cache_tags')) {
         $cacheTags = array(MF_Flexibleblock_Model_Fblock::CACHE_TAG . "_" . $this->getId(), Mage_Catalog_Model_Product::CACHE_TAG, Mage_Catalog_Model_Category::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG);
         if ($this->getBlock()->getAdditionalCacheTags()) {
             $cacheTags = array_merge($cacheTags, explode(',', $this->getBlock()->getAdditionalCacheTags()));
         }
         $this->setData('cache_tags', $cacheTags);
     }
     return parent::getCacheTags();
 }
Exemple #6
0
 /**
  * @test
  */
 public function testGetCacheTagsCmsBlock()
 {
     $block = new Mage_Cms_Block_Block();
     $block->setNameInLayout('foo');
     $block->setId(5);
     $this->assertEquals(array('74709cfbbdffe24885db05ff5d08ea9c13663422', 'ba750b74090c01fda30a383d301af7e15b340928'), $this->_blockHelper->getCacheTags($block));
 }
Exemple #7
0
 /**
  * Collects list of objects in product list
  *
  * @param Mage_Cms_Block_Block|Mage_Cms_Block_Widget_Block $object
  * @return EcomDev_Varnish_Model_Proxy_Cms_Block[]
  */
 public function collect($object)
 {
     $blockProxy = Mage::getModel('ecomdev_varnish/proxy_cms_block')->setId($object->getBlockId());
     return array($blockProxy);
 }