-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalyticsPlugin.php
More file actions
75 lines (66 loc) · 1.57 KB
/
AnalyticsPlugin.php
File metadata and controls
75 lines (66 loc) · 1.57 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
<?php
/**
* Analytics plugin main class
*
* @author Tim Hollies
*/
class AnalyticsPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'public_head',
'neatline_public_static',
'install',
'config',
'config_form',
'uninstall'
);
/**
* @var array Options that are used in the analytics plugin.
*/
protected $_options = array(
'property_id' => 'UA-XXXXX-Y',
);
/**
* Create the duration type format options form
*
* @param $args array
*/
public function hookPublicHead() {
echo get_view()->partial('config.php', array( "property_id" => get_option("property_id")));
queue_js_file('dist/omeka-analytics.min');
}
public function hookNeatlinePublicStatic($exhibit){
queue_js_file('dist/omeka-analytics.min');
}
/**
* Installation hook.
*/
public function hookInstall()
{
$this->_installOptions();
}
/**
* Uninstalls any options that have been set.
*/
public function hookUninstall()
{
$this->_uninstallOptions();
}
/**
* Set the options from the Config form.
*/
public function hookConfig()
{
foreach (array_keys($this->_options) as $key)
{
set_option($key, trim($_POST[$key]));
}
}
/**
* Displays the configuration form.
*/
public function hookConfigForm()
{
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'views'. DIRECTORY_SEPARATOR . 'config_form.php';
}
}