Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | List of all members
eZCodeMapper Class Reference
Internationalization

Handles mapping of character codes. More...

## Public Member Functions
| __construct ()
| mappingTable ( $identifier)
| ruleNames ()
| error ( $text, $position=false)
| warning ( $text, $position=false)
| isTranformationLoaded ( $name)
| loadTransformationFiles ( $currentCharset, $transformationGroup)
| parseTransformationFile ( $filename, $name)
| ordinalValues ( $table, $list)
| mapOrdinals ( $table, $ordinals)
| generateSimpleMappingTable ( $table, $allowedRanges)
| generateMappingCode ( $identifier)
| generateCharsetMappingTable ( $unicodeTable, $charset)
| decodeCommand ( $name, $parameters)
| generateCommandCode ( $command, $charsetName)
| executeCommandCode (&$text, $command, $charsetName)
| nonCJKCharsets ()

## Public Attributes
const | TYPE_DIRECT = 1
const | TYPE_RANGE = 2
const | TYPE_REPLACE = 3
| $TransformationTables
| $TransformationFiles
| $ISOUnicodeCodec

## Protected Member Functions
| mapExistingCodes ( $unicodeMap, $fromCode, $toCode)

## Private Member Functions
| appendDirectMapping (&$block, $identifier, $sourceValue, $destinationValues)
| appendReplaceMapping (&$block, $identifier, $sourceValue, $sourceEndValue, $destinationValues)
| appendTransposeMapping (&$block, $identifier, $sourceValue, $sourceEndValue, $transposeValue, $addValue, $moduloValue)
| extractUnicodeValue ( $data)
| extractUnicodeValues ( $data)
| expandInheritance ( $table)

## Detailed Description

Handles mapping of character codes.

Definition at line 19 of file ezcodemapper.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZCodeMapper::__construct | ( |  | ) |

Definition at line 25 of file ezcodemapper.php.

## Member Function Documentation

## ◆ appendDirectMapping()

eZCodeMapper::appendDirectMapping | ( | & | $block,
|  |  | $identifier,
|  |  | $sourceValue,
|  |  | $destinationValues
| ) |  |
| private

Appends a mapping from one value to another.

Parameters

  $block | Current block it is working on
  $identifier | The current identifier it is working on
  $sourceValue | The original value
  $destinationValues | The value it should be mapped to

Definition at line 839 of file ezcodemapper.php.

References $count.

Referenced by parseTransformationFile().

## ◆ appendReplaceMapping()

eZCodeMapper::appendReplaceMapping | ( | & | $block,
|  |  | $identifier,
|  |  | $sourceValue,
|  |  | $sourceEndValue,
|  |  | $destinationValues
| ) |  |
| private

Appends a mapping for a range of values into a specific value

Parameters

  $block | Current block it is working on
  $identifier | The current identifier it is working on
  $sourceValue | The start of the original value
  $sourceEndValue | The ned of the original value
  $destinationValues | The value it should be mapped to

Definition at line 868 of file ezcodemapper.php.

References $count.

Referenced by parseTransformationFile().

## ◆ appendTransposeMapping()

eZCodeMapper::appendTransposeMapping | ( | & | $block,
|  |  | $identifier,
|  |  | $sourceValue,
|  |  | $sourceEndValue,
|  |  | $transposeValue,
|  |  | $addValue,
|  |  | $moduloValue
| ) |  |
| private

Appends a mapping for characters by transposing them up or down.

Parameters

  $block | Current block it is working on
  $identifier | The current identifier it is working on
  $sourceValue | The start of the original value
  $sourceEndValue | The ned of the original value
  $transposeValue | How much to transpose the values
  $addValue | If `true` the $transposeValue is added to the range if not it is subtracted.

Definition at line 898 of file ezcodemapper.php.

References $count.

Referenced by parseTransformationFile().

## ◆ decodeCommand()

eZCodeMapper::decodeCommand | ( |  | $name,
|  |  | $parameters
| ) |  |

Decodes a command into transformation rules.

Parameters

  $name | Name of the command
  $parameters | Array of parameters for the command

Returns
  An array with transformation rules.

Definition at line 1434 of file ezcodemapper.php.

References $ini, $name, ruleNames(), and eZDebug\writeError().

## ◆ error()

eZCodeMapper::error | ( |  | $text,
|  |  | $position = `false`
| ) |  |

Outputs error $text found in parsed file at position $position.

