OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Core\SeoEncoder Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Core\SeoEncoder:
+ Collaboration diagram for OxidEsales\EshopCommunity\Core\SeoEncoder:

Public Member Functions

 addLanguageParam ($sSeoUrl, $iLang)
 
 __construct ()
 
 getDynamicObjectId ($iShopId, $sStdUrl)
 
 encodeString ($sString, $blReplaceChars=true, $iLang=false)
 
 setSeparator ($sSeparator=null)
 
 setPrefix ($sPrefix)
 
 setIdLength ($iIdlength=null)
 
 setReservedWords ($aReservedWords)
 
 markAsExpired ($sId, $iShopId=null, $iExpStat=1, $iLang=null, $sParams=null)
 
 encodeStaticUrls ($aStaticUrl, $iShopId, $iLang)
 
 copyStaticUrls ($iShopId)
 
 getStaticUrl ($sStdUrl, $iLang=null, $iShopId=null)
 
 addSeoEntry ($sObjectId, $iShopId, $iLang, $sStdUrl, $sSeoUrl, $sType, $blFixed=1, $sKeywords='', $sDescription='', $sParams='', $blExclude=false, $sAltObjectId=null)
 
 deleteSeoEntry ($objectId, $shopId, $language, $type)
 
 getMetaData ($sObjectId, $sMetaType, $iShopId=null, $iLang=null)
 
 getDynamicUrl ($sStdUrl, $sSeoUrl, $iLang)
 
 fetchSeoUrl ($standardUrl, $languageId=null)
 

Protected Member Functions

 _processSeoUrl ($sSeoUrl, $sObjectId=null, $iLang=null, $blExclude=false)
 
 _copyToHistory ($sId, $iShopId, $iLang, $sType=null, $sNewId=null)
 
 _getDynamicUri ($sStdUrl, $sSeoUrl, $iLang)
 
 _getFullUrl ($sSeoUrl, $iLang=null, $blSsl=false)
 
 _getSeoIdent ($sSeoUrl)
 
 _getStaticUri ($sStdUrl, $iShopId, $iLang)
 
 _getUrlExtension ()
 
 _getUniqueSeoUrl ($sSeoUrl, $sObjectId=null, $iObjectLang=null)
 
 _isFixed ($sType, $sId, $iLang, $iShopId=null, $sParams=null, $blStrictParamsCheck=true)
 
 _getCacheKey ($sType, $iLang=null, $iShopId=null, $sParams=null)
 
 _loadFromCache ($sCacheIdent, $sType, $iLang=null, $iShopId=null, $sParams=null)
 
 _saveInCache ($sCacheIdent, $sCache, $sType, $iLang=null, $iShopId=null, $sParams=null)
 
 _loadFromDb ($sType, $sId, $iLang, $iShopId=null, $sParams=null, $blStrictParamsCheck=true)
 
 _getReservedEntryKeys ()
 
 _prepareUri ($sUri, $iLang=false)
 
 _prepareTitle ($sTitle, $blSkipTruncate=false, $iLang=false)
 
 _saveToDb ($sType, $sObjectId, $sStdUrl, $sSeoUrl, $iLang, $iShopId=null, $blFixed=null, $sParams=null)
 
 executeQuery ($query)
 
 _trimUrl ($sUrl, $iLang=null)
 
 _getMaxUrlLength ()
 
 _getPageUri ($oObject, $sType, $sStdUrl, $sSeoUrl, $sParams, $iLang=null, $blFixed=false)
 
 _getStaticObjectId ($iShopId, $sStdUrl)
 
 _getAltUri ($sObjectId, $iLang)
 
 executeDatabaseQuery ($query)
 
 replaceSpecialChars ($stringWithSpecialChars)
 
 assembleFullPageUrl ($object, $type, $stdUrl, $seoUrl, $pageNumber, $parameters, $languageId, $isFixed)
 

Protected Attributes

 $_iIdLength = 255
 
 $_sAddParams = null
 
 $_iMaxUrlLength = null
 

Static Protected Attributes

static $_aReservedWords = ['admin']
 
static $_aReservedEntryKeys = null
 
static $_sSeparator = null
 
static $_sPrefix = null
 
static $_aFixedCache = []
 
static $_sCacheKey = null
 
static $_aCache = []
 

Detailed Description

Seo encoder base

Constructor & Destructor Documentation

◆ __construct()

OxidEsales\EshopCommunity\Core\SeoEncoder::__construct ( )

SEO encoder constructor

Member Function Documentation

◆ _copyToHistory()

OxidEsales\EshopCommunity\Core\SeoEncoder::_copyToHistory (   $sId,
  $iShopId,
  $iLang,
  $sType = null,
  $sNewId = null 
)
protected

Moves current seo record to seo history table

Parameters
string$sIdobject id
int$iShopIdactive shop id
int$iLangobject language
string$sTypeobject type (if you pass real object - type is not necessary)
string$sNewIdnew object id, mostly used for static url updates (optional)

◆ _getAltUri()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getAltUri (   $sObjectId,
  $iLang 
)
protected

Returns alternative uri used while updating seo

Parameters
string$sObjectIdobject id
int$iLanglanguage id

◆ _getCacheKey()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getCacheKey (   $sType,
  $iLang = null,
  $iShopId = null,
  $sParams = null 
)
protected

Returns cache key (in non admin mode)

Parameters
string$sTypeobject type
int$iLangactive language id
mixed$iShopIdactive shop id
string$sParamsadditional seo params. optional (mostly used for db indexing)
Returns
string

◆ _getDynamicUri()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getDynamicUri (   $sStdUrl,
  $sSeoUrl,
  $iLang 
)
protected

Returns dynamic object SEO URI

Parameters
string$sStdUrlstandard url
string$sSeoUrlseo uri
int$iLangactive language
Returns
string

◆ _getFullUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getFullUrl (   $sSeoUrl,
  $iLang = null,
  $blSsl = false 
)
protected

Returns SEO url with shop's path + additional params ( \OxidEsales\Eshop\Core\SeoEncoder:: _getAddParams)

Parameters
string$sSeoUrlseo URL
int$iLangactive language
bool$blSslforces to build ssl url
Returns
string

◆ _getMaxUrlLength()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getMaxUrlLength ( )
protected

Returns maximum seo/dynamic url length

Returns
int

◆ _getPageUri()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getPageUri (   $oObject,
  $sType,
  $sStdUrl,
  $sSeoUrl,
  $sParams,
  $iLang = null,
  $blFixed = false 
)
protected

Loads if exists or prepares and saves new seo url for passed object

Parameters
\OxidEsales\Eshop\Core\Model\BaseModel$oObjectobject to prepare seo data
string$sTypetype of object (oxvendor/oxcategory)
string$sStdUrlstanradr url
string$sSeoUrlseo uri
string$sParamsadditional params, liek page number etc. mostly used by mysql for indexes
int$iLanglanguage
bool$blFixedfixed url marker (default is false)
Returns
string

◆ _getReservedEntryKeys()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getReservedEntryKeys ( )
protected

cached getter: check root directory php file names for them not to be in 1st part of seo url because then apache will execute that php file instead of url parser

Returns
array

◆ _getSeoIdent()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getSeoIdent (   $sSeoUrl)
protected

_getSeoIdent returns seo ident for db search

Parameters
string$sSeoUrlseo url

@access protected

Returns
string

◆ _getStaticObjectId()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getStaticObjectId (   $iShopId,
  $sStdUrl 
)
protected

Generates static url object id

Parameters
int$iShopIdshop id
string$sStdUrlstandard (dynamic) url
Returns
string

◆ _getStaticUri()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getStaticUri (   $sStdUrl,
  $iShopId,
  $iLang 
)
protected

Returns SEO static uri

Parameters
string$sStdUrlstandard page url
int$iShopIdactive shop id
int$iLangactive language
Returns
string

◆ _getUniqueSeoUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getUniqueSeoUrl (   $sSeoUrl,
  $sObjectId = null,
  $iObjectLang = null 
)
protected

_getUniqueSeoUrl returns possibly modified url for not to be same as already existing in db

Parameters
string$sSeoUrlseo url
string$sObjectIdcurrent object id, used to skip self in query
int$iObjectLangobject language id

@access protected

Returns
string

◆ _getUrlExtension()

OxidEsales\EshopCommunity\Core\SeoEncoder::_getUrlExtension ( )
protected

Returns target "extension"

Returns
null

◆ _isFixed()

OxidEsales\EshopCommunity\Core\SeoEncoder::_isFixed (   $sType,
  $sId,
  $iLang,
  $iShopId = null,
  $sParams = null,
  $blStrictParamsCheck = true 
)
protected

check if seo url exist and is fixed

