Changeset 206

Show
Ignore:
Timestamp:
05/04/06 15:25:49 (3 years ago)
Author:
bart
Message:

Included patch from Stadler from ticket #23. It adds a nice menu

and code highlighting.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/AUTHORS

    r162 r206  
    1010- Frank Alcantara  <frankalcantara at users.sourceforge.net> 
    1111 
     12Code used from: 
     13Aidan Lister <aidan [ett] php [dutt] net> - The PHP_Highlight.php script 
     14 
    1215eAccelerator is based on Turck MMCache, written by 
    1316  Dmitry Stogov <dstogov at users.sourceforge.net> 
  • eaccelerator/trunk/ChangeLog

    r205 r206  
    33        * Don't store the doc_comments in op_array and class_entry. They are  
    44          useless. this should reduce memory footprint. 
     5        * Included patch from Stadler from ticket #23. It adds a nice menu  
     6          and code highlighting. 
    57 
    682006-04-13  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
  • eaccelerator/trunk/README

    r197 r206  
    242242 
    243243When you compile eAccelerator with --with-eaccelerator-disassembler you need  
    244 to place the dasm.php file also in the same directory as the control.php file. 
     244to place the dasm.php and PHP_Highlight.php file also in the same directory  
     245as the control.php file. 
    245246You can set the username and password needed to access this file at the top 
    246247of the file. 
  • eaccelerator/trunk/dasm.php

    r198 r206  
    6565        input {width: 150px} 
    6666        h1 {width: 800px;  border: 1px solid #000000; margin-left: auto; margin-right: auto; background-color: #9999cc;} 
     67        .l {border: 1px solid #000000; text-align: left; width: 800px; margin: auto; font-size: 65%;} 
     68        .l h2 {font-size: 200%; text-align: center; } 
    6769    </style> 
    6870</head> 
     
    8082        } 
    8183 
    82         $source = explode("\n", htmlentities(file_get_contents($_GET['file']), ENT_QUOTES, 'UTF-8')); 
    83 //      $source = explode("\n", file_get_contents($_GET['file'])); 
     84        require_once('PHP_Highlight.php'); 
     85        $h = new PHP_Highlight; 
     86        $h->loadFile($_GET['file']); 
     87        $source = $h->toArray(); 
    8488 
    8589        /* what do we need to do ? */ 
     
    8993                $show = $_GET['show']; 
    9094        } 
     95 
     96        print_layout(); 
    9197        switch ($show) { 
    9298                case 'main': 
     
    98104                        } 
    99105                        break; 
    100                 case 'classes': 
    101                         if (is_array($asm['classes'][$_GET['name']])) { 
    102                                 print_class($_GET['name'], $asm['classes'][$_GET['name']]); 
    103                         } 
     106                case 'methods': 
    104107                        if (isset($_GET['method']) && is_array($asm['classes'][$_GET['name']][$_GET['method']])) { 
    105108                                print_method($_GET['method'], $asm['classes'][$_GET['name']][$_GET['method']]); 
    106109                        } 
    107110                        break; 
    108                 default: 
    109                         print_layout(); 
    110111        } 
    111112 
     
    121122/* {{{ print_op_array */ 
    122123    function print_op_array($op_array) { ?> 
     124        <h2>Global file op_array</h2> 
    123125        <table> 
    124126            <tr> 
     
    149151                        if ($code != '') { 
    150152                                echo "<tr>\n"; 
    151 //                              echo '<td  class="source" colspan="7"><pre>' . highlight_string($code, true) . "</pre></td>\n"; 
    152153                                echo '<td  class="source" colspan="7"><pre>' . $code . "</pre></td>\n"; 
    153154                                echo "</tr>\n"; 
     
    174175                        if ($code != '') { 
    175176                                echo "<tr>\n"; 
    176 //                              echo '<td  class="source" colspan="7"><pre>' . highlight_string($code, true) . "</pre></td>\n"; 
    177177                                echo '<td  class="source" colspan="7"><pre>' . $code . "</pre></td>\n"; 
    178178                                echo "</tr>\n"; 
     
    204204                global $asm, $file; 
    205205                echo "<h2>Script layout</h2>\n"; 
    206                 echo "<div style=\"text-align: left; width: 800px\">\n"; 
     206                echo "<div class=\"l\">\n"; 
    207207                echo "<ul>\n"; 
    208208                if (isset($asm['op_array'])) { 
     
    218218                if (isset($asm['classes']) && count($asm['classes']) > 0) { 
    219219                        echo "<li>Classes<ul>\n"; 
    220                         foreach ($asm['classes'] as $name => $data) { 
    221                                 echo "<li><a href=\"?file=$file&show=classes&name=$name\">$name</a></li>"; 
     220                        foreach ($asm['classes'] as $name => $class) { 
     221                                echo "<li>$name<ul><li style=\"list-style-type: none\">Methods</li>\n"; 
     222                                foreach (array_keys($class) as $method) { 
     223                                        echo "<li><a href=\"?file=$file&amp;show=methods&amp;name=$name&amp;method=$method\">$method</a></li>\n"; 
     224                                } 
     225                                echo "</ul></li>\n"; 
    222226                        } 
    223227                        echo "</ul></li>\n"; 
     
    227231                echo "</div>\n"; 
    228232        } 
    229 /* }}} */ 
    230  
    231 /* {{{ print a the class layout */ 
    232         function print_class($name, $class) { 
    233                 global $file; 
    234         echo "<h2>Class $name</h2>"; 
    235                 echo "<div style=\"text-align: left; width: 800px\"><ul>\n"; 
    236         foreach($class as $method => $data) { 
    237                         echo "<li><a href=\"?file=$file&amp;show=classes&amp;name=$name&amp;method=$method\">$method</a></li>\n"; 
    238         } 
    239                 echo "</ul></div>"; 
    240     } 
    241233/* }}} */ 
    242234?>