diff --git a/vendor/Text/Wiki.php b/vendor/Text/Wiki.php index 2b9cbcc22..e0b8e1410 100644 --- a/vendor/Text/Wiki.php +++ b/vendor/Text/Wiki.php @@ -408,15 +408,15 @@ class Text_Wiki { * in further calls it will be effectively ignored. * @return &object a reference to the Text_Wiki unique instantiation. */ - function &singleton($parser = 'Default', $rules = null) + function singleton($parser = 'Default', $rules = null) { static $only = array(); if (!isset($only[$parser])) { - $ret = & Text_Wiki::factory($parser, $rules); + $ret = Text_Wiki::factory($parser, $rules); if (Text_Wiki::isError($ret)) { return $ret; } - $only[$parser] =& $ret; + $only[$parser] = $ret; } return $only[$parser]; } @@ -432,7 +432,7 @@ class Text_Wiki { * {@see Text_Wiki::singleton} for a list of rules * @return Text_Wiki a Parser object extended from Text_Wiki */ - function &factory($parser = 'Default', $rules = null) + function factory($parser = 'Default', $rules = null) { $class = 'Text_Wiki_' . $parser; $file = str_replace('_', '/', $class).'.php'; @@ -445,7 +445,7 @@ class Text_Wiki { } } - $obj =& new $class($rules); + $obj = new $class($rules); return $obj; } @@ -920,7 +920,7 @@ class Text_Wiki { // load may have failed; only parse if // an object is in the array now - if (is_object($this->parseObj[$name])) { + if (isset($this->parseObj[$name]) && is_object($this->parseObj[$name])) { $this->parseObj[$name]->parse(); } } @@ -1222,7 +1222,7 @@ class Text_Wiki { } } - $this->parseObj[$rule] =& new $class($this); + $this->parseObj[$rule] = new $class($this); } @@ -1258,7 +1258,7 @@ class Text_Wiki { } } - $this->renderObj[$rule] =& new $class($this); + $this->renderObj[$rule] = new $class($this); } @@ -1291,7 +1291,7 @@ class Text_Wiki { } } - $this->formatObj[$format] =& new $class($this); + $this->formatObj[$format] = new $class($this); } diff --git a/vendor/Text/Wiki/Parse/Default/Code.php b/vendor/Text/Wiki/Parse/Default/Code.php index f9e446426..80bf44973 100644 --- a/vendor/Text/Wiki/Parse/Default/Code.php +++ b/vendor/Text/Wiki/Parse/Default/Code.php @@ -71,7 +71,7 @@ class Text_Wiki_Parse_Code extends Text_Wiki_Parse { { // are there additional attribute arguments? $args = trim($matches[1]); - + if ($args == '') { $options = array( 'text' => $matches[2], diff --git a/vendor/Text/Wiki/Render/Xhtml/Code.php b/vendor/Text/Wiki/Render/Xhtml/Code.php index a0cb5f2e9..3229d137b 100644 --- a/vendor/Text/Wiki/Render/Xhtml/Code.php +++ b/vendor/Text/Wiki/Render/Xhtml/Code.php @@ -58,35 +58,39 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render { $css_html = $this->formatConf(' class="%s"', 'css_html'); $css_filename = $this->formatConf(' class="%s"', 'css_filename'); - if ($type == 'php') { + if ($type == 'php' || true) { if (substr($options['text'], 0, 5) != '"; // "; // ... tags) - ob_start(); - highlight_string($text); - $text = ob_get_contents(); - ob_end_clean(); + $h = new PHP_Highlight; + $h->loadString($text); + $text = $h->toHtml(true); // replace
tags with simple newlines. // replace non-breaking space with simple spaces. // translate HTML and color to XHTML and style. // courtesy of research by A. Kalin :-). + /** $map = array( '
' => "\n", ' ' => ' ', + "\n" => "
", ' '' => '
', 'color="' => 'style="color:' ); + $text = strtr($text, $map); + */ // get rid of the last newline inside the code block // (becuase higlight_string puts one there) @@ -100,7 +104,10 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render { } // done - $text = "$text"; + $text = " + +
$text +
"; } elseif ($type == 'html' || $type == 'xhtml') {