Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Curriculum-Request
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tim Steiner
Curriculum-Request
Commits
f5f7ccbb
Commit
f5f7ccbb
authored
16 years ago
by
Tim Steiner
Browse files
Options
Downloads
Patches
Plain Diff
Add PodcastProducer libraries to UNL Library
parent
5097fc1b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
library/Unl/Plist.php
+87
-0
87 additions, 0 deletions
library/Unl/Plist.php
with
87 additions
and
0 deletions
library/Unl/Plist.php
0 → 100644
+
87
−
0
View file @
f5f7ccbb
<?php
class
Unl_Plist
{
static
public
function
plistToArray
(
$xml
)
{
$dom
=
DOMDocument
::
loadXML
(
$xml
);
$xPath
=
new
DOMXPath
(
$dom
);
$root
=
$xPath
->
query
(
'plist/*'
)
->
item
(
0
);
return
self
::
_parseNode
(
$root
);
}
static
protected
function
_parseNode
(
$node
)
{
switch
(
$node
->
nodeName
)
{
case
'integer'
:
return
self
::
_parseInt
(
$node
);
break
;
case
'string'
:
case
'key'
:
return
self
::
_parseString
(
$node
);
break
;
case
'date'
:
return
self
::
_parseDate
(
$node
);
break
;
case
'true'
:
case
'false'
:
return
self
::
_parseBool
(
$node
);
break
;
case
'dict'
:
return
self
::
_parseDict
(
$node
);
break
;
case
'array'
:
return
self
::
_parseArray
(
$node
);
break
;
default
:
return
null
;
}
}
static
protected
function
_parseInt
(
$node
)
{
return
intval
(
$node
->
textContent
);
}
static
protected
function
_parseString
(
$node
)
{
return
$node
->
textContent
;
}
static
protected
function
_parseDate
(
$node
)
{
}
static
protected
function
_parseBool
(
$node
)
{
return
(
bool
)
(
$node
->
nodeName
==
'true'
);
}
static
protected
function
_parseDict
(
$node
)
{
$dict
=
array
();
$childNodes
=
array
();
foreach
(
$node
->
childNodes
as
$childNode
)
{
if
(
$childNode
->
nodeName
==
'#text'
)
{
continue
;
}
$childNodes
[]
=
$childNode
;
}
for
(
$i
=
0
;
$childNodes
[
$i
];
$i
+=
2
)
{
$key
=
self
::
_parseNode
(
$childNodes
[
$i
]);
$value
=
self
::
_parseNode
(
$childNodes
[
$i
+
1
]);
$dict
[
$key
]
=
$value
;
}
return
$dict
;
}
static
protected
function
_parseArray
(
$node
)
{
$array
=
array
();
foreach
(
$node
->
childNodes
as
$childNode
)
{
if
(
$childNode
->
nodeName
==
'#text'
)
{
continue
;
}
$array
[]
=
self
::
_parseNode
(
$childNode
);
}
return
$array
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment