Changeset 124


Ignore:
Timestamp:
2006-09-03T04:20:00+02:00 (9 years ago)
Author:
moo
Message:

Chinese translation for coverager

Location:
trunk/coverager
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/coverager/config.php.example

    r33 r124  
    11<?php
    22
    3 // should be named as config.php
     3// this is an example only
     4// write your own config and name it as config.php
     5
     6// detected by browser
     7// $lang = 'en-us';
    48
    59$charset = "UTF-8";
     10
     11// developers only
     12$show_todo_strings = false;
     13
    614// $include_paths = array("/www/my-php-project/");
    715// $exclude_paths = array("/www/my-php-project/tmp/");
     
    1321function ob_filter_path_nicer($o)
    1422{
     23    $o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}/", $o);
     24    $xcachedir = realpath(dirname(__FILE__) . "/../");
     25    $o = str_replace($xcachedir . "/", "{XCache}/", $o);
    1526    $o = str_replace("/home/", "{H}/", $o);
    1627    return $o;
    1728}
    1829
     30// implement your auth here if needed
     31// {{{ home made login example
     32// this is an example only, it's won't work for you without your implemention.
     33function check_admin_auth()
     34{
     35    require("/path/to/user-login-and-permission-lib.php");
     36    session_start();
     37
     38    if (!user_logined()) {
     39        if (!ask_the_user_to_login()) {
     40            exit;
     41        }
     42    }
     43
     44    user_load_permissions();
     45    if (!user_is_admin()) {
     46        die("Permission denied");
     47    }
     48
     49    return true;
     50}
     51
     52// uncomment:
     53// check_admin_auth()
     54// }}}
     55
    1956?>
  • trunk/coverager/coverager.css

    r33 r124  
     1h1 { text-align: center; }
    12input, table { font-family: monospace; font-size: 11px; }
    23table.cycles { border: 1px solid black; background: white; margin-top: 5px; margin-bottom: 5px; }
    34table.cycles .col1 { background-color: #f5f5f5; }
    45table.cycles .col2 { background-color: #e0e0e0; }
    5 table.cycles th { background-color: #707090; color: white; font-weight: bold; height: 20px; line-height: 16px; font-family: serif; }
     6table.cycles th { background-color: #707090; color: white; font-weight: bold; height: 20px; line-height: 18px; font-family: serif; }
    67th a { color: white; font-weight: bold; display: block; width: 100%; height: 100%; }
    78
     
    3435    width: 100%;
    3536}
    36 .coverBarHi, .coverBarMed, .coverBarLo { left: 1px; top: 1px; }
     37.coverBarHi, .coverBarMed, .coverBarLo { left: 1px; top: 1px; height: 14px; }
    3738.coverBarHi  { background-color: #A7FC9D; }
    3839.coverBarMed { background-color: #FFEA20; }
     
    5657    border: 1px solid gray;
    5758}
     59
     60.footnote { text-align: right; font-size: 12px; }
  • trunk/coverager/coverager.php

    r33 r124  
    11<?php
    22
    3 error_reporting(E_ALL);
    4 define('REQUEST_TIME', time());
     3include("./common.php");
    54
    65class Cycle
     
    4140    var $exclude_paths = array();
    4241    var $charset = 'UTF-8';
     42    var $lang = 'en-us';
     43    var $datadir = null;
     44    var $datadir_len = null;
     45    var $path = null;
     46    var $outpath = null;
    4347
    4448    function XcacheCoverageViewer()
     
    4751
    4852        // copy config
    49         foreach (array('charset', 'include_paths', 'exclude_paths', 'syntaxhiglight', 'usecache', 'datadir') as $k) {
    50             if (isset($GLOBALS['usecache'])) {
    51                 $this->{$k} = $GLOBALS['usecache'];
     53        foreach (array('charset', 'include_paths', 'exclude_paths', 'syntaxhiglight', 'usecache', 'datadir', 'lang') as $k) {
     54            if (isset($GLOBALS[$k])) {
     55                $this->{$k} = $GLOBALS[$k];
    5256            }
    5357        }
    5458
    5559        $this->datadir = preg_replace('!/$!', '', $this->datadir);
    56         $this->datadir_len =  strlen($this->datadir);
     60        $this->datadir_len = strlen($this->datadir);
    5761
    5862        $this->path = isset($_GET['path']) ? $_GET['path'] : '';
     
    125129        }
    126130
     131        $xcache_version = XCACHE_VERSION;
    127132        include("coverager.tpl.php");
    128133    }
     
    304309}
    305310
    306 if (file_exists("config.php")) {
    307     include("config.php");
    308 }
    309 
    310311$app = new XcacheCoverageViewer();
    311312$app->main();
  • trunk/coverager/coverager.tpl.php

    r33 r124  
    66echo <<<HEAD
    77    <meta http-equiv="Content-Type" content="text/html; charset=$this->charset" />
     8    <meta http-equiv="Content-Language" content="{$this->lang}" />
    89    <script type="text/javascript" src="tablesort.js" charset="$this->charset"></script>
    910HEAD;
     
    1112
    1213    <link rel="stylesheet" type="text/css" href="coverager.css" />
    13     <title>XCache Coverage Viewer</title>
     14    <title><?php echo _T("XCache PHP Code Coverage Viewer"); ?></title>
    1415</head>
    1516<body>
     17<h1><?php echo _T("XCache PHP Code Coverage Viewer"); ?></h1>
    1618
    1719<?php
     
    4951    global $cycle;
    5052    $cycle = new Cycle('class="col1"', 'class="col2"');
     53    $l_dir = _T("Directory");
     54    $l_per = _T("Percent");
     55    $l_hit = _T("Hits");
     56    $l_lns = _T("Lines");
     57    $l_tds = _T("TODO");
    5158    return <<<EOS
    5259    <table align="center" cellpadding="2" cellspacing="1" border="0" class="cycles">
    5360    <tr>
    54         <th>Directory</th><th>Percent</th><th>Hits</th><th>Lines</th><th>TODO</th>
     61        <th>{$l_dir}</th><th>{$l_per}</th><th>{$l_hit}</th><th>{$l_lns}</th><th>{$l_tds}</th>
    5562    </tr>
    5663EOS;
     
    105112    global $cycle;
    106113    $cycle = new Cycle('class="col1"', 'class="col2"');
     114    $l_fil = _T("File");
     115    $l_per = _T("Percent");
     116    $l_hit = _T("Hits");
     117    $l_lns = _T("Lines");
    107118    return <<<EOS
    108119    <br>
    109120    <table align="center" cellpadding="2" cellspacing="1" border="0" class="cycles">
    110121    <tr>
    111         <th>File</th><th>Percent</th><th>Hits</th><th>Lines</th>
     122        <th>{$l_fil}</th><th>{$l_per}</th><th>{$l_hit}</th><th>{$l_lns}</th>
    112123    </tr>
    113124EOS;
     
    154165}
    155166
     167$l_root = _T("root");
    156168if ($action == 'dir') {
     169    if (function_exists('ob_filter_path_nicer')) {
     170        ob_start('ob_filter_path_nicer');
     171    }
    157172    $path_html = htmlspecialchars($path);
    158173    echo <<<EOS
    159     <a href="?">root</a> $path<br />
     174    <a href="?">$l_root</a> $path<br />
    160175EOS;
    161176    echo dir_head($dirinfo);
     
    178193}
    179194else if ($action == 'file') {
     195    if (function_exists('ob_filter_path_nicer')) {
     196        ob_start('ob_filter_path_nicer');
     197    }
    180198    $dir_url = urlencode($dir);
    181199    $dir_html = htmlspecialchars($dir);
    182200    echo <<<EOS
    183     <a href="?">root</a> <a href="?path={$dir_url}">{$dir_html}</a>/<b>{$filename}</b><br />
     201    <a href="?">$l_root</a> <a href="?path={$dir_url}">{$dir_html}</a>/<b>{$filename}</b><br />
    184202EOS;
    185203
     
    194212EOS;
    195213    }
     214    if (function_exists('ob_filter_path_nicer')) {
     215        ob_end_flush();
     216    }
    196217    echo <<<EOS
    197218    <pre class="code"><ol>{$filecov}</ol></pre>
     
    209230?>
    210231
     232<div class="footnote">
     233Powered By: XCache <?php echo $xcache_version; ?> coverager <?php echo _T("module"); ?>
     234</div>
     235
    211236</body>
    212237</html>
Note: See TracChangeset for help on using the changeset viewer.