106         $iLang    = (int) $iLang;
 
  107         $iDefLang = (int) $this->
getConfig()->getConfigParam( 
'iDefSeoLang' );
 
  110         if ( $iLang != $iDefLang && isset( $aLangIds[$iLang] ) && 
getStr()->strpos( $sSeoUrl, $aLangIds[$iLang] . 
'/' ) !== 0 ) {
 
  111             $sSeoUrl = $aLangIds[$iLang] . 
'/'.$sSeoUrl;
 
  129     protected function _processSeoUrl( $sSeoUrl, $sObjectId = null, $iLang = null, $blExclude = 
false )
 
  143         if (!self::$_sSeparator) {
 
  146         if (!self::$_sPrefix) {
 
  163     protected function _copyToHistory( $sId, $iShopId, $iLang, $sType = null, $sNewId = null )
 
  166         $sObjectid = $sNewId?$oDb->quote( $sNewId ):
'oxobjectid';
 
  167         $sType     = $sType?
"oxtype =".$oDb->quote( $sType ).
" and":
'';
 
  168         $iLang     = (int) $iLang;
 
  171         $sSub = 
"select $sObjectid, MD5( LOWER( oxseourl ) ), oxshopid, oxlang, now() from oxseo 
  172                  where {$sType} oxobjectid = ".$oDb->quote( $sId ).
" and oxshopid = ".$oDb->quote( $iShopId ).
" and 
  173                  oxlang = {$iLang} and oxexpired = '1'";
 
  174         $sQ   = 
"replace oxseohistory ( oxobjectid, oxident, oxshopid, oxlang, oxinsert ) {$sSub}";
 
  175         $oDb->execute( $sQ );
 
  202         $iShopId = $this->
getConfig()->getShopId();
 
  204         $sStdUrl   = $this->
_trimUrl( $sStdUrl );
 
  209         $sOldSeoUrl = $this->
_loadFromDb( 
'dynamic', $sObjectId, $iLang );
 
  210         if ( $sOldSeoUrl === $sSeoUrl ) {
 
  211             $sSeoUrl = $sOldSeoUrl;
 
  223             $this->
_saveToDb( 
'dynamic', $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId );
 
  238     protected function _getFullUrl( $sSeoUrl, $iLang = null, $blSsl = 
false )
 
  241             $sFullUrl = ( $blSsl ? $this->
getConfig()->getSslShopUrl( $iLang ) : $this->
getConfig()->getShopUrl( $iLang, 
false ) ) . $sSeoUrl;
 
  258         return md5( strtolower( $sSeoUrl ) );
 
  272         $sStdUrl = $this->
_trimUrl( $sStdUrl, $iLang );
 
  300         $sSeoUrl = $this->
_prepareUri( $sSeoUrl, $iObjectLang );
 
  303         if ( $oStr->preg_match( 
'/(\.html?|\/)$/i', $sSeoUrl, $aMatched ) ) {
 
  304             $sExt = $aMatched[0];
 
  306         $sBaseSeoUrl = $sSeoUrl;
 
  307         if ( $sExt && $oStr->substr( $sSeoUrl, 0 - $oStr->strlen( $sExt ) ) == $sExt ) {
 
  308             $sBaseSeoUrl = $oStr->substr( $sSeoUrl, 0, $oStr->strlen( $sSeoUrl ) - $oStr->strlen( $sExt ) );
 
  311         $iShopId = $this->
getConfig()->getShopId();
 
  313         $sCheckSeoUrl = $this->
_trimUrl( $sSeoUrl );
 
  314         $sQ = 
"select 1 from oxseo where oxshopid = '{$iShopId}'";
 
  318         if ( $sObjectId && isset($iObjectLang) ) {
 
  319             $iObjectLang = (int) $iObjectLang;
 
  320             $sQ .= 
" and not (oxobjectid = " . $oDb->quote( $sObjectId ) . 
" and oxlang = $iObjectLang)";
 
  323         while ( $oDb->getOne( $sQ .
" and oxident= " . $oDb->quote( $this->_getSeoIdent( $sCheckSeoUrl ) ) ) ) {
 
  325             if ( self::$_sPrefix ) {
 
  329                 $sAdd .= self::$_sSeparator . $iCnt;
 
  333             $sSeoUrl = $sBaseSeoUrl . $sAdd . $sExt;
 
  334             $sCheckSeoUrl = $this->
_trimUrl( $sSeoUrl );
 
  353     protected function _isFixed( $sType, $sId, $iLang, $iShopId = null, $sParams = null, $blStrictParamsCheck = 
true)
 
  355         if ( $iShopId === null ) {
 
  356             $iShopId = $this->
getConfig()->getShopId();
 
  358         $iLang = (int) $iLang;
 
  360         if ( !isset( self::$_aFixedCache[$sType][$sShopId][$sId][$iLang] ) ) {
 
  363             $sQ = 
"SELECT `oxfixed` 
  365                 WHERE `oxtype` = ".$oDb->quote( $sType ).
" 
  366                    AND `oxobjectid` = ".$oDb->quote( $sId ) .
" 
  367                    AND `oxshopid` = ".$oDb->quote( $iShopId ).
" 
  368                    AND `oxlang` = '{$iLang}'";
 
  370             $sParams = $sParams ? $oDb->quote( $sParams ) : 
"''";
 
  371             if ( $sParams && $blStrictParamsCheck ) {
 
  372                 $sQ .= 
" AND `oxparams` = {$sParams}";
 
  374                 $sQ .= 
" ORDER BY `oxparams` ASC";
 
  378             self::$_aFixedCache[$sType][$sShopId][$sId][$iLang] = (bool) $oDb->getOne( $sQ );
 
  380         return self::$_aFixedCache[$sType][$sShopId][$sId][$iLang];
 
  393     protected function _getCacheKey( $sType, $iLang = null, $iShopId = null, $sParams = null )
 
  396         if ( !$blAdmin && $sType !== 
"oxarticle" ) {
 
  397             return $sType . ( (int) $iLang ) . ( (int) $iShopId ) . 
"seo";
 
  401         if ( self::$_sCacheKey === null ) {
 
  402             self::$_sCacheKey = 
false;
 
  403             if ( !$blAdmin && ( $oView = $this->
getConfig()->getActiveView() ) ) {
 
  404                 self::$_sCacheKey = md5( $oView->getViewId() ) . 
"seo";
 
  421     protected function _loadFromCache( $sCacheIdent, $sType, $iLang = null, $iShopId = null, $sParams = null )
 
  423         if ( !$this->
getConfig()->getConfigParam( 
'blEnableSeoCache' ) ) {
 
  427         startProfile( 
"seoencoder_loadFromCache" );
 
  429         $sCacheKey = $this->
_getCacheKey( $sType, $iLang, $iShopId, $sParams );
 
  432         if ( $sCacheKey && !isset( self::$_aCache[$sCacheKey] ) ) {
 
  436         if ( isset( self::$_aCache[$sCacheKey] ) && isset( self::$_aCache[$sCacheKey][$sCacheIdent] ) ) {
 
  437             $sCache = self::$_aCache[$sCacheKey][$sCacheIdent];
 
  440         stopProfile( 
"seoencoder_loadFromCache" );
 
  456     protected function _saveInCache( $sCacheIdent, $sCache, $sType, $iLang = null, $iShopId = null, $sParams = null )
 
  458         if ( !$this->
getConfig()->getConfigParam( 
'blEnableSeoCache' ) ) {
 
  462         startProfile( 
"seoencoder_saveInCache" );
 
  465         if ( $sCache && ( $sCacheKey = $this->
_getCacheKey( $sType, $iLang, $iShopId, $sParams ) ) !== 
false ) {
 
  466             self::$_aCache[$sCacheKey][$sCacheIdent] = $sCache;
 
  470         stopProfile( 
"seoencoder_saveInCache" );
 
  489     protected function _loadFromDb( $sType, $sId, $iLang, $iShopId = null, $sParams = null, $blStrictParamsCheck = 
true)
 
  492         if ( $iShopId === null ) {
 
  493             $iShopId = $this->
getConfig()->getShopId();
 
  496         $iLang = (int) $iLang;
 
  506             WHERE `oxtype` = ".$oDb->quote( $sType ).
" 
  507                AND `oxobjectid` = ".$oDb->quote( $sId ) .
" 
  508                AND `oxshopid` = ".$oDb->quote( $iShopId ).
" 
  509                AND `oxlang` = '{$iLang}'";
 
  511         $sParams = $sParams ? $sParams : 
'';
 
  512         if ( $sParams && $blStrictParamsCheck ) {
 
  513             $sQ .= 
" AND `oxparams` = '{$sParams}'";
 
  515             $sQ .= 
" ORDER BY `oxparams` ASC";
 
  521         $sIdent = md5( $sQ );
 
  524         if ( ( $sSeoUrl = $this->
_loadFromCache( $sIdent, $sType, $iLang, $iShopId, $sParams ) ) === 
false ) {
 
  525             $oRs = $oDb->select( $sQ );
 
  527             if ( $oRs && $oRs->recordCount() > 0 && !$oRs->EOF ) {
 
  529                 if ( $oRs->fields[
'oxexpired'] && ( $oRs->fields[
'oxtype'] == 
'static' || $oRs->fields[
'oxtype'] == 
'dynamic' ) ) {
 
  532                     $oDb->execute( 
"update oxseo set oxexpired = 0 where oxobjectid = ".$oDb->quote( $sId ).
" and oxlang = '{$iLang}'" );
 
  533                     $sSeoUrl = $oRs->fields[
'oxseourl'];
 
  534                 } elseif ( !$oRs->fields[
'oxexpired'] || $oRs->fields[
'oxfixed'] ) {
 
  536                     $sSeoUrl = $oRs->fields[
'oxseourl'];
 
  540                 $this->
_saveInCache( $sIdent, $sSeoUrl, $sType, $iLang, $iShopId, $sParams );
 
  554         if ( !isset( self::$_aReservedEntryKeys ) || !is_array( self::$_aReservedEntryKeys ) ) {
 
  555             $sDir = getShopBasePath();
 
  556             self::$_aReservedEntryKeys = array_map(
'preg_quote', self::$_aReservedWords, array(
'#'));
 
  558             foreach ( glob( 
"$sDir/*" ) as $sFile ) {
 
  559                 if ( $oStr->preg_match( 
'/^(.+)\.php[0-9]*$/i', basename( $sFile ), $aMatches ) ) {
 
  560                     self::$_aReservedEntryKeys[] = preg_quote( $aMatches[0], 
'#' );
 
  561                     self::$_aReservedEntryKeys[] = preg_quote( $aMatches[1], 
'#' );
 
  562                 } elseif ( is_dir( $sFile ) ) {
 
  563                     self::$_aReservedEntryKeys[] = preg_quote( basename( $sFile ), 
'#' );
 
  566             self::$_aReservedEntryKeys = array_unique(self::$_aReservedEntryKeys);
 
  586         $sUri = $oStr->strip_tags( $sUri );
 
  590         if ($sExt === null) {
 
  592             if ( $oStr->preg_match( 
'/(\.html?|\/)$/i', $sUri, $aMatched ) ) {
 
  593                 $sExt = $aMatched[0];
 
  598         if ( $sExt && $oStr->substr( $sUri, 0 - $oStr->strlen( $sExt ) ) == $sExt ) {
 
  599             $sUri = $oStr->substr( $sUri, 0, $oStr->strlen( $sUri ) - $oStr->strlen( $sExt ) );
 
  604         $sQuotedPrefix = preg_quote( self::$_sSeparator . self::$_sPrefix, 
'/');
 
  605         if ( phpversion() < 
'5.3' ) {
 
  606             $sQuotedPrefix = str_replace( 
'-', 
'\-', $sQuotedPrefix );
 
  608         $sRegExp = 
'/[^A-Za-z0-9' . $sQuotedPrefix . 
'\/]+/';
 
  609         $sUri  = $oStr->preg_replace( array( 
"/\W*\/\W*/", $sRegExp ), array( 
"/", self::$_sSeparator ), $sUri );
 
  612         if ( !$sUri && self::$_sPrefix ) {
 
  613             $sUri = $this->
_prepareUri( self::$_sPrefix, $iLang );
 
  617         if (
'/' != self::$_sSeparator) {
 
  619             $sUri = trim($sUri, self::$_sSeparator);
 
  628         $sUri = $oStr->preg_replace( 
"#^(/*)(".implode(
'|', $this->
_getReservedEntryKeys()).
")(/|$)#i", 
"\$1\$2$sAdd\$3", $sUri );
 
  633         if ( phpversion() < 
'5.3' ) {
 
  634             $sQuotedSeparator = str_replace( 
'-', 
'\-', $sQuotedSeparator );
 
  636         return $oStr->preg_replace( array( 
'|//+|', 
'/' . $sQuotedSeparator . $sQuotedSeparator .
'+/' ),
 
  637                              array( 
'/', self::$_sSeparator ), $sUri );
 
  650     protected function _prepareTitle( $sTitle, $blSkipTruncate = 
false, $iLang = 
false )
 
  654         if (!$sSep || (
'/' == $sSep)) {
 
  658         $sRegExp = 
'/[^A-Za-z0-9\/'.preg_quote( self::$_sPrefix, 
'/').preg_quote($sSep, 
'/').
']+/';
 
  659         $sTitle = preg_replace( array(
"#/+#", $sRegExp, 
"# +#", 
"#(".preg_quote($sSep, 
'/').
")+#"), $sSep, $sTitle );
 
  664             $iFirstSpace = $oStr->strpos( $sTitle, $sSep, $this->_iIdLength);
 
  665             if ( $iFirstSpace !== 
false ) {
 
  666                 $sTitle = $oStr->substr( $sTitle, 0, $iFirstSpace );
 
  670         $sTitle = trim( $sTitle, $sSep );
 
  696     protected function _saveToDb( $sType, $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId = null, $blFixed = null, $sParams = null )
 
  699         if ( $iShopId === null ) {
 
  700             $iShopId = $this->
getConfig()->getShopId();
 
  703         $iLang = (int) $iLang;
 
  705         $sStdUrl = $this->
_trimUrl( $sStdUrl );
 
  706         $sSeoUrl = $this->
_trimUrl( $sSeoUrl );
 
  710         $sQtedObjectId = $oDb->quote( $sObjectId );
 
  711         $iQtedShopId   = $oDb->quote( $iShopId );
 
  712         $sQtedType     = $oDb->quote( $sType );
 
  713         $sQtedSeoUrl   = $oDb->quote( $sSeoUrl );
 
  714         $sQtedStdUrl   = $oDb->quote( $sStdUrl );
 
  715         $sQtedParams   = $oDb->quote( $sParams );
 
  716         $sQtedIdent    = $oDb->quote( $sIdent );
 
  719         $sQ  = 
"select oxfixed, oxexpired, ( oxstdurl like {$sQtedStdUrl} ) as samestdurl, 
  720                 oxseourl like {$sQtedSeoUrl} as sameseourl from oxseo where oxtype = {$sQtedType} and 
  721                 oxobjectid = {$sQtedObjectId} and oxshopid = {$iQtedShopId}  and oxlang = {$iLang} ";
 
  723         $sQ .= $sParams ? 
" and oxparams = {$sQtedParams} " : 
'';
 
  726         $oRs = $oDb->select( $sQ );
 
  727         if ( $oRs && $oRs->recordCount() > 0 && !$oRs->EOF ) {
 
  728             if ( $oRs->fields[
'samestdurl'] && $oRs->fields[
'sameseourl'] && $oRs->fields[
'oxexpired'] ) {
 
  730                 $sFixed = isset( $blFixed ) ? 
", oxfixed = " . ( (int) $blFixed ) . 
" " : 
'';
 
  732                 $sSql  = 
"update oxseo set oxexpired = 0 {$sFixed} where oxtype = {$sQtedType} and 
  733                           oxobjectid = {$sQtedObjectId} and oxshopid = {$iQtedShopId} and oxlang = {$iLang} ";
 
  734                 $sSql .= $sParams ? 
" and oxparams = {$sQtedParams} " : 
'';
 
  737                 return $oDb->execute( $sSql );
 
  738             } elseif ( $oRs->fields[
'oxexpired'] ) {
 
  745         $sParams = $sParams ? $oDb->quote( $sParams ) :
'""';
 
  746         $blFixed = (int) $blFixed;
 
  748         $sQ  = 
"insert into oxseo 
  749                     (oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype, oxfixed, oxexpired, oxparams) 
  751                     ( {$sQtedObjectId}, {$sQtedIdent}, {$iQtedShopId}, {$iLang}, {$sQtedStdUrl}, {$sQtedSeoUrl}, {$sQtedType}, '$blFixed', '0', {$sParams} ) 
  752                 on duplicate key update 
  753                     oxident = {$sQtedIdent}, oxstdurl = {$sQtedStdUrl}, oxseourl = {$sQtedSeoUrl}, oxfixed = '$blFixed', oxexpired = '0'";
 
  755         return $oDb->execute( $sQ );
 
  768     protected function _trimUrl( $sUrl, $iLang = null )
 
  772         $sUrl = str_replace( array( 
$myConfig->getShopUrl( $iLang, 
false ), 
$myConfig->getSslShopUrl( $iLang ) ), 
'', $sUrl );
 
  773         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)(force_)?(admin_)?sid=[a-z0-9\.]+&?(amp;)?/i', 
'\1', $sUrl );
 
  774         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)shp=[0-9]+&?(amp;)?/i', 
'\1', $sUrl );
 
  775         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)lang=[0-9]+&?(amp;)?/i', 
'\1', $sUrl );
 
  776         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)cur=[0-9]+&?(amp;)?/i', 
'\1', $sUrl );
 
  777         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)stoken=[a-z0-9]+&?(amp;)?/i', 
'\1', $sUrl );
 
  778         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)&(amp;)?/i', 
'\1', $sUrl );
 
  779         $sUrl = $oStr->preg_replace( 
'/(\?|&(amp;)?)+$/i', 
'', $sUrl );
 
  780         $sUrl = trim( $sUrl );
 
  784         if ( $oStr->strlen( $sUrl ) > $iLength ) {
 
  785             $sUrl = $oStr->substr( $sUrl, 0, $iLength );
 
  798         if ( $this->_iMaxUrlLength === null ) {
 
  800             $this->_iMaxUrlLength = $this->
getConfig()->getConfigParam( 
"iMaxSeoUrlLength" ) ;
 
  801             if ( !$this->_iMaxUrlLength ) {
 
  802                 $this->_iMaxUrlLength = 2048;
 
  817     public function encodeString( $sString, $blReplaceChars = 
true, $iLang = 
false )
 
  820         $sString = 
getStr()->html_entity_decode( $sString );
 
  822         if ( $blReplaceChars ) {
 
  823             if ($iLang === 
false || !is_numeric($iLang)) {
 
  828                 $sString = str_replace( array_keys( $aReplaceChars ), array_values( $aReplaceChars ), $sString );
 
  834         $aReplaceWhat = array( 
'&', 
'"', 
''', 
'<', 
'>' );
 
  835         return str_replace( $aReplaceWhat, 
'', $sString );
 
  847         self::$_sSeparator = $sSeparator;
 
  848         if ( !self::$_sSeparator ) {
 
  849             self::$_sSeparator = 
'-';
 
  863             self::$_sPrefix = $sPrefix;
 
  865             self::$_sPrefix = 
'oxid';
 
  878         if ( isset( $iIdlength ) ) {
 
  879             $this->_iIdLength = $iIdlength;
 
  893         self::$_aReservedWords = array_merge( self::$_aReservedWords, $aReservedWords );
 
  908     public function markAsExpired( $sId, $iShopId = null, $iExpStat = 1, $iLang = null, $sParams = null )
 
  911         $sWhere  = $sId ? 
"where oxobjectid =  " . $oDb->quote( $sId ) : 
'';
 
  912         $sWhere .= isset( $iShopId ) ? ( $sWhere ? 
" and oxshopid = ". $oDb->quote( $iShopId ) : 
"where oxshopid = ". $oDb->quote( $iShopId ) ) : 
'';
 
  913         $sWhere .= !is_null($iLang) ? ( $sWhere ? 
" and oxlang = '{$iLang}'" : 
"where oxlang = '{$iLang}'" ) : 
'';
 
  914         $sWhere .= $sParams ? ( $sWhere ? 
" and {$sParams}" : 
"where {$sParams}" ) : 
'';
 
  916         $sQ = 
"update oxseo set oxexpired =  " . $oDb->quote( $iExpStat ) . 
" $sWhere ";
 
  917         $oDb->execute( $sQ );
 
  933     protected function _getPageUri( $oObject, $sType, $sStdUrl, $sSeoUrl, $sParams, $iLang = null, $blFixed = 
false )
 
  935         if ( !isset( $iLang ) ) {
 
  936             $iLang = $oObject->getLanguage();
 
  938         $iShopId = $this->
getConfig()->getShopId();
 
  941         $sOldSeoUrl = $this->
_loadFromDb( $sType, $oObject->getId(), $iLang, $iShopId, $sParams );
 
  942         if ( !$sOldSeoUrl ) {
 
  944             $sSeoUrl = $this->
_processSeoUrl( $sSeoUrl, $oObject->getId(), $iLang );
 
  945             $this->
_saveToDb( $sType, $oObject->getId(), $sStdUrl, $sSeoUrl, $iLang, $iShopId, (int) $blFixed, $sParams );
 
  948             $sSeoUrl = $sOldSeoUrl;
 
  963         return md5( strtolower ( $iShopId . $this->
_trimUrl( $sStdUrl ) ) );
 
  979         $sOldObjectId = null;
 
  982         $sStdUrl = $this->
_trimUrl( trim( $aStaticUrl[
'oxseo__oxstdurl'] ) );
 
  983         $sObjectId = $aStaticUrl[
'oxseo__oxobjectid'];
 
  985         if ( !$sObjectId || $sObjectId == 
'-1' ) {
 
  989             $sOldObjectId = $sObjectId;
 
  997         foreach ( $aStaticUrl[
'oxseo__oxseourl'] as $iLang => $sSeoUrl ) {
 
  999             $iLang = (int) $iLang;
 
 1002             $sSeoUrl = $this->
_trimUrl( $sSeoUrl );
 
 1004                 $sSeoUrl = $this->
_processSeoUrl( $sSeoUrl, $sObjectId, $iLang );
 
 1008             if ( $sOldObjectId ) {
 
 1010                 if ( !$oDb->getOne( 
"select (" . $oDb->quote( $sSeoUrl ) . 
" like oxseourl) & (" . $oDb->quote( $sStdUrl ) . 
" like oxstdurl) from oxseo where oxobjectid = ".$oDb->quote( $sOldObjectId ).
" and oxshopid = '{$iShopId}' and oxlang = '{$iLang}' ", 
false, 
false) ) {
 
 1011                     $this->
_copyToHistory( $sOldObjectId, $iShopId, $iLang, 
'static', $sObjectId );
 
 1015             if ( !$sSeoUrl || !$sStdUrl ) {
 
 1025             $sValues .= 
"( " . $oDb->quote( $sObjectId ) . 
", " . $oDb->quote( $sIdent ) . 
", " . $oDb->quote( $iShopId ).
", '{$iLang}', " . $oDb->quote( $sStdUrl ) . 
", " . $oDb->quote( $sSeoUrl ) . 
", 'static' )";
 
 1029         if ( $sOldObjectId ) {
 
 1030             $oDb->execute( 
"delete from oxseo where oxobjectid in ( " . $oDb->quote( $sOldObjectId ) . 
", " . $oDb->quote( $sObjectId ) . 
" )" );
 
 1036             $sQ = 
"insert into oxseo ( oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype ) values {$sValues} ";
 
 1037             $oDb->execute( $sQ );
 
 1052         $iBaseShopId = $this->
getConfig()->getBaseShopId();
 
 1053         if ( $iShopId != $iBaseShopId ) {
 
 1056                 $sQ = 
"insert into oxseo ( oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype ) 
 1057                        select MD5( LOWER( CONCAT( " . $oDb->quote( $iShopId ) . 
", oxstdurl ) ) ), MD5( LOWER( oxseourl ) ), 
 1058                        " . $oDb->quote( $iShopId ) . 
", oxlang, oxstdurl, oxseourl, oxtype from oxseo where oxshopid = '{$iBaseShopId}' and oxtype = 'static' and oxlang='$iLang' ";
 
 1059                 $oDb->execute( $sQ );
 
 1075         if (!isset($iShopId)) {
 
 1076             $iShopId = $this->
getConfig()->getShopId();
 
 1078         if (!isset($iLang)) {
 
 1082         if ( isset($this->_aStaticUrlCache[$sStdUrl][$iLang][$iShopId])) {
 
 1083             return $this->_aStaticUrlCache[$sStdUrl][$iLang][$iShopId];
 
 1087         if ( ( $sSeoUrl = $this->
_getStaticUri( $sStdUrl, $iShopId, $iLang ) ) ) {
 
 1088             $sFullUrl = $this->
_getFullUrl( $sSeoUrl, $iLang, strpos( $sStdUrl, 
"https:" ) === 0 );
 
 1092         $this->_aStaticUrlCache[$sStdUrl][$iLang][$iShopId] = $sFullUrl;
 
 1115     public function addSeoEntry( $sObjectId, $iShopId, $iLang, $sStdUrl, $sSeoUrl, $sType, $blFixed = 1, $sKeywords = 
'', $sDescription = 
'', $sParams = 
'', $blExclude = 
false, $sAltObjectId = null )
 
 1117         $sSeoUrl = $this->
_processSeoUrl( $this->
_trimUrl( $sSeoUrl ? $sSeoUrl : $this->
_getAltUri( $sAltObjectId ? $sAltObjectId : $sObjectId, $iLang ) ), $sObjectId, $iLang, $blExclude );
 
 1118         if ( $this->
_saveToDb( $sType, $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId, $blFixed, $sParams ) ) {
 
 1123             $sQtedObjectId = $oDb->quote( $sAltObjectId ? $sAltObjectId : $sObjectId );
 
 1124             $iQtedShopId   = $oDb->quote( $iShopId );
 
 1127             if ( $sKeywords !== 
false ) {
 
 1128                 $sKeywords = $oDb->quote( $oStr->htmlspecialchars( $this->encodeString( $oStr->strip_tags( $sKeywords ), 
false, $iLang ) ) );
 
 1131             if ( $sDescription !== 
false ) {
 
 1132                 $sDescription = $oDb->quote( $oStr->htmlspecialchars( $oStr->strip_tags( $sDescription ) ) );
 
 1135             $sQ = 
"insert into oxobject2seodata 
 1136                        ( oxobjectid, oxshopid, oxlang, oxkeywords, oxdescription ) 
 1138                        ( {$sQtedObjectId}, {$iQtedShopId}, {$iLang}, ".( $sKeywords ? $sKeywords : 
"''" ).
", ".( $sDescription ? $sDescription : 
"''" ).
" ) 
 1139                    on duplicate key update 
 1140                        oxkeywords = ".( $sKeywords ? $sKeywords : 
"oxkeywords" ).
", oxdescription = ".( $sDescription ? $sDescription : 
"oxdescription" );
 
 1141             $oDb->execute( $sQ );
 
 1170         $sQ = 
"delete from oxseo where oxobjectid = " . $oDb->quote( $sObjectId ) . 
" and oxshopid = " . $oDb->quote( $iShopId ) . 
" and oxlang = " . $oDb->quote( $iLang ) . 
" and oxtype = " . $oDb->quote( $sType ) . 
" ";
 
 1171         $oDb->execute( $sQ );
 
 1184     public function getMetaData( $sObjectId, $sMetaType, $iShopId = null, $iLang = null )
 
 1188         $iShopId = ( !isset( $iShopId ) ) ? $this->
getConfig()->getShopId():$iShopId;
 
 1189         $iLang   = ( !isset( $iLang ) ) ? 
oxRegistry::getLang()->getObjectTplLanguage():((int) $iLang);
 
 1190         return $oDb->getOne( 
"select {$sMetaType} from oxobject2seodata where oxobjectid = " . $oDb->quote( $sObjectId ) . 
" and oxshopid = " . $oDb->quote( $iShopId ).
" and oxlang = '{$iLang}'" );
 
 1208         startProfile(
"getDynamicUrl");
 
 1209         $sDynUrl = $this->
_getFullUrl( $this->
_getDynamicUri( $sStdUrl, $sSeoUrl, $iLang ), $iLang, strpos( $sStdUrl, 
"https:" ) === 0 );
 
 1210         stopProfile(
"getDynamicUrl");
 
 1225         $iLanguage = isset( $iLanguage ) ? ( (int) $iLanguage ) : 
oxRegistry::getLang()->getBaseLanguage();
 
 1228         $sShopId = $this->
getConfig()->getShopId();
 
 1230         $sQ = 
"SELECT `oxseourl`, `oxlang` FROM `oxseo` WHERE `oxstdurl` = " . $oDb->quote( $sStdUrl ) . 
" AND `oxlang` = '$iLanguage' AND `oxshopid` = '$sShopId' LIMIT 1";
 
 1233         $oRs = $oDb->select( $sQ );
 
 1236             $sSeoUrl = $oRs->fields[
'oxseourl'];