Googdame
This commit is contained in:
parent
7cb17c6136
commit
2fd69f4642
@ -7,12 +7,16 @@ class LanguageService {
|
||||
private static $lang = 'id';
|
||||
|
||||
public static function init() {
|
||||
if (isset($_SESSION['lang'])) {
|
||||
if (isset($_SESSION['lang']) && is_string($_SESSION['lang'])) {
|
||||
self::$lang = $_SESSION['lang'];
|
||||
} elseif (isset($_COOKIE['lang'])) {
|
||||
} elseif (isset($_COOKIE['lang']) && is_string($_COOKIE['lang'])) {
|
||||
self::$lang = $_COOKIE['lang'];
|
||||
}
|
||||
|
||||
if (!is_string(self::$lang)) {
|
||||
self::$lang = 'id';
|
||||
}
|
||||
|
||||
$langFile = __DIR__ . '/../../lang/' . self::$lang . '.php';
|
||||
if (file_exists($langFile)) {
|
||||
self::$translations = require $langFile;
|
||||
@ -34,6 +38,9 @@ class LanguageService {
|
||||
}
|
||||
|
||||
public static function setLang($lang) {
|
||||
if (!is_string($lang)) {
|
||||
return;
|
||||
}
|
||||
self::$lang = $lang;
|
||||
$_SESSION['lang'] = $lang;
|
||||
setcookie('lang', $lang, time() + (86400 * 30), "/");
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
// Autoloader
|
||||
spl_autoload_register(function ($class) {
|
||||
$prefix = 'App\';
|
||||
$prefix = 'App\\';
|
||||
$base_dir = __DIR__ . '/app/';
|
||||
|
||||
$len = strlen($prefix);
|
||||
@ -86,4 +86,4 @@ $router->get('/admin/withdrawals', 'AdminController@withdrawals');
|
||||
$router->get('/admin/withdrawals/approve/:id', 'AdminController@approveWithdrawal');
|
||||
$router->get('/admin/withdrawals/reject/:id', 'AdminController@rejectWithdrawal');
|
||||
|
||||
$router->dispatch();
|
||||
$router->dispatch();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user