r394: Add access keys to the checkboxes
[bugdar.git] / docs / lang_registry_populator.php
1 <?php
2
3 // looks for lang::r() calls and adds them to the system
4 // $Id$
5
6 chdir('./../');
7 require_once('./global.php');
8
9 function fetch_listing($path, $basepath = '', $unset = 1)
10 {
11 static $filelist;
12
13 if ($unset)
14 {
15 $filelist = array();
16 }
17
18 if (substr($path, (strlen($path) - 1), 1) != '/')
19 {
20 $path .= '/';
21 }
22
23 if ($handle = opendir($path))
24 {
25 while (($file = readdir($handle)) !== false)
26 {
27 if (substr($file, 0, 1) != '.' AND $file != 'CVS')
28 {
29 if (is_dir($path . $file))
30 {
31 $filelist["$basepath"][] = "$file/";
32 fetch_listing("$path$file", "$basepath$file/", 0);
33 }
34 else
35 {
36 $filelist["$basepath"][] = $file;
37 }
38 }
39 }
40 closedir($handle);
41 }
42 return $filelist;
43 }
44
45 function fetch_flat_listing($filelist)
46 {
47 foreach ($filelist AS $basepath => $files)
48 {
49 foreach ($files AS $file)
50 {
51 if (preg_match('#\.php$#', $file))
52 {
53 $flatlist[] = "./$basepath$file";
54 }
55 }
56 }
57 return $flatlist;
58 }
59
60 // ###################################################################
61 // ###################################################################
62
63 $listing = fetch_flat_listing(fetch_listing(getcwd()));
64
65 foreach ($listing AS $filename)
66 {
67 $file = file_get_contents($filename);
68
69 preg_match_all("#lang::r\('(.*?)'\)#", $file, $matches);
70 foreach ($matches[0] AS $matchid => $match)
71 {
72 lang::r($matches[1]["$matchid"]);
73 }
74 }
75
76 ?>