@@ -2,34 +2,34 @@ |
||
| 2 | 2 | |
| 3 | 3 | class SS_HTML5Value extends SS_HTMLValue { |
| 4 | 4 | |
| 5 | - public function setContent($content) { |
|
| 6 | - require_once(HTML5LIB_PATH.'/HTML5/Parser.php'); |
|
| 5 | + public function setContent($content) { |
|
| 6 | + require_once(HTML5LIB_PATH.'/HTML5/Parser.php'); |
|
| 7 | 7 | |
| 8 | - // Convert any errors to exceptions |
|
| 9 | - set_error_handler( |
|
| 10 | - function($no, $str){ |
|
| 11 | - throw new Exception("HTML Parse Error: ".$str); |
|
| 12 | - }, |
|
| 13 | - error_reporting() |
|
| 14 | - ); |
|
| 8 | + // Convert any errors to exceptions |
|
| 9 | + set_error_handler( |
|
| 10 | + function($no, $str){ |
|
| 11 | + throw new Exception("HTML Parse Error: ".$str); |
|
| 12 | + }, |
|
| 13 | + error_reporting() |
|
| 14 | + ); |
|
| 15 | 15 | |
| 16 | - // Use HTML5lib to parse the HTML fragment |
|
| 17 | - try { |
|
| 18 | - $document = HTML5_Parser::parse( |
|
| 19 | - '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>'. |
|
| 20 | - "<body>$content</body></html>" |
|
| 21 | - ); |
|
| 22 | - } |
|
| 23 | - catch (Exception $e) { |
|
| 24 | - $document = false; |
|
| 25 | - } |
|
| 16 | + // Use HTML5lib to parse the HTML fragment |
|
| 17 | + try { |
|
| 18 | + $document = HTML5_Parser::parse( |
|
| 19 | + '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>'. |
|
| 20 | + "<body>$content</body></html>" |
|
| 21 | + ); |
|
| 22 | + } |
|
| 23 | + catch (Exception $e) { |
|
| 24 | + $document = false; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - // Disable our error handler (restoring to previous value) |
|
| 28 | - restore_error_handler(); |
|
| 27 | + // Disable our error handler (restoring to previous value) |
|
| 28 | + restore_error_handler(); |
|
| 29 | 29 | |
| 30 | - // If we couldn't parse the HTML, set the error state |
|
| 31 | - if ($document) $this->setDocument($document); |
|
| 32 | - else $this->setInvalid(); |
|
| 33 | - } |
|
| 30 | + // If we couldn't parse the HTML, set the error state |
|
| 31 | + if ($document) $this->setDocument($document); |
|
| 32 | + else $this->setInvalid(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | // set up bits for UTF-8 |
| 91 | 91 | $x = ($code & 0x3F) | 0x80; |
| 92 | 92 | if ($code < 0x800) { |
| 93 | - $y = (($code & 0x7FF) >> 6) | 0xC0; |
|
| 93 | + $y = (($code & 0x7FF) >> 6) | 0xC0; |
|
| 94 | 94 | } else { |
| 95 | 95 | $y = (($code & 0xFC0) >> 6) | 0x80; |
| 96 | 96 | if($code < 0x10000) { |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | ( |
| 157 | 157 | $this->content_model === self::RCDATA || |
| 158 | 158 | $this->content_model === self::CDATA |
| 159 | - ) && |
|
| 159 | + ) && |
|
| 160 | 160 | !$escape |
| 161 | 161 | ); |
| 162 | 162 | $gt_cond = |
@@ -232,76 +232,76 @@ |
||
| 232 | 232 | $public = is_null($token['public']) ? false : strtolower($token['public']); |
| 233 | 233 | $system = is_null($token['system']) ? false : strtolower($token['system']); |
| 234 | 234 | $publicStartsWithForQuirks = array( |
| 235 | - "+//silmaril//dtd html pro v0r11 19970101//", |
|
| 236 | - "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", |
|
| 237 | - "-//as//dtd html 3.0 aswedit + extensions//", |
|
| 238 | - "-//ietf//dtd html 2.0 level 1//", |
|
| 239 | - "-//ietf//dtd html 2.0 level 2//", |
|
| 240 | - "-//ietf//dtd html 2.0 strict level 1//", |
|
| 241 | - "-//ietf//dtd html 2.0 strict level 2//", |
|
| 242 | - "-//ietf//dtd html 2.0 strict//", |
|
| 243 | - "-//ietf//dtd html 2.0//", |
|
| 244 | - "-//ietf//dtd html 2.1e//", |
|
| 245 | - "-//ietf//dtd html 3.0//", |
|
| 246 | - "-//ietf//dtd html 3.2 final//", |
|
| 247 | - "-//ietf//dtd html 3.2//", |
|
| 248 | - "-//ietf//dtd html 3//", |
|
| 249 | - "-//ietf//dtd html level 0//", |
|
| 250 | - "-//ietf//dtd html level 1//", |
|
| 251 | - "-//ietf//dtd html level 2//", |
|
| 252 | - "-//ietf//dtd html level 3//", |
|
| 253 | - "-//ietf//dtd html strict level 0//", |
|
| 254 | - "-//ietf//dtd html strict level 1//", |
|
| 255 | - "-//ietf//dtd html strict level 2//", |
|
| 256 | - "-//ietf//dtd html strict level 3//", |
|
| 257 | - "-//ietf//dtd html strict//", |
|
| 258 | - "-//ietf//dtd html//", |
|
| 259 | - "-//metrius//dtd metrius presentational//", |
|
| 260 | - "-//microsoft//dtd internet explorer 2.0 html strict//", |
|
| 261 | - "-//microsoft//dtd internet explorer 2.0 html//", |
|
| 262 | - "-//microsoft//dtd internet explorer 2.0 tables//", |
|
| 263 | - "-//microsoft//dtd internet explorer 3.0 html strict//", |
|
| 264 | - "-//microsoft//dtd internet explorer 3.0 html//", |
|
| 265 | - "-//microsoft//dtd internet explorer 3.0 tables//", |
|
| 266 | - "-//netscape comm. corp.//dtd html//", |
|
| 267 | - "-//netscape comm. corp.//dtd strict html//", |
|
| 268 | - "-//o'reilly and associates//dtd html 2.0//", |
|
| 269 | - "-//o'reilly and associates//dtd html extended 1.0//", |
|
| 270 | - "-//o'reilly and associates//dtd html extended relaxed 1.0//", |
|
| 271 | - "-//spyglass//dtd html 2.0 extended//", |
|
| 272 | - "-//sq//dtd html 2.0 hotmetal + extensions//", |
|
| 273 | - "-//sun microsystems corp.//dtd hotjava html//", |
|
| 274 | - "-//sun microsystems corp.//dtd hotjava strict html//", |
|
| 275 | - "-//w3c//dtd html 3 1995-03-24//", |
|
| 276 | - "-//w3c//dtd html 3.2 draft//", |
|
| 277 | - "-//w3c//dtd html 3.2 final//", |
|
| 278 | - "-//w3c//dtd html 3.2//", |
|
| 279 | - "-//w3c//dtd html 3.2s draft//", |
|
| 280 | - "-//w3c//dtd html 4.0 frameset//", |
|
| 281 | - "-//w3c//dtd html 4.0 transitional//", |
|
| 282 | - "-//w3c//dtd html experimental 19960712//", |
|
| 283 | - "-//w3c//dtd html experimental 970421//", |
|
| 284 | - "-//w3c//dtd w3 html//", |
|
| 285 | - "-//w3o//dtd w3 html 3.0//", |
|
| 286 | - "-//webtechs//dtd mozilla html 2.0//", |
|
| 287 | - "-//webtechs//dtd mozilla html//", |
|
| 235 | + "+//silmaril//dtd html pro v0r11 19970101//", |
|
| 236 | + "-//advasoft ltd//dtd html 3.0 aswedit + extensions//", |
|
| 237 | + "-//as//dtd html 3.0 aswedit + extensions//", |
|
| 238 | + "-//ietf//dtd html 2.0 level 1//", |
|
| 239 | + "-//ietf//dtd html 2.0 level 2//", |
|
| 240 | + "-//ietf//dtd html 2.0 strict level 1//", |
|
| 241 | + "-//ietf//dtd html 2.0 strict level 2//", |
|
| 242 | + "-//ietf//dtd html 2.0 strict//", |
|
| 243 | + "-//ietf//dtd html 2.0//", |
|
| 244 | + "-//ietf//dtd html 2.1e//", |
|
| 245 | + "-//ietf//dtd html 3.0//", |
|
| 246 | + "-//ietf//dtd html 3.2 final//", |
|
| 247 | + "-//ietf//dtd html 3.2//", |
|
| 248 | + "-//ietf//dtd html 3//", |
|
| 249 | + "-//ietf//dtd html level 0//", |
|
| 250 | + "-//ietf//dtd html level 1//", |
|
| 251 | + "-//ietf//dtd html level 2//", |
|
| 252 | + "-//ietf//dtd html level 3//", |
|
| 253 | + "-//ietf//dtd html strict level 0//", |
|
| 254 | + "-//ietf//dtd html strict level 1//", |
|
| 255 | + "-//ietf//dtd html strict level 2//", |
|
| 256 | + "-//ietf//dtd html strict level 3//", |
|
| 257 | + "-//ietf//dtd html strict//", |
|
| 258 | + "-//ietf//dtd html//", |
|
| 259 | + "-//metrius//dtd metrius presentational//", |
|
| 260 | + "-//microsoft//dtd internet explorer 2.0 html strict//", |
|
| 261 | + "-//microsoft//dtd internet explorer 2.0 html//", |
|
| 262 | + "-//microsoft//dtd internet explorer 2.0 tables//", |
|
| 263 | + "-//microsoft//dtd internet explorer 3.0 html strict//", |
|
| 264 | + "-//microsoft//dtd internet explorer 3.0 html//", |
|
| 265 | + "-//microsoft//dtd internet explorer 3.0 tables//", |
|
| 266 | + "-//netscape comm. corp.//dtd html//", |
|
| 267 | + "-//netscape comm. corp.//dtd strict html//", |
|
| 268 | + "-//o'reilly and associates//dtd html 2.0//", |
|
| 269 | + "-//o'reilly and associates//dtd html extended 1.0//", |
|
| 270 | + "-//o'reilly and associates//dtd html extended relaxed 1.0//", |
|
| 271 | + "-//spyglass//dtd html 2.0 extended//", |
|
| 272 | + "-//sq//dtd html 2.0 hotmetal + extensions//", |
|
| 273 | + "-//sun microsystems corp.//dtd hotjava html//", |
|
| 274 | + "-//sun microsystems corp.//dtd hotjava strict html//", |
|
| 275 | + "-//w3c//dtd html 3 1995-03-24//", |
|
| 276 | + "-//w3c//dtd html 3.2 draft//", |
|
| 277 | + "-//w3c//dtd html 3.2 final//", |
|
| 278 | + "-//w3c//dtd html 3.2//", |
|
| 279 | + "-//w3c//dtd html 3.2s draft//", |
|
| 280 | + "-//w3c//dtd html 4.0 frameset//", |
|
| 281 | + "-//w3c//dtd html 4.0 transitional//", |
|
| 282 | + "-//w3c//dtd html experimental 19960712//", |
|
| 283 | + "-//w3c//dtd html experimental 970421//", |
|
| 284 | + "-//w3c//dtd w3 html//", |
|
| 285 | + "-//w3o//dtd w3 html 3.0//", |
|
| 286 | + "-//webtechs//dtd mozilla html 2.0//", |
|
| 287 | + "-//webtechs//dtd mozilla html//", |
|
| 288 | 288 | ); |
| 289 | 289 | $publicSetToForQuirks = array( |
| 290 | - "-//w3o//dtd w3 html strict 3.0//", |
|
| 291 | - "-/w3c/dtd html 4.0 transitional/en", |
|
| 292 | - "html", |
|
| 290 | + "-//w3o//dtd w3 html strict 3.0//", |
|
| 291 | + "-/w3c/dtd html 4.0 transitional/en", |
|
| 292 | + "html", |
|
| 293 | 293 | ); |
| 294 | 294 | $publicStartsWithAndSystemForQuirks = array( |
| 295 | - "-//w3c//dtd html 4.01 frameset//", |
|
| 296 | - "-//w3c//dtd html 4.01 transitional//", |
|
| 295 | + "-//w3c//dtd html 4.01 frameset//", |
|
| 296 | + "-//w3c//dtd html 4.01 transitional//", |
|
| 297 | 297 | ); |
| 298 | 298 | $publicStartsWithForLimitedQuirks = array( |
| 299 | - "-//w3c//dtd xhtml 1.0 frameset//", |
|
| 300 | - "-//w3c//dtd xhtml 1.0 transitional//", |
|
| 299 | + "-//w3c//dtd xhtml 1.0 frameset//", |
|
| 300 | + "-//w3c//dtd xhtml 1.0 transitional//", |
|
| 301 | 301 | ); |
| 302 | 302 | $publicStartsWithAndSystemForLimitedQuirks = array( |
| 303 | - "-//w3c//dtd html 4.01 frameset//", |
|
| 304 | - "-//w3c//dtd html 4.01 transitional//", |
|
| 303 | + "-//w3c//dtd html 4.01 frameset//", |
|
| 304 | + "-//w3c//dtd html 4.01 transitional//", |
|
| 305 | 305 | ); |
| 306 | 306 | // first, do easy checks |
| 307 | 307 | if ( |