|
| 1 | +<?php |
| 2 | +$GLOBALS['showClass']; |
| 3 | +$GLOBALS['showOther']; |
| 4 | +$GLOBALS['stevilo'] = 0; |
| 5 | +$GLOBALS['komentar']; |
| 6 | +class Config { |
| 7 | + function language($a) { |
| 8 | + if(file_exists('languages/'.$a.'.php')) { |
| 9 | + include('languages/'.$a.'.php'); |
| 10 | + $GLOBALS['language'] = $a; |
| 11 | + }else { |
| 12 | + die("I can't find the selected language."); |
| 13 | + } |
| 14 | + } |
| 15 | + |
| 16 | + function showClass ($a) { |
| 17 | + $GLOBALS['showClass']=$a; |
| 18 | + } |
| 19 | + |
| 20 | + function showOther ($a) { |
| 21 | + $GLOBALS['showOther']=$a; |
| 22 | + } |
| 23 | + |
| 24 | + function set($a,$b,$c){ |
| 25 | + $GLOBALS['stevilo']++; |
| 26 | + $this->$a=array($b,$c,$GLOBALS['stevilo']); |
| 27 | + } |
| 28 | + |
| 29 | + function toString($class='',$addclass='',$addnoclass=''){ |
| 30 | + if($GLOBALS['showClass']==''or $GLOBALS['showOther']=='') {die ($GLOBALS[$GLOBALS['language']]['showClass/showOther']) ;} |
| 31 | + $string .='<?php |
| 32 | +'; if($GLOBALS['showClass']==1) { |
| 33 | + $string .= "class ".$class." { |
| 34 | + "; |
| 35 | + if (isset($GLOBALS['komentar'][0])) { |
| 36 | + $string .= '/*'.$GLOBALS['komentar'][0].'*/ |
| 37 | + '; |
| 38 | + } |
| 39 | + foreach ($this as $k=>$v) { |
| 40 | + if($v['1'] == '') { |
| 41 | + $string .= 'public $'.$k." = '".$v[0]."'; |
| 42 | + "; |
| 43 | + }else{ |
| 44 | + $string .= 'public $'.$k." = '".$v[0]."'; //".$v[1]." |
| 45 | + "; |
| 46 | + } |
| 47 | + if($GLOBALS['komentar'][$v[2]] != ''){ |
| 48 | + $string .= ' |
| 49 | + /*'.$GLOBALS['komentar'][$v[2]].'*/ |
| 50 | + '; |
| 51 | + } |
| 52 | + } |
| 53 | + if($addclass!='') { |
| 54 | + $string .=' |
| 55 | +'.$addclass.'';} |
| 56 | + $string .=" |
| 57 | +}";$string .=" |
| 58 | +
|
| 59 | +";} |
| 60 | + if($GLOBALS['showOther']==1) { |
| 61 | +if (isset($GLOBALS['komentar'][0])) { |
| 62 | + $string .= '/*'.$GLOBALS['komentar'][0].'*/'; |
| 63 | + } |
| 64 | +foreach ($this as $k=>$v) { |
| 65 | + if($v['1'] == '') { |
| 66 | + $string .= ' |
| 67 | +$'.$k.' = "'.$v[0].'"; '; |
| 68 | + }else{ |
| 69 | + $string .= ' |
| 70 | +$'.$k.' = "'.$v[0].'"; //'.$v[1]; |
| 71 | +if($GLOBALS['komentar'][$v[2]] != ''){ |
| 72 | + $string .= ' |
| 73 | +
|
| 74 | +/*'.$GLOBALS['komentar'][$v[2]].'*/'; |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | +} |
| 79 | +} |
| 80 | +if($addnoclass!='') { |
| 81 | +$string .=' |
| 82 | +
|
| 83 | +'.$addnoclass.''; } |
| 84 | +$string .=" |
| 85 | +?>"; |
| 86 | + return $string; |
| 87 | + } |
| 88 | + |
| 89 | + function comment($a) { |
| 90 | + $GLOBALS['komentar'][''.$GLOBALS['stevilo'].''] = $a; |
| 91 | + } |
| 92 | + |
| 93 | + function toFile($file,$data) { |
| 94 | + $fd = fopen ($file , "w") or die ($GLOBALS[$GLOBALS['language']]["can't open"]) ; |
| 95 | + fwrite($fd, $data); |
| 96 | + fclose($fd) ; |
| 97 | + |
| 98 | + $fd = fopen ($file , "r") or die ($GLOBALS[$GLOBALS['language']]["can't open"]) ; |
| 99 | + $data2=fread ($fd , filesize ($file)); |
| 100 | + if($data==$data2) { |
| 101 | + die($GLOBALS[$GLOBALS['language']]["ok"]); |
| 102 | + } |
| 103 | + fclose($fd) ; |
| 104 | + } |
| 105 | +} |
| 106 | +?> |
0 commit comments