Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_PageCache_Adminhtml_PageCacheController
  • Mage_PageCache_Block_Adminhtml_Cache_Additional
  • Mage_PageCache_Helper_Data
  • Mage_PageCache_Model_Control_Zend
  • Mage_PageCache_Model_Observer
  • Mage_PageCache_Model_System_Config_Source_Controls

Interfaces

  • Mage_PageCache_Model_Control_Interface
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Magento
 4:  *
 5:  * NOTICE OF LICENSE
 6:  *
 7:  * This source file is subject to the Open Software License (OSL 3.0)
 8:  * that is bundled with this package in the file LICENSE.txt.
 9:  * It is also available through the world-wide-web at this URL:
10:  * http://opensource.org/licenses/osl-3.0.php
11:  * If you did not receive a copy of the license and are unable to
12:  * obtain it through the world-wide-web, please send an email
13:  * to license@magentocommerce.com so we can send you a copy immediately.
14:  *
15:  * DISCLAIMER
16:  *
17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
18:  * versions in the future. If you wish to customize Magento for your
19:  * needs please refer to http://www.magentocommerce.com for more information.
20:  *
21:  * @category    Mage
22:  * @package     Mage_PageCache
23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
25:  */
26: 
27: /**
28:  * Page cache observer model
29:  *
30:  * @category    Mage
31:  * @package     Mage_PageCache
32:  * @author      Magento Core Team <core@magentocommerce.com>
33:  */
34: class Mage_PageCache_Model_Observer
35: {
36:     const XML_NODE_ALLOWED_CACHE = 'frontend/cache/allowed_requests';
37: 
38:     /**
39:      * Check if full page cache is enabled
40:      *
41:      * @return bool
42:      */
43:     public function isCacheEnabled()
44:     {
45:         return Mage::helper('pagecache')->isEnabled();
46:     }
47: 
48:     /**
49:      * Check when cache should be disabled
50:      *
51:      * @param Varien_Event_Observer $observer
52:      * @return Mage_PageCache_Model_Observer
53:      */
54:     public function processPreDispatch(Varien_Event_Observer $observer)
55:     {
56:         if (!$this->isCacheEnabled()) {
57:             return $this;
58:         }
59:         $action = $observer->getEvent()->getControllerAction();
60:         $request = $action->getRequest();
61:         $needCaching = true;
62: 
63:         if ($request->isPost()) {
64:             $needCaching = false;
65:         }
66: 
67:         $configuration = Mage::getConfig()->getNode(self::XML_NODE_ALLOWED_CACHE);
68: 
69:         if (!$configuration) {
70:             $needCaching = false;
71:         }
72: 
73:         $configuration = $configuration->asArray();
74:         $module = $request->getModuleName();
75:         $controller = $request->getControllerName();
76:         $action = $request->getActionName();
77: 
78:         if (!isset($configuration[$module])) {
79:             $needCaching = false;
80:         }
81: 
82:         if (isset($configuration[$module]['controller']) && $configuration[$module]['controller'] != $controller) {
83:             $needCaching = false;
84:         }
85: 
86:         if (isset($configuration[$module]['action']) && $configuration[$module]['action'] != $action) {
87:             $needCaching = false;
88:         }
89: 
90:         if (!$needCaching) {
91:             Mage::helper('pagecache')->setNoCacheCookie();
92:         }
93: 
94:         return $this;
95:     }
96: }
97: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0