summaryrefslogtreecommitdiff
path: root/platform/www/inc/Utf8/Table.php
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2022-03-08 13:08:34 +0000
committerYaco <franco@reevo.org>2022-03-08 13:08:34 +0000
commitc985c40d3f3fc6a2be3be3186df3bf2f32189475 (patch)
treecee11f5e5a7e351ee0fec36d58d72cbee4f7e49b /platform/www/inc/Utf8/Table.php
first commit after acervus codebase
Diffstat (limited to 'platform/www/inc/Utf8/Table.php')
-rw-r--r--platform/www/inc/Utf8/Table.php93
1 files changed, 93 insertions, 0 deletions
diff --git a/platform/www/inc/Utf8/Table.php b/platform/www/inc/Utf8/Table.php
new file mode 100644
index 0000000..8683c92
--- /dev/null
+++ b/platform/www/inc/Utf8/Table.php
@@ -0,0 +1,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;
+ }
+}