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/mautic.corals.io/app/bundles/CoreBundle/EventListener/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/CoreBundle/EventListener/ChannelTrait.php
<?php

namespace Mautic\CoreBundle\EventListener;

use Mautic\CoreBundle\Factory\ModelFactory;

trait ChannelTrait
{
    /**
     * @var ModelFactory<object>
     */
    protected $modelFactory;

    /**
     * @param ModelFactory<object> $modelFactory
     */
    public function setModelFactory(ModelFactory $modelFactory): void
    {
        $this->modelFactory = $modelFactory;
    }

    /**
     * Get the model for a channel.
     *
     * @return mixed
     */
    protected function getChannelModel($channel)
    {
        if ($this->modelFactory->hasModel($channel)) {
            return $this->modelFactory->getModel($channel);
        }

        return false;
    }

    /**
     * Get the entity for a channel item.
     *
     * @return mixed
     */
    protected function getChannelEntity($channel, $channelId)
    {
        $channelEntity = null;
        if ($channelModel = $this->getChannelModel($channel)) {
            try {
                $channelEntity = $channelModel->getEntity($channelId);
            } catch (\Exception) {
                // Not found
            }
        }

        return $channelEntity;
    }

    /**
     * Get the name and/or view URL for a channel entity.
     *
     * @param bool $returnWithViewUrl
     *
     * @return array|bool|string
     */
    protected function getChannelEntityName($channel, $channelId, $returnWithViewUrl = false)
    {
        if ($channelEntity = $this->getChannelEntity($channel, $channelId)) {
            $channelModel = $this->getChannelModel($channel);
            $name         = false;
            if (method_exists($channelEntity, $channelModel->getNameGetter())) {
                $name = $channelEntity->{$channelModel->getNameGetter()}();
            }

            if ($name && $returnWithViewUrl) {
                $url           = null;
                $baseRouteName = str_replace('.', '_', $channel);
                if (method_exists($channelModel, 'getActionRouteBase')) {
                    $baseRouteName = $channelModel->getActionRouteBase();
                }
                $routeSourceName = 'mautic_'.$baseRouteName.'_action';

                if (null !== $this->router->getRouteCollection()->get($routeSourceName)) {
                    $url = $this->router->generate(
                        $routeSourceName,
                        [
                            'objectAction' => 'view',
                            'objectId'     => $channelId,
                        ]
                    );
                }

                return [
                    'name' => $name,
                    'url'  => $url,
                ];
            }

            return $name;
        }

        return false;
    }
}

Spamworldpro Mini