Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/github.zip
Назад
PK cj�[ث��� � account.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @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; /** * GitHub API Account class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubAccount extends JGithubObject { /** * Method to create an authorisation. * * @param array $scopes A list of scopes that this authorisation is in. * @param string $note A note to remind you what the OAuth token is for. * @param string $url A URL to remind you what app the OAuth token is for. * * @deprecated use authorization->create() * * @return object * * @since 3.1.4 * @throws DomainException */ public function createAuthorisation(array $scopes = array(), $note = '', $url = '') { // Build the request path. $path = '/authorizations'; $data = json_encode( array('scopes' => $scopes, 'note' => $note, 'note_url' => $url) ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 201) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to delete an authorisation * * @param integer $id ID of the authorisation to delete * * @deprecated use authorization->delete() * * @return object * * @since 3.1.4 * @throws DomainException */ public function deleteAuthorisation($id) { // Build the request path. $path = '/authorizations/' . $id; // Send the request. $response = $this->client->delete($this->fetchUrl($path)); // Validate the response code. if ($response->code != 204) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to edit an authorisation. * * @param integer $id ID of the authorisation to edit * @param array $scopes Replaces the authorisation scopes with these. * @param array $addScopes A list of scopes to add to this authorisation. * @param array $removeScopes A list of scopes to remove from this authorisation. * @param string $note A note to remind you what the OAuth token is for. * @param string $url A URL to remind you what app the OAuth token is for. * * @deprecated use authorization->edit() * * @return object * * @since 3.1.4 * @throws DomainException * @throws RuntimeException */ public function editAuthorisation($id, array $scopes = array(), array $addScopes = array(), array $removeScopes = array(), $note = '', $url = '') { // Check if more than one scopes array contains data $scopesCount = 0; if (!empty($scopes)) { $scope = 'scopes'; $scopeData = $scopes; $scopesCount++; } if (!empty($addScopes)) { $scope = 'add_scopes'; $scopeData = $addScopes; $scopesCount++; } if (!empty($removeScopes)) { $scope = 'remove_scopes'; $scopeData = $removeScopes; $scopesCount++; } // Only allowed to send data for one scope parameter if ($scopesCount >= 2) { throw new RuntimeException('You can only send one scope key in this request.'); } // Build the request path. $path = '/authorizations/' . $id; $data = json_encode( array( $scope => $scopeData, 'note' => $note, 'note_url' => $url, ) ); // Send the request. $response = $this->client->patch($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get details about an authorised application for the authenticated user. * * @param integer $id ID of the authorisation to retrieve * * @deprecated use authorization->get() * * @return object * * @since 3.1.4 * @note This method will only accept Basic Authentication * @throws DomainException */ public function getAuthorisation($id) { // Build the request path. $path = '/authorizations/' . $id; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get the authorised applications for the authenticated user. * * @deprecated use authorization->getList() * * @return object * * @since 3.1.4 * @throws DomainException * @note This method will only accept Basic Authentication */ public function getAuthorisations() { // Build the request path. $path = '/authorizations'; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get the rate limit for the authenticated user. * * @deprecated use authorization->getRateLimit() * * @return object * * @since 3.1.4 * @throws DomainException */ public function getRateLimit() { // Build the request path. $path = '/rate_limit'; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } } PK cj�[�A�{+ {+ commits.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * GitHub API Commits class for the Joomla Platform. * * @since 3.0.0 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubCommits extends JGithubObject { /** * Method to create a commit. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $message The commit message. * @param string $tree SHA of the tree object this commit points to. * @param array $parents Array of the SHAs of the commits that were the parents of this commit. * If omitted or empty, the commit will be written as a root commit. * For a single parent, an array of one SHA should be provided. * For a merge commit, an array of more than one should be provided. * * @deprecated use data->commits->create() * * @return object * * @since 3.0.0 */ public function create($user, $repo, $message, $tree, array $parents = array()) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/git/commits'; $data = json_encode( array('message' => $message, 'tree' => $tree, 'parents' => $parents) ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 201) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to create a comment on a commit. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $sha The SHA of the commit to comment on. * @param string $comment The text of the comment. * @param integer $line The line number of the commit to comment on. * @param string $filepath A relative path to the file to comment on within the commit. * @param integer $position Line index in the diff to comment on. * * @deprecated use repositories->comments->create() * * @return object * * @since 3.0.0 */ public function createCommitComment($user, $repo, $sha, $comment, $line, $filepath, $position) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/commits/' . $sha . '/comments'; $data = json_encode( array( 'body' => $comment, 'commit_id' => $sha, 'line' => (int) $line, 'path' => $filepath, 'position' => (int) $position, ) ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 201) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to delete a comment on a commit. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $id The ID of the comment to edit. * * @deprecated use repositories->comments->delete() * * @return object * * @since 3.0.0 */ public function deleteCommitComment($user, $repo, $id) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/comments/' . $id; // Send the request. $response = $this->client->delete($this->fetchUrl($path)); // Validate the response code. if ($response->code != 204) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to edit a comment on a commit. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $id The ID of the comment to edit. * @param string $comment The text of the comment. * * @deprecated use repositories->comments->edit() * * @return object * * @since 3.0.0 */ public function editCommitComment($user, $repo, $id, $comment) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/comments/' . $id; $data = json_encode( array( 'body' => $comment, ) ); // Send the request. $response = $this->client->patch($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get a single commit for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $sha The SHA of the commit to retrieve. * @param integer $page Page to request * @param integer $limit Number of results to return per page * * @deprecated use repositories->commits->get() * * @return array * * @since 3.0.0 */ public function getCommit($user, $repo, $sha, $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/commits/' . $sha; // Send the request. $response = $this->client->get($this->fetchUrl($path, $page, $limit)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get a single comment on a commit. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $id ID of the comment to retrieve * * @deprecated use repositories->comments->get() * * @return array * * @since 3.0.0 */ public function getCommitComment($user, $repo, $id) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/comments/' . $id; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get a list of comments for a single commit for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $sha The SHA of the commit to retrieve. * @param integer $page Page to request * @param integer $limit Number of results to return per page * * @deprecated use repositories->comments->getList() * * @return array * * @since 3.0.0 */ public function getCommitComments($user, $repo, $sha, $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/commits/' . $sha . '/comments'; // Send the request. $response = $this->client->get($this->fetchUrl($path, $page, $limit)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get a diff for two commits. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $base The base of the diff, either a commit SHA or branch. * @param string $head The head of the diff, either a commit SHA or branch. * * @deprecated use repositories->commits->compare() * * @return array * * @since 3.0.0 */ public function getDiff($user, $repo, $base, $head) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/compare/' . $base . '...' . $head; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to list commits for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $page Page to request * @param integer $limit Number of results to return per page * * @deprecated use repositories->commits->getList() * * @return array * * @since 3.0.0 */ public function getList($user, $repo, $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/commits'; // Send the request. $response = $this->client->get($this->fetchUrl($path, $page, $limit)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get a list of commit comments for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $page Page to request * @param integer $limit Number of results to return per page * * @deprecated use repositories->comments->getListRepository() * * @return array * * @since 3.0.0 */ public function getListComments($user, $repo, $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/comments'; // Send the request. $response = $this->client->get($this->fetchUrl($path, $page, $limit)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } } PK cj�[е� � � forks.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * GitHub API Forks class for the Joomla Platform. * * @since 1.7.3 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubForks extends JGithubObject { /** * Method to fork a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $org The organization to fork the repo into. By default it is forked to the current user. * * @deprecated use repositories->forks->create() * * @return object * * @since 2.5.0 * @throws DomainException */ public function create($user, $repo, $org = '') { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/forks'; if (strlen($org) > 0) { $data = json_encode( array('org' => $org) ); } else { $data = json_encode(array()); } // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 202) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to list forks for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $page Page to request * @param integer $limit Number of results to return per page * * @deprecated use repositories->forks->getList() * * @return array * * @since 2.5.0 * @throws DomainException */ public function getList($user, $repo, $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/forks'; // Send the request. $response = $this->client->get($this->fetchUrl($path, $page, $limit)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } } PK cj�[O�)F� � github.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2011 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; /** * Joomla Platform class for interacting with a GitHub server instance. * * @property-read JGithubPackageActivity $activity GitHub API object for activity. * @property-read JGithubPackageAuthorization $authorization GitHub API object for authorizations. * @property-read JGithubPackageData $data GitHub API object for data. * @property-read JGithubPackageGists $gists GitHub API object for gists. * @property-read JGithubPackageGitignore $gitignore GitHub API object for gitignore. * @property-read JGithubPackageIssues $issues GitHub API object for issues. * @property-read JGithubPackageMarkdown $markdown GitHub API object for markdown. * @property-read JGithubPackageOrgs $orgs GitHub API object for orgs. * @property-read JGithubPackagePulls $pulls GitHub API object for pulls. * @property-read JGithubPackageRepositories $repositories GitHub API object for repositories. * @property-read JGithubPackageSearch $search GitHub API object for search. * @property-read JGithubPackageUsers $users GitHub API object for users. * * @property-read JGithubRefs $refs Deprecated GitHub API object for references. * @property-read JGithubForks $forks Deprecated GitHub API object for forks. * @property-read JGithubCommits $commits Deprecated GitHub API object for commits. * @property-read JGithubMilestones $milestones Deprecated GitHub API object for commits. * @property-read JGithubStatuses $statuses Deprecated GitHub API object for commits. * @property-read JGithubAccount $account Deprecated GitHub API object for account references. * @property-read JGithubHooks $hooks Deprecated GitHub API object for hooks. * @property-read JGithubMeta $meta Deprecated GitHub API object for meta. * * @since 1.7.3 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithub { /** * @var Registry Options for the GitHub object. * @since 1.7.3 */ protected $options; /** * @var JGithubHttp The HTTP client object to use in sending HTTP requests. * @since 1.7.3 */ protected $client; /** * @var array List of known packages. * @since 3.3 (CMS) */ protected $packages = array( 'activity', 'authorization', 'data', 'gists', 'gitignore', 'issues', 'markdown', 'orgs', 'pulls', 'repositories', 'users', ); /** * @var array List of known legacy packages. * @since 3.3 (CMS) */ protected $legacyPackages = array('refs', 'forks', 'commits', 'milestones', 'statuses', 'account', 'hooks', 'meta'); /** * Constructor. * * @param Registry $options GitHub options object. * @param JGithubHttp $client The HTTP client object. * * @since 1.7.3 */ public function __construct(Registry $options = null, JGithubHttp $client = null) { $this->options = isset($options) ? $options : new Registry; $this->client = isset($client) ? $client : new JGithubHttp($this->options); // Setup the default API url if not already set. $this->options->def('api.url', 'https://api.github.com'); } /** * Magic method to lazily create API objects * * @param string $name Name of property to retrieve * * @throws RuntimeException * * @since 1.7.3 * @return JGithubObject GitHub API object (gists, issues, pulls, etc). */ public function __get($name) { if (false == in_array($name, $this->packages)) { // Check for a legacy class if (in_array($name, $this->legacyPackages)) { if (false == isset($this->$name)) { $className = 'JGithub' . ucfirst($name); $this->$name = new $className($this->options, $this->client); } return $this->$name; } throw new RuntimeException(sprintf('%1$s - Unknown package %2$s', __METHOD__, $name)); } if (false == isset($this->$name)) { $className = 'JGithubPackage' . ucfirst($name); $this->$name = new $className($this->options, $this->client); } return $this->$name; } /** * Get an option from the JGitHub instance. * * @param string $key The name of the option to get. * * @return mixed The option value. * * @since 1.7.3 */ public function getOption($key) { return $this->options->get($key); } /** * Set an option for the JGitHub instance. * * @param string $key The name of the option to set. * @param mixed $value The option value to set. * * @return JGitHub This object for method chaining. * * @since 1.7.3 */ public function setOption($key, $value) { $this->options->set($key, $value); return $this; } } PK dj�[���@ @ hooks.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @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; /** * GitHub API Hooks class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubHooks extends JGithubObject { /** * Array containing the allowed hook events * * @var array * @since 3.1.4 */ protected $events = array( 'push', 'issues', 'issue_comment', 'commit_comment', 'pull_request', 'gollum', 'watch', 'download', 'fork', 'fork_apply', 'member', 'public', 'status', ); /** * Method to create a hook on a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $name The name of the service being called. * @param array $config Array containing the config for the service. * @param array $events The events the hook will be triggered for. * @param boolean $active Flag to determine if the hook is active * * @deprecated use repositories->hooks->create() * * @return object * * @since 3.1.4 * @throws DomainException * @throws RuntimeException */ public function create($user, $repo, $name, array $config, array $events = array('push'), $active = true) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/hooks'; // Check to ensure all events are in the allowed list foreach ($events as $event) { if (!in_array($event, $this->events)) { throw new RuntimeException('Your events array contains an unauthorized event.'); } } $data = json_encode( array('name' => $name, 'config' => $config, 'events' => $events, 'active' => $active) ); return $this->processResponse( $this->client->post($this->fetchUrl($path), $data), 201 ); } /** * Method to delete a hook * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $id ID of the hook to delete. * * @deprecated use repositories->hooks->delete() * * @return object * * @since 3.1.4 * @throws DomainException */ public function delete($user, $repo, $id) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/hooks/' . $id; return $this->processResponse( $this->client->delete($this->fetchUrl($path)), 204 ); } /** * Method to edit a hook. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $id ID of the hook to edit. * @param string $name The name of the service being called. * @param array $config Array containing the config for the service. * @param array $events The events the hook will be triggered for. This resets the currently set list * @param array $addEvents Events to add to the hook. * @param array $removeEvents Events to remove from the hook. * @param boolean $active Flag to determine if the hook is active * * @deprecated use repositories->hooks->edit() * * @return object * * @since 3.1.4 * @throws DomainException * @throws RuntimeException */ public function edit($user, $repo, $id, $name, array $config, array $events = array('push'), array $addEvents = array(), array $removeEvents = array(), $active = true) { // Check to ensure all events are in the allowed list foreach ($events as $event) { if (!in_array($event, $this->events)) { throw new RuntimeException('Your events array contains an unauthorized event.'); } } foreach ($addEvents as $event) { if (!in_array($event, $this->events)) { throw new RuntimeException('Your active_events array contains an unauthorized event.'); } } foreach ($removeEvents as $event) { if (!in_array($event, $this->events)) { throw new RuntimeException('Your remove_events array contains an unauthorized event.'); } } // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/hooks/' . $id; $data = json_encode( array( 'name' => $name, 'config' => $config, 'events' => $events, 'add_events' => $addEvents, 'remove_events' => $removeEvents, 'active' => $active, ) ); return $this->processResponse( $this->client->patch($this->fetchUrl($path), $data) ); } /** * Method to get details about a single hook for the repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $id ID of the hook to retrieve * * @deprecated use repositories->hooks->get() * * @return object * * @since 3.1.4 * @throws DomainException */ public function get($user, $repo, $id) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/hooks/' . $id; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * Method to list hooks for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $page Page to request * @param integer $limit Number of results to return per page * * @deprecated use repositories->hooks->getList() * * @return object * * @since 3.1.4 * @throws DomainException */ public function getList($user, $repo, $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/hooks'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * Method to test a hook against the latest repository commit * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $id ID of the hook to delete * * @deprecated use repositories->hooks->test() * * @return object * * @since 3.1.4 * @throws DomainException */ public function test($user, $repo, $id) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/hooks/' . $id . '/test'; return $this->processResponse( $this->client->post($this->fetchUrl($path), json_encode('')), 204 ); } } PK dj�[��� � http.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2011 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; /** * HTTP client class for connecting to a GitHub instance. * * @since 1.7.3 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubHttp extends JHttp { /** * Use no authentication for HTTP connections. * * @var integer * @since 1.7.3 */ const AUTHENTICATION_NONE = 0; /** * Use basic authentication for HTTP connections. * * @var integer * @since 1.7.3 */ const AUTHENTICATION_BASIC = 1; /** * Use OAuth authentication for HTTP connections. * * @var integer * @since 1.7.3 */ const AUTHENTICATION_OAUTH = 2; /** * Constructor. * * @param Registry $options Client options object. * @param JHttpTransport $transport The HTTP transport object. * * @since 1.7.3 */ public function __construct(Registry $options = null, JHttpTransport $transport = null) { // Call the JHttp constructor to setup the object. parent::__construct($options, $transport); // Make sure the user agent string is defined. $this->options->def('userAgent', 'JGitHub/2.0'); // Set the default timeout to 120 seconds. $this->options->def('timeout', 120); } } PK dj�[��p� � meta.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @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; /** * GitHub API Meta class. * * @since 3.2.0 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubMeta extends JGithubObject { /** * Method to get the authorized IP addresses for services * * @return array Authorized IP addresses * * @since 3.2.0 * @throws DomainException */ public function getMeta() { // Build the request path. $path = '/meta'; $githubIps = $this->processResponse($this->client->get($this->fetchUrl($path)), 200); /* * The response body returns the IP addresses in CIDR format * Decode the response body and strip the subnet mask information prior to * returning the data to the user. We're assuming quite a bit here that all * masks will be /32 as they are as of the time of development. */ $authorizedIps = array(); foreach ($githubIps as $key => $serviceIps) { // The first level contains an array of IPs based on the service $authorizedIps[$key] = array(); foreach ($serviceIps as $serviceIp) { // The second level is each individual IP address, strip the mask here $authorizedIps[$key][] = substr($serviceIp, 0, -3); } } return $authorizedIps; } } PK dj�[e��$� � milestones.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @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; /** * GitHub API Milestones class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubMilestones extends JGithubObject { /** * Method to get the list of milestones for a repo. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param string $state The milestone state to retrieved. Open (default) or closed. * @param string $sort Sort can be due_date (default) or completeness. * @param string $direction Direction is asc or desc (default). * @param integer $page The page number from which to get items. * @param integer $limit The number of items on a page. * * @deprecated use issues->milestones->getList() * * @return array * * @since 3.1.4 */ public function getList($user, $repo, $state = 'open', $sort = 'due_date', $direction = 'desc', $page = 0, $limit = 0) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/milestones?'; $path .= 'state=' . $state; $path .= '&sort=' . $sort; $path .= '&direction=' . $direction; // Send the request. $response = $this->client->get($this->fetchUrl($path, $page, $limit)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to get a specific milestone. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $milestoneId The milestone id to get. * * @deprecated use issues->milestones->get() * * @return object * * @since 3.1.4 */ public function get($user, $repo, $milestoneId) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/milestones/' . (int) $milestoneId; // Send the request. $response = $this->client->get($this->fetchUrl($path)); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to create a milestone for a repository. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $title The title of the milestone. * @param string $state Can be open (default) or closed. * @param string $description Optional description for milestone. * @param string $dueOn Optional ISO 8601 time. * * @deprecated use issues->milestones->create() * * @return object * * @since 3.1.4 */ public function create($user, $repo, $title, $state = null, $description = null, $dueOn = null) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/milestones'; // Build the request data. $data = array( 'title' => $title, ); if (!is_null($state)) { $data['state'] = $state; } if (!is_null($description)) { $data['description'] = $description; } if (!is_null($dueOn)) { $data['due_on'] = $dueOn; } $data = json_encode($data); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 201) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to update a milestone. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $milestoneId The id of the comment to update. * @param integer $title Optional title of the milestone. * @param string $state Can be open (default) or closed. * @param string $description Optional description for milestone. * @param string $dueOn Optional ISO 8601 time. * * @deprecated use issues->milestones->edit() * * @return object * * @since 3.1.4 */ public function edit($user, $repo, $milestoneId, $title = null, $state = null, $description = null, $dueOn = null) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/milestones/' . (int) $milestoneId; // Build the request data. $data = array(); if (!is_null($title)) { $data['title'] = $title; } if (!is_null($state)) { $data['state'] = $state; } if (!is_null($description)) { $data['description'] = $description; } if (!is_null($dueOn)) { $data['due_on'] = $dueOn; } $data = json_encode($data); // Send the request. $response = $this->client->patch($this->fetchUrl($path), $data); // Validate the response code. if ($response->code != 200) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } return json_decode($response->body); } /** * Method to delete a milestone. * * @param string $user The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. * @param integer $milestoneId The id of the milestone to delete. * * @deprecated use issues->milestones->delete() * * @return void * * @since 3.1.4 */ public function delete($user, $repo, $milestoneId) { // Build the request path. $path = '/repos/' . $user . '/' . $repo . '/milestones/' . (int) $milestoneId; // Send the request. $response = $this->client->delete($this->fetchUrl($path)); // Validate the response code. if ($response->code != 204) { // Decode the error response and throw an exception. $error = json_decode($response->body); throw new DomainException($error->message, $response->code); } } } PK dj�[��m�� � object.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2011 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; /** * GitHub API object class for the Joomla Platform. * * @since 1.7.3 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ abstract class JGithubObject { /** * @var Registry Options for the GitHub object. * @since 1.7.3 */ protected $options; /** * @var JGithubHttp The HTTP client object to use in sending HTTP requests. * @since 1.7.3 */ protected $client; /** * Constructor. * * @param Registry $options GitHub options object. * @param JGithubHttp $client The HTTP client object. * * @since 1.7.3 */ public function __construct(Registry $options = null, JGithubHttp $client = null) { $this->options = isset($options) ? $options : new Registry; $this->client = isset($client) ? $client : new JGithubHttp($this->options); } /** * 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 integer $page Page to request * @param integer $limit Number of results to return per page * * @return string The request URL. * * @since 1.7.3 */ protected function fetchUrl($path, $page = 0, $limit = 0) { // Get a new JUri object focusing the api url and given path. $uri = new JUri($this->options->get('api.url') . $path); if ($this->options->get('gh.token', false)) { // Use oAuth authentication - @todo set in request header ? $uri->setVar('access_token', $this->options->get('gh.token')); } else { // Use basic authentication if ($this->options->get('api.username', false)) { $username = $this->options->get('api.username'); $username = str_replace('@', '%40', $username); $uri->setUser($username); } if ($this->options->get('api.password', false)) { $password = $this->options->get('api.password'); $password = str_replace('@', '%40', $password); $uri->setPass($password); } } // If we have a defined page number add it to the JUri object. if ($page > 0) { $uri->setVar('page', (int) $page); } // If we have a defined items per page add it to the JUri object. if ($limit > 0) { $uri->setVar('per_page', (int) $limit); } return (string) $uri; } /** * Process the response and decode it. * * @param JHttpResponse $response The response. * @param integer $expectedCode The expected "good" code. * @param boolean $decode If the should be response be JSON decoded. * * @throws DomainException * @since 3.3.0 * * @return mixed */ protected function processResponse(JHttpResponse $response, $expectedCode = 200, $decode = true) { // Validate the response code. if ($response->code == $expectedCode) { return ($decode) ? json_decode($response->body) : $response->body; } // Decode the error response and throw an exception. $error = json_decode($response->body); $message = (isset($error->message)) ? $error->message : 'Error: ' . $response->code; throw new DomainException($message, $response->code); } } PK dj�[ƺ�� package/activity/events.phpnu �[��� <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2014 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * GitHub API Activity Events class for the Joomla Platform. * * @documentation https://developer.github.com/v3/activity/events/ * * @since 3.3 (CMS) * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubPackageActivityEvents extends JGithubPackage { /** * List public events. * * @since 3.1.4 * @return object */ public function getPublic() { // Build the request path. $path = '/events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List repository events. * * @param string $owner Repository owner. * @param string $repo Repository name. * * @since 3.1.4 * * @return object */ public function getRepository($owner, $repo) { // Build the request path. $path = '/repos/' . $owner . '/' . $repo . '/events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List issue events for a repository. * * @param string $owner Repository owner. * @param string $repo Repository name. * * @since 3.1.4 * @return object */ public function getIssue($owner, $repo) { // Build the request path. $path = '/repos/' . $owner . '/' . $repo . '/issues/events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List public events for a network of repositories. * * @param string $owner Repository owner. * @param string $repo Repository name. * * @since 3.1.4 * @return object */ public function getNetwork($owner, $repo) { // Build the request path. $path = '/networks/' . $owner . '/' . $repo . '/events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List public events for an organization. * * @param string $org Organisation. * * @since 3.1.4 * @return object */ public function getOrg($org) { // Build the request path. $path = '/orgs/' . $org . '/events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List events that a user has received. * * These are events that you’ve received by watching repos and following users. * If you are authenticated as the given user, you will see private events. * Otherwise, you’ll only see public events. * * @param string $user User name. * * @since 3.1.4 * @return object */ public function getUser($user) { // Build the request path. $path = '/users/' . $user . '/received_events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List public events that a user has received. * * @param string $user User name. * * @since 3.1.4 * @return object */ public function getUserPublic($user) { // Build the request path. $path = '/users/' . $user . '/received_events/public'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List events performed by a user. * * If you are authenticated as the given user, you will see your private events. * Otherwise, you’ll only see public events. * * @param string $user User name. * * @since 3.1.4 * @return object */ public function getByUser($user) { // Build the request path. $path = '/users/' . $user . '/events'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List public events performed by a user. * * @param string $user User name. * * @since 3.1.4 * @return object */ public function getByUserPublic($user) { // Build the request path. $path = '/users/' . $user . '/events/public'; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * List events for an organization. * * This is the user’s organization dashboard. * You must be authenticated as the user to view this. * * @param string $user User name. * @param string $org Organisation. * * @since 3.1.4 * @return object */ public function getUserOrg($user, $org) { // Build the request path. $path = '/users/' . $user . '/events/orgs/' . $org; return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } } PK dj�[u�@�~ ~ "