Disable options for other peoples clients.

This commit is contained in:
James Cole
2021-10-24 07:25:51 +02:00
parent b3f424fa28
commit e9e9a359c8
3 changed files with 36 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ class General extends AbstractExtension
$this->mimeIcon(),
$this->markdown(),
$this->floatval(),
$this->phpHostName(),
];
}
@@ -91,6 +92,24 @@ class General extends AbstractExtension
);
}
/**
* Show URL host name
*
* @return TwigFilter
*/
protected function phpHostName(): TwigFilter
{
return new TwigFilter(
'phphost',
static function (string $string): string {
$proto = (string)parse_url($string, PHP_URL_SCHEME);
$host = (string)parse_url($string, PHP_URL_HOST);
return e(sprintf('%s://%s', $proto, $host));
}
);
}
/**
* Used to convert 1024 to 1kb etc.
*