Definition at line 52 of file ezcodemapper.php.

References $position, $str, and eZDebug\writeError().

Referenced by parseTransformationFile().

## ◆ executeCommandCode()

eZCodeMapper::executeCommandCode | ( | & | $text,
|  |  | $command,
|  |  | $charsetName
| ) |  |

Executes custom PHP code for the command $command.

Parameters

  $charsetName | The name of the charset the text will be in, this can be used to execute different code for different charsets.

Returns
  `true` if the command is supported, `false` otherwise.

Definition at line 1663 of file ezcodemapper.php.

References $ini, eZCharTransform\commandUrlCleanup(), eZCharTransform\commandUrlCleanupCompat(), eZCharTransform\commandUrlCleanupIRI(), file_exists(), eZTextCodec\instance(), eZTextCodec\internalCharset(), nonCJKCharsets(), and eZDebug\writeError().

## ◆ expandInheritance()

eZCodeMapper::expandInheritance | ( |  | $table | ) |
| private

Goes trough all entries in $table and if it finds identifier references it will fetch the table for that identifier and merge in the current one.

Returns
  The expanded table.

Definition at line 983 of file ezcodemapper.php.

References mappingTable(), and eZDebug\writeError().

Referenced by generateMappingCode().

## ◆ extractUnicodeValue()

eZCodeMapper::extractUnicodeValue | ( |  | $data | ) |
| private

Returns
  The first unicod value for the data entry $data.

Definition at line 920 of file ezcodemapper.php.

References $type.

Referenced by parseTransformationFile().

## ◆ extractUnicodeValues()

eZCodeMapper::extractUnicodeValues | ( |  | $data | ) |
| private

Returns
  The unicode values for the data entry $data.

Definition at line 951 of file ezcodemapper.php.

References $type.

Referenced by parseTransformationFile().

## ◆ generateCharsetMappingTable()

eZCodeMapper::generateCharsetMappingTable | ( |  | $unicodeTable,
|  |  | $charset
| ) |  |

Generates a mapping table for the character set $charset. This will mapping table will only work for that character set but will be much faster and be fed directly to the strtr() PHP function.

Returns
  the table or `false` if something failed.

Definition at line 1397 of file ezcodemapper.php.

References eZTextCodec\instance(), and eZDebug\writeError().

## ◆ generateCommandCode()

eZCodeMapper::generateCommandCode | ( |  | $command,
|  |  | $charsetName
| ) |  |

Generates PHP code for the command $command.

Parameters

  $charsetName | The name of the charset the text will be in, this can be used to generate different code for different charsets.

Returns
  A string containing PHP code or `false` if not supported.

Definition at line 1519 of file ezcodemapper.php.

References $ini, file_exists(), nonCJKCharsets(), and eZDebug\writeError().

## ◆ generateMappingCode()

eZCodeMapper::generateMappingCode | ( |  | $identifier | ) |

Generates a unicode mapping table for idenfier $idenfier.

Parameters

  $identifier | Is either a single identifier string or a an array with identifiers.

Returns
  The unicode mapping table for all defined identifiers

Definition at line 1378 of file ezcodemapper.php.

References expandInheritance(), and generateSimpleMappingTable().

## ◆ generateSimpleMappingTable()

eZCodeMapper::generateSimpleMappingTable | ( |  | $table,
|  |  | $allowedRanges
| ) |  |

Goes trough the mapping rules in the table $table and generates a simple mapping table which maps from one Unicode value to another (or array of values).

The generation uses backward and forward propagation of the defined mappings to get the proper end result of a given value.

Note
  This method can take a while if lots of rules are used

Definition at line 1113 of file ezcodemapper.php.

References $i, $item, $replace, $tmp, $type, mapExistingCodes(), and ordinalValues().

Referenced by generateMappingCode().

## ◆ isTranformationLoaded()

eZCodeMapper::isTranformationLoaded | ( |  | $name | ) |

Returns
  `true` if the transformation file is already loaded.

Definition at line 100 of file ezcodemapper.php.

References $name.

Referenced by loadTransformationFiles().

## ◆ loadTransformationFiles()

eZCodeMapper::loadTransformationFiles | ( |  | $currentCharset,
|  |  | $transformationGroup
| ) |  |

Loads all transformation files defined in `transform.ini` to the current mapper. It will also load any transformations found in extensions.

