Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

FiveHundredPx.php

Zuletzt modifiziert: 09.10.2024, 12:59 - Dateigröße: 3.28 KiB


001  <?php
002  /**
003   * 500px service.
004   *
005   * @author  Pedro Amorim <contact@pamorim.fr>
006   * @license http://www.opensource.org/licenses/mit-license.html MIT License
007   * @link    https://developers.500px.com/
008   */
009   
010  namespace OAuth\OAuth1\Service;
011   
012  use OAuth\OAuth1\Signature\SignatureInterface;
013  use OAuth\OAuth1\Token\StdOAuth1Token;
014  use OAuth\Common\Http\Exception\TokenResponseException;
015  use OAuth\Common\Http\Uri\Uri;
016  use OAuth\Common\Consumer\CredentialsInterface;
017  use OAuth\Common\Http\Uri\UriInterface;
018  use OAuth\Common\Storage\TokenStorageInterface;
019  use OAuth\Common\Http\Client\ClientInterface;
020   
021  /**
022   * 500px service.
023   *
024   * @author  Pedro Amorim <contact@pamorim.fr>
025   * @license http://www.opensource.org/licenses/mit-license.html MIT License
026   * @link    https://developers.500px.com/
027   */
028  class FiveHundredPx extends AbstractService
029  {
030      public function __construct(
031          CredentialsInterface $credentials,
032          ClientInterface $httpClient,
033          TokenStorageInterface $storage,
034          SignatureInterface $signature,
035          UriInterface $baseApiUri = null
036      ) {
037          parent::__construct(
038              $credentials,
039              $httpClient,
040              $storage,
041              $signature,
042              $baseApiUri
043          );
044   
045          if (null === $baseApiUri) {
046              $this->baseApiUri = new Uri('https://api.500px.com/v1/');
047          }
048      }
049   
050      /**
051       * {@inheritDoc}
052       */
053      public function getRequestTokenEndpoint()
054      {
055          return new Uri('https://api.500px.com/v1/oauth/request_token');
056      }
057   
058      /**
059       * {@inheritdoc}
060       */
061      public function getAuthorizationEndpoint()
062      {
063          return new Uri('https://api.500px.com/v1/oauth/authorize');
064      }
065   
066      /**
067       * {@inheritdoc}
068       */
069      public function getAccessTokenEndpoint()
070      {
071          return new Uri('https://api.500px.com/v1/oauth/access_token');
072      }
073   
074      /**
075       * {@inheritdoc}
076       */
077      protected function parseRequestTokenResponse($responseBody)
078      {
079          parse_str($responseBody, $data);
080   
081          if (null === $data || !is_array($data)) {
082              throw new TokenResponseException('Unable to parse response.');
083          } elseif (!isset($data['oauth_callback_confirmed'])
084              || $data['oauth_callback_confirmed'] !== 'true'
085          ) {
086              throw new TokenResponseException('Error in retrieving token.');
087          }
088   
089          return $this->parseAccessTokenResponse($responseBody);
090      }
091   
092      /**
093       * {@inheritdoc}
094       */
095      protected function parseAccessTokenResponse($responseBody)
096      {
097          parse_str($responseBody, $data);
098   
099          if (null === $data || !is_array($data)) {
100              throw new TokenResponseException('Unable to parse response.');
101          } elseif (isset($data['error'])) {
102              throw new TokenResponseException(
103                  'Error in retrieving token: "' . $data['error'] . '"'
104              );
105          }
106   
107          $token = new StdOAuth1Token();
108   
109          $token->setRequestToken($data['oauth_token']);
110          $token->setRequestTokenSecret($data['oauth_token_secret']);
111          $token->setAccessToken($data['oauth_token']);
112          $token->setAccessTokenSecret($data['oauth_token_secret']);
113   
114          $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES);
115          unset($data['oauth_token'], $data['oauth_token_secret']);
116          $token->setExtraParams($data);
117   
118          return $token;
119      }
120  }
121