From 01e9a8e40351a87f6548a4f55de842d6f6918ad0 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 15 Sep 2026 02:44:28 +0000
Subject: [PATCH] =Found little glitch with auto-adding rewrite rules to taxonomy Registrar instances where we have the post type as the base in the url rewrite
---
jvb.php | 125 ++++++++++++++++++++---------------------
1 files changed, 61 insertions(+), 64 deletions(-)
diff --git a/jvb.php b/jvb.php
index d7df5f8..e74a588 100644
--- a/jvb.php
+++ b/jvb.php
@@ -15,6 +15,7 @@
use JVBase\admin\SEOAdmin;
use JVBase\base\SchemaHelper;
use JVBase\blocks\CustomBlocks;
+use JVBase\inc\rest\routes\OpenStreetMaps;
use JVBase\JVB;
use JVBase\managers\AdminPages;
use JVBase\managers\Approvals;
@@ -27,7 +28,6 @@
use JVBase\managers\Login;
use JVBase\managers\MagicLinks;
use JVBase\managers\NotificationManager;
-use JVBase\managers\Notifications\Notifications;
use JVBase\managers\queue\Queue;
use JVBase\managers\Referrals;
use JVBase\managers\Responses;
@@ -54,57 +54,57 @@
/**
* Track REST API errors by wrapping request execution
*/
-add_filter('rest_pre_dispatch', function($result, $server, $request) {
- // Store request details globally for error logging
- $GLOBALS['jvb_rest_request'] = [
- 'route' => $request->get_route(),
- 'method' => $request->get_method(),
- 'params' => $request->get_params(),
- 'time' => microtime(true),
- ];
-
- // Set up error handler for this request
- set_error_handler(function($errno, $errstr, $errfile, $errline) {
- if (!(error_reporting() & $errno)) {
- return false;
- }
-
- $context = array_merge($GLOBALS['jvb_rest_request'] ?? [], [
- 'error_type' => $errno,
- 'error_message' => $errstr,
- 'file' => $errfile,
- 'line' => $errline,
- 'user_id' => get_current_user_id(),
- ]);
-
- error_log('JVB REST Error: ' . json_encode($context));
-
- return false; // Let PHP handle it normally too
- });
-
- return $result;
-}, 10, 3);
-
-add_filter('rest_post_dispatch', function($result, $server, $request) {
- // Restore default error handler
- restore_error_handler();
-
- // Check for fatal errors that occurred during request
- $error = error_get_last();
- if ($error && in_array($error['type'], [E_ERROR, E_USER_ERROR, E_PARSE, E_COMPILE_ERROR])) {
- $context = array_merge($GLOBALS['jvb_rest_request'] ?? [], [
- 'fatal_error' => $error,
- 'user_id' => get_current_user_id(),
- ]);
-
- error_log('JVB REST Fatal: ' . json_encode($context));
- }
-
- // Clean up
- unset($GLOBALS['jvb_rest_request']);
-
- return $result;
-}, 10, 3);
+//add_filter('rest_pre_dispatch', function($result, $server, $request) {
+// // Store request details globally for error logging
+// $GLOBALS['jvb_rest_request'] = [
+// 'route' => $request->get_route(),
+// 'method' => $request->get_method(),
+// 'params' => $request->get_params(),
+// 'time' => microtime(true),
+// ];
+//
+// // Set up error handler for this request
+// set_error_handler(function($errno, $errstr, $errfile, $errline) {
+// if (!(error_reporting() & $errno)) {
+// return false;
+// }
+//
+// $context = array_merge($GLOBALS['jvb_rest_request'] ?? [], [
+// 'error_type' => $errno,
+// 'error_message' => $errstr,
+// 'file' => $errfile,
+// 'line' => $errline,
+// 'user_id' => get_current_user_id(),
+// ]);
+//
+// error_log('JVB REST Error: ' . json_encode($context));
+//
+// return false; // Let PHP handle it normally too
+// });
+//
+// return $result;
+//}, 10, 3);
+//
+//add_filter('rest_post_dispatch', function($result, $server, $request) {
+// // Restore default error handler
+// restore_error_handler();
+//
+// // Check for fatal errors that occurred during request
+// $error = error_get_last();
+// if ($error && in_array($error['type'], [E_ERROR, E_USER_ERROR, E_PARSE, E_COMPILE_ERROR])) {
+// $context = array_merge($GLOBALS['jvb_rest_request'] ?? [], [
+// 'fatal_error' => $error,
+// 'user_id' => get_current_user_id(),
+// ]);
+//
+// error_log('JVB REST Fatal: ' . json_encode($context));
+// }
+//
+// // Clean up
+// unset($GLOBALS['jvb_rest_request']);
+//
+// return $result;
+//}, 10, 3);
@@ -127,11 +127,11 @@
define('JVB_URL', plugin_dir_url(__FILE__));
// Session Security
-define('JVB_SESSION_FINGERPRINT', true);
+const JVB_SESSION_FINGERPRINT = true;
// Login Security
-define('JVB_MAX_LOGIN_ATTEMPTS', 5);
-define('JVB_LOCKOUT_DURATION', 15 * MINUTE_IN_SECONDS);
+const JVB_MAX_LOGIN_ATTEMPTS = 5;
+const JVB_LOCKOUT_DURATION = 15 * MINUTE_IN_SECONDS;
require(JVB_DIR.'/inc/Instance.php');
@@ -442,6 +442,8 @@
{
NewsRoutes::getInstance();
}
+
+ OpenStreetMaps::getInstance();
}
@@ -525,8 +527,8 @@
function jvbImageSize():void
{
add_theme_support('post-thumbnails');
- add_image_size( 'tiny', 50, 50, false );
- add_image_size( 'directory-preview', 100, 100, false );
+ add_image_size( 'tiny', 50, 50 );
+ add_image_size( 'directory-preview', 100, 100 );
}
@@ -555,16 +557,11 @@
);
}
-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