本文整理汇总了PHP中XMLParser::parseByFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLParser::parseByFilename方法的具体用法?PHP XMLParser::parseByFilename怎么用?PHP XMLParser::parseByFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLParser
的用法示例。
在下文中一共展示了XMLParser::parseByFilename方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllMenus
public static function getAllMenus()
{
$fname = DIR_DATA . '/menus.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
foreach ($a['menus']['group'] as $key => $value) {
$entries[] = new MenuItem(array('name' => $value['name'], 'class' => $value['class'], 'link' => $value['link']));
}
return $entries;
}
示例2: getAllDocuments
public static function getAllDocuments()
{
$fname = DIR_DATA . '/documentation.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
foreach ($a['documentation']['document'] as $key => $value) {
$entries[] = new Document($value);
}
return $entries;
}
示例3: getAllCredits
public static function getAllCredits()
{
$fname = DIR_DATA . '/credits.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$sections = array();
foreach ($a['credits']['section'] as $key => $value) {
$sections[] = new CSection($value);
}
return $sections;
}
示例4: getAllArticles
public static function getAllArticles()
{
$fname = DIR_DATA . '/press_articles.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
foreach ($a['articles']['article'] as $key => $value) {
$entries[] = new Article(array('name' => $value['name'], 'url' => $value['url'], 'language' => $value['language'], 'posted' => $value['posted']));
}
return $entries;
}
示例5: getAllDownloads
public static function getAllDownloads()
{
$fname = DIR_DATA . '/downloads.xml';
/* Now parse the data. */
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$sections = array();
foreach ($a['downloads']['section'] as $key => $value) {
$sections[] = new DSection($value);
}
return $sections;
}
示例6: getAllGroupsAndDemos
public static function getAllGroupsAndDemos()
{
$fname = DIR_DATA . '/game_demos.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
foreach ($a['game_demos']['group'] as $key => $value) {
$demos = array();
foreach ($value['demos']['demo'] as $data) {
$demos[] = new GameDemo($data);
}
$entries[] = array('name' => $value['name'], 'href' => $value['href'], 'demos' => $demos);
}
return $entries;
}
示例7: getAllGroupsAndLinks
public static function getAllGroupsAndLinks()
{
$fname = DIR_DATA . '/links.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
foreach ($a['external_links']['group'] as $key => $value) {
/* Get all links. */
$links = array();
foreach ($value['link'] as $data) {
$links[] = new WebLink($data);
}
$entries[] = array('name' => $value['name'], 'description' => $value['description'], 'links' => $links);
}
return $entries;
}
示例8: getAllScreenshots
public static function getAllScreenshots()
{
$fname = DIR_DATA . '/screenshots.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
BasicObject::toArray($a['screenshots']['group']);
foreach ($a['screenshots']['group'] as $value) {
BasicObject::toArray($value['game']);
$games = array();
foreach ($value['game'] as $data) {
$games[] = new Screenshot($data);
}
$entries[] = array('title' => $value['title'], 'category' => $value['category'], 'games' => $games);
}
return $entries;
}
示例9: getAllData
public static function getAllData($version)
{
if (!is_string($version)) {
throw new ErrorException(self::NO_VERSION);
}
$fname = DIR_COMPAT . "/compat-{$version}.xml";
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
foreach ($a['compatibility']['company'] as $key => $value) {
$games = array();
foreach ($value['games']['game'] as $data) {
$games[] = new CompatGame($data);
}
$entries[$value['name']] = $games;
}
return $entries;
}
示例10: getAllSubprojects
public static function getAllSubprojects()
{
$fname = DIR_DATA . '/subprojects.xml';
$parser = new XMLParser();
$a = $parser->parseByFilename($fname);
$entries = array();
BasicObject::toArray($a['subprojects']['project']);
foreach ($a['subprojects']['project'] as $key => $value) {
$downloads = array();
foreach ($value['entries'] as $type => $data) {
if ($type == 'file') {
BasicObject::toArray($data);
foreach ($data as $file) {
$downloads[] = new File($file);
}
}
}
$entries[] = new Project(array('name' => $value['name'], 'info' => $value['info'], 'downloads' => $downloads));
}
return $entries;
}