aboutsummaryrefslogtreecommitdiff
path: root/mod/editablecomments/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/editablecomments/start.php')
-rw-r--r--mod/editablecomments/start.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/mod/editablecomments/start.php b/mod/editablecomments/start.php
new file mode 100644
index 000000000..3c174531e
--- /dev/null
+++ b/mod/editablecomments/start.php
@@ -0,0 +1,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;
+}