Parameters
string$sTypeobject type
string$sIdobject identifier
int$iLangactive language id
mixed$iShopIdactive shop id
string$sParamsadditional seo params. optional (mostly used for db indexing)
bool$blStrictParamsCheckstrict parameters check

@access protected

Returns
bool

◆ _loadFromCache()

OxidEsales\EshopCommunity\Core\SeoEncoder::_loadFromCache (   $sCacheIdent,
  $sType,
  $iLang = null,
  $iShopId = null,
  $sParams = null 
)
protected

Loads seo data from cache for active view (in non admin mode)

Parameters
string$sCacheIdentcache identifier
string$sTypeobject type
int$iLangactive language id
mixed$iShopIdactive shop id
string$sParamsadditional seo params. optional (mostly used for db indexing)
Returns
string

◆ _loadFromDb()

OxidEsales\EshopCommunity\Core\SeoEncoder::_loadFromDb (   $sType,
  $sId,
  $iLang,
  $iShopId = null,
  $sParams = null,
  $blStrictParamsCheck = true 
)
protected

_loadFromDb loads data from oxseo table if exists returns oxseo url

Parameters
string$sTypeobject type
string$sIdobject identifier
int$iLangactive language id
mixed$iShopIdactive shop id
string$sParamsadditional seo params. optional (mostly used for db indexing)
bool$blStrictParamsCheckstrict parameters check

@access protected

Returns
string || false

◆ _prepareTitle()

OxidEsales\EshopCommunity\Core\SeoEncoder::_prepareTitle (   $sTitle,
  $blSkipTruncate = false,
  $iLang = false 
)
protected

Prepares and returns formatted object SEO id

Parameters
string$sTitleOriginal object title
bool$blSkipTruncateTruncate title into defined lenght or not
int$iLanglanguage ID, for which to prepare the title
Returns
string

◆ _prepareUri()

OxidEsales\EshopCommunity\Core\SeoEncoder::_prepareUri (   $sUri,
  $iLang = false 
)
protected

Makes safe seo uri - removes unsupported/reserved characters

Parameters
string$sUriseo uri
int$iLanglanguage ID, for which URI should be prepared
Returns
string

◆ _processSeoUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::_processSeoUrl (   $sSeoUrl,
  $sObjectId = null,
  $iLang = null,
  $blExclude = false 
)
protected

Processes seo url before saving to db:

  • \OxidEsales\Eshop\Core\SeoEncoder::addLanguageParam();
  • \OxidEsales\Eshop\Core\SeoEncoder::_getUniqueSeoUrl().
Parameters
string$sSeoUrlseo url to process
string$sObjectIdseo object id [optional]
int$iLangactive language id [optional]
bool$blExcludeexclude language prefix while building seo url
Returns
string

◆ _saveInCache()

OxidEsales\EshopCommunity\Core\SeoEncoder::_saveInCache (   $sCacheIdent,
  $sCache,
  $sType,
  $iLang = null,
  $iShopId = null,
  $sParams = null 
)
protected

Saves seo cache data for active view (in non admin mode)

Parameters
string$sCacheIdentcache identifier
string$sCachecacheable data
string$sTypeobject type
int$iLangactive language id
mixed$iShopIdactive shop id
string$sParamsadditional seo params. optional (mostly used for db indexing)
Returns
bool

◆ _saveToDb()

OxidEsales\EshopCommunity\Core\SeoEncoder::_saveToDb (   $sType,
  $sObjectId,
  $sStdUrl,
  $sSeoUrl,
  $iLang,
  $iShopId = null,
  $blFixed = null,
  $sParams = null 
)
protected

_saveToDb saves values to seo table

Parameters
string$sTypeurl type (static, dynamic, oxarticle etc)
string$sObjectIdobject identifier
string$sStdUrlstandard url
string$sSeoUrlseo url
int$iLangactive object language
mixed$iShopIdactive object shop id
bool$blFixedseo entry marker. if true, entry should not be automatically changed
string$sParamsadditional seo params. optional (mostly used for db indexing)

@access protected

Returns
mixed

◆ _trimUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::_trimUrl (   $sUrl,
  $iLang = null 
)
protected

Removes shop path part and session id from given url

Parameters
string$sUrlurl to clean bad chars
int$iLangactive language

@access protected

Returns
string

◆ addLanguageParam()

OxidEsales\EshopCommunity\Core\SeoEncoder::addLanguageParam (   $sSeoUrl,
  $iLang 
)

Returns part of url defining active language

Parameters
string$sSeoUrlseo url
int$iLanglanguage id
Returns
string

◆ addSeoEntry()

OxidEsales\EshopCommunity\Core\SeoEncoder::addSeoEntry (   $sObjectId,
  $iShopId,
  $iLang,
  $sStdUrl,
  $sSeoUrl,
  $sType,
  $blFixed = 1,
  $sKeywords = '',
  $sDescription = '',
  $sParams = '',
  $blExclude = false,
  $sAltObjectId = null 
)

Adds new seo entry to db

Parameters
string$sObjectIdobjects id
int$iShopIdshop id
int$iLangobjects language
string$sStdUrldefault url
string$sSeoUrlseo url
string$sTypeobject type
bool$blFixedmarker to keep seo config unchangeable
string$sKeywordsseo keywords
string$sDescriptionseo description
string$sParamsadditional seo params. optional (mostly used for db indexing)
bool$blExcludeexclude language prefix while building seo url
string$sAltObjectIdalternative object id used while saving meta info (used to override object id when saving tags related info)

◆ assembleFullPageUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::assembleFullPageUrl (   $object,
  $type,
  $stdUrl,
  $seoUrl,
  $pageNumber,
  $parameters,
  $languageId,
  $isFixed 
)
protected

Assemble full paginated url.

Parameters
\OxidEsales\Eshop\Application\Model\$objectObject, atm category, vendor, manufacturer, recommendationList.
string$typeSeo identifier, see oxseo.oxtype.
string$stdUrlStandard url
string$seoUrlSeo url
integer$pageNumberNumber of the page which should be prepared.
string$parametersAdditional parameters, mostly used by mysql for indices.
int$languageIdLanguage id.
bool$isFixedFixed url marker (default is null).
Returns
string

◆ copyStaticUrls()

OxidEsales\EshopCommunity\Core\SeoEncoder::copyStaticUrls (   $iShopId)

Method copies static urls from base shop to newly created

Parameters
int$iShopIdnew created shop id

◆ deleteSeoEntry()

OxidEsales\EshopCommunity\Core\SeoEncoder::deleteSeoEntry (   $objectId,
  $shopId,
  $language,
  $type 
)

Remove a SEO entry from the database.

Parameters
string$objectIdThe id of the object to delete.
int$shopIdThe shop id of the object to delete.
int$languageThe language of the object to delete.
string$typeThe type of the object to delete.

◆ encodeStaticUrls()

OxidEsales\EshopCommunity\Core\SeoEncoder::encodeStaticUrls (   $aStaticUrl,
  $iShopId,
  $iLang 
)

Static url encoder

Parameters
array$aStaticUrlstatic url info (contains standard URL and urls for each language)
int$iShopIdactive shop id
int$iLangactive language
Exceptions
Exception
Returns
null

◆ encodeString()

OxidEsales\EshopCommunity\Core\SeoEncoder::encodeString (   $sString,
  $blReplaceChars = true,
  $iLang = false 
)

Replaces special chars in text

Parameters
string$sStringstring to encode
bool$blReplaceCharsis true, replaces user defined (\OxidEsales\Eshop\Core\Language::getSeoReplaceChars) characters into alternative
int$iLanglanguage, for which to encode the string
Returns
string

◆ executeDatabaseQuery()

OxidEsales\EshopCommunity\Core\SeoEncoder::executeDatabaseQuery (   $query)
protected

Execute a query on the database.

Parameters
string$queryThe command to execute on the database.

◆ executeQuery()

OxidEsales\EshopCommunity\Core\SeoEncoder::executeQuery (   $query)
protected

Runs query. Returns false when the query fail, otherwise return true

Parameters
string$queryQuery to execute.
Returns
bool

◆ fetchSeoUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::fetchSeoUrl (   $standardUrl,
  $languageId = null 
)

Searches for seo url in seo table. If not found - FALSE is returned

Parameters
string$standardUrl
int$languageId
Returns
string|false

◆ getDynamicObjectId()

OxidEsales\EshopCommunity\Core\SeoEncoder::getDynamicObjectId (   $iShopId,
  $sStdUrl 
)

Generates dynamic url object id (calls \OxidEsales\Eshop\Core\SeoEncoder::_getStaticObjectId)

Parameters
int$iShopIdshop id
string$sStdUrlstandard (dynamic) url
Returns
string

◆ getDynamicUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::getDynamicUrl (   $sStdUrl,
  $sSeoUrl,
  $iLang 
)

getDynamicUrl acts similar to static urls, except, that dynamic url are not shown in admin and they can be re-encoded by providing new seo url

Parameters
string$sStdUrlstandard url
string$sSeoUrlpart of URL query which will be attached to standard shop url
int$iLangactive language

@access public

Returns
string

◆ getMetaData()

OxidEsales\EshopCommunity\Core\SeoEncoder::getMetaData (   $sObjectId,
  $sMetaType,
  $iShopId = null,
  $iLang = null 
)

Returns meta information for preferred object

Parameters
string$sObjectIdinformation object id
string$sMetaTypemetadata type - "oxkeywords", "oxdescription"
int$iShopIdactive shop id [optional]
int$iLangactive language [optional]
Returns
string

◆ getStaticUrl()

OxidEsales\EshopCommunity\Core\SeoEncoder::getStaticUrl (   $sStdUrl,
  $iLang = null,
  $iShopId = null 
)

Returns static url for passed standard link (if available)

Parameters
string$sStdUrlstandard Url
int$iLangactive language (optional). default null
int$iShopIdactive shop id (optional). default null
Returns
string

◆ markAsExpired()

OxidEsales\EshopCommunity\Core\SeoEncoder::markAsExpired (   $sId,
  $iShopId = null,
  $iExpStat = 1,
  $iLang = null,
  $sParams = null 
)

Marks object seo records as expired

Parameters
string$sIdchanged object id. If null is passed, object dependency is not checked
int$iShopIdactive shop id. Shop id must be passed uf you want to do shop level update (default null)
int$iExpStatexpiration status: 1 - standard expiration
int$iLangactive language (optiona;)
string$sParamsadditional params

◆ replaceSpecialChars()

OxidEsales\EshopCommunity\Core\SeoEncoder::replaceSpecialChars (   $stringWithSpecialChars)
protected

Searches for special characters in a string and replaces them with the configured strings.

Parameters
string$stringWithSpecialChars
Returns
string

◆ setIdLength()

OxidEsales\EshopCommunity\Core\SeoEncoder::setIdLength (   $iIdlength = null)

sets seo id length

Parameters
string$iIdlengthid length

◆ setPrefix()

OxidEsales\EshopCommunity\Core\SeoEncoder::setPrefix (   $sPrefix)

Sets SEO prefix

Parameters
string$sPrefixSEO prefix

◆ setReservedWords()

OxidEsales\EshopCommunity\Core\SeoEncoder::setReservedWords (   $aReservedWords)

Sets array of words which must be checked before building seo url These words are appended by seo prefix if they are the initial uri segment

Parameters
array$aReservedWordsreserved words

◆ setSeparator()

OxidEsales\EshopCommunity\Core\SeoEncoder::setSeparator (   $sSeparator = null)

Sets SEO separator

Parameters
string$sSeparatorSEO seperator

Member Data Documentation

◆ $_aCache

OxidEsales\EshopCommunity\Core\SeoEncoder::$_aCache = []
staticprotected

◆ $_aFixedCache

OxidEsales\EshopCommunity\Core\SeoEncoder::$_aFixedCache = []
staticprotected

Url fixed state cache

Returns
array

◆ $_aReservedEntryKeys

OxidEsales\EshopCommunity\Core\SeoEncoder::$_aReservedEntryKeys = null
staticprotected

◆ $_aReservedWords

OxidEsales\EshopCommunity\Core\SeoEncoder::$_aReservedWords = ['admin']
staticprotected

◆ $_iIdLength

OxidEsales\EshopCommunity\Core\SeoEncoder::$_iIdLength = 255
protected

◆ $_iMaxUrlLength

OxidEsales\EshopCommunity\Core\SeoEncoder::$_iMaxUrlLength = null
protected

◆ $_sAddParams

OxidEsales\EshopCommunity\Core\SeoEncoder::$_sAddParams = null
protected

◆ $_sCacheKey

OxidEsales\EshopCommunity\Core\SeoEncoder::$_sCacheKey = null
staticprotected

◆ $_sPrefix

OxidEsales\EshopCommunity\Core\SeoEncoder::$_sPrefix = null
staticprotected

◆ $_sSeparator

OxidEsales\EshopCommunity\Core\SeoEncoder::$_sSeparator = null
staticprotected

The documentation for this class was generated from the following file: