From f6bfc10b900c9f12b115be53408eea1eebf7998c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Blon=C4=8F=C3=A1k?= Date: Mon, 4 Sep 2017 20:19:03 +0200 Subject: [PATCH] update - notifymyandroid.com - title from configuration --- .../push_notification/notifymyandroid.php | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/include/classes/push_notification/notifymyandroid.php b/include/classes/push_notification/notifymyandroid.php index 87f0b80e..923caad4 100644 --- a/include/classes/push_notification/notifymyandroid.php +++ b/include/classes/push_notification/notifymyandroid.php @@ -1,41 +1,42 @@ apiKey = $apikey; - } - - static $priorities = array( - 0 => 'info', - 2 => 'error', - ); - - public static function getName(){ - return "notifymyandroid.com"; - } - - public static function getParameters(){ - return array( - 'apikey' => 'API key', - ); - } - - public function notify($message, $severity = 'info', $event = null){ - curl_setopt_array($ch = curl_init(), array( - CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify", - CURLOPT_POST => true, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POSTFIELDS => http_build_query($data = array( - "apikey" => $this->apiKey, - "application" => "CryptoGlance", - "description" => $message, - "content-type" => "text/html", - "event" => $event, - "priority" => array_search($severity, self::$priorities), - )), - )); - curl_exec($ch); - curl_close($ch); - } - } \ No newline at end of file +class Notifications_NotifyMyAndroid implements IPushNotification { + + private $apiKey; + public function __construct($apikey){ + $this->apiKey = $apikey; + } + + static $priorities = array( + 0 => 'info', + 2 => 'error', + ); + + public static function getName(){ + return "notifymyandroid.com"; + } + + public static function getParameters(){ + return array( + 'apikey' => 'API key', + ); + } + + public function notify($message, $severity = 'info', $event = null){ + global $setting; + curl_setopt_array($ch = curl_init(), array( + CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify", + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_POSTFIELDS => http_build_query($data = array( + "apikey" => $this->apiKey, + "application" => $setting->getValue('website_title')?:"PHP-MPOS", + "description" => $message, + "content-type" => "text/html", + "event" => $event, + "priority" => array_search($severity, self::$priorities), + )), + )); + curl_exec($ch); + curl_close($ch); + } +} \ No newline at end of file