From 98c868589ee0757f176239cf289cbd007bb74852 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 17 Feb 2006 23:20:40 +0100 Subject: file cleanups This patch cleans up the source code to satisfy the coding guidelines (see http://wiki.splitbrain.org/wiki:development#coding_style) It converts files to UNIX lineendings and removes tabs and trailing whitespace. Not all files were cleaned yet. darcs-hash:20060217222040-7ad00-bba3d2bee3b5aa7cbb5184258abd50805cd071bf.gz --- inc/parser/xhtml.php | 222 +++++++++++++++++++++++++-------------------------- 1 file changed, 111 insertions(+), 111 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 5e898ab36..1c7343cda 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -21,16 +21,16 @@ if ( !defined('DOKU_TAB') ) { require_once DOKU_INC . 'inc/parser/renderer.php'; /** - * The Renderer + * The Renderer */ class Doku_Renderer_xhtml extends Doku_Renderer { var $doc = ''; - + var $headers = array(); - + var $footnotes = array(); - + var $acronyms = array(); var $smileys = array(); var $badwords = array(); @@ -43,18 +43,18 @@ class Doku_Renderer_xhtml extends Doku_Renderer { function document_start() { } - + function document_end() { // add button for last section if any and more than one if($this->lastsec > 1) $this->_secedit($this->lastsec,''); - + if ( count ($this->footnotes) > 0 ) { $this->doc .= '
'.DOKU_LF; $id = 0; foreach ( $this->footnotes as $footnote ) { $id++; // the number of the current footnote - + // check its not a placeholder that indicates actual footnote text is elsewhere if (substr($footnote, 0, 5) != "@@FNT") { @@ -62,18 +62,18 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= '
'; $this->doc .= ''; $this->doc .= $id.') '.DOKU_LF; - + // get any other footnotes that use the same markup $alt = array_keys($this->footnotes, "@@FNT$id"); - + if (count($alt)) { foreach ($alt as $ref) { // set anchor and backlink for the other footnotes $this->doc .= ', '; - $this->doc .= ($ref+1).') '.DOKU_LF; + $this->doc .= ($ref+1).') '.DOKU_LF; } } - + // add footnote markup and close this footnote $this->doc .= $footnote; $this->doc .= '
' . DOKU_LF; @@ -91,11 +91,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= '
'.DOKU_LF; $this->doc .= '
'.DOKU_LF; } - + function tocbranch_open($level) { $this->doc .= ''.DOKU_LF; } - + function toc_close() { $this->doc .= '
'.DOKU_LF.''.DOKU_LF; } - + function header($text, $level, $pos) { global $conf; - //handle section editing + //handle section editing if($level <= $conf['maxseclevel']){ // add button for last section if any if($this->lastsec) $this->_secedit($this->lastsec,$pos-1); @@ -136,91 +136,91 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_xmlEntities($text); $this->doc .= "".DOKU_LF; } - + function section_open($level) { $this->doc .= "
".DOKU_LF; } - + function section_close() { $this->doc .= DOKU_LF.'
'.DOKU_LF; } - + function cdata($text) { $this->doc .= $this->_xmlEntities($text); } - + function p_open() { $this->doc .= DOKU_LF.'

'.DOKU_LF; } - + function p_close() { $this->doc .= DOKU_LF.'

