]> git.nbdom.net Git - nb.git/commitdiff
filename2title
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 7 Jul 2015 16:34:50 +0000 (17:34 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 7 Jul 2015 16:34:50 +0000 (17:34 +0100)
lib/php/page.php

index 85b9b571368614ea67a9b07e1f79762bd4281bd1..c3e9e46b6de322b6515cbccfb871a14d94450385 100644 (file)
@@ -84,9 +84,10 @@ class Page {
 
   function filename2title() {
     $str = '';
-    if (isset($_SERVER['REQUEST_URI'])) $str = preg_replace(',^.*?([^/]+)(\/?.*)?$,','\1',$_SERVER['REQUEST_URI']);
+    if (isset($_SERVER['REQUEST_URI'])) $str = preg_replace('/\?.*$/','',preg_replace(',^.*?([^/]+)(\/?.*)?$,','\1',$_SERVER['REQUEST_URI']));
     if ($str == '' or $str == '/') $str = preg_replace('@^.*?([^/\.]+)(/index)?(\..*?)$@','\1',$_SERVER['SCRIPT_NAME']);
     $str = preg_replace('@[\'_-]+$@',' ',$str);
+    if ($str == 'index') return 'Home';
     return mb_strtoupper(mb_substr($str,0,1)).mb_strtolower(mb_substr($str,1,mb_strlen($str)));
   }