From 816d9c781d121a85ea22533829478d839ef78287 Mon Sep 17 00:00:00 2001 From: ruan Date: Mon, 18 Jan 2016 09:50:54 +0200 Subject: [PATCH] Add lcfirst implementation for PHP < 5.3 --- check.php | 2 +- history.php | 2 +- inc/page.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/check.php b/check.php index 7182bac..550f6db 100644 --- a/check.php +++ b/check.php @@ -30,7 +30,7 @@ class Check { $from_type = $page->type_info($from); $type = $from_type['type']; if ($type !== null) { - $href .= "&from=" . lcfirst($from_type['title']); + $href .= "&from=" . Page::lc_first($from_type['title']); } echo "
"; diff --git a/history.php b/history.php index baf372a..3488e56 100644 --- a/history.php +++ b/history.php @@ -95,7 +95,7 @@ if (isset($_GET['from'])) { $info = $page->type_info($_GET['from']); if ($info['type'] !== null) { $from_title = $info['title']; - $from = lcfirst($from_title); + $from = Page::lc_first($from_title); $from_href = "$from.php"; } } diff --git a/inc/page.php b/inc/page.php index 082b3f2..f012e88 100644 --- a/inc/page.php +++ b/inc/page.php @@ -390,4 +390,14 @@ class Page { echo ""; } } + + /** + * lcfirst is only supported in PHP >= 5.3 + * @param $str + * @return string + */ + static function lc_first($str) { + $str[0] = strtolower($str[0]); + return (string)$str; + } }