Setting 클래스 변경. 해당 클래스에서 한국어명 등을 모두 관리.

- 해당 클래스를 참조하는 코드들 수정
This commit is contained in:
2018-03-25 17:56:07 +09:00
parent b7c03e5554
commit 7a34cc4089
8 changed files with 99 additions and 22 deletions
+10 -5
View File
@@ -8,14 +8,19 @@ if(!defined('ROOT')){
class AppConf{
private static $serverList = null;
/**
* 서버 설정 반환
*
* @return \sammo\Setting[]
*/
public static function getList(){
if(self::$serverList === null){
self::$serverList = [
'che'=>['체', 'white', new Setting(ROOT.'/che')],
'kwe'=>['퀘', 'yellow', new Setting(ROOT.'/kwe')],
'pwe'=>['풰', 'orange', new Setting(ROOT.'/pwe')],
'twe'=>['퉤', 'magenta', new Setting(ROOT.'/twe')],
'hwe'=>['훼', 'red', new Setting(ROOT.'/hwe')]
'che'=>new Setting(ROOT.'/che', '', 'white'),
'kwe'=>new Setting(ROOT.'/kwe', '퀘', 'yellow'),
'pwe'=>new Setting(ROOT.'/pwe', '풰', 'orange'),
'twe'=>new Setting(ROOT.'/twe', '퉤', 'magenta'),
'hwe'=>new Setting(ROOT.'/hwe', '', 'red')
];
}
return self::$serverList;
+34 -2
View File
@@ -4,23 +4,55 @@ namespace sammo;
class Setting {
private $basepath;
private $settingFile;
private $htaccessFile;
private $exist = false;
private $running = false;
public function __construct($basepath = __DIR__.'/../..') {
private $shortName;
private $korName;
private $color;
public function __construct(string $basepath, string $korName, string $color, string $name=null) {
$this->basepath = $basepath;
$this->settingFile = realpath($basepath.'/d_setting/DB.php');
$this->htaccessFile = realpath($basepath.'/.htaccess');
$this->korName = $korName;
$this->color = $color;
if($name){
$this->shortName = $name;
}
else{
$this->shortName = basename($this->basepath);
}
if(file_exists($this->settingFile)) {
$this->exist = true;
if(!file_exists($this->htaccessFile)){
$this->running = true;
}
}
}
public function isRunning(){
return $this->running;
}
public function isExists() {
return $this->exist;
}
public function getShortName(){
return basename($this->basepath);
return $this->shortName;
}
public function getColor(){
return $this->color;
}
public function getKorName(){
return $this->korName;
}
public function getBasePath(){