Merge branch 'hotspotbilling:master' into master
This commit is contained in:
@ -99,4 +99,38 @@ class Lang
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* $pad_type
|
||||
* 0 Left
|
||||
* 1 right
|
||||
* 2 center
|
||||
* */
|
||||
public static function pad($text, $pad_string = ' ', $pad_type = 0){
|
||||
global $config;
|
||||
$cols = 37;
|
||||
if($config['printer_cols']){
|
||||
$cols = $config['printer_cols'];
|
||||
}
|
||||
$text = trim($text);
|
||||
$texts = explode("\n", $text);
|
||||
if(count($texts)>1){
|
||||
$text = '';
|
||||
foreach($texts as $t){
|
||||
$text.= self::pad(trim($t), $pad_string, $pad_type)."\n";
|
||||
}
|
||||
return $text;
|
||||
}else{
|
||||
return str_pad(trim($text), $cols, $pad_string, $pad_type);
|
||||
}
|
||||
}
|
||||
|
||||
public static function pads($textLeft, $textRight, $pad_string = ' '){
|
||||
global $config;
|
||||
$cols = 37;
|
||||
if($config['printer_cols']){
|
||||
$cols = $config['printer_cols'];
|
||||
}
|
||||
return $textLeft.str_pad($textRight, $cols-strlen($textLeft), $pad_string, 0);
|
||||
}
|
||||
}
|
||||
|
@ -62,14 +62,15 @@ class Message
|
||||
if (!empty($config['wa_url'])) {
|
||||
$waurl = str_replace('[number]', urlencode($phone), $config['wa_url']);
|
||||
$waurl = str_replace('[text]', urlencode($txt), $waurl);
|
||||
Http::getData($waurl);
|
||||
return Http::getData($waurl);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPackageNotification($phone, $name, $package, $message, $via)
|
||||
public static function sendPackageNotification($phone, $name, $package, $price, $message, $via)
|
||||
{
|
||||
$msg = str_replace('[[name]]', "*$name*", $message);
|
||||
$msg = str_replace('[[package]]', "*$package*", $msg);
|
||||
$msg = str_replace('[[name]]', $name, $message);
|
||||
$msg = str_replace('[[package]]', $package, $msg);
|
||||
$msg = str_replace('[[price]]', $price, $msg);
|
||||
if (
|
||||
!empty($phone) && strlen($phone) > 5
|
||||
&& !empty($message) && in_array($via, ['sms', 'wa'])
|
||||
@ -85,9 +86,9 @@ class Message
|
||||
|
||||
public static function sendBalanceNotification($phone, $name, $balance, $balance_now, $message, $via)
|
||||
{
|
||||
$msg = str_replace('[[name]]', "*$name*", $message);
|
||||
$msg = str_replace('[[name]]', $name, $message);
|
||||
$msg = str_replace('[[current_balance]]', Lang::moneyFormat($balance_now), $msg);
|
||||
$msg = str_replace('[[balance]]', "*" . Lang::moneyFormat($balance) . "*", $msg);
|
||||
$msg = str_replace('[[balance]]', Lang::moneyFormat($balance), $msg);
|
||||
if (
|
||||
!empty($phone) && strlen($phone) > 5
|
||||
&& !empty($message) && in_array($via, ['sms', 'wa'])
|
||||
|
Reference in New Issue
Block a user