Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
5 | function google($offline = true) |
||
6 | { |
||
7 | global $google; |
||
8 | if (!$google) { |
||
9 | $google = new Google\client(); |
||
10 | $google->setApplicationName('Client_Library_Examples'); |
||
11 | $google->setDeveloperKey(CONFIG['google']['key']); |
||
12 | $google->setClientId(CONFIG['google']['client']); |
||
13 | $google->setClientSecret(CONFIG['google']['secret']); |
||
14 | $google->set_offline($offline) |
||
|
|||
15 | ->set_scope([ |
||
16 | 'https://www.googleapis.com/auth/youtube.readonly', |
||
17 | 'https://www.googleapis.com/auth/userinfo.email', |
||
18 | 'https://www.googleapis.com/auth/userinfo.profile', |
||
19 | 'https://www.googleapis.com/auth/drive', |
||
20 | 'https://www.googleapis.com/auth/youtube.force-ssl', |
||
21 | ]) |
||
22 | ->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/google/callback'); |
||
23 | } |
||
24 | return $google; |
||
25 | } |
||
26 |