<?php
/*
* OIDplus 2.0
* Copyright 2019 Daniel Marschall, ViaThinkSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use MatthiasMullie\Minify;
require_once __DIR__ . '/3p/minify/src/Minify.php';
require_once __DIR__ . '/3p/minify/src/JS.php';
require_once __DIR__ . '/3p/minify/src/Exception.php';
if (file_exists(__DIR__
. '/includes/config.inc.php')) {
include_once __DIR__ . '/includes/config.inc.php';
}
$files[] = __DIR__ . '/3p/jquery/jquery-2.2.1.min.js'; // We are using jQuery 2.2.1, because 3.3.1 seems to be incompatible with jsTree (HTML content will not be loaded into jsTree!) TODO: File bug report
$files[] = __DIR__ . '/3p/bootstrap/js/bootstrap.min.js';
$files[] = __DIR__ . '/3p/jstree/jstree.min.js';
$files[] = __DIR__ . '/3p/tinymce/tinymce.min.js';
$files[] = __DIR__ . '/3p/jquery-ui/jquery-ui.min.js';
$files[] = __DIR__ . '/3p/layout/jquery.layout.min.js';
$files[] = __DIR__ . '/3p/spamspan/spamspan.js';
$files[] = __DIR__ . '/3p/bignumber.js/bignumber.min.js';
$files[] = __DIR__ . '/3p/sha3_js/sha3.js'; // https://github.com/emn178/js-sha3
$files[] = __DIR__ . '/oidplus_base.js';
$ary = glob(__DIR__
. '/plugins/publicPages/'.'*'.'/script.js');
$ary = glob(__DIR__
. '/plugins/adminPages/'.'*'.'/script.js');
$ary = glob(__DIR__
. '/plugins/raPages/'.'*'.'/script.js');
# ---
$minifier = null;
foreach ($files as $file) {
$minifier = new Minify\JS($file);
} else {
$minifier->add($file);
}
}
if (defined('RECAPTCHA_ENABLED') && RECAPTCHA_ENABLED
) {
$minifier->add('oidplus_external_recaptcha();');
}
if (!defined('DISABLE_MSIE_COMPAT') || !DISABLE_MSIE_COMPAT
) {
$minifier->add('oidplus_external_polyfill();');
}
$out = $minifier->minify();
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) {
header("HTTP/1.1 304 Not Modified");
} else {
header('Content-Type:application/javascript');
echo $out;
}