Beispiel #1
0
 public function sendMessage($id_obj, $messageText, $messageTitle = '', $messageSubtitle = '', $ticker = '')
 {
     if (!($receiver = $this->storage->findReceiver($id_obj))) {
         throw new ReceiverNotFoundException("Receiver not found");
     }
     $tokens = $this->storage->getTokens($receiver['id']);
     foreach ($tokens as $token) {
         $message = MessengerFactory::create($token['platform']);
         Pusher::printR('Sending message "' . $messageText . '" to token "' . $token['push_token'] . '" on ' . $token['platform']);
         $message->send($token['push_token'], $messageText, $messageTitle, $messageSubtitle, $ticker);
         Pusher::printR($message);
     }
 }
Beispiel #2
0
<?php

use Avovello\Xphp\Facades\Pusher;
use Avovello\Xphp\Facades\Auth;
spl_autoload_register(function ($class) {
    $prefix = 'Avovello\\Xphp\\';
    $base_dir = __DIR__ . '/src/';
    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        return;
        //No Avovello\xphp prefix found, pass through to next autoloader
    }
    $relative_class = substr($class, $len);
    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
    if (file_exists($file)) {
        require $file;
    }
});
$dbConfig = (require_once __DIR__ . '/src/config/Database.php');
$pushTokens = [['device_id' => '123', 'platform' => 'ios', 'push_token' => 'asdfsdafsdf'], ['device_id' => '234', 'platform' => 'windows', 'push_token' => 'asdfsadf'], ['device_id' => '345', 'platform' => 'android', 'push_token' => 'asdfsadfsdf']];
$object = new Pusher($dbConfig);
$object->dropTables();
$object->createTables();
//$new_id_user = $object->addUser('user','*****@*****.**', 'test');
//$new_token = $object->login('user', 'test');
//$user = $object->checkToken('0b5de927-3304-4cd2-90b0-8a0ccb8e9b48');
Pusher::printR('-------');
Pusher::printR($object);
Beispiel #3
0
<?php

use Avovello\Xphp\Facades\Pusher;
use Avovello\Xphp\Facades\Auth;
spl_autoload_register(function ($class) {
    $prefix = 'Avovello\\Xphp\\';
    $base_dir = __DIR__ . '/src/';
    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        return;
        //No Avovello\xphp prefix found, pass through to next autoloader
    }
    $relative_class = substr($class, $len);
    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
    if (file_exists($file)) {
        require $file;
    }
});
$dbConfig = (require_once __DIR__ . '/src/config/Database.php');
$pushTokens = [['device_id' => '123', 'platform' => 'ios', 'push_token' => 'asdfsdafsdf'], ['device_id' => '234', 'platform' => 'windows', 'push_token' => 'asdfsadf'], ['device_id' => '345', 'platform' => 'android', 'push_token' => 'asdfsadfsdf']];
//$object = new Auth($dbConfig);
//$object->dropTables();
//$object->createTables();
//$new_id_user = $object->addUser('user','*****@*****.**', 'test');
//$new_token = $object->login('user', 'test');
//$user = $object->checkToken('0b5de927-3304-4cd2-90b0-8a0ccb8e9b48');
Pusher::printR('-------');
Pusher::printR($object);