3 * StatusNet, the distributed open-source microblogging tool
5 * Plugin to add additional awesomenss to StatusNet
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 Jeroen De Dauw <jeroendedauw@gmail.com>
25 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
26 * @link http://status.net/
29 if (!defined('STATUSNET')) {
34 * Fun sample plugin: tweaks input data and adds a 'Cornify' widget to sidebar.
38 * @author Jeroen De Dauw <jeroendedauw@gmail.com>
39 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
40 * @link http://status.net/
43 class AwesomenessPlugin extends Plugin
45 const VERSION = '0.0.42';
47 public function onPluginVersion(array &$versions)
50 'name' => 'Awesomeness',
51 'version' => self::VERSION,
52 'author' => 'Jeroen De Dauw',
53 'homepage' => 'http://status.net/wiki/Plugin:Awesomeness',
54 // TRANS: Plugin description for a sample plugin.
55 'rawdescription' => _m('The Awesomeness plugin adds additional awesomeness ' .
56 'to a StatusNet installation.'
63 * Add the conrnify button
65 * @param Action $action the current action
69 function onEndShowSections(Action $action)
71 $action->elementStart('div', array('id' => 'cornify_section',
72 'class' => 'section'));
76 <a href="http://www.cornify.com" onclick="cornify_add();return false;">
77 <img src="http://www.cornify.com/assets/cornify.gif" width="61" height="16" border="0" alt="Cornify" />
79 <script type="text/javascript">(function() {
80 var js = document.createElement('script');
81 js.type = 'text/javascript';
83 js.src = 'http://www.cornify.com/js/cornify.js';
84 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(js);
89 $action->elementEnd('div');
93 * Hook for new-notice form processing to take our HTML goodies;
94 * won't affect API posting etc.
96 * @param NewNoticeAction $action
98 * @param string $content
99 * @param array $options
100 * @return boolean hook return
102 function onStartSaveNewNoticeWeb($action, $user, &$content, &$options)
104 $content = htmlspecialchars($content);
105 $options['rendered'] = preg_replace("/(^|\s|-)((?:awesome|awesomeness)[\?!\.\,]?)(\s|$)/i", " <b>$2</b> ", $content);