| Current Path : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/cookie_commander/ |
| Current File : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/cookie_commander/embed.form.php |
<?php defined('_JEXEC') or die();
/////////////////////////////////////////////////////////////////////////////////////////////
/**
* Cookie Commander
*
* @author : Lab5 - Dennis Riegelsberger
* @authorUrl : https://lab5.ch
* @copyright : Copyright (C) 2018+ Lab5 - Dennis Riegelsberger. All rights reserved.
* @license : GNU/GPL General Public License version 2 or later
* @project : https://lab5.ch/cookie-commander
* @on JED : https://extensions.joomla.org/extensions/extension/site-management/cookie-control/lab5-cookie-commander/
*
* Built with <3
* Lab5
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @CHANGELOG :
* * 2020.08.10 : Great overhaul
*/
/////////////////////////////////////////////////////////////////////////////////////////////
if ( self::$this->params->get('cw_on', false )) :
if( in_array( JFactory::getDocument()->_type, ["html","error"] ) ) {
/////////////////////////////////////////////////////////////////////////////////////////////
$processfnc = function(){ // Anon function -> variable scope cleanliness
$content = JResponse::getBody();
/////////////////////////////////////////////////////////////////////////////////////////////
if ( stripos($content, 'lab5_cookies_and_consent') !== false OR
stripos($content, 'lab5_cookie_commander') !== false) {
/////////////////////////////////////////////////////////////////////////////////////////////
$regex = '/{lab5_cookies_and_consent}|{lab5_cookie_commander}/i'; // Expression to search for (positions)
// $regex = '/{lab5_cookies_and_consent}/i'; // Expression to search for (positions)
$popupHTML = false;
// Find all instances of plugin and put in $matches for lab5_cookie_commander
// $matches[0] is full pattern match, $matches[1] is the position
preg_match_all($regex, $content, $matches, PREG_SET_ORDER);
////////////////////////////////////////////////
// No matches, skip this
if ($matches) {
foreach ($matches as $match) {
////////////////////////////////////////////////
$infostring = trim($match[0]);
require('load_popup.php');
$popupHTML =
'<div class="cooco_embed_wrapper">'.
'<div class="embed-header">' .
'<h3 >'. $popup_header . '</h3>' .
'</div>' .
'<div class="embed-body">' .
$popup_body .
'</div>' .
'<div class="embed-footer">' .
$popup_footer_embed .
'</div>' .
'</div>' ;
$popupHTML = str_replace( "{popup_html}", $popupHTML, $popup_form );
// echo "\n<br>EEEEEEEEEEE <br>\n";
// die( $popupHTML );
// echo "\n<br>EEEEEEEEEEE <br>\n";
if($popupHTML){
// $content = preg_replace('/'.$infostring.'/', $popupHTML, $content, 1);
$content = str_replace($infostring, $popupHTML, $content);
}
////////////////////////////////////////////////
}
}
} ///////////////////////////////////////////////////////////////////////////////////////////
JResponse::setBody($content);
}; $processfnc();
} ///////////////////////////////////////////////////////////////////////////////////////////
endif;