PluginProbe
Extendify / 3.2.3
Extendify v3.2.3
3.2.3 3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 All 129 releases
← All changes | src/Assist/lib/domains.js +10 -4 3.1.6 → 3.2.3 View file →
@@ -1,5 +1,6 @@
1 1 import { safeParseJson } from '@shared/lib/parsing';
2 +import { siteHost } from '@shared/lib/site-host';
2 3 import apiFetch from '@wordpress/api-fetch';
3 4 import { decodeEntities } from '@wordpress/html-entities';
4 5
5 6 const { hostname } = window.location;
@@ -76,16 +77,21 @@
76 77 * The domainSearchUrl may contain both {SLD} and {TLD} placeholders
77 78 * e.g., https://example.com?sld={SLD}&tld={TLD}
78 79 * If not present, fallback to {DOMAIN} format
79 80 */
80 -export const createDomainUrlLink = (domainSearchUrl, domain) => {
81 - if (domainSearchUrl.includes('{SLD}') && domainSearchUrl.includes('{TLD}')) {
81 +export const createDomainUrlLink = (
82 + domainSearchUrl,
83 + domain,
84 + host = siteHost(),
85 +) => {
86 + const url = domainSearchUrl.replaceAll('{SITEURL}', host);
87 + if (url.includes('{SLD}') && url.includes('{TLD}')) {
82 88 const parts = domain.toLowerCase().split('.');
83 89 const sld = parts[0];
84 90 const tld = parts.slice(1).join('.');
85 - return domainSearchUrl.replace('{SLD}', sld).replace('{TLD}', `.${tld}`);
91 + return url.replace('{SLD}', sld).replace('{TLD}', `.${tld}`);
86 92 }
87 - return domainSearchUrl.replace('{DOMAIN}', domain.toLowerCase());
93 + return url.replace('{DOMAIN}', domain.toLowerCase());
88 94 };
89 95
90 96 export const deleteDomainCache = () =>
91 97 apiFetch({