1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Use Library Manager to handle core libraries.

This commit is contained in:
lonalore
2017-01-26 12:45:45 +01:00
parent 7ef1d13b35
commit 7c0c0cd2f1
160 changed files with 22190 additions and 3024 deletions

View File

@@ -20,7 +20,6 @@
"dependencies": { "dependencies": {
"jquery": "2.x", "jquery": "2.x",
"jquery-once": "2.x", "jquery-once": "2.x",
"bootstrap": "3.x",
"bootstrap-switch": "3.x", "bootstrap-switch": "3.x",
"font-awesome": "4.x" "font-awesome": "4.x"
} }

View File

@@ -189,13 +189,16 @@ if(isset($_POST['updateprefs']))
} }
$core_pref->update($key, $newValue); $core_pref->update($key, $newValue);
/*if($newValue != $core_pref->get($key))
{ // Changed value
$core_pref->set($key, $newValue);
$prefChanges[$key] = $newValue;
}*/
} }
if($core_pref->dataHasChanged())
{
// Need to clear cache in order to refresh library information.
e107::getCache()->clearAll('system');
}
$core_pref->save(false); $core_pref->save(false);
// special case, do session cleanup, logout, redirect to login screen // special case, do session cleanup, logout, redirect to login screen
if($sessionRegenerate) if($sessionRegenerate)
{ {
@@ -1671,67 +1674,51 @@ $text .= "
$text .= " $text .= "
</fieldset>"; </fieldset>";
if(E107_DEBUG_LEVEL > 0)
{
// TODO - remove these old JS settings completely!
// Javascript Control
$text .= " // Javascript Control
$text .= "
<fieldset class='e-hideme' id='core-prefs-javascript'> <fieldset class='e-hideme' id='core-prefs-javascript'>
<legend>".PRFLAN_242."</legend> <legend>" . PRFLAN_242 . "</legend>
<table class='table adminform'> <table class='table adminform'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
<col class='col-control' /> <col class='col-control' />
</colgroup> </colgroup>
<tbody>"; <tbody>";
$js_options = array(
'auto' => PRFLAN_243, // load based on dependency
'admin' => PRFLAN_244, // Always load in admin
'front' => PRFLAN_245, // Always load in front-end
'all' => PRFLAN_246, // Always load in admin and front-end
'none' => PRFLAN_247 // disabled
);
//TODO FIXME
// ie. e107 Core Minimum: JS similar to e107 v1.0 should be loaded "e_js.php" (no framwork dependency)
// with basic functions like SyncWithServerTime() and expandit(), externalLinks() etc.
$js_options = array(
$js_types = array( 'auto' => PRFLAN_243, // load based on dependency
array('id' => 'jquery', 'name'=> 'jQuery (local)'), 'admin' => PRFLAN_244, // Always load in admin
array('id' => 'prototype', 'name'=> 'Prototype (local)'), 'front' => PRFLAN_245, // Always load in front-end
'all' => PRFLAN_246, // Always load in admin and front-end
); 'none' => PRFLAN_247 // disabled
);
//TODO // separate switch for CDN.. or automatic fall-back.
foreach($js_types as $arr)
{
// $k = $arr['path'];
$k = $arr['id'];
$name = $arr['name'];
$text .= "<tr>
<td>".$name."</td>
<td>".$frm->radio("e_jslib_core[{$k}]", $js_options, $pref['e_jslib_core'][$k])."</td>
</tr>";
}
$text .= "
</tbody>
</table>";
if(E107_DEBUG_LEVEL > 0) $js_types = array(
array('id' => 'jquery', 'name' => 'jQuery (local)'),
array('id' => 'prototype', 'name' => 'Prototype (local)'),
);
foreach($js_types as $arr)
{ {
// $k = $arr['path'];
$k = $arr['id'];
$name = $arr['name'];
$text .= "<tr>
<td>" . $name . "</td>
<td>" . $frm->radio("e_jslib_core[{$k}]", $js_options, $pref['e_jslib_core'][$k]) . "</td>
</tr>";
}
$text .= "
$text .= " </tbody>
</table>
<table class='table adminform' style='margin-top: 20px'> <table class='table adminform' style='margin-top: 20px'>
<colgroup> <colgroup>
<col class='col-label' /> <col class='col-label' />
@@ -1742,49 +1729,53 @@ $text .= "
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>".PRFLAN_248."</td> <td>" . PRFLAN_248 . "</td>
<td> <td>
".$frm->radio_switch('e_jslib_nocombine', $pref['e_jslib_nocombine'], LAN_YES, LAN_NO)." " . $frm->radio_switch('e_jslib_nocombine', $pref['e_jslib_nocombine'], LAN_YES, LAN_NO) . "
<div class='smalltext field-help'>".PRFLAN_249."</div> <div class='smalltext field-help'>" . PRFLAN_249 . "</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>".PRFLAN_250."</td> <td>" . PRFLAN_250 . "</td>
<td> <td>
".$frm->radio_switch('e_jslib_gzip', $pref['e_jslib_gzip'], LAN_YES, LAN_NO)." " . $frm->radio_switch('e_jslib_gzip', $pref['e_jslib_gzip'], LAN_YES, LAN_NO) . "
<div class='smalltext field-help'>".PRFLAN_251."</div> <div class='smalltext field-help'>" . PRFLAN_251 . "</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>".PRFLAN_252."</td> <td>" . PRFLAN_252 . "</td>
<td> <td>
".$frm->radio_switch('e_jslib_nocache', $pref['e_jslib_nocache'], LAN_YES, LAN_NO)." " . $frm->radio_switch('e_jslib_nocache', $pref['e_jslib_nocache'], LAN_YES, LAN_NO) . "
<div class='smalltext field-help'>".PRFLAN_251."</div> <div class='smalltext field-help'>" . PRFLAN_251 . "</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>".PRFLAN_253."</td> <td>" . PRFLAN_253 . "</td>
<td> <td>
".$frm->radio_switch('e_jslib_nobcache', $pref['e_jslib_nobcache'], LAN_YES, LAN_NO)." " . $frm->radio_switch('e_jslib_nobcache', $pref['e_jslib_nobcache'], LAN_YES, LAN_NO) . "
<div class='smalltext field-help'>".PRFLAN_251."</div> <div class='smalltext field-help'>" . PRFLAN_251 . "</div>
</td> </td>
</tr> </tr>
"; ";
$text .= "
</tbody></table>";
} $text .= "</tbody></table></fieldset>";
else }
{ else
$text .= "<div>". {
$frm->hidden('e_jslib_nocombine',1). $text .= "<div>";
$frm->hidden('e_jslib_nocache', 1). $text .= $frm->hidden('e_jslib_core[jquery]', 'all');
$frm->hidden('e_jslib_nobcache',1). $text .= $frm->hidden('e_jslib_core[prototype]', 'none');
$frm->hidden('e_jslib_gzip',0). $text .= $frm->hidden('e_jslib_nocombine', 1);
"</div>"; $text .= $frm->hidden('e_jslib_nocache', 1);
$text .= $frm->hidden('e_jslib_nobcache', 1);
$text .= $frm->hidden('e_jslib_gzip', 0);
$text .= "</div>";
}
} /**
* @addtogroup CDN settings
* @{
*/
// [e_LANGUAGEDIR]/[e_LANGUAGE]/lan_library_manager.php // [e_LANGUAGEDIR]/[e_LANGUAGE]/lan_library_manager.php
e107::lan('core', 'library_manager'); e107::lan('core', 'library_manager');
@@ -1795,6 +1786,7 @@ $CDNproviders = array(
); );
$text .= ' $text .= '
<fieldset class="e-hideme" id="core-prefs-javascript">
<h4 class="caption">' . LAN_LIBRARY_MANAGER_30 . '</h4> <h4 class="caption">' . LAN_LIBRARY_MANAGER_30 . '</h4>
<table class="table adminform"> <table class="table adminform">
<colgroup> <colgroup>
@@ -1821,6 +1813,16 @@ $text .= '
// Submit button. // Submit button.
$text .= pref_submit('javascript'); $text .= pref_submit('javascript');
/**
* @} End of "addtogroup CDN settings".
*/
/**
* @addtogroup Third-party libraries
* @{
*/
$text .= '<h4 class="caption">' . LAN_LIBRARY_MANAGER_25 . '</h4>'; $text .= '<h4 class="caption">' . LAN_LIBRARY_MANAGER_25 . '</h4>';
$text .= '<table width="100%" class="table table-striped" cellpadding="0" cellspacing="0">'; $text .= '<table width="100%" class="table table-striped" cellpadding="0" cellspacing="0">';
$text .= '<thead>'; $text .= '<thead>';
@@ -1871,11 +1873,18 @@ if(empty($libraries))
$text .= '</tbody>'; $text .= '</tbody>';
$text .= '</table>'; $text .= '</table>';
$text .= "</fieldset>"; $text .= "</fieldset>";
/**
* @} End of "addtogroup Third-party libraries".
*/
/**
* @addtogroup Advanced Features
* @{
*/
//Advanced Features
$text .= " $text .= "
<fieldset class='e-hideme' id='core-prefs-advanced'> <fieldset class='e-hideme' id='core-prefs-advanced'>
<legend>".PRFLAN_149."</legend> <legend>".PRFLAN_149."</legend>
@@ -1942,7 +1951,9 @@ $text .= "
</fieldset> </fieldset>
"; ";
// END Advanced Features /**
* @} End of "addtogroup Advanced Features".
*/
$text .= " $text .= "
@@ -2004,6 +2015,11 @@ function prefs_adminmenu()
e107::getNav()->admin("Basic ".LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var); e107::getNav()->admin("Basic ".LAN_OPTIONS.'--id--prev_nav', 'core-prefs-main', $var);
} }
/**
* @addtogroup Third-party libraries
* @{
*/
/** /**
* Helper function to get library's name. * Helper function to get library's name.
*/ */
@@ -2110,3 +2126,7 @@ function libraryGetStatus($details)
$text = $details['error']; $text = $details['error'];
return '<span class="text-danger" data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $icon . '</span>'; return '<span class="text-danger" data-toggle="tooltip" data-placement="top" title="' . $text . '">' . $icon . '</span>';
} }
/**
* @} End of "addtogroup Third-party libraries".
*/

