aboutsummaryrefslogtreecommitdiff
path: root/mod/editablecomments/start.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 15:05:35 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 15:05:35 -0300
commited3335df218dca6aa14f1686454b3e265339b729 (patch)
tree93744d4ae085ce936d2353facf3d91a576b8741b /mod/editablecomments/start.php
parent4a86fa9b2e63b9d6bb0a07333d4c7d59df621270 (diff)
parent354eae084587d9a9bddb74cb8aff41c2af9e58ad (diff)
downloadelgg-ed3335df218dca6aa14f1686454b3e265339b729.tar.gz
elgg-ed3335df218dca6aa14f1686454b3e265339b729.tar.bz2
Merge commit '354eae084587d9a9bddb74cb8aff41c2af9e58ad' as 'mod/editablecomments'
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;
+}