Mercurial > SimpleWebPresenter
view OnlineURIValidator.inc @ 94:2370f4450983
Document functions and move a few functions to more appropriate places.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 18 Oct 2012 17:33:34 +0200 |
| parents | 8aadd7a23b68 |
| children |
line wrap: on
line source
<?php include_once 'ScriptIncludeCache.inc'; /// @cond $baseDir = dirname(__FILE__); $cache = ScriptIncludeCache::instance(__FILE__); $cache->includeOnce('Http.inc', $baseDir); $cache->includeOnce('OnlineValidator.inc', $baseDir); /// @endcond /** * Defines a validator which uses an online validator and a URI to the * content */ class OnlineURIValidator extends OnlineValidator { private $uri; /** * Constructs an OnlineURIValidator * * @param $uri The uri to validate */ function __construct($uri) { $this->uri = $uri; } function check() { $request = urlencode($this->uri); $query= '?uri=' . $request; $headers = Http::getHeaders($this->validator_url . $query, 5); return $headers['X-W3C-Validator-Status'] === "Valid"; } /** * Gets the URI for this validator * * @return string with the URI */ function getUri() { return $this->uri; } } ?>
