From 1fcac35738764b82f72f7f73b5115c6a80db43d9 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 7 Jul 2015 17:34:50 +0100 Subject: [PATCH] filename2title --- lib/php/page.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/php/page.php b/lib/php/page.php index 85b9b571..c3e9e46b 100644 --- a/lib/php/page.php +++ b/lib/php/page.php @@ -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))); } -- 2.47.3