Plugin Directory


Ignore:
Timestamp:
11/08/2026 04:28:35 PM (5 hours ago)
Author:
degird
Message:

Release 1.2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cliedesk/trunk/src/Modules/Knowledge/HelpCenter.php

    r3777980 r3791202  
    3636                add_filter( 'template_include', array( $this, 'classic_template' ), 20 );
    3737                add_action( 'wp_enqueue_scripts', array( $this, 'assets' ) );
     38                add_action( 'template_redirect', array( self::class, 'cache_policy' ), 0 );
    3839                add_filter( 'body_class', array( $this, 'body_class' ) );
    3940                // KB-37: the help-center search on any page (the block works too).
    … …  
    4647        public static function is_help(): bool {
    4748                return is_post_type_archive( Articles::POST_TYPE ) || is_tax( Articles::TAXONOMY ) || is_singular( Articles::POST_TYPE );
     49        }
     50
     51        /**
     52         * What a page cache may do with this help page: keep it while the help center is public (the same for everyone,
     53         * refreshed when an article or a setting changes), never store it when it is private. A visitor who unlocked a
     54         * password-protected help center must not fill the cache for everyone else.
     55         */
     56        public static function cache_policy(): void {
     57                if ( ! self::is_help() ) {
     58                        return;
     59                }
     60                if ( self::is_public() ) {
     61                        \Cliedesk\Infrastructure\Http\NoCache::tag_public();
     62                        return;
     63                }
     64                \Cliedesk\Infrastructure\Http\NoCache::page();
    4865        }
    4966
Note: See TracChangeset for help on using the changeset viewer.