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.
---
jvb.php | 94 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 89 insertions(+), 5 deletions(-)
diff --git a/jvb.php b/jvb.php
index 17669f9..6cc5ff8 100644
--- a/jvb.php
+++ b/jvb.php
@@ -4,7 +4,7 @@
Plugin URI: https://jakevan.ca
Description: The Base Plugin for JakeVan clients
Author: Jake Vanderwerf
-Version: 1.0.0
+Version: 1.1.0
Author URI: https://jakevan.ca/
Textdomain: jvb
*/
@@ -20,6 +20,18 @@
exit;
}
+//add_action('admin_enqueue_scripts', function() {
+// global $wp_scripts;
+// add_action('admin_print_scripts', function() use ($wp_scripts) {
+// $queue = $wp_scripts->queue ?? [];
+// foreach ($queue as $handle) {
+// $src = $wp_scripts->registered[$handle]->src ?? 'unknown';
+// error_log("Enqueued: $handle => $src");
+// }
+// }, 999);
+//}, 999);
+
+
/**
* Track REST API errors by wrapping request execution
*/
@@ -76,6 +88,7 @@
}, 10, 3);
+
function jvbIgnoredPostTypes():array
{
return [BASE.'directory', BASE.'dash', 'attachment', 'revision', 'nav_menu_item'];
@@ -83,6 +96,7 @@
define('JVB_TESTING', str_contains(get_home_url(),'.test'));
+//const JVB_TESTING = false;
//if (!JVB_TESTING) {
add_filter('show_admin_bar', '__return_false');
@@ -141,6 +155,13 @@
return IconsManager::for($source)->get($name, $options);
}
+function jvbFullIcon(string $name, array $options = []):string
+{
+ $source = $options['source'] ?? 'icons';
+ unset($options['source']);
+ return IconsManager::for($source)->getRawSvg($name, $options['style']??null);
+}
+
/**
* Get a CSS data URI for an icon
*
@@ -228,11 +249,59 @@
require(JVB_DIR . '/inc/admin/_setup.php');
require(JVB_DIR . '/JVBase.php');
+
+/**
+ * After moving to the Registrar::based registration, we need to carefully time
+ * when Site gets defined, as well as Registrar initial definitions, field definitions,
+ * and integration config
+ * These custom actions should simplify the timing for us.
+ */
+add_action('plugins_loaded', 'jvb_site_definitions',1);
+add_action('plugins_loaded', 'jvb_registrar_definitions',2);
+add_action('plugins_loaded', 'jvb_field_definitions', 3);
+add_action('plugins_loaded', 'jvb_options_definitions',3);
add_action('init', 'jvbLoadBase', 1);
+add_action('init', 'jvb_integration_definitions',3);
+add_action('init', 'jvb_field_section_definitions', 5);
+/**
+ * Can define the Site settings
+ * @return void
+ */
+function jvb_site_definitions():void
+{
+ do_action('jvb_define_site');
+}
+function jvb_registrar_definitions():void
+{
+ do_action('jvb_define_registrar');
+}
+function jvb_field_definitions():void
+{
+ do_action('jvb_define_fields');
+}
+
+function jvb_options_definitions():void
+{
+ do_action('jvb_define_options');
+}
+
function jvbLoadBase():void
{
JVB::getInstance();
}
+
+function jvb_integration_definitions():void
+{
+ do_action('jvb_define_integrations');
+}
+
+function jvb_field_section_definitions():void
+{
+ do_action('jvb_define_field_sections');
+ Registrar::maybeBuildSections();
+}
+
+
function JVB(): JVB
{
return JVB::getInstance();
@@ -297,7 +366,7 @@
if (Site::has('favourites')) {
$interactions[] = 'favourites';
}
- if (!empty(Registrar::getFeatured('karma'))) {
+ if (!empty(Registrar::withFeature('karma'))) {
$interactions[] = 'karma';
}
if (Site::has('notifications')) {
@@ -305,7 +374,6 @@
}
if (!empty($interactions)) {
- wp_enqueue_script('jvb-interactions');
foreach($interactions as $interaction) {
wp_enqueue_script('jvb-'.$interaction);
}
@@ -353,7 +421,7 @@
}';
}
- if (!empty(Registrar::getFeatured('karma'))) {
+ if (!empty(Registrar::withFeature('karma'))) {
wp_enqueue_script('jvb-votes');
$initUserSettings .= '// Fetch user votes
try {
@@ -443,7 +511,7 @@
));
}
- jvbAddScriptDependency('jvb-feed-view-script', 'jvb-queue');
+// jvbAddScriptDependency('jvb-feed-view-script', 'jvb-queue');
jvbAddScriptDependency('jvb-feed-view-script', 'jvb-selector');
jvbAddScriptDependency('jvb-feed-view-script', 'jvb-data-store');
jvbAddScriptDependency('jvb-feed-view-script', 'jvb-cache');
@@ -455,6 +523,8 @@
jvbAddScriptDependency('jvb-forms-view-script', 'jvb-quill');
jvbAddScriptDependency('jvb-forms-view-script', 'jvb-form');
jvbAddScriptDependency('jvb-forms-view-script', 'jvb-tabs');
+
+ jvbAddScriptDependency('jvb-timeline-view-script', 'jvb-gallery');
}
function jvbAdminMap():void
@@ -567,3 +637,17 @@
jvbIcon('caret-double-up')
);
}
+
+add_action( 'doing_it_wrong_run', function ( $function_name ) {
+ if ( '_load_textdomain_just_in_time' === $function_name ) {
+ // This will print the full execution path to your screen or log
+ debug_print_backtrace();
+ }
+} );
+
+
+add_filter('the_seo_framework_sitemap_exclude_ids', 'jvb_maybe_exclude_singles', 8, 1);
+function jvb_maybe_exclude_singles(array $IDs):array
+{
+ return Registrar::maybeExcludeSingles($IDs);
+}
--
Gitblit v1.10.0