1- <?
2-
3- require_once ('../config.php ' );
4- require_once ('lib/Ref.class.php ' );
5- require_once ('lib/Translation.class.php ' );
1+ <?
2+
3+ require_once ('../config.php ' );
4+ require_once ('lib/Ref.class.php ' );
5+ require_once ('lib/Translation.class.php ' );
6+
67$ benchmark_start = microtime_float ();
78
89
9- // content/static/libraries.html
10+
11+
1012$ where = CONTENTDIR . 'static/ ' ;
13+
1114putenv ('HOME= ' . CONTENTDIR );
1215
16+
1317// update the file on the server
14- `cd $ where && /usr/bin/svn update libraries.html `;
15-
16- // arguments
17- $ lang = isset ($ _POST ['lang ' ]) ? $ _POST ['lang ' ] : 'en ' ;
18-
19- // get translation file
20- $ translation = new Translation ($ lang );
21-
22- // each lib
23- $ libraries = array ('net ' , 'serial ' , 'video ' , 'opengl ' , 'dxf ' , 'pdf ' );
24-
25- $ lib_dir = 'reference/ ' .($ lang != 'en ' ? "$ lang/ " : '' ).'libraries ' ;
26-
27- // get library index
28- $ index = CONTENTDIR ."api_ $ lang/libraries/index.html " ;
29- $ page = new Page ('Libraries ' , 'Libraries ' );
30- $ page ->content (file_get_contents ($ index ));
31- make_necessary_directories (BASEDIR .$ lib_dir .'/images/include.php ' );
32- writeFile ($ lib_dir .'/index.html ' , $ page ->out ());
33- copydirr (CONTENTDIR ."api_ $ lang/libraries/images " , BASEDIR .$ lib_dir .'/images ' );
34-
35- // copy over the files for the contributed libraries
36- copy (CONTENTDIR ."static/libraries.html " , BASEDIR .$ lib_dir .'/libraries.html ' );
37-
38-
39- // foreach lib
40- foreach ($ libraries as $ lib ) {
41- $ source = "api_ $ lang/LIB_ $ lib " ;
42- $ destination = ($ lang != 'en ' ? "$ lang/ " : '' )."libraries/ $ lib " ;
43- make_necessary_directories (REFERENCEDIR .$ destination .'/images/include ' );
44-
45- // get xml files
46- if (!$ files = getXMLFiles (CONTENTDIR .$ source )) {
47- //echo "couldn't open files";
48- } else {
49- // parse xml files and create pages
50- foreach ($ files as $ file ) {
51- $ page = new LibReferencePage (new Ref ($ source .'/ ' .$ file ), $ lib , $ translation , $ lang );
52- $ page ->write ();
53- }
54- }
55-
56- // template and copy index
57- $ index = CONTENTDIR .$ source .'/index.html ' ;
58- if ($ lib == 'pdf ' || $ lib == 'dxf ' ) {
59- $ page = new Page (strtoupper ($ lib ) . ' \\ Libraries ' , 'Libraries ' , 'Library-index ' );
60- } else {
18+
19+ `cd $ where && /usr/bin/svn update libraries.html `;
20+
21+
22+ // each lib
23+ $ libraries = array ('net ' , 'serial ' , 'video ' , 'dxf ' , 'pdf ' );
24+ $ lib_dir = 'reference/libraries ' ;
25+
26+ // get library index
27+ $ index = CONTENTDIR ."api_en/libraries/index.html " ;
28+ $ page = new Page ('Libraries ' , 'Libraries ' );
29+ $ page ->content (file_get_contents ($ index ));
30+ make_necessary_directories (BASEDIR .$ lib_dir .'/images/include.php ' );
31+ writeFile ($ lib_dir .'/index.html ' , $ page ->out ());
32+ copydirr (CONTENTDIR ."api_en/libraries/images " , BASEDIR .$ lib_dir .'/images ' );
33+
34+ // copy over the files for the contributed libraries
35+ copy (CONTENTDIR ."static/libraries.html " , BASEDIR .$ lib_dir .'/libraries.html ' );
36+
37+
38+ // foreach lib
39+ foreach ($ libraries as $ lib ) {
40+ $ source = "api_en/LIB_ $ lib " ;
41+ $ destination = "libraries/ $ lib " ;
42+ make_necessary_directories (REFERENCEDIR .$ destination .'/images/include ' );
43+
44+ // get xml files
45+ if (!$ files = getXMLFiles (CONTENTDIR .$ source )) {
46+ //echo "couldn't open files";
47+ } else {
48+ // parse xml files and create pages
49+ foreach ($ files as $ file ) {
50+ $ page = new LibReferencePage (new Ref ($ source .'/ ' .$ file ), $ lib , $ translation , "en " );
51+ $ page ->write ();
52+ }
53+ }
54+
55+ // template and copy index
56+ $ index = CONTENTDIR .$ source .'/index.html ' ;
57+ if ($ lib == 'pdf ' || $ lib == 'dxf ' ) {
58+ $ page = new Page (strtoupper ($ lib ) . ' \\ Libraries ' , 'Libraries ' , 'Library-index ' );
59+ } else {
6160 //$page = new Page(ucfirst($lib) . ' \\ Libraries', 'Library-index');
62- $ page = new Page (ucfirst ($ lib ) . ' \\ Libraries ' , 'Libraries ' );
63- }
64- $ page ->language ($ lang );
65- $ page ->content (file_get_contents ($ index ));
66- writeFile ('reference/ ' .$ destination .'/index.html ' , $ page ->out ());
67-
68- // copy images directory
69- copydirr (CONTENTDIR .$ source .'/images ' , REFERENCEDIR .$ destination .'/images ' );
70-
71- }
72-
73- $ benchmark_end = microtime_float ();
74- $ execution_time = round ($ benchmark_end - $ benchmark_start , 4 );
75-
76- ?>
77-
78- <h2>Library Generation Successful</h2>
61+ $ page = new Page (ucfirst ($ lib ) . ' \\ Libraries ' , 'Libraries ' );
62+ }
63+ $ page ->language (" en " );
64+ $ page ->content (file_get_contents ($ index ));
65+ writeFile ('reference/ ' .$ destination .'/index.html ' , $ page ->out ());
66+
67+ // copy images directory
68+ copydirr (CONTENTDIR .$ source .'/images ' , REFERENCEDIR .$ destination .'/images ' );
69+
70+ }
71+
72+ $ benchmark_end = microtime_float ();
73+ $ execution_time = round ($ benchmark_end - $ benchmark_start , 4 );
74+
75+ ?>
76+
77+ <h2>Library Generation Successful</h2>
7978<p>Generated files in <?= $ execution_time?> seconds.</p>
0 commit comments