Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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