| Current Path : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/ |
| Current File : /home/pteabiscqq/www/plugins/system/lab5_cookie_commander/lab5_cookie_commander.php |
<?php
/**
* 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 :
* * 18.08.2020 :
*/
defined('_JEXEC') or die;
////////////////////////////////////////////////////////////////////////////////////////
class PlgSystemLab5_cookie_commander extends JPlugin {
////////////////////////////////////////////////////////////////////////////////////////
static $debug = FALSE; // FALSE true
///////////////////
static $this;
static $xstor;
////////////////////////////////////////////////////////////////////////////
public function __construct(&$subject, $config = array()) {
////////////////////////////////////////////////////////////////////////////
self::$xstor = new StdClass();
self::$this = $this ;
parent::__construct($subject, $config);
/* * * * * * *
Load Language Files ( needed for cookie commander form field translations ) :
* * * * * * */
JFactory::getLanguage()->load( 'plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR );
} //////////////////////////////////////////////////////////////////////////
function onBeforeRender(){
////////////////////////////////////////////////////////////////////////////
if ( !self::_selfcheck()) return ; // stop processing
//////////////////////////////////
// Cookie Commander
//////////////////////////////////
require_once (__DIR__.'/cookie_commander/cookie_commander.php');
} //////////////////////////////////////////////////////////////////////////
public function onContentPrepare($context, &$article, &$params, $page = 0) {
////////////////////////////////////////////////////////////////////////////
} //////////////////////////////////////////////////////////////////////////
function onBeforeCompileHead(){ // buffer already processed
////////////////////////////////////////////////////////////////////////////
} //////////////////////////////////////////////////////////////////////////
function onAfterRender() { // buffer already processed
////////////////////////////////////////////////////////////////////////////
if ( !self::_selfcheck()) return ; // stop processing
//////////////////////////////////
//////////////////////////////////
// Cookie Controlls
//////////////////////////////////
require(__DIR__.'/cookie_commander/embed.bar.php');
require(__DIR__.'/cookie_commander/embed.popup.php');
require(__DIR__.'/cookie_commander/embed.form.php');
//////////////////////////////////
// Analytics ( Google / Piwik )
//////////////////////////////////
require 'analytics/analytics.php';
} //////////////////////////////////////////////////////////////////////////
protected static function _selfcheck( $xthis = false ) {
////////////////////////////////////////////////////////////////////////////
/* * * * * * *
Simple performance checks to determine whether should process further
* * * * * * */
if($xthis) self::$this = $xthis;
if (JFactory::getApplication()->isAdmin()) return false;
if (JFactory::getApplication()->getName() != 'site') return false;
if (!self::$this->params->get('enabled', 1)) return false;
$urlOption = JRequest::getVar('option','none');
$urlTask = JRequest::getVar('task','none');
if(($urlOption == 'com_content') and ($urlTask == 'edit')) return false;
return true;
} //////////////////////////////////////////////////////////////////////////
function permastore_param( $name, $value ){
////////////////////////////////////////////////////////////////////////////
/* * * * * * *
Funktion zum Korrigieren / Migrieren von alten Parametern.
* * * * * * */
$table = new JTableExtension(JFactory::getDbo());
$table->load(array('element' => $this->_name));
$this->params->set($name, $value);
$table->set('params', $this->params->toString());
$table->store(); // Save the change into DB
} //////////////////////////////////////////////////////////////////////////
public static function debug( $info, $level =0, $INFOTEXT = null ){
//////////////////////////////////////////////////////////////////////////////////////////////////
if( self::$debug ){
}
} ////////////////////////////////////////////////////////////////////////////////////////////////
} //////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////