Exemplo n.º 1
0
 /**
  * Save visitor information
  *
  * @param   Core_Model_Visitor $visitor
  * @return  Core_Model_Resource_Visitor
  */
 protected function _saveVisitorInfo(Core_Model_Abstract $visitor)
 {
     /* @var $stringHelper Core_Helper_String */
     $stringHelper = App_Main::getHelper('core/string');
     $referer = $stringHelper->cleanString($visitor->getHttpReferer());
     $referer = $stringHelper->substr($referer, 0, 255);
     $userAgent = $stringHelper->cleanString($visitor->getHttpUserAgent());
     $userAgent = $stringHelper->substr($userAgent, 0, 255);
     $charset = $stringHelper->cleanString($visitor->getHttpAcceptCharset());
     $charset = $stringHelper->substr($charset, 0, 255);
     $language = $stringHelper->cleanString($visitor->getHttpAcceptLanguage());
     $language = $stringHelper->substr($language, 0, 255);
     $write = $this->_getWriteAdapter();
     $data = array('visitor_id' => $visitor->getId(), 'http_referer' => $this->_prepareValueForSave($stringHelper->substr($visitor->getHttpReferer(), 0, 255)), 'http_user_agent' => $this->_prepareValueForSave($stringHelper->substr($visitor->getHttpUserAgent(), 0, 255)), 'http_accept_charset' => $this->_prepareValueForSave($stringHelper->substr($visitor->getHttpAcceptCharset(), 0, 255)), 'http_accept_language' => $this->_prepareValueForSave($stringHelper->substr($visitor->getHttpAcceptLanguage(), 0, 255)), 'server_addr' => $this->_prepareValueForSave($visitor->getServerAddr()), 'remote_addr' => $this->_prepareValueForSave($visitor->getRemoteAddr()));
     $write->insert($this->tbl_visitor_info, $data);
     return $this;
 }