Файл: system/classes/Lang.php
Строк: 50
<?php
/**
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
 * @link          http://perf-engine.net
 * @package       PerfEngine
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
class Lang
{
    private $data = array();
    private $file;
    private $module;
    
    public function word($key)
    {    
        // $this->load($file);
        if (empty($this->data[$key])) $data = $key;
        else $data = $this->data[$key];
        return $data;
    }
    
    public function __construct($file)
    {
        $this->file = $file;
        
        if(Core::moduleId() !== false && file_exists(ROOT.'/modules/'.Core::moduleId().'/lang/'.Core::language().'/'.$this->file.'.php'))
        {
            $this->data = include(ROOT.'/modules/'.Core::moduleId().'/lang/'.Core::language().'/'.$this->file.'.php');
        }
        elseif(file_exists(SYS.'/lang/'.Core::language().'/'.$this->file.'.php'))
        {
            $this->data = include(SYS.'/lang/'.Core::language().'/'.$this->file.'.php');
        }
        else
        {
            $this->data = include(SYS.'/lang/'.Core::language().'/lang.php');
        }
        
        $this->data += include(SYS.'/lang/'.Core::language().'/lang.php');
    }
}