This repository has been archived by the owner on Jan 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
47 lines (39 loc) · 1.41 KB
/
index.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
<?php
$basePath = __DIR__;
// for infinite time of execution
ini_set('max_execution_time', '0');
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 'On');
ini_set('error_log', $basePath . '/php_error.log');
/**
* run: php -S localhost:8000
*/
require $basePath . '/config.php';
require $basePath . '/vendor/autoload.php';
// for Windows: replacing backslashes (\) by slashes (/)
if (strpos($basePath, '\\') !== false) {
$basePath = str_replace('\\', '/', $basePath);
}
/**
* Returns $baseUrl to this framework, also if it's resided in a subdirectory relative to the domain-root.
* The port is respected but omitted in $baseUrl if standard for http (80) or https (443).
*
* @return string $baseUrl
*/
function getBaseUrl() : string
{
$port = ':' . $_SERVER['SERVER_PORT'];
if (($_SERVER['REQUEST_SCHEME'] === 'http' && $_SERVER['SERVER_PORT'] === '80') || ($_SERVER['REQUEST_SCHEME'] === 'https' && $_SERVER['SERVER_PORT'] === '443')) {
$port = '';
}
$path = $_SERVER['SCRIPT_NAME'];
if (strrpos($path, 'index.php') === strlen($path) - 9) {
$path = substr($path, 0, -9);
}
return $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . $port . $path;
}
$baseUrl = getBaseUrl();
$controller = new \CarstenWalther\XliffGen\Controller\XliffGenController($basePath . '/app/', $baseUrl, [
'type' => 'csv',
'data' => $basePath . '/app/Resources/Public/Data'
]);