core = $core; $this->version = aioseoBrokenLinkChecker()->version; $this->manifestFile = AIOSEO_BROKEN_LINK_CHECKER_DIR . '/dist/manifest.php'; $this->isDev = aioseoBrokenLinkChecker()->isDev; if ( $this->isDev ) { $this->domain = getenv( 'VITE_AIOSEO_BROKEN_LINK_CHECKER_DOMAIN' ); $this->port = getenv( 'VITE_AIOSEO_BROKEN_LINK_CHECKER_DEV_PORT' ); } add_filter( 'script_loader_tag', [ $this, 'scriptLoaderTag' ], 10, 3 ); } /** * The asset to load. * * @since 1.0.0 * * @param string $asset The asset to load. * @param array $dependencies An array of dependencies. * @param mixed $data Any data to be localized. * @param string $objectName The object name to use when localizing. * @return void */ public function load( $asset, $dependencies = [], $data = null, $objectName = 'aioseoBrokenLinkChecker' ) { $this->jsPreloadImports( $asset ); $this->loadCss( $asset ); $this->enqueueJs( $asset, $dependencies, $data, $objectName ); } /** * Filter the script loader tag if this is our script. * * @since 1.0.0 * * @param string $tag The tag that is going to be output. * @param string $handle The handle for the script. * @return string The modified tag. */ public function scriptLoaderTag( $tag, $handle, $src ) { if ( $this->skipModuleTag( $handle ) ) { return $tag; } $tag = str_replace( $src, $this->normalizeAssetsHost( $src ), $tag ); // Remove the type and re-add it as module. $tag = preg_replace( '/type=[\'"].*?[\'"]/', '', (string) $tag ); $tag = preg_replace( '/