示例#1
0
 public function actionTest()
 {
     /*      $user_id = Yii::app()->user->id;
           var_dump(Yii::app()->user->isAdmin);
           //print_r(User::model()->findByPk($user_id));
           echo 'Places='.Place::model()->countUserPlaces($user_id);
           echo 'Blocks='.Place::model()->countOwnedBlocks($user_id);
           echo 'Estabs='.Place::model()->countOwnedEstablishments($user_id);
           yexit();*/
     $po = new Pushover();
     $po->setToken(Yii::app()->params['pushover']['key']);
     $po->setUser(getUserProfile(Yii::app()->user->id)->getAttribute('pushover_token'));
     $po->setDevice(getUserProfile(Yii::app()->user->id)->getAttribute('pushover_device'));
     $po->setTitle('Hey ' . getFirstName());
     $po->setMessage('Hello world! ' . time());
     $po->setUrl('http://jeffreifman.com/blog/');
     $po->setUrlTitle('cool blog');
     $po->setPriority(1);
     $po->setTimestamp(time());
     $po->setDebug(true);
     $go = $po->send();
     echo '<pre>';
     print_r($go);
     echo '</pre>';
 }
示例#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>';