comparison includes/class.skeleton.php @ 21:86a6793f1408

Temporary fix: si on envoie le prolog xml, IE sort du mode strict... Idealement, il faudrait detecter ça en amont, et utiliser saveHTML ou saveXML en fonction: ce serait probablement plus robuste. Toutefois, il faut encore decider si cela doit se faire par défaut dans la classe Template ou en spécialisation dans skeleton (auquel cas, il est indispensable de passer Template::xmlDocument en protected).
author Franck Deroche <webmaster@defr.org>
date Fri, 26 Oct 2007 17:55:35 +0200
parents ec1453cb74b8
children 710fe2fd2ff7
comparison
equal deleted inserted replaced
20:afeabaebcd9a 21:86a6793f1408
4 private $styleSheets; 4 private $styleSheets;
5 private $blogPosts; 5 private $blogPosts;
6 private $showCalendar = false; 6 private $showCalendar = false;
7 private $calendarMonth; 7 private $calendarMonth;
8 private $calendarYear; 8 private $calendarYear;
9 private $useXML;
9 10
10 public function __construct() { 11 public function __construct() {
11 parent::__construct('main.xml'); 12 parent::__construct('main.xml');
12 $this->styleSheets = array(); 13 $this->styleSheets = array();
13 $this->addDefaultSheets(); 14 $this->addDefaultSheets();
14 $this->blogPosts = array(); 15 $this->blogPosts = array();
16 $this->useXML = empty($_SERVER['HTTP_ACCEPT']) ||
17 stristr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml');
15 } 18 }
16 19
17 public function setTitle($titre) { 20 public function setTitle($titre) {
18 $this->setParams(array('title' => $titre)); 21 $this->setParams(array('title' => $titre));
19 } 22 }
203 $this->setParams($params); 206 $this->setParams($params);
204 } 207 }
205 208
206 public function __toString() { 209 public function __toString() {
207 $this->prepareOutput(); 210 $this->prepareOutput();
208 return parent::__toString(); 211 $returnValue = parent::__toString();
212 if($this->useXML)
213 header('Content-Type: application/xhtml+xml; charset=utf-8');
214 else
215 $returnValue = ereg_replace('<\?xml[^\?]*\?>', '', $returnValue);
216 return $returnValue;
209 } 217 }
210 } 218 }
211 ?> 219 ?>