enabled = true; if ( $useConfiguration ) { if ( $wgTidyConfig !== null ) { $this->config = $wgTidyConfig; } elseif ( $wgUseTidy ) { $this->config = [ 'tidyConfigFile' => $wgTidyConf, 'debugComment' => false, 'tidyBin' => $wgTidyBin, 'tidyCommandLine' => $wgTidyOpts ]; if ( $wgTidyInternal ) { $this->config['driver'] = wfIsHHVM() ? 'RaggettInternalHHVM' : 'RaggettInternalPHP'; } else { $this->config['driver'] = 'RaggettExternal'; } } else { $this->enabled = false; } } else { $this->config = [ 'tidyConfigFile' => "$IP/includes/tidy/tidy.conf", 'tidyCommandLine' => '', ]; if ( extension_loaded( 'tidy' ) && ( wfIsHHVM() || class_exists( 'tidy' ) ) ) { $this->config['driver'] = wfIsHHVM() ? 'RaggettInternalHHVM' : 'RaggettInternalPHP'; } else { if ( is_executable( $wgTidyBin ) ) { $this->config['driver'] = 'RaggettExternal'; $this->config['tidyBin'] = $wgTidyBin; } else { $path = Installer::locateExecutableInDefaultPaths( $wgTidyBin ); if ( $path !== false ) { $this->config['driver'] = 'RaggettExternal'; $this->config['tidyBin'] = $wgTidyBin; } else { $this->enabled = false; } } } } if ( !$this->enabled ) { $this->config = [ 'driver' => 'disabled' ]; } } /** * Returns true if tidy is usable * * @return bool */ public function isEnabled() { return $this->enabled; } public function getConfig() { return $this->config; } }