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/Twig/Extension/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Twig/Extension/ContentExtension.php
<?php

declare(strict_types=1);

namespace Mautic\CoreBundle\Twig\Extension;

use Mautic\CoreBundle\Twig\Helper\ContentHelper;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class ContentExtension extends AbstractExtension
{
    public function __construct(
        protected ContentHelper $contentHelper
    ) {
    }

    public function getFunctions()
    {
        return [
            new TwigFunction('customContent', [$this, 'getCustomContent'], ['is_safe' => ['all']]),
            new TwigFunction('showScriptTags', [$this, 'showScriptTags'], ['is_safe' => ['all']]),
            new TwigFunction('getSortedEditorFonts', [$this, 'sortEditorFonts']),
        ];
    }

    /**
     * Dispatch an event to collect custom content.
     *
     * @param ?mixed              $context  Context of the content requested for the viewName
     * @param array<string,mixed> $vars     twig vars
     * @param ?string             $viewName The main identifier for the content requested. Will be etracted from $vars if get_defined
     */
    public function getCustomContent($context = null, array $vars = [], ?string $viewName = null): string
    {
        return $this->contentHelper->getCustomContent($context, $vars, $viewName);
    }

    /**
     * Replaces HTML script tags with non HTML tags so the JS inside them won't
     * execute and will be readable.
     */
    public function showScriptTags(string $html): string
    {
        return $this->contentHelper->showScriptTags($html);
    }

    /**
     * @param array<mixed> $fonts
     *
     * @return array<mixed>
     */
    public function sortEditorFonts(array $fonts): array
    {
        usort($fonts, static function ($fontA, $fontB): int {
            $fontAName = $fontA['name'] ?? '';
            $fontBName = $fontB['name'] ?? '';

            return strcasecmp($fontAName, $fontBName);
        });

        return $fonts;
    }
}

Spamworldpro Mini