viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix Trends link on landing page, fix notice in TrendingHighlightsJob, a=chris

Chris Pollett [2020-06-21 22:Jun:st]
Fix Trends link on landing page, fix notice in TrendingHighlightsJob, a=chris
Filename
src/library/media_jobs/TrendingHighlightsJob.php
src/views/elements/TrendingElement.php
diff --git a/src/library/media_jobs/TrendingHighlightsJob.php b/src/library/media_jobs/TrendingHighlightsJob.php
index 4b9ac834a..47257a747 100644
--- a/src/library/media_jobs/TrendingHighlightsJob.php
+++ b/src/library/media_jobs/TrendingHighlightsJob.php
@@ -196,6 +196,7 @@ class TrendingHighlightsJob extends MediaJob
             $regex = $trending_site['TREND_VALUE_REGEX'];
             $page = $trending_site[CrawlConstants::PAGE];
             if (preg_match_all($regex, $page, $matches)) {
+                $trending_matches = [];
                 if (isset($matches[2])) {
                     $trending_matches = array_combine($matches[1], $matches[2]);
                 } else if(isset($matches[1])) {
diff --git a/src/views/elements/TrendingElement.php b/src/views/elements/TrendingElement.php
index 0ffac34be..c077e80e8 100644
--- a/src/views/elements/TrendingElement.php
+++ b/src/views/elements/TrendingElement.php
@@ -182,16 +182,13 @@ class TrendingElement extends Element
                     "category=" . $highlight['CATEGORY'];
                 $order = (($highlight['ORDER'] == 'SCORE_DESC')) ? "" :
                     "order=" . $highlight['ORDER'];
-                if (empty($token_query))  {
-                    $qm_flag = !empty($category) || !empty($order);
-                    $category = empty($order) ? $category : (empty($category) ?
-                        "" : "$category&");
-                    $trending_url = B\controllerUrl('trending',
-                        $qm_flag) . $category . $order;
-                } else {
-                    $order = (empty($order)) ? "" : "&$order";
-                    $trending_url = B\controllerUrl('trending', true) .
-                        $token_query . "&$category$order";
+                $trending_url = C\SHORT_BASE_URL . "?q=trending:" .
+                    $highlight['CATEGORY'];
+                if (!empty($order)) {
+                    $trending_url .= ":" . $highlight['ORDER'];
+                }
+                if (!empty($token_query)) {
+                    $trending_url .= "&" . $token_query;
                 }
                 $terms_per_row = (!empty($_SERVER['MOBILE'])) ? 2 : 3;
                 ?><div class="trending-highlight"><h2><a href="<?= $trending_url
ViewGit