403Webshell
Server IP : 172.67.158.161  /  Your IP : 18.227.183.238
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/loco-translate/src/fs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/loco-translate/src/fs/LocaleFile.php
<?php
/**
 * A file with metadata about the locale it relates to
 */
class Loco_fs_LocaleFile extends Loco_fs_File {
    
    /**
     * @var Loco_Locale|null
     */
    private $locale;
    
    /**
     * @var string
     */
    private $suffix;
    
    /**
     * @var string
     */
    private $prefix;

    /**
     * @var string
     */
    private $hash = '';


    /**
     * Lazy handling of localized path info
     * @return array [ prefix, suffix, hash ]
     */
    public function split(){
        if( is_null($this->suffix) ){
            $parts = explode('-',$this->filename() );
            $this->suffix = array_pop($parts);
            // handle script hashes for JSONs only
            if( 'json' === $this->extension() && preg_match('/^[0-9a-f]{32}$/',$this->suffix) ){
                $this->hash = $this->suffix;
                $this->suffix = array_pop($parts);
            }
            $this->prefix = implode('-',$parts);
            // handle situations where unsuffixed name is wrongly taken as the prefix
            // e.g. "de.po" is valid but "hello.po" is not. 
            // There are still some ambiguous situations, e.g. "foo-bar.po" is valid, but nonsense
            if( ! $this->prefix && ! $this->getLocale()->isValid() ){
                $this->prefix = $this->suffix;
                $this->suffix = '';
                $this->locale = null;
            }
        }
        return [ $this->prefix, $this->suffix, $this->hash ];
    }
    
    
    /**
     * @return Loco_Locale
     */
    public function getLocale(){
        if( ! $this->locale ){
            if( $tag = $this->getSuffix() ){
                $this->locale = Loco_Locale::parse($tag);
            }
            else {
                $this->locale = new Loco_Locale('');
            }
        }
        return $this->locale;
    }


    /**
     * @param $locale Loco_locale
     * @return Loco_fs_LocaleFile
     */
    public function cloneLocale( Loco_locale $locale ){
        $this->split();
        $path = (string) $locale;
        if( $str = $this->prefix ){
            $path = $str.'-'.$path;
        }
        if( $str = $this->extension() ){
            $path .= '.'.$str;
        }
        if( $dir = $this->getParent() ){
            $path = $dir->getPath().'/'.$path;
        }
        return new Loco_fs_LocaleFile($path);
    }


    /**
     * Get prefix (or stem) from name that comes before locale suffix.
     * @return string
     */
    public function getPrefix(){
        $info = $this->split();
        return $info[0];
    }
    

    /**
     * Get suffix (or locale code) from name that comes after "-" separator
     * @return string
     */
    public function getSuffix(){
        $info = $this->split();
        return $info[1];
    }

    /**
     * @return string
     */
    public function getHash(){
        $info = $this->split();
        return $info[2];
    }

    /**
     * Test if file is suffix only, e.g. "en_US.po"
     * @return bool
     */
    public function hasSuffixOnly(){
        $info = $this->split();
        return $info[1] && ! $info[0];
    }


    /**
     * Test if file is prefix only, e.g. "incorrect.po"
     * @return bool
     */
    public function hasPrefixOnly(){
        $info = $this->split();
        return $info[0] && ! $info[1];
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit