Index: trunk/phase3/includes/XmlTypeCheck.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * well-formed XML. Note that this doesn't check schema validity. |
8 | 8 | */ |
9 | 9 | public $wellFormed = false; |
10 | | - |
| 10 | + |
11 | 11 | /** |
12 | 12 | * Will be set to true if the optional element filter returned |
13 | 13 | * a match at some point. |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | $this->filterCallback = $filterCallback; |
33 | 33 | $this->run( $file ); |
34 | 34 | } |
35 | | - |
| 35 | + |
36 | 36 | /** |
37 | 37 | * Get the root element. Simple accessor to $rootElement |
38 | 38 | * |
— | — | @@ -52,21 +52,26 @@ |
53 | 53 | |
54 | 54 | xml_set_element_handler( $parser, array( $this, 'rootElementOpen' ), false ); |
55 | 55 | |
56 | | - $file = fopen( $fname, "rb" ); |
57 | | - do { |
58 | | - $chunk = fread( $file, 32768 ); |
59 | | - $ret = xml_parse( $parser, $chunk, feof( $file ) ); |
60 | | - if( $ret == 0 ) { |
61 | | - // XML isn't well-formed! |
| 56 | + if ( file_exists( $fname ) ) { |
| 57 | + $file = fopen( $fname, "rb" ); |
| 58 | + if ( $file ) { |
| 59 | + do { |
| 60 | + $chunk = fread( $file, 32768 ); |
| 61 | + $ret = xml_parse( $parser, $chunk, feof( $file ) ); |
| 62 | + if( $ret == 0 ) { |
| 63 | + // XML isn't well-formed! |
| 64 | + fclose( $file ); |
| 65 | + xml_parser_free( $parser ); |
| 66 | + return; |
| 67 | + } |
| 68 | + } while( !feof( $file ) ); |
| 69 | + |
62 | 70 | fclose( $file ); |
63 | | - xml_parser_free( $parser ); |
64 | | - return; |
65 | 71 | } |
66 | | - } while( !feof( $file ) ); |
| 72 | + } |
67 | 73 | |
68 | 74 | $this->wellFormed = true; |
69 | 75 | |
70 | | - fclose( $file ); |
71 | 76 | xml_parser_free( $parser ); |
72 | 77 | } |
73 | 78 | |
— | — | @@ -77,7 +82,7 @@ |
78 | 83 | */ |
79 | 84 | private function rootElementOpen( $parser, $name, $attribs ) { |
80 | 85 | $this->rootElement = $name; |
81 | | - |
| 86 | + |
82 | 87 | if( is_callable( $this->filterCallback ) ) { |
83 | 88 | xml_set_element_handler( $parser, array( $this, 'elementOpen' ), false ); |
84 | 89 | $this->elementOpen( $parser, $name, $attribs ); |
Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -28,9 +28,9 @@ |
29 | 29 | * Contextual title, used when images are being screened |
30 | 30 | * against the bad image list |
31 | 31 | */ |
32 | | - private $contextTitle = false; |
| 32 | + protected $contextTitle = false; |
33 | 33 | |
34 | | - private $mAttribs = array(); |
| 34 | + protected $mAttribs = array(); |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Fixed margins |