Merge "Drop index oi_name_archive_name on table oldimage"
[lhc/web/wiklou.git] / includes / tidy / TidyDriverBase.php
1 <?php
2
3 namespace MediaWiki\Tidy;
4
5 /**
6 * Base class for HTML cleanup utilities
7 */
8 abstract class TidyDriverBase {
9 protected $config;
10
11 function __construct( $config ) {
12 $this->config = $config;
13 }
14
15 /**
16 * Return true if validate() can be used
17 */
18 public function supportsValidate() {
19 return false;
20 }
21
22 /**
23 * Check HTML for errors, used if $wgValidateAllHtml = true.
24 *
25 * @param string $text
26 * @param string &$errorStr Return the error string
27 * @return bool Whether the HTML is valid
28 */
29 public function validate( $text, &$errorStr ) {
30 throw new \MWException( static::class . ' does not support validate()' );
31 }
32
33 /**
34 * Clean up HTML
35 *
36 * @param string $text HTML document fragment to clean up
37 * @return string The corrected HTML output
38 */
39 abstract public function tidy( $text );
40 }