本文整理汇总了PHP中Parse\ParseClient类的典型用法代码示例。如果您正苦于以下问题:PHP ParseClient类的具体用法?PHP ParseClient怎么用?PHP ParseClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParseClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initialize Push with needed Parse keys
*
* @param $appId
* @param $restKey
* @param $masterKey
*/
public function __construct($appId, $restKey, $masterKey)
{
$this->appId = $appId;
$this->restKey = $restKey;
$this->masterKey = $masterKey;
ParseClient::initialize($appId, $restKey, $masterKey);
}
示例2: setUp
public static function setUp()
{
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('UTC');
ParseClient::initialize('app-id-here', 'rest-api-key-here', 'master-key-here');
}
示例3: __construct
/**
* Construct our adapter by gleaning the keys from the ENV params.
* These can be set in the .env file, or set as environment vars on a production server.
*/
public function __construct()
{
$app_id = env('PARSE_APP_APID');
$rest_key = env('PARSE_APP_REST');
$master_key = env('PARSE_APP_MAST');
ParseClient::initialize($app_id, $rest_key, $master_key);
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->load->database();
// Init parse: app_id, rest_key, master_key
ParseClient::initialize($this->config->item('app_id'), $this->config->item('rest_key'), $this->config->item('master_key'));
}
示例5: onBootstrap
public function onBootstrap(MvcEvent $e)
{
//parse uses a global client, and needs the session to be started
$config = $e->getApplication()->getServiceManager()->get('config');
session_start();
ParseClient::initialize($config['parse']['app_id'], $config['parse']['rest_key'], $config['parse']['master_key']);
}
示例6: inicializa
/**
* Inicializa la aplicacion de la base de datos de Parse
*/
public static function inicializa()
{
try {
ParseClient::initialize('ve3SsAciKVt8GwhmLDCzW9rQ6EkPj8ai3pWcp3Is', 'zt0dVKAQwyRTAOFkfFj5d9jzDWAH9fjaJsUR5fhD', 'QpnJBJkOEp3VmEbcaAX8r6HDixj2wCUNQ42e1c4N');
} catch (ParseException $ex) {
}
}
示例7: send
/**
* Sends a push notification.
*
* @param array $data The data of the push notification. Valid fields
* are:
* channels - An Array of channels to push to.
* push_time - A Date object for when to send the push.
* expiration_time - A Date object for when to expire
* the push.
* expiration_interval - The seconds from now to expire the push.
* where - A ParseQuery over ParseInstallation that is used to match
* a set of installations to push to.
* data - The data to send as part of the push
* @param bool $useMasterKey Whether to use the Master Key for the request
*
* @throws \Exception, ParseException
*
* @return mixed
*/
public static function send($data, $useMasterKey = false)
{
if (isset($data['expiration_time']) && isset($data['expiration_interval'])) {
throw new Exception('Both expiration_time and expiration_interval can\'t be set.');
}
if (isset($data['where'])) {
if ($data['where'] instanceof ParseQuery) {
$where_options = $data['where']->_getOptions();
if (!isset($where_options['where'])) {
$data['where'] = '{}';
} else {
$dd = $data['where']->_getOptions();
$data['where'] = $dd['where'];
}
} else {
throw new Exception('Where parameter for Parse Push must be of type ParseQuery');
}
}
if (isset($data['push_time'])) {
//Local push date format is different from iso format generally used in Parse
//Schedule does not work if date format not correct
$data['push_time'] = ParseClient::getPushDateFormat($data['push_time'], isset($data['local_time']));
}
if (isset($data['expiration_time'])) {
$cc = ParseClient::_encode($data['expiration_time'], false);
$data['expiration_time'] = $cc['iso'];
}
return ParseClient::_request('POST', 'push', null, json_encode(ParseClient::_encode($data, true)), $useMasterKey);
}
示例8: setUpBeforeClass
public static function setUpBeforeClass()
{
ParseClient::_unsetStorage();
session_start();
ParseTestHelper::setUp();
self::$parseStorage = ParseClient::getStorage();
}
示例9: bootParseClient
private function bootParseClient()
{
$config = $this->app['config']->get('parse');
// Init the parse client
ParseClient::initialize($config['app_id'], $config['rest_key'], $config['master_key']);
ParseClient::setStorage(new ParseSessionStorage($this->app['session']));
}
示例10: __construct
public function __construct()
{
$app_id = "id";
$rest_key = "rest_key";
$master_key = "master_key";
ParseClient::initialize($app_id, $rest_key, $master_key);
}
示例11: setupParse
/**
* Setup parse.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
protected function setupParse(Application $app)
{
$app_id = env('PARSE_APP_ID');
$rest_key = env('PARSE_REST_KEY');
$master_key = env('PARSE_MASTER_KEY');
ParseClient::initialize($app_id, $rest_key, $master_key);
}
示例12: setUp
public static function setUp()
{
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('UTC');
ParseClient::initialize('app-id-here', 'rest-api-key-here', 'master-key-here', true, 'account-key-here');
ParseClient::setServerURL('http://localhost:1337/parse');
}
示例13: email
public static function email($type, $email, $title = "")
{
ParseClient::initialize(self::$app_id, self::$rest_key, self::$master_key);
$alert = ["Nuevas validaciones disponibles", "Tiene un nuevo evento disponible", "Nuevas encuestas disponibles", "Tiene un nuevo mensaje"];
$query = ParseInstallation::query();
$query->equalTo("email", $email);
ParsePush::send(array("where" => $query, "data" => array("title" => "VaClases", "alert" => ($title ? $title . " - " : "") . $alert[$type])));
}
示例14: getCurrentSession
/**
* Retrieves the Session object for the currently logged in user.
*
* @param boolean $useMasterKey If the Master Key should be used to override security.
*
* @return ParseSession
*/
public static function getCurrentSession($useMasterKey = false)
{
$token = ParseUser::getCurrentUser()->getSessionToken();
$response = ParseClient::_request('GET', '/1/sessions/me', $token, null, $useMasterKey);
$session = new ParseSession();
$session->_mergeAfterFetch($response);
$session->handleSaveResult();
return $session;
}
示例15: connect_to_db
public function connect_to_db()
{
//almacenamos en variables los datos obtenidos desde la clase Config
$app_id = Config::appId;
$rest_key = Config::restKey;
$master_key = Config::masterKey;
//establecemos la conexión a la DB
$connection = ParseClient::initialize($app_id, $rest_key, $master_key);
}