mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Account for missing ms_stripos
This commit is contained in:
parent
173a72fa46
commit
98fff659a3
1 changed files with 27 additions and 0 deletions
27
core.php
27
core.php
|
@ -255,6 +255,33 @@ function starts_with($haystack, $needle)
|
||||||
return (substr($haystack, 0, $length) === $needle);
|
return (substr($haystack, 0, $length) === $needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mb_stripos all occurences
|
||||||
|
* from http://www.pontikis.net/tip/?id=16
|
||||||
|
* based on http://www.php.net/manual/en/function.strpos.php#87061
|
||||||
|
*
|
||||||
|
* Find all occurrences of a needle in a haystack (case-insensitive, UTF8)
|
||||||
|
*
|
||||||
|
* @param string $haystack
|
||||||
|
* @param string $needle
|
||||||
|
* @return array or false
|
||||||
|
*/
|
||||||
|
function mb_stripos_all($haystack, $needle) {
|
||||||
|
$s = 0; $i = 0;
|
||||||
|
while(is_integer($i)) {
|
||||||
|
$i = function_exists("mb_stripos") ? mb_stripos($haystack, $needle, $s) : stripos($haystack, $needle, $s);
|
||||||
|
if(is_integer($i)) {
|
||||||
|
$aStrPos[] = $i;
|
||||||
|
$s = $i + (function_exists("mb_strlen") ? mb_strlen($needle) : strlen($needle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($aStrPos))
|
||||||
|
return $aStrPos;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function system_mime_type_extensions() {
|
function system_mime_type_extensions() {
|
||||||
global $settings;
|
global $settings;
|
||||||
# Returns the system MIME type mapping of MIME types to extensions, as defined in /etc/mime.types (considering the first
|
# Returns the system MIME type mapping of MIME types to extensions, as defined in /etc/mime.types (considering the first
|
||||||
|
|
Loading…
Reference in a new issue