<?php
|
namespace JVBase;
|
|
use JVBase\blocks\CustomBlocks;
|
use JVBase\registrar\Registrar;
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
class JVB
|
{
|
protected static JVB|null $instance = null;
|
protected array $managers = [];
|
protected array $content = [];
|
protected array $taxonomies = [];
|
protected array $blocks = [];
|
protected array $routes = [];
|
protected CustomBlocks $customBlocks;
|
|
|
|
public static function getInstance(): JVB
|
{
|
if (self::$instance === null) {
|
self::$instance = new self();
|
}
|
return self::$instance;
|
}
|
|
|
private function __construct()
|
{
|
}
|
|
public function routes($route): mixed
|
{
|
if (array_key_exists($route, $this->routes)) {
|
return $this->routes[$route];
|
}
|
return false;
|
}
|
|
|
public function getFields($type): array
|
{
|
return Registrar::getFieldsFor($type)??[];
|
}
|
|
/**
|
* @deprecated Should use the Registrar::getInstance
|
* @param $type
|
* @return mixed
|
*/
|
public function getContent($type): mixed
|
{
|
return $this->content[$type] ?? $this->taxonomies[$type] ?? $this->blocks[$type] ?? null;
|
}
|
|
}
|