comparison OnlineBufferValidator.inc @ 93:8aadd7a23b68

Moved some functionality from common-functions into Http class. Reorganized Validator into a class hierarchy. Added functionality for validating with a buffer in addition to URLs.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 18 Oct 2012 16:44:48 +0200
parents
children 2370f4450983
comparison
equal deleted inserted replaced
92:f468365813c9 93:8aadd7a23b68
1 <?php
2 include_once 'ScriptIncludeCache.inc';
3
4 /// @cond
5 $baseDir = dirname(__FILE__);
6 $cache = ScriptIncludeCache::instance(__FILE__);
7 $cache->includeOnce('Http.inc', $baseDir);
8 $cache->includeOnce('OnlineValidator.inc', $baseDir);
9 /// @endcond
10
11
12 class OnlineBufferValidator extends OnlineValidator
13 {
14
15 private $buffer;
16
17 function __construct($buffer)
18 {
19 $this->buffer = $buffer;
20 }
21
22 function check()
23 {
24 $params = array( 'fragment' => $this->buffer);
25
26 $headers = Http::postHeaders($this->validator_url , $params, 2);
27 return $headers['X-W3C-Validator-Status'] === "Valid";
28 }
29 }
30 ?>