Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

oxSeoEncoder Class Reference

Inheritance diagram for oxSeoEncoder:
Collaboration diagram for oxSeoEncoder:

List of all members.

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 ($sObjectId, $iShopId, $iLang, $sType)
 getMetaData ($sObjectId, $sMetaType, $iShopId=null, $iLang=null)
 getDynamicUrl ($sStdUrl, $sSeoUrl, $iLang)
 fetchSeoUrl ($sStdUrl, $iLanguage=null)

Static Public Member Functions

static getInstance ()

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)
 _trimUrl ($sUrl, $iLang=null)
 _getMaxUrlLength ()
 _getPageUri ($oObject, $sType, $sStdUrl, $sSeoUrl, $sParams, $iLang=null, $blFixed=false)
 _getStaticObjectId ($iShopId, $sStdUrl)
 _getAltUri ($sObjectId, $iLang)

Protected Attributes

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

Static Protected Attributes

static $_aReservedWords = array( 'admin' )
static $_aReservedEntryKeys = null
static $_sSeparator = null
static $_sPrefix = null
static $_instance = null
static $_aFixedCache = array()
static $_sCacheKey = null
static $_aCache = array()

Detailed Description

Seo encoder base

Definition at line 7 of file oxseoencoder.php.


Constructor & Destructor Documentation

oxSeoEncoder.__construct (  ) 

SEO encoder constructor

Reimplemented from oxSuperCfg.

Definition at line 140 of file oxseoencoder.php.


Member Function Documentation

oxSeoEncoder._copyToHistory ( sId,
iShopId,
iLang,
sType = null,
sNewId = null 
) [protected]

Moves current seo record to seo history table

Parameters:
string $sId object id
int $iShopId active shop id
int $iLang object language
string $sType object type (if you pass real object - type is not necessary)
string $sNewId new object id, mostly used for static url updates (optional)
Returns:
null

Definition at line 163 of file oxseoencoder.php.

oxSeoEncoder._getAltUri ( sObjectId,
iLang 
) [protected]

Returns alternative uri used while updating seo

Parameters:
string $sObjectId object id
int $iLang language id
Returns:
null

Reimplemented in oxSeoEncoderArticle, oxSeoEncoderCategory, oxSeoEncoderContent, oxSeoEncoderManufacturer, and oxSeoEncoderVendor.

Definition at line 1153 of file oxseoencoder.php.

oxSeoEncoder._getCacheKey ( sType,
iLang = null,
iShopId = null,
sParams = null 
) [protected]

Returns cache key (in non admin mode)

Parameters:
string $sType object type
int $iLang active language id
mixed $iShopId active shop id
string $sParams additional seo params. optional (mostly used for db indexing)
Returns:
string

Definition at line 393 of file oxseoencoder.php.

oxSeoEncoder._getDynamicUri ( sStdUrl,
sSeoUrl,
iLang 
) [protected]

Returns dynamic object SEO URI

Parameters:
string $sStdUrl standart url
string $sSeoUrl seo uri
int $iLang active language
Returns:
string

Definition at line 200 of file oxseoencoder.php.

oxSeoEncoder._getFullUrl ( sSeoUrl,
iLang = null,
blSsl = false 
) [protected]

Returns SEO url with shop's path + additional params ( oxseoencoder:: _getAddParams)

Parameters:
string $sSeoUrl seo URL
int $iLang active language
bool $blSsl forces to build ssl url
Returns:
string

Definition at line 238 of file oxseoencoder.php.

oxSeoEncoder._getMaxUrlLength (  )  [protected]

Returns maximum seo/dynamic url length

Returns:
int

Definition at line 796 of file oxseoencoder.php.

oxSeoEncoder._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:
oxbase $oObject object to prepare seo data
string $sType type of object (oxvendor/oxcategory)
string $sStdUrl stanradr url
string $sSeoUrl seo uri
string $sParams additional params, liek page number etc. mostly used by mysql for indexes
int $iLang language
bool $blFixed fixed url marker (default is false)
Returns:
string

Definition at line 933 of file oxseoencoder.php.

oxSeoEncoder._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

Definition at line 552 of file oxseoencoder.php.

oxSeoEncoder._getSeoIdent ( sSeoUrl  )  [protected]