Parameters

  $currentCharset | The name of the current charset in use. The caller must make sure this is not an alias by using eZCharsetInfo::realCharsetCode()
  $transformationGroup | The transformation group which is currently used or `false` for none.

Definition at line 113 of file ezcodemapper.php.

References $file, $files, $group, $ini, eZExtension\expandedPathList(), file_exists(), isTranformationLoaded(), parseTransformationFile(), and eZCharsetInfo\realCharsetCode().

## ◆ mapExistingCodes()

eZCodeMapper::mapExistingCodes | ( |  | $unicodeMap,
|  |  | $fromCode,
|  |  | $toCode
| ) |  |
| protected

Goes trough all to codes in the mapping table $unicodeMap and maps those that match $fromCode into $toCode.

Returns
  $unicodeMap

Definition at line 1076 of file ezcodemapper.php.

Referenced by generateSimpleMappingTable().

## ◆ mapOrdinals()

eZCodeMapper::mapOrdinals | ( |  | $table,
|  |  | $ordinals
| ) |  |

Goes trough each ordinal in $ordinals and sees if there is mapping for it. If it is the mapping is applied and used as the new ordinal, if the mapping refers to an array it will be mapped recursively.

Definition at line 1049 of file ezcodemapper.php.

Referenced by ordinalValues().

## ◆ mappingTable()

eZCodeMapper::mappingTable | ( |  | $identifier | ) |

Returns
  The mapping table for identifier $identifier or `false` if it is not found.

Definition at line 34 of file ezcodemapper.php.

Referenced by expandInheritance().

## ◆ nonCJKCharsets()

eZCodeMapper::nonCJKCharsets | ( |  | ) |

Returns
  An array with charsets that are certain to not contain CJK characters.

Definition at line 1803 of file ezcodemapper.php.

Referenced by executeCommandCode(), and generateCommandCode().

## ◆ ordinalValues()

eZCodeMapper::ordinalValues | ( |  | $table,
|  |  | $list
| ) |  |

Turns the character list $list into an array with ordinal values

Parameters

  $list | Can be on of these types: String - each character is turned into an ordinal value Numeric - the numeric is used as ordinal value Boolean - means no character Array - each element is turned into an ordinal value by recursion

Definition at line 1018 of file ezcodemapper.php.

References $item, $offset, and mapOrdinals().

Referenced by generateSimpleMappingTable().

## ◆ parseTransformationFile()

eZCodeMapper::parseTransformationFile | ( |  | $filename,
|  |  | $name
| ) |  |

Parses the transformation file $filename and appends any rules it finds to the current rule list.

Parameters

  $name | The name of transformation file as it was requested, ie. without a path

Definition at line 177 of file ezcodemapper.php.

References $i, $lines, $name, $offset, $str, $type, appendDirectMapping(), appendReplaceMapping(), appendTransposeMapping(), error(), extractUnicodeValue(), extractUnicodeValues(), eZTextCodec\instance(), and warning().

Referenced by loadTransformationFiles().

## ◆ ruleNames()

eZCodeMapper::ruleNames | ( |  | ) |

Returns
  An array with the names of rules which are currently available.

Definition at line 44 of file ezcodemapper.php.

Referenced by decodeCommand().

## ◆ warning()

eZCodeMapper::warning | ( |  | $text,
|  |  | $position = `false`
| ) |  |

Outputs warning $text found in parsed file at position $position.

Definition at line 76 of file ezcodemapper.php.

References $position, $str, and eZDebug\writeWarning().

Referenced by parseTransformationFile().

## Member Data Documentation

## ◆ $ISOUnicodeCodec

eZCodeMapper::$ISOUnicodeCodec

Definition at line 1822 of file ezcodemapper.php.

## ◆ $TransformationFiles

eZCodeMapper::$TransformationFiles

Definition at line 1821 of file ezcodemapper.php.

## ◆ $TransformationTables

eZCodeMapper::$TransformationTables

Definition at line 1820 of file ezcodemapper.php.

## ◆ TYPE_DIRECT

const eZCodeMapper::TYPE_DIRECT = 1

Definition at line 21 of file ezcodemapper.php.

## ◆ TYPE_RANGE

const eZCodeMapper::TYPE_RANGE = 2

Definition at line 22 of file ezcodemapper.php.

## ◆ TYPE_REPLACE

const eZCodeMapper::TYPE_REPLACE = 3

Definition at line 23 of file ezcodemapper.php.

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

- ezcodemapper.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.