public function isValidUrl($path) { if (Str::startsWith($path, ['#', '//', 'mailto:', 'tel:', 'http://', 'https://'])) { return true; } return filter_var($path, FILTER_VALIDATE_URL) !== false; }
/** * Do a few checks to get the theme path for a given asset url. * * @param string $url * @return string */ protected function assetUrl($url) { if ($this->url->isValidUrl($url)) { return $url; } $theme = StylistFacade::current(); if ($theme) { $themePath = $theme->getAssetPath(); $url = "themes/{$themePath}/{$url}"; } return $url; }