[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/parser/ -> MWTidy.php (summary)

HTML validation and correction This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 291 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

MWTidyWrapper:: (4 methods):
  __construct()
  getWrapped()
  replaceCallback()
  postprocess()

MWTidy:: (4 methods):
  tidy()
  checkErrors()
  execExternalTidy()
  execInternalTidy()


Class: MWTidyWrapper  - X-Ref

Class used to hide mw:editsection tokens from Tidy so that it doesn't break them
or break on them. This is a bit of a hack for now, but hopefully in the future
we may create a real postprocessor or something that will replace this.
It's called wrapper because for now it basically takes over MWTidy::tidy's task
of wrapping the text in a xhtml block

This re-uses some of the parser's UNIQ tricks, though some of it is private so it's
duplicated. Perhaps we should create an abstract marker hiding class.

__construct()   X-Ref


getWrapped( $text )   X-Ref

param: string $text
return: string

replaceCallback( $m )   X-Ref

param: array $m
return: string

postprocess( $text )   X-Ref

param: string $text
return: string

Class: MWTidy  - X-Ref

Class to interact with HTML tidy

Either the external tidy program or the in-process tidy extension
will be used depending on availability. Override the default
$wgTidyInternal setting to disable the internal if it's not working.

tidy( $text )   X-Ref
Interface with html tidy, used if $wgUseTidy = true.
If tidy isn't able to correct the markup, the original will be
returned in all its glory with a warning comment appended.

param: string $text Hideous HTML input
return: string Corrected HTML output

checkErrors( $text, &$errorStr = null )   X-Ref
Check HTML for errors, used if $wgValidateAllHtml = true.

param: string $text
param: string &$errorStr Return the error string
return: bool Whether the HTML is valid

execExternalTidy( $text, $stderr = false, &$retval = null )   X-Ref
Spawn an external HTML tidy process and get corrected markup back from it.
Also called in OutputHandler.php for full page validation

param: string $text HTML to check
param: bool $stderr Whether to read result from STDERR rather than STDOUT
param: int &$retval Exit code (-1 on internal error)
return: string|null

execInternalTidy( $text, $stderr = false, &$retval = null )   X-Ref
Use the HTML tidy extension to use the tidy library in-process,
saving the overhead of spawning a new process.

param: string $text HTML to check
param: bool $stderr Whether to read result from error status instead of output
param: int &$retval Exit code (-1 on internal error)
return: string|null



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1