http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89710
Revision: 89710
Author: preilly
Date: 2011-06-07 23:05:05 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
add back json support
Modified Paths:
--------------
trunk/extensions/PatchOutputMobile/PatchOutputMobile.php
Modified: trunk/extensions/PatchOutputMobile/PatchOutputMobile.php
===================================================================
--- trunk/extensions/PatchOutputMobile/PatchOutputMobile.php 2011-06-07
22:34:17 UTC (rev 89709)
+++ trunk/extensions/PatchOutputMobile/PatchOutputMobile.php 2011-06-07
23:05:05 UTC (rev 89710)
@@ -39,7 +39,7 @@
'onOutputPageBeforeHTML' );
class ExtPatchOutputMobile {
- const VERSION = '0.4.2';
+ const VERSION = '0.4.3';
private $doc;
@@ -352,6 +352,8 @@
$title = 'Wikipedia';
}
+ $format = isset( $_GET['format'] ) ? $_GET['format'] : '';
+
$dir = self::$dir;
$code = self::$code;
$regularWikipedia =
self::$messages['patch-output-mobile-regular-wikipedia'];
@@ -371,13 +373,22 @@
require( 'views/layout/application.wml.php' );
}
- if ( $this->contentFormat == 'XHTML' ) {
+ if ( $this->contentFormat == 'XHTML' && $format != 'json' ) {
require( 'views/notices/_donate.html.php' );
require( 'views/layout/_search_webkit.html.php' );
require( 'views/layout/_footmenu_default.html.php' );
require( 'views/layout/application.html.php' );
}
+ if ( $format === 'json' ) {
+ header( 'Content-Type: application/json' );
+ header( 'Content-Disposition: attachment;
filename="data.js";' );
+ $json_data = array();
+ $json_data['title'] = $title;
+ $json_data['html'] = $contentHtml;
+ return json_encode( $json_data );
+ }
+
return $applicationHtml;
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs