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

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
parent a46d0d65
No related branches found
No related tags found
No related merge requests found
......@@ -6,20 +6,41 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
/**
* 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);
......
......@@ -207,7 +207,8 @@ function tpl_metaheaders(){
ptln('<script language="javascript" type="text/javascript" charset="utf-8" src="'.
DOKU_BASE.'lib/scripts/domTT.js"></script>',$it);
//FIXME include some default CSS ? IE FIX?
// plugin stylesheets
plugin_printCSS();
}
/**
......@@ -603,7 +604,7 @@ function tpl_mediafilelist(){
search($data,$conf['mediadir'],'search_media',array(),$dir);
if(!count($data)){
ptln('<div class="nothing">'.$lang['nothingfound'].'<div>');
ptln('<div class="nothing">'.$lang['nothingfound'].'</div>');
return;
}
......
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