Template: Integrate compression on included .js and .css files, fix custom_css template variable.

This commit is contained in:
Nate 2020-03-19 21:11:53 -06:00
parent 8b2b284041
commit 92719e0399
15 changed files with 148 additions and 21 deletions

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap-colorpicker.min.css';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap-tempusdominus.min.css';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap.min.css';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap-colorpicker.min.js';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap-pwstrength.min.js';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap-tempusdominus.min.js';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'bootstrap.min.js';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'all.min.css';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'solid.min.js';
?>

View File

@ -99,6 +99,7 @@
switch($subcategory) {
//exceptions
case 'favicon':
case 'custom_css':
if ($setting['text'] != '') {
$tmp_url = parse_url($setting['text']);
$tmp_path = pathinfo($setting['text']);

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'jquery.autosize.input.js';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'jquery-3.4.1.min.js';
?>

View File

@ -0,0 +1,10 @@
<?php
ob_start('ob_gzhandler');
header('Content-type: text/javascript; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
include_once 'moment-with-locales.min.js';
?>

View File

@ -3,7 +3,10 @@
require_once "root.php";
require_once "resources/require.php";
header("Content-type: text/css; charset: UTF-8");
ob_start('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
//parse fonts (add surrounding single quotes to each font name)
if (is_array($_SESSION['theme']) && sizeof($_SESSION['theme']) > 0) {
@ -2667,3 +2670,13 @@ header("Content-type: text/css; charset: UTF-8");
text-align: left;
margin-bottom: 20px;
}
<?php
//output custom css
if ($_SESSION['theme']['custom_css_code']['text'] != '') {
echo $_SESSION['theme']['custom_css_code']['text'];
}
?>

View File

@ -15,22 +15,15 @@
<meta name='viewport' content='width=device-width, initial-scale=1'>
{*//external css files *}
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap.min.css'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap-tempusdominus.css'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap-colorpicker.min.css'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/fontawesome/css/all.css'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap.min.css.php'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap-tempusdominus.min.css.php'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/bootstrap/css/bootstrap-colorpicker.min.css.php'>
<link rel='stylesheet' type='text/css' href='{$project_path}/resources/fontawesome/css/all.min.css.php'>
<link rel='stylesheet' type='text/css' href='{$project_path}/themes/default/css.php'>
{*//link to custom css file *}
{if $settings.theme.custom_css}
<link rel='stylesheet' type='text/css' href='$settings.theme.custom_css'>
{/if}
{*//output custom css *}
{if $settings.theme.custom_css_code}
<style>
$settings.theme.custom_css_code
</style>
<link rel='stylesheet' type='text/css' href='{$settings.theme.custom_css}'>
{/if}
{*//set favorite icon *}
@ -40,15 +33,15 @@
<title>{$document_title}</title>
{*//remote javascript *}
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery-3.4.1.min.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.autosize.input.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/momentjs/moment-with-locales.min.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap.min.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-tempusdominus.min.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-colorpicker.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-pwstrength.min.js'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.min.js.php'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/jquery/jquery.autosize.input.js.php'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/momentjs/moment-with-locales.min.js.php'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap.min.js.php'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-tempusdominus.min.js.php'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-colorpicker.min.js.php'></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/bootstrap/js/bootstrap-pwstrength.min.js.php'></script>
<script language='JavaScript' type='text/javascript'>{literal}window.FontAwesomeConfig = { autoReplaceSvg: false }{/literal}</script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/fontawesome/js/all.js' defer></script>
<script language='JavaScript' type='text/javascript' src='{$project_path}/resources/fontawesome/js/solid.min.js.php' defer></script>
{*//web font loader *}
{if $settings.theme.font_loader == 'true'}