eZPublishCommunityProject(LegacyStack)  2013.6
eZCharTransform Class Reference

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

Public Member Functions

 cacheFilePath ($prefix, $suffix, $key)
 
 eZCharTransform ()
 
 setWordSeparator ($char)
 
 transform ($text, $rule, $charset=false, $useCache=true)
 
 transformByGroup ($text, $group, $charset=false, $useCache=true)
 

Static Public Member Functions

static commandUrlCleanup ($text, $charsetName)
 
static commandUrlCleanupCompat ($text, $charsetName)
 
static commandUrlCleanupIRI ($text, $charsetName)
 
static instance ()
 Returns a shared instance of the eZCharTransform class. More...
 
static wordSeparator ()
 

Public Attributes

const CODE_DATE = 1177423380
 The timestamp for when the format of the cache files were last changed. More...
 

Protected Member Functions

 executeCacheFile ($text, $filepath, $timestamp=false)
 

Private Member Functions

 groupCommands ($group)
 
 storeCacheFile ($filepath, $transformationData, $extraCode, $type, $charsetName)
 

Static Private Member Functions

 cachedTransformationPath ()
 
static varExport ($value)
 

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 cacheFilePath().

eZCharTransform::cacheFilePath (   $prefix,
  $suffix,
  $key 
)

Get cache file path.

Parameters
$prefix
$suffix
$key
Returns
cache file path.

Referenced by transform(), and transformByGroup().

static eZCharTransform::commandUrlCleanup (   $text,
  $charsetName 
)
static
static eZCharTransform::commandUrlCleanupCompat (   $text,
  $charsetName 
)
static
static eZCharTransform::commandUrlCleanupIRI (   $text,
  $charsetName 
)
static
eZCharTransform::executeCacheFile (   $text,
  $filepath,
  $timestamp = false 
)
protected
Parameters
$textThe text that should be transformed
$filepathThe filepath for the cache file
$timestampA timestamp value which is matched against the cache file, pass for instance the timestamp of the INI file.
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::setWordSeparator (   $char)

Sets the current word separator, set it to null to use default value.

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
$groupWhich transformation group to use, of which the rules will be applied.
$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.
static eZCharTransform::varExport (   $value)
staticprivate

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.

Referenced by storeCacheFile().

static eZCharTransform::wordSeparator ( )
static

Returns the current word separator, if none is found it will read from site.ini URLTranslator/WordSeparator

See Also
setWordSeparator

Referenced by commandUrlCleanup(), commandUrlCleanupIRI(), and eZURLAliasFilterAppendNodeID\process().

Member Data Documentation

const eZCharTransform::CODE_DATE = 1177423380

The timestamp for when the format of the cache files were last changed.

This must be updated when the format changes to invalidate existing cache files. 1101288452

  1. Jan. 2007 - 1170165730
  1. Apr. 2007 - 1177423380

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