Functions

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

mr_arrayValue(array $array, mixed $key, mixed $default) : mixed

Shortcut function for some ways to access to arrays:

// old way
if (is_array($foo) && isset($foo['bar']) && $foo['bar'] == 'yieeha') {
    // do something
}

// new, more readable way:
if (mr_arrayValue($foo, 'bar') == 'yieeha') {
    // do something
}

// old way
if (is_array($foo) && isset($foo['bar'])) {
    $jep = $foo['bar'];
} else {
    $jep = 'yummy';
}

// new way
$jep = mr_arrayValue($foo, 'bar', 'yummy');

Parameters

$array

array

The array

$key

mixed

Position of an indexed array or key of an assoziative array

$default

mixed

Default value to return

Returns

mixedEither the found value or the default value

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

mr_buildGeneratedCode(string $code) : string

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

Parameters

$code

string

Code to prepare

Returns

stringNew code

Works as a wrapper for Contenido_Url.

mr_buildNewUrl(string $url) : string

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

todo : Still exists bcause of downwards compatibility (some other modules/plugins are using it)

Parameters

$url

string

URL to rebuild

Returns

stringNew URL

Processes mod_rewrite related job for duplicated articles.

mr_conCopyArtLang(array $data) : array

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

Parameters

$data

array

Assoziative array with record entries

Returns

arrayLoop through of arguments

Processes mod_rewrite related job for articles beeing moved.

mr_conMoveArticles(array $data) : array

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

Parameters

$data

array

Assoziative array with record entries

Returns

arrayLoop through of arguments

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

mr_conSaveArticle(array $data) : array

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

Parameters

$data

array

Assoziative array with some article properties

Returns

arrayPassed parameter

Processes mod_rewrite related job for synchronized articles.

mr_conSyncArticle(array $data) : array

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

Parameters

$data

array

Assoziative array with record entries as follows: array( 'src_art_lang' => Recordset (assoziative array) of source item from con_art_lang table 'dest_art_lang' => Recordset (assoziative array) of inserted destination item from con_art_lang table );

Returns

arrayLoop through of argument

Debug output only during development

mr_debugOutput(bool $print) : mixed

Parameters

$print

bool

Flag to echo the debug data

Returns

mixedEither the debug data, if parameter $print is set to true, or nothing

Returns the mod rewrite configuration array of an client.

mr_getConfiguration(int $clientId) : array | null

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

Parameters

$clientId

int

Id of client

Returns

arraynull

Minimalistic'n simple way to get request variables.

mr_getRequest(string $key, mixed $default) : mixed

Checks occurance in $_GET, then in $_POST. Uses trim() and strip_tags() to preclean data.

Parameters

$key

string

Name of var to get

$default

mixed

Default value to return

Returns

mixedThe value

Replaces calling of header method for redirects in front_content.php, used during development.

mr_header($header) 

Parameters

$header

Header value for redirect

Returns amr related translation text

mr_i18n(string $key) : string

Parameters

$key

string

The message id as string

Returns

stringRelated message

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

mr_loadConfiguration(int $clientId, bool $forceReload) 

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

Parameters

$clientId

int

Id of client

$forceReload

bool

Flag to force to reload configuration, e. g. after done changes on it

Database query helper.

mr_queryAndNextRecord(string $query) : mixed

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

Minimizes following code:

// default way
$db  = cRegistry::getDb();
$sql = "SELECT * FROM foo WHERE bar='foobar'";
$db->query($sql);
$db->next_record();
$data = $db->Record;

// new way
$sql  = "SELECT * FROM foo WHERE bar='foobar'";
$data = mr_queryAndNextRecord($sql);

Parameters

$query

string

Query to execute

Returns

mixedAssoziative array including recordset or null

Cleanups passed string from characters beeing repeated two or more times

mr_removeMultipleChars(string $char, string $string) : string

Parameters

$char

string

Character to remove

$string

string

String to clean from character

Returns

stringCleaned string

Request cleanup function.

mr_requestCleanup(mixed $data, array $options) : mixed

Request data is allways tainted and must be filtered. Pass the array to cleanup using several options. Emulates array_walk_recursive().

Parameters

$data

mixed

Data to cleanup

$options

array

