Class to create websafe names, it also provides several helper functions

Provides some common features such as common debugging, globals/configuration access for childs.

author Stefan Seifarth / stese
author Murat Purc
package plugin
subpackage Mod Rewrite

 Methods

Build a recursiv path for mod_rewrite rule like server directories (dir1/dir2/dir3)

buildRecursivPath(int $iCatId, int $iLangId, int $iLastId) : string
Static

Parameters

$iCatId

int

Latest category id

$iLangId

int

Language id

$iLastId

int

Last category id

Returns

stringlinkpath with correct uri

Checks if client id exists

clientIdExists(int $clientId) : bool
Static

Parameters

$clientId

int

Returns

bool

Return full CONTENIDO url from single anchor

contenidoHtmlAnchor(array $aMatches, bool $bXHTML) : string
Static

Parameters

$aMatches

array

[0] = complete anchor, [1] = pre arguments, [2] = anchor name, [3] = post arguments

$bXHTML

bool

Flag to return XHTML valid url

Returns

stringNew anchor

Get article id and language id from article language id

getArtIdByArtlangId(int $iArtlangId) : array
Static

Parameters

$iArtlangId

int

Current article id

Returns

arrayArray with idart and idlang of current article

Get article id by article websafe name

getArtIdByWebsafeName(string $sArtName, int $iCatId, int $iLangId) : int | null
Static

Parameters

$sArtName

string

Websafe name

$iCatId

int

Category id

$iLangId

int

Language id

Returns

intnullRecent article id or null

Get article urlname and language id

getArtIds(int $iArtlangId) : array
Static

Parameters

$iArtlangId

int

idartlang

Returns

arrayUrlname, idlang of empty array

Get article websafe name from idartlang.

getArtLangWebsafeName(int $iArtLangId) : string
Static

Parameters

$iArtLangId

int

idartlang

Returns

stringArticle websafe name

Get article name from article id and language id

getArtTitle(int $iArtId, int $iLangId) : string
Static
NOTE : seems to be not used???

Parameters

$iArtId

int

Article id

$iLangId

int

Language id

Returns

stringArticle name

Get article websafe name from article id and language id.

getArtWebsafeName(int $iArtId, int $iLangId) : string
Static

Parameters

$iArtId

int

Article id

$iLangId

int

Language id

Returns

stringArticle websafe name

Funcion to return cat id by path.

getCatIdByUrlPath(string $path) : int
Static

Caches the paths at first call to provode faster processing at further calls.

Parameters

$path

string

Category path

Returns

intCategory id

Get language ids from category id

getCatLanguages(int $iCatId) : array
Static

Parameters

$iCatId

int

Category id

Returns

arrayUsed language ids

Get category name from category id and language id.

getCatName(int $iCatId, int $iLangId) : string
Static

Parameters

$iCatId

int

Category id

$iLangId

int

Language id

Returns

stringCategory name

Splits passed argument into scheme://host and path/query.

getClientFullUrlParts(string $url) : array
Static

Example: input = http://host/front_content.php?idcat=123 return = array('htmlpath' => 'http://host', 'url' => 'front_content.php?idcat=123')

Parameters

$url

string

URL to split

Returns

arrayAssoziative array including the two parts: - array('htmlpath' => $path, 'url' => $url)

Get client id from client name

getClientId(string $sClientName) : int
Static

Parameters

$sClientName

string

Client name

Returns

intClient id

Get name of client by id.

getClientName(int $clientId) : string
Static

Parameters

$clientId

int

Client id

Returns

stringClient name

Returns configuration of mod rewrite, content of gobal $cfg['mod_rewrite']

getConfig(string $key, mixed $default) : mixed
InheritedStatic
inherited_from \ModRewriteBase::getConfig()

Parameters

$key

string

Name of configuration key

$default

mixed

Default value to return as a fallback

Returns

mixedDesired value mr configuration, either the full configuration or one of the desired subpart

Returns .htaccess related assoziative info array

getHtaccessInfo() : array
Static

Returns

array

Used to postprocess resolved path

getIdFromPathresolverResult(array $results) : mixed
Static

Error site handling if category not found

if percentage == 100 and there is no 100 percentage result value, error site will be shown - can be adjust by user settings for smooth similar effects - 80 to 95 will be best but have to check by user

deprecated Is no more used

Parameters

$results

array

Pathresolver results array

Returns

mixedCategoryid or false

Get language id from language name thanks to Nicolas Dickinson for multi Client/Language BugFix

getLanguageId(string $sLanguageName, int $iClientId) : int
Static

Parameters

$sLanguageName

string

Language name

$iClientId

int

Client id

Returns

intLanguage id

Returns name of language by id.

getLanguageName(int $languageId) : string
Static

Parameters

$languageId

int

Language id

Returns

stringLanuage name

Initialization, is to call at least once, also possible to call multible times, if different client configuration is to load.

initialize(int $clientId) 
Static

Loads configuration of passed client and sets some properties.

Parameters

$clientId

int

Client id

Returns enabled state of mod rewrite plugin

isEnabled() : bool
InheritedStatic
inherited_from \ModRewriteBase::isEnabled()

Returns

bool

Check articles on websafe name.

isInCatArticles(string $sName, int $iArtId, int $iLangId, int $iCatId) : bool
Static

Check all articles in the current category on existing same websafe name.

Parameters

$sName

string

Websafe name to check

$iArtId

int

Current article id

$iLangId

int

Current language id

$iCatId

int

Category id

Returns

boolTrue if websafename already exists, false if not

Check categories on websafe name

isInCategories(string $sName, int $iCatId, int $iLangId) : bool
Static

Check all categories in the main parent category on existing same websafe name

Parameters

$sName

string

Websafe name to check

$iCatId

int

Current category id

$iLangId

int

Current language id

Returns

boolTrue if websafename already exists, false if not

Checks if language id exists

languageIdExists(int $languageId) : bool
Static

Parameters

$languageId

int

Language id

Returns

bool

Recreate all or only empty aliases (categories and articles).

recreateAliases(bool $bOnlyEmpty) 
Static

Shortcut to recreateCategoriesAliases() and recreateArticlesAliases()

Parameters

$bOnlyEmpty

bool

Flag to reset only empty items

Recreates all or only empty urlname entries in art_lang table.

recreateArticlesAliases(bool $bOnlyEmpty) 
Static

Parameters

$bOnlyEmpty

bool

Flag to reset only empty items

Recreates all or only empty aliases in categories table.

recreateCategoriesAliases(bool $bOnlyEmpty) 
Static

Parameters

$bOnlyEmpty

bool

Flag to reset only empty items

Method to reset all aliases (categories and articles).

resetAliases() 
Static

Shortcut to recreateCategoriesAliases() and recreateArticlesAliases()

Method to reset all aliases in articles.

resetArticlesAliases() 
Static

Clears all urlname entries in art_lang table, and sets the value for all existing entries.

deprecated see ModRewrite::recreateArticlesAliases();

Method to reset all aliases in categories.

resetCategoriesAliases() 
Static

Clears all urlname entries in cat_lang table, and sets the value for all existing entries.

deprecated see ModRewrite::recreateCategoriesAliases();

Return full CONTENIDO url from single anchor

rewriteHtmlAnchor(array $aMatches) : string
Static

Parameters

$aMatches

array

[0] = complete anchor, [1] = pre arguments, [2] = anchor name, [3] = post arguments

Returns

stringNew anchor

Set websafe name in article list.

setArtWebsafeName(string $sName, int $iArtId, int $iLangId, int $iCatId) : bool
Static

Insert new websafe name in article list

Parameters

$sName

string

Original name (will be converted)

$iArtId

int

Current article id

$iLangId

int

Current language id

$iCatId

int

Category id

Returns

boolTrue if insert was successfully

Set urlpath of category

setCatUrlPath(int $iCatId, int $iLangId) : bool
Static

Parameters

$iCatId

int

Category id

$iLangId

int

Language id

Returns

boolTrue if insert was successfully

Set websafe name in category list.

setCatWebsafeName(string $sName, int $iCatId, int $iLangId) : bool
Static

Insert new websafe name in category list.

Parameters

$sName

string

Original name (will be converted) or alias

$iCatId

int

Category id

$iLangId

int

Language id

Returns

boolTrue if insert was successfully

Sets the configuration of mod rewrite, content of gobal $cfg['mod_rewrite']

setConfig(string $key, mixed $value) 
InheritedStatic
inherited_from \ModRewriteBase::setConfig()

Parameters

$key

string

Name of configuration key

$value

mixed

The value to set

Sets the enabled state of mod rewrite plugin

setEnabled(bool $bEnabled) 
InheritedStatic
inherited_from \ModRewriteBase::setEnabled()

Parameters

$bEnabled

bool

Function to preclean a url.

urlPreClean(string $url) : string
Static

Removes absolute path declaration '/front_content.php' or relative path definition to actual dir './front_content.php', ampersand entities '&' and returns a url like 'front_content.php?idart=12&idlang=1'

Parameters

$url

string

Url to clean

Returns

stringCleaned Url

 Properties

 

$_lookupTable : array
 

$_db : \cDb