Adds some PHP 8 ready changes to compiler classes. Adds Server and Crypt classes.

This commit is contained in:
2023-01-01 04:11:34 +02:00
parent e614f2ec23
commit e771e7d243
71 changed files with 2697 additions and 872 deletions

View File

@@ -204,7 +204,7 @@ class Gui implements GuiInterface
if (is_array($query) && count($query) >= 3)
{
// cleanup the newlines around the code
$code = trim(str_replace($first_line, '', $code), PHP_EOL)
$code = trim(str_replace($first_line, '', (string) $code), PHP_EOL)
. PHP_EOL;
// set the ID
$id = (int) $query[2];
@@ -243,14 +243,9 @@ class Gui implements GuiInterface
protected function check(string &$code): bool
{
// check for customcode placeholders
if (strpos($code, '$$$$') !== false)
{
// we do not add GUI wrapper placeholder to code
// that already has any customcode placeholders
return false;
}
return true;
// we do not add GUI wrapper placeholder to code
// that already has any customcode placeholders
return strpos($code, '$$$$') === false;
}
}

View File

@@ -56,7 +56,7 @@ class Hash
public function set(string $script): string
{
// check if we should hash a string
if (\strpos($script, 'HASH' . 'STRING((((') !== false)
if (strpos($script, 'HASH' . 'STRING((((') !== false)
{
// get the strings
$values = GetHelper::allBetween(
@@ -67,14 +67,14 @@ class Hash
foreach ($values as $value)
{
$locker['HASH' . 'STRING((((' . $value . '))))']
= \md5($value);
= md5((string) $value);
}
// update the script
return $this->placeholder->update($script, $locker);
}
// check if we should hash a file
if (\strpos($script, 'HASH' . 'FILE((((') !== false)
if (strpos($script, 'HASH' . 'FILE((((') !== false)
{
// get the strings
$values = GetHelper::allBetween(
@@ -89,7 +89,7 @@ class Hash
{
// now we hash the file content
$locker['HASH' . 'FILE((((' . $path . '))))']
= \md5($value);
= md5((string) $value);
}
else
{

View File

@@ -69,8 +69,8 @@ class LockBase implements LockBaseInterface
$locker['LOCK'.'BASE64((((' . $value . '))))']
= "base64_decode( preg_replace('/\s+/', ''," .
PHP_EOL . Indent::_(2) . "'" .
\wordwrap(
\base64_encode($value), 64, PHP_EOL . Indent::_(2), true
wordwrap(
base64_encode((string) $value), 64, PHP_EOL . Indent::_(2), true
) .
"'))";
}