Commit e0621bbd authored by walper's avatar walper

[FIX] NOT COMPATIBLE WITH TRUNK. Bug 5634. Fixed CDN (both jquery and Google)...

[FIX] NOT COMPATIBLE WITH TRUNK. Bug 5634. Fixed CDN (both jquery and Google) when using javascript minification. Fixed CDN issue when using css minification.
parent ace99ed1
......@@ -81,6 +81,11 @@ class HeaderLib
$this->add_jsfile($file, -1);
return $this;
}
function add_jsfile_cdn($file) {
$this->add_jsfile($file, '-2');
return $this;
}
function add_jsfile($file,$rank=0,$minified=false)
{
......@@ -300,6 +305,13 @@ class HeaderLib
{
global $prefs;
$cdn = array();
if ( isset( $this->jsfiles['-2'] ) ) {
$cdn = $this->jsfiles['-2'];
unset( $this->jsfiles['-2'] );
}
$dependancy = array();
if ( isset( $this->jsfiles[-1] ) ) {
$dependancy = $this->jsfiles[-1];
......@@ -348,6 +360,8 @@ class HeaderLib
return array(
// no minify attempt on cdns
'cdn'=> $cdn,
'dependancy_min'=> $minify_dependancy_ok,
'dependancy_full'=> $minify_dependancy_failed,
// no minify attempt on external stuff
......
......@@ -324,11 +324,12 @@ $headerlib->add_jsfile('lib/tiki-js.js');
// using jquery-migrate-1.2.1.js plugin for tiki 11, still required in tiki 12 LTS to support some 3rd party plugins
if ( isset($prefs['javascript_cdn']) && $prefs['javascript_cdn'] == 'google' ) {
$headerlib->add_jsfile_dependancy("$url_scheme://ajax.googleapis.com/ajax/libs/jquery/$headerlib->jquery_version/jquery.min.js");
$headerlib->add_jsfile_cdn("$url_scheme://ajax.googleapis.com/ajax/libs/jquery/$headerlib->jquery_version/jquery.min.js");
// Goggle does not provide this file via a cdn - load local
$headerlib->add_jsfile_dependancy("vendor/jquery/plugins/migrate-min/jquery-migrate-1.2.1.min.js");
} else if ( isset($prefs['javascript_cdn']) && $prefs['javascript_cdn'] == 'jquery' ) {
$headerlib->add_jsfile_dependancy("//code.jquery.com/jquery-$headerlib->jquery_version.min.js");
$headerlib->add_jsfile_dependancy("//code.jquery.com/jquery-migrate-1.2.1.min.js");
$headerlib->add_jsfile_cdn("$url_scheme://code.jquery.com/jquery-$headerlib->jquery_version.min.js");
$headerlib->add_jsfile_cdn("$url_scheme://code.jquery.com/jquery-migrate-1.2.1.min.js");
} else {
if ( $prefs['tiki_minify_javascript'] === 'y' ) {
$headerlib->add_jsfile_dependancy("vendor/jquery/jquery-min/jquery-$headerlib->jquery_version.min.js");
......@@ -420,9 +421,9 @@ if ( $prefs['feature_ajax'] === 'y' ) {
if ( $prefs['feature_jquery_ui'] == 'y' ) {
if ( isset($prefs['javascript_cdn']) && $prefs['javascript_cdn'] == 'google' ) {
$headerlib->add_jsfile_dependancy("$url_scheme://ajax.googleapis.com/ajax/libs/jqueryui/$headerlib->jqueryui_version/jquery-ui.min.js");
$headerlib->add_jsfile_cdn("$url_scheme://ajax.googleapis.com/ajax/libs/jqueryui/$headerlib->jqueryui_version/jquery-ui.min.js");
} else if ( isset($prefs['javascript_cdn']) && $prefs['javascript_cdn'] == 'jquery' ) {
$headerlib->add_jsfile_dependancy("//code.jquery.com/ui/$headerlib->jqueryui_version/jquery-ui.min.js");
$headerlib->add_jsfile_cdn("$url_scheme://code.jquery.com/ui/$headerlib->jqueryui_version/jquery-ui.min.js");
} else {
if ( $prefs['tiki_minify_javascript'] === 'y' ) {
$headerlib->add_jsfile_dependancy("vendor/jquery/jquery-ui/jquery-ui.min.js");
......@@ -433,7 +434,9 @@ if ( $prefs['feature_jquery_ui'] == 'y' ) {
if ( $prefs['feature_jquery_ui_theme'] !== 'none' ) {
if ( isset($prefs['javascript_cdn']) && $prefs['javascript_cdn'] == 'jquery' ) {
$headerlib->add_cssfile("//code.jquery.com/ui/$headerlib->jqueryui_version/themes/{$prefs['feature_jquery_ui_theme']}/jquery-ui.css");
// cdn for css not working - this is the only css from a cdn anyway - so use local version
//$headerlib->add_cssfile("//code.jquery.com/ui/$headerlib->jqueryui_version/themes/{$prefs['feature_jquery_ui_theme']}/jquery-ui.css");
$headerlib->add_cssfile('vendor/jquery/jquery-ui-themes/themes/' . $prefs['feature_jquery_ui_theme'] . '/jquery-ui.css');
} else {
$headerlib->add_cssfile('vendor/jquery/jquery-ui-themes/themes/' . $prefs['feature_jquery_ui_theme'] . '/jquery-ui.css');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment