*/ class Mage_Rss_Model_Observer { /** * Factory instance * * @var Mage_Core_Model_Abstract */ protected $_factory; /** * Application instance * * @var Mage_Core_Model_App */ protected $_app; /** * @param array $args */ public function __construct(array $args = array()) { $this->_factory = !empty($args['factory']) ? $args['factory'] : Mage::getSingleton('core/factory'); $this->_app = !empty($args['app']) ? $args['app'] : Mage::app(); } /** * Clean cache for catalog review rss * * @param Varien_Event_Observer $observer * @return void */ public function reviewSaveAfter(Varien_Event_Observer $observer) { $this->_cleanCache(Mage_Rss_Block_Catalog_Review::CACHE_TAG); } /** * Clean cache for notify stock rss * * @param Varien_Event_Observer $observer * @return void */ public function salesOrderItemSaveAfterNotifyStock(Varien_Event_Observer $observer) { $this->_cleanCache(Mage_Rss_Block_Catalog_NotifyStock::CACHE_TAG); } /** * Clean cache for catalog new orders rss * * @param Varien_Event_Observer $observer * @return void */ public function salesOrderItemSaveAfterOrderNew(Varien_Event_Observer $observer) { $this->_cleanCache(Mage_Rss_Block_Order_New::CACHE_TAG); } /** * Cleaning cache * * @param string $tag */ protected function _cleanCache($tag) { if ($this->_factory->getHelper('rss')->isRssEnabled()) { $this->_app->cleanCache(array($tag)); } } }