Skip to content

Commit

Permalink
[VkBridge] Better title generation:
Browse files Browse the repository at this point in the history
1. Use first parargraph only
2. Remove tags
3. Allow to use comma and colon in title
  • Loading branch information
em92 committed Jul 22, 2023
1 parent 39a8346 commit 9c5fa52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bridges/VkBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ private function getPhoto($a)

private function getTitle($content)
{
preg_match('/^["\w\ \p{L}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
$content = explode('<br>', $content)[0];
$content = strip_tags($content);
preg_match('/^[:,"\w\ \p{L}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result);
if (count($result) == 0) {
return 'untitled';
}
Expand Down

0 comments on commit 9c5fa52

Please sign in to comment.