From f51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0 Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Fri, 8 Mar 2019 21:20:34 +0100 Subject: további rendrakás --- .../include/share/facebook/GraphNodes/Birthday.php | 85 ----- .../share/facebook/GraphNodes/Collection.php | 242 ------------- .../share/facebook/GraphNodes/GraphAchievement.php | 112 ------ .../share/facebook/GraphNodes/GraphAlbum.php | 183 ---------- .../share/facebook/GraphNodes/GraphApplication.php | 43 --- .../share/facebook/GraphNodes/GraphCoverPhoto.php | 72 ---- .../share/facebook/GraphNodes/GraphEdge.php | 252 ------------- .../share/facebook/GraphNodes/GraphEvent.php | 242 ------------- .../share/facebook/GraphNodes/GraphGroup.php | 170 --------- .../share/facebook/GraphNodes/GraphList.php | 36 -- .../share/facebook/GraphNodes/GraphLocation.php | 102 ------ .../share/facebook/GraphNodes/GraphNode.php | 198 ----------- .../share/facebook/GraphNodes/GraphNodeFactory.php | 392 --------------------- .../share/facebook/GraphNodes/GraphObject.php | 36 -- .../facebook/GraphNodes/GraphObjectFactory.php | 88 ----- .../share/facebook/GraphNodes/GraphPage.php | 157 --------- .../share/facebook/GraphNodes/GraphPicture.php | 72 ---- .../share/facebook/GraphNodes/GraphSessionInfo.php | 102 ------ .../share/facebook/GraphNodes/GraphUser.php | 172 --------- 19 files changed, 2756 deletions(-) delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/Birthday.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/Collection.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphAchievement.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphAlbum.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphApplication.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphCoverPhoto.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphEdge.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphEvent.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphGroup.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphList.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphLocation.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphNodeFactory.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphObject.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphObjectFactory.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphPicture.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphSessionInfo.php delete mode 100644 mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php (limited to 'mayor-orig/www/include/share/facebook/GraphNodes') diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/Birthday.php b/mayor-orig/www/include/share/facebook/GraphNodes/Birthday.php deleted file mode 100644 index 4338b65e..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/Birthday.php +++ /dev/null @@ -1,85 +0,0 @@ -hasYear = count($parts) === 3 || count($parts) === 1; - $this->hasDate = count($parts) === 3 || count($parts) === 2; - - parent::__construct($date); - } - - /** - * Returns whether date object contains birth day and month - * - * @return bool - */ - public function hasDate() - { - return $this->hasDate; - } - - /** - * Returns whether date object contains birth year - * - * @return bool - */ - public function hasYear() - { - return $this->hasYear; - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/Collection.php b/mayor-orig/www/include/share/facebook/GraphNodes/Collection.php deleted file mode 100644 index 424b7cf3..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/Collection.php +++ /dev/null @@ -1,242 +0,0 @@ -items = $items; - } - - /** - * Gets the value of a field from the Graph node. - * - * @param string $name The field to retrieve. - * @param mixed $default The default to return if the field doesn't exist. - * - * @return mixed - */ - public function getField($name, $default = null) - { - if (isset($this->items[$name])) { - return $this->items[$name]; - } - - return $default; - } - - /** - * Gets the value of the named property for this graph object. - * - * @param string $name The property to retrieve. - * @param mixed $default The default to return if the property doesn't exist. - * - * @return mixed - * - * @deprecated 5.0.0 getProperty() has been renamed to getField() - * @todo v6: Remove this method - */ - public function getProperty($name, $default = null) - { - return $this->getField($name, $default); - } - - /** - * Returns a list of all fields set on the object. - * - * @return array - */ - public function getFieldNames() - { - return array_keys($this->items); - } - - /** - * Returns a list of all properties set on the object. - * - * @return array - * - * @deprecated 5.0.0 getPropertyNames() has been renamed to getFieldNames() - * @todo v6: Remove this method - */ - public function getPropertyNames() - { - return $this->getFieldNames(); - } - - /** - * Get all of the items in the collection. - * - * @return array - */ - public function all() - { - return $this->items; - } - - /** - * Get the collection of items as a plain array. - * - * @return array - */ - public function asArray() - { - return array_map(function ($value) { - return $value instanceof Collection ? $value->asArray() : $value; - }, $this->items); - } - - /** - * Run a map over each of the items. - * - * @param \Closure $callback - * - * @return static - */ - public function map(\Closure $callback) - { - return new static(array_map($callback, $this->items, array_keys($this->items))); - } - - /** - * Get the collection of items as JSON. - * - * @param int $options - * - * @return string - */ - public function asJson($options = 0) - { - return json_encode($this->asArray(), $options); - } - - /** - * Count the number of items in the collection. - * - * @return int - */ - public function count() - { - return count($this->items); - } - - /** - * Get an iterator for the items. - * - * @return ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->items); - } - - /** - * Determine if an item exists at an offset. - * - * @param mixed $key - * - * @return bool - */ - public function offsetExists($key) - { - return array_key_exists($key, $this->items); - } - - /** - * Get an item at a given offset. - * - * @param mixed $key - * - * @return mixed - */ - public function offsetGet($key) - { - return $this->items[$key]; - } - - /** - * Set the item at a given offset. - * - * @param mixed $key - * @param mixed $value - * - * @return void - */ - public function offsetSet($key, $value) - { - if (is_null($key)) { - $this->items[] = $value; - } else { - $this->items[$key] = $value; - } - } - - /** - * Unset the item at a given offset. - * - * @param string $key - * - * @return void - */ - public function offsetUnset($key) - { - unset($this->items[$key]); - } - - /** - * Convert the collection to its string representation. - * - * @return string - */ - public function __toString() - { - return $this->asJson(); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphAchievement.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphAchievement.php deleted file mode 100644 index 31508ee4..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphAchievement.php +++ /dev/null @@ -1,112 +0,0 @@ - '\Facebook\GraphNodes\GraphUser', - 'application' => '\Facebook\GraphNodes\GraphApplication', - ]; - - /** - * Returns the ID for the achievement. - * - * @return string|null - */ - public function getId() - { - return $this->getField('id'); - } - - /** - * Returns the user who achieved this. - * - * @return GraphUser|null - */ - public function getFrom() - { - return $this->getField('from'); - } - - /** - * Returns the time at which this was achieved. - * - * @return \DateTime|null - */ - public function getPublishTime() - { - return $this->getField('publish_time'); - } - - /** - * Returns the app in which the user achieved this. - * - * @return GraphApplication|null - */ - public function getApplication() - { - return $this->getField('application'); - } - - /** - * Returns information about the achievement type this instance is connected with. - * - * @return array|null - */ - public function getData() - { - return $this->getField('data'); - } - - /** - * Returns the type of achievement. - * - * @see https://developers.facebook.com/docs/graph-api/reference/achievement - * - * @return string - */ - public function getType() - { - return 'game.achievement'; - } - - /** - * Indicates whether gaining the achievement published a feed story for the user. - * - * @return boolean|null - */ - public function isNoFeedStory() - { - return $this->getField('no_feed_story'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphAlbum.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphAlbum.php deleted file mode 100644 index 52f19b51..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphAlbum.php +++ /dev/null @@ -1,183 +0,0 @@ - '\Facebook\GraphNodes\GraphUser', - 'place' => '\Facebook\GraphNodes\GraphPage', - ]; - - /** - * Returns the ID for the album. - * - * @return string|null - */ - public function getId() - { - return $this->getField('id'); - } - - /** - * Returns whether the viewer can upload photos to this album. - * - * @return boolean|null - */ - public function getCanUpload() - { - return $this->getField('can_upload'); - } - - /** - * Returns the number of photos in this album. - * - * @return int|null - */ - public function getCount() - { - return $this->getField('count'); - } - - /** - * Returns the ID of the album's cover photo. - * - * @return string|null - */ - public function getCoverPhoto() - { - return $this->getField('cover_photo'); - } - - /** - * Returns the time the album was initially created. - * - * @return \DateTime|null - */ - public function getCreatedTime() - { - return $this->getField('created_time'); - } - - /** - * Returns the time the album was updated. - * - * @return \DateTime|null - */ - public function getUpdatedTime() - { - return $this->getField('updated_time'); - } - - /** - * Returns the description of the album. - * - * @return string|null - */ - public function getDescription() - { - return $this->getField('description'); - } - - /** - * Returns profile that created the album. - * - * @return GraphUser|null - */ - public function getFrom() - { - return $this->getField('from'); - } - - /** - * Returns profile that created the album. - * - * @return GraphPage|null - */ - public function getPlace() - { - return $this->getField('place'); - } - - /** - * Returns a link to this album on Facebook. - * - * @return string|null - */ - public function getLink() - { - return $this->getField('link'); - } - - /** - * Returns the textual location of the album. - * - * @return string|null - */ - public function getLocation() - { - return $this->getField('location'); - } - - /** - * Returns the title of the album. - * - * @return string|null - */ - public function getName() - { - return $this->getField('name'); - } - - /** - * Returns the privacy settings for the album. - * - * @return string|null - */ - public function getPrivacy() - { - return $this->getField('privacy'); - } - - /** - * Returns the type of the album. - * - * enum{ profile, mobile, wall, normal, album } - * - * @return string|null - */ - public function getType() - { - return $this->getField('type'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphApplication.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphApplication.php deleted file mode 100644 index aa07c825..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphApplication.php +++ /dev/null @@ -1,43 +0,0 @@ -getField('id'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphCoverPhoto.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphCoverPhoto.php deleted file mode 100644 index 824275bb..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphCoverPhoto.php +++ /dev/null @@ -1,72 +0,0 @@ -getField('id'); - } - - /** - * Returns the source of cover if it exists - * - * @return string|null - */ - public function getSource() - { - return $this->getField('source'); - } - - /** - * Returns the offset_x of cover if it exists - * - * @return int|null - */ - public function getOffsetX() - { - return $this->getField('offset_x'); - } - - /** - * Returns the offset_y of cover if it exists - * - * @return int|null - */ - public function getOffsetY() - { - return $this->getField('offset_y'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphEdge.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphEdge.php deleted file mode 100644 index f6f4970c..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphEdge.php +++ /dev/null @@ -1,252 +0,0 @@ -request = $request; - $this->metaData = $metaData; - $this->parentEdgeEndpoint = $parentEdgeEndpoint; - $this->subclassName = $subclassName; - - parent::__construct($data); - } - - /** - * Gets the parent Graph edge endpoint that generated the list. - * - * @return string|null - */ - public function getParentGraphEdge() - { - return $this->parentEdgeEndpoint; - } - - /** - * Gets the subclass name that the child GraphNode's are cast as. - * - * @return string|null - */ - public function getSubClassName() - { - return $this->subclassName; - } - - /** - * Returns the raw meta data associated with this GraphEdge. - * - * @return array - */ - public function getMetaData() - { - return $this->metaData; - } - - /** - * Returns the next cursor if it exists. - * - * @return string|null - */ - public function getNextCursor() - { - return $this->getCursor('after'); - } - - /** - * Returns the previous cursor if it exists. - * - * @return string|null - */ - public function getPreviousCursor() - { - return $this->getCursor('before'); - } - - /** - * Returns the cursor for a specific direction if it exists. - * - * @param string $direction The direction of the page: after|before - * - * @return string|null - */ - public function getCursor($direction) - { - if (isset($this->metaData['paging']['cursors'][$direction])) { - return $this->metaData['paging']['cursors'][$direction]; - } - - return null; - } - - /** - * Generates a pagination URL based on a cursor. - * - * @param string $direction The direction of the page: next|previous - * - * @return string|null - * - * @throws FacebookSDKException - */ - public function getPaginationUrl($direction) - { - $this->validateForPagination(); - - // Do we have a paging URL? - if (!isset($this->metaData['paging'][$direction])) { - return null; - } - - $pageUrl = $this->metaData['paging'][$direction]; - - return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl); - } - - /** - * Validates whether or not we can paginate on this request. - * - * @throws FacebookSDKException - */ - public function validateForPagination() - { - if ($this->request->getMethod() !== 'GET') { - throw new FacebookSDKException('You can only paginate on a GET request.', 720); - } - } - - /** - * Gets the request object needed to make a next|previous page request. - * - * @param string $direction The direction of the page: next|previous - * - * @return FacebookRequest|null - * - * @throws FacebookSDKException - */ - public function getPaginationRequest($direction) - { - $pageUrl = $this->getPaginationUrl($direction); - if (!$pageUrl) { - return null; - } - - $newRequest = clone $this->request; - $newRequest->setEndpoint($pageUrl); - - return $newRequest; - } - - /** - * Gets the request object needed to make a "next" page request. - * - * @return FacebookRequest|null - * - * @throws FacebookSDKException - */ - public function getNextPageRequest() - { - return $this->getPaginationRequest('next'); - } - - /** - * Gets the request object needed to make a "previous" page request. - * - * @return FacebookRequest|null - * - * @throws FacebookSDKException - */ - public function getPreviousPageRequest() - { - return $this->getPaginationRequest('previous'); - } - - /** - * The total number of results according to Graph if it exists. - * - * This will be returned if the summary=true modifier is present in the request. - * - * @return int|null - */ - public function getTotalCount() - { - if (isset($this->metaData['summary']['total_count'])) { - return $this->metaData['summary']['total_count']; - } - - return null; - } - - /** - * @inheritDoc - */ - public function map(\Closure $callback) - { - return new static( - $this->request, - array_map($callback, $this->items, array_keys($this->items)), - $this->metaData, - $this->parentEdgeEndpoint, - $this->subclassName - ); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphEvent.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphEvent.php deleted file mode 100644 index a470d89f..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphEvent.php +++ /dev/null @@ -1,242 +0,0 @@ - '\Facebook\GraphNodes\GraphCoverPhoto', - 'place' => '\Facebook\GraphNodes\GraphPage', - 'picture' => '\Facebook\GraphNodes\GraphPicture', - 'parent_group' => '\Facebook\GraphNodes\GraphGroup', - ]; - - /** - * Returns the `id` (The event ID) as string if present. - * - * @return string|null - */ - public function getId() - { - return $this->getField('id'); - } - - /** - * Returns the `cover` (Cover picture) as GraphCoverPhoto if present. - * - * @return GraphCoverPhoto|null - */ - public function getCover() - { - return $this->getField('cover'); - } - - /** - * Returns the `description` (Long-form description) as string if present. - * - * @return string|null - */ - public function getDescription() - { - return $this->getField('description'); - } - - /** - * Returns the `end_time` (End time, if one has been set) as DateTime if present. - * - * @return \DateTime|null - */ - public function getEndTime() - { - return $this->getField('end_time'); - } - - /** - * Returns the `is_date_only` (Whether the event only has a date specified, but no time) as bool if present. - * - * @return bool|null - */ - public function getIsDateOnly() - { - return $this->getField('is_date_only'); - } - - /** - * Returns the `name` (Event name) as string if present. - * - * @return string|null - */ - public function getName() - { - return $this->getField('name'); - } - - /** - * Returns the `owner` (The profile that created the event) as GraphNode if present. - * - * @return GraphNode|null - */ - public function getOwner() - { - return $this->getField('owner'); - } - - /** - * Returns the `parent_group` (The group the event belongs to) as GraphGroup if present. - * - * @return GraphGroup|null - */ - public function getParentGroup() - { - return $this->getField('parent_group'); - } - - /** - * Returns the `place` (Event Place information) as GraphPage if present. - * - * @return GraphPage|null - */ - public function getPlace() - { - return $this->getField('place'); - } - - /** - * Returns the `privacy` (Who can see the event) as string if present. - * - * @return string|null - */ - public function getPrivacy() - { - return $this->getField('privacy'); - } - - /** - * Returns the `start_time` (Start time) as DateTime if present. - * - * @return \DateTime|null - */ - public function getStartTime() - { - return $this->getField('start_time'); - } - - /** - * Returns the `ticket_uri` (The link users can visit to buy a ticket to this event) as string if present. - * - * @return string|null - */ - public function getTicketUri() - { - return $this->getField('ticket_uri'); - } - - /** - * Returns the `timezone` (Timezone) as string if present. - * - * @return string|null - */ - public function getTimezone() - { - return $this->getField('timezone'); - } - - /** - * Returns the `updated_time` (Last update time) as DateTime if present. - * - * @return \DateTime|null - */ - public function getUpdatedTime() - { - return $this->getField('updated_time'); - } - - /** - * Returns the `picture` (Event picture) as GraphPicture if present. - * - * @return GraphPicture|null - */ - public function getPicture() - { - return $this->getField('picture'); - } - - /** - * Returns the `attending_count` (Number of people attending the event) as int if present. - * - * @return int|null - */ - public function getAttendingCount() - { - return $this->getField('attending_count'); - } - - /** - * Returns the `declined_count` (Number of people who declined the event) as int if present. - * - * @return int|null - */ - public function getDeclinedCount() - { - return $this->getField('declined_count'); - } - - /** - * Returns the `maybe_count` (Number of people who maybe going to the event) as int if present. - * - * @return int|null - */ - public function getMaybeCount() - { - return $this->getField('maybe_count'); - } - - /** - * Returns the `noreply_count` (Number of people who did not reply to the event) as int if present. - * - * @return int|null - */ - public function getNoreplyCount() - { - return $this->getField('noreply_count'); - } - - /** - * Returns the `invited_count` (Number of people invited to the event) as int if present. - * - * @return int|null - */ - public function getInvitedCount() - { - return $this->getField('invited_count'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphGroup.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphGroup.php deleted file mode 100644 index 6217bd4d..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphGroup.php +++ /dev/null @@ -1,170 +0,0 @@ - '\Facebook\GraphNodes\GraphCoverPhoto', - 'venue' => '\Facebook\GraphNodes\GraphLocation', - ]; - - /** - * Returns the `id` (The Group ID) as string if present. - * - * @return string|null - */ - public function getId() - { - return $this->getField('id'); - } - - /** - * Returns the `cover` (The cover photo of the Group) as GraphCoverPhoto if present. - * - * @return GraphCoverPhoto|null - */ - public function getCover() - { - return $this->getField('cover'); - } - - /** - * Returns the `description` (A brief description of the Group) as string if present. - * - * @return string|null - */ - public function getDescription() - { - return $this->getField('description'); - } - - /** - * Returns the `email` (The email address to upload content to the Group. Only current members of the Group can use this) as string if present. - * - * @return string|null - */ - public function getEmail() - { - return $this->getField('email'); - } - - /** - * Returns the `icon` (The URL for the Group's icon) as string if present. - * - * @return string|null - */ - public function getIcon() - { - return $this->getField('icon'); - } - - /** - * Returns the `link` (The Group's website) as string if present. - * - * @return string|null - */ - public function getLink() - { - return $this->getField('link'); - } - - /** - * Returns the `name` (The name of the Group) as string if present. - * - * @return string|null - */ - public function getName() - { - return $this->getField('name'); - } - - /** - * Returns the `member_request_count` (Number of people asking to join the group.) as int if present. - * - * @return int|null - */ - public function getMemberRequestCount() - { - return $this->getField('member_request_count'); - } - - /** - * Returns the `owner` (The profile that created this Group) as GraphNode if present. - * - * @return GraphNode|null - */ - public function getOwner() - { - return $this->getField('owner'); - } - - /** - * Returns the `parent` (The parent Group of this Group, if it exists) as GraphNode if present. - * - * @return GraphNode|null - */ - public function getParent() - { - return $this->getField('parent'); - } - - /** - * Returns the `privacy` (The privacy setting of the Group) as string if present. - * - * @return string|null - */ - public function getPrivacy() - { - return $this->getField('privacy'); - } - - /** - * Returns the `updated_time` (The last time the Group was updated (this includes changes in the Group's properties and changes in posts and comments if user can see them)) as \DateTime if present. - * - * @return \DateTime|null - */ - public function getUpdatedTime() - { - return $this->getField('updated_time'); - } - - /** - * Returns the `venue` (The location for the Group) as GraphLocation if present. - * - * @return GraphLocation|null - */ - public function getVenue() - { - return $this->getField('venue'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphList.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphList.php deleted file mode 100644 index 3dfbd497..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphList.php +++ /dev/null @@ -1,36 +0,0 @@ -getField('street'); - } - - /** - * Returns the city component of the location - * - * @return string|null - */ - public function getCity() - { - return $this->getField('city'); - } - - /** - * Returns the state component of the location - * - * @return string|null - */ - public function getState() - { - return $this->getField('state'); - } - - /** - * Returns the country component of the location - * - * @return string|null - */ - public function getCountry() - { - return $this->getField('country'); - } - - /** - * Returns the zipcode component of the location - * - * @return string|null - */ - public function getZip() - { - return $this->getField('zip'); - } - - /** - * Returns the latitude component of the location - * - * @return float|null - */ - public function getLatitude() - { - return $this->getField('latitude'); - } - - /** - * Returns the street component of the location - * - * @return float|null - */ - public function getLongitude() - { - return $this->getField('longitude'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php deleted file mode 100644 index a81c47b7..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php +++ /dev/null @@ -1,198 +0,0 @@ -castItems($data)); - } - - /** - * Iterates over an array and detects the types each node - * should be cast to and returns all the items as an array. - * - * @TODO Add auto-casting to AccessToken entities. - * - * @param array $data The array to iterate over. - * - * @return array - */ - public function castItems(array $data) - { - $items = []; - - foreach ($data as $k => $v) { - if ($this->shouldCastAsDateTime($k) - && (is_numeric($v) - || $this->isIso8601DateString($v)) - ) { - $items[$k] = $this->castToDateTime($v); - } elseif ($k === 'birthday') { - $items[$k] = $this->castToBirthday($v); - } else { - $items[$k] = $v; - } - } - - return $items; - } - - /** - * Uncasts any auto-casted datatypes. - * Basically the reverse of castItems(). - * - * @return array - */ - public function uncastItems() - { - $items = $this->asArray(); - - return array_map(function ($v) { - if ($v instanceof \DateTime) { - return $v->format(\DateTime::ISO8601); - } - - return $v; - }, $items); - } - - /** - * Get the collection of items as JSON. - * - * @param int $options - * - * @return string - */ - public function asJson($options = 0) - { - return json_encode($this->uncastItems(), $options); - } - - /** - * Detects an ISO 8601 formatted string. - * - * @param string $string - * - * @return boolean - * - * @see https://developers.facebook.com/docs/graph-api/using-graph-api/#readmodifiers - * @see http://www.cl.cam.ac.uk/~mgk25/iso-time.html - * @see http://en.wikipedia.org/wiki/ISO_8601 - */ - public function isIso8601DateString($string) - { - // This insane regex was yoinked from here: - // http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/ - // ...and I'm all like: - // http://thecodinglove.com/post/95378251969/when-code-works-and-i-dont-know-why - $crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))' - . '((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?' - . '|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d' - . '|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])' - . '((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d' - . '([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/'; - - return preg_match($crazyInsaneRegexThatSomehowDetectsIso8601, $string) === 1; - } - - /** - * Determines if a value from Graph should be cast to DateTime. - * - * @param string $key - * - * @return boolean - */ - public function shouldCastAsDateTime($key) - { - return in_array($key, [ - 'created_time', - 'updated_time', - 'start_time', - 'end_time', - 'backdated_time', - 'issued_at', - 'expires_at', - 'publish_time', - 'joined' - ], true); - } - - /** - * Casts a date value from Graph to DateTime. - * - * @param int|string $value - * - * @return \DateTime - */ - public function castToDateTime($value) - { - if (is_int($value)) { - $dt = new \DateTime(); - $dt->setTimestamp($value); - } else { - $dt = new \DateTime($value); - } - - return $dt; - } - - /** - * Casts a birthday value from Graph to Birthday - * - * @param string $value - * - * @return Birthday - */ - public function castToBirthday($value) - { - return new Birthday($value); - } - - /** - * Getter for $graphObjectMap. - * - * @return array - */ - public static function getObjectMap() - { - return static::$graphObjectMap; - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphNodeFactory.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphNodeFactory.php deleted file mode 100644 index 6a370919..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphNodeFactory.php +++ /dev/null @@ -1,392 +0,0 @@ -response = $response; - $this->decodedBody = $response->getDecodedBody(); - } - - /** - * Tries to convert a FacebookResponse entity into a GraphNode. - * - * @param string|null $subclassName The GraphNode sub class to cast to. - * - * @return GraphNode - * - * @throws FacebookSDKException - */ - public function makeGraphNode($subclassName = null) - { - $this->validateResponseAsArray(); - $this->validateResponseCastableAsGraphNode(); - - return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName); - } - - /** - * Convenience method for creating a GraphAchievement collection. - * - * @return GraphAchievement - * - * @throws FacebookSDKException - */ - public function makeGraphAchievement() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement'); - } - - /** - * Convenience method for creating a GraphAlbum collection. - * - * @return GraphAlbum - * - * @throws FacebookSDKException - */ - public function makeGraphAlbum() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum'); - } - - /** - * Convenience method for creating a GraphPage collection. - * - * @return GraphPage - * - * @throws FacebookSDKException - */ - public function makeGraphPage() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage'); - } - - /** - * Convenience method for creating a GraphSessionInfo collection. - * - * @return GraphSessionInfo - * - * @throws FacebookSDKException - */ - public function makeGraphSessionInfo() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo'); - } - - /** - * Convenience method for creating a GraphUser collection. - * - * @return GraphUser - * - * @throws FacebookSDKException - */ - public function makeGraphUser() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser'); - } - - /** - * Convenience method for creating a GraphEvent collection. - * - * @return GraphEvent - * - * @throws FacebookSDKException - */ - public function makeGraphEvent() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent'); - } - - /** - * Convenience method for creating a GraphGroup collection. - * - * @return GraphGroup - * - * @throws FacebookSDKException - */ - public function makeGraphGroup() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup'); - } - - /** - * Tries to convert a FacebookResponse entity into a GraphEdge. - * - * @param string|null $subclassName The GraphNode sub class to cast the list items to. - * @param boolean $auto_prefix Toggle to auto-prefix the subclass name. - * - * @return GraphEdge - * - * @throws FacebookSDKException - */ - public function makeGraphEdge($subclassName = null, $auto_prefix = true) - { - $this->validateResponseAsArray(); - $this->validateResponseCastableAsGraphEdge(); - - if ($subclassName && $auto_prefix) { - $subclassName = static::BASE_GRAPH_OBJECT_PREFIX . $subclassName; - } - - return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName); - } - - /** - * Validates the decoded body. - * - * @throws FacebookSDKException - */ - public function validateResponseAsArray() - { - if (!is_array($this->decodedBody)) { - throw new FacebookSDKException('Unable to get response from Graph as array.', 620); - } - } - - /** - * Validates that the return data can be cast as a GraphNode. - * - * @throws FacebookSDKException - */ - public function validateResponseCastableAsGraphNode() - { - if (isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data'])) { - throw new FacebookSDKException( - 'Unable to convert response from Graph to a GraphNode because the response looks like a GraphEdge. Try using GraphNodeFactory::makeGraphEdge() instead.', - 620 - ); - } - } - - /** - * Validates that the return data can be cast as a GraphEdge. - * - * @throws FacebookSDKException - */ - public function validateResponseCastableAsGraphEdge() - { - if (!(isset($this->decodedBody['data']) && static::isCastableAsGraphEdge($this->decodedBody['data']))) { - throw new FacebookSDKException( - 'Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.', - 620 - ); - } - } - - /** - * Safely instantiates a GraphNode of $subclassName. - * - * @param array $data The array of data to iterate over. - * @param string|null $subclassName The subclass to cast this collection to. - * - * @return GraphNode - * - * @throws FacebookSDKException - */ - public function safelyMakeGraphNode(array $data, $subclassName = null) - { - $subclassName = $subclassName ?: static::BASE_GRAPH_NODE_CLASS; - static::validateSubclass($subclassName); - - // Remember the parent node ID - $parentNodeId = isset($data['id']) ? $data['id'] : null; - - $items = []; - - foreach ($data as $k => $v) { - // Array means could be recurable - if (is_array($v)) { - // Detect any smart-casting from the $graphObjectMap array. - // This is always empty on the GraphNode collection, but subclasses can define - // their own array of smart-casting types. - $graphObjectMap = $subclassName::getObjectMap(); - $objectSubClass = isset($graphObjectMap[$k]) - ? $graphObjectMap[$k] - : null; - - // Could be a GraphEdge or GraphNode - $items[$k] = $this->castAsGraphNodeOrGraphEdge($v, $objectSubClass, $k, $parentNodeId); - } else { - $items[$k] = $v; - } - } - - return new $subclassName($items); - } - - /** - * Takes an array of values and determines how to cast each node. - * - * @param array $data The array of data to iterate over. - * @param string|null $subclassName The subclass to cast this collection to. - * @param string|null $parentKey The key of this data (Graph edge). - * @param string|null $parentNodeId The parent Graph node ID. - * - * @return GraphNode|GraphEdge - * - * @throws FacebookSDKException - */ - public function castAsGraphNodeOrGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null) - { - if (isset($data['data'])) { - // Create GraphEdge - if (static::isCastableAsGraphEdge($data['data'])) { - return $this->safelyMakeGraphEdge($data, $subclassName, $parentKey, $parentNodeId); - } - // Sometimes Graph is a weirdo and returns a GraphNode under the "data" key - $data = $data['data']; - } - - // Create GraphNode - return $this->safelyMakeGraphNode($data, $subclassName); - } - - /** - * Return an array of GraphNode's. - * - * @param array $data The array of data to iterate over. - * @param string|null $subclassName The GraphNode subclass to cast each item in the list to. - * @param string|null $parentKey The key of this data (Graph edge). - * @param string|null $parentNodeId The parent Graph node ID. - * - * @return GraphEdge - * - * @throws FacebookSDKException - */ - public function safelyMakeGraphEdge(array $data, $subclassName = null, $parentKey = null, $parentNodeId = null) - { - if (!isset($data['data'])) { - throw new FacebookSDKException('Cannot cast data to GraphEdge. Expected a "data" key.', 620); - } - - $dataList = []; - foreach ($data['data'] as $graphNode) { - $dataList[] = $this->safelyMakeGraphNode($graphNode, $subclassName); - } - - $metaData = $this->getMetaData($data); - - // We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination) - $parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null; - $className = static::BASE_GRAPH_EDGE_CLASS; - - return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName); - } - - /** - * Get the meta data from a list in a Graph response. - * - * @param array $data The Graph response. - * - * @return array - */ - public function getMetaData(array $data) - { - unset($data['data']); - - return $data; - } - - /** - * Determines whether or not the data should be cast as a GraphEdge. - * - * @param array $data - * - * @return boolean - */ - public static function isCastableAsGraphEdge(array $data) - { - if ($data === []) { - return true; - } - - // Checks for a sequential numeric array which would be a GraphEdge - return array_keys($data) === range(0, count($data) - 1); - } - - /** - * Ensures that the subclass in question is valid. - * - * @param string $subclassName The GraphNode subclass to validate. - * - * @throws FacebookSDKException - */ - public static function validateSubclass($subclassName) - { - if ($subclassName == static::BASE_GRAPH_NODE_CLASS || is_subclass_of($subclassName, static::BASE_GRAPH_NODE_CLASS)) { - return; - } - - throw new FacebookSDKException('The given subclass "' . $subclassName . '" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphObject.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphObject.php deleted file mode 100644 index 0633c405..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphObject.php +++ /dev/null @@ -1,36 +0,0 @@ -makeGraphNode($subclassName); - } - - /** - * Convenience method for creating a GraphEvent collection. - * - * @return GraphEvent - * - * @throws FacebookSDKException - */ - public function makeGraphEvent() - { - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent'); - } - - /** - * Tries to convert a FacebookResponse entity into a GraphEdge. - * - * @param string|null $subclassName The GraphNode sub class to cast the list items to. - * @param boolean $auto_prefix Toggle to auto-prefix the subclass name. - * - * @return GraphEdge - * - * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory - */ - public function makeGraphList($subclassName = null, $auto_prefix = true) - { - return $this->makeGraphEdge($subclassName, $auto_prefix); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php deleted file mode 100644 index 503b96b5..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php +++ /dev/null @@ -1,157 +0,0 @@ - '\Facebook\GraphNodes\GraphPage', - 'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage', - 'location' => '\Facebook\GraphNodes\GraphLocation', - 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto', - 'picture' => '\Facebook\GraphNodes\GraphPicture', - ]; - - /** - * Returns the ID for the user's page as a string if present. - * - * @return string|null - */ - public function getId() - { - return $this->getField('id'); - } - - /** - * Returns the Category for the user's page as a string if present. - * - * @return string|null - */ - public function getCategory() - { - return $this->getField('category'); - } - - /** - * Returns the Name of the user's page as a string if present. - * - * @return string|null - */ - public function getName() - { - return $this->getField('name'); - } - - /** - * Returns the best available Page on Facebook. - * - * @return GraphPage|null - */ - public function getBestPage() - { - return $this->getField('best_page'); - } - - /** - * Returns the brand's global (parent) Page. - * - * @return GraphPage|null - */ - public function getGlobalBrandParentPage() - { - return $this->getField('global_brand_parent_page'); - } - - /** - * Returns the location of this place. - * - * @return GraphLocation|null - */ - public function getLocation() - { - return $this->getField('location'); - } - - /** - * Returns CoverPhoto of the Page. - * - * @return GraphCoverPhoto|null - */ - public function getCover() - { - return $this->getField('cover'); - } - - /** - * Returns Picture of the Page. - * - * @return GraphPicture|null - */ - public function getPicture() - { - return $this->getField('picture'); - } - - /** - * Returns the page access token for the admin user. - * - * Only available in the `/me/accounts` context. - * - * @return string|null - */ - public function getAccessToken() - { - return $this->getField('access_token'); - } - - /** - * Returns the roles of the page admin user. - * - * Only available in the `/me/accounts` context. - * - * @return array|null - */ - public function getPerms() - { - return $this->getField('perms'); - } - - /** - * Returns the `fan_count` (Number of people who likes to page) as int if present. - * - * @return int|null - */ - public function getFanCount() - { - return $this->getField('fan_count'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphPicture.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphPicture.php deleted file mode 100644 index 10274ec5..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphPicture.php +++ /dev/null @@ -1,72 +0,0 @@ -getField('is_silhouette'); - } - - /** - * Returns the url of user picture if it exists - * - * @return string|null - */ - public function getUrl() - { - return $this->getField('url'); - } - - /** - * Returns the width of user picture if it exists - * - * @return int|null - */ - public function getWidth() - { - return $this->getField('width'); - } - - /** - * Returns the height of user picture if it exists - * - * @return int|null - */ - public function getHeight() - { - return $this->getField('height'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphSessionInfo.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphSessionInfo.php deleted file mode 100644 index df8dd358..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphSessionInfo.php +++ /dev/null @@ -1,102 +0,0 @@ -getField('app_id'); - } - - /** - * Returns the application name the token was issued for. - * - * @return string|null - */ - public function getApplication() - { - return $this->getField('application'); - } - - /** - * Returns the date & time that the token expires. - * - * @return \DateTime|null - */ - public function getExpiresAt() - { - return $this->getField('expires_at'); - } - - /** - * Returns whether the token is valid. - * - * @return boolean - */ - public function getIsValid() - { - return $this->getField('is_valid'); - } - - /** - * Returns the date & time the token was issued at. - * - * @return \DateTime|null - */ - public function getIssuedAt() - { - return $this->getField('issued_at'); - } - - /** - * Returns the scope permissions associated with the token. - * - * @return array - */ - public function getScopes() - { - return $this->getField('scopes'); - } - - /** - * Returns the login id of the user associated with the token. - * - * @return string|null - */ - public function getUserId() - { - return $this->getField('user_id'); - } -} diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php deleted file mode 100644 index 6e1ed8f5..00000000 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php +++ /dev/null @@ -1,172 +0,0 @@ - '\Facebook\GraphNodes\GraphPage', - 'location' => '\Facebook\GraphNodes\GraphPage', - 'significant_other' => '\Facebook\GraphNodes\GraphUser', - 'picture' => '\Facebook\GraphNodes\GraphPicture', - ]; - - /** - * Returns the ID for the user as a string if present. - * - * @return string|null - */ - public function getId() - { - return $this->getField('id'); - } - - /** - * Returns the name for the user as a string if present. - * - * @return string|null - */ - public function getName() - { - return $this->getField('name'); - } - - /** - * Returns the first name for the user as a string if present. - * - * @return string|null - */ - public function getFirstName() - { - return $this->getField('first_name'); - } - - /** - * Returns the middle name for the user as a string if present. - * - * @return string|null - */ - public function getMiddleName() - { - return $this->getField('middle_name'); - } - - /** - * Returns the last name for the user as a string if present. - * - * @return string|null - */ - public function getLastName() - { - return $this->getField('last_name'); - } - - /** - * Returns the email for the user as a string if present. - * - * @return string|null - */ - public function getEmail() - { - return $this->getField('email'); - } - - /** - * Returns the gender for the user as a string if present. - * - * @return string|null - */ - public function getGender() - { - return $this->getField('gender'); - } - - /** - * Returns the Facebook URL for the user as a string if available. - * - * @return string|null - */ - public function getLink() - { - return $this->getField('link'); - } - - /** - * Returns the users birthday, if available. - * - * @return Birthday|null - */ - public function getBirthday() - { - return $this->getField('birthday'); - } - - /** - * Returns the current location of the user as a GraphPage. - * - * @return GraphPage|null - */ - public function getLocation() - { - return $this->getField('location'); - } - - /** - * Returns the current location of the user as a GraphPage. - * - * @return GraphPage|null - */ - public function getHometown() - { - return $this->getField('hometown'); - } - - /** - * Returns the current location of the user as a GraphUser. - * - * @return GraphUser|null - */ - public function getSignificantOther() - { - return $this->getField('significant_other'); - } - - /** - * Returns the picture of the user as a GraphPicture - * - * @return GraphPicture|null - */ - public function getPicture() - { - return $this->getField('picture'); - } -} -- cgit v1.2.3