From e2a5225a190079b5814f67ee1a3043be197608e1 Mon Sep 17 00:00:00 2001 From: Hugo Cox Date: Fri, 28 Mar 2025 10:17:49 +0100 Subject: [PATCH 1/2] (feat): filter and sort portalUrls by numeric blogId --- src/Base/Models/PortalLinkGenerator.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Base/Models/PortalLinkGenerator.php b/src/Base/Models/PortalLinkGenerator.php index cfba7d9..726595e 100644 --- a/src/Base/Models/PortalLinkGenerator.php +++ b/src/Base/Models/PortalLinkGenerator.php @@ -65,6 +65,16 @@ private function getShowOnPortalURL(): string return ''; } + // Filter out terms where slug is not numeric + $terms = array_filter($terms, function($term) { + return is_numeric($term->slug); + }); + + // Sort terms by slug (blog ID) + usort($terms, function($a, $b) { + return intval($a->slug) <=> intval($b->slug); + }); + $portalURL = reset($terms); if (isset($_GET['source'])) { From 72752cf39ab96791b45174ba2c90397e2d87e551 Mon Sep 17 00:00:00 2001 From: Hugo Cox Date: Fri, 28 Mar 2025 10:22:42 +0100 Subject: [PATCH 2/2] (release): v3.7.3 --- CHANGELOG.md | 4 ++++ openpub-base.php | 2 +- src/Base/Foundation/Plugin.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d768bf..cb69729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v3.7.3 + +- Feat: getShowOnPortalURL(): add filter and sorting for portalUrls by numeric blogId with taxonomy 'openpub-show-on' + ## v3.7.2 - Refactor: register rest routes in correct order diff --git a/openpub-base.php b/openpub-base.php index 2a52c36..5e8db40 100644 --- a/openpub-base.php +++ b/openpub-base.php @@ -4,7 +4,7 @@ * Plugin Name: Yard | OpenPub Base * Plugin URI: https://www.openwebconcept.nl/ * Description: Acts as foundation for other OpenPub related content plugins. This plugin implements actions to allow for other plugins to add and/or change Custom Posttypes, Metaboxes, Taxonomies, en Posts 2 posts relations. - * Version: 3.7.2 + * Version: 3.7.3 * Author: Yard | Digital Agency * Author URI: https://www.yard.nl/ * License: GPL-3.0 diff --git a/src/Base/Foundation/Plugin.php b/src/Base/Foundation/Plugin.php index 3cb9d60..6fd5dd1 100644 --- a/src/Base/Foundation/Plugin.php +++ b/src/Base/Foundation/Plugin.php @@ -8,7 +8,7 @@ class Plugin { public const NAME = 'openpub-base'; - public const VERSION = '3.7.2'; + public const VERSION = '3.7.3'; protected string $rootPath; public Config $config;