mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-07-09 15:27:32 +00:00
Add lcfirst implementation for PHP < 5.3
This commit is contained in:
parent
676931a4a9
commit
816d9c781d
@ -30,7 +30,7 @@ class Check {
|
|||||||
$from_type = $page->type_info($from);
|
$from_type = $page->type_info($from);
|
||||||
$type = $from_type['type'];
|
$type = $from_type['type'];
|
||||||
if ($type !== null) {
|
if ($type !== null) {
|
||||||
$href .= "&from=" . lcfirst($from_type['title']);
|
$href .= "&from=" . Page::lc_first($from_type['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<br><script type=\"text/javascript\">document.location=\"$href\";</script>";
|
echo "<br><script type=\"text/javascript\">document.location=\"$href\";</script>";
|
||||||
|
@ -95,7 +95,7 @@ if (isset($_GET['from'])) {
|
|||||||
$info = $page->type_info($_GET['from']);
|
$info = $page->type_info($_GET['from']);
|
||||||
if ($info['type'] !== null) {
|
if ($info['type'] !== null) {
|
||||||
$from_title = $info['title'];
|
$from_title = $info['title'];
|
||||||
$from = lcfirst($from_title);
|
$from = Page::lc_first($from_title);
|
||||||
$from_href = "$from.php";
|
$from_href = "$from.php";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
inc/page.php
10
inc/page.php
@ -390,4 +390,14 @@ class Page {
|
|||||||
echo "<script type=\"text/javascript\">withjQuery(function(){ $('tr').click(function(){var href=$(this).find('a').attr('href');if(href!==undefined)window.location=href;}).hover(function(){\$(this).toggleClass('hover');}); });</script>";
|
echo "<script type=\"text/javascript\">withjQuery(function(){ $('tr').click(function(){var href=$(this).find('a').attr('href');if(href!==undefined)window.location=href;}).hover(function(){\$(this).toggleClass('hover');}); });</script>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user