Add new functions: get IPs, strip UTF8 BOM from text, text updates

Add the following new static methods

Convert\Strings::stripUTF8BomBytes: removes the UTF8 BOM bytes from the beginning of a line
Used for CSV files created in Excel for the first header entry (line 0/row 0)

Get\Systen::getIpAddresses: gets all IP addresses for the the current access user
and returns an array

Moved the frontend folder detection from the first load config to the config.path.php

Cleaned up the translations JS scripts
This commit is contained in:
Clemens Schwaighofer
2024-09-03 09:49:01 +09:00
parent 2d71e760e8
commit ef80cba561
8 changed files with 118 additions and 59 deletions

View File

@@ -1,4 +1,4 @@
<?php
<?php // phpcs:ignore PSR1.Files.SideEffects
/********************************************************************
* AUTHOR: Clemens Schwaighofer
@@ -11,6 +11,20 @@
declare(strict_types=1);
// find trigger name "admin/" or "frontend/" in the getcwd() folder
$folder = '';
foreach (['admin', 'frontend'] as $_folder) {
if (strstr(getcwd() ?: '', DIRECTORY_SEPARATOR . $_folder)) {
$folder = $_folder;
break;
}
}
// if content path is empty, fallback is default
if (empty($folder)) {
$folder = 'default';
}
define('CONTENT_PATH', $folder . DIRECTORY_SEPARATOR);
// File and Folder paths
// ID is TARGET (first array element)
/*$PATHS = [