mirror of
https://github.com/twisterarmy/cloud-server.git
synced 2025-03-13 05:51:46 +00:00
rename localization helper to format, add posts br support
This commit is contained in:
parent
72ecc92426
commit
88b2dd53a5
@ -43,16 +43,16 @@ if (isset($_SESSION['userName'])) {
|
||||
}
|
||||
|
||||
$reTwist = [
|
||||
'message' => implode('', $reTwists),
|
||||
'time' => Localization::time($post['userpost']['rt']['time']),
|
||||
'message' => Format::post(implode('', $reTwists)),
|
||||
'time' => Format::time($post['userpost']['rt']['time']),
|
||||
'userName' => $post['userpost']['rt']['n'],
|
||||
'reTwist' => $reTwist,
|
||||
];
|
||||
}
|
||||
|
||||
$posts[] = [
|
||||
'message' => implode('', $messages),
|
||||
'time' => Localization::time($post['userpost']['time']),
|
||||
'message' => Format::post(implode('', $messages)),
|
||||
'time' => Format::time($post['userpost']['time']),
|
||||
'userName' => $post['userpost']['n'],
|
||||
'reTwist' => $reTwist,
|
||||
];
|
||||
|
@ -12,7 +12,7 @@ require(PROJECT_DIR . '/system/twister.php');
|
||||
require(PROJECT_DIR . '/system/icon.php');
|
||||
require(PROJECT_DIR . '/system/helper/filter.php');
|
||||
require(PROJECT_DIR . '/system/helper/valid.php');
|
||||
require(PROJECT_DIR . '/system/helper/localization.php');
|
||||
require(PROJECT_DIR . '/system/helper/format.php');
|
||||
|
||||
// Init libraries
|
||||
$_twister = new Twister(
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Localization {
|
||||
class Format {
|
||||
|
||||
public static function plural(int $number, array $texts) {
|
||||
|
||||
@ -33,5 +33,10 @@ class Localization {
|
||||
return sprintf('%s %s ago', $r, self::plural($r, $v));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function post(string $text) {
|
||||
|
||||
return nl2br($text);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user