mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 22:38:42 +00:00
Fixes from test
This commit is contained in:
parent
6554060634
commit
c3686e3db0
|
|
@ -157,19 +157,25 @@ class EventManager
|
||||||
*
|
*
|
||||||
* @param string $group Name of the event
|
* @param string $group Name of the event
|
||||||
*
|
*
|
||||||
* @return void
|
* @return bool
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function detach(string $group) /* : bool */
|
public function detach(string $group) : bool
|
||||||
{
|
{
|
||||||
|
$found = false;
|
||||||
|
|
||||||
if (isset($this->callbacks[$group])) {
|
if (isset($this->callbacks[$group])) {
|
||||||
unset($this->callbacks[$group]);
|
unset($this->callbacks[$group]);
|
||||||
|
$found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->groups[$group])) {
|
if (isset($this->groups[$group])) {
|
||||||
unset($this->groups[$group]);
|
unset($this->groups[$group]);
|
||||||
|
$found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -189,4 +189,9 @@ class L11nManager
|
||||||
|
|
||||||
return $this->language[$code][$module][$translation];
|
return $this->language[$code][$module][$translation];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHtml(string $code, string $module, string $theme, string $translation) : string
|
||||||
|
{
|
||||||
|
return htmlspecialchars($this->getText($code, $module, $theme, $translation));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,7 @@ class Request extends RequestAbstract
|
||||||
if (!isset($this->browser)) {
|
if (!isset($this->browser)) {
|
||||||
$arr = BrowserType::getConstants();
|
$arr = BrowserType::getConstants();
|
||||||
$http_request_type = strtolower($_SERVER['HTTP_USER_AGENT']);
|
$http_request_type = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||||
|
|
||||||
foreach ($arr as $key => $val) {
|
foreach ($arr as $key => $val) {
|
||||||
if (stripos($http_request_type, $val)) {
|
if (stripos($http_request_type, $val)) {
|
||||||
$this->browser = $val;
|
$this->browser = $val;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
* @var \phpOMS\Message\RequestSource
|
* @var \phpOMS\Message\RequestSource
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private $source = null;
|
private $source = RequestSource::UNDEFINED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request hash.
|
* Request hash.
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,5 @@ abstract class RequestSource extends Enum
|
||||||
/* public */ const WEB = 0; /* This is a http request */
|
/* public */ const WEB = 0; /* This is a http request */
|
||||||
/* public */ const CONSOLE = 1; /* Request is a console command */
|
/* public */ const CONSOLE = 1; /* Request is a console command */
|
||||||
/* public */ const SOCKET = 2; /* Request through socket connection */
|
/* public */ const SOCKET = 2; /* Request through socket connection */
|
||||||
|
/* public */ const UNDEFINED = 3; /* Request through socket connection */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ abstract class DateTime extends ValidatorAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function isValid($value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
return (bool) strtotime($value);
|
return (bool) strtotime($value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class BIC extends ValidatorAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function isValid($value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
return (bool) preg_match('/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i', $value);
|
return (bool) preg_match('/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i', $value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ abstract class CreditCard extends ValidatorAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function isValid($value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
$value = preg_replace('/\D/', '', $value);
|
$value = preg_replace('/\D/', '', $value);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ abstract class Iban extends ValidatorAbstract
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function isValid($value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
$value = str_replace(' ', '', strtolower($value));
|
$value = str_replace(' ', '', strtolower($value));
|
||||||
$enumName = 'C_' . strtoupper(substr($value, 0, 2));
|
$enumName = 'C_' . strtoupper(substr($value, 0, 2));
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class Email extends ValidatorAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function isValid(string $value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) {
|
if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) {
|
||||||
self::$msg = 'Invalid Email by filter_var standards';
|
self::$msg = 'Invalid Email by filter_var standards';
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ abstract class Hostname extends ValidatorAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function isValid($value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
return filter_var(gethostbyname($value), FILTER_VALIDATE_IP) !== false;
|
return filter_var(gethostbyname($value), FILTER_VALIDATE_IP) !== false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class Ip extends ValidatorAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function isValid($value) : bool
|
public static function isValid($value, array $constraints = null) : bool
|
||||||
{
|
{
|
||||||
return filter_var($value, FILTER_VALIDATE_IP) !== false;
|
return filter_var($value, FILTER_VALIDATE_IP) !== false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user