From 76367a9f9d7b8c55be7feb72b5428c0cf18a9e4f Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Wed, 25 May 2022 11:58:18 -0400 Subject: [PATCH] Pesky newlines It's interesting, looping through the labels.txt file gives us a $line that also has a \n at the end of it, thus a search for "House Finch" becomes just "House". But only on certain species? It seems that 95% of other species weren't affected by this newline. Anyways this fixes it :) --- scripts/overview.php | 2 +- scripts/todays_detections.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index 66b5304..f556698 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -70,7 +70,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse // convert sci name to English name foreach($lines as $line){ if(strpos($line, $todaytable['Sci_Name']) !== false){ - $engname = explode("_", $line)[1]; + $engname = trim(explode("_", $line)[1]); break; } } diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index 91350b8..b9d6b30 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -120,7 +120,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { // convert sci name to English name foreach($lines as $line){ if(strpos($line, $todaytable['Sci_Name']) !== false){ - $engname = explode("_", $line)[1]; + $engname = trim(explode("_", $line)[1]); break; } }