修复了一些问题
This commit is contained in:
@@ -443,6 +443,12 @@ class SchemaProvider {
|
||||
|
||||
private function sanitize_value($value, string $type) {
|
||||
switch ($type) {
|
||||
case 'attachment_ids':
|
||||
if (!is_array($value)) {
|
||||
return [];
|
||||
}
|
||||
$ids = array_values(array_filter(array_map('absint', $value)));
|
||||
return array_values(array_unique($ids));
|
||||
case 'html':
|
||||
return wp_kses_post((string) $value);
|
||||
case 'textarea':
|
||||
@@ -488,6 +494,10 @@ class SchemaProvider {
|
||||
return $this->sanitize_value($value, $sanitize_type);
|
||||
}
|
||||
|
||||
if ($type === 'gallery') {
|
||||
return $this->sanitize_value($value, 'attachment_ids');
|
||||
}
|
||||
|
||||
if (in_array($type, ['fieldset', 'accordion'], true)) {
|
||||
return $this->sanitize_object_fields($value, (array) ($field['fields'] ?? []));
|
||||
}
|
||||
@@ -658,6 +668,7 @@ class SchemaProvider {
|
||||
'icon' => 'string',
|
||||
'media' => 'url',
|
||||
'upload' => 'url',
|
||||
'gallery' => 'attachment_ids',
|
||||
'code' => 'code',
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user