| | |
| | | exit; |
| | | } |
| | | /** |
| | | * @deprecated Use Registrar.php directly |
| | | * Centralized registry for all content types, taxonomies, and user roles |
| | | * Provides a single source of truth and caching layer |
| | | */ |
| | |
| | | private function initialize(): void |
| | | { |
| | | // Build initial caches |
| | | $this->buildContentCache(); |
| | | $this->buildTaxonomyCache(); |
| | | $this->buildUserRoleCache(); |
| | | $this->buildRelationships(); |
| | | |
| | | // Set up WordPress hooks for cache invalidation |
| | |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Build content type cache |
| | | */ |
| | | private function buildContentCache(): void |
| | | { |
| | | $this->cache[self::CACHE_CONTENT] = JVB_CONTENT; |
| | | |
| | | // Add computed properties |
| | | foreach ($this->cache[self::CACHE_CONTENT] as $slug => &$config) { |
| | | $config['_slug'] = $slug; |
| | | $config['_post_type'] = BASE . $slug; |
| | | $config['_supports_dashboard'] = $this->computesDashboardSupport($config); |
| | | $config['_is_user_type'] = $this->computesUserType($config); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Build taxonomy cache |
| | | */ |
| | | private function buildTaxonomyCache(): void |
| | | { |
| | | $this->cache[self::CACHE_TAXONOMIES] = JVB_TAXONOMY; |
| | | |
| | | foreach ($this->cache[self::CACHE_TAXONOMIES] as $slug => &$config) { |
| | | $config['_slug'] = $slug; |
| | | $config['_taxonomy'] = BASE . $slug; |
| | | $config['_is_hierarchical'] = $config['hierarchical'] ?? true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Build user role cache |
| | | */ |
| | | private function buildUserRoleCache(): void |
| | | { |
| | | $this->cache[self::CACHE_USER_ROLES] = JVB_USER; |
| | | |
| | | foreach ($this->cache[self::CACHE_USER_ROLES] as $slug => &$config) { |
| | | $config['_slug'] = $slug; |
| | | $config['_role'] = BASE . $slug; |
| | | $config['_creatable_content'] = $this->extractCreatableContent($config); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Build relationships between types |