Changeset 1684

Show
Ignore:
Timestamp:
01/06/2008 02:31:17 AM (9 months ago)
Author:
Geert
Message:
  • Added cookie data to the Profiler
  • Translators: update profiler file please
  • Also fixed small bug in Profiler library: now using stripos() in combination with str_ireplace() to add profiler data before </body>
Location:
trunk/system
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/config/profiler.php

    r1668 r1684  
    2121 */ 
    2222$config['session'] = TRUE; 
     23 
     24/** 
     25 * Show cookie data. 
     26 */ 
     27$config['cookie'] = TRUE; 
  • trunk/system/i18n/en_US/profiler.php

    r1297 r1684  
    1111        'no_queries'   => 'No queries', 
    1212        'no_database'  => 'Database not loaded', 
     13        'cookie_data'  => 'Cookie Data', 
     14        'no_cookie'    => 'No cookie data', 
    1315); 
  • trunk/system/i18n/nl_NL/profiler.php

    r1524 r1684  
    1111        'no_queries'   => 'Geen queries', 
    1212        'no_database'  => 'Database niet geladen', 
     13        'cookie_data'  => 'Cookie Data', 
     14        'no_cookie'    => 'Geen cookie data', 
    1315); 
  • trunk/system/libraries/Profiler.php

    r1522 r1684  
    7878                } 
    7979 
     80                if (Config::item('profiler.cookie')) 
     81                { 
     82                        $data['cookie'] = TRUE; 
     83                } 
     84 
    8085                // Load the profiler view 
    8186                $view = new View('kohana_profiler', $data); 
    82                  
     87 
    8388                // Return rendered view if $return is TRUE 
    8489                if ($return == TRUE) 
     
    8994                { 
    9095                        // Closing body tag was found, insert the profiler data before it 
    91                         Kohana::$output = str_replace('</body>', $view->render().'</body>', Kohana::$output); 
     96                        Kohana::$output = str_ireplace('</body>', $view->render().'</body>', Kohana::$output); 
    9297                } 
    9398                else 
  • trunk/system/views/kohana_profiler.php

    r1606 r1684  
    6565        background-color: #CCE8FB; 
    6666} 
     67#kp-cookiedata th 
     68{ 
     69        background-color: #FFF4D7; 
     70} 
    6771#kohana-profiler .kp-column 
    6872{ 
     
    237241<?php endif; ?> 
    238242 
     243<?php if (isset($cookie)): ?> 
     244        <table id="kp-cookiedata"> 
     245                <tr> 
     246                        <th colspan="2"><?php echo Kohana::lang('profiler.cookie_data') ?></th> 
     247                </tr> 
     248<?php 
     249 
     250if (count($_COOKIE) == 0): 
     251 
     252?> 
     253                <tr><td colspan="2"><?php echo Kohana::lang('profiler.no_cookie') ?></td></tr> 
     254<?php 
     255 
     256else: 
     257        text::alternate(); 
     258        foreach($_COOKIE as $name => $value): 
     259 
     260?> 
     261                <tr<?php echo text::alternate('', ' class="kp-altrow"') ?>> 
     262                        <td class="kp-name"><?php echo $name ?></td> 
     263                        <td> 
     264                                <?php echo (is_array($value)) ? '<pre>'.html::specialchars(print_r($value, TRUE)).'</pre>' : html::specialchars($value) ?> 
     265                        </td> 
     266                </tr> 
     267<?php 
     268 
     269        endforeach; 
     270endif; 
     271 
     272?> 
     273        </table> 
     274<?php endif; ?> 
     275 
    239276</div>