Rev 922 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
class Conteneur {
protected $parametres = array();
protected $partages = array();
public function __construct(array $parametres = null) {
$this->parametres = is_null($parametres) ? array() : $parametres;
}
public function getParametre($cle) {
$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
return $valeur;
}
public function getParametreTableau($cle) {
$tableau = array();
$parametre = $this->getParametre($cle);
if (empty($parametre) === false) {
$tableauPartiel = explode(',', $parametre);
$tableauPartiel = array_map('trim', $tableauPartiel);
foreach ($tableauPartiel as $champ) {
if (strpos($champ, '=') === false) {
$tableau[] = trim($champ);
} else {
list($cle, $val) = explode('=', $champ);
$tableau[trim($cle)] = trim($val);
}
}
}
return $tableau;
}
public function setParametre($cle, $valeur) {
$this->parametres[$cle] = $valeur;
}
public function getBdd() {
if (!isset($this->partages['Bdd'])){
$this->partages['Bdd'] = new Bdd();
}
return $this->partages['Bdd'];
}
public function getCacheSimple($options = array()) {
$cache = new CacheSimple($options);
return $cache;
}
public function getWikipediaBot($options = array()) {
$wpBot = new WikipediaBot($options);
return $wpBot;
}
public function getUrl($url) {
$url = new Url($url);
return $url;
}
}
?>