Mercurial > SimpleWebPresenter
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OnlineBufferValidator.inc Thu Oct 18 16:44:48 2012 +0200 @@ -0,0 +1,30 @@ +<?php +include_once 'ScriptIncludeCache.inc'; + +/// @cond +$baseDir = dirname(__FILE__); +$cache = ScriptIncludeCache::instance(__FILE__); +$cache->includeOnce('Http.inc', $baseDir); +$cache->includeOnce('OnlineValidator.inc', $baseDir); +/// @endcond + + +class OnlineBufferValidator extends OnlineValidator +{ + + private $buffer; + + function __construct($buffer) + { + $this->buffer = $buffer; + } + + function check() + { + $params = array( 'fragment' => $this->buffer); + + $headers = Http::postHeaders($this->validator_url , $params, 2); + return $headers['X-W3C-Validator-Status'] === "Valid"; + } +} +?> \ No newline at end of file
