. * * @category Plugin * @package StatusNet * @author Jeroen De Dauw * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } /** * Fun sample plugin: tweaks input data and adds a 'Cornify' widget to sidebar. * * @category Plugin * @package StatusNet * @author Jeroen De Dauw * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ class AwesomenessPlugin extends Plugin { const VERSION = '0.0.42'; public function onPluginVersion(array &$versions) { $versions[] = array( 'name' => 'Awesomeness', 'version' => self::VERSION, 'author' => 'Jeroen De Dauw', 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/Awesomeness', // TRANS: Plugin description for a sample plugin. 'rawdescription' => _m('The Awesomeness plugin adds additional awesomeness ' . 'to a StatusNet installation.' ) ); return true; } /** * Add the conrnify button * * @param Action $action the current action * * @return void */ function onEndShowSections(Action $action) { $action->elementStart('div', array('id' => 'cornify_section', 'class' => 'section')); $action->raw( << Cornify EOT ); $action->elementEnd('div'); } /** * Hook for new-notice form processing to take our HTML goodies; * won't affect API posting etc. * * @param NewNoticeAction $action * @param User $user * @param string $content * @param array $options * @return boolean hook return */ function onStartSaveNewNoticeWeb($action, $user, &$content, &$options) { $content = htmlspecialchars($content); $options['rendered'] = preg_replace("/(^|\s|-)((?:awesome|awesomeness)[\?!\.\,]?)(\s|$)/i", " $2 ", $content); } }