MediaWiki  master
MWTidy.php
Go to the documentation of this file.
1 <?php
29 class 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 }
MWTidy\isEnabled
static isEnabled()
Definition: MWTidy.php:51
MediaWiki\Tidy\RemexDriver
Definition: RemexDriver.php:12
MWTidy\factory
static factory(array $config=null)
Create a new Tidy driver object from configuration.
Definition: MWTidy.php:75
MWTidy\$instance
static $instance
Definition: MWTidy.php:30
MWTidy
Class to interact with and configure Remex tidy.
Definition: MWTidy.php:29
$wgTidyConfig
$wgTidyConfig
Configuration for HTML postprocessing tool.
Definition: DefaultSettings.php:4616
MWTidy\singleton
static singleton()
Definition: MWTidy.php:59
MWTidy\destroySingleton
static destroySingleton()
Destroy the current singleton instance.
Definition: MWTidy.php:83
MWTidy\tidy
static tidy( $text)
Interface with Remex tidy.
Definition: MWTidy.php:42