eZPublish  3.9
eZCharTransform Class Reference

Performs rule based transformation of characters in a string. More...

Public Member Functions

 eZCharTransform ()
 
instance ()
 
 transform ($text, $rule, $charset=false, $useCache=true)
 
 transformByGroup ($text, $group, $charset=false, $useCache=true)
 

Private Member Functions

 executeCacheFile (&$text, $prefix, $suffix, $key, $timestamp=false, &$filepath)
 
 groupCommands ($group)
 
 storeCacheFile ($filepath, $transformationData, $extraCode, $type, $charsetName)
 
 varExport ($value)
 

Static Private Member Functions

 cachedTransformationPath ()
 
 varExportInternal ($value, $column=0, $iteration=0)
 

Detailed Description

Performs rule based transformation of characters in a string.

See Also
eZCodeMapper

Member Function Documentation

eZCharTransform::cachedTransformationPath ( )
staticprivate
Returns
the path of the cached transformation tables.

Referenced by executeCacheFile().

eZCharTransform::executeCacheFile ( $text,
  $prefix,
  $suffix,
  $key,
  $timestamp = false,
$filepath 
)
private
Parameters
$textThe text that should be transformed
$keyThe unique key for the cache, this should be a CRC32 or MD5 of the current rules or commands which are used.
$timestampA timestamp value which is matched against the cache file, pass for instance the timestamp of the INI file.
[out]$filepathThe filepath for the cache file will be generated here, this can be used for the storeCacheFile() method.
Returns
The restored transformation data or false if there is no cached data.

Referenced by transform(), and transformByGroup().

eZCharTransform::eZCharTransform ( )

Constructor

Referenced by instance().

eZCharTransform::groupCommands (   $group)
private

Finds all commands defined for group $group. The groups and their commands are defined in transform.ini.

Returns
An array with commands, each entry contains of:
  • command - Name of the command
  • parameters - Array with parameters for command
  • text - Textual representation of the command + parameters

Referenced by transformByGroup().

eZCharTransform::storeCacheFile (   $filepath,
  $transformationData,
  $extraCode,
  $type,
  $charsetName 
)
private

Stores the mapping table $table in the cache file $filepath.

Referenced by transform(), and transformByGroup().

eZCharTransform::transform (   $text,
  $rule,
  $charset = false,
  $useCache = true 
)

Transforms the text according to the rules defined in $rule using character set $charset.

Parameters
$textThe text string to be converted, currently Unicode arrays are not supported
$ruleWhich transformation rule to use, can either be a string identifier or an array with identifiers.
$charsetWhich charset to use when transforming, if false it will use current charset (i18n.ini).
$useCacheIf true then it will use cache files for the mapping, if not it will have to calculate them each time.
eZCharTransform::transformByGroup (   $text,
  $group,
  $charset = false,
  $useCache = true 
)

Transforms the text according to the rules defined in $rule using character set $charset.

Parameters
$textThe text string to be converted, currently Unicode arrays are not supported
$ruleWhich transformation rule to use, can either be a string identifier or an array with identifiers.
$charsetWhich charset to use when transforming, if false it will use current charset (i18n.ini).
$useCacheIf true then it will use cache files for the tables, if not it will have to calculate them each time.
eZCharTransform::varExport (   $value)
private

Creates a text representation of the value $value which can be placed in files and be read back by a PHP parser as it was. The type of the values determines the output, it can be one of the following.

  • boolean, becomes true or false
  • null, becomes null
  • string, adds \ (backslash) to backslashes, double quotes, dollar signs and newlines. Then wraps the whole string in " (double quotes).
  • numeric, displays the value as-is.
  • array, expands all value recursively using this function
  • object, creates a representation of an object creation if the object has serializeData implemented.
Parameters
$columnDetermines the starting column in which the text will be placed. This is used for expanding arrays and objects which can span multiple lines.
$iterationThe current iteration, starts at 0 and increases with 1 for each recursive call

Referenced by storeCacheFile().

eZCharTransform::varExportInternal (   $value,
  $column = 0,
  $iteration = 0 
)
staticprivate

Referenced by varExport().


The documentation for this class was generated from the following file: