forked from litespeedtech/lscache_wp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamp.cls.php
34 lines (31 loc) · 910 Bytes
/
amp.cls.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* The Third Party integration with AMP plugin.
*
* @since 2.9.8.6
* @package LiteSpeed_Cache
* @subpackage LiteSpeed_Cache/thirdparty
* @author LiteSpeed Technologies <[email protected]>
*/
namespace LiteSpeed\Thirdparty ;
defined( 'WPINC' ) || exit ;
use \LiteSpeed\API ;
class AMP
{
/**
* CSS async will affect AMP result and
* Lazyload will inject JS library which AMP not allowed
* need to force set false before load
*
* @since 2.9.8.6
* @access public
*/
public static function preload()
{
if ( ! function_exists( 'is_amp_endpoint' ) || is_admin() || ! isset( $_GET[ 'amp' ] ) ) return;
add_filter( 'litespeed_can_optm', '__return_false' );
// do_action( 'litespeed_conf_force', API::O_OPTM_CSS_ASYNC, false );
do_action( 'litespeed_conf_force', API::O_MEDIA_LAZY, false );
do_action( 'litespeed_conf_force', API::O_MEDIA_IFRAME_LAZY, false );
}
}