11<?php
2- class Notifications_NotifyMyAndroid implements IPushNotification {
3-
4- private $ apiKey ;
5- public function __construct ($ apikey ){
6- $ this ->apiKey = $ apikey ;
7- }
8-
9- static $ priorities = array (
10- 0 => 'info ' ,
11- 2 => 'error ' ,
12- );
13-
14- public static function getName (){
15- return "notifymyandroid.com " ;
16- }
17-
18- public static function getParameters (){
19- return array (
20- 'apikey ' => 'API key ' ,
21- );
22- }
23-
24- public function notify ($ message , $ severity = 'info ' , $ event = null ){
25- curl_setopt_array ($ ch = curl_init (), array (
26- CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify " ,
27- CURLOPT_POST => true ,
28- CURLOPT_RETURNTRANSFER => true ,
29- CURLOPT_POSTFIELDS => http_build_query ($ data = array (
30- "apikey " => $ this ->apiKey ,
31- "application " => "CryptoGlance " ,
32- "description " => $ message ,
33- "content-type " => "text/html " ,
34- "event " => $ event ,
35- "priority " => array_search ($ severity , self ::$ priorities ),
36- )),
37- ));
38- curl_exec ($ ch );
39- curl_close ($ ch );
40- }
41- }
2+ class Notifications_NotifyMyAndroid implements IPushNotification {
3+
4+ private $ apiKey ;
5+ public function __construct ($ apikey ){
6+ $ this ->apiKey = $ apikey ;
7+ }
8+
9+ static $ priorities = array (
10+ 0 => 'info ' ,
11+ 2 => 'error ' ,
12+ );
13+
14+ public static function getName (){
15+ return "notifymyandroid.com " ;
16+ }
17+
18+ public static function getParameters (){
19+ return array (
20+ 'apikey ' => 'API key ' ,
21+ );
22+ }
23+
24+ public function notify ($ message , $ severity = 'info ' , $ event = null ){
25+ global $ setting ;
26+ curl_setopt_array ($ ch = curl_init (), array (
27+ CURLOPT_URL => "https://www.notifymyandroid.com/publicapi/notify " ,
28+ CURLOPT_POST => true ,
29+ CURLOPT_RETURNTRANSFER => true ,
30+ CURLOPT_POSTFIELDS => http_build_query ($ data = array (
31+ "apikey " => $ this ->apiKey ,
32+ "application " => $ setting ->getValue ('website_title ' )?:"PHP-MPOS " ,
33+ "description " => $ message ,
34+ "content-type " => "text/html " ,
35+ "event " => $ event ,
36+ "priority " => array_search ($ severity , self ::$ priorities ),
37+ )),
38+ ));
39+ curl_exec ($ ch );
40+ curl_close ($ ch );
41+ }
42+ }
0 commit comments