name() ) return TRUE; if( $str == $this->isocode() ) return TRUE; if( $str == $this->fullname() ) return TRUE; $aliases = $this->aliases(); if( !is_array($aliases) ) $aliases = explode(',',$aliases); if( is_array($aliases) && count($aliases) ) { for( $i = 0; $i < count($aliases); $i++ ) { if( strtolower($aliases[$i]) == strtolower($str) ) return TRUE; } } return FALSE; } public function name() { return $this->_key; // $name = get_class(); // if( endswith($name,'_nls') ) // { // $name = substr($name,0,strlen($name)-4); // } // return $name; } public function isocode() { if( !$this->_isocode ) { return substr($this->_fullname,0,2); } return $this->_isocode; } public function display() { if( $this->_display ) { return $this->_display; } } public function locale() { // if( !$this->_locale ) { // debug_display($this); // return $this->name(); // } return $this->_locale; } public function encoding() { if( !$this->_encoding ) return 'UTF-8'; return $this->_encoding; } public function fullname() { if( $this->_fullname ) return $this->_fullname; } public function aliases() { if( $this->_aliases ) { if( is_array($this->_aliases) ) return $this->_aliases; return explode(',',$this->_aliases); } } public function key() { return $this->_key; } public function direction() { if( $this->_direction ) return $this->_direction; return 'ltr'; } public function htmlarea() { if( $this->_htmlarea ) return $this->_htmlarea; return substr($this->_fullname,0,2); } public static function &from_array($data) { $obj = new CmsNls(); // name and key if( isset($data['englishlang']) ) { foreach( $data['englishlang'] as $k => $v ) { $obj->_fullname = $v; $obj->_key = $k; break; } } // get the display value if( isset($data['language'][$obj->_key]) ) { $obj->_display = $data['language'][$obj->_key]; } // get the isocode? if( isset($data['isocode'][$obj->_key]) ) { $obj->_isocode = $data['isocode'][$obj->_key]; } else { $t = explode('_',$obj->_key); if( is_array($t) && count($t) ) { $obj->_isocode = $t[0]; } } // get the locale if( isset($data['locale'][$obj->_key]) ) { $obj->_locale = $data['locale'][$obj->_key]; } // get the encoding if( isset($data['encoding'][$obj->_key]) ) { $obj->_encoding = $data['encoding'][$obj->_key]; } if( isset($data['htmlarea'][$obj->_key]) ) { $obj->_htmlarea = $data['htmlarea'][$obj->_key]; } // get the direction if( isset($data['direction'][$obj->_key]) ) { $obj->_direction = $data['direction'][$obj->_key]; } // get aliases if( isset($data['alias']) ) { $obj->_aliases= array_keys($data['alias']); } if( $obj->_key == '' ) { debug_display($data); debug_display($obj); die(); } return $obj; } } // end of class # # EOF # ?>