4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
24 * Initialize and detect the tidy support
31 * Determine if there is a usable tidy.
32 * @param bool $useConfiguration
34 public function __construct( $useConfiguration = false ) {
35 global $wgUseTidy, $wgTidyBin, $wgTidyInternal, $wgTidyConfig,
36 $wgTidyConf, $wgTidyOpts;
38 $this->enabled
= true;
39 if ( $useConfiguration ) {
40 if ( $wgTidyConfig !== null ) {
41 $this->config
= $wgTidyConfig;
42 } elseif ( $wgUseTidy ) {
44 'tidyConfigFile' => $wgTidyConf,
45 'debugComment' => false,
46 'tidyBin' => $wgTidyBin,
47 'tidyCommandLine' => $wgTidyOpts
49 if ( $wgTidyInternal ) {
50 $this->config
['driver'] = wfIsHHVM() ?
'RaggettInternalHHVM' : 'RaggettInternalPHP';
52 $this->config
['driver'] = 'RaggettExternal';
55 $this->enabled
= false;
58 $this->config
= [ 'driver' => 'RemexHtml' ];
60 if ( !$this->enabled
) {
61 $this->config
= [ 'driver' => 'disabled' ];
66 * Returns true if tidy is usable
70 public function isEnabled() {
71 return $this->enabled
;
74 public function getConfig() {