\DevOwl\CacheInvalidateExcludeAssets

Use this class to exclude JavaScript and Stylesheets from caching plugins.

Initialize this class in your init action!

Summary

Methods
Properties
Constants
__construct()
init()
hasFailureSupportPluginActive()
getAllUrlPath()
getAllUrls()
getInlineScripts()
getUrlPath()
getDependencies()
byHandle()
getHandles()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$pluginReceiver
$handles
N/A

Properties

$pluginReceiver

$pluginReceiver :

Type

$handles

$handles :

Handles to block.

Type

Methods

init()

init()

Initialize the hook for active cache plugins and pass down the `WP_Dependency` to the abstract implementation.

hasFailureSupportPluginActive()

hasFailureSupportPluginActive()

Checks if the current WordPress instance has a plugin active which does in general support the exclusion of assets, but doing this will result in a defect page or is not supported programmatically atm.

getAllUrlPath()

getAllUrlPath(string  $type)

Get all URL path without query arguments and leading slash.

Parameters

string $type

Can be css or js

getAllUrls()

getAllUrls(string  $type)

Get all (full) URLs of our dependencies.

Parameters

string $type

Can be css or js

getInlineScripts()

getInlineScripts(string  $type): array<mixed,string>

Get a list of to excluding inline scripts. E.g. when excluding a JavaScript which gets an additional `wp_localize_script`, this method will return `['var realCookieBanner =']`.

Parameters

string $type

Can be css or js

Returns

array<mixed,string>

getUrlPath()

getUrlPath(\_WP_Dependency  $dep)

Get only the URL path without query arguments and leading slash.

Parameters

\_WP_Dependency $dep

getDependencies()

getDependencies(string  $type): array<mixed,\_WP_Dependency>

Get `_WP_Dependency` for all available assets.

Parameters

string $type

Can be css or js

Returns

array<mixed,\_WP_Dependency>

byHandle()

byHandle(string  $type,string|array<mixed,string>  $handles)

Exclude a given handle.

Parameters

string $type

Can be css or js

string|array<mixed,string> $handles

Registered handle via wp_enqueue_script

getHandles()

getHandles()

Getter.