-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: WP Fastest Cache compatibility
- Loading branch information
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/* * * * * * * * * * * * * * * * * * * * | ||
* ██████╗ █████╗ ██████╗ ███████╗ | ||
* ██╔════╝██╔══██╗██╔═══██╗██╔════╝ | ||
* ██║ ███████║██║ ██║███████╗ | ||
* ██║ ██╔══██║██║ ██║╚════██║ | ||
* ╚██████╗██║ ██║╚██████╔╝███████║ | ||
* ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ | ||
* | ||
* @author : Daan van den Bergh | ||
* @url : https://daan.dev/wordpress/caos/ | ||
* @copyright: © 2021 - 2024 Daan van den Bergh | ||
* @license : GPL2v2 or later | ||
* * * * * * * * * * * * * * * * * * * */ | ||
|
||
class CAOS_Compatibility_Cloudflare { | ||
/** | ||
* Build class. | ||
*/ | ||
public function __construct() { | ||
$this->init(); | ||
} | ||
|
||
/** | ||
* Action and filter hooks. | ||
* | ||
* @return void | ||
*/ | ||
private function init() { | ||
add_filter( 'caos_script_custom_attributes', [ $this, 'exclude_from_cloudflare' ] ); | ||
} | ||
|
||
/** | ||
* Add data-no-optimize="1" attribute to script if LiteSpeed Cache is enabled. | ||
* | ||
* @param $attributes | ||
* | ||
* @return string | ||
*/ | ||
public function exclude_from_cloudflare( $attributes ) { | ||
return 'data-cfasync="false" ' . $attributes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/* * * * * * * * * * * * * * * * * * * * | ||
* ██████╗ █████╗ ██████╗ ███████╗ | ||
* ██╔════╝██╔══██╗██╔═══██╗██╔════╝ | ||
* ██║ ███████║██║ ██║███████╗ | ||
* ██║ ██╔══██║██║ ██║╚════██║ | ||
* ╚██████╗██║ ██║╚██████╔╝███████║ | ||
* ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ | ||
* | ||
* @author : Daan van den Bergh | ||
* @url : https://daan.dev/wordpress/caos/ | ||
* @copyright: © 2021 - 2024 Daan van den Bergh | ||
* @license : GPL2v2 or later | ||
* * * * * * * * * * * * * * * * * * * */ | ||
|
||
class CAOS_Compatibility_WpFastestCache { | ||
/** | ||
* Build class. | ||
*/ | ||
public function __construct() { | ||
$this->init(); | ||
} | ||
|
||
/** | ||
* Action and filter hooks. | ||
* | ||
* @return void | ||
*/ | ||
private function init() { | ||
add_filter( 'caos_script_custom_attributes', [ $this, 'exclude_from_wpfc' ] ); | ||
} | ||
|
||
/** | ||
* Add data-no-optimize="1" attribute to script if LiteSpeed Cache is enabled. | ||
* | ||
* @param $attributes | ||
* | ||
* @return string | ||
*/ | ||
public function exclude_from_wpfc( $attributes ) { | ||
return 'data-wpfc-render="false" ' . $attributes; | ||
} | ||
} |