Exemple #1
0
 /**
  * In non admin mode checks if request was NOT processed by seo handler.
  * If NOT, then tries to load alternative SEO url and if url is available -
  * redirects to it. If no alternative path was found - 404 header is emitted
  * and page is rendered
  */
 protected function _processRequest()
 {
     $myUtils = oxRegistry::getUtils();
     // non admin, request is not empty and was not processed by seo engine
     if (!isSearchEngineUrl() && $myUtils->seoIsActive() && ($sStdUrl = getRequestUrl('', true))) {
         // fetching standard url and looking for it in seo table
         if ($this->_canRedirect() && ($sRedirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl($sStdUrl))) {
             $myUtils->redirect($this->getConfig()->getCurrentShopUrl() . $sRedirectUrl, false);
         } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
             // forcing to set no index/follow meta
             $this->_forceNoIndex();
             if ($this->getConfig()->getConfigParam('blSeoLogging')) {
                 $sShopId = $this->getConfig()->getShopId();
                 $sLangId = oxRegistry::getLang()->getBaseLanguage();
                 $sIdent = md5(strtolower($sStdUrl) . $sShopId . $sLangId);
                 // logging "not found" url
                 $oDb = oxDb::getDb();
                 $oDb->execute("replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang )\n                               values ( " . $oDb->quote($sStdUrl) . ", '{$sIdent}', '{$sShopId}', '{$sLangId}' ) ");
             }
         }
     }
 }
 public function testIsSearchEngineUrl()
 {
     $this->assertFalse(isSearchEngineUrl());
 }
 /**
  * Parse SEO url parameters.
  *
  * @return null
  */
 protected function _processSeoCall()
 {
     // TODO: refactor shop bootstrap and parse url params as soon as possible
     if (isSearchEngineUrl()) {
         oxNew('oxSeoDecoder')->processSeoCall();
     }
 }
 /**
  * In non admin mode checks if request was NOT processed by seo handler.
  * If NOT, then tries to load alternative SEO url and if url is available -
  * redirects to it. If no alternative path was found - 404 header is emitted
  * and page is rendered
  */
 protected function _processRequest()
 {
     $utils = oxRegistry::getUtils();
     // non admin, request is not empty and was not processed by seo engine
     if (!isSearchEngineUrl() && $utils->seoIsActive() && ($requestUrl = getRequestUrl())) {
         // fetching standard url and looking for it in seo table
         if ($this->_canRedirect() && ($redirectUrl = oxRegistry::get("oxSeoEncoder")->fetchSeoUrl($requestUrl))) {
             $utils->redirect($this->getConfig()->getCurrentShopUrl() . $redirectUrl, false, 301);
         } elseif (VIEW_INDEXSTATE_INDEX == $this->noIndex()) {
             // forcing to set no index/follow meta
             $this->_forceNoIndex();
             if ($this->getConfig()->getConfigParam('blSeoLogging')) {
                 $shopId = $this->getConfig()->getShopId();
                 $languageId = oxRegistry::getLang()->getBaseLanguage();
                 $id = md5(strtolower($requestUrl) . $shopId . $languageId);
                 // logging "not found" url
                 $database = oxDb::getDb();
                 $database->execute("replace oxseologs ( oxstdurl, oxident, oxshopid, oxlang ) values ( ?, ?, ?, ? ) ", array($requestUrl, $id, $shopId, $languageId));
             }
         }
     }
 }