ApiFormatTxt.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * Created on Oct 22, 2006
  4. *
  5. * API for MediaWiki 1.8+
  6. *
  7. * Copyright (C) 2008 Roan Kattouw <Firstname>.<Lastname>@home.nl
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. * http://www.gnu.org/copyleft/gpl.html
  23. */
  24. if (!defined('MEDIAWIKI')) {
  25. // Eclipse helper - will be ignored in production
  26. require_once ('ApiFormatBase.php');
  27. }
  28. /**
  29. * @ingroup API
  30. */
  31. class ApiFormatTxt extends ApiFormatBase {
  32. public function __construct($main, $format) {
  33. parent :: __construct($main, $format);
  34. }
  35. public function getMimeType() {
  36. # This looks like it should be text/plain, but IE7 is so
  37. # brain-damaged it tries to parse text/plain as HTML if it
  38. # contains HTML tags. Using MIME text/text works around this bug
  39. return 'text/text';
  40. }
  41. public function execute() {
  42. $this->printText(print_r($this->getResultData(), true));
  43. }
  44. public function getDescription() {
  45. return 'Output data in PHP\'s print_r() format' . parent :: getDescription();
  46. }
  47. public function getVersion() {
  48. return __CLASS__ . ': $Id: ApiFormatTxt.php 35098 2008-05-20 17:13:28Z ialex $';
  49. }
  50. }