forked from kevinowino869/mitrobill
Move send SMS/Wa/Telegram to class
This commit is contained in:
@ -228,40 +228,6 @@ function alphanumeric($str, $tambahan = "")
|
||||
return preg_replace("/[^a-zA-Z0-9" . $tambahan . "]+/", "", $str);
|
||||
}
|
||||
|
||||
|
||||
function sendTelegram($txt)
|
||||
{
|
||||
global $config;
|
||||
run_hook('send_telegram'); #HOOK
|
||||
if (!empty($config['telegram_bot']) && !empty($config['telegram_target_id'])) {
|
||||
file_get_contents('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $config['telegram_target_id'] . '&text=' . urlencode($txt));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendSMS($phone, $txt)
|
||||
{
|
||||
global $config;
|
||||
run_hook('send_sms'); #HOOK
|
||||
if (!empty($config['sms_url'])) {
|
||||
$smsurl = str_replace('[number]', urlencode($phone), $config['sms_url']);
|
||||
$smsurl = str_replace('[text]', urlencode($txt), $smsurl);
|
||||
file_get_contents($smsurl);
|
||||
}
|
||||
}
|
||||
|
||||
function sendWhatsapp($phone, $txt)
|
||||
{
|
||||
global $config;
|
||||
run_hook('send_whatsapp'); #HOOK
|
||||
if (!empty($config['wa_url'])) {
|
||||
$waurl = str_replace('[number]', urlencode($phone), $config['wa_url']);
|
||||
$waurl = str_replace('[text]', urlencode($txt), $waurl);
|
||||
file_get_contents($waurl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function time_elapsed_string($datetime, $full = false)
|
||||
{
|
||||
$now = new DateTime;
|
||||
|
Reference in New Issue
Block a user