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/registry/OptionsRegistry.php | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/inc/registry/OptionsRegistry.php b/inc/registry/OptionsRegistry.php
index a21f2d8..391b842 100644
--- a/inc/registry/OptionsRegistry.php
+++ b/inc/registry/OptionsRegistry.php
@@ -4,7 +4,9 @@
if (!defined('ABSPATH')) {
exit;
}
-use JVBase\meta\MetaManager;
+
+use JVBase\meta\Form;
+use JVBase\meta\Meta;
class OptionsRegistry
{
@@ -22,7 +24,7 @@
*/
public function registerOptions(): void
{
- $meta = new MetaManager(null, 'options');
+ $meta = Meta::forOptions('options');
foreach ($this->fields as $field_name => $field) {
if (in_array($field_name, ['common', 'fields'])) {
continue;
@@ -34,7 +36,7 @@
// Add default value if not exists
if (get_option($option_name) === false) {
- add_option($option_name, $field['default'] ?? $meta->getDefaultValue($field['type']));
+ add_option($option_name, $field['default'] ??'');
}
//
@@ -87,11 +89,7 @@
$name = $args['name'];
$value = get_option(BASE . $name);
- // Use MetaForm to render if available
- if (class_exists('\JVBase\meta\MetaForm')) {
- $form = new \JVBase\meta\MetaForm();
- echo $form->renderField($name, $field, $value);
- }
+ echo Form::render($name, $value, $field);
}
private function getFieldType(string $type): string
@@ -104,12 +102,4 @@
default => 'string'
};
}
-
- private function getSanitizeCallback(array $field): callable
- {
- return function($value) use ($field) {
- $manager = new \JVBase\meta\MetaManager();
- return $manager->sanitizeField($value, $field);
- };
- }
}
--
Gitblit v1.10.0