summaryrefslogtreecommitdiff
path: root/inc/utf8.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-07-29 12:09:42 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-07-29 12:12:14 +0200
commitfa446926c63aef4f4f394967b84d20e2da0dad6d (patch)
tree2a64e72ebd66875fcb45448c2c91afe6c0e2c007 /inc/utf8.php
parenta8c343f2838765f8034ee6b91263b1b417f3a7ec (diff)
downloadrpg-fa446926c63aef4f4f394967b84d20e2da0dad6d.tar.gz
rpg-fa446926c63aef4f4f394967b84d20e2da0dad6d.tar.bz2
more utf8_basename fixes
Diffstat (limited to 'inc/utf8.php')
-rw-r--r--inc/utf8.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index e3e7e8c1a..6fab8502c 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -91,10 +91,9 @@ if(!function_exists('utf8_basename')){
* @return string
*/
function utf8_basename($path, $suffix=''){
- $slashrpos = strrpos($path, '/');
- $bslashrpos = strrpos($path, '\\');
- $rpos = max($slashrpos === false ? -1 : $slashrpos, $bslashrpos === false ? -1 : $bslashrpos);
- $path = substr($path, $rpos+1);
+ $path = trim($path,'\\/');
+ $rpos = max(strrpos($path, '/'), strrpos($path, '\\'));
+ if($rpos) $path = substr($path, $rpos+1);
$suflen = strlen($suffix);
if($suflen && (substr($path, -$suflen) == $suffix)){