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/vendor/mageworx/module-xmlsitemap/Model/Generator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/mageworx/module-xmlsitemap/Model/Generator/AdditionalLinks.php
<?php
/**
 * Copyright © MageWorx. All rights reserved.
 * See LICENSE.txt for license details.
 */

namespace MageWorx\XmlSitemap\Model\Generator;

use Magento\Framework\ObjectManagerInterface;
use MageWorx\XmlSitemap\Helper\Data as Helper;
use MageWorx\XmlSitemap\Model\Generator;

/**
 * {@inheritdoc}
 */
class AdditionalLinks extends AbstractGenerator
{
    /**
     * AdditionalLinks constructor.
     *
     * @param Helper $helper
     * @param ObjectManagerInterface $objectManager
     */
    public function __construct(
        Helper $helper,
        ObjectManagerInterface $objectManager

    ) {
        $this->code = 'additional_link';
        $this->name = __('Additional links');
        parent::__construct($helper, $objectManager);
    }

    /**
     * @param int $storeId
     * @param Generator $writer
     * @param bool|null $usePubInMediaUrls
     */
    public function generate($storeId, $writer, $usePubInMediaUrls = null)
    {
        if ($this->helper->isShowLinks($storeId)) {
            $this->storeId = $storeId;
            $this->helper->init($this->storeId);
            $this->storeBaseUrl = $writer->storeBaseUrl;
            $collection         = $this->helper->getAdditionalLinkCollection();
            $this->counter      = count($collection);
            $changefreq         = $this->helper->getAdditionalLinkChangefreq();
            $priority           = $this->helper->getAdditionalLinkPriority();

            if (count($collection)) {
                foreach ($collection as $item) {
                    $url     = $this->helper->trailingSlash($this->convertAdditionalPageUrl($item->getUrl()));
                    $lastmod = $this->helper->getCurrentDate();
                    $writer->write($url, $lastmod, $changefreq, $priority);
                }
            }
            unset($collection);
        }
    }

    /**
     * Retrieve URL
     *
     * @param string $url
     * @return string
     */
    protected function convertAdditionalPageUrl($url)
    {
        if (strpos($url, '://') !== false) {
            return $url;
        }

        return $this->storeBaseUrl . ltrim($url, '/');
    }
}

Spamworldpro Mini