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

Vkontakte.php

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


001  <?php
002   
003  namespace OAuth\OAuth2\Service;
004   
005  use OAuth\OAuth2\Token\StdOAuth2Token;
006  use OAuth\Common\Http\Exception\TokenResponseException;
007  use OAuth\Common\Http\Uri\Uri;
008  use OAuth\Common\Consumer\CredentialsInterface;
009  use OAuth\Common\Http\Client\ClientInterface;
010  use OAuth\Common\Storage\TokenStorageInterface;
011  use OAuth\Common\Http\Uri\UriInterface;
012   
013  class Vkontakte extends AbstractService
014  {
015      /**
016       * Defined scopes
017       *
018       * @link http://vk.com/dev/permissions
019       */
020      const SCOPE_EMAIL         = 'email';
021      const SCOPE_NOTIFY        = 'notify';
022      const SCOPE_FRIENDS       = 'friends';
023      const SCOPE_PHOTOS        = 'photos';
024      const SCOPE_AUDIO         = 'audio';
025      const SCOPE_VIDEO         = 'video';
026      const SCOPE_DOCS          = 'docs';
027      const SCOPE_NOTES         = 'notes';
028      const SCOPE_PAGES         = 'pages';
029      const SCOPE_APP_LINK      = '';
030      const SCOPE_STATUS        = 'status';
031      const SCOPE_OFFERS        = 'offers';
032      const SCOPE_QUESTIONS     = 'questions';
033      const SCOPE_WALL          = 'wall';
034      const SCOPE_GROUPS        = 'groups';
035      const SCOPE_MESSAGES      = 'messages';
036      const SCOPE_NOTIFICATIONS = 'notifications';
037      const SCOPE_STATS         = 'stats';
038      const SCOPE_ADS           = 'ads';
039      const SCOPE_OFFLINE       = 'offline';
040      const SCOPE_NOHTTPS       = 'nohttps';
041   
042      public function __construct(
043          CredentialsInterface $credentials,
044          ClientInterface $httpClient,
045          TokenStorageInterface $storage,
046          $scopes = array(),
047          UriInterface $baseApiUri = null
048      ) {
049          parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
050   
051          if (null === $baseApiUri) {
052              $this->baseApiUri = new Uri('https://api.vk.com/method/');
053          }
054      }
055   
056      /**
057       * {@inheritdoc}
058       */
059      public function getAuthorizationEndpoint()
060      {
061          return new Uri('https://oauth.vk.com/authorize');
062      }
063   
064      /**
065       * {@inheritdoc}
066       */
067      public function getAccessTokenEndpoint()
068      {
069          return new Uri('https://oauth.vk.com/access_token');
070      }
071   
072      /**
073       * {@inheritdoc}
074       */
075      protected function parseAccessTokenResponse($responseBody)
076      {
077          $data = json_decode($responseBody, true);
078   
079          if (null === $data || !is_array($data)) {
080              throw new TokenResponseException('Unable to parse response.');
081          } elseif (isset($data['error'])) {
082              throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
083          }
084   
085          $token = new StdOAuth2Token();
086          $token->setAccessToken($data['access_token']);
087          $token->setLifeTime($data['expires_in']);
088   
089          if (isset($data['refresh_token'])) {
090              $token->setRefreshToken($data['refresh_token']);
091              unset($data['refresh_token']);
092          }
093   
094          unset($data['access_token']);
095          unset($data['expires_in']);
096   
097          $token->setExtraParams($data);
098   
099          return $token;
100      }
101      
102      /**
103       * {@inheritdoc}
104       */
105      protected function getAuthorizationMethod()
106      {
107          return static::AUTHORIZATION_METHOD_QUERY_STRING;
108      }
109  }
110