aufraeumen 4

This commit is contained in:
rirat-0
2026-06-03 02:02:54 +02:00
parent b9475a045f
commit d58ea953af
2 changed files with 3 additions and 10 deletions
+1 -4
View File
@@ -169,7 +169,7 @@ class LocalArticleManager implements ArticleManagerDAO {
return $filteredArticles;
}
// getarticlesbyauthor nutzen um auch nach kategorien zu suchen
public function search(string $keyword): array
{
$articles = $this->getAllArticles();
@@ -179,18 +179,15 @@ class LocalArticleManager implements ArticleManagerDAO {
return [];
}
// Verwende strtolower statt mb_strtolower
$cleanKeyword = strtolower(trim($keyword));
foreach ($articles as $article) {
// Sicherstellen, dass die Felder existieren und in Kleinbuchstaben umwandeln
$title = isset($article['title']) ? strtolower((string)$article['title']) : '';
$content = isset($article['content']) ? strtolower((string)$article['content']) : '';
if (($cleanKeyword !== '' && strpos($title, $cleanKeyword) !== false) ||
($cleanKeyword !== '' && strpos($content, $cleanKeyword) !== false)) {
// Falls die Article-Klasse geladen ist, wird das hier fehlerfrei ausgeführt:
$filteredArticles[] = new Article(
intval($article['id'] ?? 0),
$article['title'] ?? '',