'.DOKU_LF; } - + function linebreak() { $this->doc .= '
'.DOKU_LF; } - + function hr() { $this->doc .= '
'.DOKU_LF; } - + function strong_open() { $this->doc .= ''; } - + function strong_close() { $this->doc .= ''; } - + function emphasis_open() { $this->doc .= ''; } - + function emphasis_close() { $this->doc .= ''; } - + function underline_open() { $this->doc .= ''; } - + function underline_close() { $this->doc .= ''; } - + function monospace_open() { $this->doc .= ''; } - + function monospace_close() { $this->doc .= ''; } - + function subscript_open() { $this->doc .= ''; } - + function subscript_close() { $this->doc .= ''; } - + function superscript_open() { $this->doc .= ''; } - + function superscript_close() { $this->doc .= ''; } - + function deleted_open() { $this->doc .= ''; } - + function deleted_close() { $this->doc .= ''; } - + /** * Callback for footnote start syntax * @@ -236,7 +236,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->store = $this->doc; $this->doc = ''; } - + /** * Callback for footnote end syntax * @@ -251,10 +251,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $footnote = $this->doc; $this->doc = $this->store; $this->store = ''; - + // check to see if this footnote has been seen before $i = array_search($footnote, $this->footnotes); - + if ($i === false) { // its a new footnote, add it to the $footnotes array $id = count($this->footnotes)+1; @@ -269,43 +269,43 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output the footnote reference and link, incl. onmouseover for insitu footnote popup $this->doc .= ''.$id.')'; } - + function listu_open() { $this->doc .= ''.DOKU_LF; } - + function listo_open() { $this->doc .= '
    '.DOKU_LF; } - + function listo_close() { $this->doc .= '
