/var/www/hkosl.com/nick/codeigniter/application/vendor/gettext/languages/src/Exporter/Html.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Gettext\Languages\Exporter;

class 
Html extends Exporter
{
    
/**
     * @see Exporter::toStringDo
     */
    
protected static function toStringDo($languages)
    {
        return 
self::buildTable($languagesfalse);
    }
    protected static function 
h($str)
    {
        return 
htmlspecialchars($strENT_COMPAT'UTF-8');
    }
    protected static function 
buildTable($languages$forDocs)
    {
        
$prefix $forDocs '            ' '';
        
$lines = array();
        
$lines[] = $prefix.'<table'.($forDocs ' class="table table-bordered table-condensed table-striped"' '').'>';
        
$lines[] = $prefix.'    <thead>';
        
$lines[] = $prefix.'        <tr>';
        
$lines[] = $prefix.'            <th>Language code</th>';
        
$lines[] = $prefix.'            <th>Language name</th>';
        
$lines[] = $prefix.'            <th># plurals</th>';
        
$lines[] = $prefix.'            <th>Formula</th>';
        
$lines[] = $prefix.'            <th>Plurals</th>';
        
$lines[] = $prefix.'        </tr>';
        
$lines[] = $prefix.'    </thead>';
        
$lines[] = $prefix.'    <tbody>';
        foreach (
$languages as $lc) {
            
$lines[] = $prefix.'        <tr>';
            
$lines[] = $prefix.'            <td>'.$lc->id.'</td>';
            
$name self::h($lc->name);
            if (isset(
$lc->supersededBy)) {
                
$name .= '<br /><small><span>Superseded by</span> '.$lc->supersededBy.'</small>';
            }
            
$lines[] = $prefix.'            <td>'.$name.'</td>';
            
$lines[] = $prefix.'            <td>'.count($lc->categories).'</td>';
            
$lines[] = $prefix.'            <td>'.self::h($lc->formula).'</td>';
            
$cases = array();
            foreach (
$lc->categories as $c) {
                
$cases[] = '<li><span>'.$c->id.'</span><code>'.self::h($c->examples).'</code></li>';
            }
            
$lines[] = $prefix.'            <td><ol'.($forDocs ' class="cases"' '').' start="0">'.implode(''$cases).'</ol></td>';
            
$lines[] = $prefix.'        </tr>';
        }
        
$lines[] = $prefix.'    </tbody>';
        
$lines[] = $prefix.'</table>';

        return 
implode("\n"$lines);
    }
    
/**
     * @see Exporter::getDescription
     */
    
public static function getDescription()
    {
        return 
'Build a HTML table';
    }
}