Update of /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_eventwrapper
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27198/serendipity_plugin_eventwrapper
Added Files:
serendipity_plugin_eventwrapper.php
Log Message:
New event-wrapper plugin. Whenever an event plugin generates data, it can't be displayed in the sidebar. Thus this wrapper-plugin can wrap generated data inside an event to display in a sidebar. See the content-rewrite plugin for example usage. This way, the needed data can stay within the event plugin container.
--- NEW FILE: serendipity_plugin_eventwrapper.php ---
<?php # $Id: serendipity_plugin_eventwrapper.php,v 1.1 2004/02/09 15:14:21 garvinhicking Exp $
switch ($serendipity['lang']) {
case 'de':
@define('PLUGIN_EVENT_WRAPPER_NAME', 'Event-Ausgabe Wrapper');
@define('PLUGIN_EVENT_WRAPPER_DESC', 'Zeigt die Ausgabedaten eines Event-Plugins an');
@define('PLUGIN_EVENT_WRAPPER_PLUGIN', 'Quell Event-Plugin');
@define('PLUGIN_EVENT_WRAPPER_PLUGINDESC', 'Wählen Sie das Event-Plugin aus, für das die Ausgabe dargestellt werden soll');
@define('PLUGIN_EVENT_WRAPPER_TITLEDESC', 'Geben Sie den Titel für die Sidebar an. Die Eingabe eines leeren Titels zeigt den des Event-Plugins an.');
break;
case 'en':
case 'es':
default:
@define('PLUGIN_EVENT_WRAPPER_NAME', 'Event-Output wrapper');
@define('PLUGIN_EVENT_WRAPPER_DESC', 'Displays gathered data by a certain event plugin');
@define('PLUGIN_EVENT_WRAPPER_PLUGIN', 'Source event plugin');
@define('PLUGIN_EVENT_WRAPPER_PLUGINDESC', 'Select the event plugin for which the output should be displayed');
@define('PLUGIN_EVENT_WRAPPER_TITLEDESC', 'Enter the title for this sidebar item (leave empty for inheritance by event plugin)');
break;
}
class serendipity_plugin_eventwrapper extends serendipity_plugin
{
var $rewrite_from, $rewrite_to;
function introspect(&$propbag)
{
global $serendipity;
$propbag->add('name', PLUGIN_EVENT_WRAPPER_NAME);
$propbag->add('description', PLUGIN_EVENT_WRAPPER_DESC);
$propbag->add('configuration', array('event_plugin', 'title'));
}
function introspect_config_item($name, &$propbag)
{
global $serendipity;
switch($name) {
case 'event_plugin':
$plugins = serendipity_plugin_api::get_event_plugins();
$select = array();
if (is_array($plugins)) {
foreach($plugins AS $plugname => $plugarray) {
$select[$plugname] = $plugarray['t'];
}
}
$propbag->add('type', 'select');
$propbag->add('name', PLUGIN_EVENT_WRAPPER_PLUGIN);
$propbag->add('description', PLUGIN_EVENT_WRAPPER_PLUGINDESC);
$propbag->add('select_values', $select);
break;
case 'title':
$propbag->add('type', 'string');
$propbag->add('name', TITLE);
$propbag->add('description', PLUGIN_EVENT_WRAPPER_TITLEDESC);
break;
default:
return false;
}
return true;
}
function generate_content(&$title)
{
$bag = new serendipity_property_bag;
$this->introspect($bag);
$wrap = &serendipity_plugin_api::get_event_plugins($this->get_config('event_plugin'));
$faketitle = '';
if (is_object($wrap)) {
$wrap->generate_content($faketitle);
}
if ($this->get_config('title') != '') {
$title = $this->get_config('title');
} else {
$title = $faketitle;
}
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>
|