From ba1e1ccf869b818f7a7a897264dfea05563a7796 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 07 Jun 2026 20:10:20 +0000
Subject: [PATCH] =Major overhaul of Integrations. Playing around with adding fields to post types through Registrar from an integrations' class file.
---
inc/managers/CustomTable.php | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/inc/managers/CustomTable.php b/inc/managers/CustomTable.php
index e344576..572d8a2 100644
--- a/inc/managers/CustomTable.php
+++ b/inc/managers/CustomTable.php
@@ -49,15 +49,16 @@
*
* @example CustomTable::for('favourites')->insert($data);
*/
- public static function for(string $tableName): self
+ public static function for(string $tableName, bool $user = false, bool $auth = false, bool $useTransactions = false): self
{
if (!isset(self::$instances[$tableName])) {
- self::$instances[$tableName] = new self($tableName);
+ self::$instances[$tableName] = new self($tableName, $user, $auth, $useTransactions);
}
return self::$instances[$tableName];
}
+
public static function destroyInstance(string $tableName):void
{
if (isset(self::$instances[$tableName])) {
@@ -184,7 +185,7 @@
if (is_array($key)) {
$value = $key['value'];
// Ensure value is wrapped in parentheses
- if (!str_starts_with(trim($value), '(')) {
+ if (!str_contains(trim($value), '(`')) {
$value = '(`' . $value . '`)';
}
$parts[] = $key['key'] . ' KEY ' . $value;
@@ -260,7 +261,7 @@
* @param string $tableName Table name without prefix/BASE (e.g., 'favourites', 'notifications')
* @param bool $useTransactions Whether to auto-wrap operations in transactions
*/
- public function __construct(string $tableName, bool $useTransactions = false)
+ public function __construct(string $tableName, bool $user = false, bool $auth = false, bool $useTransactions = false)
{
global $wpdb;
$this->wpdb = $wpdb;
@@ -269,6 +270,12 @@
$this->useTransactions = $useTransactions;
$this->cache = Cache::for($tableName);
+ if ($user) {
+ $this->cache->user();
+ }
+ if ($auth) {
+ $this->cache->auth();
+ }
$usersStatus = $this->wpdb->get_row("SHOW TABLE STATUS LIKE '{$this->wpdb->users}'");
$parentCollation = $usersStatus->Collation ?? 'utf8mb4_general_ci';
--
Gitblit v1.10.0