csna_qq.module
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use Drupal\Core\Url;
/**
* @file
* The CSNA QQ module is a sub-module of the Chinese Social Networks
* Authentication (CSNA) framework allowing integration with the QQ OAuth
* protocol for Authentication/Login.
*/
/**
* Implements hook_csna_provider_info().
*/
function csna_qq_csna_provider_info() {
$providers = array();
$providers['qq'] = array(
'title' => t('QQ'),
'description' => t('Set your <strong>QQ authorized KEY</strong> and <strong>SECRET</strong> below.<br/>If you want to use an API key, you can get one at the !keylink.', array('!keylink' => \Drupal::l(t('QQ API website'), Url::fromUri('http://connect.qq.com/', array('attributes' => array('target' => '_blank')))))),
'display_title' => csna_get_qq_button_image(),
'type' => CSNA_OAUTH2,
'authorize_uri' => 'https://graph.qq.com/oauth2.0/authorize',
'access_token_uri' => 'https://graph.qq.com/oauth2.0/token',
'info_uri' => 'https://graph.qq.com/user/get_user_info',
);
return $providers;
}
/**
* Helper function for returning a themed image for the QQ display title.
*/
function csna_get_qq_button_image() {
$image_arr = array(
'path' => drupal_get_path('module', 'csna_qq') . '/qq_120x24.png',
'title' => t('Sign in with QQ'),
'alt' => t('Sign in with QQ'),
);
//return theme('image', $image_arr);
return '';
}