Index: trunk/phase3/includes/api/ApiFormatDump.php |
— | — | @@ -0,0 +1,64 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * API for MediaWiki 1.8+ |
| 5 | + * |
| 6 | + * Created on August 8, 2010 |
| 7 | + * |
| 8 | + * Copyright © 2010 Soxred93 |
| 9 | + * |
| 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. |
| 14 | + * |
| 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. |
| 19 | + * |
| 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 |
| 24 | + * |
| 25 | + * @file |
| 26 | + */ |
| 27 | + |
| 28 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 29 | + // Eclipse helper - will be ignored in production |
| 30 | + require_once( 'ApiFormatBase.php' ); |
| 31 | +} |
| 32 | + |
| 33 | +/** |
| 34 | + * API PHP's var_dump() output formatter |
| 35 | + * @ingroup API |
| 36 | + */ |
| 37 | +class ApiFormatDump extends ApiFormatBase { |
| 38 | + |
| 39 | + public function __construct( $main, $format ) { |
| 40 | + parent::__construct( $main, $format ); |
| 41 | + } |
| 42 | + |
| 43 | + public function getMimeType() { |
| 44 | + // This looks like it should be text/plain, but IE7 is so |
| 45 | + // brain-damaged it tries to parse text/plain as HTML if it |
| 46 | + // contains HTML tags. Using MIME text/text works around this bug |
| 47 | + return 'text/text'; |
| 48 | + } |
| 49 | + |
| 50 | + public function execute() { |
| 51 | + ob_start(); |
| 52 | + var_dump( $this->getResultData() ); |
| 53 | + $result = ob_get_contents(); |
| 54 | + ob_end_clean(); |
| 55 | + $this->printText( $result ); |
| 56 | + } |
| 57 | + |
| 58 | + public function getDescription() { |
| 59 | + return 'Output data in PHP\'s var_dump() format' . parent::getDescription(); |
| 60 | + } |
| 61 | + |
| 62 | + public function getVersion() { |
| 63 | + return __CLASS__ . ': $Id$'; |
| 64 | + } |
| 65 | +} |
Property changes on: trunk/phase3/includes/api/ApiFormatDump.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 66 | + native |
Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -100,7 +100,9 @@ |
101 | 101 | 'txt' => 'ApiFormatTxt', |
102 | 102 | 'txtfm' => 'ApiFormatTxt', |
103 | 103 | 'dbg' => 'ApiFormatDbg', |
104 | | - 'dbgfm' => 'ApiFormatDbg' |
| 104 | + 'dbgfm' => 'ApiFormatDbg', |
| 105 | + 'dump' => 'ApiFormatDump', |
| 106 | + 'dumpfm' => 'ApiFormatDump', |
105 | 107 | ); |
106 | 108 | |
107 | 109 | /** |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -260,6 +260,7 @@ |
261 | 261 | 'ApiFeedWatchlist' => 'includes/api/ApiFeedWatchlist.php', |
262 | 262 | 'ApiFormatBase' => 'includes/api/ApiFormatBase.php', |
263 | 263 | 'ApiFormatDbg' => 'includes/api/ApiFormatDbg.php', |
| 264 | + 'ApiFormatDump' => 'includes/api/ApiFormatDump.php', |
264 | 265 | 'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php', |
265 | 266 | 'ApiFormatJson' => 'includes/api/ApiFormatJson.php', |
266 | 267 | 'ApiFormatPhp' => 'includes/api/ApiFormatPhp.php', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -341,6 +341,7 @@ |
342 | 342 | * (bug 24330) Add &redirect parameter to ?action=edit |
343 | 343 | * (bug 24722) For list=allusers&auprop=blockinfo, only show blockedby and blockreason if |
344 | 344 | the user is actually blocked. |
| 345 | +* Add format=dump and format=dumpfm, outputs results in PHP's var_dump() format. |
345 | 346 | |
346 | 347 | === Languages updated in 1.17 === |
347 | 348 | |