18
18
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
19
19
*/
20
20
21
+ if (!function_exists ('mb_stripos ' )) {
22
+
21
23
/**
22
24
* Find position of first occurrence of a case-insensitive string.
23
25
*
28
30
* @return integer|boolean The numeric position of the first occurrence of $needle in the $haystack string, or false
29
31
* if $needle is not found.
30
32
*/
31
- if (!function_exists ('mb_stripos ' )) {
32
33
function mb_stripos ($ haystack , $ needle , $ offset = 0 , $ encoding = null ) {
33
34
return Multibyte::stripos ($ haystack , $ needle , $ offset );
34
35
}
36
+
35
37
}
36
38
39
+ if (!function_exists ('mb_stristr ' )) {
40
+
37
41
/**
38
42
* Finds first occurrence of a string within another, case insensitive.
39
43
*
@@ -46,12 +50,14 @@ function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) {
46
50
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
47
51
* @return string|boolean The portion of $haystack, or false if $needle is not found.
48
52
*/
49
- if (!function_exists ('mb_stristr ' )) {
50
53
function mb_stristr ($ haystack , $ needle , $ part = false , $ encoding = null ) {
51
54
return Multibyte::stristr ($ haystack , $ needle , $ part );
52
55
}
56
+
53
57
}
54
58
59
+ if (!function_exists ('mb_strlen ' )) {
60
+
55
61
/**
56
62
* Get string length.
57
63
*
@@ -60,12 +66,14 @@ function mb_stristr($haystack, $needle, $part = false, $encoding = null) {
60
66
* @return integer The number of characters in string $string having character encoding encoding.
61
67
* A multi-byte character is counted as 1.
62
68
*/
63
- if (!function_exists ('mb_strlen ' )) {
64
69
function mb_strlen ($ string , $ encoding = null ) {
65
70
return Multibyte::strlen ($ string );
66
71
}
72
+
67
73
}
68
74
75
+ if (!function_exists ('mb_strpos ' )) {
76
+
69
77
/**
70
78
* Find position of first occurrence of a string.
71
79
*
@@ -76,12 +84,14 @@ function mb_strlen($string, $encoding = null) {
76
84
* @return integer|boolean The numeric position of the first occurrence of $needle in the $haystack string.
77
85
* If $needle is not found, it returns false.
78
86
*/
79
- if (!function_exists ('mb_strpos ' )) {
80
87
function mb_strpos ($ haystack , $ needle , $ offset = 0 , $ encoding = null ) {
81
88
return Multibyte::strpos ($ haystack , $ needle , $ offset );
82
89
}
90
+
83
91
}
84
92
93
+ if (!function_exists ('mb_strrchr ' )) {
94
+
85
95
/**
86
96
* Finds the last occurrence of a character in a string within another.
87
97
*
@@ -94,12 +104,14 @@ function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) {
94
104
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
95
105
* @return string|boolean The portion of $haystack. or false if $needle is not found.
96
106
*/
97
- if (!function_exists ('mb_strrchr ' )) {
98
107
function mb_strrchr ($ haystack , $ needle , $ part = false , $ encoding = null ) {
99
108
return Multibyte::strrchr ($ haystack , $ needle , $ part );
100
109
}
110
+
101
111
}
102
112
113
+ if (!function_exists ('mb_strrichr ' )) {
114
+
103
115
/**
104
116
* Finds the last occurrence of a character in a string within another, case insensitive.
105
117
*
@@ -112,12 +124,14 @@ function mb_strrchr($haystack, $needle, $part = false, $encoding = null) {
112
124
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
113
125
* @return string|boolean The portion of $haystack. or false if $needle is not found.
114
126
*/
115
- if (!function_exists ('mb_strrichr ' )) {
116
127
function mb_strrichr ($ haystack , $ needle , $ part = false , $ encoding = null ) {
117
128
return Multibyte::strrichr ($ haystack , $ needle , $ part );
118
129
}
130
+
119
131
}
120
132
133
+ if (!function_exists ('mb_strripos ' )) {
134
+
121
135
/**
122
136
* Finds position of last occurrence of a string within another, case insensitive
123
137
*
@@ -128,12 +142,14 @@ function mb_strrichr($haystack, $needle, $part = false, $encoding = null) {
128
142
* @return integer|boolean The numeric position of the last occurrence of $needle in the $haystack string,
129
143
* or false if $needle is not found.
130
144
*/
131
- if (!function_exists ('mb_strripos ' )) {
132
145
function mb_strripos ($ haystack , $ needle , $ offset = 0 , $ encoding = null ) {
133
146
return Multibyte::strripos ($ haystack , $ needle , $ offset );
134
147
}
148
+
135
149
}
136
150
151
+ if (!function_exists ('mb_strrpos ' )) {
152
+
137
153
/**
138
154
* Find position of last occurrence of a string in a string.
139
155
*
@@ -145,12 +161,14 @@ function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) {
145
161
* @return integer|boolean The numeric position of the last occurrence of $needle in the $haystack string.
146
162
* If $needle is not found, it returns false.
147
163
*/
148
- if (!function_exists ('mb_strrpos ' )) {
149
164
function mb_strrpos ($ haystack , $ needle , $ offset = 0 , $ encoding = null ) {
150
165
return Multibyte::strrpos ($ haystack , $ needle , $ offset );
151
166
}
167
+
152
168
}
153
169
170
+ if (!function_exists ('mb_strstr ' )) {
171
+
154
172
/**
155
173
* Finds first occurrence of a string within another
156
174
*
@@ -163,38 +181,44 @@ function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) {
163
181
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
164
182
* @return string|boolean The portion of $haystack, or true if $needle is not found.
165
183
*/
166
- if (!function_exists ('mb_strstr ' )) {
167
184
function mb_strstr ($ haystack , $ needle , $ part = false , $ encoding = null ) {
168
185
return Multibyte::strstr ($ haystack , $ needle , $ part );
169
186
}
187
+
170
188
}
171
189
190
+ if (!function_exists ('mb_strtolower ' )) {
191
+
172
192
/**
173
193
* Make a string lowercase
174
194
*
175
195
* @param string $string The string being lowercased.
176
196
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
177
197
* @return string with all alphabetic characters converted to lowercase.
178
198
*/
179
- if (!function_exists ('mb_strtolower ' )) {
180
199
function mb_strtolower ($ string , $ encoding = null ) {
181
200
return Multibyte::strtolower ($ string );
182
201
}
202
+
183
203
}
184
204
205
+ if (!function_exists ('mb_strtoupper ' )) {
206
+
185
207
/**
186
208
* Make a string uppercase
187
209
*
188
210
* @param string $string The string being uppercased.
189
211
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
190
212
* @return string with all alphabetic characters converted to uppercase.
191
213
*/
192
- if (!function_exists ('mb_strtoupper ' )) {
193
214
function mb_strtoupper ($ string , $ encoding = null ) {
194
215
return Multibyte::strtoupper ($ string );
195
216
}
217
+
196
218
}
197
219
220
+ if (!function_exists ('mb_substr_count ' )) {
221
+
198
222
/**
199
223
* Count the number of substring occurrences
200
224
*
@@ -203,12 +227,14 @@ function mb_strtoupper($string, $encoding = null) {
203
227
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
204
228
* @return integer The number of times the $needle substring occurs in the $haystack string.
205
229
*/
206
- if (!function_exists ('mb_substr_count ' )) {
207
230
function mb_substr_count ($ haystack , $ needle , $ encoding = null ) {
208
231
return Multibyte::substrCount ($ haystack , $ needle );
209
232
}
233
+
210
234
}
211
235
236
+ if (!function_exists ('mb_substr ' )) {
237
+
212
238
/**
213
239
* Get part of string
214
240
*
@@ -218,12 +244,14 @@ function mb_substr_count($haystack, $needle, $encoding = null) {
218
244
* @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used.
219
245
* @return string The portion of $string specified by the $string and $length parameters.
220
246
*/
221
- if (!function_exists ('mb_substr ' )) {
222
247
function mb_substr ($ string , $ start , $ length = null , $ encoding = null ) {
223
248
return Multibyte::substr ($ string , $ start , $ length );
224
249
}
250
+
225
251
}
226
252
253
+ if (!function_exists ('mb_encode_mimeheader ' )) {
254
+
227
255
/**
228
256
* Encode string for MIME header
229
257
*
@@ -239,16 +267,15 @@ function mb_substr($string, $start, $length = null, $encoding = null) {
239
267
* @param integer $indent [definition unknown and appears to have no affect]
240
268
* @return string A converted version of the string represented in ASCII.
241
269
*/
242
- if (!function_exists ('mb_encode_mimeheader ' )) {
243
270
function mb_encode_mimeheader ($ str , $ charset = 'UTF-8 ' , $ transferEncoding = 'B ' , $ linefeed = "\r\n" , $ indent = 1 ) {
244
271
return Multibyte::mimeEncode ($ str , $ charset , $ linefeed );
245
272
}
273
+
246
274
}
247
275
248
276
/**
249
277
* Multibyte handling methods.
250
278
*
251
- *
252
279
* @package Cake.I18n
253
280
*/
254
281
class Multibyte {
0 commit comments