From 38ca124de0886de6e808d1a21526f04f47343326 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Sat, 22 Jul 2023 17:00:12 +0500 Subject: [PATCH] [VkBridge] Better title generation (#3563) 1. Use first parargraph only 2. Remove tags 3. Allow to use comma and colon in title --- bridges/VkBridge.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index 0cd2fba8..c5a9d4cc 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -448,7 +448,9 @@ class VkBridge extends BridgeAbstract private function getTitle($content) { - preg_match('/^["\w\ \p{L}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result); + $content = explode('
', $content)[0]; + $content = strip_tags($content); + preg_match('/^[:,"\w\ \p{L}\(\)\?#«»-]+/mu', htmlspecialchars_decode($content), $result); if (count($result) == 0) { return 'untitled'; }