Skip to content

Commit

Permalink
Merge branch 'feat/nettoyage' of github.com:pierretux/spip_comarquage…
Browse files Browse the repository at this point in the history
…v3 into pierretux-feat/nettoyage
  • Loading branch information
psychoz971 committed Sep 15, 2023
2 parents 96216da + b516f5d commit 9f9ff57
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions comarquage_fonctions.php
Expand Up @@ -358,31 +358,4 @@ function fluxXmlObjToArr($obj, $utiliser_namespace = false, $parentName = '') {
}

return $tableau;
}

global $spip_version_branche;
if($spip_version_branche[0] == "2") {
/**
* Surcharge le filtre table_valeur pour accepter la syntaxe a/b
* au lieu d'avoir à faire table_valeur{a}|table_valeur{b}.
*
* Nécessaire pour SPIP 2.
*
* @param array $table
* @param string $cle
* @param string $defaut
* @return string
*/
function filtre_table_valeur_dist($table,$cle,$defaut='') {
$table = is_string($table)?unserialize($table):$table;
$table = is_array($table)?$table:array();

// https://stackoverflow.com/a/9628276
$temp = &$table;
foreach(explode('/', $cle) as $key) {
if(! isset($temp[$key])) return $defaut;
$temp = &$temp[$key];
}
return $temp;
}
}
}

0 comments on commit 9f9ff57

Please sign in to comment.