??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/monicslandscape.co.uk/wp-content/plugins/surerank/inc/schema/base.php
⬅ Kembali
<?php
/**
* Base Schema Type
*
* This file provides a base class for schema types.
*
* @package SureRank
* @since 1.0.0
*/
namespace SureRank\Inc\Schema;
/**
* Base Schema Type
*
* Provides a base class for defining schema types.
* Child classes must implement the `get` and `schema_data` methods.
*
* @package SureRank
* @since 1.0.0
*/
abstract class Base {
/**
* Get schema variables.
*
* This method should be implemented by child classes to define schema fields.
*
* @return array<int, array<string, mixed>>
*/
abstract public function get();
/**
* Get schema data.
*
* @return array<string, mixed>
* @since 1.0.0
*/
abstract public function schema_data();
/**
* Render schema data with dynamic content
*
* @param array<string, mixed> $schema Schema configuration.
* @param Render $renderer Variable renderer instance.
* @return array<string, mixed> Rendered schema data.
* @since 1.2.0
*/
public function render_schema( $schema, $renderer ) {
$fields = Data::get_schema_type( $schema );
$type = $schema['fields']['@type'] ?? $schema['type'] ?? 'Thing';
$schema_render = new Schema_Render( $type, $fields, $renderer );
return $schema_render->render();
}
/**
* Get schema type options.
*
* @return array<string, mixed>
*/
public function get_schema_type_options() {
return [];
}
/**
* Add a helper property to the schema.
*
* @param string $id The property ID.
* @param array<string, mixed> $args Arguments for the property.
*
* @return array<string, mixed>
*/
protected function add_helper_property( $id, $args = [] ) {
return Helper::get_instance()->get_property( $id, $args );
}
/**
* Parse Schema Fields
*
* Parses schema fields recursively to include only required data.
*
* @param array<int, array<string, mixed>> $fields Schema fields.
* @return array<string, mixed> Parsed fields.
*/
protected function parse_fields( $fields ) {
$parsed = [];
foreach ( $fields as $field ) {
if ( empty( $field['id'] ) || ( empty( $field['required'] ) && empty( $field['show'] ) ) || ( isset( $field['default'] ) && false === $field['default'] ) ) {
continue;
}
$type = $field['type'] ?? 'Text';
$value = 'Group' === $type ? $this->parse_group( $field ) : ( $field['std'] ?? '' );
$parsed[ $field['id'] ] = $value;
}
return $parsed;
}
/**
* Parse Group Fields
*
* Parses group fields recursively.
*
* @param array<string, mixed> $field Group field data.
* @return array<string, mixed>|array<int, array<string, mixed>> Parsed group fields.
*/
protected function parse_group( $field ) {
$group_fields = $this->parse_fields( $field['fields'] );
if ( 1 === count( $group_fields ) && isset( $group_fields['@type'] ) ) { // Yoda condition.
return [];
}
if ( ! empty( $field['cloneable'] ) ) {
return [ $group_fields ];
}
return $group_fields;
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
📁 types
dir
—
2026-06-24 10:05
🐘 base.php
php
2.9 KB
2026-02-09 12:08
🐘 custom-fields.php
php
3.7 KB
2025-12-22 15:55
🐘 data.php
php
16.2 KB
2026-04-27 18:58
🐘 helper.php
php
1.9 KB
2026-01-14 10:26
🐘 options.php
php
414 B
2025-06-27 15:25
🐘 products.php
php
20.7 KB
2026-06-04 12:50
🐘 properties.php
php
20.7 KB
2026-02-09 12:08
🐘 render.php
php
2.2 KB
2025-06-27 15:25
🐘 rules.php
php
9.9 KB
2025-08-18 15:48
🐘 schema-render.php
php
6.8 KB
2026-05-20 12:46
🐘 schemas-api.php
php
23.7 KB
2026-06-04 12:50
🐘 schemas.php
php
6.9 KB
2026-06-17 16:29
🐘 utils.php
php
6.3 KB
2025-09-11 15:07
🐘 validator.php
php
15.5 KB
2025-12-22 15:55
🐘 variables.php
php
7 KB
2025-12-22 15:55