Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
612 B

​
​
​
5 months ago
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. class Language_json{
  3. var $Labels;
  4. var $FileName;
  5. function __construct( $FN ){
  6. $this->FileName = $FN;
  7. $DOP = file_get_contents( $FN );
  8. $this->Labels = json_decode( $DOP, true );
  9. }
  10. function GetLabel($LabelKey){
  11. if (isset($this->Labels[$LabelKey])){
  12. $J = str_replace("'","\'",$this->Labels[$LabelKey]);
  13. $J = str_replace('"','\"',$J);
  14. return $J;
  15. } else return $LabelKey;
  16. }
  17. function AddLabel($LabelKey, $LabelText ){
  18. $this->Labels[$LabelKey] = $LabelText;
  19. $FD = fopen( $this->FileName, "w+" );
  20. fprintf( $FD, json_encode( $this->Labels ) );
  21. fclose( $FD );
  22. }
  23. };
  24. ?>