r89711 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89710‎ | r89711 | r89712 >
Date:23:16, 7 June 2011
Author:preilly
Status:deferred
Tags:
Comment:
add callback support for json payload
Modified paths:
  • /trunk/extensions/PatchOutputMobile/PatchOutputMobile.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PatchOutputMobile/PatchOutputMobile.php
@@ -39,7 +39,7 @@
4040 'onOutputPageBeforeHTML' );
4141
4242 class ExtPatchOutputMobile {
43 - const VERSION = '0.4.3';
 43+ const VERSION = '0.4.4';
4444
4545 private $doc;
4646
@@ -386,7 +386,16 @@
387387 $json_data = array();
388388 $json_data['title'] = $title;
389389 $json_data['html'] = $contentHtml;
390 - return json_encode( $json_data );
 390+
 391+ $callback = isset( $_GET['callback'] ) ? $_GET['callback'] : '';
 392+
 393+ $json = json_encode( $json_data );
 394+
 395+ if ( !empty( $callback ) ) {
 396+ $json = urlencode( $callback ) . '(' . $json . ')';
 397+ }
 398+
 399+ return $json;
391400 }
392401
393402 return $applicationHtml;

Status & tagging log