Rev 191 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 63 | PointedEar | 1 | <?php | 
        
| 2 | |||
| 3 | $encoding = 'UTF-8';  | 
        ||
| 4 | header("Content-Type: text/html" . ($encoding ? "; charset=$encoding" : ""));  | 
        ||
| 5 | |||
| 6 | $modi = max(array(  | 
        ||
| 7 | @filemtime(__FILE__),  | 
        ||
| 106 | PointedEar | 8 | @filemtime('LocaleData'),  | 
        
| 63 | PointedEar | 9 | @filemtime('index.phtml'),  | 
        
| 156 | PointedEar | 10 | @filemtime('footer.phtml'),  | 
        
| 106 | PointedEar | 11 | @filemtime('styles/lcars-basic.css'),  | 
        
| 12 | @filemtime('styles/lcars22.css'),  | 
        ||
| 170 | PointedEar | 13 | @filemtime('styles/lcars22-ie6.css'),  | 
        
| 106 | PointedEar | 14 | @filemtime('styles/lcars-ani.css'),  | 
        
| 15 | @filemtime('scripts/object.js'),  | 
        ||
| 63 | PointedEar | 16 | ));  | 
        
| 17 | |||
| 18 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT');  | 
        ||
| 19 | |||
| 20 | /* Cached resource expires in HTTP/1.1 caches 24h after last retrieval */ | 
        ||
| 117 | PointedEar | 21 | header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate');  | 
        
| 63 | PointedEar | 22 | |
| 23 | /* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */ | 
        ||
| 117 | PointedEar | 24 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');  | 
        
| 63 | PointedEar | 25 | |
| 26 | $languages = array(  | 
        ||
| 27 | 'en' => 'English',  | 
        ||
| 191 | PointedEar | 28 | 'de' => 'Deutsch',  | 
        
| 29 | //   'ru' => 'По-русски', | 
        ||
| 63 | PointedEar | 30 | );  | 
        
| 31 | |||
| 154 | PointedEar | 32 | require_once 'Zend/Loader/StandardAutoloader.php';  | 
        
| 33 | $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));  | 
        ||
| 34 | $loader->register();  | 
        ||
| 35 | |||
| 151 | PointedEar | 36 | $translator = new Zend\I18n\Translator\Translator();  | 
        
| 154 | PointedEar | 37 | // $translator->setCache(new Zend\Cache\Storage\*Adapter()); | 
        
| 151 | PointedEar | 38 | $type = 'gettext';  | 
        
| 189 | PointedEar | 39 | $baseDir = './i18n/LocaleData';  | 
        
| 137 | PointedEar | 40 | $textDomain = 'de.pointedears';  | 
        
| 191 | PointedEar | 41 | $pattern = "%s/LC_MESSAGES/{$textDomain}.mo";  | 
        
| 151 | PointedEar | 42 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);  | 
        
| 63 | PointedEar | 43 | |
| 151 | PointedEar | 44 | /** | 
        
| 45 |  * Returns the translation of the parameter, if any, | 
        ||
| 46 |  * using Zend Framework 2.1 Translate | 
        ||
| 156 | PointedEar | 47 |  * | 
        
| 151 | PointedEar | 48 |  * @param string $s | 
        
| 49 |  * @return string | 
        ||
| 50 |  */ | 
        ||
| 51 | function tr ($s)  | 
        ||
| 141 | PointedEar | 52 | { | 
        
| 151 | PointedEar | 53 | global $translator;  | 
        
| 54 | global $textDomain;  | 
        ||
| 55 | global $language;  | 
        ||
| 170 | PointedEar | 56 | |
| 191 | PointedEar | 57 |   /* DEBUG */ | 
        
| 58 | //   echo "return \$translator->translate(\"$s\", \"$textDomain\", \"$language\");<br>\n"; | 
        ||
| 59 | |||
| 156 | PointedEar | 60 | return $translator->translate($s, $textDomain, $language);  | 
        
| 137 | PointedEar | 61 | } | 
        
| 62 | |||
| 63 | PointedEar | 63 | $menu = array(  | 
        
| 71 | PointedEar | 64 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'),  | 
        
| 65 | 'es-matrix' => array(  | 
        ||
| 66 | 'path' => 'es-matrix',  | 
        ||
| 67 | 'text' => 'ES Matrix',  | 
        ||
| 151 | PointedEar | 68 | 'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")  | 
        
| 71 | PointedEar | 69 | ),  | 
        
| 152 | PointedEar | 70 | 'devel' => array('path' => 'websvn/', 'text' => tr('Software projects')),  | 
        
| 71 | PointedEar | 71 | 'series' => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),  | 
        
| 72 | 'ufpdb' => array(  | 
        ||
| 63 | PointedEar | 73 | 'path' => "ufpdb/index.$language",  | 
        
| 74 | 'text' => 'UFPDB',  | 
        ||
| 151 | PointedEar | 75 | 'title' => tr('United Federation of Planets DataBase')  | 
        
| 63 | PointedEar | 76 |   ) | 
        
| 140 | PointedEar | 77 | );  |