Index: trunk/extensions/Collection/Collection.php |
— | — | @@ -192,13 +192,12 @@ |
193 | 193 | # register global Ajax functions: |
194 | 194 | |
195 | 195 | function wfAjaxGetCollection() { |
196 | | - $json = new Services_JSON(); |
197 | 196 | if ( isset( $_SESSION['wsCollection'] ) ) { |
198 | 197 | $collection = $_SESSION['wsCollection']; |
199 | 198 | } else { |
200 | 199 | $collection = array(); |
201 | 200 | } |
202 | | - $r = new AjaxResponse( $json->encode( array( 'collection' => $collection ) ) ); |
| 201 | + $r = new AjaxResponse( FormatJson::encode( array( 'collection' => $collection ) ) ); |
203 | 202 | $r->setContentType( 'application/json' ); |
204 | 203 | return $r; |
205 | 204 | } |
— | — | @@ -231,7 +230,6 @@ |
232 | 231 | $wgAjaxExportList[] = 'wfAjaxPostCollection'; |
233 | 232 | |
234 | 233 | function wfAjaxGetMWServeStatus( $collection_id = '', $writer = 'rl' ) { |
235 | | - $json = new Services_JSON(); |
236 | 234 | $result = SpecialCollection::mwServeCommand( 'render_status', array( |
237 | 235 | 'collection_id' => $collection_id, |
238 | 236 | 'writer' => $writer |
— | — | @@ -239,7 +237,7 @@ |
240 | 238 | if ( isset( $result['status']['progress'] ) ) { |
241 | 239 | $result['status']['progress'] = number_format( $result['status']['progress'], 2, '.', '' ); |
242 | 240 | } |
243 | | - $r = new AjaxResponse( $json->encode( $result ) ); |
| 241 | + $r = new AjaxResponse( FormatJson::encode( $result ) ); |
244 | 242 | $r->setContentType( 'application/json' ); |
245 | 243 | return $r; |
246 | 244 | } |
— | — | @@ -282,10 +280,9 @@ |
283 | 281 | |
284 | 282 | $html = CollectionHooks::getBookCreatorBoxContent( $title, $ajaxHint, $oldid ); |
285 | 283 | |
286 | | - $json = new Services_JSON(); |
287 | 284 | $result = array(); |
288 | 285 | $result['html'] = $html; |
289 | | - $r = new AjaxResponse( $json->encode( $result ) ); |
| 286 | + $r = new AjaxResponse( FormatJson::encode( $result ) ); |
290 | 287 | $r->setContentType( 'application/json' ); |
291 | 288 | return $r; |
292 | 289 | } |
— | — | @@ -303,11 +300,10 @@ |
304 | 301 | $html = ob_get_contents(); |
305 | 302 | ob_end_clean(); |
306 | 303 | |
307 | | - $json = new Services_JSON(); |
308 | 304 | $result = array(); |
309 | 305 | $result['html'] = $html; |
310 | 306 | $result['collection'] = $collection; |
311 | | - $r = new AjaxResponse( $json->encode( $result ) ); |
| 307 | + $r = new AjaxResponse( FormatJson::encode( $result ) ); |
312 | 308 | $r->setContentType( 'application/json' ); |
313 | 309 | return $r; |
314 | 310 | } |
— | — | @@ -368,7 +364,6 @@ |
369 | 365 | function wfAjaxCollectionGetPopupData( $title ) { |
370 | 366 | global $wgScriptPath; |
371 | 367 | |
372 | | - $json = new Services_JSON(); |
373 | 368 | $result = array(); |
374 | 369 | $imagePath = "$wgScriptPath/extensions/Collection/images"; |
375 | 370 | $t = Title::newFromText( $title ); |
— | — | @@ -389,7 +384,7 @@ |
390 | 385 | $result['img'] = "$imagePath/silk-remove.png"; |
391 | 386 | } |
392 | 387 | $result['title'] = $title; |
393 | | - $r = new AjaxResponse( $json->encode( $result ) ); |
| 388 | + $r = new AjaxResponse( FormatJson::encode( $result ) ); |
394 | 389 | $r->setContentType( 'application/json' ); |
395 | 390 | return $r; |
396 | 391 | } |
— | — | @@ -403,7 +398,6 @@ |
404 | 399 | * @return AjaxResponse with JSON-encoded array including HTML fragment. |
405 | 400 | */ |
406 | 401 | function wfCollectionSuggestAction( $action, $article ) { |
407 | | - $json = new Services_JSON(); |
408 | 402 | $result = CollectionSuggest::refresh( $action, $article ); |
409 | 403 | $undoLink = Xml::element( 'a', |
410 | 404 | array( |
— | — | @@ -423,7 +417,7 @@ |
424 | 418 | $undoLink |
425 | 419 | ); |
426 | 420 | $result['collection'] = CollectionSession::getCollection(); |
427 | | - $r = new AjaxResponse( $json->encode( $result ) ); |
| 421 | + $r = new AjaxResponse( FormatJson::encode( $result ) ); |
428 | 422 | $r->setContentType( 'application/json' ); |
429 | 423 | return $r; |
430 | 424 | } |