當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ParseClient::_encode方法代碼示例

本文整理匯總了PHP中Parse\ParseClient::_encode方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParseClient::_encode方法的具體用法?PHP ParseClient::_encode怎麽用?PHP ParseClient::_encode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parse\ParseClient的用法示例。


在下文中一共展示了ParseClient::_encode方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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);
 }
開發者ID:vaibbhav,項目名稱:parse_php5.3_sdk,代碼行數:48,代碼來源:ParsePush.php

示例2: _encode

 /**
  * Returns an associative array encoding of the current operation.
  *
  * @return mixed
  */
 public function _encode()
 {
     if ($this->isAssociativeArray) {
         $object = new \stdClass();
         foreach ($this->value as $key => $value) {
             $object->{$key} = ParseClient::_encode($value, true);
         }
         return ParseClient::_encode($object, true);
     }
     return ParseClient::_encode($this->value, true);
 }
開發者ID:alex-z82,項目名稱:web-friend-smash,代碼行數:16,代碼來源:SetOperation.php

示例3: getSaveJSON

 /**
  * Returns JSON object of the unsaved operations.
  *
  * @return array
  */
 private function getSaveJSON()
 {
     $this->beforeSave();
     return ParseClient::_encode($this->operationSet, true);
 }
開發者ID:bohemima,項目名稱:parse-php-sdk,代碼行數:10,代碼來源:ParseObject.php

示例4: buildQueryString

 /**
  * Build query string from query constraints.
  *
  * @param array $queryOptions Associative array of the query constraints.
  *
  * @return string Query string.
  */
 private function buildQueryString($queryOptions)
 {
     if (isset($queryOptions['where'])) {
         $queryOptions['where'] = ParseClient::_encode($queryOptions['where'], true);
         $queryOptions['where'] = json_encode($queryOptions['where']);
     }
     return http_build_query($queryOptions);
 }
開發者ID:ParseServer,項目名稱:parse-php-sdk,代碼行數:15,代碼來源:ParseQuery.php

示例5: _encode

 /**
  * Returns an associative array encoding of this operation.
  *
  * @return array
  */
 public function _encode()
 {
     return array('__op' => 'AddUnique', 'objects' => ParseClient::_encode($this->objects, true));
 }
開發者ID:alex-z82,項目名稱:web-friend-smash,代碼行數:9,代碼來源:AddUniqueOperation.php

示例6: _encode

 /**
  * Returns associative array representing encoded operation.
  *
  * @return array
  */
 public function _encode()
 {
     return ['__op' => 'Remove', 'objects' => ParseClient::_encode($this->objects, true)];
 }
開發者ID:louk,項目名稱:One-Nice-Thing,代碼行數:9,代碼來源:RemoveOperation.php

示例7: _encode

 /**
  * Returns an associative array encoding of the current operation.
  *
  * @return mixed
  *
  * @throws \Exception
  */
 public function _encode()
 {
     $addRelation = array();
     $removeRelation = array();
     if (!empty($this->relationsToAdd)) {
         $addRelation = array('__op' => 'AddRelation', 'objects' => ParseClient::_encode(self::convertToOneDimensionalArray($this->relationsToAdd), true));
     }
     if (!empty($this->relationsToRemove)) {
         $removeRelation = array('__op' => 'RemoveRelation', 'objects' => ParseClient::_encode(self::convertToOneDimensionalArray($this->relationsToRemove), true));
     }
     if (!empty($addRelation) && !empty($removeRelation)) {
         return array('__op' => 'Batch', 'ops' => [$addRelation, $removeRelation]);
     }
     return empty($addRelation) ? $removeRelation : $addRelation;
 }
開發者ID:alex-z82,項目名稱:web-friend-smash,代碼行數:22,代碼來源:ParseRelationOperation.php

示例8: getSaveJSON

 /**
  * Returns JSON object of the unsaved operations.
  *
  * @return array
  */
 private function getSaveJSON()
 {
     $operationSet = $this->operationSet;
     if (!$operationSet) {
         // Parse REST API needs {} not [] for "body" request property
         $operationSet = new \stdClass();
     }
     return ParseClient::_encode($operationSet, true);
 }
開發者ID:xaratt,項目名稱:parse-php-sdk,代碼行數:14,代碼來源:ParseObject.php


注:本文中的Parse\ParseClient::_encode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。