diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/actions.php | 2 | ||||
-rw-r--r-- | inc/admin_acl.php | 10 | ||||
-rw-r--r-- | inc/auth.php | 4 | ||||
-rw-r--r-- | inc/auth/ldap.php (renamed from inc/auth_ldap.php) | 0 | ||||
-rw-r--r-- | inc/auth/mysql.php (renamed from inc/auth_mysql.php) | 0 | ||||
-rw-r--r-- | inc/auth/pgsql.php (renamed from inc/auth_pgsql.php) | 0 | ||||
-rw-r--r-- | inc/auth/plain.php (renamed from inc/auth_plain.php) | 4 | ||||
-rw-r--r-- | inc/common.php | 10 | ||||
-rw-r--r-- | inc/html.php | 40 | ||||
-rw-r--r-- | inc/init.php | 30 | ||||
-rw-r--r-- | inc/io.php | 49 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 26 | ||||
-rw-r--r-- | inc/plugins/info/syntax.php | 110 | ||||
-rw-r--r-- | inc/plugins/syntax.php | 66 | ||||
-rw-r--r-- | inc/template.php | 19 |
15 files changed, 83 insertions, 287 deletions
diff --git a/inc/actions.php b/inc/actions.php index 25a2e14c2..aef63b94c 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -69,7 +69,7 @@ function act_dispatch(){ //call template FIXME: all needed vars available? header('Content-Type: text/html; charset=utf-8'); - include(DOKU_INC.'tpl/'.$conf['template'].'/main.php'); + include(DOKU_INC.'lib/tpl/'.$conf['template'].'/main.php'); // output for the commands is now handled in inc/templates.php // in function tpl_content() } diff --git a/inc/admin_acl.php b/inc/admin_acl.php index fcf9d9ae3..15332b3b4 100644 --- a/inc/admin_acl.php +++ b/inc/admin_acl.php @@ -43,7 +43,7 @@ function admin_acl_handler(){ } // reload ACL config - $AUTH_ACL = file('conf/acl.auth.php'); + $AUTH_ACL = file(DOKU_INC.'conf/acl.auth.php'); } /** @@ -117,7 +117,7 @@ function get_acl_config($id){ * @author Frank Schubert <frank@schokilade.de> */ function admin_acl_add($acl_scope, $acl_user, $acl_level){ - $acl_config = join("",file('conf/acl.auth.php')); + $acl_config = join("",file(DOKU_INC.'conf/acl.auth.php')); // max level for pagenames is edit if(strpos($acl_scope,'*') === false) { @@ -128,7 +128,7 @@ function admin_acl_add($acl_scope, $acl_user, $acl_level){ $new_config = $acl_config.$new_acl; - return io_saveFile("conf/acl.auth.php", $new_config); + return io_saveFile(DOKU_INC.'conf/acl.auth.php', $new_config); } /** @@ -137,14 +137,14 @@ function admin_acl_add($acl_scope, $acl_user, $acl_level){ * @author Frank Schubert <frank@schokilade.de> */ function admin_acl_del($acl_scope, $acl_user){ - $acl_config = file('conf/acl.auth.php'); + $acl_config = file(DOKU_INC.'conf/acl.auth.php'); $acl_pattern = '^'.preg_quote($acl_scope,'/').'\s+'.$acl_user.'\s+[0-8].*$'; // save all non!-matching #FIXME invert is available from 4.2.0 only! $new_config = preg_grep("/$acl_pattern/", $acl_config, PREG_GREP_INVERT); - return io_saveFile("conf/acl.auth.php", join("",$new_config)); + return io_saveFile(DOKU_INC.'conf/acl.auth.php', join('',$new_config)); } // --- HTML OUTPUT FUNCTIONS BELOW --- // diff --git a/inc/auth.php b/inc/auth.php index a55cfbc51..863bb3c49 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -15,7 +15,7 @@ require_once(DOKU_INC.'inc/blowfish.php'); require_once(DOKU_INC.'inc/mail.php'); // load the the auth functions - require_once(DOKU_INC.'inc/auth_'.$conf['authtype'].'.php'); + require_once(DOKU_INC.'inc/auth/'.$conf['authtype'].'.php'); // some ACL level defines define('AUTH_NONE',0); @@ -29,7 +29,7 @@ if($conf['useacl']){ auth_login($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']); //load ACL into a global array - $AUTH_ACL = file('conf/acl.auth.php'); + $AUTH_ACL = file(DOKU_INC.'conf/acl.auth.php'); } /** diff --git a/inc/auth_ldap.php b/inc/auth/ldap.php index 2f0f4f1ff..2f0f4f1ff 100644 --- a/inc/auth_ldap.php +++ b/inc/auth/ldap.php diff --git a/inc/auth_mysql.php b/inc/auth/mysql.php index 758fe3b77..758fe3b77 100644 --- a/inc/auth_mysql.php +++ b/inc/auth/mysql.php diff --git a/inc/auth_pgsql.php b/inc/auth/pgsql.php index b063f405e..b063f405e 100644 --- a/inc/auth_pgsql.php +++ b/inc/auth/pgsql.php diff --git a/inc/auth_plain.php b/inc/auth/plain.php index 55e1fa9f6..eaa01b79d 100644 --- a/inc/auth_plain.php +++ b/inc/auth/plain.php @@ -73,7 +73,7 @@ function auth_createUser($user,$pass,$name,$mail){ $mail, $conf['defaultgroup'])); $userline .= "\n"; - $fh = fopen('conf/users.auth.php','a'); + $fh = fopen(DOKU_INC.'conf/users.auth.php','a'); if($fh){ fwrite($fh,$userline); fclose($fh); @@ -93,7 +93,7 @@ function auth_createUser($user,$pass,$name,$mail){ */ function auth_plain_loadUserData(){ $data = array(); - $lines = file('conf/users.auth.php'); + $lines = file(DOKU_INC.'conf/users.auth.php'); foreach($lines as $line){ $line = preg_replace('/#.*$/','',$line); //ignore comments $line = trim($line); diff --git a/inc/common.php b/inc/common.php index 162a1a8e4..99cec10a9 100644 --- a/inc/common.php +++ b/inc/common.php @@ -105,7 +105,11 @@ function msg($message,$lvl=0){ }else{ $MSG = array(); $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); - html_msgarea(); + if(function_exists('html_msgarea')){ + html_msgarea(); + }else{ + print "ERROR($lvl) $message"; + } } } @@ -244,7 +248,7 @@ function checkwordblock(){ if(!$conf['usewordblock']) return false; - $blockfile = file('conf/wordblock.conf'); + $blockfile = file(DOKU_INC.'conf/wordblock.conf'); //how many lines to read at once (to work around some PCRE limits) if(version_compare(phpversion(),'4.3.0','<')){ //old versions of PCRE define a maximum of parenthesises even if no @@ -799,7 +803,7 @@ function check(){ msg('Mediadir is not writable',-1); } - if(is_writable('conf/users.auth.php')){ + if(is_writable(DOKU_INC.'conf/users.auth.php')){ msg('conf/users.auth.php is writable',1); }else{ msg('conf/users.auth.php is not writable',0); diff --git a/inc/html.php b/inc/html.php index 411e230c7..acdfaecba 100644 --- a/inc/html.php +++ b/inc/html.php @@ -364,7 +364,7 @@ function html_revisions(){ print $date; - print ' <img src="'.DOKU_BASE.'images/blank.gif" border="0" width="15" height="11" alt="" /> '; + print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" border="0" width="15" height="11" alt="" /> '; print '<a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> '; @@ -386,7 +386,7 @@ function html_revisions(){ print $date; print ' <a href="'.wl($ID,"rev=$rev,do=diff").'">'; - print '<img src="'.DOKU_BASE.'images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />'; + print '<img src="'.DOKU_BASE.'lib/images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />'; print '</a> '; print '<a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a> '; @@ -438,11 +438,11 @@ function html_recent($first=0){ print $date.' '; print '<a href="'.wl($id,"do=diff").'">'; - print '<img src="'.DOKU_BASE.'images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />'; + print '<img src="'.DOKU_BASE.'lib/images/diff.png" border="0" width="15" height="11" title="'.$lang['diff'].'" />'; print '</a> '; print '<a href="'.wl($id,"do=revisions").'">'; - print '<img src="'.DOKU_BASE.'images/history.png" border="0" width="12" height="14" title="'.$lang['btn_revs'].'" />'; + print '<img src="'.DOKU_BASE.'lib/images/history.png" border="0" width="12" height="14" title="'.$lang['btn_revs'].'" />'; print '</a> '; print html_wikilink($id,$id); @@ -848,29 +848,29 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? <?/* sets changed to true when previewed */?> textChanged = <? ($pr) ? print 'true' : print 'false' ?>; - formatButton('images/bold.png','<?=$lang['qb_bold']?>','**','**','<?=$lang['qb_bold']?>','b'); - formatButton('images/italic.png','<?=$lang['qb_italic']?>',"\/\/","\/\/",'<?=$lang['qb_italic']?>','i'); - formatButton('images/underline.png','<?=$lang['qb_underl']?>','__','__','<?=$lang['qb_underl']?>','u'); - formatButton('images/code.png','<?=$lang['qb_code']?>','\'\'','\'\'','<?=$lang['qb_code']?>','c'); + formatButton('bold.png','<?=$lang['qb_bold']?>','**','**','<?=$lang['qb_bold']?>','b'); + formatButton('italic.png','<?=$lang['qb_italic']?>',"\/\/","\/\/",'<?=$lang['qb_italic']?>','i'); + formatButton('underline.png','<?=$lang['qb_underl']?>','__','__','<?=$lang['qb_underl']?>','u'); + formatButton('code.png','<?=$lang['qb_code']?>','\'\'','\'\'','<?=$lang['qb_code']?>','c'); - formatButton('images/fonth1.png','<?=$lang['qb_h1']?>','====== ',' ======\n','<?=$lang['qb_h1']?>','1'); - formatButton('images/fonth2.png','<?=$lang['qb_h2']?>','===== ',' =====\n','<?=$lang['qb_h2']?>','2'); - formatButton('images/fonth3.png','<?=$lang['qb_h3']?>','==== ',' ====\n','<?=$lang['qb_h3']?>','3'); - formatButton('images/fonth4.png','<?=$lang['qb_h4']?>','=== ',' ===\n','<?=$lang['qb_h4']?>','4'); - formatButton('images/fonth5.png','<?=$lang['qb_h5']?>','== ',' ==\n','<?=$lang['qb_h5']?>','5'); + formatButton('fonth1.png','<?=$lang['qb_h1']?>','====== ',' ======\n','<?=$lang['qb_h1']?>','1'); + formatButton('fonth2.png','<?=$lang['qb_h2']?>','===== ',' =====\n','<?=$lang['qb_h2']?>','2'); + formatButton('fonth3.png','<?=$lang['qb_h3']?>','==== ',' ====\n','<?=$lang['qb_h3']?>','3'); + formatButton('fonth4.png','<?=$lang['qb_h4']?>','=== ',' ===\n','<?=$lang['qb_h4']?>','4'); + formatButton('fonth5.png','<?=$lang['qb_h5']?>','== ',' ==\n','<?=$lang['qb_h5']?>','5'); - formatButton('images/link.png','<?=$lang['qb_link']?>','[[',']]','<?=$lang['qb_link']?>','l'); - formatButton('images/extlink.png','<?=$lang['qb_extlink']?>','[[',']]','http://www.example.com|<?=$lang['qb_extlink']?>'); + formatButton('link.png','<?=$lang['qb_link']?>','[[',']]','<?=$lang['qb_link']?>','l'); + formatButton('extlink.png','<?=$lang['qb_extlink']?>','[[',']]','http://www.example.com|<?=$lang['qb_extlink']?>'); - formatButton('images/list.png','<?=$lang['qb_ol']?>',' - ','\n','<?=$lang['qb_ol']?>'); - formatButton('images/list_ul.png','<?=$lang['qb_ul']?>',' * ','\n','<?=$lang['qb_ul']?>'); + formatButton('list.png','<?=$lang['qb_ol']?>',' - ','\n','<?=$lang['qb_ol']?>'); + formatButton('list_ul.png','<?=$lang['qb_ul']?>',' * ','\n','<?=$lang['qb_ul']?>'); - insertButton('images/rule.png','<?=$lang['qb_hr']?>','----\n'); - mediaButton('images/image.png','<?=$lang['qb_media']?>','m','<?=$INFO['namespace']?>'); + insertButton('rule.png','<?=$lang['qb_hr']?>','----\n'); + mediaButton('image.png','<?=$lang['qb_media']?>','m','<?=$INFO['namespace']?>'); <? if($conf['useacl'] && $_SERVER['REMOTE_USER']){ - echo "insertButton('images/sig.png','".$lang['qb_sig']."','".html_signature()."','y');"; + echo "insertButton('sig.png','".$lang['qb_sig']."','".html_signature()."','y');"; } ?> </script> diff --git a/inc/init.php b/inc/init.php index 363518b65..dd5614d42 100644 --- a/inc/init.php +++ b/inc/init.php @@ -30,14 +30,14 @@ if(!defined('DOKU_URL')) define('DOKU_URL',getBaseURL(true)); // define Plugin dir - if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'inc/plugins/'); + if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); // define main script if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php'); // define Template baseURL if(!defined('DOKU_TPL')) define('DOKU_TPL', - DOKU_BASE.'tpl/'.$conf['template'].'/'); + DOKU_BASE.'lib/tpl/'.$conf['template'].'/'); // make session rewrites XHTML compliant @ini_set('arg_separator.output', '&'); @@ -72,16 +72,29 @@ } // make real paths and check them - $conf['datadir'] = realpath($conf['datadir']); + $conf['datadir'] = init_path($conf['datadir']); if(!$conf['datadir']) die('Wrong datadir! Check config!'); - $conf['olddir'] = realpath($conf['olddir']); + $conf['olddir'] = init_path($conf['olddir']); if(!$conf['olddir']) die('Wrong olddir! Check config!'); - $conf['mediadir'] = realpath($conf['mediadir']); + $conf['mediadir'] = init_path($conf['mediadir']); if(!$conf['mediadir']) die('Wrong mediadir! Check config!'); // automatic upgrade to script versions of certain files - scriptify('conf/users.auth'); - scriptify('conf/acl.auth'); + scriptify(DOKU_INC.'conf/users.auth'); + scriptify(DOKU_INC.'conf/acl.auth'); + + +/** + * returns absolute path + * + * This tries the given past first, then checks in DOKU_INC + */ +function init_path($path){ + $p = realpath($path); + if($p) return $p; + $p = realpath(DOKU_INC.$path); + return $p; +} /** * remove magic quotes recursivly @@ -123,6 +136,9 @@ function getBaseURL($abs=false){ $dir = str_replace('\\','/',$dir); #bugfix for weird WIN behaviour $dir = preg_replace('#//+#','/',$dir); + + //handle script in lib/exe dir + $dir = preg_replace('!lib/exe/$!','',$dir); //finish here for relative URLs if(!$abs) return $dir; diff --git a/inc/io.php b/inc/io.php index 3981757da..a3e5f85c4 100644 --- a/inc/io.php +++ b/inc/io.php @@ -10,55 +10,6 @@ require_once(DOKU_INC.'inc/common.php'); /** - * Returns the parsed text from the given sourcefile. Uses cache - * if exists. Creates it if not. - * - * @author Andreas Gohr <andi@splitbrain.org> - * @deprecated -> parserutils - */ -function io_cacheParse($file){ - trigger_error("deprecated io_cacheParse called"); - - global $conf; - global $CACHEGROUP; - global $parser; //we read parser options - $parsed = ''; - $cache = $conf['datadir'].'/_cache/'; - $cache .= md5($file.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].$CACHEGROUP); - $purge = $conf['datadir'].'/_cache/purgefile'; - - // check if cache can be used - $cachetime = @filemtime($cache); - - if( @file_exists($cache) // does the cachefile exist - && @file_exists($file) // and does the source exist - && !isset($_REQUEST['purge']) // no purge param was set - && filesize($cache) // and contains the cachefile any data - && ((time() - $cachetime) < $conf['cachetime']) // and is cachefile young enough - && ($cachetime > filemtime($file)) // and newer than the source - && ($cachetime > @filemtime($purge)) // and newer than the purgefile - && ($cachetime > filemtime('conf/dokuwiki.php')) // and newer than the config file - && ($cachetime > @filemtime('conf/local.php')) // and newer than the local config file - && ($cachetime > filemtime('inc/parser.php')) // and newer than the parser - && ($cachetime > filemtime('inc/format.php'))) // and newer than the formating functions - { - $parsed = io_readFile($cache); //give back cache - $parsed .= "\n<!-- cachefile $cache used -->\n"; - }elseif(@file_exists($file)){ - $parsed = parse(io_readFile($file)); //sets global parseroptions - if($parser['cache']){ - io_saveFile($cache,$parsed); //save cachefile - $parsed .= "\n<!-- no cachefile used, but created -->\n"; - }else{ - @unlink($cache); //try to delete cachefile - $parsed .= "\n<!-- no cachefile used, caching forbidden -->\n"; - } - } - - return $parsed; -} - -/** * Removes empty directories * * @todo use safemode hack diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 5c3c8f86e..dde735b2f 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -73,8 +73,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /* The (+/-) version will work too but needs some CSS tweaking to look fine */ /* $this->doc .= ' <script type="text/javascript">showTocToggle("+","-")';*/ $this->doc .= '<script type="text/javascript">showTocToggle('; - $this->doc .= '\'<img src="'.DOKU_BASE.'images/arrow_down.png">\','; - $this->doc .= '\'<img src="'.DOKU_BASE.'images/arrow_up.png">\')'; + $this->doc .= '\'<img src="'.DOKU_BASE.'lib/images/arrow_down.png">\','; + $this->doc .= '\'<img src="'.DOKU_BASE.'lib/images/arrow_up.png">\')'; $this->doc .= '</script>'; $this->doc .= $lang['toc']; $this->doc .= '</div>'.DOKU_LF; @@ -376,12 +376,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } } - /** - */ function smiley($smiley) { if ( array_key_exists($smiley, $this->smileys) ) { $title = $this->_xmlEntities($this->smileys[$smiley]); - $this->doc .= '<img src="'.DOKU_BASE.'smileys/'.$this->smileys[$smiley]. + $this->doc .= '<img src="'.DOKU_BASE.'lib/images/smileys/'.$this->smileys[$smiley]. '" align="middle" alt="'. $this->_xmlEntities($smiley).'" />'; } else { @@ -389,7 +387,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } } - /** + /* * not used function wordblock($word) { if ( array_key_exists($word, $this->badwords) ) { @@ -566,10 +564,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if(!$isImage){ //if ico exists set additional style - if(@file_exists(DOKU_INC.'interwiki/'.$wikiName.'.png')){ - $link['style']='background-image: url('.DOKU_BASE.'interwiki/'.$wikiName.'.png)'; + if(@file_exists(DOKU_INC.'lib/images/interwiki/'.$wikiName.'.png')){ + $link['style']='background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$wikiName.'.png)'; }elseif(@file_exists(DOKU_INC.'interwiki/'.$wikiName.'.gif')){ - $link['style']='background-image: url('.DOKU_BASE.'interwiki/'.$wikiName.'.gif)'; + $link['style']='background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$wikiName.'.gif)'; } } @@ -714,7 +712,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['target'] = $conf['target']['media']; $link['title'] = $this->_xmlEntities($src); - $link['url'] = DOKU_BASE.'fetch.php?cache='.$cache.'&media='.urlencode($src); + $link['url'] = DOKU_BASE.'lib/exe/fetch.php?cache='.$cache.'&media='.urlencode($src); $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); @@ -738,7 +736,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['target'] = $conf['target']['media']; $link['title'] = $this->_xmlEntities($src); - $link['url'] = DOKU_BASE.'fetch.php?cache='.$cache.'&media='.urlencode($src); + $link['url'] = DOKU_BASE.'lib/exe/fetch.php?cache='.$cache.'&media='.urlencode($src); $link['name'] = $this->_media ($src, $title, $align, $width, $height, $cache); @@ -893,7 +891,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { list($ext,$mime) = mimetype($src); if(substr($mime,0,5) == 'image'){ //add image tag - $ret .= '<img src="'.DOKU_BASE.'fetch.php?w='.$width.'&h='.$height. + $ret .= '<img src="'.DOKU_BASE.'lib/exe/fetch.php?w='.$width.'&h='.$height. '&cache='.$cache.'&media='.urlencode($src).'"'; $ret .= ' class="media'.$align.'"'; @@ -919,9 +917,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ( !is_null($width) ) $ret .= ' width="'.$this->_xmlEntities($width).'"'; if ( !is_null($height) ) $ret .= ' height="'.$this->_xmlEntities($height).'"'; $ret .= '>'.DOKU_LF; - $ret .= '<param name="movie" value="'.DOKU_BASE.'fetch.php?media='.urlencode($src).'" />'.DOKU_LF; + $ret .= '<param name="movie" value="'.DOKU_BASE.'lib/exe/fetch.php?media='.urlencode($src).'" />'.DOKU_LF; $ret .= '<param name="quality" value="high" />'.DOKU_LF; - $ret .= '<embed src="'.DOKU_BASE.'fetch.php?media='.urlencode($src).'"'. + $ret .= '<embed src="'.DOKU_BASE.'lib/exe/fetch.php?media='.urlencode($src).'"'. ' quality="high"'; if ( !is_null($width) ) $ret .= ' width="'.$this->_xmlEntities($width).'"'; if ( !is_null($height) ) $ret .= ' height="'.$this->_xmlEntities($height).'"'; diff --git a/inc/plugins/info/syntax.php b/inc/plugins/info/syntax.php deleted file mode 100644 index bf45e5d11..000000000 --- a/inc/plugins/info/syntax.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -/** - * Info Plugin: Displays information about various DokuWiki internals - * - * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) - * @author Andreas Gohr <andi@splitbrain.org> - */ - -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'inc/plugins/'); -require_once(DOKU_PLUGIN.'syntax.php'); - -/** - * All DokuWiki plugins to extend the parser/rendering mechanism - * need to inherit from this class - */ -class syntax_plugin_info extends DokuWiki_Syntax_Plugin { - - /** - * What kind of syntax are we? - */ - function getType(){ - return 'substition'; - } - - /** - * Where to sort in? - */ - function getSort(){ - return 155; - } - - - /** - * Connect pattern to lexer - */ - function connectTo($mode) { - $this->Lexer->addSpecialPattern('~~INFO:\w+~~',$mode,'plugin_info'); - } - - - /** - * Handle the match - */ - function handle($match, $state, $pos, &$handler){ - $match = substr($match,7,-2); //strip ~~INFO: from start and ~~ from end - return array(strtolower($match)); - } - - /** - * Create output - */ - function render($mode, &$renderer, $data) { - if($mode == 'xhtml'){ - //handle various info stuff - switch ($data[0]){ - case 'version'; - $renderer->doc .= getVersion(); - break; - case 'syntaxmodes'; - $renderer->doc .= $this->_syntaxmodes_xhtml(); - break; - case 'syntaxtypes'; - $renderer->doc .= $this->_syntaxtypes_xhtml(); - break; - default: - $renderer->doc .= "no info about ".htmlspecialchars($data[0]); - } - return true; - } - return false; - } - - /** - * lists all known syntax types and their registered modes - */ - function _syntaxtypes_xhtml(){ - global $PARSER_MODES; - $doc = ''; - - $doc .= '<table class="inline"><tbody>'; - foreach($PARSER_MODES as $mode => $modes){ - $doc .= '<tr>'; - $doc .= '<td class="leftalign">'; - $doc .= $mode; - $doc .= '</td>'; - $doc .= '<td class="leftalign">'; - $doc .= join(', ',$modes); - $doc .= '</td>'; - $doc .= '</tr>'; - } - $doc .= '</tbody></table>'; - return $doc; - } - - /** - * lists all known syntax modes and their sorting value - */ - function _syntaxmodes_xhtml(){ - $modes = p_get_parsermodes(); - $doc = ''; - - foreach ($modes as $mode){ - $doc .= $mode['mode'].' ('.$mode['sort'].'), '; - } - return $doc; - } -} - -//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/inc/plugins/syntax.php b/inc/plugins/syntax.php deleted file mode 100644 index bb5680cd3..000000000 --- a/inc/plugins/syntax.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Syntax Plugin Prototype - * - * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) - * @author Andreas Gohr <andi@splitbrain.org> - */ - -if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'inc/plugins/'); -require_once(DOKU_INC.'inc/parser/parser.php'); - -/** - * All DokuWiki plugins to extend the parser/rendering mechanism - * need to inherit from this class - */ -class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { - - /** - * Needs to return one of the mode types defined in $PARSER_MODES in parser.php - */ - function getType(){ - trigger_error('getType() not implemented in '.get_class($this), E_USER_WARNING); - } - - /** - * Handler to prepare matched data for the rendering process - * - * Usually you should only need the $match param. - * - * @param $match string The text matched by the patterns - * @param $state int The lexer state for the match - * @param $pos int The character position of the matched text - * @param $handler ref Reference to the Doku_Handler object - * @return array Return an array with all data you want to use in render - */ - function handle($match, $state, $pos, &$handler){ - trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); - } - - /** - * Handles the actual output creation. - * - * The function should always check for the given mode and return false - * when a mode isn't supported. - * - * $renderer contains a reference to the renderer object which is - * currently handling the rendering. You need to use it for writing - * the output. How this is done depends on the renderer used (specified - * by $mode - * - * The contents of the $data array depends on what the handler() function above - * created - * - * @param $mode string current Rendermode - * @param $renderer ref reference to the current renderer object - * @param $data array data created by handler() - * @return boolean rendered correctly? - */ - function render($mode, &$renderer, $data) { - trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); - } - -} - -//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/inc/template.php b/inc/template.php index 11a1112d0..43c224926 100644 --- a/inc/template.php +++ b/inc/template.php @@ -145,7 +145,7 @@ function tpl_metaheaders(){ ptln('<link rel="alternate" type="application/rss+xml" title="Current Namespace" href="'.DOKU_BASE.'feed.php?mode=list&ns='.$INFO['namespace'].'" />',$it); ptln('<link rel="alternate" type="text/html" title="Plain HTML" href="'.wl($ID,'do=export_html').'" />',$it); ptln('<link rel="alternate" type="text/plain" title="Wiki Markup" href="'.wl($ID, 'do=export_raw').'" />',$it); - ptln('<link rel="stylesheet" media="screen" type="text/css" href="'.DOKU_BASE.'style.css" />',$it); + ptln('<link rel="stylesheet" media="screen" type="text/css" href="'.DOKU_BASE.'lib/styles/style.css" />',$it); // setup robot tags apropriate for different modes if( ($ACT=='show' || $ACT=='export_html') && !$REV){ @@ -172,9 +172,12 @@ function tpl_metaheaders(){ ptln('</script>',$it); // load the default JavaScript files - ptln('<script language="JavaScript" type="text/javascript" src="'.DOKU_BASE.'script.js"></script>',$it); - ptln('<script language="JavaScript" type="text/javascript" src="'.DOKU_BASE.'tw-sack.js"></script>',$it); - ptln('<script language="JavaScript" type="text/javascript" src="'.DOKU_BASE.'ajax.js"></script>',$it); + ptln('<script language="JavaScript" type="text/javascript" src="'. + DOKU_BASE.'lib/scripts/script.js"></script>',$it); + ptln('<script language="JavaScript" type="text/javascript" src="'. + DOKU_BASE.'lib/scripts/tw-sack.js"></script>',$it); + ptln('<script language="JavaScript" type="text/javascript" src="'. + DOKU_BASE.'lib/scripts/ajax.js"></script>',$it); //FIXME include some default CSS ? IE FIX? } @@ -571,9 +574,9 @@ function tpl_mediafilelist(){ $ask = $lang['del_confirm'].'\\n'; $ask .= $item['id']; - $del = '<a href="media.php?delete='.urlencode($item['id']).'" '. + $del = '<a href="'.DOKU_BASE.'lib/exe/media.php?delete='.urlencode($item['id']).'" '. 'onclick="return confirm(\''.$ask.'\')" onkeypress="return confirm(\''.$ask.'\')">'. - '<img src="'.DOKU_BASE.'images/del.png" alt="'.$lang['btn_delete'].'" '. + '<img src="'.DOKU_BASE.'lib/images/del.png" alt="'.$lang['btn_delete'].'" '. 'align="bottom" title="'.$lang['btn_delete'].'" /></a>'; }else{ $del = ''; @@ -589,9 +592,9 @@ function tpl_mediafilelist(){ ptln('<a href="javascript:mediaSelect(\''.$item['id'].'\')">'); if($w>120){ - print '<img src="'.DOKU_BASE.'fetch.php?w=120&media='.urlencode($item['id']).'" width="120" />'; + print '<img src="'.DOKU_BASE.'lib/exe/fetch.php?w=120&media='.urlencode($item['id']).'" width="120" />'; }else{ - print '<img src="'.DOKU_BASE.'fetch.php?media='.urlencode($item['id']).'" width="'.$w.'" height="'.$h.'" />'; + print '<img src="'.DOKU_BASE.'lib/exe/fetch.php?media='.urlencode($item['id']).'" width="'.$w.'" height="'.$h.'" />'; } print '</a>'; |