Class ModRewrite

Description

Class to create websafe names

  • author: Stefan Seifarth / stese
  • author: Murat Purc <murat@purc.de>

Located in /contenido/plugins/mod_rewrite/classes/class.modrewrite.php (line 40)

ModRewriteBase
   |
   --ModRewrite
Method Summary
 static string buildRecursivPath ([int $iCatId = 0], [int $iLangId = 0], [int $iLastId = 0])
 static string contenidoHtmlAnchor ([ $aMatches = array()], [ $bXHTML = true])
 static array getArtIdByArtlangId ([int $iArtlangId = 0])
 static array getArtIds ([int $iArtlangId = 0])
 static string getArtLangWebsafeName ([int $iArtLangId = 0])
 static string getArtTitle ([int $iArtId = 0], [int $iLangId = 0])
 static string getArtWebsafeName ([int $iArtId = 0], [int $iLangId = 0])
 static int getCatIdByUrlPath (string $path)
 static array getCatLanguages ([int $iCatId = 0])
 static string getCatName ([int $iCatId = 0], [int $iLangId = 0])
 static array getClientFullUrlParts (string $url)
 static integer getClientId ([string $sClientName = ''])
 static string getClientName ([int $clientId = 0])
 static mixed getIdFromPathresolverResult (array $results)
 static integer getLanguageId ([string $sLanguageName = ''], [int $iClientId = 1])
 static string getLanguageName ([int $languageId = 0])
 static void initialize (int $clientId)
 static bool isInCatArticles ([string $sName = ''], [int $iArtId = 0], [int $iLangId = 0], [int $iCatId = 0])
 static bool isInCategories ([string $sName = ''], [int $iCatId = 0], [int $iLangId = 0])
 static void resetAliases ()
 static void resetArticlesAliases ()
 static void resetCategoriesAliases ()
 static string rewriteHtmlAnchor ([ $aMatches = array()])
 static bool setArtWebsafeName ([string $sName = ''], [int $iArtId = 0], [int $iLangId = 0], [int $iCatId = 0])
 static bool setCatUrlPath ([int $iCatId = 0], [int $iLangId = 0])
 static bool setCatWebsafeName ([string $sName = ''], [int $iCatId = 0], [int $iLangId = 0])
 static string urlPreClean (string $url)
 int getArtIdByWebsafeName ([string $sArtName = ''], [int $iCatId = 0], [ $iLangId = 0])
Variables
Methods
static buildRecursivPath (line 527)

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

  • return: linkpath with correct uri
  • access: public
string buildRecursivPath ([int $iCatId = 0], [int $iLangId = 0], [int $iLastId = 0])
  • int $iCatId: Latest category id
  • int $iLangId: Language id
  • int $iLastId: Last category id
static contenidoHtmlAnchor (line 610)

Return full contenido url from single anchor

  • return: New anchor
  • access: public
string contenidoHtmlAnchor ([ $aMatches = array()], [ $bXHTML = true])
  • array $aMatches: [0] = complete anchor, [1] = pre arguments, [2] = anchor name, [3] = post arguments
  • $bXHTML
static getArtIdByArtlangId (line 286)

Get article id and language id from article language id

  • return: Array with idart and idlang of current article
  • access: public
array getArtIdByArtlangId ([int $iArtlangId = 0])
  • int $iArtlangId: Current article id
static getArtIds (line 507)

Get article urlname and language id

  • return: Urlname, idlang of empty array
  • access: public
array getArtIds ([int $iArtlangId = 0])
  • int $iArtlangId: idartlang
static getArtLangWebsafeName (line 655)

Get article websafe name from idartlang.

  • return: Article websafe name
  • access: public
string getArtLangWebsafeName ([int $iArtLangId = 0])
  • int $iArtLangId: idartlang
static getArtTitle (line 457)

Get article name from article id and language id

  • return: Article name
  • access: public
string getArtTitle ([int $iArtId = 0], [int $iLangId = 0])
  • int $iArtId: Article id
  • int $iLangId: Language id
static getArtWebsafeName (line 636)

Get article websafe name from article id and language id.

  • return: Article websafe name
  • access: public
string getArtWebsafeName ([int $iArtId = 0], [int $iLangId = 0])
  • int $iArtId: Article id
  • int $iLangId: Language id
static getCatIdByUrlPath (line 384)

Funcion to return cat id by path.

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

  • return: Category id
  • access: public
int getCatIdByUrlPath (string $path)
  • string $path: Category path
static getCatLanguages (line 477)

Get language ids from category id

  • return: Used language ids
  • access: public
array getCatLanguages ([int $iCatId = 0])
  • int $iCatId: Category id
static getCatName (line 352)

Get category name from category id and language id.

  • return: Category name
  • access: public
string getCatName ([int $iCatId = 0], [int $iLangId = 0])
  • int $iCatId: Category id
  • int $iLangId: Language id
static getClientFullUrlParts (line 787)

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

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

  • return: Assoziative array including the two parts:
    • array('htmlpath' => $path, 'url' => $url)
  • access: public
array getClientFullUrlParts (string $url)
  • string $url: URL to split
static getClientId (line 699)

Get client id from client name

  • return: Client id
  • access: public
integer getClientId ([string $sClientName = ''])
  • string $sClientName: Client name
static getClientName (line 672)

Get name of client by id.

  • return: Client name
  • access: public
string getClientName ([int $clientId = 0])
  • int $clientId: Client id
static getIdFromPathresolverResult (line 912)

Used to postprocess resolved path

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

  • return: Categoryid or false
  • deprecated: Is no more used
  • todo: remove usage at /contenido/includes/functions.pathresolver.php
  • access: public
mixed getIdFromPathresolverResult (array $results)
  • array $results: Pathresolver results array
static getLanguageId (line 753)

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

  • return: Language id
  • access: public
integer getLanguageId ([string $sLanguageName = ''], [int $iClientId = 1])
  • string $sLanguageName: Language name
  • int $iClientId: Client id
static getLanguageName (line 724)

Returns name of language by id.

  • return: Lanuage name
  • access: public
string getLanguageName ([int $languageId = 0])
  • int $languageId: Language id
static initialize (line 51)

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

Loads configuration of passed client and sets some properties.

  • access: public
void initialize (int $clientId)
  • int $clientId: Client id

Redefinition of:
ModRewriteBase::initialize()
Initialization, is to call at least once by an child.
static isInCatArticles (line 106)

Check articles on websafe name.

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

  • return: True if websafename already exists, false if not
  • access: public
bool isInCatArticles ([string $sName = ''], [int $iArtId = 0], [int $iLangId = 0], [int $iCatId = 0])
  • string $sName: Websafe name to check
  • int $iArtId: Current article id
  • int $iLangId: Current language id
  • int $iCatId: Category id
static isInCategories (line 67)

Check categories on websafe name

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

  • return: True if websafename already exists, false if not
  • access: public
bool isInCategories ([string $sName = ''], [int $iCatId = 0], [int $iLangId = 0])
  • string $sName: Websafe name to check
  • int $iCatId: Current category id
  • int $iLangId: Current language id
static resetAliases (line 891)

Method to reset all aliases (categories and articles).

  • access: public
void resetAliases ()
static resetArticlesAliases (line 869)

Method to reset all aliases in articles.

  • access: public
void resetArticlesAliases ()
static resetCategoriesAliases (line 840)

Method to reset all aliases in categories.

  • access: public
void resetCategoriesAliases ()
static rewriteHtmlAnchor (line 566)

Return full contenido url from single anchor

  • return: New anchor
  • access: public
string rewriteHtmlAnchor ([ $aMatches = array()])
  • array $aMatches: [0] = complete anchor, [1] = pre arguments, [2] = anchor name, [3] = post arguments
static setArtWebsafeName (line 146)

Set websafe name in article list.

Insert new websafe name in article list

  • return: True if insert was successfully
  • access: public
bool setArtWebsafeName ([string $sName = ''], [int $iArtId = 0], [int $iLangId = 0], [int $iCatId = 0])
  • string $sName: Original name (will be converted)
  • int $iArtId: Current article id
  • int $iLangId: Current language id
  • int $iCatId: Category id
static setCatUrlPath (line 261)

Set urlpath of category

  • return: True if insert was successfully
  • access: public
bool setCatUrlPath ([int $iCatId = 0], [int $iLangId = 0])
  • int $iCatId: Category id
  • int $iLangId: Language id
static setCatWebsafeName (line 200)

Set websafe name in category list.

Insert new websafe name in category list.

  • return: True if insert was successfully
  • access: public
bool setCatWebsafeName ([string $sName = ''], [int $iCatId = 0], [int $iLangId = 0])
  • string $sName: Original name (will be converted) or alias
  • int $iCatId: Category id
  • int $iLangId: Language id
static urlPreClean (line 825)

Function to preclean a url.

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

  • return: Cleaned Url
  • access: public
string urlPreClean (string $url)
  • string $url: Url to clean
getArtIdByWebsafeName (line 304)

Get article id by article websafe name

  • return: Recent article id
int getArtIdByWebsafeName ([string $sArtName = ''], [int $iCatId = 0], [ $iLangId = 0])
  • string $sArtName: Websafe name
  • int $iCatId: Category id
  • $iLangId

Inherited Methods

Inherited From ModRewriteBase

 ModRewriteBase::getConfig()
 ModRewriteBase::initialize()
 ModRewriteBase::isEnabled()

Documentation generated on Tue, 25 Nov 2008 22:07:21 +0100 by phpDocumentor 1.4.1