Plugin Directory

Changeset 3440850


Ignore:
Timestamp:
01/16/2026 09:03:12 AM (3 months ago)
Author:
Lugat
Message:

Updated TTL settings for better understanding

Location:
jinx-fast-cache/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • jinx-fast-cache/trunk/index.php

    r3440505 r3440850  
    55   * Plugin URI: https://wordpress.org/plugins/jixn-fast-cache/
    66   * Description: Blazing fast full-page caching for WordPress. Jinx Fast-Cache serves static HTML files, bypassing PHP and database overhead entirely.
    7    * Version: 0.9.7
     7   * Version: 0.9.8
    88   * Author: Jinx Digital <hello@jinx-digital.com>
    99   * Author URI: http://jinx-digital.com
  • jinx-fast-cache/trunk/src/Settings.php

    r3435708 r3440850  
    5959        }
    6060
    61         if (isset($input['ttl'])) {
    62            $sanitized['ttl'] = sanitize_text_field($input['ttl']);
     61        if (isset($input['ttl'], $input['ttl_modifier'])) {
     62
     63          $ttl = absint($input['ttl']);
     64          $ttlModifier = sanitize_text_field($input['ttl_modifier']);
     65
     66          $sanitized['ttl'] = "{$ttl} {$ttlModifier}";
     67
    6368        }
    6469
  • jinx-fast-cache/trunk/templates/settings.php

    r3435728 r3440850  
    11<?php
     2
    23  use Jinx\FastCache\Plugin;
    34  use Jinx\FastCache\Settings;
     5
    46?>
    57
     
    130132    <table class="form-table">
    131133
     134      <?php
     135
     136        $ttl = Settings::getOption('ttl', '3600 seconds');
     137
     138        if (is_numeric($ttl)) :
     139          $ttl = "{$ttl} seconds";
     140        endif;
     141
     142        list($ttl, $ttlModifier) = explode(' ', $ttl);
     143
     144      ?>
     145
    132146      <tr valign="top">
    133147        <th scope="row"><?= Plugin::t('Cache Lifespan (TTL)'); ?></th>
    134148        <td>
    135           <input type="text" name="<?= Settings::getName('ttl'); ?>" value="<?= $options['ttl'] ?? 3600; ?>" class="regular-text" /> <?= Plugin::t('seconds or modifier'); ?>
    136           <p class="description"><?= Plugin::t('How long a cached page remains valid. 3600 = 1 hour. Set a higher value for sites that don\'t update often. You may also use a modifier like "1 year".'); ?></p>
     149          <input type="number" name="<?= Settings::getName('ttl'); ?>" value="<?= $ttl; ?>" min="1" class="small-text" />
     150          <select name="<?= Settings::getName('ttl_modifier'); ?>">
     151            <option value="seconds" <?php selected('seconds', $ttlModifier); ?>><?= Plugin::t('second(s)'); ?></option>
     152            <option value="minutes" <?php selected('minutes', $ttlModifier); ?>><?= Plugin::t('minute(s)'); ?></option>
     153            <option value="hours" <?php selected('hours', $ttlModifier); ?>><?= Plugin::t('hour(s)'); ?></option>
     154            <option value="days" <?php selected('days', $ttlModifier); ?>><?= Plugin::t('day(s)'); ?></option>
     155            <option value="weeks" <?php selected('weeks', $ttlModifier); ?>><?= Plugin::t('week(s)'); ?></option>
     156            <option value="months" <?php selected('months', $ttlModifier); ?>><?= Plugin::t('month(s)'); ?></option>
     157            <option value="years" <?php selected('years', $ttlModifier); ?>><?= Plugin::t('year(s)'); ?></option>
     158          </select>
     159          <p class="description"><?= Plugin::t('How long a cached page remains valid. Set a higher value for sites that don\'t update often.'); ?></p>
    137160        </td>
    138161      </tr>
Note: See TracChangeset for help on using the changeset viewer.