add css and js file serving
Dieser Commit ist enthalten in:
Ursprung
dae36da7a0
Commit
fc7687c076
1 geänderte Dateien mit 63 neuen und 1 gelöschten Zeilen
|
@ -1,7 +1,69 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* config file for cookie consent manager
|
||||
*
|
||||
* @author Ortwin Pinke <ortwin.pinke@php-backoffice.de>
|
||||
*
|
||||
*/
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
$sPluginName = 'phpbo.cookie_consent';
|
||||
|
||||
function phpboccInjectFrontend($sHtml) {
|
||||
$sInjection = '';
|
||||
$sInjection .= '<link rel="stylesheet" href="front_content.php?phpboccGetCss=klaro.css" />'. "\n";
|
||||
$sInjection .= '<script type="text/javascript" src="front_content.php?phpboccGetJs=config.js"></script>' . "\n";
|
||||
$sInjection .= '<script type="text/javascript" src="front_content.php?phpboccGetJs=klaro.js"></script>' . "\n";
|
||||
$sInjection .= '</body>';
|
||||
|
||||
|
||||
return str_replace('</body>', $sInjection, $sHtml);
|
||||
}
|
||||
|
||||
function phpboccGetJs() {
|
||||
if (isset($_GET['phpboccGetJs'])) {
|
||||
$sFileContent = '';
|
||||
ob_end_clean();
|
||||
header("Content-Type: application/javascript");
|
||||
header("Cache-Control: max-age=604800, public");
|
||||
|
||||
switch ($_GET['phpboccGetJs']) {
|
||||
case 'config.js':
|
||||
$sFileContent = file_get_contents(dirname(__FILE__, 2).'/external/klaro/config.js');
|
||||
break;
|
||||
case 'klaro.js':
|
||||
$sFileContent = file_get_contents(dirname(__FILE__, 2).'/external/klaro/klaro.js');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
echo $sFileContent;
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
function phpboccGetCss() {
|
||||
if (isset($_GET['phpboccGetCss'])) {
|
||||
$sFileContent = '';
|
||||
ob_end_clean();
|
||||
header("Content-type: text/css; charset: UTF-8");
|
||||
header("Cache-Control: max-age=604800, public");
|
||||
|
||||
switch ($_GET['phpboccGetCss']) {
|
||||
case 'klaro.css':
|
||||
$sFileContent = file_get_contents(dirname(__FILE__, 2).'/external/klaro/klaro.css');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
echo $sFileContent;
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
$_cecRegistry->addChainFunction("Contenido.Frontend.HTMLCodeOutput", "phpboccInjectFrontend");
|
||||
$_cecRegistry->addChainFunction("Contenido.Frontend.AfterLoadPlugins", "phpboccGetJs");
|
||||
$_cecRegistry->addChainFunction("Contenido.Frontend.AfterLoadPlugins", "phpboccGetCss");
|
||||
|
|
Laden …
In neuem Issue referenzieren