More wikia upstreaming
This commit is contained in:
parent
3901d9c88c
commit
c5a7c0517d
2 changed files with 20 additions and 15 deletions
|
|
@ -28,9 +28,9 @@ class ImageGallery {
|
||||||
* Contextual title, used when images are being screened
|
* Contextual title, used when images are being screened
|
||||||
* against the bad image list
|
* against the bad image list
|
||||||
*/
|
*/
|
||||||
private $contextTitle = false;
|
protected $contextTitle = false;
|
||||||
|
|
||||||
private $mAttribs = array();
|
protected $mAttribs = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed margins
|
* Fixed margins
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class XmlTypeCheck {
|
||||||
* well-formed XML. Note that this doesn't check schema validity.
|
* well-formed XML. Note that this doesn't check schema validity.
|
||||||
*/
|
*/
|
||||||
public $wellFormed = false;
|
public $wellFormed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will be set to true if the optional element filter returned
|
* Will be set to true if the optional element filter returned
|
||||||
* a match at some point.
|
* a match at some point.
|
||||||
|
|
@ -31,7 +31,7 @@ class XmlTypeCheck {
|
||||||
$this->filterCallback = $filterCallback;
|
$this->filterCallback = $filterCallback;
|
||||||
$this->run( $file );
|
$this->run( $file );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root element. Simple accessor to $rootElement
|
* Get the root element. Simple accessor to $rootElement
|
||||||
*
|
*
|
||||||
|
|
@ -52,21 +52,26 @@ class XmlTypeCheck {
|
||||||
|
|
||||||
xml_set_element_handler( $parser, array( $this, 'rootElementOpen' ), false );
|
xml_set_element_handler( $parser, array( $this, 'rootElementOpen' ), false );
|
||||||
|
|
||||||
$file = fopen( $fname, "rb" );
|
if ( file_exists( $fname ) ) {
|
||||||
do {
|
$file = fopen( $fname, "rb" );
|
||||||
$chunk = fread( $file, 32768 );
|
if ( $file ) {
|
||||||
$ret = xml_parse( $parser, $chunk, feof( $file ) );
|
do {
|
||||||
if( $ret == 0 ) {
|
$chunk = fread( $file, 32768 );
|
||||||
// XML isn't well-formed!
|
$ret = xml_parse( $parser, $chunk, feof( $file ) );
|
||||||
|
if( $ret == 0 ) {
|
||||||
|
// XML isn't well-formed!
|
||||||
|
fclose( $file );
|
||||||
|
xml_parser_free( $parser );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} while( !feof( $file ) );
|
||||||
|
|
||||||
fclose( $file );
|
fclose( $file );
|
||||||
xml_parser_free( $parser );
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} while( !feof( $file ) );
|
}
|
||||||
|
|
||||||
$this->wellFormed = true;
|
$this->wellFormed = true;
|
||||||
|
|
||||||
fclose( $file );
|
|
||||||
xml_parser_free( $parser );
|
xml_parser_free( $parser );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +82,7 @@ class XmlTypeCheck {
|
||||||
*/
|
*/
|
||||||
private function rootElementOpen( $parser, $name, $attribs ) {
|
private function rootElementOpen( $parser, $name, $attribs ) {
|
||||||
$this->rootElement = $name;
|
$this->rootElement = $name;
|
||||||
|
|
||||||
if( is_callable( $this->filterCallback ) ) {
|
if( is_callable( $this->filterCallback ) ) {
|
||||||
xml_set_element_handler( $parser, array( $this, 'elementOpen' ), false );
|
xml_set_element_handler( $parser, array( $this, 'elementOpen' ), false );
|
||||||
$this->elementOpen( $parser, $name, $attribs );
|
$this->elementOpen( $parser, $name, $attribs );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue