3 * StatusNet, the distributed open-source microblogging tool
5 * Plugin to add Echo/JS-Kit commenting to notice pages
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Zach Copley <zach@status.net>
25 * @copyright 2010 StatusNet, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://status.net/
30 if (!defined('STATUSNET')) {
35 * Plugin to use Echo (formerly JS-Kit)
37 * This plugin adds an Echo commenting widget to each notice page on
38 * your site. To get it to work, first you'll have to sign up for Echo
39 * (a for-pay service) and register your site's URL.
41 * http://aboutecho.com/
43 * Once you've done that it's pretty straight forward to turn the
44 * plugin on; just add this to your config.php:
48 * array('div_style' => 'width:675px; padding-top:10px; position:relative; float:left;')
51 * NOTE: the 'div_style' in an optional parameter that passes in some
52 * inline CSS when creating the Echo widget. It's a shortcut to make
53 * the widget look OK with the default StatusNet theme. If you leave
54 * it out you'll have to edit your theme CSS files to make the widget
55 * look good. You can also control the way the widget looks by
56 * adding style rules to your theme.
58 * See: http://wiki.js-kit.com/Skinning-Guide#UsingCSSnbsptocustomizefontsandcolors
62 * @author Zach Copley <zach@status.net>
63 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
64 * @link http://status.net/
68 class EchoPlugin extends Plugin
70 // NOTE: The Echo documentation says that this script will change on
71 // a per site basis, but I think that's incorrect. It always seems to
73 public $script = 'http://cdn.js-kit.com/scripts/comments.js';
75 function onEndShowScripts($action)
77 if (get_class($action) == 'ShownoticeAction') {
78 $action->script($this->script);
84 function onEndShowContentBlock($action)
86 if (get_class($action) == 'ShownoticeAction') {
89 $attrs['class'] = 'js-kit-comments';
90 $attrs['permalink'] = $action->notice->uri;
91 $attrs['uniq'] = $action->notice->id;
93 // NOTE: there are some other attributes that could be useful
94 // http://wiki.js-kit.com/Echo-Behavior
96 if (!empty($this->div_style)) {
97 $attrs['style'] = $this->div_style;
100 $action->element('div', $attrs, null);
104 function onPluginVersion(&$versions)
106 $versions[] = array('name' => 'Echo',
107 'version' => STATUSNET_VERSION,
108 'author' => 'Zach Copley',
109 'homepage' => 'http://status.net/wiki/Plugin:Echo',
111 _m('Use <a href="http://aboutecho.com/">Echo</a>'.
112 ' to add commenting to notice pages.'));