1
0
mirror of https://github.com/e107inc/e107.git synced 2025-09-02 19:02: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

@@ -6,9 +6,18 @@ define("BOOTSTRAP", 3);
define('FONTAWESOME', 4);
$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::css('theme','css/bootstrap-dark.min.css');

View File

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

View File

@@ -18,9 +18,16 @@ class theme_bootstrap3 implements e_theme_config
$theme_pref['bootswatch'] = $_POST['bootswatch'];
$theme_pref['cdn'] = $_POST['cdn'];
$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')

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']);
}
}
}