From c16a4d78d07e81ecdd2ff9b1b9090560ab2fe488 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 04 Sep 2026 22:25:09 +0000
Subject: [PATCH] =Got the panel loading up the fields, organized by section! Now to ensure it saves properly. Still need to add: upload fields, selector fields, repeater/taglist/group fields

---
 jvb.php |  159 +++++++++++++++++++++-------------------------------
 1 files changed, 65 insertions(+), 94 deletions(-)

diff --git a/jvb.php b/jvb.php
index 6494ea5..cd08de1 100644
--- a/jvb.php
+++ b/jvb.php
@@ -27,7 +27,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 +53,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);
 
 
 
@@ -121,21 +120,17 @@
 	add_filter('show_admin_bar', '__return_false');
 //}
 
-//if (JVB_TESTING) {
-//	error_log('In testing mode...');
-//} else {
-//	error_log('Not in testing mode...');
-//}
+
 
 const JVB_DIR = WP_PLUGIN_DIR . '/jvb';
 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');
@@ -514,23 +509,23 @@
 {
     echo '<div class="screen-reader-text live-region" aria-live="polite" role="status"></div>';
 }
+/*
+add_action('wp_head', 'jvbFrontendBase',1);
+function jvbFrontendBase():void
+{
 
-//add_action('wp_head', 'jvbFrontendBase',1);
-//function jvbFrontendBase():void
-//{
-//	?>
-<!--	<script type="text/javascript">window.jvbBase = '--><?php //= BASE ?>//';</script>
-//	<?php
-//}
-
+	<script type="text/javascript">window.jvbBase = '<?= BASE ?>';</script>
+	<?php
+}
+*/
 
 
 add_action('after_setup_theme', 'jvbImageSize');
 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 );
 }
 
 
@@ -549,23 +544,6 @@
 //	return $result;
 //}, 10, 3);
 
-add_filter('rest_authentication_errors', function($result) {
-
-	// Don't override existing authentication
-	if (is_wp_error($result) || $result === true) {
-		return $result;
-	}
-
-	// Try to authenticate from cookie
-	$cookie_user = wp_validate_auth_cookie('', 'logged_in');
-
-	if ($cookie_user) {
-		wp_set_current_user($cookie_user);
-		return true;
-	}
-	return $result;
-}, 99);
-
 
 add_action('wp_footer', 'jvb_back_to_top');
 function jvb_back_to_top():void
@@ -576,13 +554,6 @@
 	);
 }
 
-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

--
Gitblit v1.10.0