diff options
author | Andreas Gohr <andi@splitbrain.org> | 2005-07-31 09:35:21 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2005-07-31 09:35:21 +0200 |
commit | 4b15e09d7fd735b5df41e47b6e324e0bc44fa872 (patch) | |
tree | ff13e3cd294d01118a6e1fc21de4d32b9796788f /inc/pluginutils.php | |
parent | a46d0d658b98649869f6c9660e168af3940d7c30 (diff) | |
download | rpg-4b15e09d7fd735b5df41e47b6e324e0bc44fa872.tar.gz rpg-4b15e09d7fd735b5df41e47b6e324e0bc44fa872.tar.bz2 |
Plugins can add their own CSS now
Plugins can use their own styleheets now. They are loaded in the tpl_metaheader
function.
The following files are used if existing in the plugin's directory:
style.css - overall style used always
screen.css - only used in normal view (media
darcs-hash:20050731073521-7ad00-dcece7a255d3b08a1d2da9f2444b31e628ee76ea.gz
Diffstat (limited to 'inc/pluginutils.php')
-rw-r--r-- | inc/pluginutils.php | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 6c758a1be..4988a169c 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -7,19 +7,40 @@ */ /** + * prints needed HTML to include plugin CSS files + */ +function plugin_printCSS(){ + $plugins = plugin_list(); + foreach ($plugins as $p){ + $dir = "lib/plugins/$p/"; + if(@file_exists(DOKU_INC.$dir.'style.css')){ + print ' <link rel="stylesheet" type="text/css" href="'.DOKU_BASE.$dir.'style.css" />'."\n"; + } + if(@file_exists(DOKU_INC.$dir.'screen.css')){ + print ' <link rel="stylesheet" media="screen" type="text/css" href="'.DOKU_BASE.$dir.'screen.css" />'."\n"; + } + if(@file_exists(DOKU_INC.$dir.'print.css')){ + print ' <link rel="stylesheet" media="print" type="text/css" href="'.DOKU_BASE.$dir.'print.css" />'."\n"; + } + } +} + +/** * Returns a list of available plugins of given type * + * Returns all plugins if no type given + * * @author Andreas Gohr <andi@splitbrain.org> */ -function plugin_list($type){ +function plugin_list($type=''){ $plugins = array(); if ($dh = opendir(DOKU_PLUGIN)) { while (false !== ($file = readdir($dh))) { if ($file == '.' || $file == '..') continue; if (is_file(DOKU_PLUGIN.$file)) continue; - if (@file_exists(DOKU_PLUGIN.$file.'/'.$type.'.php')){ - $plugins[] = $file; + if ($type=='' || @file_exists(DOKU_PLUGIN.$file.'/'.$type.'.php')){ + $plugins[] = $file; } } closedir($dh); |