-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCuratescapeAdminHelperPlugin.php
91 lines (78 loc) · 3.22 KB
/
CuratescapeAdminHelperPlugin.php
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
<?php
include dirname(__FILE__) . '/helpers.php';
class CuratescapeAdminHelperPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'install',
'admin_head',
'admin_footer',
'config',
'config_form',
'uninstall',
'upgrade',
);
protected $_options = array(
'cah_enable_dashboard_stats' => 1,
'cah_enable_dashboard_resources' => 1,
'cah_enable_dashboard_components' => 1,
'cah_enable_item_file_tab_notes' => 1,
'cah_enable_item_file_toggle_dc' => 1,
'cah_enable_file_edit_links' => 1,
'cah_theme_options_accordion'=>1,
'cah_hide_add_input_where_unsupported'=>1,
'cah_hide_html_checkbox_where_unsupported'=>1,
'cah_inactive_users_helper'=>1
);
public function hookConfig()
{
// config form save
set_option('cah_enable_dashboard_stats', (int)(boolean)$_POST['cah_enable_dashboard_stats']);
set_option('cah_enable_dashboard_resources', (int)(boolean)$_POST['cah_enable_dashboard_resources']);
set_option('cah_enable_dashboard_components', (int)(boolean)$_POST['cah_enable_dashboard_components']);
set_option('cah_enable_item_file_tab_notes', (int)(boolean)$_POST['cah_enable_item_file_tab_notes']);
set_option('cah_enable_item_file_toggle_dc', (int)(boolean)$_POST['cah_enable_item_file_toggle_dc']);
set_option('cah_enable_file_edit_links', (int)(boolean)$_POST['cah_enable_file_edit_links']);
set_option('cah_theme_options_accordion', (int)(boolean)$_POST['cah_theme_options_accordion']);
set_option('cah_hide_add_input_where_unsupported', (int)(boolean)$_POST['cah_hide_add_input_where_unsupported']);
set_option('cah_hide_html_checkbox_where_unsupported', (int)(boolean)$_POST['cah_hide_html_checkbox_where_unsupported']);
set_option('cah_inactive_users_helper', (int)(boolean)$_POST['cah_inactive_users_helper']);
}
public function hookConfigForm()
{
// config form
require dirname(__FILE__) . '/config_form.php';
}
public function hookAdminHead()
{
// header scripts: admin styles
require dirname(__FILE__) . '/functions/admin_head.php';
}
public function hookAdminFooter()
{
// footer scripts: admin dashboard enhancements
require dirname(__FILE__) . '/functions/admin_footer.php';
}
public function hookInstall()
{
// install scripts: plugin options
$this->_installOptions();
// install scripts: create custom item type and elements
require dirname(__FILE__) . '/functions/install.php';
}
public function hookUpgrade($args)
{
if (version_compare($args['old_version'], '1.1', '<')) {
set_option('cah_hide_add_input_where_unsupported', 1);
}
if (version_compare($args['old_version'], '1.2', '<')) {
set_option('cah_hide_html_checkbox_where_unsupported', 1);
}
if (version_compare($args['old_version'], '1.6', '<')) {
set_option('cah_inactive_users_helper', 1);
}
}
public function hookUninstall()
{
$this->_uninstallOptions();
}
}