2022-07-30 20:58:10 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* https://www.d3data.de
|
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace D3\DebugBar\Modules\Core;
|
|
|
|
|
|
|
|
use D3\DebugBar\Application\Component\DebugBarComponent;
|
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
|
|
|
|
|
|
|
class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
|
|
|
{
|
2022-08-01 01:24:44 +02:00
|
|
|
public function __construct()
|
2022-07-30 20:58:10 +02:00
|
|
|
{
|
|
|
|
$this->_d3AddDebugBarComponent();
|
|
|
|
|
2022-08-01 01:24:44 +02:00
|
|
|
parent::__construct();
|
2022-07-30 20:58:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function _d3AddDebugBarComponent(): void
|
|
|
|
{
|
|
|
|
$userComponentNames = Registry::getConfig()->getConfigParam('aUserComponentNames');
|
|
|
|
$d3CmpName = DebugBarComponent::class;
|
|
|
|
$blDontUseCache = 1;
|
|
|
|
|
|
|
|
if (!is_array($userComponentNames)) {
|
|
|
|
$userComponentNames = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!in_array($d3CmpName, array_keys($userComponentNames))) {
|
|
|
|
$userComponentNames[$d3CmpName] = $blDontUseCache;
|
|
|
|
Registry::getConfig()->setConfigParam('aUserComponentNames', $userComponentNames);
|
|
|
|
}
|
|
|
|
}
|
2022-08-01 01:24:44 +02:00
|
|
|
|
|
|
|
public function __destruct()
|
|
|
|
{
|
|
|
|
if (!isAdmin()) {
|
|
|
|
/** @var DebugBarComponent $debugBarComponent */
|
|
|
|
$debugBarComponent = Registry::getConfig()->getActiveView()->getComponent(DebugBarComponent::class);
|
2022-08-01 01:24:44 +02:00
|
|
|
echo $debugBarComponent->getRenderer()->renderHead();
|
2022-08-01 01:24:44 +02:00
|
|
|
$debugBarComponent->addTimelineMessures();
|
2022-08-01 01:24:44 +02:00
|
|
|
echo $debugBarComponent->getRenderer()->render();
|
2022-08-01 01:24:44 +02:00
|
|
|
}
|
|
|
|
}
|
2022-08-01 22:27:28 +02:00
|
|
|
}
|