MediaWiki REL1_35
MWTidy.php
Go to the documentation of this file.
1<?php
29class MWTidy {
30 private static $instance;
31
42 public static function tidy( $text ) {
43 $driver = self::singleton();
44 return $driver->tidy( $text );
45 }
46
51 public static function isEnabled() {
52 return true;
53 }
54
59 public static function singleton() {
60 global $wgTidyConfig;
61 if ( self::$instance === null ) {
62 self::$instance = self::factory( $wgTidyConfig );
63 }
64 return self::$instance;
65 }
66
75 public static function factory( array $config = null ) {
76 return new MediaWiki\Tidy\RemexDriver( $config ?? [] );
77 }
78
83 public static function destroySingleton() {
84 self::$instance = null;
85 }
86}
$wgTidyConfig
Configuration for HTML postprocessing tool.
Class to interact with and configure Remex tidy.
Definition MWTidy.php:29
static $instance
Definition MWTidy.php:30
static singleton()
Definition MWTidy.php:59
static factory(array $config=null)
Create a new Tidy driver object from configuration.
Definition MWTidy.php:75
static destroySingleton()
Destroy the current singleton instance.
Definition MWTidy.php:83
static tidy( $text)
Interface with Remex tidy.
Definition MWTidy.php:42
static isEnabled()
Definition MWTidy.php:51