Jake Vanderwerf
2026-02-10 6d4396cc8a7c715a259a0ff3072890f0640c79df
inc/blocks/TimelineBlock.php
@@ -1,12 +1,10 @@
<?php
namespace JVBase\blocks;
use JVBase\managers\CacheManager;
use JVBase\forms\TaxonomySelector;
use JVBase\meta\MetaManager;
use JVBase\managers\Cache;
use JVBase\meta\Meta;
use JVBase\utility\Features;
use WP_Block;
use WP_Query;
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
@@ -14,7 +12,7 @@
class TimelineBlock
{
    protected CacheManager $cache;
    protected Cache $cache;
    protected string $config;
    protected string $type;
    protected string $path = JVB_DIR . '/build/timeline';
@@ -31,9 +29,9 @@
    public function __construct()
    {
        $this->cache = CacheManager::for('timelines', WEEK_IN_SECONDS)->connectTo('post', 'timeline');
        $this->cache = Cache::for('timelines', WEEK_IN_SECONDS)->connect('post');
      if (JVB_TESTING){
         $this->cache->clear();
         $this->cache->flush();
      }
        add_action('init', [ $this, 'registerBlock' ]);
      add_action('wp_footer', 'jvbRenderGallery');
@@ -89,7 +87,7 @@
   }
    protected function renderHeader():void
    {
      $meta = new MetaManager($this->parentID, 'post');
      $meta = Meta::forPost($this->parentID);
      $sharedFields = JVB()->routes('content')->getTimelineSharedFields($this->content);
      $fields = $meta->getAll($sharedFields);
      $extra = $meta->getAll();
@@ -122,7 +120,7 @@
                     ?>
                     <?= $open ?>
                     <a href="<?=$link?>" rel="tag"><?=$term->name?></a>
                     <a href="<?=$link?>" rel="tag"><?=html_entity_decode($term->name)?></a>
                     <?= $close ?>
                  <?php }
                  if ($many) { echo '</ul>'; }
@@ -140,8 +138,10 @@
            <?= jvbFormatImage(get_post_thumbnail_id($this->parentID), 'tiny', 'large', false) ?>
         </div>
         <div class="after">
            <?php if (!empty($this->children)) :?>
            <h3>After <?=$this->total?> Treatment<?= $this->total > 1 ? 's' : '' ?></h3>
            <?= jvbFormatImage(get_post_thumbnail_id($this->children[count($this->children)-1]), 'tiny', 'large', false) ?>
            <?php endif; ?>
         </div>
      </section>
      <section id="info">
@@ -174,7 +174,7 @@
      $uniqueFields = JVB()->routes('content')->getTimelineUniqueFields($this->content);
      foreach ($all as $i => $ID) {
         $meta = new MetaManager($ID, 'post');
         $meta = Meta::forPost($ID);
         $fields = $meta->getAll($uniqueFields);
         $plural = ($i>1) ? 's': '';
@@ -221,7 +221,7 @@
      $out = '<ul class="term-list">';
      foreach ($timeline as $term) {
         $link = get_term_link($term->term_id, BASE.'timeline');
         $out .= '<li><a href="'.$link.'" rel="tag" title="See more progressions at this timeline">'.jvbIcon(JVB_TAXONOMY['timeline']['icon']??'hourglass').$term->name.'</a><small>from the last treatment</small></li>';
         $out .= '<li><a href="'.$link.'" rel="tag" title="See more progressions at this timeline">'.jvbIcon(JVB_TAXONOMY['timeline']['icon']??'hourglass').html_entity_decode($term->name).'</a><small>after the treatment</small></li>';
      }
      $out .='</ul>';
      return $out;