Mercurial > SimpleWebPresenter
diff OnlineBufferValidator.inc.php @ 134:b6b4a58c7625
Using .inc.php rather than just .inc for include files.
| author | Tom Fredrik Blenning <bfg@bfgconsult.no> |
|---|---|
| date | Sun, 22 Jan 2023 19:22:00 +0100 |
| parents | OnlineBufferValidator.inc@2370f4450983 |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OnlineBufferValidator.inc.php Sun Jan 22 19:22:00 2023 +0100 @@ -0,0 +1,39 @@ +<?php +include_once 'ScriptIncludeCache.inc.php'; + +/// @cond +$baseDir = dirname(__FILE__); +$cache = ScriptIncludeCache::instance(__FILE__); +$cache->includeOnce('Http.inc.php', $baseDir); +$cache->includeOnce('OnlineValidator.inc.php', $baseDir); +/// @endcond + + +/** + * Defines a validator which uses an online validator and a buffer + * with the content + */ +class OnlineBufferValidator extends OnlineValidator +{ + + private $buffer; + + /** + * Constructs an OnlineURIValidator + * + * @param $buffer The buffer to validate + */ + 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
