$21 GRAYBYTE WORDPRESS FILE MANAGER $60

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/php54/usr/share/pear/Symfony/Component/Translation/Loader/

HOME
Current File : /opt/alt/php54/usr/share/pear/Symfony/Component/Translation/Loader//CsvFileLoader.php
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * 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;

/**
 * CsvFileLoader loads translations from CSV files.
 *
 * @author Saša Stamenković <[email protected]>
 *
 * @api
 */
class CsvFileLoader extends ArrayLoader implements LoaderInterface
{
    private $delimiter = ';';
    private $enclosure = '"';
    private $escape    = '\\';

    /**
     * {@inheritdoc}
     *
     * @api
     */
    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 = array();

        try {
            $file = new \SplFileObject($resource, 'rb');
        } catch (\RuntimeException $e) {
            throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e);
        }

        $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY);
        $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);

        foreach ($file as $data) {
            if (substr($data[0], 0, 1) === '#') {
                continue;
            }

            if (!isset($data[1])) {
                continue;
            }

            if (count($data) == 2) {
                $messages[$data[0]] = $data[1];
            } else {
                 continue;
            }
        }

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

        return $catalogue;
    }

    /**
     * Sets the delimiter, enclosure, and escape character for CSV.
     *
     * @param string $delimiter delimiter character
     * @param string $enclosure enclosure character
     * @param string $escape    escape character
     */
    public function setCsvControl($delimiter = ';', $enclosure = '"', $escape = '\\')
    {
        $this->delimiter = $delimiter;
        $this->enclosure = $enclosure;
        $this->escape    = $escape;
    }
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.54 PM
root / root
0755
schema
--
3 Mar 2024 10.54 PM
root / root
0755
ArrayLoader.php
1.902 KB
18 Dec 2019 11.22 AM
root / root
0644
CsvFileLoader.php
2.533 KB
18 Dec 2019 11.22 AM
root / root
0644
IcuDatFileLoader.php
1.64 KB
18 Dec 2019 11.22 AM
root / root
0644
IcuResFileLoader.php
2.619 KB
18 Dec 2019 11.22 AM
root / root
0644
IniFileLoader.php
1.231 KB
18 Dec 2019 11.22 AM
root / root
0644
JsonFileLoader.php
2.364 KB
18 Dec 2019 11.22 AM
root / root
0644
LoaderInterface.php
1.113 KB
18 Dec 2019 11.22 AM
root / root
0644
MoFileLoader.php
5.718 KB
18 Dec 2019 11.22 AM
root / root
0644
PhpFileLoader.php
1.308 KB
18 Dec 2019 11.22 AM
root / root
0644
PoFileLoader.php
5.994 KB
18 Dec 2019 11.22 AM
root / root
0644
QtFileLoader.php
2.488 KB
18 Dec 2019 11.22 AM
root / root
0644
XliffFileLoader.php
5.064 KB
18 Dec 2019 11.22 AM
root / root
0644
YamlFileLoader.php
1.954 KB
18 Dec 2019 11.22 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF