diff --git a/plugins/SiteNoticeInSidebar/SiteNoticeInSidebarPlugin.php b/plugins/SiteNoticeInSidebar/SiteNoticeInSidebarPlugin.php new file mode 100644 index 0000000000..4e6aade2a5 --- /dev/null +++ b/plugins/SiteNoticeInSidebar/SiteNoticeInSidebarPlugin.php @@ -0,0 +1,92 @@ +. + * + * @category Plugin + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Put the site notice in the sidebar + * + * @category General + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class SiteNoticeInSidebarPlugin extends Plugin +{ + /** + * Function comment + * + * @param + * + * @return + */ + + function onStartShowSiteNotice($action) + { + return false; + } + + function onStartShowSections($action) + { + $text = common_config('site', 'notice'); + if (!empty($text)) { + $sns = new SiteNoticeSection($action, $text); + $sns->show(); + } + return true; + } + + function onEndShowStyles($action) + { + $action->element('style', null, '#site_notice { width: 100% }'); + return true; + } + + function onAutoload($cls) + { + $dir = dirname(__FILE__); + + switch ($cls) + { + case 'SiteNoticeSection': + include_once $dir . '/'.strtolower($cls).'.php'; + return false; + default: + return true; + } + } +} diff --git a/plugins/SiteNoticeInSidebar/sitenoticesection.php b/plugins/SiteNoticeInSidebar/sitenoticesection.php new file mode 100644 index 0000000000..37c37edaf2 --- /dev/null +++ b/plugins/SiteNoticeInSidebar/sitenoticesection.php @@ -0,0 +1,67 @@ +. + * + * @category Site + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET')) { + // This check helps protect against security problems; + // your code file can't be executed directly from the web. + exit(1); +} + +/** + * Site notice section + * + * @category Site + * @package StatusNet + * @author Evan Prodromou + * @copyright 2011 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 + * @link http://status.net/ + */ + +class SiteNoticeSection extends Section +{ + var $text; + + function __construct($action, $text) + { + parent::__construct($action); + $this->text = $text; + } + + function title() + { + return _('Site notice'); + } + + function showContent() + { + $this->out->raw($this->text); + } +}