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/SEO/schemas/resolvers/PersonResolver.php | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/inc/managers/SEO/schemas/resolvers/PersonResolver.php b/inc/managers/SEO/schemas/resolvers/PersonResolver.php
index cd9d95c..efce13f 100644
--- a/inc/managers/SEO/schemas/resolvers/PersonResolver.php
+++ b/inc/managers/SEO/schemas/resolvers/PersonResolver.php
@@ -4,6 +4,7 @@
use JVBase\managers\SEO\schemas\SchemaDefinition;
use JVBase\managers\SEO\SchemaReferenceBuilder;
use JVBase\meta\Meta;
+use JVBase\registrar\Registrar;
if (!defined('ABSPATH')) {
exit;
@@ -50,17 +51,13 @@
*/
private function buildWorksFor(int $userId): ?array
{
- if (!defined('JVB_TAXONOMY')) {
+ $contentTypes = Registrar::getFeatured('is_content', 'term');
+ if (empty($contentTypes)) {
return null;
}
- // Find taxonomies that represent organizations (is_content taxonomies)
- foreach (JVB_TAXONOMY as $slug => $config) {
- if (empty($config['is_content'])) {
- continue;
- }
-
- $fullTax = BASE . $slug;
+ foreach ($contentTypes as $content) {
+ $fullTax = jvbCheckBase($content);
$terms = wp_get_object_terms($userId, $fullTax);
if (is_wp_error($terms) || empty($terms)) {
@@ -71,9 +68,8 @@
$term = $terms[0];
return SchemaReferenceBuilder::build(
- $term->term_id,
'term',
- null
+ $term->term_id
);
}
@@ -85,17 +81,24 @@
*/
private function buildWorkExamples(int $userId, int $limit = 5): array
{
- if (!defined('JVB_CONTENT')) {
+ $role = jvbUserRole($userId);
+ $registrar = Registrar::getInstance($role);
+
+ if (!$registrar){
+ return [];
+ }
+ $types = $registrar->getCreatable();
+ if (empty($types)){
return [];
}
$examples = [];
- foreach (JVB_CONTENT as $slug => $config) {
- $fullType = BASE . $slug;
+ foreach ($types as $slug) {
+ $type = jvbCheckBase($slug);
$posts = get_posts([
- 'post_type' => $fullType,
+ 'post_type' => $type,
'author' => $userId,
'posts_per_page' => $limit,
'post_status' => 'publish',
@@ -106,7 +109,7 @@
continue;
}
- $refs = SchemaReferenceBuilder::buildMultiple($posts, 'post', null, true);
+ $refs = SchemaReferenceBuilder::buildMultiple('post', $posts, null, true);
if (!empty($refs)) {
$examples = array_merge($examples, $refs);
--
Gitblit v1.10.0