| | |
| | | public static function archive(string $type): array |
| | | { |
| | | $type = self::checkType($type, '[SchemaHelper]::archive'); |
| | | error_log('[SchemaHelper]::archive type: '.print_r($type, true)); |
| | | |
| | | if (!$type) { |
| | | return []; |
| | | } |
| | |
| | | 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\WebSite', |
| | | 'name' => get_bloginfo('name'), |
| | | 'url' => get_home_url(), |
| | | 'id' => get_home_url() . '#website', |
| | | 'id' => get_home_url() . '/#website', |
| | | 'description' => get_bloginfo('description'), |
| | | 'inLanguage' => 'en-CA' |
| | | ], |
| | | default => [] |
| | | }, |
| | | 'archive' => [ |
| | | 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\WebPage\CollectionPage', |
| | | 'type' => 'JVBase\inc\managers\SEO\render\Thing\CreativeWork\WebPage\CollectionPage\CollectionPage', |
| | | 'name' => '{{name}}' |
| | | ], |
| | | default => [], |
| | | }; |
| | | return apply_filters(BASE.ucfirst($type).ucfirst($format).'Default', $defaults); |
| | | |
| | | $result = apply_filters(BASE.ucfirst($type).ucfirst($format).'Default', $defaults); |
| | | if ($format === 'reference' && empty($result)) { |
| | | $full = self::getDefault($type, 'schema'); |
| | | if (!empty($full)) { |
| | | $result = [ |
| | | 'type' => $full['type'], |
| | | 'name' => $full['name'], |
| | | 'description'=> $full['description'] |
| | | ]; |
| | | $check = ['id', 'url']; |
| | | foreach ($check as $ch) { |
| | | if (array_key_exists($ch, $full)) { |
| | | $result[$ch] = $full[$ch]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return $result; |
| | | } |
| | | |
| | | public static function updateHistory(string $type, string $format, array $newest):bool |
| | |
| | | unset($config['type']); |
| | | $class = new $className(); |
| | | |
| | | |
| | | foreach ($config as $property => $value) { |
| | | if (is_array($value)) { |
| | | if (is_array($value) && array_key_exists('type', $value)) { |
| | | $value = self::classFromConfig($value, $meta); |
| | | } |
| | | $method = 'set'.ucfirst($property); |