_getSeoIdent returns seo ident for db search

Parameters:
string $sSeoUrl seo url

protected

Returns:
string

Definition at line 256 of file oxseoencoder.php.

oxSeoEncoder._getStaticObjectId ( iShopId,
sStdUrl 
) [protected]

Generates static url object id

Parameters:
int $iShopId shop id
string $sStdUrl standard (dynamic) url
Returns:
string

Definition at line 961 of file oxseoencoder.php.

oxSeoEncoder._getStaticUri ( sStdUrl,
iShopId,
iLang 
) [protected]

Returns SEO static uri

Parameters:
string $sStdUrl standard page url
int $iShopId active shop id
int $iLang active language
Returns:
string

Definition at line 270 of file oxseoencoder.php.

oxSeoEncoder._getUniqueSeoUrl ( sSeoUrl,
sObjectId = null,
iObjectLang = null 
) [protected]

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

Parameters:
string $sSeoUrl seo url
string $sObjectId current object id, used to skip self in query
int $iObjectLang object language id

protected

Returns:
string

Definition at line 298 of file oxseoencoder.php.

oxSeoEncoder._getUrlExtension (  )  [protected]

Returns target "extension"

Returns:
null

Reimplemented in oxSeoEncoderArticle, oxSeoEncoderCategory, oxSeoEncoderContent, oxSeoEncoderManufacturer, and oxSeoEncoderVendor.

Definition at line 281 of file oxseoencoder.php.

oxSeoEncoder._isFixed ( sType,
sId,
iLang,
iShopId = null,
sParams = null,
blStrictParamsCheck = true 
) [protected]

check if seo url exist and is fixed

Parameters:
string $sType object type
string $sId object identifier
int $iLang active language id
mixed $iShopId active shop id
string $sParams additional seo params. optional (mostly used for db indexing)
bool $blStrictParamsCheck strict parameters check

protected

Returns:
bool

Definition at line 353 of file oxseoencoder.php.

oxSeoEncoder._loadFromCache ( sCacheIdent,
sType,
iLang = null,
iShopId = null,
sParams = null 
) [protected]

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

Parameters:
string $sCacheIdent cache identifier
string $sType object type
int $iLang active language id
mixed $iShopId active shop id
string $sParams additional seo params. optional (mostly used for db indexing)
Returns:
string

Definition at line 421 of file oxseoencoder.php.

oxSeoEncoder._loadFromDb ( sType,
sId,
iLang,
iShopId = null,
sParams = null,
blStrictParamsCheck = true 
) [protected]

_loadFromDb loads data from oxseo table if exists returns oxseo url

Parameters:
string $sType object type
string $sId object identifier
int $iLang active language id
mixed $iShopId active shop id
string $sParams additional seo params. optional (mostly used for db indexing)
bool $blStrictParamsCheck strict parameters check

protected

Returns:
string || false

Definition at line 489 of file oxseoencoder.php.

oxSeoEncoder._prepareTitle ( sTitle,
blSkipTruncate = false,
iLang = false 
) [protected]

Prepares and returns formatted object SEO id

Parameters:
string $sTitle Original object title
bool $blSkipTruncate Truncate title into defined lenght or not
int $iLang language ID, for which to prepare the title
Returns:
string

Definition at line 650 of file oxseoencoder.php.

oxSeoEncoder._prepareUri ( sUri,
iLang = false 
) [protected]

Makes safe seo uri - removes unsupported/reserved characters

Parameters:
string $sUri seo uri
int $iLang language ID, for which URI should be prepared
Returns:
string

Definition at line 579 of file oxseoencoder.php.

oxSeoEncoder._processSeoUrl ( sSeoUrl,
sObjectId = null,
iLang = null,
blExclude = false 
) [protected]

Processes seo url before saving to db:

  • oxseoencoder.addLanguageParam();
  • oxseoencoder._getUniqueSeoUrl().
Parameters:
string $sSeoUrl seo url to process
string $sObjectId seo object id [optional]
int $iLang active language id [optional]
bool $blExclude exclude language prefix while building seo url
Returns:
string

Definition at line 129 of file oxseoencoder.php.

oxSeoEncoder._saveInCache ( sCacheIdent,
sCache,
sType,
iLang = null,
iShopId = null,
sParams = null 
) [protected]

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

