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 38)

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 500)

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 580)

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 255)

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 480)

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 625)

Get article websafe name from idartlang.

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

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 606)

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 353)

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 450)

Get language ids from category id

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

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 757)

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 669)

Get client id from client name

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

Get name of client by id.

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

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 723)

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 694)

Returns name of language by id.

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

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 104)

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 65)

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 869)

Method to reset all aliases (categories and articles).

Shortcut to resetArticlesAliases() and resetArticlesAliases()

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

Method to reset all aliases in articles.

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

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

Method to reset all aliases in categories.

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

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

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 144)

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 230)

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 184)

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 795)

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 273)

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 Sun, 08 Feb 2009 22:00:31 +0100 by phpDocumentor 1.4.1