[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Utf8/ -> Table.php (source)

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