get_data($handle, 'phast_no_defer')) { return $tag; } return preg_replace('~registered as $handle => $item) { if (empty($item->extra['phast_no_defer']) || empty($item->extra['data']) ) { continue; } $item->extra['data'] = "'phast-no-defer';\n" . $item->extra['data']; } }); foreach ([ Compat\MonsterInsights::class, Compat\Slimstat::class, Compat\GoogleSiteKit::class, Compat\GAGoogleAnalytics::class, Compat\AdThrive::class, ] as $class) { (new $class())->setup(); } $sdk = phastpress_get_plugin_sdk(); $handler = $sdk->getPhastAPI()->deployOutputBufferForDocument(); // Allow disabling PhastPress with hook. add_filter('template_redirect', function () use ($handler) { if (apply_filters('phastpress_disable', false)) { $handler->cancel(); } }, 100); $plugin_config = $sdk->getPluginConfiguration(); $display_footer = $plugin_config->shouldDisplayFooter(); if ($display_footer) { add_action('wp_head', 'phastpress_render_footer_css', 0, 2); add_action('wp_footer', 'phastpress_render_footer'); } } function phastpress_render_footer_css() { echo << STYLE; } function phastpress_render_footer() { echo ''; }