Пример #1
0
 /**
  * send push notifications. Currently only pushover.net is supported
  *
  */
 public static function send($subject, $url)
 {
     $app_key = \OCP\Config::getSystemValue('pushnotifications_pushover_app', '');
     $pushid = trim(\OCP\Config::getUserValue(\OCP\User::getUser(), 'pushnotifications', 'pushid', ''));
     if (!empty($pushid)) {
         $push = new \Pushover();
         $push->setToken($app_key);
         $push->setUser($pushid);
         $push->setMessage($subject);
         $push->setUrl($url);
         $push->setUrlTitle('ownCloud');
         $push->setCallback($url);
         $push->setTimestamp(time());
         $push->setDebug(true);
         $go = $push->send();
         unset($push);
     }
 }
Пример #2
0
<?php

/**
 * @author Chris Schalenborgh <*****@*****.**>
 * @version 0.1
 */
include 'Pushover.php';
$push = new Pushover();
$push->setToken('app token goes here');
$push->setUser('user token goes here');
$push->setTitle('Hey Chris');
$push->setMessage('Hello world! ' . time());
$push->setUrl('http://chris.schalenborgh.be/blog/');
$push->setUrlTitle('cool php blog');
$push->setDevice('iPhone');
$push->setPriority(2);
$push->setRetry(60);
//Used with Priority = 2; Pushover will resend the notification every 60 seconds until the user accepts.
$push->setExpire(3600);
//Used with Priority = 2; Pushover will resend the notification every 60 seconds for 3600 seconds. After that point, it stops sending notifications.
$push->setCallback('http://chris.schalenborgh.be/');
$push->setTimestamp(time());
$push->setDebug(true);
$push->setSound('bike');
$go = $push->send();
echo '<pre>';
print_r($go);
echo '</pre>';