Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/app/code/Cnc/CsBlock/Block/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/code/Cnc/CsBlock/Block/Base.php
<?php
/**
 * Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved.
 * https://opensource.org/licenses/OSL-3.0  Open Software License (OSL 3.0)
 * Cnc
 * Radosław Stępień <[email protected]> <[email protected]>
 */
namespace Cnc\CsBlock\Block;

use Aheadworks\Csblock\Block\Csblock;
use Aheadworks\Csblock\Model\CsblockFactory;
use Aheadworks\Csblock\Model\ResourceModel\Content\CollectionFactory as ContentCollectionFactory;
use Aheadworks\Csblock\Model\ResourceModel\Csblock\CollectionFactory as CsBlockCollectionFactory;
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
use Magento\Customer\Model\Session;
use Magento\Framework\Data\Form\FormKey;
use Magento\Framework\Stdlib\DateTime\DateTime;
use Magento\Framework\View\Element\Template\Context;

class Base extends Csblock
{
    const NAME = 'name';
    const CTA_BUTTON_LABEL = 'cta_button_label';
    const CTA_BUTTON_LINK = 'cta_button_link';

    /**
     * @var CategoryCollectionFactory
     */
    protected $categoryCollectionFactory;

    /**
     * @var ProductCollectionFactory
     */
    protected $productCollectionFactory;

    /**
     * Base constructor.
     * @param Context $context
     * @param FormKey $formKey
     * @param CsBlockCollectionFactory $csblockCollectionFactory
     * @param ContentCollectionFactory $contentCollectionFactory
     * @param CsblockFactory $csblockFactory
     * @param Session $customerSession
     * @param DateTime $dateTime
     * @param CategoryCollectionFactory $categoryCollectionFactory
     * @param ProductCollectionFactory $productCollectionFactory
     * @param array $data
     */
    public function __construct(
        Context $context,
        FormKey $formKey,
        CsBlockCollectionFactory $csblockCollectionFactory,
        ContentCollectionFactory $contentCollectionFactory,
        CsblockFactory $csblockFactory,
        Session $customerSession,
        DateTime $dateTime,
        CategoryCollectionFactory $categoryCollectionFactory,
        ProductCollectionFactory $productCollectionFactory,
        array $data = []
    ) {
        parent::__construct(
            $context,
            $formKey,
            $csblockCollectionFactory,
            $contentCollectionFactory,
            $csblockFactory,
            $customerSession,
            $dateTime,
            $data
        );
        $this->categoryCollectionFactory = $categoryCollectionFactory;
        $this->productCollectionFactory = $productCollectionFactory;
    }

    /**
     * @return string
     */
    public function getBlockName()
    {
        return $this->getData(self::NAME);
    }

    /**
     * @return string
     */
    public function getCtaButtonLabel()
    {
        return $this->getData(self::CTA_BUTTON_LABEL);
    }

    /**
     * @return string
     */
    public function getCtaButtonLink()
    {
        $ctaLink = $this->getData(self::CTA_BUTTON_LINK);
        if (strpos($ctaLink, rtrim($this->_urlBuilder->getBaseUrl(), '/')) === false) {
            return
                rtrim($this->_urlBuilder->getBaseUrl(), '/') .
                ((substr($ctaLink, 0, 1) === '/') ? '' : '/') .
                $ctaLink;
        }
        return $this->getData(self::CTA_BUTTON_LINK);
    }

    /**
     * @param $type
     * @param $count
     * @return bool|array
     */
    public function getMultipleFieldsData($type, $count)
    {
        $data = [];
        for ($i = 1; $i <= $count; $i++) {
            $data[$i] = $this->getData($type . $i) ?: '';
        }

        if (empty($data)) {
            return false;
        }

        return $data;
    }
}

Spamworldpro Mini