| 1 |
<?php |
| 2 |
/** |
| 3 |
* This is logic for integrating with the WP Fastest Cache plugin. |
| 4 |
* |
| 5 |
* @link https://wordpress.org/plugins/wp-fastest-cache/ |
| 6 |
* |
| 7 |
* @see https://pixelgrade.com |
| 8 |
* @author Pixelgrade |
| 9 |
* @since 2.7.1 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; // Exit if accessed directly |
| 14 |
} |
| 15 |
|
| 16 |
// Try to exclude the webfontloader script by adding a default rule in the plugin options. |
| 17 |
add_filter( 'default_option_WpFastestCacheExclude', function ( $default ) { |
| 18 |
$webfontloader_script_url = trailingslashit( dirname( plugin_basename( PixCustomifyPlugin::instance()->get_file() ) ) ) . 'js/vendor/webfontloader'; |
| 19 |
if ( empty( $default ) ) { |
| 20 |
$default = json_encode( [ |
| 21 |
[ |
| 22 |
'prefix' => 'contain', |
| 23 |
'content' => $webfontloader_script_url, |
| 24 |
'type' => 'js', |
| 25 |
] |
| 26 |
] ); |
| 27 |
} |
| 28 |
|
| 29 |
return $default; |
| 30 |
}, 10, 1 ); |
| 31 |
|