always load css and js sources using the same url as the page that is being visited so there is no http/https mismatch.
This commit is contained in:
parent
81cf9209f0
commit
65c0b84313
@ -520,10 +520,32 @@ function format_css_if_exists($source) {
|
|||||||
$path = theme_include($source[0]);
|
$path = theme_include($source[0]);
|
||||||
|
|
||||||
if($path)
|
if($path)
|
||||||
return '<link rel="stylesheet" href="' . z_root() . '/' . $path . '" type="text/css" media="' . $source[1] . '" />' . "\r\n";
|
return '<link rel="stylesheet" href="' . script_path() . '/' . $path . '" type="text/css" media="' . $source[1] . '" />' . "\r\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function script_path() {
|
||||||
|
if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS'])
|
||||||
|
$scheme = 'https';
|
||||||
|
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
|
||||||
|
$scheme = 'https';
|
||||||
|
else
|
||||||
|
$scheme = 'http';
|
||||||
|
|
||||||
|
if(x($_SERVER,'SERVER_NAME')) {
|
||||||
|
$hostname = $_SERVER['SERVER_NAME'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return z_root();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x($_SERVER,'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
|
||||||
|
$hostname .= ':' . $_SERVER['SERVER_PORT'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $scheme . '://' . $hostname;
|
||||||
|
}
|
||||||
|
|
||||||
function head_add_js($src) {
|
function head_add_js($src) {
|
||||||
get_app()->js_sources[] = $src;
|
get_app()->js_sources[] = $src;
|
||||||
}
|
}
|
||||||
@ -552,7 +574,7 @@ function format_js_if_exists($source) {
|
|||||||
else
|
else
|
||||||
$path = theme_include($source);
|
$path = theme_include($source);
|
||||||
if($path)
|
if($path)
|
||||||
return '<script src="' . z_root() . '/' . $path . '" ></script>' . "\r\n" ;
|
return '<script src="' . script_path() . '/' . $path . '" ></script>' . "\r\n" ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user