Replace remaining disallowed operators

This commit is contained in:
Dylan K. Taylor
2022-01-20 19:23:19 +00:00
parent 61f8144280
commit 4e956d5d1d
9 changed files with 39 additions and 39 deletions

View File

@ -135,7 +135,7 @@ class Language{
*/
public function translateString(string $str, array $params = [], ?string $onlyPrefix = null) : string{
$baseText = $this->get($str);
$baseText = $this->parseTranslation(($onlyPrefix === null or strpos($str, $onlyPrefix) === 0) ? $baseText : $str, $onlyPrefix);
$baseText = $this->parseTranslation(($onlyPrefix === null || strpos($str, $onlyPrefix) === 0) ? $baseText : $str, $onlyPrefix);
foreach($params as $i => $p){
$replacement = $p instanceof Translatable ? $this->translate($p) : (string) $p;
@ -176,14 +176,14 @@ class Language{
if($replaceString !== null){
$ord = ord($c);
if(
($ord >= 0x30 and $ord <= 0x39) // 0-9
or ($ord >= 0x41 and $ord <= 0x5a) // A-Z
or ($ord >= 0x61 and $ord <= 0x7a) or // a-z
$c === "." or $c === "-"
($ord >= 0x30 && $ord <= 0x39) // 0-9
|| ($ord >= 0x41 && $ord <= 0x5a) // A-Z
|| ($ord >= 0x61 && $ord <= 0x7a) || // a-z
$c === "." || $c === "-"
){
$replaceString .= $c;
}else{
if(($t = $this->internalGet(substr($replaceString, 1))) !== null and ($onlyPrefix === null or strpos($replaceString, $onlyPrefix) === 1)){
if(($t = $this->internalGet(substr($replaceString, 1))) !== null && ($onlyPrefix === null || strpos($replaceString, $onlyPrefix) === 1)){
$newString .= $t;
}else{
$newString .= $replaceString;
@ -204,7 +204,7 @@ class Language{
}
if($replaceString !== null){
if(($t = $this->internalGet(substr($replaceString, 1))) !== null and ($onlyPrefix === null or strpos($replaceString, $onlyPrefix) === 1)){
if(($t = $this->internalGet(substr($replaceString, 1))) !== null && ($onlyPrefix === null || strpos($replaceString, $onlyPrefix) === 1)){
$newString .= $t;
}else{
$newString .= $replaceString;