-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
245 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
class Config { | ||
public $display_offline_message = '1'; | ||
public $offline = '1'; //2 | ||
public $offline_message = 'hej'; //nej | ||
public $offline_message2 = 'hej'; //nej | ||
|
||
//addclass | ||
} | ||
|
||
|
||
$display_offline_message = "1"; | ||
$offline = "1"; //2 | ||
$offline_message = "hej"; //nej | ||
$offline_message2 = "hej"; //nej | ||
|
||
//addnoclass | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?php | ||
$GLOBALS['showClass']; | ||
$GLOBALS['showOther']; | ||
$GLOBALS['stevilo'] = 0; | ||
$GLOBALS['komentar']; | ||
$GLOBALS['status']=1; | ||
$GLOBALS['status_message']; | ||
class Config { | ||
function language($a) { | ||
if(file_exists('languages/'.$a.'.php')) { | ||
include('languages/'.$a.'.php'); | ||
$GLOBALS['language'] = $a; | ||
}else { | ||
$GLOBALS['status_message']="I can't find the selected language."; | ||
$GLOBALS['ststus']=0; | ||
} | ||
} | ||
|
||
function showClass ($a) { | ||
if($GLOBALS['status']!=0) { | ||
$GLOBALS['showClass']=$a; | ||
} | ||
} | ||
|
||
function showOther ($a) { | ||
if($GLOBALS['status']!=0) { | ||
$GLOBALS['showOther']=$a; | ||
} | ||
} | ||
|
||
function set($a,$b,$c){ | ||
if($GLOBALS['status']!=0) { | ||
$GLOBALS['stevilo']++; | ||
$this->$a=array($b,$c,$GLOBALS['stevilo']); | ||
} | ||
} | ||
|
||
function toString($class='',$addclass='',$addnoclass=''){ | ||
if($GLOBALS['status']!=0) { | ||
if($GLOBALS['showClass']==''or $GLOBALS['showOther']=='') { | ||
$GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]['showClass/showOther'] ; | ||
$GLOBALS['status']=0;} | ||
$string .='<?php | ||
'; if($GLOBALS['showClass']==1) { | ||
$string .= "class ".$class." { | ||
"; | ||
if (isset($GLOBALS['komentar'][0])) { | ||
$string .= '/*'.$GLOBALS['komentar'][0].'*/ | ||
'; | ||
} | ||
foreach ($this as $k=>$v) { | ||
if($v['1'] == '') { | ||
$string .= 'public $'.$k." = '".$v[0]."'; | ||
"; | ||
}else{ | ||
$string .= 'public $'.$k." = '".$v[0]."'; //".$v[1]." | ||
"; | ||
} | ||
if($GLOBALS['komentar'][$v[2]] != ''){ | ||
$string .= ' | ||
/*'.$GLOBALS['komentar'][$v[2]].'*/ | ||
'; | ||
} | ||
} | ||
if($addclass!='') { | ||
$string .=' | ||
'.$addclass.'';} | ||
$string .=" | ||
}";$string .=" | ||
";} | ||
if($GLOBALS['showOther']==1) { | ||
if (isset($GLOBALS['komentar'][0])) { | ||
$string .= '/*'.$GLOBALS['komentar'][0].'*/'; | ||
} | ||
foreach ($this as $k=>$v) { | ||
if($v['1'] == '') { | ||
$string .= ' | ||
$'.$k.' = "'.$v[0].'"; '; | ||
}else{ | ||
$string .= ' | ||
$'.$k.' = "'.$v[0].'"; //'.$v[1]; | ||
if($GLOBALS['komentar'][$v[2]] != ''){ | ||
$string .= ' | ||
/*'.$GLOBALS['komentar'][$v[2]].'*/'; | ||
} | ||
} | ||
|
||
} | ||
} | ||
if($addnoclass!='') { | ||
$string .=' | ||
'.$addnoclass.''; } | ||
$string .=" | ||
?>"; | ||
return $string; | ||
} | ||
} | ||
|
||
function comment($a) { | ||
if($$GLOBALS['status']!=0) { | ||
$GLOBALS['komentar'][''.$GLOBALS['stevilo'].''] = $a; | ||
} | ||
} | ||
|
||
function toFile($file,$data) { | ||
if($GLOBALS['status']!=0) { | ||
$fd = fopen ($file , "w") or $statusek=0; | ||
if($statusek==0) { | ||
$GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["can't open"]; | ||
$GLOBALS['status']=0; | ||
} | ||
fwrite($fd, $data); | ||
fclose($fd) ; | ||
|
||
$fd = fopen ($file , "r") or $statusek2=0; | ||
if($statusek2==0) { | ||
$GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["can't open"]; | ||
$GLOBALS['status']=0; | ||
} | ||
$data2=fread ($fd , filesize ($file)); | ||
if($data==$data2) { | ||
$GLOBALS['status_message']=$GLOBALS[$GLOBALS['language']]["ok"]; | ||
$GLOBALS['status']=1; | ||
} | ||
fclose($fd) ; | ||
} | ||
} | ||
|
||
function status() { | ||
return $GLOBALS['status']; | ||
} | ||
|
||
function status_message() { | ||
return $GLOBALS['status_message']; | ||
} | ||
} | ||
$config = new Config; | ||
$config->language('slovenian'); | ||
$config->showClass(1); | ||
$config->showOther(1); | ||
|
||
$config->comment('test'); | ||
$config->set('display_offline_message', 1,''); | ||
$config->set('offline', '1',2); | ||
$config->comment('testek'); | ||
$config->set('offline_message', 'hej','nej'); | ||
$config->set('offline_message2', 'hej','nej'); | ||
|
||
$data = $config->toString('Config','//addclass','//addnoclass'); | ||
$config->toFile('config.php',$data); | ||
echo $config->status_message(); | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
$GLOBALS['english']["can't open"] = 'Write successfully'; | ||
$GLOBALS['english']["ok"] = "I can't open $file"; | ||
$GLOBALS['english']["showClass/showOther"] = "I can't find the settings showClass and showOther"; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
$GLOBALS['slovenian']["can't open"] = "Ne morem odpreti $file"; | ||
$GLOBALS['slovenian']["ok"] = 'Zapisovanje uspešno'; | ||
$GLOBALS['slovenian']["showClass/showOther"] = 'Ne najdem navtavitev showConfig on showOther'; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
include("config.php"); | ||
echo $offline; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters