-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFlickrImportPlugin.php
More file actions
131 lines (112 loc) · 2.72 KB
/
FlickrImportPlugin.php
File metadata and controls
131 lines (112 loc) · 2.72 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/**
* Flickr plugin
*
* @package FlickrImport
* @copyright Copyright 2014 UCSC Library Digital Initiatives
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* FlickrImport plugin class
*/
class FlickrImportPlugin extends Omeka_Plugin_AbstractPlugin
{
/**
* @var array Hooks for the plugin.
*/
protected $_hooks = array('install','uninstall','initialize','define_acl','admin_head','config','config_form');
/**
* @var array Filters for the plugin.
*/
protected $_filters = array('admin_navigation_main');
/**
* @var array Options and their default values.
*/
protected $_options = array(
'flickrBackgroundErrors' => '',
'flickr_api_key' => ''
);
/**
* Require the job file
*
* @return void
*/
public function hookInitialize()
{
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'jobs' . DIRECTORY_SEPARATOR . 'import.php';
}
/**
* Install the options
*
* @return void
*/
public function hookInstall()
{
$this->_installOptions();
}
/**
* Uninstall the options
*
* @return void
*/
public function hookUninstall()
{
$this->_uninstallOptions();
}
/**
* Queue the javascript and css files to help the form work.
*
* This function runs before the admin section of the sit loads.
* It queues the javascript and css files which help the form work,
* so that they are loaded before any html output.
*
* @return void
*/
public function hookAdminHead()
{
queue_js_file('FlickrImport');
queue_css_file('FlickrImport');
}
/**
* Define the plugin's access control list.
*
* @param array $args This array contains a reference to
* the zend ACL under it's 'acl' key.
* @return void
*/
public function hookDefineAcl($args)
{
$args['acl']->addResource('FlickrImport_Index');
$args['acl']->allow('contributor','FlickrImport_Index');
}
/**
* Add the SedMeta link to the admin main navigation.
*
* @param array $nav Array of links for admin nav section
* @return array $nav Updated array of links for admin nav section
*/
public function filterAdminNavigationMain($nav)
{
$nav[] = array(
'label' => __('Flickr Import'),
'uri' => url('flickr-import'),
'resource' => 'FlickrImport_Index',
'privilege' => 'index'
);
return $nav;
}
/**
* Display the plugin config form.
*/
public function hookConfigForm()
{
require dirname(__FILE__) . '/forms/config_form.php';
}
/**
* Set the options from the config form input.
*/
public function hookConfig()
{
set_option('flickr_api_key', $_POST['flickr-api-key']);
}
}