From 638dbef30a301918ffd5abe7ce95254d2c8fd47b Mon Sep 17 00:00:00 2001 From: xboard Date: Wed, 22 Nov 2023 21:33:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93=20access=20start=20=E5=9C=A8webman=E4=B8=AD=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=AE=9A=E4=B9=89=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/V1/User/KnowledgeController.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/V1/User/KnowledgeController.php b/app/Http/Controllers/V1/User/KnowledgeController.php index 96b8778..7d345e3 100644 --- a/app/Http/Controllers/V1/User/KnowledgeController.php +++ b/app/Http/Controllers/V1/User/KnowledgeController.php @@ -62,12 +62,8 @@ class KnowledgeController extends Controller private function formatAccessData(&$body) { - function getBetween($input, $start, $end){$substr = substr($input, strlen($start)+strpos($input, $start),(strlen($input) - strpos($input, $end))*(-1));return $start . $substr . $end;} - while (strpos($body, '') !== false) { - $accessData = getBetween($body, '', ''); - if ($accessData) { - $body = str_replace($accessData, '
'. __('You must have a valid subscription to view content in this area') .'
', $body); - } - } + $pattern = '/(.*?)/s'; + $replacement = '
' . __('You must have a valid subscription to view content in this area') . '
'; + $body = preg_replace($pattern, $replacement, $body); } }