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 | 88 ++++++++++++++++++++++----------------------
1 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/inc/managers/SEOMetaManager.php b/inc/managers/SEOMetaManager.php
index 5ccbb0e..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':
@@ -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';
@@ -294,17 +294,17 @@
* 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';
@@ -313,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');
@@ -325,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');
@@ -393,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);
@@ -426,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);
@@ -473,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);
@@ -491,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');
@@ -522,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}";
}
@@ -541,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')) {
@@ -573,19 +573,19 @@
* 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')) {
@@ -647,18 +647,18 @@
* 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 = '';
@@ -710,18 +710,18 @@
* 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)) {
@@ -829,4 +829,4 @@
}
}
-new SEOMetaManager();
+//new SEOMetaManager();
--
Gitblit v1.10.0