FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing-docs/generate/tutorials.php at macos · processing/processing-docs · GitHub
processing
processing-docs
Repository navigation
Code
Issues
3
(3)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
processing-docs
/
generate
/
tutorials.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
80 lines (66 loc) · 2.22 KB
Breadcrumbs
processing-docs
/
generate
/
tutorials.php
Copy path
File metadata and controls
executable file
·
80 lines (66 loc) · 2.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
require_once
(
'
../config.php
'
);
$
benchmark_start
=
microtime_float
();
$
source
=
CONTENTDIR
.
"
static/tutorials/
"
;
$
path
=
BASEDIR
;
$
where
=
CONTENTDIR
.
'
static/tutorials
'
;
putenv
(
'
HOME=
'
.
CONTENTDIR
);
// Switch from SVN to GIT, 14 FEB 2013
// Disabled for now, so we can test generate scripts without pulling latest from repo. -SM
//`cd $path && /usr/bin/git pull https://github.com/processing/processing-docs/`;
// Copy over the images for the tutorials index
$
tpath
=
$
path
.
'
tutorials/imgs
'
;
if
(!
is_dir
(
$
tpath
)) {
mkdir
(
$
tpath
,
0757
);
}
if
(
is_dir
(
$
tpath
)) {
copydirr
(
$
source
.
'
imgs
'
,
$
tpath
,
null
,
0757
,
true
);
}
// Index page
$
page
=
new
Page
(
"
Tutorials
"
,
"
Tutorials
"
,
"
Tutorials
"
,
"
../
"
);
$
page
->
content
(
file_get_contents
(
$
source
.
"
index.html
"
));
writeFile
(
'
tutorials/index.html
'
,
$
page
->
out
());
// Start making the individual tutorial pages
if
( !
$
xml
=
simplexml_load_file
(
$
source
.
'
tutorials.xml
'
) )
{
echo
'
XML file missing
'
;
}
else
{
foreach
(
$
xml
as
$
tutorial
)
{
$
title
=
$
tutorial
->
title
;
$
directory
=
$
tutorial
->
directory
;
$
imgs
=
$
tutorial
->
imgs
;
$
code
=
$
tutorial
->
code
;
echo
'
About to generate tutorial
'
.
$
title
.
'
in directory
'
.
$
directory
.
'
, imgs dir =
'
.
$
imgs
.
'
, code dir =
'
.
$
code
.
'
<br \>
'
;
echo
'
Copying
'
.
$
source
.
$
directory
.
'
/index.html to
'
.
'
tutorials/
'
.
$
directory
.
'
/index.html<br \>
'
;
$
page
=
new
Page
(
$
title
,
"
Tutorials
"
,
"
Tutorials
"
,
"
../../
"
);
$
page
->
content
(
file_get_contents
(
$
source
.
$
directory
.
'
/index.html
'
));
writeFile
(
'
tutorials/
'
.
$
directory
.
'
/index.html
'
,
$
page
->
out
());
if
(
$
imgs
==
'
true
'
) {
$
newpath
=
$
path
.
'
tutorials/
'
.
$
directory
.
'
/imgs
'
;
if
(!
is_dir
(
$
newpath
)) {
mkdir
(
$
newpath
,
0757
);
}
if
(
is_dir
(
$
newpath
)) {
copydirr
(
$
source
.
$
directory
.
'
/imgs
'
,
$
newpath
,
null
,
0757
,
true
);
}
}
if
(
$
code
==
'
true
'
) {
$
newpath
=
$
path
.
'
tutorials/
'
.
$
directory
.
'
/code
'
;
if
(!
is_dir
(
$
newpath
)) {
mkdir
(
$
newpath
,
0757
);
}
if
(
is_dir
(
$
newpath
)) {
copydirr
(
$
source
.
$
directory
.
'
/code
'
,
$
newpath
,
null
,
0757
,
true
);
}
}
}
}
$
benchmark_end
=
microtime_float
();
$
execution_time
=
round
(
$
benchmark_end
-
$
benchmark_start
,
4
);
?>
<h2>Static page generation Successful</h2>
<h2>Updated
<?=
$
where
?>
</h2>
<p>Generated files in
<?=
$
execution_time
?>
seconds.</p>
Back
|
FazBrowse Home
|
New Git URL