From 2f46bacded409c86514bc7542a01337c3cbf642a Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Dec 2013 18:29:56 -0800 Subject: head_remove_css, head_remove_js --- include/plugin.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include/plugin.php') diff --git a/include/plugin.php b/include/plugin.php index 5ed2a1736..5ad467f98 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -494,6 +494,15 @@ function head_add_css($src,$media = 'screen') { get_app()->css_sources[] = array($src,$media); } + +function head_remove_css($src,$media = 'screen') { + $a = get_app(); + $index = array_search(array($src,$media),$a->css_sources); + if($index !== false) + unset($a->css_sources[$index]); + +} + function head_get_css() { $str = ''; $sources = get_app()->css_sources; @@ -515,11 +524,18 @@ function format_css_if_exists($source) { } - function head_add_js($src) { get_app()->js_sources[] = $src; } +function head_remove_js($src) { + $a = get_app(); + $index = array_search($src,$a->js_sources); + if($index !== false) + unset($a->js_sources[$index]); + +} + function head_get_js() { $str = ''; $sources = get_app()->js_sources; -- cgit v1.2.3 From 65c0b84313ed3c08e4512968e0030631c55bcbb4 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 12 Dec 2013 18:13:52 -0800 Subject: always load css and js sources using the same url as the page that is being visited so there is no http/https mismatch. --- include/plugin.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'include/plugin.php') diff --git a/include/plugin.php b/include/plugin.php index 5ad467f98..9982a48a2 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -520,10 +520,32 @@ function format_css_if_exists($source) { $path = theme_include($source[0]); if($path) - return '' . "\r\n"; + return '' . "\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) { get_app()->js_sources[] = $src; } @@ -552,7 +574,7 @@ function format_js_if_exists($source) { else $path = theme_include($source); if($path) - return '' . "\r\n" ; + return '' . "\r\n" ; } -- cgit v1.2.3