Changeset 1128 for trunk/vendor/Text

Show
Ignore:
Timestamp:
02/23/07 19:45:22 (23 months ago)
Author:
zYne
Message:
 
Location:
trunk/vendor/Text
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/vendor/Text/Wiki.php

    r1125 r1128  
    409409    * @return &object a reference to the Text_Wiki unique instantiation. 
    410410    */ 
    411     function &singleton($parser = 'Default', $rules = null) 
     411    function singleton($parser = 'Default', $rules = null) 
    412412    { 
    413413        static $only = array(); 
    414414        if (!isset($only[$parser])) { 
    415             $ret = & Text_Wiki::factory($parser, $rules); 
     415            $ret = Text_Wiki::factory($parser, $rules); 
    416416            if (Text_Wiki::isError($ret)) { 
    417417                return $ret; 
    418418            } 
    419             $only[$parser] =& $ret; 
     419            $only[$parser] = $ret; 
    420420        } 
    421421        return $only[$parser]; 
     
    433433     * @return Text_Wiki a Parser object extended from Text_Wiki 
    434434     */ 
    435     function &factory($parser = 'Default', $rules = null) 
     435    function factory($parser = 'Default', $rules = null) 
    436436    { 
    437437        $class = 'Text_Wiki_' . $parser; 
     
    446446        } 
    447447 
    448         $obj =& new $class($rules); 
     448        $obj = new $class($rules); 
    449449        return $obj; 
    450450    } 
     
    921921                // load may have failed; only parse if 
    922922                // 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])) { 
    924924                    $this->parseObj[$name]->parse(); 
    925925                } 
     
    12231223        } 
    12241224 
    1225         $this->parseObj[$rule] =& new $class($this); 
     1225        $this->parseObj[$rule] = new $class($this); 
    12261226 
    12271227    } 
     
    12591259        } 
    12601260 
    1261         $this->renderObj[$rule] =& new $class($this); 
     1261        $this->renderObj[$rule] = new $class($this); 
    12621262    } 
    12631263 
     
    12921292        } 
    12931293 
    1294         $this->formatObj[$format] =& new $class($this); 
     1294        $this->formatObj[$format] = new $class($this); 
    12951295    } 
    12961296 
  • trunk/vendor/Text/Wiki/Parse/Default/Code.php

    r1125 r1128  
    7272        // are there additional attribute arguments? 
    7373        $args = trim($matches[1]); 
    74          
     74 
    7575        if ($args == '') { 
    7676            $options = array( 
  • trunk/vendor/Text/Wiki/Render/Xhtml/Code.php

    r1125 r1128  
    5959        $css_filename = $this->formatConf(' class="%s"', 'css_filename'); 
    6060 
    61         if ($type == 'php') { 
     61        if ($type == 'php' || true) { 
    6262            if (substr($options['text'], 0, 5) != '<?php') { 
    6363                // PHP code example: 
    6464                // add the PHP tags 
    65                 $text = "<?php\n" . $options['text'] . "\n?>"; // <?php 
     65                $text = "<?php  
     66                " .  $options['text'] . "\n?>"; // <?php 
    6667            } 
    6768 
    6869            // convert tabs to four spaces 
    69             $text = str_replace("\t", "    ", $text); 
     70            $text = str_replace("\t", "&nbsp;&nbsp;%nbsp;&nbsp;", $text); 
    7071 
    7172            // colorize the code block (also converts HTML entities and adds 
    7273            // <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); 
    7777 
    7878            // replace <br /> tags with simple newlines. 
     
    8080            // translate HTML <font> and color to XHTML <span> and style. 
    8181            // courtesy of research by A. Kalin :-). 
     82            /** 
    8283            $map = array( 
    8384                '<br />'  => "\n", 
    8485                '&nbsp;'  => ' ', 
     86                "\n"      => "<br \>", 
    8587                '<font'   => '<span', 
    8688                '</font>' => '</span>', 
    8789                'color="' => 'style="color:' 
    8890            ); 
     91 
    8992            $text = strtr($text, $map); 
     93            */ 
    9094 
    9195            // get rid of the last newline inside the code block 
     
    101105 
    102106            // 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>"; 
    104111 
    105112        } elseif ($type == 'html' || $type == 'xhtml') {