phpnuxbill/system/autoload/Lang.php

71 lines
1.7 KiB
PHP
Raw Normal View History

2022-09-10 17:08:10 +08:00
<?php
/**
2022-10-16 15:50:24 +08:00
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
2022-09-10 17:08:10 +08:00
**/
2023-08-09 11:49:29 +08:00
class Lang
{
public static function T($var)
{
2022-09-10 17:08:10 +08:00
return Lang($var);
}
2023-03-06 15:51:05 +08:00
2023-08-09 11:49:29 +08:00
public static function htmlspecialchars($var)
{
2023-03-06 15:51:05 +08:00
return htmlspecialchars($var);
}
2023-08-09 11:49:29 +08:00
public static function moneyFormat($var)
{
global $config;
return $config['currency_code'] . ' ' .number_format($var, 0, $config['dec_point'], $config['thousands_sep']);
}
2023-08-09 15:54:38 +08:00
public static function phoneFormat($phone)
{
global $config;
if(Validator::UnsignedNumber($phone) && !empty($config['country_code_phone'])){
return preg_replace('/^0/', $config['country_code_phone'], $phone);
}else{
return $phone;
}
}
2023-08-21 18:09:44 +08:00
public static function dateFormat($date){
global $config;
return date($config['date_format'], strtotime($date));
}
public static function dateTimeFormat($date){
global $config;
2023-09-01 10:16:40 +08:00
if(strtotime($date) < strtotime("2000-01-01 00:00:00")){
return "";
}else{
return date($config['date_format']. ' H:i', strtotime($date));
}
2023-08-21 18:09:44 +08:00
}
2023-08-24 16:12:31 +08:00
public static function dateAndTimeFormat($date, $time){
global $config;
return date($config['date_format']. ' H:i', strtotime("$date $time"));
}
2023-08-21 18:09:44 +08:00
public static function nl2br($text){
return nl2br($text);
}
public static function arrayCount($arr){
return count($arr);
}
2023-08-24 12:35:23 +08:00
public static function getNotifText($key){
global $_notifmsg, $_notifmsg_default;
if(isset($_notifmsg[$key])){
return $_notifmsg[$key];
}else{
return $_notifmsg_default[$key];
}
}
2022-09-10 17:08:10 +08:00
}