2007-05-04 22:23:16 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Name: Site Description
|
|
|
|
* Author: Shish <webmaster@shishnet.org>
|
2007-05-06 19:01:26 +00:00
|
|
|
* License: GPLv2
|
2007-05-04 22:23:16 +00:00
|
|
|
* Description: Sets the "description" meta-info in the page header, for
|
|
|
|
* eg search engines to read
|
|
|
|
*/
|
2008-08-23 12:08:19 +00:00
|
|
|
class SiteDescription implements Extension {
|
|
|
|
public function receive_event(Event $event) {
|
2008-08-22 09:41:30 +00:00
|
|
|
if($event instanceof PageRequestEvent) {
|
2007-07-17 07:45:35 +00:00
|
|
|
global $config;
|
2007-05-04 22:23:16 +00:00
|
|
|
if(strlen($config->get_string("site_description")) > 0) {
|
|
|
|
$description = $config->get_string("site_description");
|
2007-07-17 07:45:35 +00:00
|
|
|
$event->page->add_header("<meta name=\"description\" content=\"$description\">");
|
2007-05-04 22:23:16 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-22 09:41:30 +00:00
|
|
|
if($event instanceof SetupBuildingEvent) {
|
2007-05-04 22:23:16 +00:00
|
|
|
$sb = new SetupBlock("Site Description");
|
|
|
|
$sb->add_longtext_option("site_description");
|
2007-06-30 01:19:11 +00:00
|
|
|
$event->panel->add_block($sb);
|
2007-05-04 22:23:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_event_listener(new SiteDescription());
|
|
|
|
?>
|