From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan

---
 inc/managers/SEOMetaManager.php |  125 ++++++++++++++++++++++-------------------
 1 files changed, 66 insertions(+), 59 deletions(-)

diff --git a/inc/managers/SEOMetaManager.php b/inc/managers/SEOMetaManager.php
index 2db1d41..dc9c2de 100644
--- a/inc/managers/SEOMetaManager.php
+++ b/inc/managers/SEOMetaManager.php
@@ -1,7 +1,7 @@
 <?php
 namespace JVBase\managers;
 
-use JVBase\meta\MetaManager;
+use JVBase\meta\Meta;
 use WP_Term;
 use DateTime;
 use DateMalformedStringException;
@@ -10,6 +10,7 @@
     exit; // Exit if accessed directly
 }
 /**
+ * @deprecated use JVBase\managers\seo\SEO.php
  * SEO Meta Manager for edmonton.ink
  *
  * Integrates with The SEO Framework to generate optimized titles and meta descriptions
@@ -113,7 +114,7 @@
     protected function getPostTitle(int $post_id):string
     {
         $title = get_the_title($post_id);
-        $meta = new MetaManager($post_id, 'post');
+        $meta = Meta::forPost($post_id);
         $post_type = get_post_type($post_id);
 
         return match ($post_type) {
@@ -132,7 +133,7 @@
      */
     protected function getPostDescription(int $post_id):string
     {
-        $meta = new MetaManager($post_id, 'post');
+        $meta = Meta::forPost($post_id);
 
         $post_type = get_post_type($post_id);
         switch ($post_type) {
@@ -158,7 +159,7 @@
      */
     protected function getTermTitle(WP_Term $term):string
     {
-        $meta = new MetaManager($term->term_id, 'term');
+        $meta = Meta::forTerm($term->term_id);
 
         switch ($term->taxonomy) {
             case BASE . 'shop':
@@ -174,7 +175,7 @@
                 return $this->getCityTitle($term);
 
             default:
-                return $term->name;
+                return html_entity_decode($term->name);
         }
     }
 
@@ -186,7 +187,7 @@
      */
     protected function getTermDescription(WP_Term $term):string
     {
-        $meta = new MetaManager($term->term_id, 'term');
+        $meta = Meta::forTerm($term->term_id);
 
         switch ($term->taxonomy) {
             case BASE . 'shop':
@@ -275,10 +276,9 @@
      * Get artist title
      *
      * @param string $title The original title
-     * @param MetaManager $meta The meta manager
      * @return string The optimized title
      */
-    protected function getArtistTitle(string $title, MetaManager $meta):string
+    protected function getArtistTitle(string $title):string
     {
         $city_terms = get_the_terms(get_the_ID(), BASE . 'city');
         $city = ($city_terms && !is_wp_error($city_terms)) ? $city_terms[0]->name : 'Edmonton';
@@ -287,25 +287,24 @@
 
         $title_format = "{$title} | {$city}'s Best {$artist_type}";
         $title = strtok($title, ' ');
-        $title_format = (strlen($title_format) <= $this->character_limits['title']) ? $title_format : "{$title} | {$city}'s Best {$artist_type}";
-        return $title_format;
+		return (strlen($title_format) <= $this->character_limits['title']) ? $title_format : "{$title} | {$city}'s Best {$artist_type}";
     }
 
     /**
      * Get artist description
      *
      * @param int $post_id The post ID
-     * @param MetaManager $meta The meta manager
+     * @param Meta $meta The meta manager
      * @return string The optimized description
      */
-    protected function getArtistDescription(int $post_id, MetaManager $meta):string
+    protected function getArtistDescription(int $post_id, Meta $meta):string
     {
-        $bio = $meta->getValue('short_bio');
+        $bio = $meta->get('short_bio');
         if ($bio !== '') {
             return $bio;
         }
 
-        $first_name = $meta->getValue('first_name');
+        $first_name = $meta->get('first_name');
 
         $city_terms = get_the_terms($post_id, BASE . 'city');
         $city = ($city_terms && !is_wp_error($city_terms)) ? $city_terms[0]->name : 'Edmonton';
@@ -314,7 +313,7 @@
 
         // Get top styles if available
         $styles = [];
-        $top_styles = $meta->getValue('top_style');
+        $top_styles = $meta->get('top_style');
         if (!empty($top_styles)) {
             foreach ((array)$top_styles as $style_id) {
                 $style = get_term($style_id, BASE . 'style');
@@ -326,7 +325,7 @@
 
         // Get top themes if available
         $themes = [];
-        $top_themes = $meta->getValue('top_theme');
+        $top_themes = $meta->get('top_theme');
         if (!empty($top_themes)) {
             foreach ((array)$top_themes as $theme_id) {
                 $theme = get_term($theme_id, BASE . 'theme');
@@ -394,16 +393,16 @@
      * Get partner description
      *
      * @param int $post_id The post ID
-     * @param MetaManager $meta The meta manager
+     * @param Meta $meta The meta manager
      * @return string The optimized description
      */
-    protected function getPartnerDescription(int $post_id, MetaManager$meta):string
+    protected function getPartnerDescription(int $post_id, Meta$meta):string
     {
-        $short_bio = $meta->getValue('short_bio');
+        $short_bio = $meta->get('short_bio');
         if ($short_bio !== '') {
             return $short_bio;
         }
-        $established = $meta->getValue('established');
+        $established = $meta->get('established');
 
         $description = get_the_title($post_id);
 
@@ -427,16 +426,16 @@
      */
     protected function getEventTitle(int $post_id, string $title):string
     {
-        $meta = new MetaManager($post_id, 'post');
+        $meta = Meta::forPost($post_id);
 
         // Get event type if available
-        $event_type = $meta->getValue('event_type') ?: '';
+        $event_type = $meta->get('event_type') ?: '';
         if ($event_type && term_exists((int)$event_type, BASE . 'type')) {
             $event_type = get_term($event_type, BASE . 'type')->name;
         }
 
         // Get date information
-        $date_start = $meta->getValue('date_start');
+        $date_start = $meta->get('date_start');
         $month = '';
         if ($date_start) {
             $date = new DateTime($date_start);
@@ -474,17 +473,17 @@
      */
     protected function getEventDescription(int $post_id):string
     {
-        $meta = new MetaManager($post_id, 'post');
+        $meta = Meta::forPost($post_id);
         $title = get_the_title($post_id);
 
         // Get event type if available
-        $event_type = $meta->getValue('event_type') ?: '';
+        $event_type = $meta->get('event_type') ?: '';
         if ($event_type && term_exists((int)$event_type, BASE . 'type')) {
             $event_type = get_term($event_type, BASE . 'type')->name;
         }
 
         // Get date information
-        $date_start = $meta->getValue('date_start');
+        $date_start = $meta->get('date_start');
         $date_format = '';
         if ($date_start) {
             $date = new DateTime($date_start);
@@ -492,7 +491,7 @@
         }
 
         // Get location information
-        $location = $meta->getValue('location');
+        $location = $meta->get('location');
         $location_name = '';
         if (!empty($location['shop'])) {
             $shop_term = get_term($location['shop'], BASE . 'shop');
@@ -523,11 +522,11 @@
         }
 
         // Add event details if available
-        $is_free = $meta->getValue('is_free');
+        $is_free = $meta->get('is_free');
         if ($is_free) {
             $description .= ". Free admission";
         } else {
-            $cost = $meta->getValue('cost');
+            $cost = $meta->get('cost');
             if ($cost) {
                 $description .= ". Admission: {$cost}";
             }
@@ -542,12 +541,12 @@
      * Get shop title
      *
      * @param WP_Term $term The term object
-     * @param MetaManager $meta The meta manager
+     * @param Meta $meta The meta manager
      * @return string The optimized title
      */
-    protected function getShopTitle(WP_Term $term, MetaManager $meta):string
+    protected function getShopTitle(WP_Term $term, Meta $meta):string
     {
-        $city_id = $meta->getValue('city');
+        $city_id = $meta->get('city');
         $city = 'Edmonton';
 
         if ($city_id && term_exists((int)$city_id, BASE . 'city')) {
@@ -557,7 +556,7 @@
             }
         }
 
-        $length = strlen($term->name) + strlen($city);
+        $length = strlen(html_entity_decode($term->name)) + strlen($city);
 
         $title = match (true) {
             $length < 36 => $city . '\s Best Tattoo Studios',
@@ -566,26 +565,27 @@
             $length < 46 => $city . ' Tattoo Shop',
             default => 'Tattoo Shop: ',
         };
-        return "{$term->name} | {$title}";
+		$name = html_entity_decode($term->name);
+        return "{$name} | {$title}";
     }
 
     /**
      * Get shop description
      *
      * @param WP_Term $term The term object
-     * @param MetaManager $meta The meta manager
+     * @param Meta $meta The meta manager
      * @return string The optimized description
      */
-    protected function getShopDescription(WP_Term $term, MetaManager $meta):string
+    protected function getShopDescription(WP_Term $term, Meta $meta):string
     {
-        $short_bio = $meta->getValue('short_bio');
+        $short_bio = $meta->get('short_bio');
         if ($short_bio !== '') {
             return $short_bio;
         }
 
-        $established = $meta->getValue('established');
+        $established = $meta->get('established');
         // Get city
-        $city_id = $meta->getValue('city');
+        $city_id = $meta->get('city');
         $city = 'Edmonton';
 
         if ($city_id && term_exists((int)$city_id, BASE . 'city')) {
@@ -614,7 +614,7 @@
         }
 
         // Build description
-        $description = "{$term->name}";
+        $description = html_entity_decode($term->name);
 
         if (!empty($established)) {
             $description .= " has been slinging ink in {$city} since {$established}";
@@ -639,25 +639,26 @@
      */
     protected function getStyleTitle(WP_Term $term):string
     {
-        return "Edmonton's Best {$term->name} Tattoo Artists";
+		$name = html_entity_decode($term->name);
+        return "Edmonton's Best {$name} Tattoo Artists";
     }
 
     /**
      * Get style description
      *
      * @param WP_Term $term The term object
-     * @param MetaManager $meta The meta manager
+     * @param Meta $meta The meta manager
      * @return string The optimized description
      */
-    protected function getStyleDescription(WP_Term $term, MetaManager $meta):string
+    protected function getStyleDescription(WP_Term $term, Meta $meta):string
     {
-        $tagline = $meta->getValue('tagline');
+        $tagline = $meta->get('tagline');
 
         if (!$tagline !== '') {
             return $tagline;
         }
-        $characteristics = $meta->getValue('characteristics');
-        $alternate_names = $meta->getValue('alternate_name');
+        $characteristics = $meta->get('characteristics');
+        $alternate_names = $meta->get('alternate_name');
 
         // Get alt names if available
         $alt_name_text = '';
@@ -675,7 +676,8 @@
         }
 
         // Build description
-        $description = "{$term->name}{$alt_name_text} is a distinctive tattoo style";
+		$name = html_entity_decode($term->name);
+        $description = "{$name}{$alt_name_text} is a distinctive tattoo style";
 
         if (!empty($characteristics)) {
             $stripped = wp_strip_all_tags($characteristics);
@@ -686,7 +688,8 @@
             }
         }
 
-        $description .= " Find Edmonton artists specializing in {$term->name} tattoos.";
+		$name = html_entity_decode($term->name);
+        $description .= " Find Edmonton artists specializing in {$name} tattoos.";
 
         return $description;
     }
@@ -699,25 +702,26 @@
      */
     protected function getThemeTitle(WP_Term $term):string
     {
-        return "Edmonton's Best {$term->name} Tattoos";
+		$name = html_entity_decode($term->name);
+        return "Edmonton's Best {$name} Tattoos";
     }
 
     /**
      * Get theme description
      *
      * @param WP_Term $term The term object
-     * @param MetaManager $meta The meta manager
+     * @param Meta $meta The meta manager
      * @return string The optimized description
      */
-    protected function getThemeDescription(WP_Term $term, MetaManager $meta):string
+    protected function getThemeDescription(WP_Term $term, Meta $meta):string
     {
-        $description_meta = $meta->getValue('description');
+        $description_meta = $meta->get('description');
         if ($description_meta !== '') {
             return $description_meta;
         }
 
         // Get similar themes if available
-        $similar = $meta->getValue('similar');
+        $similar = $meta->get('similar');
         $similar_text = '';
 
         if (!empty($similar)) {
@@ -735,15 +739,16 @@
         }
 
         // Build description
-        $description = "Explore {$term->name} tattoos";
+		$name = html_entity_decode($term->name);
+        $description = "Explore {$name} tattoos";
 
 
         $description .= ", a popular motif in Edmonton's tattoo scene.";
 
 
         $description .= $similar_text;
-
-        $description .= " Find artists specializing in {$term->name} tattoos.";
+		$name = html_entity_decode($term->name);
+        $description .= " Find artists specializing in {$name} tattoos.";
 
         return $description;
     }
@@ -756,7 +761,8 @@
      */
     protected function getCityTitle(WP_Term $term):string
     {
-        return "{$term->name} Tattoo Artists & Shops | edmonton.ink";
+		$name = html_entity_decode($term->name);
+        return "{$name} Tattoo Artists & Shops | edmonton.ink";
     }
 
     /**
@@ -799,7 +805,8 @@
         }
 
         // Build description
-        $description = "Discover {$term->name}'s vibrant tattoo scene";
+		$name = html_entity_decode($term->name);
+        $description = "Discover {$name}'s vibrant tattoo scene";
 
         if ($shop_count > 0 || $artist_count > 0) {
             $description .= " featuring";
@@ -822,4 +829,4 @@
     }
 }
 
-new SEOMetaManager();
+//new SEOMetaManager();

--
Gitblit v1.10.0