-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomHeadBodyContentPlugin.php
More file actions
56 lines (50 loc) · 1.32 KB
/
CustomHeadBodyContentPlugin.php
File metadata and controls
56 lines (50 loc) · 1.32 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
<?php
class CustomHeadBodyContentPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array(
'install',
'uninstall',
'config_form',
'config',
'public_head',
'public_footer',
);
public function hookInstall()
{
set_option('custom_head_content', '');
set_option('custom_body_content', '');
}
public function hookUninstall()
{
delete_option('custom_head_content');
delete_option('custom_body_content');
}
public function hookConfigForm()
{
include 'views/admin/config_form.php';
}
public function hookConfig($args)
{
$post = $args['post'];
if (isset($post['custom_head_content'])) {
set_option('custom_head_content', $post['custom_head_content']);
}
if (isset($post['custom_body_content'])) {
set_option('custom_body_content', $post['custom_body_content']);
}
}
public function hookPublicHead()
{
$customContent = get_option('custom_head_content');
if ($customContent) {
echo $customContent;
}
}
public function hookPublicFooter()
{
$customContent = get_option('custom_body_content');
if ($customContent) {
echo $customContent;
}
}
}