'false', 'data-no-optimize' => '1', 'data-no-defer' => '1', 'data-no-minify' => '1', 'data-pagespeed-no-defer' => '', 'nowprocket' => '', ); const MATCH = 'htform'; /** * Hooks. */ public static function init() { add_filter( 'script_loader_tag', array( __CLASS__, 'tag' ), 20, 2 ); add_filter( 'wp_script_attributes', array( __CLASS__, 'attrs' ) ); add_filter( 'wp_inline_script_attributes', array( __CLASS__, 'attrs' ) ); // Optimizer exclusion lists (array-based). $array_filters = array( 'rocket_delay_js_exclusions', 'rocket_exclude_defer_js', 'rocket_exclude_js', 'litespeed_optm_js_defer_exc', 'litespeed_optimize_js_excludes', 'perfmatters_delay_js_exclusions', 'sgo_javascript_combine_exclude', 'sgo_js_minify_exclude', 'sgo_js_async_exclude', 'wp-optimize-minify-default-exclusions', ); foreach ( $array_filters as $filter ) { add_filter( $filter, array( __CLASS__, 'exclude_list' ) ); } add_filter( 'autoptimize_filter_js_exclude', array( __CLASS__, 'exclude_string' ) ); add_action( 'init', array( __CLASS__, 'purge_after_update' ), 99 ); } /** * Add skip attributes to the HTforms script tag (and its config). * * @param string $tag Tag HTML. * @param string $handle Handle. * @return string */ public static function tag( $tag, $handle ) { if ( 'htform' !== $handle || false !== strpos( $tag, 'data-cfasync' ) ) { return $tag; } $extra = ''; foreach ( self::SKIP_ATTRS as $k => $v ) { $extra .= '' === $v ? ' ' . $k : ' ' . $k . '="' . esc_attr( $v ) . '"'; } return str_replace( '