File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,16 +17,25 @@ class Resource {
1717
1818 public function __construct ($ data ) {
1919 $ this ->url = $ data ["url " ];
20- $ this ->isRemote = (boolean ) parse_url ($ this ->url , PHP_URL_HOST );
20+
21+ $ prependScheme = preg_match ("/^\/\// " , $ this ->url );
22+ $ this ->isRemote = $ prependScheme || parse_url ($ this ->url , PHP_URL_HOST );
23+ if ($ prependScheme ) {
24+ $ this ->url = (empty ($ _SERVER ["HTTPS " ]) ? "http: " : "https: " ) . $ this ->url ;
25+ }
2126
2227 if (isset ($ data ["minified " ])) {
2328 $ this ->minified = $ data ["minified " ];
2429 }
2530
2631 if (isset ($ data ["language " ])) {
27- $ this ->language = $ data ["minified " ];
32+ $ this ->language = $ data ["language " ];
2833 } else {
29- $ this ->language = pathinfo ($ this ->url , PATHINFO_EXTENSION );
34+ if ($ this ->isRemote ) {
35+ $ this ->language = pathinfo (parse_url ($ this ->url , PHP_URL_PATH ), PATHINFO_EXTENSION );
36+ } else {
37+ $ this ->language = pathinfo ($ this ->url , PATHINFO_EXTENSION );
38+ }
3039 }
3140 }
3241
You can’t perform that action at this time.
0 commit comments