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.

23 lines
544 B

​
​
​
2 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. return $this->Labels[$LabelKey];
  13. } else return $LabelKey;
  14. }
  15. function AddLabel($LabelKey, $LabelText ){
  16. $this->Labels[$LabelKey] = $LabelText;
  17. $FD = fopen( $this->FileName, "w+" );
  18. fprintf( $FD, json_encode( $this->Labels ) );
  19. fclose( $FD );
  20. }
  21. };
  22. ?>