@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | $servicename = $soundcloud->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: '.$soundcloud->getAuthURL(null, $scopes)); |
30 | 30 | } |
31 | 31 | // step 3: receive the access token |
32 | -elseif(isset($_GET['code'])){ // soundcloud doesn't support <state> |
|
32 | +elseif (isset($_GET['code'])) { // soundcloud doesn't support <state> |
|
33 | 33 | $token = $soundcloud->getAccessToken($_GET['code']); |
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($soundcloud->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 |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | $servicename = $flickr->serviceName; |
21 | 21 | |
22 | 22 | // step 2: redirect to the provider's login screen |
23 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
23 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
24 | 24 | header('Location: '.$flickr->getAuthURL(['perms' => Flickr::PERM_DELETE])); |
25 | 25 | } |
26 | 26 | // step 3: receive the access token |
27 | -elseif(isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])){ |
|
27 | +elseif (isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])) { |
|
28 | 28 | $token = $flickr->getAccessToken($_GET['oauth_token'], $_GET['oauth_verifier']); |
29 | 29 | |
30 | 30 | $user_name = $token->extraParams['username']; |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | header('Location: ?granted='.$servicename); |
37 | 37 | } |
38 | 38 | // step 4: verify the token and use the API |
39 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
39 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
40 | 40 | echo '<pre>'.print_r(Psr7\get_json($flickr->testLogin()), true).'</pre>'; |
41 | 41 | } |
42 | 42 | // step 1 (optional): display a login link |
43 | -else{ |
|
43 | +else { |
|
44 | 44 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
45 | 45 | } |
46 | 46 |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | |
30 | 30 | // now walk through the array and get the method info |
31 | 31 | $str = []; |
32 | -foreach($methods as $methodname){ |
|
32 | +foreach ($methods as $methodname) { |
|
33 | 33 | $methodInfo = $flickr->request('flickr.reflection.getMethodInfo', ['method_name' => $methodname], 'GET'); |
34 | 34 | $m = Psr7\get_json($methodInfo); |
35 | 35 | |
36 | - if(!$m || !isset($m->method)){ |
|
36 | + if (!$m || !isset($m->method)) { |
|
37 | 37 | $logger->debug($methodname, (array)$methodInfo->headers); |
38 | 38 | |
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $args = []; |
43 | - if(isset($m->arguments)){ |
|
44 | - foreach($m->arguments->argument as $a){ |
|
43 | + if (isset($m->arguments)) { |
|
44 | + foreach ($m->arguments->argument as $a) { |
|
45 | 45 | |
46 | - if($a->name !== 'api_key'){ |
|
46 | + if ($a->name !== 'api_key') { |
|
47 | 47 | $args[] = $a->name; |
48 | 48 | } |
49 | 49 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | \array_shift($name); // remove the "flickr" |
56 | 56 | |
57 | - foreach($name as $k => $parts){ |
|
57 | + foreach ($name as $k => $parts) { |
|
58 | 58 | $name[$k] = \ucfirst($parts); |
59 | 59 | } |
60 | 60 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | use chillerlan\OAuth\Providers\Instagram\Instagram; |
14 | 14 | |
15 | 15 | /** @var \chillerlan\OAuth\Providers\Instagram\Instagram $instagram */ |
16 | -$instagram = null; |
|
16 | +$instagram = null; |
|
17 | 17 | |
18 | 18 | require_once __DIR__.'/instagram-common.php'; |
19 | 19 | |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | $servicename = $instagram->serviceName; |
30 | 30 | |
31 | 31 | // step 2: redirect to the provider's login screen |
32 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
32 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
33 | 33 | header('Location: '.$instagram->getAuthURL(null, $scopes)); |
34 | 34 | } |
35 | 35 | // step 3: receive the access token |
36 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
36 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
37 | 37 | $token = $instagram->getAccessToken($_GET['code'], $_GET['state']); |
38 | 38 | |
39 | 39 | $user = $token->extraParams['user']; |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | header('Location: ?granted='.$servicename); |
45 | 45 | } |
46 | 46 | // step 4: verify the token and use the API |
47 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
47 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
48 | 48 | echo '<pre>'.print_r(Psr7\get_json($instagram->profile('self')), true).'</pre>'; |
49 | 49 | } |
50 | 50 | // step 1 (optional): display a login link |
51 | -else{ |
|
51 | +else { |
|
52 | 52 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
53 | 53 | } |
54 | 54 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | $servicename = $github->serviceName; |
27 | 27 | |
28 | 28 | // step 2: redirect to the provider's login screen |
29 | -if(isset($_GET['login']) && $_GET['login'] === $servicename){ |
|
29 | +if (isset($_GET['login']) && $_GET['login'] === $servicename) { |
|
30 | 30 | header('Location: '.$github->getAuthURL(null, $scopes)); |
31 | 31 | } |
32 | 32 | // step 3: receive the access token |
33 | -elseif(isset($_GET['code']) && isset($_GET['state'])){ |
|
33 | +elseif (isset($_GET['code']) && isset($_GET['state'])) { |
|
34 | 34 | $token = $github->getAccessToken($_GET['code'], $_GET['state']); |
35 | 35 | |
36 | 36 | // save the token [...] |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | header('Location: ?granted='.$servicename); |
40 | 40 | } |
41 | 41 | // step 4: verify the token and use the API |
42 | -elseif(isset($_GET['granted']) && $_GET['granted'] === $servicename){ |
|
42 | +elseif (isset($_GET['granted']) && $_GET['granted'] === $servicename) { |
|
43 | 43 | echo '<pre>'.print_r(Psr7\get_json($github->me()), true).'</pre>'; |
44 | 44 | } |
45 | 45 | // step 1 (optional): display a login link |
46 | -else{ |
|
46 | +else { |
|
47 | 47 | echo '<a href="?login='.$servicename.'">connect with '.$servicename.'!</a>'; |
48 | 48 | } |
49 | 49 |