PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.7.5
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.7.5
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/Utils/Helper.php +21 -0 3.7.23.7.5 View file →
@@ -114,8 +114,29 @@
114 114 }
115 115 }
116 116
117 117 /**
118 + * A URL on the public Templately website, honouring the dev domain.
119 + *
120 + * The PHP counterpart of `react-src/utils/helper.js#webURL`. A hard-coded
121 + * `https://templately.com/...` sends a site running against the dev API to
122 + * the live site, where its account does not exist — so build every out-link
123 + * through this instead.
124 + *
125 + * Note this is the *website*, not the API host `get_api_url()` builds.
126 + *
127 + * @param string $path Path with or without a leading slash.
128 + * @param array $args Query args (utm_* etc).
129 + * @return string
130 + */
131 + public static function web_url( string $path = '', array $args = [] ): string {
132 + $base_url = self::is_dev_api() ? 'https://templately.dev' : 'https://templately.com';
133 + $url = $base_url . '/' . ltrim( $path, '/' );
134 +
135 + return empty( $args ) ? $url : add_query_arg( $args, $url );
136 + }
137 +
138 + /**
118 139 * Get API URL for Templately endpoints
119 140 *
120 141 * @param string $endpoint API endpoint path (e.g., 'v2/import/pack/123')
121 142 * @return string Complete API URL