-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslideshareapi.module
More file actions
80 lines (70 loc) · 2.51 KB
/
slideshareapi.module
File metadata and controls
80 lines (70 loc) · 2.51 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* Implementation of hook_menu
*/
function slideshareapi_menu(){
$items = array();
$items['admin/settings/slideshareapi'] = array(
'access arguments' => array('administer site configuration'),
'description' => 'Configure slideshareapi integration with Slideshare.net.',
'page callback' => 'drupal_get_form',
'page arguments' => array('slideshareapi_settings'),
'title' => 'slideshare API',
);
return $items;
}
/**
* Initialize the slideshare api object and make the request.
* Can be used as menu callback function
* @param $method method to be called (see http://www.slideshare.net/developers/documentation)
* @param $params parameters for this request
*
* example:
* $res = slideshare_slideshare("get_slideshow", array('slideshow_id' => '5038209'));
*/
function slideshare_slideshare($method, $params){
module_load_include('inc', 'slideshareapi', 'slideshareapi.request');
$ssobject = new Slideshareapi();
return $ssobject -> request($method, $params);
}
/**
* Admin settings form
*/
function slideshareapi_settings() {
$form['slideshareapi'] = array(
'#collapsible' => TRUE,
'#title' => t('Slideshare.net API information'),
'#type' => 'fieldset',
);
$form['slideshareapi']['slideshareapi_apiurl'] = array(
'#default_value' => variable_get('slideshareapi_apiurl', 'http://www.slideshare.net/api/2/'),
'#title' => t('The base URL of the API'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['slideshareapi']['slideshareapi_key'] = array(
'#default_value' => variable_get('slideshareapi_key', ''),
'#title' => t('Slideshare.net API key'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['slideshareapi']['slideshareapi_secret'] = array(
'#default_value' => variable_get('slideshareapi_secret', ''),
'#title' => t('Slideshare.net Shared Secret key'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['slideshareapi']['slideshareapi_user'] = array(
'#default_value' => variable_get('slideshareapi_user', ''),
'#title' => t('Slideshare.net Username'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['slideshareapi']['slideshareapi_pass'] = array(
'#default_value' => variable_get('slideshareapi_pass', ''),
'#title' => t('Slideshare.net Password'),
'#type' => 'password',
'#required' => TRUE,
);
return system_settings_form($form);
}