Default options array, provides only 'filter' key with several filter functions which are to execute as follows: $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. function myFilter($data) { // do what you want with the data, e. g. cleanup of xss content return $data; }

Returns

mixedCleaned data

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

mr_runFrontendController() : bool

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

Returns

boolJust a return value

Sets language of client, like done in front_content.php

mr_setClientLanguageId(int $client) 

Parameters

$client

int

Client id

Saves the mod rewrite configuration array of an client.

mr_setConfiguration(int $clientId, array $config) : bool

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

Parameters

$clientId

int

Id of client

$config

array

Configuration to save

Returns

bool

Processes mod_rewrite related job after copying a category subtree.

mr_strCopyCategory(array $data) : array

Will be called by chain 'Contenido.Category.strCopyCategory'.

Parameters

$data

array

Assoziative array with some values

Returns

arrayPassed parameter

Processes mod_rewrite related job after moving a category subtree.

mr_strMoveSubtree(array $data) : array

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

Parameters

$data

array

Assoziative array with some values

Returns

arrayPassed parameter

Processes mod_rewrite related job after moving a category up.

mr_strMoveUpCategory(int $idcat) : int

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

todo do we really need processing of the category? there is no mr relevant data changes while moving the category on same level, level and name won't change

Parameters

$idcat

int

Category id

Returns

intCategory id

Processes mod_rewrite related job after moving a category down.

mr_strMovedownCategory(int $idcat) : int

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

todo do we really need processing of the category? there is no mr relevant data changes while moving the category on same level, level and name won't change

Parameters

$idcat

int

Id of category beeing moved down

Returns

intCategory id

Processes mod_rewrite related job for created new category.

mr_strNewCategory(array $data) : array

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

Parameters

$data

array

Assoziative array with some values

Returns

arrayPassed parameter

Processes mod_rewrite related job for created new tree.

mr_strNewTree(array $data) : array

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

Parameters

$data

array

Assoziative array with some values

Returns

arrayPassed parameter

Processes mod_rewrite related job for renamed category 2010-02-01: and now all existing subcategories and modify their paths too.

mr_strRenameCategory(array $data) : array

.. 2010-02-01: max 50 recursion level

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

Parameters

$data

array

Assoziative array with some values

Returns

arrayPassed parameter

Processes mod_rewrite related job during structure synchronisation process, sets the urlpath of current category.

mr_strSyncCategory(array $data) : array

Will be called by chain 'Contenido.Category.strSyncCategory_Loop'.

Parameters

$data

array

Assoziative array with some values

Returns

arrayPassed parameter

Classes and interfaces

ModRewrite

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

« More »

ModRewriteBase

Abstract base mod rewrite class.

« More »

ModRewriteController

Mod Rewrite controller class.

« More »

ModRewriteDebugger

Mod rewrite debugger class.

« More »

ModRewriteTest

Mod rewrite test class.

« More »

ModRewriteUrlStack

Mod rewrite url stack class.

« More »

ModRewriteUrlUtil

Mod Rewrite url utility class.

« More »

ModRewrite_ContentController

Content controller for general settings.

« More »

ModRewrite_ContentExpertController

Content expert controller for expert settings/actions.

« More »

ModRewrite_ContentTestController

Content controller to run tests.

« More »

ModRewrite_ControllerAbstract

Abstract controller for all concrete mod_rewrite controller implementations.

« More »

Functions

Installation steps to install a new plugin Function differ between extracted and Zip archive plugins

installationRoutine(\cGuiPage $page, boolean $isExtracted, string $extractedPath) 

Parameters

$page

\cGuiPage

$isExtracted

boolean

$extractedPath

string

foldername from extracted plugin

Functions

Function is called after the plugins have been loaded.

piUsAfterLoadPlugins() 

If the string placeholder in the example URL http://www.domain.de/placeholder is a defined short URL, the user is redirected to the correct URL.

Function is called after an article has been saved.

piUsConSaveArtAfter(array $values) 

Checks whether a short URL has been given via $_POST and saves/deletes it.

Parameters

$values

array

the values which are saved

Constructs the HTML code containing table rows which are added to the end of the article edit form

piUsEditFormAdditionalRows($idart, $idlang, $idclient) : string

Parameters

$idart

$idlang

$idclient

Returns

stringrendered HTML code

Computes an error message which describes the given error code.

piUsGetErrorMessage(int $errorCode, $shortUrlItem) : string

Parameters

$errorCode

int

the error code

$shortUrlItem

Returns

stringthe error message describing the given error code