aufraeumen 4
This commit is contained in:
@@ -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'] ?? '',
|
||||
|
||||
Reference in New Issue
Block a user