From a2d649c465f8f77c2b1dfdcc3724e69fde78a296 Mon Sep 17 00:00:00 2001
From: andi
Date: Mon, 25 Apr 2005 20:35:43 +0200
Subject: changed XHTML renderer from outputbuffering to string appending #272
darcs-hash:20050425183543-9977f-86c2d99ebfcb30849443b7bc5ef1a09859148732.gz
---
inc/io.php | 2 +
inc/parser/xhtml.php | 215 +++++++++++++++++++++++++--------------------------
inc/parserutils.php | 11 ++-
3 files changed, 112 insertions(+), 116 deletions(-)
diff --git a/inc/io.php b/inc/io.php
index 36cacaa92..f6ad79a4e 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -17,6 +17,8 @@
* @deprecated -> parserutils
*/
function io_cacheParse($file){
+ trigger_error("deprecated io_cacheParse called");
+
global $conf;
global $CACHEGROUP;
global $parser; //we read parser options
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index dc17092d9..39708db17 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -42,7 +42,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
var $lastsec = 0;
function document_start() {
- ob_start();
}
function document_end() {
@@ -50,52 +49,48 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if($this->lastsec > 1) $this->_secedit($this->lastsec,'');
if ( count ($this->footnotes) > 0 ) {
- echo ''.DOKU_LF;
}
-
- $this->doc .= ob_get_contents();
- ob_end_clean();
-
}
function toc_open() {
- echo ''.DOKU_LF;
- echo ''.DOKU_LF;
- echo '
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
}
function tocbranch_open($level) {
- echo '
'.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
}
function toc_close() {
- echo '
'.DOKU_LF.'
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF.'
'.DOKU_LF;
}
function header($text, $level, $pos) {
@@ -108,98 +103,98 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$this->lastsec = $pos;
}
- echo DOKU_LF.'';
- echo $this->_xmlEntities($text);
- echo "".DOKU_LF;
+ $this->doc .= DOKU_LF.'';
+ $this->doc .= $this->_xmlEntities($text);
+ $this->doc .= "".DOKU_LF;
}
function section_open($level) {
- echo "".DOKU_LF;
+ $this->doc .= "
".DOKU_LF;
}
function section_close() {
- echo DOKU_LF.'
'.DOKU_LF;
+ $this->doc .= DOKU_LF.'
'.DOKU_LF;
}
function cdata($text) {
- echo $this->_xmlEntities($text);
+ $this->doc .= $this->_xmlEntities($text);
}
function p_open() {
- echo DOKU_LF.''.DOKU_LF;
+ $this->doc .= DOKU_LF.'
'.DOKU_LF;
}
function p_close() {
- echo DOKU_LF.'
'.DOKU_LF;
+ $this->doc .= DOKU_LF.'
'.DOKU_LF;
}
function linebreak() {
- echo '
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
}
function hr() {
- echo '
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
}
function strong_open() {
- echo '';
+ $this->doc .= '';
}
function strong_close() {
- echo '';
+ $this->doc .= '';
}
function emphasis_open() {
- echo '';
+ $this->doc .= '';
}
function emphasis_close() {
- echo '';
+ $this->doc .= '';
}
function underline_open() {
- echo '';
+ $this->doc .= '';
}
function underline_close() {
- echo '';
+ $this->doc .= '';
}
function monospace_open() {
- echo '';
+ $this->doc .= '';
}
function monospace_close() {
- echo '
';
+ $this->doc .= '
';
}
function subscript_open() {
- echo '';
+ $this->doc .= '';
}
function subscript_close() {
- echo '';
+ $this->doc .= '';
}
function superscript_open() {
- echo '';
+ $this->doc .= '';
}
function superscript_close() {
- echo '';
+ $this->doc .= '';
}
function deleted_open() {
- echo '';
+ $this->doc .= '';
}
function deleted_close() {
- echo '';
+ $this->doc .= '';
}
function footnote_open() {
$id = $this->_newFootnoteId();
- echo ''.$id.')';
+ $this->doc .= ''.$id.')';
$this->footnoteIdStack[] = $id;
ob_start();
}
@@ -216,39 +211,39 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
}
function listu_open() {
- echo ''.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
function listu_close() {
- echo '
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
}
function listo_open() {
- echo ''.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
function listo_close() {
- echo '
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF;
}
function listitem_open($level) {
- echo '';
+ $this->doc .= '';
}
function listitem_close() {
- echo ''.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
function listcontent_open() {
- echo '';
+ $this->doc .= '';
}
function listcontent_close() {
- echo ''.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
function unformatted($text) {
- echo $this->_xmlEntities($text);
+ $this->doc .= $this->_xmlEntities($text);
}
/**
@@ -267,32 +262,32 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
function html($text) {
global $conf;
if($conf['htmlok']){
- echo $text;
+ $this->doc .= $text;
}else{
$this->file($text);
}
}
function preformatted($text) {
- echo '' . $this->_xmlEntities($text) . '
'. DOKU_LF;
+ $this->doc .= '' . $this->_xmlEntities($text) . '
'. DOKU_LF;
}
function file($text) {
- echo '' . $this->_xmlEntities($text). '
'. DOKU_LF;
+ $this->doc .= '' . $this->_xmlEntities($text). '
'. DOKU_LF;
}
/**
* @TODO Shouldn't this output '.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
/**
* @TODO Shouldn't this output ?
*/
function quote_close() {
- echo '
'.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
/**
@@ -312,7 +307,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$geshi->set_link_target($conf['target']['extern']);
$text = $geshi->parse_code();
- echo $text;
+ $this->doc .= $text;
}
}
@@ -322,11 +317,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$title = $this->_xmlEntities($this->acronyms[$acronym]);
- echo ''.$this->_xmlEntities($acronym).'';
} else {
- echo $this->_xmlEntities($acronym);
+ $this->doc .= $this->_xmlEntities($acronym);
}
}
@@ -335,11 +330,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
function smiley($smiley) {
if ( array_key_exists($smiley, $this->smileys) ) {
$title = $this->_xmlEntities($this->smileys[$smiley]);
- echo '
smileys[$smiley].
'" align="middle" alt="'.
$this->_xmlEntities($smiley).'" />';
} else {
- echo $this->_xmlEntities($smiley);
+ $this->doc .= $this->_xmlEntities($smiley);
}
}
@@ -347,39 +342,39 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* not used
function wordblock($word) {
if ( array_key_exists($word, $this->badwords) ) {
- echo '** BLEEP **';
+ $this->doc .= '** BLEEP **';
} else {
- echo $this->_xmlEntities($word);
+ $this->doc .= $this->_xmlEntities($word);
}
}
*/
function entity($entity) {
if ( array_key_exists($entity, $this->entities) ) {
- echo $this->entities[$entity];
+ $this->doc .= $this->entities[$entity];
} else {
- echo $this->_xmlEntities($entity);
+ $this->doc .= $this->_xmlEntities($entity);
}
}
function multiplyentity($x, $y) {
- echo "$x×$y";
+ $this->doc .= "$x×$y";
}
function singlequoteopening() {
- echo "‘";
+ $this->doc .= "‘";
}
function singlequoteclosing() {
- echo "’";
+ $this->doc .= "’";
}
function doublequoteopening() {
- echo "“";
+ $this->doc .= "“";
}
function doublequoteclosing() {
- echo "”";
+ $this->doc .= "”";
}
/**
@@ -430,7 +425,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if($returnonly){
return $this->_formatLink($link);
}else{
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
}
@@ -458,7 +453,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if($conf['relnofollow']) $link['more'] .= ' rel="nofollow"';
//output formatted
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
/**
@@ -523,7 +518,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link['title'] = htmlspecialchars($link['url']);
//output formatted
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
/*
@@ -531,25 +526,25 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* @TODO Correct the CSS class for files? (not windows)
* @TODO Remove hard coded URL to splitbrain.org
function filelink($link, $title = NULL) {
- echo 'doc .= '_getLinkTitle($title, $link, $isImage);
if ( !$isImage ) {
- echo ' class="windows"';
+ $this->doc .= ' class="windows"';
} else {
- echo ' class="media"';
+ $this->doc .= ' class="media"';
}
- echo ' href="'.$this->_xmlEntities($link).'"';
+ $this->doc .= ' href="'.$this->_xmlEntities($link).'"';
- echo ' style="background: transparent url(http://wiki.splitbrain.org/images/windows.gif) 0px 1px no-repeat;"';
+ $this->doc .= ' style="background: transparent url(http://wiki.splitbrain.org/images/windows.gif) 0px 1px no-repeat;"';
- echo ' onclick="return svchk()" onkeypress="return svchk()">';
+ $this->doc .= ' onclick="return svchk()" onkeypress="return svchk()">';
- echo $title;
+ $this->doc .= $title;
- echo '';
+ $this->doc .= '';
}
*/
@@ -583,7 +578,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link['url'] = $url;
//output formatted
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
function emaillink($address, $name = NULL) {
@@ -644,7 +639,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link['title'] = $title;
//output formatted
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
/**
@@ -670,7 +665,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
//output formatted
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
/**
@@ -694,7 +689,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
//output formatted
- echo $this->_formatLink($link);
+ $this->doc .= $this->_formatLink($link);
}
/**
@@ -714,20 +709,20 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$rss = fetch_rss($url);
error_reporting($elvl);
- print '';
}
/**
@@ -797,49 +792,49 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
// $numrows not yet implemented
function table_open($maxcols = NULL, $numrows = NULL){
- echo ''.DOKU_LF;
+ $this->doc .= ''.DOKU_LF;
}
function table_close(){
- echo '
'.DOKU_LF.'
'.DOKU_LF;
+ $this->doc .= '
'.DOKU_LF.'
'.DOKU_LF;
}
function tablerow_open(){
- echo DOKU_TAB . '' . DOKU_LF . DOKU_TAB . DOKU_TAB;
+ $this->doc .= DOKU_TAB . '
' . DOKU_LF . DOKU_TAB . DOKU_TAB;
}
function tablerow_close(){
- echo DOKU_LF . DOKU_TAB . '
' . DOKU_LF;
+ $this->doc .= DOKU_LF . DOKU_TAB . '' . DOKU_LF;
}
function tableheader_open($colspan = 1, $align = NULL){
- echo 'doc .= ' | doc .= ' class="'.$align.'align"';
}
if ( $colspan > 1 ) {
- echo ' colspan="'.$colspan.'"';
+ $this->doc .= ' colspan="'.$colspan.'"';
}
- echo '>';
+ $this->doc .= '>';
}
function tableheader_close(){
- echo ' | ';
+ $this->doc .= '';
}
function tablecell_open($colspan = 1, $align = NULL){
- echo 'doc .= ' | doc .= ' class="'.$align.'align"';
}
if ( $colspan > 1 ) {
- echo ' colspan="'.$colspan.'"';
+ $this->doc .= ' colspan="'.$colspan.'"';
}
- echo '>';
+ $this->doc .= '>';
}
function tablecell_close(){
- echo ' | ';
+ $this->doc .= '';
}
//----------------------------------------------------------
@@ -912,7 +907,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
* Adds code for section editing button
*/
function _secedit($f, $t){
- print '';
+ $this->doc .= '';
}
function _getLinkTitle($title, $default, & $isImage, $id=NULL) {
diff --git a/inc/parserutils.php b/inc/parserutils.php
index a2d750099..717fa64e7 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -25,8 +25,8 @@ function p_wiki_xhtml($id, $rev='', $excuse=true){
$ret = '';
//ensure $id is in global $ID (needed for parsing)
- global $ID;
- $ID = $id;
+// global $ID;
+// $ID = $id;
if($rev){
if(@file_exists($file)){
@@ -75,7 +75,6 @@ function p_cached_xhtml($file){
&& $cachetime > @filemtime($file) // cache is fresh
&& ((time() - $cachetime) < $conf['cachetime']) // and is cachefile young enough
&& !isset($_REQUEST['purge']) // no purge param was set
-
&& ($cachetime > @filemtime(DOKU_INC.'conf/dokuwiki.php')) // newer than the config file
&& ($cachetime > @filemtime(DOKU_INC.'conf/local.php')) // newer than the local config file
&& ($cachetime > @filemtime(DOKU_INC.'inc/parser/xhtml.php')) // newer than the renderer
@@ -213,9 +212,9 @@ function p_get_instructions($text){
$Parser->addMode('eol',new Doku_Parser_Mode_Eol());
// Do the parsing
- $parsed = $Parser->parse($text);
-# dbg($parsed);
- return $parsed;
+ $p = $Parser->parse($text);
+# dbg($p);
+ return $p;
}
/**
--
cgit v1.2.3