Ejemplo n.º 1
0
 protected function _construct()
 {
     parent::_construct();
     if (version_compare(Mage::getVersion(), '1.3.2.2', '>')) {
         $userAgent = Mage::helper('core/http')->getHttpUserAgent();
         if (!$this->_skipRequestLogging) {
             if (empty($userAgent)) {
                 $this->_skipRequestLogging = true;
             }
         }
         //ignore user agents was introduced in 1.4.0.0
         if (!$this->_skipRequestLogging && version_compare(Mage::getVersion(), '1.4.0.0') < 0) {
             $ignoreAgents = Mage::getConfig()->getNode('global/ignore_user_agents');
             if ($ignoreAgents) {
                 $ignoreAgents = $ignoreAgents->asArray();
                 if (in_array($userAgent, $ignoreAgents)) {
                     $this->_skipRequestLogging = true;
                 }
             }
         }
         if (!$this->_skipRequestLogging) {
             if (preg_match("/" . self::USER_AGENT_BOT_PATTERN . "/i", $userAgent)) {
                 $this->_skipRequestLogging = true;
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Object initialization
  */
 protected function _construct()
 {
     // Call upon the parent constructor
     $rt = parent::_construct();
     // If module is disabled
     if ((bool) Mage::getStoreConfig('disablelog/settings/enabled') == false) {
         return $rt;
     }
     // Check disable_all flag
     $this->_skipRequestLogging = (bool) Mage::getStoreConfig('disablelog/settings/disable_all');
     // Check if logging should be disabled for a specific user-agent
     if ($this->_skipRequestLogging == false) {
         $userAgent = Mage::helper('core/http')->getHttpUserAgent();
         $ignoreAgents = Mage::getConfig()->getNode('global/skip_user_agents');
         if ($ignoreAgents) {
             $ignoreAgents = $ignoreAgents->asArray();
             foreach ($ignoreAgents as $ignoreAgent) {
                 if (stristr($userAgent, $ignoreAgent)) {
                     $this->_skipRequestLogging = true;
                     break;
                 }
             }
         }
     }
     return $rt;
 }