public static function getPersonalStreamCursor(Network $network, $user, $limit = 50, $date = null)
 {
     if (is_null($date)) {
         $date = time();
     }
     $resource = $network->getUrnForUser($user) . ":personalStream";
     return TimelineCursor::init($network, $resource, $limit, $date);
 }
 public static function getNetworkFromCore(Core $core)
 {
     if (get_class($core) == Network::getClassName()) {
         return $core;
     } elseif (get_class($core) == Site::getClassName()) {
         return $core->getNetwork();
     } else {
         return $core->getSite()->getNetwork();
     }
 }
 public static function removeSubscriptions(Network $network, $userToken, $topics)
 {
     $userId = JWT::decode($userToken, $network->getData()->getKey(), array(Core::ENCRYPTION))->user_id;
     $userUrn = $network->getUrnForUser($userId);
     $data = json_encode(array("delete" => self::buildSubscriptions($topics, $userUrn)));
     $url = self::getSubscriptionUrl($network, $userUrn);
     $response = Client::PATCH($url, self::getHeaders($network, $userToken), $data);
     $body = self::getDataFromResponse($response);
     if (!property_exists($body, "removed")) {
         return 0;
     }
     return self::getDataFromResponse($response)->{"removed"};
 }
示例#4
0
 public static function getNetwork($networkName, $networkKey)
 {
     return Network::init($networkName, $networkKey);
 }