From 772462eeca3002a1d52508aeba485aab2b4742ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 03 Mar 2026 19:06:19 +0000
Subject: [PATCH] =MAJOR OVERHAUL. Likely should have made a new branch ages ago. Key changes: Registrar.php is the base for custom post types, taxonomies, and user roles. Replaces JVB_CONTENT, JVB_TAXONOMY, and JVB_USER constants, eliminates most of Features.php (except for JVB_SITE, JVB_MEMBERSHIP), and has built in sanitizing and validation via sub-classes. Also started a major overhaul of the Schema output. Created a shit ton of property traits and classes to help sanitize and ensure proper data for different schema types. Still a bunch to do, but better to be starting committing changes here on this other branch.
---
inc/helpers/ui.php | 57 ++++++++++++++++++++++++---------------------------------
1 files changed, 24 insertions(+), 33 deletions(-)
diff --git a/inc/helpers/ui.php b/inc/helpers/ui.php
index 5b0a616..a491e36 100644
--- a/inc/helpers/ui.php
+++ b/inc/helpers/ui.php
@@ -1,5 +1,6 @@
<?php
+use JVBase\meta\Form;
use JVBase\utility\Features;
use JVBase\utility\Image;
@@ -86,8 +87,8 @@
<div class="actions row end">
<button class="retry" data-action="retry"><span>Retry</span><?= jvbIcon('arrows-clockwise')?></button>
<button class="cancel" data-action="cancel"><span>Cancel</span><?= jvbIcon('x-square')?></button>
+ <button class="refresh" data-action="refresh" title="Refresh to see changes"><span>Refresh</span><?= jvbIcon('arrows-clockwise')?></button>
<button class="dismiss" data-action="dismiss"><span>Dismiss</span><?= jvbIcon('eye-closed')?></button>
-
</div>
</div>
</template>
@@ -110,7 +111,7 @@
*/
function jvbNotificationMenu():string
{
- if (jvbSiteHasNotifications() && is_user_logged_in()) {
+ if (Features::forMembership()->has('notifications') && is_user_logged_in()) {
ob_start();
?>
@@ -212,24 +213,7 @@
*/
function jvbSearch(string $placeholder = 'Search...', string $id = 'search'):string
{
- $id = sanitize_title($id);
- return sprintf(
- '<div class="search-container row start nowrap">
- <input type="search" id="%s" placeholder="%s">
- <button
- title="Clear Search"
- type="button"
- class="clear-search"
- aria-label="Clear search"
- onclick="this.previousElementSibling.value = \'\'; this.previousElementSibling.focus();"
- >%s</button>
- <button type="button" title="Search" class="toggle search" aria-label="Toggles search input visually" onclick="this.parentNode.classList.toggle(\'open\');this.previousElementSibling.previousElementSibling.focus();">%s</button>
- </div>',
- $id,
- $placeholder,
- jvbIcon('x', ['title'=> 'Clear Search']),
- jvbIcon('magnifying-glass')
- );
+ return Form::search($placeholder, $id);
}
@@ -269,7 +253,7 @@
function jvbImageCaption(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string
{
$caption = wp_get_attachment_caption($imgID);
- $caption = ($caption && $caption !== '') ? '<figcaption>'.apply_filters('the_content', $caption).'</figcaption>' : '';
+ $caption = ($caption && $caption !== '') ? '<figcaption>'.jvb_filter_content( $caption).'</figcaption>' : '';
return '<figure>'.jvbFormatImage($imgID, $start, $end, $addLink, $postSlug).$caption.'</figure>';
}
@@ -410,13 +394,13 @@
<h2>'.$config['title'].'</h2>';
if ( array_key_exists('description', $config)) {
if (!is_array($config['description'])) {
- $content .= apply_filters('the_content', $config['description']);
+ $content .= jvb_filter_content( $config['description']);
} else {
// foreach ($config['description'] as $desc) {
-// $content .= apply_filters('the_content', $desc);
+// $content .= jvb_filter_content( $desc);
// }
$content .= implode('',array_map(function ($paragraph) {
- return apply_filters('the_content', $paragraph);
+ return jvb_filter_content( $paragraph);
}, $config['description']));
}
@@ -436,24 +420,30 @@
return $out;
}
-function jvbRenderProgressBar(string $inside ='', $top = false, $icon = true)
+function jvbRenderProgressBar(string $inside ='', $top = false, $icon = true, $return = false):string
{
+
$top = $top ? ' abs top' : '';
- ?>
- <div class="progress<?=$top?>">
+ $bar = sprintf(
+ '<div class="progress%s">
<div class="bar">
<div class="fill"></div>
</div>
<div class="row btw">
- <?php if ($icon) { ?>
- <i class="icon"></i>
- <?php } ?>
+ %s
<div class="details">
- <?=$inside?>
+ %s
</div>
</div>
- </div>
- <?php
+ </div>',
+ $top,
+ ($icon) ? '<i class="icon"></i>': '',
+ $inside
+ );
+ if (!$return) {
+ echo $bar;
+ }
+ return $bar;
}
function jvbFormStatus(string $message = '') {
@@ -473,6 +463,7 @@
</div>
<div class="fstatus row" hidden>
<div class="spinner"></div>
+ <i class="icon"></i>
<p class="message">'.$message.'</p>
</div>';
}
--
Gitblit v1.10.0