Subversion Repositories LCARS

Rev

Rev 152 | Rev 156 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 152 Rev 154
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('styles/lcars-basic.css'),
10
  @filemtime('styles/lcars-basic.css'),
11
  @filemtime('styles/lcars22.css'),
11
  @filemtime('styles/lcars22.css'),
12
  @filemtime('styles/lcars-ani.css'),
12
  @filemtime('styles/lcars-ani.css'),
13
  @filemtime('scripts/object.js'),
13
  @filemtime('scripts/object.js'),
14
));
14
));
15
15
16
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT');
16
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT');
17
17
18
/* Cached resource expires in HTTP/1.1 caches 24h after last retrieval */
18
/* 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');
19
header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate');
20
20
21
/* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
21
/* 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');
22
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');
23
23
24
$languages = array(
24
$languages = array(
25
  'en' => 'English',
25
  'en' => 'English',
26
  'de' => 'Deutsch'
26
  'de' => 'Deutsch'
27
);
27
);
28
28
29
/* TODO: Use Autoloader */
29
/* TODO: Use Autoloader */
30
require_once 'Zend/Stdlib/ErrorHandler.php';
30
require_once 'Zend/Loader/StandardAutoloader.php';
31
require_once 'Zend/I18n/Translator/TextDomain.php';
-
 
32
require_once 'Zend/I18n/Translator/Loader/FileLoaderInterface.php';
31
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
33
require_once 'Zend/I18n/Translator/Loader/Gettext.php';
-
 
34
require_once 'Zend/ServiceManager/ServiceLocatorAwareInterface.php';
-
 
35
require_once 'Zend/ServiceManager/ServiceLocatorInterface.php';
-
 
36
require_once 'Zend/ServiceManager/ServiceManager.php';
32
$loader->register();
37
require_once 'Zend/ServiceManager/AbstractPluginManager.php';
-
 
38
require_once 'Zend/I18n/Translator/LoaderPluginManager.php';
-
 
39
require_once 'Zend/I18n/Translator/Translator.php';
-
 
40
 
33
41
$translator = new Zend\I18n\Translator\Translator();
34
$translator = new Zend\I18n\Translator\Translator();
-
 
35
// $translator->setCache(new Zend\Cache\Storage\*Adapter());
42
$type = 'gettext';
36
$type = 'gettext';
43
$baseDir = './LocaleData';
37
$baseDir = './LocaleData';
44
$pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo';
38
$pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo';
45
$textDomain = 'de.pointedears';
39
$textDomain = 'de.pointedears';
46
$translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);
40
$translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);
47
41
48
/**
42
/**
49
 * Returns the translation of the parameter, if any,
43
 * Returns the translation of the parameter, if any,
50
 * using Zend Framework 2.1 Translate
44
 * using Zend Framework 2.1 Translate
51
 * @param string $s
45
 * @param string $s
52
 * @return string
46
 * @return string
53
 */
47
 */
54
function tr ($s)
48
function tr ($s)
55
{
49
{
56
  global $translator;
50
  global $translator;
57
  global $textDomain;
51
  global $textDomain;
58
  global $language;
52
  global $language;
59
 
53
 
60
  if ($translator)
54
  if ($translator)
61
  {
55
  {
62
    return $translator->translate($s, $textDomain, $language);
56
    return $translator->translate($s, $textDomain, $language);
63
  }
57
  }
64
58
65
  return $s;
59
  return $s;
66
}
60
}
67
61
68
$menu = array(
62
$menu = array(
69
  'scripts'   => array('path' => 'scripts/', 'text' => 'Scripting'),
63
  'scripts'   => array('path' => 'scripts/', 'text' => 'Scripting'),
70
  'es-matrix' => array(
64
  'es-matrix' => array(
71
    'path'  => 'es-matrix',
65
    'path'  => 'es-matrix',
72
    'text'  => 'ES Matrix',
66
    'text'  => 'ES Matrix',
73
    'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")
67
    'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")
74
  ),
68
  ),
75
  'devel'     => array('path' => 'websvn/',   'text' => tr('Software projects')),
69
  'devel'     => array('path' => 'websvn/',   'text' => tr('Software projects')),
76
  'series'    => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),
70
  'series'    => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),
77
  'ufpdb'     => array(
71
  'ufpdb'     => array(
78
    'path'  => "ufpdb/index.$language",
72
    'path'  => "ufpdb/index.$language",
79
    'text'  => 'UFPDB',
73
    'text'  => 'UFPDB',
80
    'title' => tr('United Federation of Planets DataBase')
74
    'title' => tr('United Federation of Planets DataBase')
81
  )
75
  )
82
);
76
);
83
 
77