Jake Vanderwerf
2026-01-04 d38d825e3484d822ea3c1f0fb1df37ecf386b18a
inc/helpers/ui.php
@@ -1,6 +1,7 @@
<?php
use JVBase\utility\Features;
use JVBase\utility\Image;
if (!defined('ABSPATH')) {
   exit;
@@ -16,7 +17,7 @@
    }
    ?>
    <aside id="queue" class="left col start btw" aria-expanded="false" hidden>
    <aside id="queue" class="left col start btw main" aria-expanded="false" hidden>
        <div class="status-actions row start nowrap">
         <div class="refresh row btw">
                <span class="countdown row" title="Will refresh again...">5</span>
@@ -53,10 +54,9 @@
            ?>
         </nav>
      </div>
      <div class="qitems col">
         <!-- Operations will be listed here -->
      <div class="qitems col a-start nowrap">
      </div>
      <div class="queue-actions row btw">
      <div class="queue-actions row btw nowrap">
         <button class="dismiss-all">Clear Completed</button>
         <button class="retry-all">Retry Failed</button>
      </div>
@@ -152,6 +152,9 @@
 */
function jvbHelpMenu():string
{
   if (!Features::forSite()->has('helpMenu')) {
      return '';
   }
    $out = get_option(BASE.'help_menu');
    if ($out === false) {
@@ -245,19 +248,17 @@
 *
 * @return string
 */
function jvbFormatImage(int|string $imgID, string $start = 'tiny', string $end = 'large'):string
function jvbFormatImage(int $imgID, string $start = 'tiny', string $end = 'large', bool $addLink = true, ?string $postSlug = null):string
{
    $block = new \JVBase\blocks\CustomBlocks();
    if ($imgID === '' || $imgID === 0) {
        $imgID = $block->imageID($imgID);
    }
    if ($imgID === '' || $imgID === 0 || $imgID === false) {
        return '';
    }
    $image = new Image();
    return $image->formatImage($imgID, $start, $end, $addLink, $postSlug);
}
   $imgID = (int)$imgID;
    return $block->formatImage($imgID, $start, $end);
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>' : '';
   return '<figure>'.jvbFormatImage($imgID, $start, $end, $addLink, $postSlug).$caption.'</figure>';
}
/**
@@ -265,8 +266,6 @@
 * @return void
 */
add_action('wp_footer', 'jvbToastContainer');
function jvbToastContainer():void
{
    ?>
@@ -332,11 +331,12 @@
add_action('wp_footer', 'jvbLoadingScreen');
function jvbLoadingScreen():string
{
   $icon = apply_filters('jvbLoadingIcon', 'drop-simple');
   return '<dialog class="loading">
      <div class="col">
         <div class="spinner"></div>
         <div class="status col">
            <div class="icon">'.apply_filters('jvbLoadingIcon', jvbIcon('drop-simple')).'</div>
            <div class="icon">'.jvbIcon($icon).'</div>
            <h3>Loading</h3>
            <p class="typeText">Please wait...</p>
         </div>
@@ -396,7 +396,7 @@
      }
      $content .= '>
         <h2>'.$config['title'].'</h2>';
         if ( $config['description']) {
         if ( array_key_exists('description', $config)) {
            if (!is_array($config['description'])) {
               $content .= apply_filters('the_content', $config['description']);
            } else {
@@ -432,8 +432,11 @@
      <div class="bar">
         <div class="fill"></div>
      </div>
      <div class="details row btw">
         <?=$inside?>
      <div class="row btw">
         <i class="icon"></i>
         <div class="details">
            <?=$inside?>
         </div>
      </div>
   </div>
   <?php