Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/twitter.zip
Назад
PK F}!]�2T� � directmessages.phpnu &1i� <?php /** * @package Joomla.Platform * @subpackage Twitter * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die(); /** * Twitter API Direct Messages class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/twitter` package via Composer instead */ class JTwitterDirectmessages extends JTwitterObject { /** * Method to get the most recent direct messages sent to the authenticating user. * * @param integer $sinceId Returns results with an ID greater than (that is, more recent than) the specified ID. * @param integer $maxId Returns results with an ID less than (that is, older than) or equal to the specified ID. * @param integer $count Specifies the number of direct messages to try and retrieve, up to a maximum of 200. * @param boolean $entities When set to true, each tweet will include a node called "entities,". This node offers a variety of metadata * about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. * @param boolean $skipStatus When set to either true, t or 1 statuses will not be included in the returned user objects. * * @return array The decoded JSON response * * @since 3.1.4 */ public function getDirectMessages($sinceId = 0, $maxId = 0, $count = 20, $entities = null, $skipStatus = null) { // Check the rate limit for remaining hits $this->checkRateLimit('direct_messages'); // Set the API path $path = '/direct_messages.json'; // Check if since_id is specified. if ($sinceId) { $data['since_id'] = $sinceId; } // Check if max_id is specified. if ($maxId) { $data['max_id'] = $maxId; } // Check if count is specified. if ($count) { $data['count'] = $count; } // Check if entities is specified. if (!is_null($entities)) { $data['include_entities'] = $entities; } // Check if skip_status is specified. if (!is_null($skipStatus)) { $data['skip_status'] = $skipStatus; } // Send the request. return $this->sendRequest($path, 'GET', $data); } /** * Method to get the most recent direct messages sent by the authenticating user. * * @param integer $sinceId Returns results with an ID greater than (that is, more recent than) the specified ID. * @param integer $maxId Returns results with an ID less than (that is, older than) or equal to the specified ID. * @param integer $count Specifies the number of direct messages to try and retrieve, up to a maximum of 200. * @param integer $page Specifies the page of results to retrieve. * @param boolean $entities When set to true, each tweet will include a node called "entities,". This node offers a variety of metadata * about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. * * @return array The decoded JSON response * * @since 3.1.4 */ public function getSentDirectMessages($sinceId = 0, $maxId = 0, $count = 20, $page = 0, $entities = null) { // Check the rate limit for remaining hits $this->checkRateLimit('direct_messages', 'sent'); // Set the API path $path = '/direct_messages/sent.json'; // Check if since_id is specified. if ($sinceId) { $data['since_id'] = $sinceId; } // Check if max_id is specified. if ($maxId) { $data['max_id'] = $maxId; } // Check if count is specified. if ($count) { $data['count'] = $count; } // Check if page is specified. if ($page) { $data['page'] = $page; } // Check if entities is specified. if (!is_null($entities)) { $data['include_entities'] = $entities; } // Send the request. return $this->sendRequest($path, 'GET', $data); } /** * Method to send a new direct message to the specified user from the authenticating user. * * @param mixed $user Either an integer containing the user ID or a string containing the screen name. * @param string $text The text of your direct message. Be sure to keep the message under 140 characters. * * @return array The decoded JSON response * * @since 3.1.4 * @throws RuntimeException */ public function sendDirectMessages($user, $text) { // Set the API path $path = '/direct_messages/new.json'; // Determine which type of data was passed for $user if (is_numeric($user)) { $data['user_id'] = $user; } elseif (is_string($user)) { $data['screen_name'] = $user; } else { // We don't have a valid entry throw new RuntimeException('The specified username is not in the correct format; must use integer or string'); } $data['text'] = $text; // Send the request. return $this->sendRequest($path, 'POST', $data); } /** * Method to get a single direct message, specified by an id parameter. * * @param integer $id The ID of the direct message. * * @return array The decoded JSON response * * @since 3.1.4 */ public function getDirectMessagesById($id) { // Check the rate limit for remaining hits $this->checkRateLimit('direct_messages', 'show'); // Set the API path $path = '/direct_messages/show.json'; $data['id'] = $id; // Send the request. return $this->sendRequest($path, 'GET', $data); } /** * Method to delete the direct message specified in the required ID parameter. * * @param integer $id The ID of the direct message. * @param boolean $entities When set to true, each tweet will include a node called "entities,". This node offers a variety of metadata * about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. * * @return array The decoded JSON response * * @since 3.1.4 */ public function deleteDirectMessages($id, $entities = null) { // Set the API path $path = '/direct_messages/destroy.json'; $data['id'] = $id; // Check if entities is specified. if (!is_null($entities)) { $data['include_entities'] = $entities; } // Send the request. return $this->sendRequest($path, 'POST', $data); } } PK F}!]��5 5 object.phpnu &1i� <?php /** * @package Joomla.Platform * @subpackage Twitter * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die(); use Joomla\Registry\Registry; /** * Twitter API object class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/twitter` package via Composer instead */ abstract class JTwitterObject { /** * @var Registry Options for the Twitter object. * @since 3.1.4 */ protected $options; /** * @var JHttp The HTTP client object to use in sending HTTP requests. * @since 3.1.4 */ protected $client; /** * @var JTwitterOAuth The OAuth client. * @since 3.1.4 */ protected $oauth; /** * Constructor. * * @param Registry &$options Twitter options object. * @param JHttp $client The HTTP client object. * @param JTwitterOAuth $oauth The OAuth client. * * @since 3.1.4 */ public function __construct(Registry &$options = null, JHttp $client = null, JTwitterOAuth $oauth = null) { $this->options = isset($options) ? $options : new Registry; $this->client = isset($client) ? $client : new JHttp($this->options); $this->oauth = $oauth; } /** * Method to check the rate limit for the requesting IP address * * @param string $resource A resource or a comma-separated list of resource families you want to know the current rate limit disposition for. * @param string $action An action for the specified resource, if only one resource is specified. * * @return void * * @since 3.1.4 * @throws RuntimeException */ public function checkRateLimit($resource = null, $action = null) { // Check the rate limit for remaining hits $rate_limit = $this->getRateLimit($resource); $property = '/' . $resource; if (!is_null($action)) { $property .= '/' . $action; } if ($rate_limit->resources->$resource->$property->remaining == 0) { // The IP has exceeded the Twitter API rate limit throw new RuntimeException('This server has exceed the Twitter API rate limit for the given period. The limit will reset at ' . $rate_limit->resources->$resource->$property->reset ); } } /** * Method to build and return a full request URL for the request. This method will * add appropriate pagination details if necessary and also prepend the API url * to have a complete URL for the request. * * @param string $path URL to inflect * @param array $parameters The parameters passed in the URL. * * @return string The request URL. * * @since 3.1.4 */ public function fetchUrl($path, $parameters = null) { if ($parameters) { foreach ($parameters as $key => $value) { if (strpos($path, '?') === false) { $path .= '?' . $key . '=' . $value; } else { $path .= '&' . $key . '=' . $value; } } } // Get a new JUri object focusing the api url and given path. if (strpos($path, 'http://search.twitter.com/search.json') === false) { $uri = new JUri($this->options->get('api.url') . $path); } else { $uri = new JUri($path); } return (string) $uri; } /** * Method to retrieve the rate limit for the requesting IP address * * @param string $resource A resource or a comma-separated list of resource families you want to know the current rate limit disposition for. * * @return array The JSON response decoded * * @since 3.1.4 */ public function getRateLimit($resource) { // Build the request path. $path = '/application/rate_limit_status.json'; if (!is_null($resource)) { return $this->sendRequest($path, 'GET', array('resources' => $resource)); } return $this->sendRequest($path); } /** * Method to send the request. * * @param string $path The path of the request to make * @param string $method The request method. * @param mixed $data Either an associative array or a string to be sent with the post request. * @param array $headers An array of name-value pairs to include in the header of the request * * @return array The decoded JSON response * * @since 3.1.4 * @throws RuntimeException */ public function sendRequest($path, $method = 'GET', $data = array(), $headers = array()) { // Get the access token. $token = $this->oauth->getToken(); // Set parameters. $parameters['oauth_token'] = $token['key']; // Send the request. $response = $this->oauth->oauthRequest($this->fetchUrl($path), $method, $parameters, $data, $headers); if (strpos($path, 'update_with_media') !== false) { // Check Media Rate Limit. $response_headers = $response->headers; if ($response_headers['x-mediaratelimit-remaining'] == 0) { // The IP has exceeded the Twitter API media rate limit throw new RuntimeException('This server has exceed the Twitter API media rate limit for the given period. The limit will reset in ' . $response_headers['x-mediaratelimit-reset'] . 'seconds.' ); } } if (strpos($response->body, 'redirected') !== false) { return $response->headers['Location']; } return json_decode($response->body); } /** * Get an option from the JTwitterObject instance. * * @param string $key The name of the option to get. * * @return mixed The option value. * * @since 3.1.4 */ public function getOption($key) { return $this->options->get($key); } /** * Set an option for the JTwitterObject instance. * * @param string $key The name of the option to set. * @param mixed $value The option value to set. * * @return JTwitterObject This object for method chaining. * * @since 3.1.4 */ public function setOption($key, $value) { $this->options->set($key, $value); return $this; } } PK F}!]����- - search.phpnu &1i� <?php /** * @package Joomla.Platform * @subpackage Twitter * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die(); /** * Twitter API Search class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/twitter` package via Composer instead */ class JTwittersearch extends JTwitterObject { /** * Method to get tweets that match a specified query. * * @param string $query Search query. Should be URL encoded. Queries will be limited by complexity. * @param string $callback If supplied, the response will use the JSONP format with a callback of the given name * @param string $geocode Returns tweets by users located within a given radius of the given latitude/longitude. The parameter value is * specified by "latitude,longitude,radius", where radius units must be specified as either "mi" (miles) or "km" (kilometers). * @param string $lang Restricts tweets to the given language, given by an ISO 639-1 code. * @param string $locale Specify the language of the query you are sending (only ja is currently effective). This is intended for * language-specific clients and the default should work in the majority of cases. * @param string $resultType Specifies what type of search results you would prefer to receive. The current default is "mixed." * @param integer $count The number of tweets to return per page, up to a maximum of 100. Defaults to 15. * @param string $until Returns tweets generated before the given date. Date should be formatted as YYYY-MM-DD. * @param integer $sinceId Returns results with an ID greater than (that is, more recent than) the specified ID. * @param integer $maxId Returns results with an ID less than (that is, older than) or equal to the specified ID. * @param boolean $entities When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a * variety of metadata about the tweet in a discrete structure, including: urls, media and hashtags. * * @return array The decoded JSON response * * @since 3.1.4 */ public function search($query, $callback = null, $geocode = null, $lang = null, $locale = null, $resultType = null, $count = 15, $until = null, $sinceId = 0, $maxId = 0, $entities = null) { // Check the rate limit for remaining hits $this->checkRateLimit('search', 'tweets'); // Set the API path $path = '/search/tweets.json'; // Set query parameter. $data['q'] = rawurlencode($query); // Check if callback is specified. if ($callback) { $data['callback'] = $callback; } // Check if geocode is specified. if ($geocode) { $data['geocode'] = $geocode; } // Check if lang is specified. if ($lang) { $data['lang'] = $lang; } // Check if locale is specified. if ($locale) { $data['locale'] = $locale; } // Check if result_type is specified. if ($resultType) { $data['result_type'] = $resultType; } // Check if count is specified. if ($count != 15) { $data['count'] = $count; } // Check if until is specified. if ($until) { $data['until'] = $until; } // Check if since_id is specified. if ($sinceId > 0) { $data['since_id'] = $sinceId; } // Check if max_id is specified. if ($maxId > 0) { $data['max_id'] = $maxId; } // Check if entities is specified. if (!is_null($entities)) { $data['include_entities'] = $entities; } // Send the request. return $this->sendRequest($path, 'GET', $data); } /** * Method to get the authenticated user's saved search queries. * * @return array The decoded JSON response * * @since 3.1.4 */ public function getSavedSearches() { // Check the rate limit for remaining hits $this->checkRateLimit('saved_searches', 'list'); // Set the API path $path = '/saved_searches/list.json'; // Send the request. return $this->sendRequest($path); } /** * Method to get the information for the saved search represented by the given id. * * @param integer $id The ID of the saved search. * * @return array The decoded JSON response * * @since 3.1.4 */ public function getSavedSearchesById($id) { // Check the rate limit for remaining hits $this->checkRateLimit('saved_searches', 'show/:id'); // Set the API path $path = '/saved_searches/show/' . $id . '.json'; // Send the request. return $this->sendRequest($path); } /** * Method to create a new saved search for the authenticated user. * * @param string $query The query of the search the user would like to save. * * @return array The decoded JSON response * * @since 3.1.4 */ public function createSavedSearch($query) { // Set the API path $path = '/saved_searches/create.json'; // Set POST request data $data['query'] = rawurlencode($query); // Send the request. return $this->sendRequest($path, 'POST', $data); } /** * Method to delete a saved search for the authenticating user. * * @param integer $id The ID of the saved search. * * @return array The decoded JSON response * * @since 3.1.4 */ public function deleteSavedSearch($id) { // Check the rate limit for remaining hits $this->checkRateLimit('saved_searches', 'destroy/:id'); // Set the API path $path = '/saved_searches/destroy/' . $id . '.json'; // Send the request. return $this->sendRequest($path, 'POST'); } } PK F}!]3_l�� � block.phpnu &1i� <?php /** * @package Joomla.Platform * @subpackage Twitter * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die(); /** * Twitter API Block class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/twitter` package via Composer instead */ class JTwitterBlock extends JTwitterObject { /** * Method to get the user ids the authenticating user is blocking. * * @param boolean $stringifyIds Provide this option to have ids returned as strings instead. * @param integer $cursor Causes the list of IDs to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned * is not guaranteed to be 5000 as suspended users are filtered out after connections are queried. If no cursor * is provided, a value of -1 will be assumed, which is the first "page." * * @return array The decoded JSON response * * @since 3.1.4 */ public function getBlocking($stringifyIds = null, $cursor = null) { // Check the rate limit for remaining hits $this->checkRateLimit('blocks', 'ids'); $data = array(); // Check if stringify_ids is specified if (!is_null($stringifyIds)) { $data['stringify_ids'] = $stringifyIds; } // Check if cursor is specified if (!is_null($stringifyIds)) { $data['cursor'] = $cursor; } // Set the API path $path = '/blocks/ids.json'; // Send the request. return $this->sendRequest($path, 'GET', $data); } /** * Method to block the specified user from following the authenticating user. * * @param mixed $user Either an integer containing the user ID or a string containing the screen name. * @param boolean $entities When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a * variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. * @param boolean $skipStatus When set to either true, t or 1 statuses will not be included in the returned user objects. * * @return array The decoded JSON response * * @since 3.1.4 * @throws RuntimeException */ public function block($user, $entities = null, $skipStatus = null) { // Check the rate limit for remaining hits $this->checkRateLimit('blocks', 'create'); // Determine which type of data was passed for $user if (is_numeric($user)) { $data['user_id'] = $user; } elseif (is_string($user)) { $data['screen_name'] = $user; } else { // We don't have a valid entry throw new RuntimeException('The specified username is not in the correct format; must use integer or string'); } // Check if entities is specified if (!is_null($entities)) { $data['include_entities'] = $entities; } // Check if skip_statuses is specified if (!is_null($skipStatus)) { $data['skip_status'] = $skipStatus; } // Set the API path $path = '/blocks/create.json'; // Send the request. return $this->sendRequest($path, 'POST', $data); } /** * Method to unblock the specified user from following the authenticating user. * * @param mixed $user Either an integer containing the user ID or a string containing the screen name. * @param boolean $entities When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a * variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. * @param boolean $skipStatus When set to either true, t or 1 statuses will not be included in the returned user objects. * * @return array The decoded JSON response * * @since 3.1.4 * @throws RuntimeException */ public function unblock($user, $entities = null, $skipStatus = null) { // Check the rate limit for remaining hits $this->checkRateLimit('blocks', 'destroy'); // Determine which type of data was passed for $user if (is_numeric($user)) { $data['user_id'] = $user; } elseif (is_string($user)) { $data['screen_name'] = $user; } else { // We don't have a valid entry throw new RuntimeException('The specified username is not in the correct format; must use integer or string'); } // Check if entities is specified if (!is_null($entities)) { $data['include_entities'] = $entities; } // Check if skip_statuses is specified if (!is_null($skipStatus)) { $data['skip_status'] = $skipStatus; } // Set the API path $path = '/blocks/destroy.json'; // Send the request. return $this->sendRequest($path, 'POST', $data); } } PK F}!]�M���'