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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/vendor/kkomelin/laravel-translatable-string-exporter/src/Core/   drwxr-xr-x
Free 13.07 GB of 57.97 GB (22.54%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace KKomelin\TranslatableStringExporter\Core;

use 
Symfony\Component\Finder\SplFileInfo;

class 
CodeParser
{
    
/**
     * Translation function names.
     *
     * @var array
     */
    
protected $functions;

    
/**
     * Base search pattern.
     *
     * @var string
     */
    
protected $basePattern '/([FUNCTIONS])\(\s*([\'"])(?P<string>(?:(?![^\\\]\2).)+.)\2\s*[\),]/u';

    
/**
     * Function-specific search patterns.
     *
     * @var array
     */
    
protected $patterns = [];

    
/**
     * Parser constructor.
     *
     * @return void
     */
    
public function __construct()
    {
        
$this->functions config(
            
'laravel-translatable-string-exporter.functions',
            [
                
'__',
                
'_t',
                
'@lang',
            ]
        );

        foreach (
$this->functions as $key => $value) {
            if (
\is_numeric($key)) {
                
$func $value;
                
$callable null;
            } else {
                
$func $key;
                
$callable $value;
            }

            
$pattern_key str_replace('[FUNCTIONS]'$func$this->basePattern);
            if (
config('laravel-translatable-string-exporter.allow-newlines'false)) {
                
$pattern_key .= 's';
            }

            
$this->patterns[$pattern_key] = $callable;
        }
    }

    
/**
     * Parse a file in order to find translatable strings.
     *
     * @param  \Symfony\Component\Finder\SplFileInfo  $file
     * @return array
     */
    
public function parse(SplFileInfo $file)
    {
        
$strings = [];

        foreach (
$this->patterns as $pattern => $func) {
            
preg_match_all($pattern$file->getContents(), $matches);

            foreach (
$matches['string'] as $string) {
                if (
\is_null($func)) {
                    
$strings[] = $string;
                } elseif (
\is_callable($func)) {
                    
$strings[] = call_user_func($func$string);
                }
            }
        }

        
// Remove duplicates.
        
$strings array_unique($strings);

        return 
$this->clean($strings);
    }

    
/**
     * Provide extra clean up step
     * Used for instances of {{ __('We\'re amazing!') }}
     * Without clean up: We\'re amazing!
     * With clean up: We're amazing!
     *
     * @param array $strings
     * @return array
     */
    
public function clean(array $strings)
    {
        return 
array_map(function ($string) {
            return 
str_replace('\\\'''\''$string);
        }, 
$strings);
    }
}

:: 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.0081 ]--