*/
function inc_verifier_dist($valeur, $type, $options = null, &$valeur_normalisee = null) {
+ $erreur = array();
// On vérifie que les options sont bien un tableau
if (!is_array($options)) {
$options = array();
* @param string $repertoire
* Dans quel repertoire chercher les yaml.
*
- * @return Retourne un tableau listant les vérifications et leurs options
+ * @return array Retourne un tableau listant les vérifications et leurs options
*/
function verifier_lister_disponibles($repertoire = 'verifier') {
static $verifications = array();
return $verifications[$repertoire];
}
+/**
+ * Fonction de callback pour uasort()
+ * Afin de trier selon le titre
+ * @param array $array1 premier élèment
+ * @param array $array2 second élèment
+ * @return int 1,0,-1
+ **/
+function verifier_trier_par_titre($array1,$array2) {
+ if (isset($array1['titre']) and isset($array2['titre'])) {
+ if ($array1['titre'] == $array2['titre']) {
+ return 0;
+ } elseif ($array1['titre'] > $array2['titre']) {
+ return 1;
+ } else {
+ return -1;
+ }
+ } else {
+ return 0;
+ }
+}
/**
* Charger les informations contenues dans le yaml d'une vérification
* @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']) : '';
+ $verif = array();
+
+ if (defined('_DIR_PLUGIN_YAML')) {
+ 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;
}