mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Misc/Cleanup
* more trait properties to const as they were always intended to be
This commit is contained in:
@@ -37,10 +37,7 @@ class AjaxHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
$h = $this->handler;
|
||||
$out = $this->$h();
|
||||
if ($out === null)
|
||||
$out = '';
|
||||
$out = $this->{$this->handler}() ?? '';
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -68,4 +65,5 @@ class AjaxHandler
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -19,8 +19,8 @@ class SimpleXML extends SimpleXMLElement
|
||||
trait TrRequestData
|
||||
{
|
||||
// const in trait supported in php8.2+
|
||||
public static $PATTERN_TEXT_LINE = '/[\p{Cc}\p{Cf}\p{Co}\p{Cs}\p{Cn}]/ui';
|
||||
public static $PATTERN_TEXT_BLOB = '/[\x00-\x09\x0B-\x1F\p{Cf}\p{Co}\p{Cs}\p{Cn}]/ui';
|
||||
public const PATTERN_TEXT_LINE = '/[\p{Cc}\p{Cf}\p{Co}\p{Cs}\p{Cn}]/ui';
|
||||
public const PATTERN_TEXT_BLOB = '/[\x00-\x09\x0B-\x1F\p{Cf}\p{Co}\p{Cs}\p{Cn}]/ui';
|
||||
|
||||
protected $_get = []; // fill with variables you that are going to be used; eg:
|
||||
protected $_post = []; // 'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdList']
|
||||
@@ -104,13 +104,13 @@ trait TrRequestData
|
||||
private static function checkTextLine(string $val) : string
|
||||
{
|
||||
// trim non-printable chars
|
||||
return preg_replace(self::$PATTERN_TEXT_LINE, '', $val);
|
||||
return preg_replace(self::PATTERN_TEXT_LINE, '', $val);
|
||||
}
|
||||
|
||||
private static function checkTextBlob(string $val) : string
|
||||
{
|
||||
// trim non-printable chars
|
||||
return preg_replace(self::$PATTERN_TEXT_BLOB, '', $val);
|
||||
return preg_replace(self::PATTERN_TEXT_BLOB, '', $val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@ class GuidePage extends GenericPage
|
||||
protected static function checkDescription(string $str) : string
|
||||
{
|
||||
// run checkTextBlob and also replace \n => \s and \s+ => \s
|
||||
$str = preg_replace(parent::$PATTERN_TEXT_BLOB, '', $str);
|
||||
$str = preg_replace(parent::PATTERN_TEXT_BLOB, '', $str);
|
||||
|
||||
$str = strtr($str, ["\n" => ' ', "\r" => ' ']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user