1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
<?php
namespace dokuwiki\Utf8;
/**
* Provides static access to the UTF-8 conversion tables
*
* Lazy-Loads tables on first access
*/
class Table
{
/**
* Get the upper to lower case conversion table
*
* @return array
*/
public static function upperCaseToLowerCase()
{
static $table = null;
if ($table === null) $table = include __DIR__ . '/tables/case.php';
return $table;
}
/**
* Get the lower to upper case conversion table
*
* @return array
*/
public static function lowerCaseToUpperCase()
{
static $table = null;
if ($table === null) {
$uclc = self::upperCaseToLowerCase();
$table = array_flip($uclc);
}
return $table;
}
/**
* Get the lower case accent table
* @return array
*/
public static function lowerAccents()
{
static $table = null;
if ($table === null) {
$table = include __DIR__ . '/tables/loweraccents.php';
}
return $table;
}
/**
* Get the lower case accent table
* @return array
*/
public static function upperAccents()
{
static $table = null;
if ($table === null) {
$table = include __DIR__ . '/tables/upperaccents.php';
}
return $table;
}
/**
* Get the romanization table
* @return array
*/
public static function romanization()
{
static $table = null;
if ($table === null) {
$table = include __DIR__ . '/tables/romanization.php';
}
return $table;
}
/**
* Get the special chars as a concatenated string
* @return string
*/
public static function specialChars()
{
static $string = null;
if ($string === null) {
$table = include __DIR__ . '/tables/specials.php';
// FIXME should we cache this to file system?
$string = Unicode::toUtf8($table);
}
return $string;
}
}
|