From af454ec0136a8fc672fd4068a36222c14f98d812 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sun, 20 Dec 2020 23:24:08 +0100 Subject: [PATCH] Setup ID getter by rewrite for tags to return arrays Tag rewrites can now be set for multiple target tags. --- src/NodaIDGetter.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/NodaIDGetter.php b/src/NodaIDGetter.php index 5d2f2fa..125aeb4 100644 --- a/src/NodaIDGetter.php +++ b/src/NodaIDGetter.php @@ -241,23 +241,23 @@ final class NodaIDGetter { * @param string $lang Language to check in. * @param string $name Name of the tag to search for. * - * @return integer + * @return array */ - public static function getTagIDByRewrite(MDMysqli $mysqli_noda, string $lang, string $name):int { + public static function getTagIDByRewrite(MDMysqli $mysqli_noda, string $lang, string $name):array { - if (empty($name)) return 0; + if (empty($name)) return []; + + $output = []; $tagRewriteResult = $mysqli_noda->query_by_stmt(" SELECT `tag_id` FROM `tag_rewriting` WHERE `tag_language` = ? - AND `input_name` = ? - LIMIT 1", "ss", $lang, $name); + AND `input_name` = ?", "ss", $lang, $name); - if ($tagRewriteData = $tagRewriteResult->fetch_row()) { - $output = $tagRewriteData[0]; + while ($tagRewriteData = $tagRewriteResult->fetch_row()) { + $output[] = $tagRewriteData[0]; } - else $output = 0; $tagRewriteResult->close(); $tagRewriteResult = null;