diff --git a/includes/config.plugin.php b/includes/config.plugin.php index 9b9c95b..4c9ff80 100644 --- a/includes/config.plugin.php +++ b/includes/config.plugin.php @@ -1,7 +1,69 @@ * - */ \ No newline at end of file + */ +if (!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + +$sPluginName = 'phpbo.cookie_consent'; + +function phpboccInjectFrontend($sHtml) { + $sInjection = ''; + $sInjection .= ''. "\n"; + $sInjection .= '' . "\n"; + $sInjection .= '' . "\n"; + $sInjection .= ''; + + + return str_replace('', $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");