Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php declare(strict_types=1); namespace Plugin\jtl_startcats; use Illuminate\Suppor..
Decoded Output download
<?php declare(strict_types=1);
namespace Plugin\jtl_startcats;
use Illuminate\Support\Collection;
use JTL\Catalog\Hersteller;
use JTL\Helpers\Manufacturer;
use JTL\DB\ReturnType;
use JTL\Events\Dispatcher;
use JTL\Plugin\Bootstrapper;
use JTL\Shop;
use JTL\Smarty\JTLSmarty;
use stdClass;
/**
* Class Bootstrap
* @package Plugin\jtl_startcats
*/
class Bootstrap extends Bootstrapper
{
/**
* @inheritDoc
*/
public function boot(Dispatcher $dispatcher)
{
parent::boot($dispatcher);
if (!Shop::isFrontend()) {
return;
}
$dispatcher->listen('shop.hook.' . \HOOK_SEITE_PAGE, function () {
if (Shop::getPageType() !== \PAGE_STARTSEITE) {
return;
}
Shop::Smarty()->assign('startManufacturers', $this->getAttributedCategories())
->assign('jtl_fpc_title', $this->getPlugin()->getLocalization()->getTranslation('jtl_startcats_title'));
});
$dispatcher->listen('shop.hook.' . \HOOK_SMARTY_INC, function (array $args) {
$smarty = $args['smarty'];
/** @var JTLSmarty $smarty */
$smarty->assign('boxName_1', $this->getPlugin()->getConfig()->getValue('jtl_startcats_position_1'));
$smarty->assign('boxName_2', $this->getPlugin()->getConfig()->getValue('jtl_startcats_position_2'));
});
}
/**
* @return Hersteller[]
*/
private function getAttributedCategories(): array
{
$cacheID = 'jtl_startcats_category_list_' . Shop::getLanguageID();
$manufacturerIDs = $this->getCache()->get($cacheID);
if ($manufacturerIDs === false) {
$manufacturerIDs = $this->getDB()->query(
"SELECT kHersteller
FROM thersteller
ORDER BY cName",
ReturnType::COLLECTION
)->slice(0, 4)->map(function (stdClass $e) {
return (int)$e->kHersteller;
});
/** @var Collection $manufacturerIDs */
$tags = $manufacturerIDs->map(static function (int $id) {
return \CACHING_GROUP_MANUFACTURER . '_' . $id;
});
$tags[] = \CACHING_GROUP_MANUFACTURER;
$this->getCache()->set($cacheID, $manufacturerIDs, $tags);
}
return $manufacturerIDs->map(function (int $id) {
return new Hersteller($id);
})->all();
}
}
?>
Did this file decode correctly?
Original Code
<?php declare(strict_types=1);
namespace Plugin\jtl_startcats;
use Illuminate\Support\Collection;
use JTL\Catalog\Hersteller;
use JTL\Helpers\Manufacturer;
use JTL\DB\ReturnType;
use JTL\Events\Dispatcher;
use JTL\Plugin\Bootstrapper;
use JTL\Shop;
use JTL\Smarty\JTLSmarty;
use stdClass;
/**
* Class Bootstrap
* @package Plugin\jtl_startcats
*/
class Bootstrap extends Bootstrapper
{
/**
* @inheritDoc
*/
public function boot(Dispatcher $dispatcher)
{
parent::boot($dispatcher);
if (!Shop::isFrontend()) {
return;
}
$dispatcher->listen('shop.hook.' . \HOOK_SEITE_PAGE, function () {
if (Shop::getPageType() !== \PAGE_STARTSEITE) {
return;
}
Shop::Smarty()->assign('startManufacturers', $this->getAttributedCategories())
->assign('jtl_fpc_title', $this->getPlugin()->getLocalization()->getTranslation('jtl_startcats_title'));
});
$dispatcher->listen('shop.hook.' . \HOOK_SMARTY_INC, function (array $args) {
$smarty = $args['smarty'];
/** @var JTLSmarty $smarty */
$smarty->assign('boxName_1', $this->getPlugin()->getConfig()->getValue('jtl_startcats_position_1'));
$smarty->assign('boxName_2', $this->getPlugin()->getConfig()->getValue('jtl_startcats_position_2'));
});
}
/**
* @return Hersteller[]
*/
private function getAttributedCategories(): array
{
$cacheID = 'jtl_startcats_category_list_' . Shop::getLanguageID();
$manufacturerIDs = $this->getCache()->get($cacheID);
if ($manufacturerIDs === false) {
$manufacturerIDs = $this->getDB()->query(
"SELECT kHersteller
FROM thersteller
ORDER BY cName",
ReturnType::COLLECTION
)->slice(0, 4)->map(function (stdClass $e) {
return (int)$e->kHersteller;
});
/** @var Collection $manufacturerIDs */
$tags = $manufacturerIDs->map(static function (int $id) {
return \CACHING_GROUP_MANUFACTURER . '_' . $id;
});
$tags[] = \CACHING_GROUP_MANUFACTURER;
$this->getCache()->set($cacheID, $manufacturerIDs, $tags);
}
return $manufacturerIDs->map(function (int $id) {
return new Hersteller($id);
})->all();
}
}
Function Calls
None |
Stats
MD5 | 9e3bbe6f12fae2a4d5af30fd256027f7 |
Eval Count | 0 |
Decode Time | 35 ms |