From f4be611c51473359e6d41780f0313c446079e9d3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 09 Jun 2026 15:19:24 +0000
Subject: [PATCH] =Switched the /base/options.php to the same pattern as Site.php: a class based approached rather than a filter. Updated Meta.php to play along with the defined fields from there in Meta::forOptions. Had to change openingHoursSpecificationsTrait.php to not use the translater functions __('text','textdomain') for now, as we load before init.

---
 base/Site.php |   87 ++++++++++++++++++++++++++-----------------
 1 files changed, 53 insertions(+), 34 deletions(-)

diff --git a/base/Site.php b/base/Site.php
index dfdff4d..2276b00 100644
--- a/base/Site.php
+++ b/base/Site.php
@@ -1,8 +1,6 @@
 <?php
 namespace JVBase\base;
 
-use JVBase\base\Login;
-
 if (!defined('ABSPATH')) {
 	exit;
 }
@@ -14,11 +12,21 @@
 	protected static Membership $membershipConfig;
 	protected static Site $instance;
 	protected static string $icons = 'regular';
+	/**
+	 * @var array Dashboard  config
+	 */
+	protected static string $dashboardTitle;
 
 	/**
 	 * @var bool $is_directory Whether this is a membership directory
 	 */
 	protected static bool $is_directory = false;
+	protected static string $directory_singular;
+	protected static string $directory_plural;
+	/**
+	 * @var bool Whether to add a help menu to the header
+	 */
+	protected static bool $help_menu = false;
 	/**
 	 * @var bool $has_membership Whether this site has membership
 	 */
@@ -31,6 +39,7 @@
 	 * @var bool $referrals Whether to implement a referral system, with rewards
 	 */
 	protected static bool $referrals = false;
+	protected static string $defaultReferralRole = BASE.'client';
 	/**
 	 * @var bool $magic_link Whether users can login without a password
 	 */
@@ -53,6 +62,10 @@
 	 */
 	protected static bool $limit_hours = false;
 	/**
+	 * @var bool $has_hours Whether this site has business hours
+	 */
+	protected static bool $has_hours = false;
+	/**
 	 * @var bool $enthusiast Whether to scaffold enthusiasts (users that can interact with and save favourites)
 	 */
 	protected static bool $enthusiast = false;
@@ -81,7 +94,7 @@
 	public static function getInstance():Site {
 		if (!isset(self::$instance)) {
 			self::$instance = new self();
-			do_action('jvbLoadDefinitions');
+			do_action('jvb_define_site');
 		}
 		return self::$instance;
 	}
@@ -200,35 +213,41 @@
 		}
 		return self::$membershipConfig;
 	}
+
+	public function setDashboardTitle(string $title):void
+	{
+		self::$dashboardTitle = $title;
+	}
+
+	public static function dashboardTitle():bool|string
+	{
+		return self::$dashboardTitle ?? false;
+	}
+
+	public function setDirectorySingular(string $title):void
+	{
+		self::$directory_singular = $title;
+	}
+	public static function getDirectorySingular():bool|string
+	{
+		return self::$directory_singular ?? false;
+	}
+
+	public function setDirectoryPlural(string $title):void
+	{
+		self::$directory_plural = $title;
+	}
+	public static function getDirectoryPlural():bool|string
+	{
+		return self::$directory_plural ?? false;
+	}
+
+	public static function setDefaultReferralRole(string $role):void
+	{
+		self::$defaultReferralRole = $role;
+	}
+	public static function getDefaultReferralRole():string
+	{
+		return self::$defaultReferralRole;
+	}
 }
-
-
-$defaults = [
-	'icons'               => 'light',
-	'directory'        => false,        //as in, a membership directory
-	'membership'      => false,
-	'has_map'             => false,			//TODO: migrate to integrations['gmb']
-	'dashboard'           => false,
-	'support'         => false,
-	'feed_block'      => false,
-	'email_notifications' => false,
-	'integrations'  => [
-		'bluesky'     => false,
-		'cloudflare'  => false,
-		'facebook'    => false,
-		'maps'        => false,
-		'gmb'         => false,
-		'helcim'      => false,
-		'instagram'   => false,
-		'square'      => false,
-		'umami'       => false,
-	],
-	'is_restaurant'       => false,
-	'limit_hours'         => false,
-	'enthusiast'          => false,
-	'favourites'          => false,    			//optional flag to allow enthusiasts, but not favourites
-];
-
-$jvb_site = array_merge($defaults, apply_filters('jvb_site', []));
-
-define('JVB_SITE', $jvb_site);

--
Gitblit v1.10.0