get_param_keys(); if ( empty( $keys ) ) { return; } $path = ABLOCKS_ASSETS_PATH . 'js/link-passthrough.js'; if ( ! file_exists( $path ) ) { return; } // The payload is sub-1KB gzipped and already needs an inline config // block, so it's printed inline rather than as an extra HTTP request. // The readable source file stays the single source of truth. $handle = 'ablocks-link-passthrough'; wp_register_script( $handle, false, [], ABLOCKS_VERSION, [ 'in_footer' => true ] ); wp_enqueue_script( $handle ); $config = [ 'keys' => $keys, 'mode' => $this->get_match_mode(), 'linkClass' => $this->get_link_class(), 'keywords' => $this->get_keywords(), 'persist' => (bool) Helper::get_settings( 'param_passthrough_persist', true ), 'cookieDays' => max( 0, (int) Helper::get_settings( 'param_passthrough_cookie_days', 30 ) ), ]; // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents $body = (string) file_get_contents( $path ); wp_add_inline_script( $handle, 'window.ABlocksLinkPassthrough = ' . wp_json_encode( $config ) . ";\n" . $body, 'after' ); } }