Plugin Directory

Changeset 2888549


Ignore:
Timestamp:
03/28/2023 03:28:27 PM (3 years ago)
Author:
Lugat
Message:

Added new filters for 404 and query params.

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

Legend:

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

    r2874473 r2888549  
    55   * Plugin URI: https://wordpress.org/plugins/jixn-fast-cache/
    66   * Description: Blazing fast full page cache.
    7    * Version: 0.5.0
     7   * Version: 0.5.1
    88   * Author: SquareFlower Websolutions (Lukas Rydygel) <hallo@squareflower.de>
    99   * Author URI: http://squareflower.de
  • jinx-fast-cache/trunk/readme.txt

    r2874473 r2888549  
    7070- **jinx_fast_cache_interval**: Change the interval of the cron task (default 60).
    7171- **jinx_fast_cache_queue_size**: Change the number of URLs which should be handled durring a cron task (default 10). When setting it to <= 0, all URLs will be handled. This may cause a huge load when you have a lot of URLs.
     72- **jinx_fast_cache_ignore_404**: Change if 404 error should not be cached (default true). A lot of 404 errors will create a lot of cache files on your server.
     73- **jinx_fast_cache_query_params**: Change if and which query params will be accepted. You may pass '__return_empty_array' to allow no query params.
    7274
    7375=== Injections ===
     
    9698    [jinx_fast_cache_inject]My dynamic content or other shortcodes can be used here[/jinx_fast_cache_inject]
    9799
     100
    98101== Roadmap ==
    99102
     
    107110- [x] Add multisite support
    108111- [x] Flush and warm after update complete
     112- [x] Ignore 404
     113- [x] Allow query params to be excluded or totally ignored
    109114- [ ] Provide cache timeout
    110115- [ ] Provide admin panel to change options
  • jinx-fast-cache/trunk/src/Front.php

    r2874473 r2888549  
    2020
    2121        if ($cache === true) {
    22 
    23           $metaKey = Helper::getDisabledMetaKey();
    24 
    25           $object = get_queried_object();
    26          
    27           if (is_a($object, 'WP_Post')) {
    28             $disabled = (bool) get_post_meta($object->ID, $metaKey, true);
    29           } elseif (is_a($object, 'WP_Term')) {
    30             $disabled = (bool) get_term_meta($object->term_id, $metaKey, true);
     22         
     23          $disabled = null;
     24         
     25          if (is_404()) {           
     26            $disabled = apply_filters('jinx_fast_cache_ignore_404', true);
     27          } else {
     28         
     29            $metaKey = Helper::getDisabledMetaKey();
     30
     31            $object = get_queried_object();
     32
     33            if (is_a($object, 'WP_Post')) {
     34              $disabled = (bool) get_post_meta($object->ID, $metaKey, true);
     35            } elseif (is_a($object, 'WP_Term')) {
     36              $disabled = (bool) get_term_meta($object->term_id, $metaKey, true);
     37            }
     38         
    3139          }
    3240         
  • jinx-fast-cache/trunk/src/Helper.php

    r2874473 r2888549  
    9292      global $wp;
    9393     
    94       $paths = [$_SERVER['HTTP_HOST'], $wp->request, $_SERVER['QUERY_STRING']];
     94      $paths = [$_SERVER['HTTP_HOST'], $wp->request];
     95     
     96      parse_str($_SERVER['QUERY_STRING'], $queryParams);
     97     
     98      $queryParams = apply_filters('jinx_fast_cache_query_params', $queryParams);
     99      if (!empty($queryParams)) {
     100        $paths[] = http_build_query($queryParams);
     101      }
    95102     
    96103      if ($relative === false) {
Note: See TracChangeset for help on using the changeset viewer.