* Reordered wiki table handling and __TOC__ extraction in the parser to better handle...
[lhc/web/wiklou.git] / maintenance / languages.inc
1 <?php
2 /**
3 * Library to grab data from languages files
4 *
5 * WORK IN PROGRESS. There is some bugs when including the same
6 * file multiple time :(((
7 */
8 require_once('commandLine.inc');
9
10 class languages {
11 /** Contain the list of languages available */
12 var $list = array();
13 /** some messages for the current lang */
14 var $messages = array();
15
16 function languages() {
17 $this->clear();
18 $this->loadList();
19 }
20
21 function clear() {
22 $this->list = array();
23 $this->messages = array();
24 }
25
26 function loadList() {
27 global $IP;
28 $this->list = array();
29
30 // available language files
31 $dir = opendir("$IP/languages");
32 while ($file = readdir($dir)) {
33 if (preg_match("/Language([^.]*?)\.php$/", $file, $m)) {
34 $this->list[] = $m[1];
35 }
36 }
37 sort($this->list);
38
39 // Cleanup file list
40 foreach($this->list as $key => $lang) {
41 if ($lang == 'Utf8' || $lang == '' || $lang == 'Converter')
42 unset($this->list[$key]);
43 }
44 }
45
46 function getList() { return $this->list; }
47 }
48 ?>