mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Use one expression language instance for all extra fields
This commit is contained in:
parent
1e1d58da7f
commit
01f42d52ef
1 changed files with 3 additions and 15 deletions
|
@ -10,11 +10,11 @@ use Wallabag\ExpressionLanguage\AuthenticatorProvider;
|
||||||
|
|
||||||
class LoginFormAuthenticator
|
class LoginFormAuthenticator
|
||||||
{
|
{
|
||||||
private AuthenticatorProvider $authenticatorProvider;
|
private ExpressionLanguage $expressionLanguage;
|
||||||
|
|
||||||
public function __construct(AuthenticatorProvider $authenticatorProvider)
|
public function __construct(AuthenticatorProvider $authenticatorProvider)
|
||||||
{
|
{
|
||||||
$this->authenticatorProvider = $authenticatorProvider;
|
$this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,8 +90,7 @@ class LoginFormAuthenticator
|
||||||
|
|
||||||
foreach ($siteConfig->getExtraFields() as $fieldName => $fieldValue) {
|
foreach ($siteConfig->getExtraFields() as $fieldName => $fieldValue) {
|
||||||
if ('@=' === substr($fieldValue, 0, 2)) {
|
if ('@=' === substr($fieldValue, 0, 2)) {
|
||||||
$expressionLanguage = $this->getExpressionLanguage();
|
$fieldValue = $this->expressionLanguage->evaluate(
|
||||||
$fieldValue = $expressionLanguage->evaluate(
|
|
||||||
substr($fieldValue, 2),
|
substr($fieldValue, 2),
|
||||||
[
|
[
|
||||||
'config' => $siteConfig,
|
'config' => $siteConfig,
|
||||||
|
@ -104,15 +103,4 @@ class LoginFormAuthenticator
|
||||||
|
|
||||||
return $extraFields;
|
return $extraFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ExpressionLanguage
|
|
||||||
*/
|
|
||||||
private function getExpressionLanguage()
|
|
||||||
{
|
|
||||||
return new ExpressionLanguage(
|
|
||||||
null,
|
|
||||||
[$this->authenticatorProvider]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue