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
|
|
|
* Link: http://trac.shishnet.org/shimmie2/
|
|
|
|
* 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
|
2007-05-06 19:01:26 +00:00
|
|
|
*
|
|
|
|
* This is currently the only example of a user-contributed extension~
|
2007-05-04 22:23:16 +00:00
|
|
|
*/
|
|
|
|
class SiteDescription extends Extension {
|
|
|
|
public function receive_event($event) {
|
|
|
|
if(is_a($event, '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
|
|
|
}
|
|
|
|
}
|
|
|
|
if(is_a($event, 'SetupBuildingEvent')) {
|
|
|
|
$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());
|
|
|
|
?>
|