Kaynağa Gözat

filter and link fix

Xen 1 yıl önce
ebeveyn
işleme
703bfd5742
1 değiştirilmiş dosya ile 9 ekleme ve 23 silme
  1. 9 23
      www/index.php

+ 9 - 23
www/index.php

@@ -115,29 +115,15 @@ function clean_str($str) {
 		$item_link = "article.php?loc=" . $loc . '&a=' . $item->get_permalink();
 		
 		$up_title = strtoupper($item_title);
-		// if (str_contains($up_title, "SPORTS") == true)
-		// {
-		// 	// 🧒 👦 👨‍👦‍👦
-		// 	echo '<p class="sports" style="font-size: 4px;">
-		// 		⚽ 🏀 🏈 ⚾️ 🎾 🏐 🏉 🎱 🏆 🏟 ⛹️
-		// 		<a href="$item_link">happened</a>
-		// 		</p>'; 
-		// 	// Break out of 2nd-level loop.
-		// 	continue;
-		// }
-		for ($i = 0; $i < count($title_filters); $i++)
-		{
-			$testing = $title_filters[$i];
-			if (str_contains($up_title, $testing) == true)
-			{
-				// 🧒 👦 👨‍👦‍👦
-				echo '<p class="sports" style="font-size: 4px;">
-					⚽ 🏀 🏈 ⚾️ 🎾 🏐 🏉 🎱 🏆 🏟 ⛹️
-					<a href="$item_link">happened</a>
-					</p>'; 
-				// Break out of 2nd-level loop.
-				continue 2;
-			}
+
+		preg_match_all('|(SPORTS|NFL|NFL|NBA|MLB|)|', $up_title, $matches);
+		if (!empty($matches)) {
+			// 🧒 👦 👨‍👦‍👦
+			echo '<p class="sports" style="font-size: 4px;">
+				⚽ 🏀 🏈 ⚾️ 🎾 🏐 🏉 🎱 🏆 🏟 ⛹️
+				<a href="' . $item_link . '">happened</a>
+				</p>'; 
+			continue;
 		}
 		
 		$subheadlines = clean_str($item->get_description());