Skip to content

Commit

Permalink
Popravki kodnih standardov
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 committed Nov 13, 2018
1 parent f5a0ec6 commit b0f4ec4
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 123 deletions.
1 change: 0 additions & 1 deletion languages/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
$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";
?>
3 changes: 1 addition & 2 deletions languages/slovenian.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
$GLOBALS['slovenian']["can't open"] = "Ne morem odpreti $file";
$GLOBALS['slovenian']["ok"] = 'Zapisovanje uspešno';
$GLOBALS['slovenian']["ok"] = 'Zapisovanje uspešno';
$GLOBALS['slovenian']["showClass/showOther"] = 'Ne najdem navtavitev showConfig on showOther';
?>
254 changes: 134 additions & 120 deletions php-config.php
Original file line number Diff line number Diff line change
@@ -1,140 +1,154 @@
<?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." {

class Config
{
public 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;
}
}

public function showClass($a)
{
if ($GLOBALS['status']!=0) {
$GLOBALS['showClass']=$a;
}
}

public function showOther($a)
{
if ($GLOBALS['status']!=0) {
$GLOBALS['showOther']=$a;
}
}

public function set($a, $b, $c)
{
if ($GLOBALS['status']!=0) {
$GLOBALS['stevilo']++;
$this->$a=array($b,$c,$GLOBALS['stevilo']);
}
}

public 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].'*/
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 .= '
}
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 .="
}
}
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 .= '
";
}
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 .= '
} else {
$string .= '
$'.$k.' = "'.$v[0].'"; //'.$v[1];
if($GLOBALS['komentar'][$v[2]] != ''){
$string .= '
if ($GLOBALS['komentar'][$v[2]] != '') {
$string .= '
/*'.$GLOBALS['komentar'][$v[2]].'*/';
}
}
}
}
}
}
if ($addnoclass!='') {
$string .='
}
}
if($addnoclass!='') {
$string .='
'.$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'];
}
return $string;
}
}

public function comment($a)
{
if ($$GLOBALS['status']!=0) {
$GLOBALS['komentar'][''.$GLOBALS['stevilo'].''] = $a;
}
}

public 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) ;
}
}

public function status()
{
return $GLOBALS['status'];
}

public function status_message()
{
return $GLOBALS['status_message'];
}
}
?>

0 comments on commit b0f4ec4

Please sign in to comment.