File/contenido/plugins/mod_rewrite/includes/functions.mod_rewrite.php

Description

Defines the 'modrewrite' related functions

TODO: Rename functions/variables use coding guidelines

Functions
mr_arrayValue (line 901)

Returns value of an array key (assoziative or indexed).

Shortcut function for some ways to access to arrays:

  1.  // old way
  2.  if (is_array($foo&& isset($foo['bar']&& $foo['bar'== 'yieeha'{
  3.      // do something
  4.  }
  5.  
  6.  // new, more readable way:
  7.  if (mr_arrayValue($foo'bar'== 'yieeha'{
  8.      // do something
  9.  }
  10.  
  11.  // old way
  12.  if (is_array($foo&& isset($foo['bar'])) {
  13.      $jep $foo['bar'];
  14.  else {
  15.      $jep 'yummy';
  16.  }
  17.  
  18.  // new way
  19.  $jep mr_arrayValue($foo'bar''yummy');

  • return: Either the found value or the default value
mixed mr_arrayValue (array $array, mixed $key, [mixed $default = null])
  • array $array: The array
  • mixed $key: Position of an indexed array or key of an assoziative array
  • mixed $default: Default value to return
mr_build_generated_code (line 525)

Replaces existing ancors inside passed code, while rebuilding the urls.

Will be called by chain 'Contenido.Content.conGenerateCode' or 'Contenido.Frontend.HTMLCodeOutput' depening on mod_rewrite settings.

  • return: New code
string mr_build_generated_code (string $code)
  • string $code: Code to prepare
mr_build_new_url (line 496)

Works as a wrapper for creation of urls using Contenido_UrlBuilder_MR.

Will be called by chain 'Contenido.Frontend.CreateURL'.

  • return: New URL
  • deprecated: Some parts of the function are replaced against new Url building logic.
string mr_build_new_url (string $url)
  • string $url: URL to rebuild
mr_conCopyArtLang (line 418)

Processes mod_rewrite related job for duplicated articles.

Will be called by chain 'Contenido.Article.conCopyArtLang_AfterInsert'.

  • return: Loop through of arguments
array mr_conCopyArtLang (array $data)
  • array $data: Assoziative array with record entries
mr_conMoveArticles (line 389)

Processes mod_rewrite related job for articles beeing moved.

Will be called by chain 'Contenido.Article.conMoveArticles_Loop'.

  • return: Loop through of arguments
array mr_conMoveArticles (array $data)
  • array $data: Assoziative array with record entries
mr_conSaveArticle (line 307)

Processes mod_rewrite related job for saved articles (new or modified article).

Will be called by chain 'Contenido.Action.con_saveart.AfterCall'.

  • return: Passed parameter
array mr_conSaveArticle ( $data)
  • array $data: Assoziative array with some article properties
mr_conSyncArticle (line 453)

Processes mod_rewrite related job for synchronized articles.

Will be called by chain 'Contenido.Article.conSyncArticle_AfterInsert'.

  • return: Loop through of argument
array mr_conSyncArticle (array $data)
  • array $data: Assoziative array with record entries as follows:
    1.  array(
    2.      'src_art_lang'  => Recordset (assoziative arrayof source item from con_art_lang table
    3.      'dest_art_lang' => Recordset (assoziative arrayof inserted destination item from con_art_lang table
    4.  );
mr_get_client_id (line 68)

Get client id from client name

  • return: Client id
integer mr_get_client_id ([string $str_clientname = ""])
  • string $str_clientname: Client name
mr_get_idart (line 91)

Get article id by article websafe name

  • return: Recent article id
integer mr_get_idart ([string $str_artname = ""], [integer $int_id = 0], [ $int_lang_id = 0])
  • string $str_artname: Websafe name
  • integer $int_id: Category id
  • $int_lang_id
mr_get_language_id (line 43)

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

  • return: Language id
integer mr_get_language_id ([string $str_languagename = ""], [ $int_client = 1])
  • string $str_languagename: Language name
  • $int_client
mr_loadConfiguration (line 638)

Loads Advanced Mod Rewrite configuration for passed client using serialized file containing the settings.

File is placed in /contenido/mod_rewrite/includes/and is named like config.mod_rewrite_{client_id}.php.

void mr_loadConfiguration (int $clientId)
  • int $clientId: Id of client
mr_prResolvePathViaURLNames (line 703)

Funcion to return cat id by path. Loads cached data structure about resolved paths only once.

  • return: Category id
int mr_prResolvePathViaURLNames (string $path)
  • string $path: Category path
mr_query_n_next_record (line 860)

Database query helper. Used to execute a select statement and to return the result of first recordset.

Minimizes following code:

  1.  // default way
  2.  $db  new DB_Contenido();
  3.  $sql "SELECT * FROM foo WHERE bar='foobar'";
  4.  $db->query($sql);
  5.  $db->next_record();
  6.  $data $db->Record;
  7.  
  8.  // new way
  9.  $sql  "SELECT * FROM foo WHERE bar='foobar'";
  10.  $data mr_query_n_next_record($sql);

  • return: Assoziative array including recordset or null
mixed mr_query_n_next_record (string $query)
  • string $query: Query to execute
mr_requestCleanup (line 936)

Request cleanup function. Request data is allways tainted and must be filtered.

Pass the array to cleanup using several options. Emulates array_walk_recursive().

  • return: Cleaned data
mixed mr_requestCleanup ( &$data, [array $options = null], mixed $data)
  • mixed $data: Data to cleanup
  • array $options: Default options array, provides only 'filter' key with several filter functions which are to execute as follows:
    1.  $options['filter'array('trim''myFilterFunc');
    If no filter functions are set, 'trim', 'strip_tags' and 'stripslashes' will be used by default. A userdefined function must accept the value as a parameter and must return the filtered parameter, e. g.
    1.  function myFilter($data{
    2.     // do what you want with the data, e. g. cleanup of xss content
    3.     return $data;
    4.  }
  • &$data
mr_resetPathResolverCache (line 817)
void mr_resetPathResolverCache ()
mr_runFrontendController (line 678)

Includes the frontend controller script which parses the url and extacts needed data like idcat, idart, lang and client from it.

Will be called by chain 'Contenido.Frontend.AfterLoadPlugins' at front_content.php.

  • return: Just a return value
bool mr_runFrontendController ()
mr_set_client_language (line 601)

Sets language of client, like done in front_content.php

void mr_set_client_language (int $client)
  • int $client: Client id
mr_strMovedownCategory (line 245)

Processes mod_rewrite related job after moving a category down.

Will be called by chain 'Contenido.Action.str_movedowncat.AfterCall'.

TODO: do we really need processing of the category? no mr relevant data changes while moving

  • return: Category id
int mr_strMovedownCategory (int $idcat)
  • int $idcat: Id of category beeing moved down
mr_strMoveSubtree (line 276)

Processes mod_rewrite related job after moving a category subtree.

Will be called by chain 'Contenido.Action.str_movesubtree.AfterCall'.

  • return: Category id
int mr_strMoveSubtree (int $idcat)
  • int $idcat: Id of category where the subtree has beeen moved
mr_strMoveUpCategory (line 210)

Processes mod_rewrite related job after moving a category up.

Will be called by chain 'Contenido.Action.str_moveupcat.AfterCall'.

TODO: do we really need processing of the category? no mr relevant data changes while moving

  • return: Category id
int mr_strMoveUpCategory (int $idcat)
  • int $idcat: Category id
mr_strNewCategory (line 165)

Processes mod_rewrite related job for created new category.

Will be called by chain 'Contenido.Action.str_newcat.AfterCall'.

  • return: Passed parameter
array mr_strNewCategory ( $data)
  • array $data: Assoziative array with some values
mr_strNewTree (line 144)

Processes mod_rewrite related job for created new tree.

Will be called by chain 'Contenido.Action.str_newtree.AfterCall'.

  • return: Passed parameter
array mr_strNewTree ( $data)
  • array $data: Assoziative array with some values
mr_strRenameCategory (line 186)

Processes mod_rewrite related job for renamed category.

Will be called by chain 'Contenido.Action.str_renamecat.AfterCall'.

  • return: Passed parameter
array mr_strRenameCategory ( $data)
  • array $data: Assoziative array with some values

Documentation generated on Mon, 08 Sep 2008 03:08:54 +0200 by phpDocumentor 1.4.0