|
|
|
@ -52,20 +52,6 @@ class AppExtension extends AbstractExtension
@@ -52,20 +52,6 @@ class AppExtension extends AbstractExtension
|
|
|
|
|
'mentionToMarkdown' |
|
|
|
|
] |
|
|
|
|
), |
|
|
|
|
new TwigFilter( |
|
|
|
|
'url_to_html', |
|
|
|
|
[ |
|
|
|
|
$this, |
|
|
|
|
'urlToHtml' |
|
|
|
|
] |
|
|
|
|
), |
|
|
|
|
new TwigFilter( |
|
|
|
|
'mention_to_html', |
|
|
|
|
[ |
|
|
|
|
$this, |
|
|
|
|
'mentionToHtml' |
|
|
|
|
] |
|
|
|
|
), |
|
|
|
|
new TwigFilter( |
|
|
|
|
'keva_namespace_value', |
|
|
|
|
[ |
|
|
|
@ -184,28 +170,6 @@ class AppExtension extends AbstractExtension
@@ -184,28 +170,6 @@ class AppExtension extends AbstractExtension
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function urlToHtml( |
|
|
|
|
string $text |
|
|
|
|
): string |
|
|
|
|
{ |
|
|
|
|
return preg_replace( |
|
|
|
|
'~(https?://(?:www\.)?[^\(\s\)]+)~i', |
|
|
|
|
'<a href="$1">$1</a>', |
|
|
|
|
$text |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function mentionToHtml( |
|
|
|
|
string $text |
|
|
|
|
): string |
|
|
|
|
{ |
|
|
|
|
return preg_replace( |
|
|
|
|
'~@([A-z0-9]{64})~i', |
|
|
|
|
'<a href="#$1">@$1</a>', |
|
|
|
|
$text |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function plural(int $number, array $texts) |
|
|
|
|
{ |
|
|
|
|
$cases = [2, 0, 1, 1, 1, 2]; |
|
|
|
|