Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Language {
- protected $langID = null;
- protected $langArray = array();
- public function __construct( $langid = null ) {
- if( $langid != null ) {
- $this->langID = $langid;
- }
- $this->initLanguage();
- }
- protected function initLanguage() {
- $sql = UCP_Framework::getDB()->sendQuery("SELECT * FROM `languages` WHERE ID = '". $this->langID ."'");
- if( UCP_Framework::getDB()->numRows($sql) == 0) {
- $this->langID = 1; //default
- }
- $sql = UCP_Framework::getDB()->sendQuery("SELECT * FROM `languagevars` WHERE langID = '". $this->langID . "'");
- while( $row = UCP_Framework::getDB()->fetchArray($sql)) {
- $this->langArray[] = $row;
- }
- }
- public function __get($id) {
- $rtn_found = false;
- foreach( $this->langArray as $lang ) {
- if( $lang["languageVar"] == $id ) {
- $rtn_found = true;
- $rtn_value = $lang["languageValue"];
- }
- }
- if( $rtn_found == true ) {
- return $rtn_value;
- } else {
- return $id;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement