array( 'valeur' => $valeur, 'type' => $type, 'options' => $options, ), 'data' => $erreur ) ); return $erreur; } /** * Liste toutes les vérifications possibles * * @param string $repertoire * Dans quel repertoire chercher les yaml. * * @return Retourne un tableau listant les vérifications et leurs options */ function verifier_lister_disponibles($repertoire='verifier'){ static $verifications = array(); if (!isset($verifications[$repertoire])) { $verifications[$repertoire] = array(); $liste = find_all_in_path("$repertoire/", '.+[.]yaml$'); if (count($liste)){ foreach ($liste as $fichier=>$chemin){ $type = preg_replace(',[.]yaml$,i', '', $fichier); $dossier = str_replace($fichier, '', $chemin); // On ne garde que les vérifications qui ont bien la fonction ! if (charger_fonction($type, $repertoire, true) and ( is_array($verif = verifier_charger_infos($type, $repertoire)) ) ) { $verifications[$repertoire][$type] = $verif; } } } } return $verifications[$repertoire]; } /** * Charger les informations contenues dans le yaml d'une vérification * * @param string $type_verif * Le type de la vérification * * @param string $repertoire * Dans quel repertoire chercher les yaml. * * @return array Un tableau contenant le YAML décodé */ function verifier_charger_infos($type_verif, $repertoire='verifier'){ include_spip('inc/yaml'); $fichier = find_in_path("$repertoire/$type_verif.yaml"); $verif = yaml_decode_file($fichier); if (is_array($verif)){ $verif['titre'] = (isset($verif['titre']) and $verif['titre']) ? _T_ou_typo($verif['titre']) : $type_verif; $verif['description'] = (isset($verif['description']) and $verif['description']) ? _T_ou_typo($verif['description']) : ''; $verif['icone'] = (isset($verif['icone']) and $verif['icone']) ? _T_ou_typo($verif['icone']) : ''; } return $verif; } ?>