From 3b83905603d44b1a08f8b2b36a605808ce686ad6 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 02 Jun 2026 00:46:48 +0000
Subject: [PATCH] =double checking schema outputs for legacytattooremoval
---
inc/meta/MetaTypeManager.php | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/inc/meta/MetaTypeManager.php b/inc/meta/MetaTypeManager.php
index 89fbe37..e0da68f 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',
@@ -50,11 +50,21 @@
'sanitize' => 'sanitize_email',
'default' => '',
],
+ 'phone' => [
+ 'type' => 'string',
+ 'sanitize' => 'sanitizeTelephone',
+ 'default' => '',
+ ],
'url' => [
'type' => 'string',
'sanitize' => 'esc_url_raw',
'default' => '',
],
+ 'upload' => [
+ 'type' => 'string',
+ 'sanitize' => 'sanitizeUpload',
+ 'default' => '',
+ ],
'image' => [
'type' => 'integer',
'sanitize' => 'absint',
@@ -75,11 +85,21 @@
'sanitize' => 'sanitizeUser',
'default' => '',
],
+ 'post' => [
+ 'type' => 'string',
+ 'sanitize' => 'sanitizePost',
+ 'default' => '',
+ ],
'repeater' => [
'type' => 'object',
'sanitize' => 'sanitizeRepeater',
'default' => [],
],
+ 'taglist' => [
+ 'type' => 'object',
+ 'sanitize' => 'sanitizeTagList',
+ 'default' => []
+ ],
'group' => [
'type' => 'object',
'sanitize' => 'sanitizeGroup',
@@ -118,25 +138,34 @@
'type' => 'string',
'sanitize' => 'sanitize_text_field',
'default' => '',
- ]
+ ],
+ 'selector' => [
+ 'type' => 'string',
+ 'sanitize' => 'sanitizeSelector',
+ '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;
}
+ public static function getTypes():array
+ {
+ return static::$type_map;
+ }
}
--
Gitblit v1.10.0