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 /** * Copyright Magefan ([email protected]). All rights reserved. * Please visi..

Decoded Output download

<?php
/**
 * Copyright  Magefan ([email protected]). All rights reserved.
 * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
 *
 * Glory to Ukraine! Glory to the heroes!
 */

declare(strict_types=1);

namespace Magefan\HtmlSitemap\Block\Blog;

use Magefan\HtmlSitemap\Block\AbstractBlock;
use Magento\Framework\View\Element\Template;
use Magefan\HtmlSitemap\Model\Config;
use Magento\Framework\DataObject;
use Magefan\HtmlSitemap\Model\BlogFactory;

abstract class AbstractCategories extends AbstractBlock
{
    /**
     * @var BlogFactory
     */
    protected $blogFactory;

    /**
     * @var string
     */
    protected $type = 'blogcategorylinks';

    /**
     * Category constructor.
     * @param Template\Context $context
     * @param Config $config
     * @param BlogFactory $blogFactory
     * @param array $data
     */
    public function __construct(
        Template\Context $context,
        Config $config,
        BlogFactory $blogFactory,
        array $data = []
    ) {
        parent::__construct($context, $config, $data);
        $this->blogFactory = $blogFactory;
    }

    /**
     * @return array|mixed|null
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getCollection()
    {
        $k = 'collection';
        if (!$this->hasData($k)) {
            $items = $this->blogFactory->createCategoryCollection()
                ->addActiveFilter()
                ->addStoreFilter($this->_storeManager->getStore()->getId());
            if ($ignoredLinks = $this->config->getIgnoredLinks()) {
                $items->addFieldToFilter('identifier', ['nin' => $ignoredLinks]);
            }

            $items = $items->addFieldToFilter('mf_exclude_html_sitemap', 0)
                ->setOrder('position')
                ->getTreeOrderedArray();

            if ($pageSize = $this->getPageSize()) {
                $items = array_slice($items, 0, $pageSize);
            }

            foreach ($items as $key => $item) {
                if ($maxDepth = $this->getMaxDepth()) {
                    if ($maxDepth > 0 && $item->getLevel() >= $maxDepth) {
                        unset($items[$key]);
                    }
                }
            }

            $this->setData($k, $items);
        }

        return $this->getData($k);
    }

    /**
     * @return array|mixed|null
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getItems()
    {
        $k = 'items';
        if (null === $this->getData($k)) {
            $items = [];

            $collection = $this->getCollection();

            foreach ($collection as $collectionItem) {
                $item = new DataObject([
                    'url' => $collectionItem->getCategoryUrl(),
                    'name' => $collectionItem->getTitle(),
                    'level' => $collectionItem->getLevel(),
                    'object' => $collectionItem
                ]);
                $items[] = $item;
            }

            $this->setData($k, $items);
        }

        return $this->getData($k);
    }

    /**
     * @return string
     */
    public function getCurrentTypeHtmlSitemapUrl()
    {
        return $this->getUrl('htmlsitemap/blog/categories');
    }

    /**
     * @return int
     */
    protected function getMaxDepth(): int
    {
        return 0;
    }

    /**
     * @return string
     */
    public function toHtml()
    {
        if (!$this->config->isBlogEnabled()) {
            return '';
        }
        return parent::toHtml(); // TODO: Change the autogenerated stub
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * Copyright  Magefan ([email protected]). All rights reserved.
 * Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
 *
 * Glory to Ukraine! Glory to the heroes!
 */

declare(strict_types=1);

namespace Magefan\HtmlSitemap\Block\Blog;

use Magefan\HtmlSitemap\Block\AbstractBlock;
use Magento\Framework\View\Element\Template;
use Magefan\HtmlSitemap\Model\Config;
use Magento\Framework\DataObject;
use Magefan\HtmlSitemap\Model\BlogFactory;

abstract class AbstractCategories extends AbstractBlock
{
    /**
     * @var BlogFactory
     */
    protected $blogFactory;

    /**
     * @var string
     */
    protected $type = 'blogcategorylinks';

    /**
     * Category constructor.
     * @param Template\Context $context
     * @param Config $config
     * @param BlogFactory $blogFactory
     * @param array $data
     */
    public function __construct(
        Template\Context $context,
        Config $config,
        BlogFactory $blogFactory,
        array $data = []
    ) {
        parent::__construct($context, $config, $data);
        $this->blogFactory = $blogFactory;
    }

    /**
     * @return array|mixed|null
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getCollection()
    {
        $k = 'collection';
        if (!$this->hasData($k)) {
            $items = $this->blogFactory->createCategoryCollection()
                ->addActiveFilter()
                ->addStoreFilter($this->_storeManager->getStore()->getId());
            if ($ignoredLinks = $this->config->getIgnoredLinks()) {
                $items->addFieldToFilter('identifier', ['nin' => $ignoredLinks]);
            }

            $items = $items->addFieldToFilter('mf_exclude_html_sitemap', 0)
                ->setOrder('position')
                ->getTreeOrderedArray();

            if ($pageSize = $this->getPageSize()) {
                $items = array_slice($items, 0, $pageSize);
            }

            foreach ($items as $key => $item) {
                if ($maxDepth = $this->getMaxDepth()) {
                    if ($maxDepth > 0 && $item->getLevel() >= $maxDepth) {
                        unset($items[$key]);
                    }
                }
            }

            $this->setData($k, $items);
        }

        return $this->getData($k);
    }

    /**
     * @return array|mixed|null
     * @throws \Magento\Framework\Exception\NoSuchEntityException
     */
    public function getItems()
    {
        $k = 'items';
        if (null === $this->getData($k)) {
            $items = [];

            $collection = $this->getCollection();

            foreach ($collection as $collectionItem) {
                $item = new DataObject([
                    'url' => $collectionItem->getCategoryUrl(),
                    'name' => $collectionItem->getTitle(),
                    'level' => $collectionItem->getLevel(),
                    'object' => $collectionItem
                ]);
                $items[] = $item;
            }

            $this->setData($k, $items);
        }

        return $this->getData($k);
    }

    /**
     * @return string
     */
    public function getCurrentTypeHtmlSitemapUrl()
    {
        return $this->getUrl('htmlsitemap/blog/categories');
    }

    /**
     * @return int
     */
    protected function getMaxDepth(): int
    {
        return 0;
    }

    /**
     * @return string
     */
    public function toHtml()
    {
        if (!$this->config->isBlogEnabled()) {
            return '';
        }
        return parent::toHtml(); // TODO: Change the autogenerated stub
    }
}

Function Calls

None

Variables

None

Stats

MD5 986765738e892cd9105e568b4cebacad
Eval Count 0
Decode Time 88 ms