FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing-docs/generate/lib/Translation.class.php at master · 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
/
lib
/
Translation.class.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
76 lines (66 loc) · 2.33 KB
Breadcrumbs
processing-docs
/
generate
/
lib
/
Translation.class.php
Copy path
File metadata and controls
executable file
·
76 lines (66 loc) · 2.33 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
<?php
class
Translation
{
var
$
navigation
=
array
();
var
$
attributes
=
array
();
var
$
categories
=
array
();
var
$
cat_tr
=
array
();
var
$
meta
=
array
();
function
Translation
(
$
lang
)
{
$
file
=
"
api_
$
lang
/translation/translation.xml
"
;
//$file = "api_en/translation/translation.xml";
// Three new lines from Casey 25 July 2011
$
xml
=
new
DOMDocument
(
'
1.0
'
,
'
utf-8
'
);
$
xml
->
formatOutput
=
true
;
$
xml
->
preserveWhiteSpace
=
false
;
$
xml
->
load
(
$
file
);
//$xml =& openXML($file);
$
this
->
parse
(
$
xml
);
}
function
parse
(
$
xml
)
{
$
nav
=
$
xml
->
getElementsByTagName
(
'
navigation
'
);
$
nav
=
$
nav
->
item
(
0
);
foreach
(
$
nav
->
childNodes
as
$
child
) {
$
this
->
navigation
[
$
child
->
nodeName
] =
$
child
->
getText
();
}
$
attr
=
$
xml
->
getElementsByTagName
(
'
attributes
'
);
$
attr
=
$
attr
->
item
(
0
);
foreach
(
$
attr
->
childNodes
as
$
child
) {
$
this
->
attributes
[
$
child
->
nodeName
] =
$
child
->
getText
();
}
$
cats
=
$
xml
->
getElementsByTagName
(
'
categories
'
);
$
cats
=
$
cats
->
item
(
0
);
foreach
(
$
cats
->
childNodes
as
$
c
) {
$
name
=
htmlspecialchars
(
$
c
->
getAttribute
(
'
name
'
));
$
this
->
categories
[
$
name
] =
array
(
''
=>
array
());
$
this
->
cat_tr
[
$
name
] =
htmlspecialchars
(
trim
(
$
c
->
firstChild
->
nodeValue
));
if
(
$
c
->
childCount
>
0
) {
foreach
(
$
c
->
childNodes
as
$
s
) {
if
(
$
s
->
nodeType
==
1
) {
$
this
->
categories
[
$
name
][
$
s
->
getAttribute
(
'
name
'
)] =
array
();
$
this
->
cat_tr
[
$
s
->
getAttribute
(
'
name
'
)] =
trim
(
$
s
->
firstChild
->
nodeValue
);
}
}
}
}
$
meta
=
$
xml
->
getElementsByTagName
(
'
meta
'
);
$
meta
=
$
meta
->
item
(
0
);
foreach
(
$
meta
->
childNodes
as
$
child
) {
$
nodeName
=
$
child
->
nodeName
;
eregi
(
"
<
$
nodeName
>(.*)<\/
$
nodeName
>
"
,
$
child
->
toString
(),
$
matches
);
$
this
->
meta
[
$
nodeName
] =
$
matches
[
1
];
}
}
function
test
()
{
echo
'
<pre>
'
;
print_r
(
$
this
->
navigation
);
print_r
(
$
this
->
attributes
);
print_r
(
$
this
->
categories
);
print_r
(
$
this
->
cat_tr
);
print_r
(
$
this
->
meta
);
}
}
?>
Back
|
FazBrowse Home
|
New Git URL