2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2008-04-11 06:12:07 +00:00
|
|
|
/**
|
|
|
|
* Name: News
|
|
|
|
* Author: Shish <webmaster@shishnet.org>
|
|
|
|
* License: GPLv2
|
2009-01-15 23:02:05 -08:00
|
|
|
* Description: Show a short amount of text in a block on the post list
|
2009-01-16 00:18:41 -08:00
|
|
|
* Documentation:
|
|
|
|
* Any HTML is allowed
|
2008-04-11 06:12:07 +00:00
|
|
|
*/
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2008-08-23 12:08:19 +00:00
|
|
|
class News implements Extension {
|
2007-06-30 01:19:11 +00:00
|
|
|
var $theme;
|
|
|
|
|
2008-08-23 12:08:19 +00:00
|
|
|
public function receive_event(Event $event) {
|
2008-09-06 16:59:02 +00:00
|
|
|
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
2009-01-04 11:18:37 -08:00
|
|
|
|
2008-08-22 09:41:30 +00:00
|
|
|
if($event instanceof PostListBuildingEvent) {
|
2009-01-04 08:35:39 -08:00
|
|
|
if(strlen($event->context->config->get_string("news_text")) > 0) {
|
|
|
|
$this->theme->display_news($event->page, $event->context->config->get_string("news_text"));
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-17 18:07:18 +00:00
|
|
|
|
2008-08-22 09:41:30 +00:00
|
|
|
if($event instanceof SetupBuildingEvent) {
|
2007-04-16 11:58:25 +00:00
|
|
|
$sb = new SetupBlock("News");
|
|
|
|
$sb->add_longtext_option("news_text");
|
2007-06-30 01:19:11 +00:00
|
|
|
$event->panel->add_block($sb);
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_event_listener(new News());
|
|
|
|
?>
|