Skip to content
Snippets Groups Projects
Commit c327d6c4 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

Some renderer plugin updates

The namingscheme for renderer plugins now matches the other types, the plugin
manager now returns info on renderer plugins, too

darcs-hash:20070120002731-7ad00-fcea93a6a6da807103b6aa82d6472196125cb3ec.gz
parent 863befa1
No related branches found
No related tags found
No related merge requests found
......@@ -513,25 +513,27 @@ function p_sort_modes($a, $b){
function p_render($mode,$instructions,& $info){
if(is_null($instructions)) return '';
// Create the renderer
$file = DOKU_INC.'lib/plugins/'.$mode.'/renderer.php';
if(!@file_exists($file)){
$file = DOKU_INC."inc/parser/$mode.php";
}
if(!@file_exists($file)){
msg("No renderer for $mode found",-1);
return null;
}
require_once $file;
// try default renderer first:
$file = DOKU_INC."inc/parser/$mode.php";
if(@file_exists($file)){
require_once $file;
$rclass = "Doku_Renderer_$mode";
$rclass = "Doku_Renderer_$mode";
if ( !class_exists($rclass) ) {
trigger_error("Unable to resolve render class $rclass",E_USER_WARNING);
msg("Renderer for $mode not valid",-1);
return null;
if ( !class_exists($rclass) ) {
trigger_error("Unable to resolve render class $rclass",E_USER_WARNING);
msg("Renderer for $mode not valid",-1);
return null;
}
$Renderer = & new $rclass();
}else{
// Maybe a plugin is available?
$Renderer =& plugin_load('renderer',$mode);
if(is_null($Renderer)){
msg("No renderer for $mode found",-1);
return null;
}
}
$Renderer = & new $rclass(); #FIXME any way to check for class existance?
$Renderer->smileys = getSmileys();
$Renderer->entities = getEntities();
......
......@@ -5,18 +5,18 @@
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Andreas Gohr <andi@splitbrain.org>
*/
// plugin related constants
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
$plugin_types = array('admin','syntax','action');
$plugin_types = array('admin','syntax','action','renderer');
/**
* Returns a list of available plugins of given type
*
* @param $type string, plugin_type name;
* the type of plugin to return,
* @param $type string, plugin_type name;
* the type of plugin to return,
* use empty string for all types
* @param $all bool;
* @param $all bool;
* false to only return enabled plugins,
* true to return both enabled and disabled plugins
*
......@@ -30,9 +30,9 @@ function plugin_list($type='',$all=false){
while (false !== ($plugin = readdir($dh))) {
if ($plugin == '.' || $plugin == '..' || $plugin == 'tmp') continue;
if (is_file(DOKU_PLUGIN.$plugin)) continue;
// if required, skip disabled plugins
if (!$all && plugin_isdisabled($plugin)) continue;
// if required, skip disabled plugins
if (!$all && plugin_isdisabled($plugin)) continue;
if ($type=='' || @file_exists(DOKU_PLUGIN."$plugin/$type.php")){
$plugins[] = $plugin;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment