forked from RiverVanRain/contactus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.php
74 lines (61 loc) · 1.89 KB
/
start.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
<?php
/*
*
* Contact Us
*
* @author RiverVanRain
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
* @copyright (c) weborganiZm 2k13
*
* @link http://weborganizm.org/crewz/p/1983/personal-net
*
*/
elgg_register_event_handler('init', 'system', 'contactus_init');
/**
* Initialize the plugin
*/
function contactus_init() {
elgg_register_page_handler('contactus', 'contactus_page_handler');
elgg_extend_view('css/elgg', 'contactus/css');
elgg_extend_view('css/admin', 'contactus/admin_css');
//if (elgg_is_logged_in()) {
$href = "contactus/add";
elgg_register_menu_item('footer', array(
'name' => 'contact_this',
'href' => $href,
'title' => elgg_echo('contactus:this:tooltip'),
'text' => elgg_view_icon('contact-this') . elgg_echo('contactus:this'),
'link_class' => 'elgg-lightbox',
'priority' => 500,
'section' => 'alt',
));
//}
elgg_register_admin_menu_item('administer', 'contactus', 'administer_utilities');
elgg_register_widget_type(
'contactus',
elgg_echo('contactus'),
elgg_echo('contactus:widget:description'),
'admin');
$action_path = elgg_get_plugins_path() . "contactus/actions/contactus";
elgg_register_action('contactus/add', "$action_path/add.php",'public');
elgg_register_action('contactus/delete', "$action_path/delete.php", 'admin');
elgg_register_action('contactus/archive', "$action_path/archive.php", 'admin');
}
function contactus_page_handler($page) {
//gatekeeper();
$content .= elgg_view_title(elgg_echo('contactus:this'));
$content .= elgg_view_form('contactus/add');
$sidebar = elgg_echo('contactus:instructions');
$params = array(
'content' => $content,
'sidebar' => $sidebar,
);
$body = elgg_view_layout('one_sidebar', $params);
if (elgg_is_xhr()) {
echo elgg_view_form('contactus/add');
}
else {
echo elgg_view_page(elgg_echo('contactus:this'), $body);
}
return true;
}