View File

@@ -91,7 +91,7 @@
<core name="e_jslib_nocombine">1</core> <core name="e_jslib_nocombine">1</core>
<core name="e_jslib_core"><![CDATA[array ( <core name="e_jslib_core"><![CDATA[array (
'prototype' => 'none', 'prototype' => 'none',
'jquery' => 'auto', 'jquery' => 'all',
)]]></core> )]]></core>
<core name="e_jslib_plugin"><![CDATA[array ()]]></core> <core name="e_jslib_plugin"><![CDATA[array ()]]></core>
<core name="e_jslib_theme"><![CDATA[array ()]]></core> <core name="e_jslib_theme"><![CDATA[array ()]]></core>

View File

@@ -1,5 +1,6 @@
<?php <?php
/*
/**
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2012 e107 Inc (e107.org) * Copyright (C) 2008-2012 e107 Inc (e107.org)
@@ -10,20 +11,18 @@
* $Id$ * $Id$
* *
*/ */
//global $pref, $eplug_admin, $THEME_JSLIB, $THEME_CORE_JSLIB;
/**
* Class e_jsmanager.
*/
class e_jsmanager class e_jsmanager
{ {
/** /**
* Supported Libraries (Front-End) - loaded on demand. * Supported Libraries (Front-End) - loaded on demand.
*/ */
protected $_libraries = array( protected $_libraries = array(
'prototype' => array( 'prototype' => array(), // TODO remove prototype completely.
'prototype/prototype.js' ,
'scriptaculous/scriptaculous.js',
'scriptaculous/effects.js',
'e107.js',
),
'jquery' => array(), 'jquery' => array(),
); );
@@ -233,9 +232,10 @@ class e_jsmanager
$this->setInAdmin(defset('e_ADMIN_AREA', false)); $this->setInAdmin(defset('e_ADMIN_AREA', false));
$minified = deftrue('e_DEBUG') == true ? null : 'minified'; $minified = deftrue('e_DEBUG') == true ? null : 'minified';
$cdn = e107::getPref('e_jslib_cdn', true);
// Use local files. // Use local files.
if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true' || !deftrue('e_CDN',true)) if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true' || !deftrue('e_CDN', $cdn))
{ {
if($this->isInAdmin()) // Admin Area. if($this->isInAdmin()) // Admin Area.
{ {

View File

@@ -494,10 +494,22 @@ class e_library_manager
$properties['info_type'] = 'theme'; $properties['info_type'] = 'theme';
$properties['theme'] = $theme; $properties['theme'] = $theme;
$libraries[$machine_name] = $properties; $libraries[$machine_name] = $properties;
$themes[] = $theme; // This theme has a valid e_library implementation.
if(!in_array($theme, $themes))
{
$themes[] = $theme; // This theme has a valid e_library implementation.
}
} }
} }
} }
if(method_exists($addonClass, 'config_alter'))
{
if(!in_array($theme, $themes))
{
$themes[] = $theme; // This theme has a valid e_library implementation.
}
}
} }
} }
} }
@@ -1156,21 +1168,19 @@ class e_library_manager
{ {
if(defset('e_ADMIN_AREA', false) == true) if(defset('e_ADMIN_AREA', false) == true)
{ {
$coreLibrary = new core_library();
$coreLibs = $coreLibrary->config();
switch($library['machine_name']) switch($library['machine_name'])
{ {
// Force to use 'smoothness' theme for Admin UI. // Force to use default CSS files on Admin UI.
case 'cdn.jquery.ui': case 'cdn.jquery.ui':
$library['files']['css'] = array( case 'jquery.ui':
'themes/smoothness/jquery-ui.css' => array( case 'cdn.bootstrap':
'zone' => 2, case 'bootstrap':
), $coreLib = $coreLibs[$library['machine_name']];
); $library['files']['css'] = $coreLib['files']['css'];
$library['variants']['minified']['files']['css'] = $coreLib['variants']['minified']['files']['css'];
$library['variants']['minified']['files']['css'] = array(
'themes/smoothness/jquery-ui.min.css' => array(
'zone' => 2,
),
);
break; break;
} }
} }
@@ -1186,7 +1196,21 @@ class core_library
{ {
/** /**
* Return information about external libraries. * Provides information about external libraries.
*
* Provides information about:
* - jQuery (CDN).
* - jQuery (local).
* - jQuery Once (CDN)
* - jQuery Once (local)
* - jQuery UI (CDN)
* - jQuery UI (local)
* - Bootstrap (CDN)
* - Bootstrap (local)
* - Bootstrap Editable (CDN)
* - Bootstrap Editable (local)
* - Font-Awesome (CDN)
* - Font-Awesome (local)
*/ */
public function config() public function config()
{ {
@@ -1288,9 +1312,6 @@ class core_library
), ),
), ),
), ),
'dependencies' => array(
'cdn.jquery',
),
// Override library path to CDN. // Override library path to CDN.
'library_path' => 'https://cdn.jsdelivr.net/jquery.once/2.1.2/', 'library_path' => 'https://cdn.jsdelivr.net/jquery.once/2.1.2/',
); );
@@ -1325,9 +1346,6 @@ class core_library
), ),
), ),
), ),
'dependencies' => array(
'jquery',
),
// Override library path. // Override library path.
'library_path' => '{e_WEB}lib/jquery-once/', 'library_path' => '{e_WEB}lib/jquery-once/',
); );
@@ -1372,12 +1390,53 @@ class core_library
), ),
), ),
), ),
'dependencies' => array(
'cdn.jquery',
),
// Override library path to CDN. // Override library path to CDN.
'library_path' => 'https://cdn.jsdelivr.net/jquery.ui/1.11.4/', 'library_path' => 'https://cdn.jsdelivr.net/jquery.ui/1.11.4/',
); );
// jQuery UI (local).
$libraries['jquery.ui'] = array(
'name' => 'jQuery UI (local)',
'vendor_url' => 'https://jqueryui.com/',
'version_arguments' => array(
'file' => 'jquery-ui.js',
'pattern' => '/v(\d\.\d+\.\d+)/',
'lines' => 5,
),
'files' => array(
'js' => array(
'jquery-ui.js' => array(
'zone' => 2,
'type' => 'url',
),
),
'css' => array(
'jquery-ui.css' => array(
'zone' => 2,
),
),
),
'variants' => array(
// All properties defined for 'minified' override top-level properties.
'minified' => array(
'files' => array(
'js' => array(
'jquery-ui.min.js' => array(
'zone' => 2,
'type' => 'url',
),
),
'css' => array(
'jquery-ui.min.css' => array(
'zone' => 2,
),
),
),
),
),
// Override library path.
'library_path' => '{e_WEB}lib/jquery-ui/',
);
// Bootstrap (CDN). // Bootstrap (CDN).
$libraries['cdn.bootstrap'] = array( $libraries['cdn.bootstrap'] = array(
@@ -1419,9 +1478,6 @@ class core_library
), ),
), ),
), ),
'dependencies' => array(
'cdn.jquery',
),
// Override library path to CDN. // Override library path to CDN.
'library_path' => 'https://cdn.jsdelivr.net/bootstrap/3.3.7/', 'library_path' => 'https://cdn.jsdelivr.net/bootstrap/3.3.7/',
); );
@@ -1466,56 +1522,8 @@ class core_library
), ),
), ),
), ),
'dependencies' => array(
'jquery',
),
);
// Bootstrap Editable (Local).
$libraries['bootstrap.editable'] = array(
'name' => 'Bootstrap Editable (Local)',
'vendor_url' => 'https://vitalets.github.io/bootstrap-editable/',
'version_arguments' => array(
'file' => 'js/bootstrap-editable.min.js',
'pattern' => '/v(\d\.\d\.\d+)/',
'lines' => 5,
),
'files' => array(
'js' => array(
'js/bootstrap-editable.js' => array(
'zone' => 2,
'type' => 'url',
),
),
'css' => array(
'css/bootstrap-editable.css' => array(
'zone' => 2,
),
),
),
'variants' => array(
// All properties defined for 'minified' override top-level properties.
'minified' => array(
'files' => array(
'js' => array(
'js/bootstrap-editable.min.js' => array(
'zone' => 2,
'type' => 'url',
),
),
'css' => array(
'css/bootstrap-editable.min.css' => array(
'zone' => 2,
),
),
),
),
),
'dependencies' => array(
'cdn.bootstrap', // FIXME - bootstrap local version?
),
// Override library path. // Override library path.
'library_path' => '{e_WEB}js/bootstrap3-editable/', 'library_path' => '{e_WEB}lib/bootstrap/3.3.7/',
); );
// Bootstrap Editable (CDN). // Bootstrap Editable (CDN).
@@ -1558,13 +1566,54 @@ class core_library
), ),
), ),
), ),
'dependencies' => array(
'cdn.bootstrap',
),
// Override library path to CDN. // Override library path to CDN.
'library_path' => 'https://cdn.jsdelivr.net/bootstrap.editable/1.5.1/', 'library_path' => 'https://cdn.jsdelivr.net/bootstrap.editable/1.5.1/',
); );
// Bootstrap Editable (local).
$libraries['bootstrap.editable'] = array(
'name' => 'Bootstrap Editable (Local)',
'vendor_url' => 'https://vitalets.github.io/bootstrap-editable/',
'version_arguments' => array(
'file' => 'js/bootstrap-editable.min.js',
'pattern' => '/v(\d\.\d\.\d+)/',
'lines' => 5,
),
'files' => array(
'js' => array(
'js/bootstrap-editable.js' => array(
'zone' => 2,
'type' => 'url',
),
),
'css' => array(
'css/bootstrap-editable.css' => array(
'zone' => 2,
),
),
),
'variants' => array(
// All properties defined for 'minified' override top-level properties.
'minified' => array(
'files' => array(
'js' => array(
'js/bootstrap-editable.min.js' => array(
'zone' => 2,
'type' => 'url',
),
),
'css' => array(
'css/bootstrap-editable.min.css' => array(
'zone' => 2,
),
),
),
),
),
// Override library path.
'library_path' => '{e_WEB}js/bootstrap3-editable/',
);
// Font-Awesome (CDN). // Font-Awesome (CDN).
$libraries['cdn.fontawesome'] = array( $libraries['cdn.fontawesome'] = array(
'name' => 'Font-Awesome (CDN)', 'name' => 'Font-Awesome (CDN)',

View File

@@ -6,9 +6,18 @@ define("BOOTSTRAP", 3);
define('FONTAWESOME', 4); define('FONTAWESOME', 4);
$minified = deftrue('e_DEBUG') == true ? null : 'minified'; $minified = deftrue('e_DEBUG') == true ? null : 'minified';
$cdn = e107::getPref('e_jslib_cdn', true);
if($cdn) {
e107::library('load', 'cdn.bootstrap', $minified);
e107::library('load', 'cdn.fontawesome', $minified);
}
else
{
e107::library('load', 'bootstrap', $minified);
e107::library('load', 'fontawesome', $minified);
}
e107::library('load', 'cdn.bootstrap', $minified);
e107::library('load', 'cdn.fontawesome', $minified);
e107::library('load', 'bootstrap.editable', $minified); e107::library('load', 'bootstrap.editable', $minified);
e107::css('theme','css/bootstrap-dark.min.css'); e107::css('theme','css/bootstrap-dark.min.css');

View File

@@ -1,76 +1,54 @@
<?php <?php
/** /**
* Bootstrap 3 Theme for e107 v2.x * @file
* Bootstrap 3 Theme for e107 v2.x.
*/ */
if (!defined('e107_INIT')) { exit; }
define("BOOTSTRAP", 3); if(!defined('e107_INIT'))
define("FONTAWESOME", 4); {
define('VIEWPORT', "width=device-width, initial-scale=1.0"); exit;
}
define("BOOTSTRAP", 3);
define("FONTAWESOME", 4);
define('VIEWPORT', "width=device-width, initial-scale=1.0");
/* @see https://www.cdnperf.com */ $min = deftrue('e_DEBUG') == true ? null : 'minified';
// Warning: Some bootstrap CDNs are not compiled with popup.js $cdn = e107::getPref('e_jslib_cdn', true);
// use https if e107 is using https.
/* if($cdn)
* jsdelivr {
https://cdn.jsdelivr.net/bootstrap/3.3.7/js/bootstrap.min.js e107::library('load', 'cdn.bootstrap', $min);
https://cdn.jsdelivr.net/bootstrap/3.3.7/css/bootstrap-theme.min.css e107::library('load', 'cdn.fontawesome', $min);
https://cdn.jsdelivr.net/bootstrap/3.3.7/css/bootstrap.min.css }
https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css else
https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.css {
e107::library('load', 'bootstrap', $min);
e107::library('load', 'fontawesome', $min);
}
https://cdn.jsdelivr.net/bootswatch/3.3.7/cerulean/bootstrap.min.css // CDN provider for Bootswatch.
$cndPref = e107::pref('theme', 'cdn', 'cdnjs');
$bootswatch = e107::pref('theme', 'bootswatch', false);
cdnjs switch($cndPref)
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js {
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap-theme.css case "jsdelivr":
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap-theme.min.css if($bootswatch)
https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css {
e107::css('url', 'https://cdn.jsdelivr.net/bootswatch/3.3.7/' . $bootswatch . '/bootstrap.min.css');
}
break;
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css case "cdnjs":
default:
*/ if($bootswatch)
$cndPref = e107::pref('theme', 'cdn','cdnjs'); {
$bootswatch = e107::pref('theme', 'bootswatch',false); e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/' . $bootswatch . '/bootstrap.min.css');
}
break;
switch($cndPref) }
{
case "jsdelivr":
e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery', 2);
if($bootswatch)
{
e107::css('url', 'https://cdn.jsdelivr.net/bootswatch/3.3.7/'.$bootswatch.'/bootstrap.min.css');
}
else
{
e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.7/css/bootstrap.min.css');
}
e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css');
break;
case "cdnjs":
default:
e107::js("url", "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js", 'jquery', 2);
if($bootswatch)
{
e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/'.$bootswatch.'/bootstrap.min.css');
}
else
{
e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css');
}
e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css');
}

View File

@@ -18,9 +18,16 @@ class theme_bootstrap3 implements e_theme_config
$theme_pref['bootswatch'] = $_POST['bootswatch']; $theme_pref['bootswatch'] = $_POST['bootswatch'];
$theme_pref['cdn'] = $_POST['cdn']; $theme_pref['cdn'] = $_POST['cdn'];
$pref->set('sitetheme_pref', $theme_pref); $pref->set('sitetheme_pref', $theme_pref);
return $pref->dataHasChanged(); $changed = $pref->dataHasChanged();
if($changed)
{
// Need to clear cache in order to refresh library information.
e107::getCache()->clearAll('system');
}
return $changed;
} }
function config($type='front') function config($type='front')

View File

@@ -0,0 +1,42 @@
<?php
/**
* @file
* Provides information about external libraries.
*/
/**
* Class bootstrap3_library.
*/
class bootstrap3_library
{
/**
* Provides information about external libraries.
*/
function config()
{
$libraries = array();
return $libraries;
}
/**
* Alter the library information before detection and caching takes place.
*/
function config_alter(&$libraries)
{
$bootswatch = e107::pref('theme', 'bootswatch', false);
if($bootswatch)
{
// Disable Bootstrap CSS.
unset($libraries['cdn.bootstrap']['files']['css']);
unset($libraries['cdn.bootstrap']['variants']['minified']['files']['css']);
unset($libraries['bootstrap']['files']['css']);
unset($libraries['bootstrap']['variants']['minified']['files']['css']);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

@@ -0,0 +1,13 @@
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('.././transition.js')
require('.././alert.js')
require('.././button.js')
require('.././carousel.js')
require('.././collapse.js')
require('.././dropdown.js')
require('.././modal.js')
require('.././tooltip.js')
require('.././popover.js')
require('.././scrollspy.js')
require('.././tab.js')
require('.././affix.js')

View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Some files were not shown because too many files have changed in this diff Show More