Parameters:
string $sCacheIdent cache identifier
string $sCache cacheable data
string $sType object type
int $iLang active language id
mixed $iShopId active shop id
string $sParams additional seo params. optional (mostly used for db indexing)
Returns:
bool

Definition at line 456 of file oxseoencoder.php.

oxSeoEncoder._saveToDb ( sType,
sObjectId,
sStdUrl,
sSeoUrl,
iLang,
iShopId = null,
blFixed = null,
sParams = null 
) [protected]

_saveToDb saves values to seo table

Parameters:
string $sType url type (static, dynamic, oxarticle etc)
string $sObjectId object identifier
string $sStdUrl standard url
string $sSeoUrl seo url
int $iLang active object language
mixed $iShopId active object shop id
bool $blFixed seo entry marker. if true, entry should not be automatically changed
string $sParams additional seo params. optional (mostly used for db indexing)

protected

Returns:
void

Definition at line 696 of file oxseoencoder.php.

oxSeoEncoder._trimUrl ( sUrl,
iLang = null 
) [protected]

Removes shop path part and session id from given url

Parameters:
string $sUrl url to clean bad chars
int $iLang active language

protected

Returns:
string

Definition at line 768 of file oxseoencoder.php.

oxSeoEncoder.addLanguageParam ( sSeoUrl,
iLang 
)

Returns part of url defining active language

Parameters:
string $sSeoUrl seo url
int $iLang language id
Returns:
string

Definition at line 104 of file oxseoencoder.php.

oxSeoEncoder.addSeoEntry ( sObjectId,
iShopId,
iLang,
sStdUrl,
sSeoUrl,
sType,
blFixed = 1,
sKeywords = '',
sDescription = '',
sParams = '',
blExclude = false,
sAltObjectId = null 
)

Adds new seo entry to db

Parameters:
string $sObjectId objects id
int $iShopId shop id
int $iLang objects language
string $sStdUrl default url
string $sSeoUrl seo url
string $sType object type
bool $blFixed marker to keep seo config unchangeable
string $sKeywords seo keywords
string $sDescription seo description
string $sParams additional seo params. optional (mostly used for db indexing)
bool $blExclude exclude language prefix while building seo url
string $sAltObjectId alternative object id used while saving meta info (used to override object id when saving tags related info)
Returns:
null

Definition at line 1115 of file oxseoencoder.php.

oxSeoEncoder.copyStaticUrls ( iShopId  ) 

Method copies static urls from base shop to newly created

Parameters:
int $iShopId new created shop id
Returns:
null

Definition at line 1050 of file oxseoencoder.php.

oxSeoEncoder.deleteSeoEntry ( sObjectId,
iShopId,
iLang,
sType 
)

Removes seo entry from db

Parameters:
string $sObjectId objects id
int $iShopId shop id
int $iLang objects language
string $sType object type
Returns:
null

Definition at line 1167 of file oxseoencoder.php.

oxSeoEncoder.encodeStaticUrls ( aStaticUrl,
iShopId,
iLang 
)

Static url encoder

Parameters:
array $aStaticUrl static url info (contains standard URL and urls for each language)
int $iShopId active shop id
int $iLang active language
Returns:
null

Definition at line 975 of file oxseoencoder.php.

oxSeoEncoder.encodeString ( sString,
blReplaceChars = true,
iLang = false 
)

Replaces special chars in text

Parameters:
string $sString string to encode
bool $blReplaceChars is true, replaces user defined (oxlang.getSeoReplaceChars) characters into alternative
int $iLang language, for which to encode the string
Returns:
string

Definition at line 817 of file oxseoencoder.php.

oxSeoEncoder.fetchSeoUrl ( sStdUrl,
iLanguage = null 
)

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

Parameters:
string $sStdUrl standard url
integer $iLanguage language
Returns:
mixed

Definition at line 1222 of file oxseoencoder.php.

oxSeoEncoder.getDynamicObjectId ( iShopId,
sStdUrl 
)

Generates dynamic url object id (calls oxseoencoder._getStaticObjectId)

Parameters:
int $iShopId shop id
string $sStdUrl standard (dynamic) url
Returns:
string

Definition at line 186 of file oxseoencoder.php.

