aboutsummaryrefslogtreecommitdiff
path: root/mod/editablecomments/start.php
blob: 3c174531e5bbe2f9513144d3c5119d85f146a40b (plain)
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
<?php
/**
 * Editable Comments -- Make comments editable
 *
 * @package        Lorea
 * @subpackage     EditableComments
 * @homepage       https://lorea.org/plugin/editablecomments
 * @copyright      2012 Lorea Faeries <federation@lorea.org>
 * @license        COPYING, http://www.gnu.org/licenses/agpl
 *
 * Copyright 2012 Lorea Faeries <federation@lorea.org>
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License
 * as published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */

elgg_register_event_handler('init', 'system', 'editablecomments_init');

/**
 * Initialise the editable comments plugin
 */
function editablecomments_init() {
	$actions_dir = elgg_get_plugins_path() . "editablecomments/actions/comments";
	elgg_register_action('comments/edit', "$actions_dir/edit.php");
	
	elgg_register_plugin_hook_handler('register', 'menu:annotation', 'editablecomments_annotation_menu');
}

function editablecomments_annotation_menu($hook, $type, $return, $params) {
	$annotation = $params['annotation'];
	$id = $annotation->id;
	if ($annotation->canEdit()) {
		$return[] = new ElggMenuItem('edit_annotation', elgg_echo('edit'), "#edit-annotation-$id");
	}
	return $return;
}