本文整理匯總了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;
}