From 772462eeca3002a1d52508aeba485aab2b4742ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 03 Mar 2026 19:06:19 +0000
Subject: [PATCH] =MAJOR OVERHAUL. Likely should have made a new branch ages ago. Key changes: Registrar.php is the base for custom post types, taxonomies, and user roles. Replaces JVB_CONTENT, JVB_TAXONOMY, and JVB_USER constants, eliminates most of Features.php (except for JVB_SITE, JVB_MEMBERSHIP), and has built in sanitizing and validation via sub-classes. Also started a major overhaul of the Schema output. Created a shit ton of property traits and classes to help sanitize and ensure proper data for different schema types. Still a bunch to do, but better to be starting committing changes here on this other branch.
---
inc/managers/NotificationManager.php | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/inc/managers/NotificationManager.php b/inc/managers/NotificationManager.php
index 5a02499..2aaa4cf 100644
--- a/inc/managers/NotificationManager.php
+++ b/inc/managers/NotificationManager.php
@@ -2,6 +2,7 @@
namespace JVBase\managers;
use JVBase\JVB;
+use JVBase\registrar\Registrar;
use WP_Error;
use Exception;
use WP_Post;
@@ -423,7 +424,7 @@
*/
public function notifyEveryone(string $type, int|null $action_user_id = null, string $message = '', int|null $target_id = null, string|null $target_type = null, array|null $context = null):bool|WP_Error
{
- $artists = $this->getUserIDs(array_keys(JVB_USER));
+ $artists = $this->getUserIDs(Registrar::getRegistered('user'));
return $this->addNotification($artists, $type, $action_user_id, $message, $target_id, $target_type, $context);
}
@@ -453,7 +454,7 @@
}
// Check if this is a relevant content type
- $content_types = jvbBasedFeedContent();
+ $content_types = array_map(function($type) {return jvbCheckBase($type->getSlug()); }, Registrar::getFeatured('show_feed', 'post'));
if (!in_array($post->post_type, $content_types)) {
return;
}
@@ -1617,14 +1618,9 @@
*/
protected function pluralize(string $content):string
{
- if (array_key_exists($content, JVB_CONTENT)) {
- return JVB_CONTENT[$content]['plural'];
- } elseif (array_key_exists($content, JVB_TAXONOMY)) {
- return JVB_TAXONOMY[$content]['plural'];
- } elseif (array_key_exists($content, JVB_USER)) {
- return JVB_USER[$content]['plural'];
- }
- return $content;
+ $registrar = Registrar::getInstance($content);
+ return ($registrar) ? $registrar->getPlural()
+ : str_replace('_', ' ', $content.'s');
}
/**
@@ -1749,7 +1745,7 @@
return array_map(function ($r) {
return jvbCheckBase(trim($r));
}, array_filter($roles, function ($r) {
- return array_key_exists(trim($r), JVB_USER);
+ return Registrar::getInstance(trim($r))!== false;
}));
}
--
Gitblit v1.10.0