Compare commits

...

5 Commits

Author SHA1 Message Date
Clemens Schwaighofer
aa2b60973e HTML::htmlent and HTML::checked updates
Changed Params form ENT_COMPAT | ENT_HTML401 to ENT_QUOTES | ENT_HTML5
Flags can be overwritten on call

Logic clean up for return flow

HTML::checked gets logic updated with less nested ifs
2024-08-05 13:24:37 +09:00
Clemens Schwaighofer
554dd5f73c Fix not closed <head> block in all admin test files 2024-08-05 12:53:48 +09:00
Clemens Schwaighofer
e6f9559fbb DB IO: placeholder fix for JSON/JSONB lists 2024-07-29 16:30:48 +09:00
Clemens Schwaighofer
770d6f30a4 DB\IO Placeholder regex fix for json queries, test data updates
Some doc typo fixes
test updates with remove of not used sub calls

DB IO Placeholder regex now checks for any JSON/JSONB operators
2024-07-29 15:55:38 +09:00
Clemens Schwaighofer
f94f6cbe87 Add .shellcheckrc, move phpstan tmp folder to repository temp folder 2024-07-19 18:40:24 +09:00
61 changed files with 111 additions and 86 deletions

2
.shellcheckrc Normal file
View File

@@ -0,0 +1,2 @@
shell=bash
external-sources=true

View File

@@ -12,7 +12,7 @@ if [ "${1}" = "t" ] || [ "${2}" = "t" ]; then
opt_testdox="--testdox"; opt_testdox="--testdox";
fi; fi;
php_bin=""; php_bin="";
if [ ! -z "${1}" ]; then if [ -n "${1}" ]; then
case "${1}" in case "${1}" in
# "7.3") php_bin="/usr/bin/php7.3 "; ;; # "7.3") php_bin="/usr/bin/php7.3 "; ;;
# "7.4") php_bin="/usr/bin/php7.4 "; ;; # "7.4") php_bin="/usr/bin/php7.4 "; ;;
@@ -23,7 +23,7 @@ if [ ! -z "${1}" ]; then
*) echo "Not support PHP: ${1}"; exit; ;; *) echo "Not support PHP: ${1}"; exit; ;;
esac; esac;
fi; fi;
if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then if [ -n "${2}" ] && [ -z "${php_bin}" ]; then
case "${2}" in case "${2}" in
# "7.3") php_bin="/usr/bin/php7.3 "; ;; # "7.3") php_bin="/usr/bin/php7.3 "; ;;
# "7.4") php_bin="/usr/bin/php7.4 "; ;; # "7.4") php_bin="/usr/bin/php7.4 "; ;;

View File

@@ -2,7 +2,7 @@
includes: includes:
- phpstan-conditional.php - phpstan-conditional.php
parameters: parameters:
tmpDir: /tmp/phpstan-corelibs tmpDir: %currentWorkingDirectory%/tmp/phpstan-corelibs
level: 8 # max is now 9 level: 8 # max is now 9
checkMissingCallableSignature: true checkMissingCallableSignature: true
treatPhpDocTypesAsCertain: false treatPhpDocTypesAsCertain: false
@@ -39,9 +39,9 @@ parameters:
- www/vendor - www/vendor
# ignore errores with # ignore errores with
ignoreErrors: ignoreErrors:
# - # in the class_test tree we allow deprecated calls - # in the class_test tree we allow deprecated calls
# message: "#^Call to deprecated method #" message: "#^Call to deprecated method #"
# path: %currentWorkingDirectory%/www/admin/class_test.*.php path: %currentWorkingDirectory%/www/admin/class_test.*.php
# - '#Expression in empty\(\) is always falsy.#' # - '#Expression in empty\(\) is always falsy.#'
# - # -
# message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#' # message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#'

2
tmp/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -46,7 +46,7 @@ use CoreLibs\Debug\Support;
$PAGE_NAME = 'TEST CLASS: ADMIN BACKEND'; $PAGE_NAME = 'TEST CLASS: ADMIN BACKEND';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -21,7 +21,7 @@ ob_end_flush();
use CoreLibs\Combined\ArrayHandler; use CoreLibs\Combined\ArrayHandler;
use CoreLibs\Debug\Support as DgS; use CoreLibs\Debug\Support as DgS;
use CoreLibs\Convert\SetVarType; use CoreLibs\Convert\SetVarType;
use PHPUnit\Framework\Constraint\ArrayHasKey; // use PHPUnit\Framework\Constraint\ArrayHasKey;
$log = new CoreLibs\Logging\Logging([ $log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG, 'log_folder' => BASE . LOG,
@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: ARRAY HANDLER'; $PAGE_NAME = 'TEST CLASS: ARRAY HANDLER';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -23,7 +23,7 @@ use CoreLibs\Convert\Byte;
$PAGE_NAME = 'TEST CLASS: AUTOLOADER'; $PAGE_NAME = 'TEST CLASS: AUTOLOADER';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $byte_class = 'CoreLibs\Convert\Byte';
$PAGE_NAME = 'TEST CLASS: BYTE CONVERT'; $PAGE_NAME = 'TEST CLASS: BYTE CONVERT';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CHECK COLORS'; $PAGE_NAME = 'TEST CLASS: CHECK COLORS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $db = new CoreLibs\DB\IO(DB_CONFIG, $log);
$PAGE_NAME = 'TEST CLASS: CLASS CALLS'; $PAGE_NAME = 'TEST CLASS: CLASS CALLS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONFIG DIRECT'; $PAGE_NAME = 'TEST CLASS: CONFIG DIRECT';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONFIG LINK'; $PAGE_NAME = 'TEST CLASS: CONFIG LINK';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -31,7 +31,7 @@ $color_class = 'CoreLibs\Convert\Colors';
$PAGE_NAME = 'TEST CLASS: CONVERT COLORS'; $PAGE_NAME = 'TEST CLASS: CONVERT COLORS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CREATE EMAIL'; $PAGE_NAME = 'TEST CLASS: CREATE EMAIL';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $datetime_class = 'CoreLibs\Combined\DateTime';
$PAGE_NAME = 'TEST CLASS: DATE/TIME'; $PAGE_NAME = 'TEST CLASS: DATE/TIME';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -451,6 +451,7 @@ function intervalStringFormatDeprecated(
$value = $interval->days; $value = $interval->days;
$skip = true; $skip = true;
} else { } else {
/** @phan-suppress-next-line PhanUndeclaredProperty */
$value = $interval->$part; $value = $interval->$part;
} }
if ($value == 0 && $skip_last_zero === true) { if ($value == 0 && $skip_last_zero === true) {

View File

@@ -34,7 +34,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB dbReturn'; $PAGE_NAME = 'TEST CLASS: DB dbReturn';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><a href="class_test.db.php">Class Test DB</a></div>'; print '<div><a href="class_test.db.php">Class Test DB</a></div>';

View File

@@ -35,7 +35,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB'; $PAGE_NAME = 'TEST CLASS: DB';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><a href="class_test.db.type.php">Class Test DB row type convert to PHP type</a></div>'; print '<div><a href="class_test.db.type.php">Class Test DB row type convert to PHP type</a></div>';

View File

@@ -20,7 +20,7 @@ $LOG_FILE_ID = 'classTest-db-query-placeholder';
ob_end_flush(); ob_end_flush();
use CoreLibs\Debug\Support; use CoreLibs\Debug\Support;
use CoreLibs\DB\Support\ConvertPlaceholder; // use CoreLibs\DB\Support\ConvertPlaceholder;
$log = new CoreLibs\Logging\Logging([ $log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG, 'log_folder' => BASE . LOG,
@@ -33,7 +33,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDER'; $PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDER';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -19,7 +19,7 @@ require 'config.php';
$LOG_FILE_ID = 'classTest-db-query-placeholders'; $LOG_FILE_ID = 'classTest-db-query-placeholders';
ob_end_flush(); ob_end_flush();
use CoreLibs\Debug\Support; // use CoreLibs\Debug\Support;
$log = new CoreLibs\Logging\Logging([ $log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG, 'log_folder' => BASE . LOG,
@@ -32,7 +32,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDERS'; $PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDERS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -33,7 +33,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB COLUMN TYPES'; $PAGE_NAME = 'TEST CLASS: DB COLUMN TYPES';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -43,7 +43,7 @@ $debug_logging_class = 'CoreLibs\Debug\LoggingLegacy';
$PAGE_NAME = 'TEST CLASS: DEBUG'; $PAGE_NAME = 'TEST CLASS: DEBUG';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS'; $PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -35,7 +35,7 @@ $chk_enc = 'CoreLibs\Check\Encoding';
$PAGE_NAME = 'TEST CLASS: ENCODING (CHECK/CONVERT/MIME)'; $PAGE_NAME = 'TEST CLASS: ENCODING (CHECK/CONVERT/MIME)';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -31,7 +31,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: ENCRYPTION'; $PAGE_NAME = 'TEST CLASS: ENCRYPTION';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: ERROR MSG'; $PAGE_NAME = 'TEST CLASS: ERROR MSG';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: FILE'; $PAGE_NAME = 'TEST CLASS: FILE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -31,7 +31,7 @@ $hash_class = 'CoreLibs\Create\Hash';
$PAGE_NAME = 'TEST CLASS: HASH'; $PAGE_NAME = 'TEST CLASS: HASH';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -35,19 +35,20 @@ $elements_class = 'CoreLibs\Output\Form\Elements';
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS'; $PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
$string = "Something < = > Other <br> Next line"; $string = "Something < = > Other <br> Next line and Quotes '\"";
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . "<br>"; echo "String: <pre>$string</pre><br>";
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . " (" . htmlentities($string) . ")<br>";
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>"; print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
$date_str = [2021, 5, 1, 11, 10]; $date_str = [2021, 5, 1, 11, 10];
print "PRINTDATETIME: " print "PRINTDATETIME: "
. $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>"; . $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>";
// STATIC // STATIC
$string = "Something < = > Other <br> Next line"; // $string = "Something < = > Other <br> Next line and Quotes '\"";
print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "<br>"; print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "<br>";
print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "<br>"; print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "<br>";
$date_str = [2021, 5, 1, 11, 10]; $date_str = [2021, 5, 1, 11, 10];
@@ -67,8 +68,10 @@ $checked_list = [
['foo', ['bar']], ['foo', ['bar']],
]; ];
foreach ($checked_list as $check) { foreach ($checked_list as $check) {
print "CHECKED(0): $check[0]: " . Html::checked($check[1], $check[0]) . "<br>"; print "CHECKED(0): " . $check[0] . " -> " . print_r($check[1], true) . ": "
print "CHECKED(1): $check[0]: " . Html::checked($check[1], $check[0], Html::CHECKED) . "<br>"; . Html::checked($check[1], $check[0]) . "<br>";
print "CHECKED(1): " . $check[0] . " -> " . print_r($check[1], true) . ": "
. Html::checked($check[1], $check[0], Html::CHECKED) . "<br>";
} }
// magic link creation test // magic link creation test

View File

@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML BUILD: BLOCK'; $PAGE_NAME = 'TEST CLASS: HTML BUILD: BLOCK';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML BUILD'; $PAGE_NAME = 'TEST CLASS: HTML BUILD';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML BUILD: STRING REPLACE'; $PAGE_NAME = 'TEST CLASS: HTML BUILD: STRING REPLACE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -32,7 +32,7 @@ $image_class = 'CoreLibs\Output\Image';
$PAGE_NAME = 'TEST CLASS: IMAGE'; $PAGE_NAME = 'TEST CLASS: IMAGE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -32,7 +32,7 @@ $json_class = 'CoreLibs\Convert\Json';
$PAGE_NAME = 'TEST CLASS: JSON'; $PAGE_NAME = 'TEST CLASS: JSON';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -20,7 +20,7 @@ ob_end_flush();
$PAGE_NAME = 'TEST CLASS: LANG'; $PAGE_NAME = 'TEST CLASS: LANG';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -38,7 +38,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: LOGGING'; $PAGE_NAME = 'TEST CLASS: LOGGING';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -44,7 +44,7 @@ $login->loginMainCall();
$PAGE_NAME = 'TEST CLASS: LOGIN'; $PAGE_NAME = 'TEST CLASS: LOGIN';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $math_class = 'CoreLibs\Convert\Math';
$PAGE_NAME = 'TEST CLASS: MATH'; $PAGE_NAME = 'TEST CLASS: MATH';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: MEMORY USAGE'; $PAGE_NAME = 'TEST CLASS: MEMORY USAGE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -27,7 +27,7 @@ $_mime = new CoreLibs\Convert\MimeAppName();
$PAGE_NAME = 'TEST CLASS: MIME'; $PAGE_NAME = 'TEST CLASS: MIME';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -74,7 +74,7 @@ $form = new CoreLibs\Output\Form\Generate(
$PAGE_NAME = 'TEST CLASS: FORM GENERATE'; $PAGE_NAME = 'TEST CLASS: FORM GENERATE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -32,7 +32,7 @@ $password_class = 'CoreLibs\Security\Password';
$PAGE_NAME = 'TEST CLASS: PASSWORD'; $PAGE_NAME = 'TEST CLASS: PASSWORD';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -63,7 +63,7 @@ $backend->db->dbInfo(true);
ob_end_flush(); ob_end_flush();
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS</title><head>"; print "<html><head><title>TEST CLASS</title></head>";
print "<body>"; print "<body>";
// key: file name, value; name // key: file name, value; name

View File

@@ -32,7 +32,7 @@ $phpv_class = 'CoreLibs\Check\PhpVersion';
$PAGE_NAME = 'TEST CLASS: PHP VERSION'; $PAGE_NAME = 'TEST CLASS: PHP VERSION';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $array_class = 'CoreLibs\Create\RandomKey';
$PAGE_NAME = 'TEST CLASS: RANDOM KEY'; $PAGE_NAME = 'TEST CLASS: RANDOM KEY';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -27,7 +27,7 @@ $ref_class = 'CoreLibs\Get\ReadEnvFile';
$PAGE_NAME = 'TEST CLASS: READ ENV FILE'; $PAGE_NAME = 'TEST CLASS: READ ENV FILE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: RUNNING TIME'; $PAGE_NAME = 'TEST CLASS: RUNNING TIME';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -50,7 +50,7 @@ $session = new Session();
$PAGE_NAME = 'TEST CLASS: SESSION'; $PAGE_NAME = 'TEST CLASS: SESSION';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -50,7 +50,7 @@ $session = new Session();
$PAGE_NAME = 'TEST CLASS: SESSION (READ)'; $PAGE_NAME = 'TEST CLASS: SESSION (READ)';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -47,7 +47,7 @@ $adm->DATA['adm_set'] = 'SET from admin class';
$PAGE_NAME = 'TEST CLASS: SMARTY'; $PAGE_NAME = 'TEST CLASS: SMARTY';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -97,7 +97,7 @@ $smarty->DATA['drop_down_test'] = [
'foobar' => 'Foo Bar', 'foobar' => 'Foo Bar',
]; ];
$smarty->DATA['drop_down_test_selected'] = 'bar'; $smarty->DATA['drop_down_test_selected'] = 'bar';
$smarty->DATA['drop_down_test_nested'] = [ $smarty->DATA['drop_down_test_nested'] = [
'' => '選択してください', '' => '選択してください',
'4/25(木)' => [ '4/25(木)' => [
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50', '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',

View File

@@ -23,7 +23,7 @@ $byte_class = 'CoreLibs\Convert\Strings';
$PAGE_NAME = 'TEST CLASS: STRINGS CONVERT'; $PAGE_NAME = 'TEST CLASS: STRINGS CONVERT';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: SYSTEM'; $PAGE_NAME = 'TEST CLASS: SYSTEM';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $token_class = 'CoreLibs\Output\Form\Token';
$PAGE_NAME = 'TEST CLASS: FORM TOKEN'; $PAGE_NAME = 'TEST CLASS: FORM TOKEN';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $uids_class = 'CoreLibs\Create\Uids';
$PAGE_NAME = 'TEST CLASS: UIDS'; $PAGE_NAME = 'TEST CLASS: UIDS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE'; $PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="class_test.php">Class Test Master</a></div>'; print '<div><a href="class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONFIG DIRECT SUB'; $PAGE_NAME = 'TEST CLASS: CONFIG DIRECT SUB';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; print "<body>";
print '<div><a href="../class_test.php">Class Test Master</a></div>'; print '<div><a href="../class_test.php">Class Test Master</a></div>';
print '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -47,7 +47,7 @@ $l10n = new \CoreLibs\Language\L10n(
); );
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>GROUP TESTER</title><head>"; print "<html><head><title>GROUP TESTER</title></head>";
print "<body>"; print "<body>";
print '<form method="post" name="loginlogout">'; print '<form method="post" name="loginlogout">';

View File

@@ -16,16 +16,22 @@ class Html
/** /**
* full wrapper for html entities * full wrapper for html entities
* *
* uses default params as: ENT_QUOTES | ENT_HTML5
* switches from ENT_HTML401 to ENT_HTML5 as we assume all our pages have <!DOCTYPE html>
* removed: ENT_SUBSTITUTE -> wrong characters will be replaced with space
* encodes in UTF-8
* does not double encode
*
* @param mixed $string string to html encode * @param mixed $string string to html encode
* @param int $flags [default: ENT_QUOTES | ENT_HTML5]
* @return mixed if string, encoded, else as is (eg null) * @return mixed if string, encoded, else as is (eg null)
*/ */
public static function htmlent(mixed $string): mixed public static function htmlent(mixed $string, int $flags = ENT_QUOTES | ENT_HTML5): mixed
{ {
if (is_string($string)) { if (is_string($string)) {
return htmlentities($string, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); return htmlentities($string, $flags, 'UTF-8', false);
} else {
return $string;
} }
return $string;
} }
/** /**
@@ -54,14 +60,10 @@ class Html
*/ */
public static function checked(array|string $haystack, string $needle, int $type = 0): ?string public static function checked(array|string $haystack, string $needle, int $type = 0): ?string
{ {
if (is_array($haystack)) { if (is_array($haystack) && in_array($needle, $haystack)) {
if (in_array($needle, $haystack)) { return $type ? 'checked' : 'selected';
return $type ? 'checked' : 'selected'; } elseif (!is_array($haystack) && $haystack == $needle) {
} return $type ? 'checked' : 'selected';
} else {
if ($haystack == $needle) {
return $type ? 'checked' : 'selected';
}
} }
return null; return null;
} }

View File

@@ -1324,8 +1324,12 @@ class IO
// /s for matching new line in . list // /s for matching new line in . list
// [disabled, we don't used ^ or $] /m for multi line match // [disabled, we don't used ^ or $] /m for multi line match
// Matches in 1:, must be array_filtered to remove empty, count with array_unique // Matches in 1:, must be array_filtered to remove empty, count with array_unique
$query_split = '[(=,?-]|->|->>|#>|#>>|@>|<@|\?\|\?\&|\|\||#-';
preg_match_all( preg_match_all(
'/(?:\'.*?\')?\s*(?:\?\?|<>|[(=,])\s*(?:\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))/s', '/'
. '(?:\'.*?\')?\s*(?:\?\?|<>|' . $query_split . ')\s*'
. '(?:\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))'
. '/s',
$query, $query,
$match $match
); );

View File

@@ -39,9 +39,11 @@ class ConvertPlaceholder
): array { ): array {
$convert_to = strtolower($convert_to); $convert_to = strtolower($convert_to);
$matches = []; $matches = [];
$query_split = '[(=,?-]|->|->>|#>|#>>|@>|<@|\?\|\?\&|\|\||#-';
$pattern = '/' $pattern = '/'
// prefix string part, must match towards // prefix string part, must match towards
. '(?:\'.*?\')?\s*(?:\?\?|[(=,])\s*' // seperator for ( = , ? - [and json/jsonb in pg doc section 9.15]
. '(?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*'
// match for replace part // match for replace part
. '(?:' . '(?:'
// digit -> ignore // digit -> ignore
@@ -96,7 +98,10 @@ class ConvertPlaceholder
$type = 'named'; $type = 'named';
$matches_return = $named_matches; $matches_return = $named_matches;
// only check for :named // only check for :named
$pattern_replace = '/((?:\'.*?\')?\s*(?:\?\?|[(=,])\s*)(\d+|(?:\'.*?\')|(:\w+))/s'; $pattern_replace = '/'
. '((?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*)'
. '(\d+|(?:\'.*?\')|(:\w+))'
. '/s';
// 0: full // 0: full
// 1: pre part // 1: pre part
// 2: keep part UNLESS '3' is set // 2: keep part UNLESS '3' is set
@@ -134,7 +139,10 @@ class ConvertPlaceholder
// order and data stays the same // order and data stays the same
$params_new = $params; $params_new = $params;
// only check for ? // only check for ?
$pattern_replace = '/((?:\'.*?\')?\s*(?:\?\?|[(=,])\s*)(\d+|(?:\'.*?\')|(?:(?:\?\?)?\s*(\?{1})))/s'; $pattern_replace = '/'
. '((?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*)'
. '(\d+|(?:\'.*?\')|(?:(?:\?\?)?\s*(\?{1})))'
. '/s';
// 0: full // 0: full
// 1: pre part // 1: pre part
// 2: keep part UNLESS '3' is set // 2: keep part UNLESS '3' is set
@@ -163,7 +171,10 @@ class ConvertPlaceholder
$type = 'numbered'; $type = 'numbered';
$matches_return = $numbered_matches; $matches_return = $numbered_matches;
// only check for $n // only check for $n
$pattern_replace = '/((?:\'.*?\')?\s*(?:\?\?|[(=,])\s*)(\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))/s'; $pattern_replace = '/'
. '((?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*)'
. '(\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))'
. '/s';
// 0: full // 0: full
// 1: pre part // 1: pre part
// 2: keep part UNLESS '3' is set // 2: keep part UNLESS '3' is set

View File

@@ -46,7 +46,7 @@ class CachedFileReader extends \CoreLibs\Language\Core\StringReader
if (!is_resource($fd)) { if (!is_resource($fd)) {
$this->error = 3; // Cannot read file, probably permissions $this->error = 3; // Cannot read file, probably permissions
} else { } else {
$this->fd_str = fread($fd, filesize($filename) ?: 0) ?: ''; $this->fd_str = fread($fd, filesize($filename) ?: 1) ?: '';
fclose($fd); fclose($fd);
} }
} else { } else {

View File

@@ -185,7 +185,7 @@ class SmartyExtend extends \Smarty
// call basic smarty // call basic smarty
// or Smarty::__construct(); // or Smarty::__construct();
parent::__construct(); parent::__construct();
// iinit lang // init lang
$this->l10n = $l10n; $this->l10n = $l10n;
// parse and read, legacy stuff // parse and read, legacy stuff
$locale = $this->l10n->getLocaleAsArray(); $locale = $this->l10n->getLocaleAsArray();