From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan
---
inc/meta/MetaTypeManager.php | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/inc/meta/MetaTypeManager.php b/inc/meta/MetaTypeManager.php
index 89fbe37..4ea0aeb 100644
--- a/inc/meta/MetaTypeManager.php
+++ b/inc/meta/MetaTypeManager.php
@@ -9,7 +9,7 @@
*/
class MetaTypeManager
{
- protected array $type_map = [
+ protected static array $type_map = [
'text' => [
'type' => 'string',
'sanitize' => 'sanitize_text_field',
@@ -55,6 +55,11 @@
'sanitize' => 'esc_url_raw',
'default' => '',
],
+ 'upload' => [
+ 'type' => 'string',
+ 'sanitize' => 'sanitizeUpload',
+ 'default' => '',
+ ],
'image' => [
'type' => 'integer',
'sanitize' => 'absint',
@@ -80,6 +85,11 @@
'sanitize' => 'sanitizeRepeater',
'default' => [],
],
+ 'tag_list' => [
+ 'type' => 'object',
+ 'sanitize' => 'sanitizeTagList',
+ 'default' => []
+ ],
'group' => [
'type' => 'object',
'sanitize' => 'sanitizeGroup',
@@ -120,23 +130,23 @@
'default' => '',
]
];
- public function getType(string $field_name):array
+ public static function getType(string $field_name):array
{
- return $this->type_map[$field_name]??[];
+ return static::$type_map[$field_name]??[];
}
- public function getMetaType(string $field_type):string
+ public static function getMetaType(string $field_type):string
{
- return $this->type_map[$field_type]['type'] ?? 'string';
+ return static::$type_map[$field_type]['type'] ?? 'string';
}
- public function getSanitizeCallback(string $field_type):string
+ public static function getSanitizeCallback(string $field_type):string
{
- return $this->type_map[$field_type]['sanitize'] ?? 'sanitize_text_field';
+ return static::$type_map[$field_type]['sanitize'] ?? 'sanitize_text_field';
}
- public function registerType(string $type, array $config):void
+ public static function registerType(string $type, array $config):void
{
- $this->type_map[$type] = $config;
+ static::$type_map[$type] = $config;
}
}
--
Gitblit v1.10.0