se' ); add_filter( 'do_rocket_protocol_rewrite', '__return_false' ); unset( $wp_filter['rocket_buffer'] ); $options = get_option( self::AMP_OPTIONS, [] ); if ( ! empty( $options['theme_support'] ) && in_array( $options['theme_support'], [ 'transitional', 'reader' ], true ) ) { add_filter( 'rocket_cdn_reject_files', [ $this, 'reject_files' ], PHP_INT_MAX ); add_filter( 'rocket_buffer', [ $this->cdn_subscriber, 'rewrite' ] ); add_filter( 'rocket_buffer', [ $this->cdn_subscriber, 'rewrite_srcset' ] ); } } /** * Adds all CSS and JS files to the list of excluded CDN files. * * @since 3.5.5 * * @param array $files List of excluded files. * @return array List of excluded files. */ public function reject_files( $files ) { return array_merge( $files, [ '(.*).css', '(.*).js', ] ); } /** * Adds the switching script from AMP to delay JS excluded files * * @since 3.11.1 * * @param array $excluded List of excluded files. * @return array List of excluded files. */ public function exclude_script_from_delay_js( $excluded ) { $excluded[] = 'amp-mobile-version-switcher'; return $excluded; } }