Changeset 1128 for trunk/vendor/Text
- Timestamp:
- 02/23/07 19:45:22 (23 months ago)
- Location:
- trunk/vendor/Text
- Files:
-
- 3 modified
-
Wiki.php (modified) (7 diffs)
-
Wiki/Parse/Default/Code.php (modified) (1 diff)
-
Wiki/Render/Xhtml/Code.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/vendor/Text/Wiki.php
r1125 r1128 409 409 * @return &object a reference to the Text_Wiki unique instantiation. 410 410 */ 411 function &singleton($parser = 'Default', $rules = null)411 function singleton($parser = 'Default', $rules = null) 412 412 { 413 413 static $only = array(); 414 414 if (!isset($only[$parser])) { 415 $ret = &Text_Wiki::factory($parser, $rules);415 $ret = Text_Wiki::factory($parser, $rules); 416 416 if (Text_Wiki::isError($ret)) { 417 417 return $ret; 418 418 } 419 $only[$parser] = &$ret;419 $only[$parser] = $ret; 420 420 } 421 421 return $only[$parser]; … … 433 433 * @return Text_Wiki a Parser object extended from Text_Wiki 434 434 */ 435 function &factory($parser = 'Default', $rules = null)435 function factory($parser = 'Default', $rules = null) 436 436 { 437 437 $class = 'Text_Wiki_' . $parser; … … 446 446 } 447 447 448 $obj = &new $class($rules);448 $obj = new $class($rules); 449 449 return $obj; 450 450 } … … 921 921 // load may have failed; only parse if 922 922 // an object is in the array now 923 if (is _object($this->parseObj[$name])) {923 if (isset($this->parseObj[$name]) && is_object($this->parseObj[$name])) { 924 924 $this->parseObj[$name]->parse(); 925 925 } … … 1223 1223 } 1224 1224 1225 $this->parseObj[$rule] = &new $class($this);1225 $this->parseObj[$rule] = new $class($this); 1226 1226 1227 1227 } … … 1259 1259 } 1260 1260 1261 $this->renderObj[$rule] = &new $class($this);1261 $this->renderObj[$rule] = new $class($this); 1262 1262 } 1263 1263 … … 1292 1292 } 1293 1293 1294 $this->formatObj[$format] = &new $class($this);1294 $this->formatObj[$format] = new $class($this); 1295 1295 } 1296 1296 -
trunk/vendor/Text/Wiki/Parse/Default/Code.php
r1125 r1128 72 72 // are there additional attribute arguments? 73 73 $args = trim($matches[1]); 74 74 75 75 if ($args == '') { 76 76 $options = array( -
trunk/vendor/Text/Wiki/Render/Xhtml/Code.php
r1125 r1128 59 59 $css_filename = $this->formatConf(' class="%s"', 'css_filename'); 60 60 61 if ($type == 'php' ) {61 if ($type == 'php' || true) { 62 62 if (substr($options['text'], 0, 5) != '<?php') { 63 63 // PHP code example: 64 64 // add the PHP tags 65 $text = "<?php\n" . $options['text'] . "\n?>"; // <?php 65 $text = "<?php 66 " . $options['text'] . "\n?>"; // <?php 66 67 } 67 68 68 69 // convert tabs to four spaces 69 $text = str_replace("\t", " ", $text);70 $text = str_replace("\t", " %nbsp; ", $text); 70 71 71 72 // colorize the code block (also converts HTML entities and adds 72 73 // <code>...</code> tags) 73 ob_start(); 74 highlight_string($text); 75 $text = ob_get_contents(); 76 ob_end_clean(); 74 $h = new PHP_Highlight; 75 $h->loadString($text); 76 $text = $h->toHtml(true); 77 77 78 78 // replace <br /> tags with simple newlines. … … 80 80 // translate HTML <font> and color to XHTML <span> and style. 81 81 // courtesy of research by A. Kalin :-). 82 /** 82 83 $map = array( 83 84 '<br />' => "\n", 84 85 ' ' => ' ', 86 "\n" => "<br \>", 85 87 '<font' => '<span', 86 88 '</font>' => '</span>', 87 89 'color="' => 'style="color:' 88 90 ); 91 89 92 $text = strtr($text, $map); 93 */ 90 94 91 95 // get rid of the last newline inside the code block … … 101 105 102 106 // done 103 $text = "<pre$css>$text</pre>"; 107 $text = "<table border=1 class='dashed' cellpadding=0 cellspacing=0> 108 <tr><td><b>$text 109 </b></td></tr> 110 </table>"; 104 111 105 112 } elseif ($type == 'html' || $type == 'xhtml') {