oxSeoEncoder.getDynamicUrl ( sStdUrl,
sSeoUrl,
iLang 
)

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

Parameters:
string $sStdUrl standard url
string $sSeoUrl part of URL query which will be attached to standard shop url
int $iLang active language

public

Returns:
string

Definition at line 1206 of file oxseoencoder.php.

static oxSeoEncoder.getInstance (  )  [static]

Singleton method

Deprecated:
since v5.0 (2012-08-10); Use oxRegistry.get("oxSeoEncoder") instead
Returns:
oxseoencoder

Reimplemented in oxSeoEncoderArticle, oxSeoEncoderCategory, oxSeoEncoderContent, oxSeoEncoderManufacturer, oxSeoEncoderRecomm, oxSeoEncoderTag, and oxSeoEncoderVendor.

Definition at line 91 of file oxseoencoder.php.

oxSeoEncoder.getMetaData ( sObjectId,
sMetaType,
iShopId = null,
iLang = null 
)

Returns meta information for preferred object

Parameters:
string $sObjectId information object id
string $sMetaType metadata type - "oxkeywords", "oxdescription"
int $iShopId active shop id [optional]
int $iLang active language [optional]
Returns:
string

Definition at line 1184 of file oxseoencoder.php.

oxSeoEncoder.getStaticUrl ( sStdUrl,
iLang = null,
iShopId = null 
)

Returns static url for passed standard link (if available)

Parameters:
string $sStdUrl standard Url
int $iLang active language (optional). default null
int $iShopId active shop id (optional). default null
Returns:
string

Definition at line 1073 of file oxseoencoder.php.

oxSeoEncoder.markAsExpired ( sId,
iShopId = null,
iExpStat = 1,
iLang = null,
sParams = null 
)

Marks object seo records as expired

Parameters:
string $sId changed object id. If null is passed, object dependency is not checked
int $iShopId active shop id. Shop id must be passed uf you want to do shop level update (default null)
int $iExpStat expiration status: 1 - standard expiration
int $iLang active language (optiona;)
string $sParams additional params
Returns:
null

Definition at line 908 of file oxseoencoder.php.

oxSeoEncoder.setIdLength ( iIdlength = null  ) 

sets seo id length

Parameters:
string $iIdlength id length
Returns:
null

Definition at line 876 of file oxseoencoder.php.

oxSeoEncoder.setPrefix ( sPrefix  ) 

Sets SEO prefix

Parameters:
string $sPrefix SEO prefix
Returns:
null

Definition at line 860 of file oxseoencoder.php.

oxSeoEncoder.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 $aReservedWords reserved words
Returns:
null

Definition at line 891 of file oxseoencoder.php.

oxSeoEncoder.setSeparator ( sSeparator = null  ) 

Sets SEO separator

Parameters:
string $sSeparator SEO seperator
Returns:
null

Definition at line 845 of file oxseoencoder.php.


Member Data Documentation

oxSeoEncoder.$_aCache = array() [static, protected]

Definition at line 76 of file oxseoencoder.php.

oxSeoEncoder.$_aFixedCache = array() [static, protected]

Url fixed state cache

Returns:
array

Definition at line 64 of file oxseoencoder.php.

oxSeoEncoder.$_aReservedEntryKeys = null [static, protected]

Definition at line 22 of file oxseoencoder.php.

oxSeoEncoder.$_aReservedWords = array( 'admin' ) [static, protected]

Definition at line 15 of file oxseoencoder.php.

oxSeoEncoder.$_iIdLength = 255 [protected]

Definition at line 36 of file oxseoencoder.php.

oxSeoEncoder.$_iMaxUrlLength = null [protected]

Definition at line 82 of file oxseoencoder.php.

oxSeoEncoder.$_instance = null [static, protected]
oxSeoEncoder.$_sAddParams = null [protected]

Definition at line 50 of file oxseoencoder.php.

oxSeoEncoder.$_sCacheKey = null [static, protected]

Definition at line 70 of file oxseoencoder.php.

oxSeoEncoder.$_sPrefix = null [static, protected]

Definition at line 43 of file oxseoencoder.php.

oxSeoEncoder.$_sSeparator = null [static, protected]

Definition at line 29 of file oxseoencoder.php.


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