forked from halo-battle/game
Ajout d'une étape de linting dans DroneCi (#3)
Corrige un doublons laissé par le rebase semi-manuel Ajout d'une étape de linting dans DroneCi Fix linting Co-authored-by: Nigel Sheldon <nigelsheldon@live.fr> Reviewed-on: https://gitea.nemunai.re/halo-battle/game/pulls/3
This commit is contained in:
parent
5b17a7dbd7
commit
dd61d3b66b
263 changed files with 45327 additions and 42695 deletions
|
|
@ -1,41 +1,39 @@
|
|||
<?php
|
||||
|
||||
function parse_config($node,$name = 'var',$attribut = 'name')
|
||||
{
|
||||
$configs = $node->childNodes;
|
||||
if($configs)
|
||||
{
|
||||
$array = array();
|
||||
function parse_config($node, $name = 'var', $attribut = 'name')
|
||||
{
|
||||
$configs = $node->childNodes;
|
||||
if ($configs) {
|
||||
$array = array();
|
||||
|
||||
foreach($configs as $value)
|
||||
{
|
||||
if($value->nodeName == $name)
|
||||
{
|
||||
if($value->getElementsByTagName($name)->length == 0)
|
||||
{
|
||||
$array[$value->getAttribute($attribut)] = trim($value->textContent);
|
||||
}
|
||||
else $array[$value->getAttribute($attribut)] = parse_config($value,$name,$attribut);
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
foreach ($configs as $value) {
|
||||
if ($value->nodeName == $name) {
|
||||
if ($value->getElementsByTagName($name)->length == 0) {
|
||||
$array[$value->getAttribute($attribut)] = trim($value->textContent);
|
||||
} else {
|
||||
$array[$value->getAttribute($attribut)] = parse_config($value, $name, $attribut);
|
||||
}
|
||||
}
|
||||
else return array();
|
||||
}
|
||||
return $array;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/*function parse($file)
|
||||
{
|
||||
$xml = new DOMDocument();
|
||||
|
||||
|
||||
$xml->load($file);
|
||||
#$xml->validate();
|
||||
|
||||
|
||||
if($root = $xml->documentElement->getAttribute('root'))
|
||||
{
|
||||
if($root == substr(FILE,0,strlen($root)))
|
||||
{
|
||||
$search = substr(FILE,strlen($root));
|
||||
|
||||
|
||||
$paths = explode('/',$search);
|
||||
$paths2 = $paths;
|
||||
foreach($paths as $key => $path)
|
||||
|
|
@ -46,20 +44,20 @@ function parse_config($node,$name = 'var',$attribut = 'name')
|
|||
}
|
||||
if($key != count($paths) - 1) $paths2[$key] .= '/';
|
||||
}
|
||||
|
||||
|
||||
foreach($xml->getElementsByTagName('config') as $value)
|
||||
{
|
||||
$config[$value->getAttribute('match')] = $value;
|
||||
}
|
||||
|
||||
|
||||
$parsed = array();
|
||||
array_unshift($paths2,'*');
|
||||
|
||||
|
||||
foreach($paths2 as $path)
|
||||
{
|
||||
if($config[$path]) $parsed = array_merge($parsed,parse_config($config[$path]));
|
||||
}
|
||||
|
||||
|
||||
return $parsed;
|
||||
}
|
||||
}
|
||||
|
|
@ -69,5 +67,3 @@ function parse_config($node,$name = 'var',$attribut = 'name')
|
|||
define('FILE','/var/www/site/test/test.php');
|
||||
|
||||
print_r(parse('../config/root.xml'));*/
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue