1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112:
<?php
class LangConfiguration
{
private $name;
private $author_name;
private $author_mail;
private $author_link;
private $date;
private $version;
private $compatibility;
private $identifier;
private $picture_url;
public function __construct($config_ini_file)
{
$this->load_configuration($config_ini_file);
}
public function get_name()
{
return $this->name;
}
public function get_author_name()
{
return $this->author_name;
}
public function get_author_mail()
{
return $this->author_mail;
}
public function get_author_link()
{
return $this->author_link;
}
public function get_date()
{
return $this->date;
}
public function get_version()
{
return $this->version;
}
public function get_compatibility()
{
return $this->compatibility;
}
public function get_identifier()
{
return $this->identifier;
}
public function get_picture_url()
{
return $this->picture_url;
}
public function has_picture()
{
$picture = $this->picture_url->rel();
return !empty($picture);
}
private function load_configuration($config_ini_file)
{
$config = @parse_ini_file($config_ini_file);
$this->check_parse_ini_file($config, $config_ini_file);
$this->name = $config['name'];
$this->author_name = $config['author'];
$this->author_mail = $config['author_mail'];
$this->author_link = $config['author_link'];
$this->date = $config['date'];
$this->version = $config['version'];
$this->compatibility = $config['compatibility'];
$this->identifier = $config['identifier'];
$url = '/images/stats/countries/' . $this->identifier . '.png';
$picture = new File(PATH_TO_ROOT . $url);
if (!$picture->exists())
$url = '';
$this->picture_url = new Url($url);
}
private function check_parse_ini_file($parse_result, $ini_file)
{
if ($parse_result === false)
{
throw new IOException('Parse ini file "' . $ini_file . '" failed');
}
}
}
?>