@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | use chillerlan\OAuth\Providers\Wordpress\Wordpress; |
| 14 | 14 | |
| 15 | 15 | /** @var \chillerlan\OAuth\Providers\Wordpress\Wordpress $wordpress */ |
| 16 | -$wordpress = null; |
|
| 16 | +$wordpress = null; |
|
| 17 | 17 | |
| 18 | 18 | require_once __DIR__.'/wordpress-common.php'; |
| 19 | 19 | |
| 20 | -$scopes = [ |
|
| 20 | +$scopes = [ |
|
| 21 | 21 | # Wordpress::SCOPE_AUTH, |
| 22 | 22 | Wordpress::SCOPE_GLOBAL, |
| 23 | 23 | ]; |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | $servicename = $wordpress->serviceName; |
| 26 | 26 | |
| 27 | 27 | // step 2: redirect to the provider's login screen |
| 28 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
| 28 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
| 29 | 29 | header('Location: '.$wordpress->getAuthURL(null, $scopes)); |
| 30 | 30 | } |
| 31 | 31 | // step 3: receive the access token |
| 32 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
| 32 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
| 33 | 33 | $token = $wordpress->getAccessToken($_GET['code'], $_GET['state']); |
| 34 | 34 | |
| 35 | 35 | // save the token [...] |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | header('Location: ?granted='.$servicename); |
| 39 | 39 | } |
| 40 | 40 | // step 4: verify the token and use the API |
| 41 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
| 41 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
| 42 | 42 | echo '<pre>'.print_r(Psr7\get_json($wordpress->me()), true).'</pre>'; |
| 43 | 43 | } |
| 44 | 44 | // step 1 (optional): display a login link |
| 45 | -else{ |
|
| 45 | +else { |
|
| 46 | 46 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | use chillerlan\OAuth\Providers\Vimeo\Vimeo; |
| 14 | 14 | |
| 15 | 15 | /** @var \chillerlan\OAuth\Providers\Vimeo\Vimeo $vimeo */ |
| 16 | -$vimeo = null; |
|
| 16 | +$vimeo = null; |
|
| 17 | 17 | |
| 18 | 18 | require_once __DIR__.'/vimeo-common.php'; |
| 19 | 19 | |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | $servicename = $vimeo->serviceName; |
| 35 | 35 | |
| 36 | 36 | // step 2: redirect to the provider's login screen |
| 37 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
| 37 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
| 38 | 38 | header('Location: '.$vimeo->getAuthURL(null, $scopes)); |
| 39 | 39 | } |
| 40 | 40 | // step 3: receive the access token |
| 41 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
| 41 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
| 42 | 42 | $token = $vimeo->getAccessToken($_GET['code'], $_GET['state']); |
| 43 | 43 | |
| 44 | 44 | $app = $token->extraParams['app']; |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | header('Location: ?granted='.$servicename); |
| 50 | 50 | } |
| 51 | 51 | // step 4: verify the token and use the API |
| 52 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
| 53 | - echo '<pre>'.print_r(Psr7\get_json($vimeo->verifyToken()),true).'</pre>'; |
|
| 52 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
| 53 | + echo '<pre>'.print_r(Psr7\get_json($vimeo->verifyToken()), true).'</pre>'; |
|
| 54 | 54 | } |
| 55 | 55 | // step 1 (optional): display a login link |
| 56 | -else{ |
|
| 56 | +else { |
|
| 57 | 57 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -25,4 +25,4 @@ |
||
| 25 | 25 | |
| 26 | 26 | require_once __DIR__.'/../provider-example-common.php'; |
| 27 | 27 | |
| 28 | -$vimeo = new \chillerlan\OAuth\Providers\Vimeo\Vimeo($http, $storage, $options, $logger); |
|
| 28 | +$vimeo = new \chillerlan\OAuth\Providers\Vimeo\Vimeo($http, $storage, $options, $logger); |
|
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | $servicename = $osm->serviceName; |
| 22 | 22 | |
| 23 | 23 | // step 2: redirect to the provider's login screen |
| 24 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
| 24 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
| 25 | 25 | header('Location: '.$osm->getAuthURL()); |
| 26 | 26 | } |
| 27 | 27 | // step 3: receive the access token |
| 28 | -elseif(isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])){ |
|
| 28 | +elseif (isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])) { |
|
| 29 | 29 | $token = $osm->getAccessToken($_GET['oauth_token'], $_GET['oauth_verifier']); |
| 30 | 30 | |
| 31 | 31 | // save the token [...] |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | header('Location: ?granted='.$servicename); |
| 35 | 35 | } |
| 36 | 36 | // step 4: verify the token and use the API |
| 37 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
| 37 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
| 38 | 38 | echo '<pre>'.print_r(Psr7\get_xml($osm->userDetails()), true).'</pre>'; |
| 39 | 39 | } |
| 40 | 40 | // step 1 (optional): display a login link |
| 41 | -else{ |
|
| 41 | +else { |
|
| 42 | 42 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | require_once __DIR__.'/opencaching-common.php'; |
| 22 | 22 | |
| 23 | 23 | // step 2: redirect to the provider's login screen |
| 24 | -if(isset($_GET['login']) && $_GET['login'] === $okapi->serviceName){ |
|
| 24 | +if (isset($_GET['login']) && $_GET['login'] === $okapi->serviceName) { |
|
| 25 | 25 | header('Location: '.$okapi->getAuthURL(['oauth_callback' => $options->callbackURL])); |
| 26 | 26 | } |
| 27 | 27 | // step 3: receive the access token |
| 28 | -elseif(isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])){ |
|
| 28 | +elseif (isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])) { |
|
| 29 | 29 | $token = $okapi->getAccessToken($_GET['oauth_token'], $_GET['oauth_verifier']); |
| 30 | 30 | |
| 31 | 31 | // save the token [...] |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | header('Location: ?granted='.$okapi->serviceName); |
| 35 | 35 | } |
| 36 | 36 | // step 4: verify the token and use the API |
| 37 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $okapi->serviceName){ |
|
| 37 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $okapi->serviceName) { |
|
| 38 | 38 | echo '<pre>'.print_r(Psr7\get_json($okapi->usersUser(['fields' => 'username'])), true).'</pre>'; |
| 39 | 39 | } |
| 40 | 40 | // step 1 (optional): display a login link |
| 41 | -else{ |
|
| 41 | +else { |
|
| 42 | 42 | echo '<a href="?login='.$okapi->serviceName.'">connect with '.$okapi->serviceName.'!</a>'; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | // now walk through the array and get the method info |
| 29 | 29 | $str = []; |
| 30 | 30 | |
| 31 | -foreach($methods as $methodname){ |
|
| 31 | +foreach ($methods as $methodname) { |
|
| 32 | 32 | |
| 33 | 33 | // skip auth endpoints |
| 34 | - if(strpos($methodname, 'services/oauth/') === 0){ |
|
| 34 | + if (strpos($methodname, 'services/oauth/') === 0) { |
|
| 35 | 35 | continue; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | $p = str_replace('services/', '/', $m->name); |
| 41 | 41 | |
| 42 | 42 | $args = []; |
| 43 | - if(isset($m->arguments)){ |
|
| 44 | - foreach($m->arguments as $a){ |
|
| 43 | + if (isset($m->arguments)) { |
|
| 44 | + foreach ($m->arguments as $a) { |
|
| 45 | 45 | $args[] = $a->name; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | // camelize path |
| 50 | 50 | $name = explode('/', $p); |
| 51 | 51 | |
| 52 | - foreach($name as $k => $part){ |
|
| 52 | + foreach ($name as $k => $part) { |
|
| 53 | 53 | |
| 54 | 54 | // camelize underscored part |
| 55 | 55 | $np = explode('_', $part); |
| 56 | 56 | |
| 57 | - foreach($np as $j => $pp){ |
|
| 57 | + foreach ($np as $j => $pp) { |
|
| 58 | 58 | $np[$j] = ucfirst($pp); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | $servicename = $google->serviceName; |
| 28 | 28 | |
| 29 | 29 | // step 2: redirect to the provider's login screen |
| 30 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
| 30 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
| 31 | 31 | header('Location: '.$google->getAuthURL(['access_type' => 'online'], $scopes)); |
| 32 | 32 | } |
| 33 | 33 | // step 3: receive the access token |
| 34 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
| 34 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
| 35 | 35 | $token = $google->getAccessToken($_GET['code'], $_GET['state']); |
| 36 | 36 | |
| 37 | 37 | // save the token [...] |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | header('Location: ?granted='.$servicename); |
| 41 | 41 | } |
| 42 | 42 | // step 4: verify the token and use the API |
| 43 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
| 43 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
| 44 | 44 | echo '<pre>'.print_r(Psr7\get_json($google->me()), true).'</pre>'; |
| 45 | 45 | } |
| 46 | 46 | // step 1 (optional): display a login link |
| 47 | -else{ |
|
| 47 | +else { |
|
| 48 | 48 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | $servicename = $discord->serviceName; |
| 36 | 36 | |
| 37 | 37 | // step 2: redirect to the provider's login screen |
| 38 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
| 38 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
| 39 | 39 | header('Location: '.$discord->getAuthURL(null, $scopes)); |
| 40 | 40 | } |
| 41 | 41 | // step 3: receive the access token |
| 42 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
| 42 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
| 43 | 43 | $token = $discord->getAccessToken($_GET['code'], $_GET['state']); |
| 44 | 44 | |
| 45 | 45 | // save the token [...] |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | header('Location: ?granted='.$servicename); |
| 49 | 49 | } |
| 50 | 50 | // step 4: verify the token and use the API |
| 51 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
| 51 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
| 52 | 52 | echo '<pre>'.print_r(Psr7\get_json($discord->me()), true).'</pre>'; |
| 53 | 53 | } |
| 54 | 54 | // step 1 (optional): display a login link |
| 55 | -else{ |
|
| 55 | +else { |
|
| 56 | 56 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | $servicename = $deezer->serviceName; |
| 31 | 31 | |
| 32 | 32 | // step 2: redirect to the provider's login screen |
| 33 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
| 33 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
| 34 | 34 | header('Location: '.$deezer->getAuthURL(null, $scopes)); |
| 35 | 35 | } |
| 36 | 36 | // step 3: receive the access token |
| 37 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
| 37 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
| 38 | 38 | $token = $deezer->getAccessToken($_GET['code'], $_GET['state']); |
| 39 | 39 | |
| 40 | 40 | // save the token [...] |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | header('Location: ?granted='.$servicename); |
| 44 | 44 | } |
| 45 | 45 | // step 4: verify the token and use the API |
| 46 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
| 46 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
| 47 | 47 | echo '<pre>'.print_r(Psr7\get_json($deezer->me()), true).'</pre>'; |
| 48 | 48 | } |
| 49 | 49 | // step 1 (optional): display a login link |
| 50 | -else{ |
|
| 50 | +else { |
|
| 51 | 51 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
| 52 | 52 | } |
| 53 | 53 | |