3 * Dump output filter class.
4 * This just does output filtering and streaming; XML formatting is done
5 * higher up, so be careful in what you do.
7 * Copyright © 2003, 2005, 2006 Brion Vibber <brion@pobox.com>
8 * https://www.mediawiki.org/
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * http://www.gnu.org/copyleft/gpl.html
34 * FIXME will need to be made protected whenever legacy code
42 protected $sendingThisPage;
45 * @param DumpOutput $sink
47 function __construct( &$sink ) {
52 * @param string $string
54 function writeOpenStream( $string ) {
55 $this->sink
->writeOpenStream( $string );
59 * @param string $string
61 function writeCloseStream( $string ) {
62 $this->sink
->writeCloseStream( $string );
67 * @param string $string
69 function writeOpenPage( $page, $string ) {
70 $this->sendingThisPage
= $this->pass( $page, $string );
71 if ( $this->sendingThisPage
) {
72 $this->sink
->writeOpenPage( $page, $string );
77 * @param string $string
79 function writeClosePage( $string ) {
80 if ( $this->sendingThisPage
) {
81 $this->sink
->writeClosePage( $string );
82 $this->sendingThisPage
= false;
88 * @param string $string
90 function writeRevision( $rev, $string ) {
91 if ( $this->sendingThisPage
) {
92 $this->sink
->writeRevision( $rev, $string );
98 * @param string $string
100 function writeLogItem( $rev, $string ) {
101 $this->sink
->writeRevision( $rev, $string );
105 * @param string $newname
107 function closeRenameAndReopen( $newname ) {
108 $this->sink
->closeRenameAndReopen( $newname );
112 * @param string $newname
115 function closeAndRename( $newname, $open = false ) {
116 $this->sink
->closeAndRename( $newname, $open );
122 function getFilenames() {
123 return $this->sink
->getFilenames();
127 * Override for page-based filter types.
128 * @param object $page
131 function pass( $page ) {