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