'.DOKU_LF; } - + function listitem_open($level) { $this->doc .= '
  • '; } - + function listitem_close() { $this->doc .= '
  • '.DOKU_LF; } - + function listcontent_open() { $this->doc .= '
    '; } - + function listcontent_close() { $this->doc .= '
    '.DOKU_LF; } - + function unformatted($text) { $this->doc .= $this->_xmlEntities($text); } - + /** * Execute PHP code if allowed * @@ -322,7 +322,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->file($text); } } - + /** * Insert HTML if allowed * @@ -336,23 +336,23 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->file($text); } } - + function preformatted($text) { $this->doc .= '
    ' . $this->_xmlEntities($text) . '
    '. DOKU_LF; } - + function file($text) { $this->doc .= '
    ' . $this->_xmlEntities($text). '
    '. DOKU_LF; } - + function quote_open() { $this->doc .= '
    '.DOKU_LF; } - + function quote_close() { $this->doc .= '
    '.DOKU_LF; } - + /** * Callback for code text * @@ -362,7 +362,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { */ function code($text, $language = NULL) { global $conf; - + if ( is_null($language) ) { $this->preformatted($text); } else { @@ -376,26 +376,26 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $geshi->set_header_type(GESHI_HEADER_PRE); $geshi->set_overall_class("code $language"); $geshi->set_link_target($conf['target']['extern']); - + $text = $geshi->parse_code(); $this->doc .= $text; } } - + function acronym($acronym) { - + if ( array_key_exists($acronym, $this->acronyms) ) { - + $title = $this->_xmlEntities($this->acronyms[$acronym]); - + $this->doc .= ''.$this->_xmlEntities($acronym).''; - + } else { $this->doc .= $this->_xmlEntities($acronym); } } - + function smiley($smiley) { if ( array_key_exists($smiley, $this->smileys) ) { $title = $this->_xmlEntities($this->smileys[$smiley]); @@ -406,7 +406,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_xmlEntities($smiley); } } - + /* * not used function wordblock($word) { @@ -417,7 +417,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } } */ - + function entity($entity) { if ( array_key_exists($entity, $this->entities) ) { $this->doc .= $this->entities[$entity]; @@ -425,33 +425,33 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_xmlEntities($entity); } } - + function multiplyentity($x, $y) { $this->doc .= "$x×$y"; } - + function singlequoteopening() { $this->doc .= "‘"; } - + function singlequoteclosing() { $this->doc .= "’"; } - + function doublequoteopening() { $this->doc .= "“"; } - + function doublequoteclosing() { $this->doc .= "”"; } - + /** */ function camelcaselink($link) { - $this->internallink($link,$link); + $this->internallink($link,$link); } - + function locallink($hash, $name = NULL){ global $ID; @@ -488,10 +488,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } else { $class='media'; } - + //keep hash anchor list($id,$hash) = split('#',$id,2); - + //prepare for formating $link['target'] = $conf['target']['wiki']; $link['style'] = ''; @@ -523,7 +523,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_formatLink($link); } } - + function externallink($url, $name = NULL) { global $conf; @@ -532,13 +532,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // add protocol on simple short URLs if(substr($url,0,3) == 'ftp' && (substr($url,0,6) != 'ftp://')) $url = 'ftp://'.$url; if(substr($url,0,3) == 'www') $url = 'http://'.$url; - + if ( !$isImage ) { $class='urlextern'; } else { $class='media'; } - + //prepare for formating $link['target'] = $conf['target']['extern']; $link['style'] = ''; @@ -554,12 +554,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //output formatted $this->doc .= $this->_formatLink($link); } - + /** */ function interwikilink($match, $name = NULL, $wikiName, $wikiUri) { global $conf; - + $link = array(); $link['target'] = $conf['target']['interwiki']; $link['pre'] = ''; @@ -615,7 +615,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //output formatted $this->doc .= $this->_formatLink($link); } - + /** */ function windowssharelink($url, $name = NULL) { @@ -648,7 +648,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //output formatted $this->doc .= $this->_formatLink($link); } - + function emaillink($address, $name = NULL) { global $conf; //simple setup @@ -658,7 +658,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['suf'] = ''; $link['style'] = ''; $link['more'] = ''; - + //we just test for image here - we need to encode the title our self $this->_getLinkTitle($name, $address, $isImage); if ( !$isImage ) { @@ -675,9 +675,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { }else{ $name = $this->_xmlEntities($name); } - + if($conf['mailguard'] == 'visible') $address = rawurlencode($address); - + $link['url'] = 'mailto:'.$address; $link['name'] = $name; $link['title'] = $title; @@ -685,7 +685,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //output formatted $this->doc .= $this->_formatLink($link); } - + function internalmedia ($src, $title=NULL, $align=NULL, $width=NULL, $height=NULL, $cache=NULL, $linking=NULL) { global $conf; @@ -719,7 +719,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ($linking == 'nolink' || $noLink) $this->doc .= $link['name']; else $this->doc .= $this->_formatLink($link); } - + /** * @todo don't add link for flash */ @@ -759,7 +759,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Renders an RSS feed using Magpie - * + * * @author Andreas Gohr */ function rss ($url){ @@ -794,19 +794,19 @@ class Doku_Renderer_xhtml extends Doku_Renderer { function table_open($maxcols = NULL, $numrows = NULL){ $this->doc .= ''.DOKU_LF; } - + function table_close(){ $this->doc .= '
    '.DOKU_LF.'
    '.DOKU_LF; } - + function tablerow_open(){ $this->doc .= DOKU_TAB . '' . DOKU_LF . DOKU_TAB . DOKU_TAB; } - + function tablerow_close(){ $this->doc .= DOKU_LF . DOKU_TAB . '' . DOKU_LF; } - + function tableheader_open($colspan = 1, $align = NULL){ $this->doc .= 'doc .= '>'; } - + function tableheader_close(){ $this->doc .= ''; } - + function tablecell_open($colspan = 1, $align = NULL){ $this->doc .= 'doc .= '>'; } - + function tablecell_close(){ $this->doc .= ''; } - + //---------------------------------------------------------- // Utils @@ -898,7 +898,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Renders internal and external media - * + * * @author Andreas Gohr */ function _media ($src, $title=NULL, $align=NULL, $width=NULL, @@ -911,7 +911,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //add image tag $ret .= '_xmlEntities($title).'"'; $ret .= ' alt="'.$this->_xmlEntities($title).'"'; @@ -927,14 +927,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer { }else{ $ret .= ' alt=""'; } - + if ( !is_null($width) ) $ret .= ' width="'.$this->_xmlEntities($width).'"'; - + if ( !is_null($height) ) $ret .= ' height="'.$this->_xmlEntities($height).'"'; - $ret .= ' />'; + $ret .= ' />'; }elseif($mime == 'application/x-shockwave-flash'){ $ret .= ' */ function _secedit($f, $t){ $this->doc .= ''; } - + /** * Construct a title and handle images in titles * @@ -1013,7 +1013,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { return $this->_imageTitle($title); } } - + /** * Returns an HTML code for images used in link titles * -- cgit v1.2.3