*/
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
require_once(DOKU_INC.'inc/parserutils.php');
/**
* Convenience function to quickly build a wikilink
*
* @author Andreas Gohr
*/
function html_wikilink($id,$name=NULL,$search=''){
require_once(DOKU_INC.'inc/parser/xhtml.php');
static $xhtml_renderer = NULL;
if(is_null($xhtml_renderer)){
$xhtml_renderer = new Doku_Renderer_xhtml();
}
return $xhtml_renderer->internallink($id,$name,$search,true);
}
/**
* Helps building long attribute lists
*
* @author Andreas Gohr
*/
function html_attbuild($attributes){
$ret = '';
foreach ( $attributes as $key => $value ) {
$ret .= $key.'="'.formtext($value).'" ';
}
return trim($ret);
}
/**
* The loginform
*
* @author Andreas Gohr
*/
function html_login(){
global $lang;
global $conf;
global $ID;
print p_locale_xhtml('login');
?>
if($conf['openregister']){
print '
';
print $lang['reghere'];
print ': '.$lang['register'].'';
print '
';
}
?>
/*
FIXME provide new hook
if(@file_exists('includes/login.txt')){
print io_cacheParse('includes/login.txt');
}
*/
}
/**
* shows the edit/source/show button dependent on current mode
*
* @author Andreas Gohr
*/
function html_editbutton(){
global $ID;
global $REV;
global $ACT;
global $INFO;
if($ACT == 'show' || $ACT == 'search'){
if($INFO['writable']){
if($INFO['exists']){
$r = html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post');
}else{
$r = html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post');
}
}else{
$r = html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post');
}
}else{
$r = html_btn('show',$ID,'v',array('do' => 'show'));
}
return $r;
}
/**
* prints a section editing button
*
* @author Andreas Gohr
*/
function html_secedit_button($section,$p){
global $ID;
global $lang;
$secedit = '';
# if($p) $secedit .= "
\n";
$secedit .= '';
$secedit .= html_btn('secedit',$ID,'',
array('do' => 'edit',
'lines' => "$section"),
'post');
$secedit .= '
';
# if($p) $secedit .= "\n";
return $secedit;
}
/**
* inserts section edit buttons if wanted or removes the markers
*
* @author Andreas Gohr
*/
function html_secedit($text,$show=true){
global $INFO;
if($INFO['writable'] && $show && !$INFO['rev']){
$text = preg_replace('##e',
"html_secedit_button('\\1',true)",
$text);
$text = preg_replace('##e',
"html_secedit_button('\\1',false)",
$text);
}else{
$text = preg_replace('##e','',$text);
}
return $text;
}
/**
* Just the back to top button (in it's own form)
*
* @author Andreas Gohr
*/
function html_topbtn(){
global $lang;
$ret = '';
$ret = '';
return $ret;
}
/**
* Displays a button (using it's own form)
*
* @author Andreas Gohr
*/
function html_btn($name,$id,$akey,$params,$method='get'){
global $conf;
global $lang;
$label = $lang['btn_'.$name];
$ret = '';
//filter id (without urlencoding)
$id = idfilter($id,false);
//make nice URLs even for buttons
if($conf['userewrite'] == 2){
$script = DOKU_BASE.DOKU_SCRIPT.'/'.$id;
}elseif($conf['userewrite']){
$script = DOKU_BASE.$id;
}else{
$script = DOKU_BASE.DOKU_SCRIPT;
$params['id'] = $id;
}
$ret .= '