1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- function get_language_file_as_xml($language='english')
- {
- $path = api_get_path(SYS_LANG_PATH).$language.'/';
- if(!is_dir($path) or !is_readable($path))
- {
- if($language != 'english')
- {
- return get_language_file_as_xml('english');
- }
- else
- {
- return '';
- }
- }
-
- $file = $path.'videoconf.inc.php';
- if(!is_file($file) or !is_readable($file))
- {
- if($language != 'english')
- {
- return get_language_file_as_xml('english');
- }
- else
- {
- return '';
- }
- }
-
-
- $non_utf8_encoding = api_get_non_utf8_encoding($language);
- $list = file($file);
- $xml = '';
- foreach ( $list as $line ) {
- if(substr($line, 0, 1)=='$') {
- $items = array();
- $match = preg_match('/^\$([^\s]*)\s*=\s*"(.*)";$/', $line, $items);
- if($match) {
- $string = $items[2];
- if (!api_is_valid_utf8($string)) {
- $string = api_html_entity_decode(api_utf8_encode($string, $non_utf8_encoding), ENT_QUOTES, 'UTF-8');
- }
- $xml .= '<labelfield><labelid>'.$items[1].'</labelid><labelvalue>'.stripslashes($string).'</labelvalue></labelfield>'."\n";
- }
- }
- }
-
- if(empty($xml) && $language!='english')
- {
- return get_language_file_as_xml('english');
- }
- return $xml;
- }
- ?>
|