1 | <?php |
---|
2 | # vim: set noexpandtab tabstop=5 shiftwidth=5: |
---|
3 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
4 | # This file is part of anonymousComment, a plugin for Dotclear. |
---|
5 | # |
---|
6 | # Copyright (c) 2009 Aurélien Bompard <aurelien@bompard.org> |
---|
7 | # |
---|
8 | # Licensed under the AGPL version 3.0. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/agpl-3.0.html |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | |
---|
13 | |
---|
14 | $core->addBehavior('publicHeadContent', |
---|
15 | array('anonymousCommentBehaviors','publicHeadContent')); |
---|
16 | $core->addBehavior('publicCommentFormBeforeContent', |
---|
17 | array('anonymousCommentBehaviors','publicCommentFormBeforeContent')); |
---|
18 | |
---|
19 | class anonymousCommentBehaviors |
---|
20 | { |
---|
21 | public static function publicHeadContent(&$core,$_ctx) |
---|
22 | { |
---|
23 | if (!$core->blog->settings->anonymous_active) { return; } |
---|
24 | // print the headers |
---|
25 | echo "\n<!-- Anonymous comments -->\n"; |
---|
26 | echo ( |
---|
27 | '<script type="text/javascript">'. |
---|
28 | '//<![CDATA['."\n". |
---|
29 | 'var anonymous_name = "'. |
---|
30 | html::escapeHTML($core->blog->settings->anonymous_name). |
---|
31 | '";'."\n". |
---|
32 | 'var anonymous_mail = "'. |
---|
33 | html::escapeHTML($core->blog->settings->anonymous_email). |
---|
34 | '";'."\n". |
---|
35 | '//]]>'. |
---|
36 | '</script>'. |
---|
37 | '<script type="text/javascript" src="'.$core->blog->getQmarkURL(). |
---|
38 | 'pf=anonymousComment/anonymousComment.js'.'"></script>'."\n" |
---|
39 | ); |
---|
40 | } |
---|
41 | |
---|
42 | public static function publicCommentFormBeforeContent(&$core,$_ctx) |
---|
43 | { |
---|
44 | if (!$core->blog->settings->anonymous_active) { return; } |
---|
45 | echo ('<p class="field"><label for="c_anonymous">'. |
---|
46 | __("Anonymous comment:")."</label>\n". |
---|
47 | '<input name="c_anonymous" id="c_anonymous" type="checkbox" />'. |
---|
48 | "</p>\n"); |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | ?> |
---|