Skip to content
This repository
Browse code

BUGFIX: Removed XHTML XML declaration requirement

  • Loading branch information...
commit 13b7386a2f2fc6f665b5a5ab35e4d1ff1be7cec4 1 parent d57caa6
authored March 07, 2013

Showing 1 changed file with 12 additions and 18 deletions. Show diff stats Hide diff stats

  1. 30  control/ContentNegotiator.php
30  control/ContentNegotiator.php
@@ -134,25 +134,19 @@ public static function process(SS_HTTPResponse $response) {
134 134
 	 */
135 135
 	public function xhtml(SS_HTTPResponse $response) {
136 136
 		$content = $response->getBody();
137  
-		
138  
-		// Only serve "pure" XHTML if the XML header is present
139  
-		if(substr($content,0,5) == '<' . '?xml' ) {
140  
-			$response->addHeader("Content-Type", "application/xhtml+xml; charset=" . self::$encoding);
141  
-			$response->addHeader("Vary" , "Accept");
142  
-
143  
-			// Fix base tag
144  
-			$content = preg_replace('/<base href="([^"]*)"><!--\[if[[^\]*]\] \/><!\[endif\]-->/', 
145  
-				'<base href="$1" />', $content);
146  
-			
147  
-			$content = str_replace('&nbsp;','&#160;', $content);
148  
-			$content = str_replace('<br>','<br />', $content);
149  
-			$content = preg_replace('#(<img[^>]*[^/>])>#i', '\\1/>', $content);
150  
-			
151  
-			$response->setBody($content);
152 137
 
153  
-		} else {
154  
-			return $this->html($response);
155  
-		}
  138
+		$response->addHeader("Content-Type", "application/xhtml+xml; charset=" . self::$encoding);
  139
+		$response->addHeader("Vary" , "Accept");
  140
+
  141
+		// Fix base tag
  142
+		$content = preg_replace('/<base href="([^"]*)"><!--\[if[[^\]*]\] \/><!\[endif\]-->/', 
  143
+			'<base href="$1" />', $content);
  144
+
  145
+		$content = str_replace('&nbsp;','&#160;', $content);
  146
+		$content = str_replace('<br>','<br />', $content);
  147
+		$content = preg_replace('#(<img[^>]*[^/>])>#i', '\\1/>', $content);
  148
+
  149
+		$response->setBody($content);
156 150
 	}
157 151
 	
158 152
 	/*

0 notes on commit 13b7386

Please sign in to comment.
Something went wrong with that request. Please try again.