fix several places where head_add_(css|js) functions have been used incorrectly. It appears that mistakes were made going back a long time and propagated. Here's the way it should work:
- if there is no preceding / character, we look for the file within all the appropriate theme directories. - otherwise the file should have a preceding /, which means use this path relative to the hubzilla basedir - files beginning with // are considered to be schemeless URLs. Therefore 'foo.css' means find the best theme-able representation of foo.css. '/library/foo.css' means only use the version of foo.css that is in /library.
This commit is contained in:
parent
02e487f306
commit
573846707c
@ -296,7 +296,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
||||
));
|
||||
|
||||
if($p['mimeType'] != 'text/bbcode')
|
||||
head_add_js('library/ace/ace.js'); // Ace Code Editor
|
||||
head_add_js('/library/ace/ace.js'); // Ace Code Editor
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ class Theme {
|
||||
$opts .= $schema_str;
|
||||
|
||||
if(file_exists('view/theme/' . $t . '/php/style.php'))
|
||||
return('view/theme/' . $t . '/php/style.pcss' . $opts);
|
||||
return('/view/theme/' . $t . '/php/style.pcss' . $opts);
|
||||
|
||||
return('view/theme/' . $t . '/css/style.css');
|
||||
return('/view/theme/' . $t . '/css/style.css');
|
||||
}
|
||||
|
||||
function debug() {
|
||||
|
9
boot.php
9
boot.php
@ -2225,7 +2225,7 @@ function construct_page(&$a) {
|
||||
// Zotlabs\Render\Theme::debug();
|
||||
|
||||
if (($p = theme_include($current_theme[0] . '.js')) != '')
|
||||
head_add_js($p);
|
||||
head_add_js('/' . $p);
|
||||
|
||||
if (($p = theme_include('mod_' . App::$module . '.php')) != '')
|
||||
require_once($p);
|
||||
@ -2237,10 +2237,13 @@ function construct_page(&$a) {
|
||||
else
|
||||
head_add_css(((x(App::$page, 'template')) ? App::$page['template'] : 'default' ) . '.css');
|
||||
|
||||
head_add_css('mod_' . App::$module . '.css');
|
||||
if (($p = theme_include('mod_' . App::$module . '.css')) != '')
|
||||
head_add_css('mod_' . App::$module . '.css');
|
||||
|
||||
head_add_css(Zotlabs\Render\Theme::url($installing));
|
||||
|
||||
head_add_js('mod_' . App::$module . '.js');
|
||||
if (($p = theme_include('mod_' . App::$module . '.js')) != '')
|
||||
head_add_js('mod_' . App::$module . '.js');
|
||||
|
||||
App::build_pagehead();
|
||||
|
||||
|
@ -598,16 +598,23 @@ function head_get_links() {
|
||||
|
||||
|
||||
function format_css_if_exists($source) {
|
||||
$path_prefix = script_path() . '/';
|
||||
|
||||
if (strpos($source[0], '/') !== false) {
|
||||
// The source is a URL
|
||||
$path = $source[0];
|
||||
// script_path() returns https://yoursite.tld
|
||||
|
||||
$path_prefix = script_path();
|
||||
|
||||
$script = $source[0];
|
||||
|
||||
if(strpos($script, '/') !== false) {
|
||||
// The script is a path relative to the server root
|
||||
$path = $script;
|
||||
// If the url starts with // then it's an absolute URL
|
||||
if($source[0][0] === '/' && $source[0][1] === '/') $path_prefix = '';
|
||||
if(substr($script,0,2) === '//') {
|
||||
$path_prefix = '';
|
||||
}
|
||||
} else {
|
||||
// It's a file from the theme
|
||||
$path = theme_include($source[0]);
|
||||
$path = '/' . theme_include($script);
|
||||
}
|
||||
|
||||
if($path) {
|
||||
@ -697,16 +704,19 @@ function head_get_main_js() {
|
||||
}
|
||||
|
||||
function format_js_if_exists($source) {
|
||||
$path_prefix = script_path() . '/';
|
||||
$path_prefix = script_path();
|
||||
|
||||
if(strpos($source,'/') !== false) {
|
||||
// The source is a URL
|
||||
// The source is a known path on the system
|
||||
$path = $source;
|
||||
// If the url starts with // then it's an absolute URL
|
||||
if($source[0] === '/' && $source[1] === '/') $path_prefix = '';
|
||||
} else {
|
||||
if(substr($source,0,2) === '//') {
|
||||
$path_prefix = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// It's a file from the theme
|
||||
$path = theme_include($source);
|
||||
$path = '/' . theme_include($source);
|
||||
}
|
||||
if($path) {
|
||||
$qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION;
|
||||
|
@ -2,51 +2,45 @@
|
||||
|
||||
require_once('include/plugin.php');
|
||||
|
||||
head_add_css('library/tiptip/tipTip.css');
|
||||
head_add_css('library/jgrowl/jquery.jgrowl.css');
|
||||
head_add_css('library/jRange/jquery.range.css');
|
||||
head_add_css('/library/tiptip/tipTip.css');
|
||||
head_add_css('/library/jgrowl/jquery.jgrowl.css');
|
||||
head_add_css('/library/jRange/jquery.range.css');
|
||||
|
||||
head_add_css('view/css/conversation.css');
|
||||
head_add_css('view/css/widgets.css');
|
||||
head_add_css('view/css/colorbox.css');
|
||||
head_add_css('library/justifiedGallery/justifiedGallery.min.css');
|
||||
head_add_css('library/Text_Highlighter/sample.css');
|
||||
head_add_css('/view/css/conversation.css');
|
||||
head_add_css('/view/css/widgets.css');
|
||||
head_add_css('/view/css/colorbox.css');
|
||||
head_add_css('/library/justifiedGallery/justifiedGallery.min.css');
|
||||
head_add_css('/library/Text_Highlighter/sample.css');
|
||||
|
||||
head_add_js('jquery.js');
|
||||
//head_add_js('jquery.migrate-3.0.0.js');
|
||||
head_add_js('library/justifiedGallery/jquery.justifiedGallery.min.js');
|
||||
head_add_js('library/sprintf.js/dist/sprintf.min.js');
|
||||
head_add_js('/library/justifiedGallery/jquery.justifiedGallery.min.js');
|
||||
head_add_js('/library/sprintf.js/dist/sprintf.min.js');
|
||||
|
||||
//head_add_js('jquery-compat.js');
|
||||
head_add_js('spin.js');
|
||||
head_add_js('jquery.spin.js');
|
||||
head_add_js('jquery.textinputs.js');
|
||||
head_add_js('autocomplete.js');
|
||||
head_add_js('library/jquery-textcomplete/jquery.textcomplete.js');
|
||||
//head_add_js('library/colorbox/jquery.colorbox.js');
|
||||
head_add_js('library/jquery.timeago.js');
|
||||
head_add_js('library/readmore.js/readmore.js');
|
||||
head_add_js('library/sticky-kit/sticky-kit.js');
|
||||
//head_add_js('library/jquery_ac/friendica.complete.js');
|
||||
//head_add_js('library/tiptip/jquery.tipTip.minified.js');
|
||||
head_add_js('library/jgrowl/jquery.jgrowl_minimized.js');
|
||||
//head_add_js('library/tinymce/jscripts/tiny_mce/tiny_mce.js');
|
||||
head_add_js('library/cryptojs/components/core-min.js');
|
||||
head_add_js('library/cryptojs/rollups/aes.js');
|
||||
head_add_js('library/cryptojs/rollups/rabbit.js');
|
||||
head_add_js('library/cryptojs/rollups/tripledes.js');
|
||||
//head_add_js('library/stylish_select/jquery.stylish-select.js');
|
||||
head_add_js('/library/jquery-textcomplete/jquery.textcomplete.js');
|
||||
|
||||
head_add_js('/library/jquery.timeago.js');
|
||||
head_add_js('/library/readmore.js/readmore.js');
|
||||
head_add_js('/library/sticky-kit/sticky-kit.js');
|
||||
head_add_js('/library/jgrowl/jquery.jgrowl_minimized.js');
|
||||
head_add_js('/library/cryptojs/components/core-min.js');
|
||||
head_add_js('/library/cryptojs/rollups/aes.js');
|
||||
head_add_js('/library/cryptojs/rollups/rabbit.js');
|
||||
head_add_js('/library/cryptojs/rollups/tripledes.js');
|
||||
|
||||
head_add_js('acl.js');
|
||||
head_add_js('webtoolkit.base64.js');
|
||||
head_add_js('main.js');
|
||||
head_add_js('crypto.js');
|
||||
head_add_js('library/jRange/jquery.range.js');
|
||||
//head_add_js('docready.js');
|
||||
head_add_js('library/colorbox/jquery.colorbox-min.js');
|
||||
head_add_js('/library/jRange/jquery.range.js');
|
||||
head_add_js('/library/colorbox/jquery.colorbox-min.js');
|
||||
|
||||
head_add_js('library/jquery.AreYouSure/jquery.are-you-sure.js');
|
||||
head_add_js('library/tableofcontents/jquery.toc.js');
|
||||
head_add_js('library/imagesloaded/imagesloaded.pkgd.min.js');
|
||||
head_add_js('/library/jquery.AreYouSure/jquery.are-you-sure.js');
|
||||
head_add_js('/library/tableofcontents/jquery.toc.js');
|
||||
head_add_js('/library/imagesloaded/imagesloaded.pkgd.min.js');
|
||||
/**
|
||||
* Those who require this feature will know what to do with it.
|
||||
* Those who don't, won't.
|
||||
|
@ -1,19 +1,17 @@
|
||||
<?php
|
||||
|
||||
head_add_css('library/font_awesome/css/font-awesome.min.css');
|
||||
head_add_css('library/bootstrap/css/bootstrap.min.css');
|
||||
head_add_css('library/bootstrap-tagsinput/bootstrap-tagsinput.css');
|
||||
head_add_css('view/css/bootstrap-red.css');
|
||||
head_add_css('library/datetimepicker/jquery.datetimepicker.css');
|
||||
//head_add_css('library/colorpicker/css/colorpicker.css');
|
||||
head_add_css('library/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css');
|
||||
head_add_css('/library/font_awesome/css/font-awesome.min.css');
|
||||
head_add_css('/library/bootstrap/css/bootstrap.min.css');
|
||||
head_add_css('/library/bootstrap-tagsinput/bootstrap-tagsinput.css');
|
||||
head_add_css('/view/css/bootstrap-red.css');
|
||||
head_add_css('/library/datetimepicker/jquery.datetimepicker.css');
|
||||
head_add_css('/library/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css');
|
||||
require_once('view/php/theme_init.php');
|
||||
|
||||
head_add_js('library/bootstrap/js/bootstrap.min.js');
|
||||
head_add_js('library/bootbox/bootbox.min.js');
|
||||
head_add_js('library/bootstrap-tagsinput/bootstrap-tagsinput.js');
|
||||
head_add_js('library/datetimepicker/jquery.datetimepicker.js');
|
||||
//head_add_js('library/colorpicker/js/colorpicker.js');
|
||||
head_add_js('library/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js');
|
||||
//head_add_js('library/bootstrap-colorpicker/src/js/docs.js');
|
||||
head_add_js('/library/bootstrap/js/bootstrap.min.js');
|
||||
head_add_js('/library/bootbox/bootbox.min.js');
|
||||
head_add_js('/library/bootstrap-tagsinput/bootstrap-tagsinput.js');
|
||||
head_add_js('/library/datetimepicker/jquery.datetimepicker.js');
|
||||
head_add_js('/library/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js');
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user