ApiFormatYaml.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * Created on Sep 19, 2006
  4. *
  5. * API for MediaWiki 1.8+
  6. *
  7. * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  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 ApiFormatYaml extends ApiFormatBase {
  32. public function __construct($main, $format) {
  33. parent :: __construct($main, $format);
  34. }
  35. public function getMimeType() {
  36. return 'application/yaml';
  37. }
  38. public function execute() {
  39. $this->printText(Spyc :: YAMLDump($this->getResultData()));
  40. }
  41. public function getDescription() {
  42. return 'Output data in YAML format' . parent :: getDescription();
  43. }
  44. public function getVersion() {
  45. return __CLASS__ . ': $Id: ApiFormatYaml.php 35098 2008-05-20 17:13:28Z ialex $';
  46. }
  47. }