示例#1
0
$extractLocales = function ($dir) use(&$locales) {
    $locale = $dir->getFilename();
    // Check config
    $configFile = $dir->getRealpath() . '/config.php';
    if (file_exists($configFile)) {
        $config = (include $configFile);
        $locales[$locale] = !empty($config['name']) ? $config['name'] : $locale;
    }
};
$defaultLocalesDir = new \Symfony\Component\Finder\Finder();
$defaultLocalesDir->directories()->in($root . '/bundles/CoreBundle/Translations')->ignoreDotFiles(true)->depth('== 0');
foreach ($defaultLocalesDir as $dir) {
    $extractLocales($dir);
}
$installedLocales = new \Symfony\Component\Finder\Finder();
$installedLocales->directories()->in($root . '/../' . $paths['translations'])->ignoreDotFiles(true)->depth('== 0');
foreach ($installedLocales as $dir) {
    $extractLocales($dir);
}
unset($defaultLocalesDir, $installedLocales, $extractLocales);
$mauticParams['supported_languages'] = $locales;
// Load parameters array from local configuration
if (isset($paths['local_config'])) {
    if (file_exists($paths['local_config'])) {
        include $paths['local_config'];
        // Override default with local
        $mauticParams = array_merge($mauticParams, $parameters);
    }
}
// Force local specific params
if (file_exists(__DIR__ . '/parameters_local.php')) {
示例#2
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
$loader = new Twig_Loader_Filesystem(__DIR__);
$twig = new Twig_Environment($loader);
$finder = new Symfony\Component\Finder\Finder();
$finder->directories()->in(__DIR__)->exclude('vendor')->depth('== 0');
$extensions = get_loaded_extensions();
natcasesort($extensions);
$functions = get_defined_functions();
$functions = $functions['internal'];
shuffle($functions);
$function = current($functions);
echo $twig->render('index.html.twig', array('host' => $_SERVER['SERVER_NAME'], 'directories' => $finder, 'infos' => array(PHP_VERSION, PHP_SAPI, PHP_OS), 'extensions' => $extensions, 'function' => $function));