Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
TurkishUtf8.php
001 <?php
002
003 /*
004 * Copyright (C) 2016 Nicolas Grekas - p@tchwork.com
005 *
006 * This library is free software; you can redistribute it and/or modify it
007 * under the terms of the (at your option):
008 * Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or
009 * GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).
010 */
011
012 namespace Patchwork;
013
014 /**
015 * Turkish locale specialized version of Patchwork\Utf8.
016 */
017 class TurkishUtf8 extends Utf8
018 {
019 public static function strtocasefold($s, $full = true)
020 {
021 if (false !== strpos($s, 'İ')) {
022 $s = str_replace('İ', 'i', $s);
023 }
024
025 return parent::strtocasefold($s, $full);
026 }
027
028 public static function stripos($s, $needle, $offset = 0)
029 {
030 if (false !== strpos($needle, 'I')) {
031 $needle = str_replace('I', 'ı', $needle);
032 }
033 if (false !== strpos($needle, 'İ')) {
034 $needle = str_replace('İ', 'i', $needle);
035 }
036 if (false !== strpos($s, 'I')) {
037 $s = str_replace('I', 'ı', $s);
038 }
039 if (false !== strpos($s, 'İ')) {
040 $s = str_replace('İ', 'i', $s);
041 }
042
043 return parent::stripos($s, $needle, $offset);
044 }
045
046 public static function strripos($s, $needle, $offset = 0)
047 {
048 if (false !== strpos($needle, 'I')) {
049 $needle = str_replace('I', 'ı', $needle);
050 }
051 if (false !== strpos($needle, 'İ')) {
052 $needle = str_replace('İ', 'i', $needle);
053 }
054 if (false !== strpos($s, 'I')) {
055 $s = str_replace('I', 'ı', $s);
056 }
057 if (false !== strpos($s, 'İ')) {
058 $s = str_replace('İ', 'i', $s);
059 }
060
061 return parent::strripos($s, $needle, $offset);
062 }
063
064 public static function stristr($s, $needle, $before_needle = false)
065 {
066 $needle = self::stripos($s, $needle);
067 if (false === $needle) {
068 return false;
069 }
070 if ($before_needle) {
071 return self::substr($s, 0, $needle);
072 }
073
074 return self::substr($s, $needle);
075 }
076
077 public static function strrichr($s, $needle, $before_needle = false)
078 {
079 $needle = self::strripos($s, $needle);
080 if (false === $needle) {
081 return false;
082 }
083 if ($before_needle) {
084 return self::substr($s, 0, $needle);
085 }
086
087 return self::substr($s, $needle);
088 }
089
090 public static function strtolower($s)
091 {
092 if (false !== strpos($s, 'İ')) {
093 $s = str_replace('İ', 'i', $s);
094 }
095 if (false !== strpos($s, 'I')) {
096 $s = str_replace('I', 'ı', $s);
097 }
098
099 return parent::strtolower($s);
100 }
101
102 public static function strtoupper($s)
103 {
104 if (false !== strpos($s, 'i')) {
105 $s = str_replace('i', 'İ', $s);
106 }
107
108 return parent::strtoupper($s);
109 }
110
111 public static function str_ireplace($search, $replace, $subject, &$count = null)
112 {
113 $search = (array) $search;
114
115 foreach ($search as $i => $s) {
116 if ('' === $s .= '') {
117 $s = '/^(?<=.)$/';
118 } else {
119 $s = preg_quote($s, '/');
120 $s = strtr($s, array(
121 'i' => '(?-i:[iİ])',
122 'İ' => '(?-i:[iİ])',
123 'ı' => '(?-i:[ıI])',
124 'I' => '(?-i:[ıI])',
125 ));
126 $s = "/{$s}/ui";
127 }
128
129 $search[$i] = $s;
130 }
131
132 $subject = preg_replace($search, $replace, $subject, -1, $replace);
133 $count = $replace;
134
135 return $subject;
136 }
137
138 public static function ucfirst($s)
139 {
140 if ('i' === substr($s, 0, 1)) {
141 return 'İ'.substr($s, 1);
142 } else {
143 return parent::ucfirst($s);
144 }
145 }
146
147 public static function ucwords($s)
148 {
149 if (false !== strpos($s, 'i')) {
150 $s = preg_replace('/\bi/u', 'İ', $s);
151 }
152
153 return parent::ucwords($s);
154 }
155 }
156