Mercurial > SimpleWebPresenter
comparison OnlineURIValidator.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 | OnlineURIValidator.inc@2370f4450983 |
| children |
comparison
equal
deleted
inserted
replaced
| 133:00255ca89459 | 134:b6b4a58c7625 |
|---|---|
| 1 <?php | |
| 2 include_once 'ScriptIncludeCache.inc.php'; | |
| 3 | |
| 4 /// @cond | |
| 5 $baseDir = dirname(__FILE__); | |
| 6 $cache = ScriptIncludeCache::instance(__FILE__); | |
| 7 $cache->includeOnce('Http.inc.php', $baseDir); | |
| 8 $cache->includeOnce('OnlineValidator.inc.php', $baseDir); | |
| 9 /// @endcond | |
| 10 | |
| 11 /** | |
| 12 * Defines a validator which uses an online validator and a URI to the | |
| 13 * content | |
| 14 */ | |
| 15 class OnlineURIValidator extends OnlineValidator | |
| 16 { | |
| 17 private $uri; | |
| 18 | |
| 19 /** | |
| 20 * Constructs an OnlineURIValidator | |
| 21 * | |
| 22 * @param $uri The uri to validate | |
| 23 */ | |
| 24 function __construct($uri) | |
| 25 { | |
| 26 $this->uri = $uri; | |
| 27 } | |
| 28 | |
| 29 function check() | |
| 30 { | |
| 31 $request = urlencode($this->uri); | |
| 32 $query= '?uri=' . $request; | |
| 33 | |
| 34 $headers = Http::getHeaders($this->validator_url . $query, 5); | |
| 35 return $headers['X-W3C-Validator-Status'] === "Valid"; | |
| 36 } | |
| 37 | |
| 38 /** | |
| 39 * Gets the URI for this validator | |
| 40 * | |
| 41 * @return string with the URI | |
| 42 */ | |
| 43 function getUri() | |
| 44 { | |
| 45 return $this->uri; | |
| 46 } | |
| 47 | |
| 48 } | |
| 49 ?> |
