Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 1313 → Rev 1314

/trunk/services/modules/0.1/plantuse/Textes.php
93,16 → 93,20
}
private function obtenirTextes() {
$retour = "";
$retour = array();
if ($this->parametres['masque'] != "") {
$this->parametres['masque'] = str_replace(" ", "_", $this->parametres['masque']);
$json = file_get_contents($this->plantuseurl.$this->parametres['masque']);
$url = $this->plantuseurl.$this->parametres['masque'];
$json = file_get_contents($url);
if ($json != false) {
$tableau = json_decode($json, TRUE);
if (isset($tableau['parse']['wikitext']['*'])) {
$texte = $tableau['parse']['wikitext']['*'];
if (strpos($texte, "Résumé des usages") !== FALSE) {
$retour = substr($texte, strpos($texte, "{{Encadr")+63, -2);
$texte = substr($texte, strpos($texte, "{{Encadr")+63, -2);
$texte = str_replace("*", "", $texte);
$retour['usages'] = array_filter(array_map('trim', explode("\n", $texte)), 'strlen');
$retour['url'] = $url;
}
}
}