diff options
author | redmatrix <git@macgirvin.com> | 2016-06-26 20:17:12 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-26 20:17:12 -0700 |
commit | 900d8f3b0a1711bc9ffecca6f0006a7392075d6d (patch) | |
tree | 7b6e8311cee33252577cd31f0bcc5b5a4eb7807e /include/plugin.php | |
parent | e2de2f65d5f434f800ac9fb6b824f9cbb5f860e8 (diff) | |
parent | dac3138fd1aa5e60f68c6b0ef59cbbc550d22def (diff) | |
download | volse-hubzilla-900d8f3b0a1711bc9ffecca6f0006a7392075d6d.tar.gz volse-hubzilla-900d8f3b0a1711bc9ffecca6f0006a7392075d6d.tar.bz2 volse-hubzilla-900d8f3b0a1711bc9ffecca6f0006a7392075d6d.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'include/plugin.php')
-rwxr-xr-x | include/plugin.php | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/include/plugin.php b/include/plugin.php index c95f8cbf9..6dfda1cc9 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -551,15 +551,21 @@ function head_get_css() { } function format_css_if_exists($source) { - if (strpos($source[0], '/') !== false) + $path_prefix = script_path() . '/'; + + if (strpos($source[0], '/') !== false) { + // The source is a URL $path = $source[0]; - else + // If the url starts with // then it's an absolute URL + if($source[0][0] === '/' && $source[0][1] === '/') $path_prefix = ''; + } else { + // It's a file from the theme $path = theme_include($source[0]); + } if($path) { - $path = script_path() . '/' . $path; $qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION; - return '<link rel="stylesheet" href="' . $path . $qstring . '" type="text/css" media="' . $source[1] . '">' . "\r\n"; + return '<link rel="stylesheet" href="' . $path_prefix . $path . $qstring . '" type="text/css" media="' . $source[1] . '">' . "\r\n"; } } @@ -643,14 +649,20 @@ function head_get_main_js() { } function format_js_if_exists($source) { - if(strpos($source,'/') !== false) + $path_prefix = script_path() . '/'; + + if(strpos($source,'/') !== false) { + // The source is a URL $path = $source; - else + // If the url starts with // then it's an absolute URL + if($source[0] === '/' && $source[1] === '/') $path_prefix = ''; + } else { + // It's a file from the theme $path = theme_include($source); + } if($path) { - $path = script_path() . '/' . $path; $qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION; - return '<script src="' . $path . $qstring . '" ></script>' . "\r\n" ; + return '<script src="' . $path_prefix . $path . $qstring . '" ></script>' . "\r\n" ; } } |