Initial
Takes in a file, process it and output a new file with additional columns.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
session_start();
|
||||
|
||||
$appConfig = require __DIR__ . '/config.php';
|
||||
|
||||
$vendorAutoload = __DIR__ . '/vendor/autoload.php';
|
||||
if (is_file($vendorAutoload)) {
|
||||
require_once $vendorAutoload;
|
||||
}
|
||||
|
||||
function app_config(string $path, mixed $default = null): mixed
|
||||
{
|
||||
global $appConfig;
|
||||
|
||||
$segments = explode('.', $path);
|
||||
$value = $appConfig;
|
||||
|
||||
foreach ($segments as $segment) {
|
||||
if (!is_array($value) || !array_key_exists($segment, $value)) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
$value = $value[$segment];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
function asset_url(string $path): string
|
||||
{
|
||||
$path = ltrim($path, '/');
|
||||
$scriptName = str_replace('\\', '/', (string) ($_SERVER['SCRIPT_NAME'] ?? ''));
|
||||
$scriptDir = rtrim(dirname($scriptName), '/');
|
||||
$documentRoot = rtrim(str_replace('\\', '/', (string) ($_SERVER['DOCUMENT_ROOT'] ?? '')), '/');
|
||||
|
||||
if ($documentRoot !== '' && str_ends_with($documentRoot, '/public')) {
|
||||
$url = '/assets/' . $path;
|
||||
} elseif ($scriptDir === '' || $scriptDir === '.') {
|
||||
$url = '/public/assets/' . $path;
|
||||
} elseif (str_ends_with($scriptDir, '/public')) {
|
||||
$url = $scriptDir . '/assets/' . $path;
|
||||
} else {
|
||||
$url = $scriptDir . '/public/assets/' . $path;
|
||||
}
|
||||
|
||||
$filesystemPath = __DIR__ . '/public/assets/' . $path;
|
||||
if (is_file($filesystemPath)) {
|
||||
$url .= (str_contains($url, '?') ? '&' : '?') . 'v=' . filemtime($filesystemPath);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
foreach ([
|
||||
__DIR__ . '/app/Database.php',
|
||||
__DIR__ . '/app/Support/View.php',
|
||||
__DIR__ . '/app/Import/ImportResult.php',
|
||||
__DIR__ . '/app/Import/ChunkReadFilter.php',
|
||||
__DIR__ . '/app/Import/ImportJobStore.php',
|
||||
__DIR__ . '/app/Import/SpreadsheetReader.php',
|
||||
__DIR__ . '/app/Import/SpreadsheetRowProcessor.php',
|
||||
__DIR__ . '/app/Import/ImportRepository.php',
|
||||
__DIR__ . '/app/Import/ImportService.php',
|
||||
__DIR__ . '/app/Http/AppController.php',
|
||||
] as $file) {
|
||||
require_once $file;
|
||||
}
|
||||
Reference in New Issue
Block a user