* * body: array( 'html' => ... )
* * $title and $revision are optional
* POST /local/v3/transform/wikitext/to/html/{$title}{/$revision}
- * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'bodyOnly' => true/false )
+ * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body_only' => true/false )
* * $title is optional
* * $revision is optional
*
unset( $params['URL'] );
}
// set up defaults and merge them with the given params
- $mparams = array_merge( array(
+ $mparams = array_merge( [
'name' => 'parsoid',
'url' => 'http://localhost:8000/',
'prefix' => 'localhost',
'domain' => 'localhost',
'forwardCookies' => false,
'HTTPProxy' => null,
- ), $params );
+ ], $params );
// Ensure that the url parameter has a trailing slash.
$mparams['url'] = preg_replace(
'#/?$#',
}
public function onRequests( array $reqs, Closure $idGeneratorFunc ) {
- $result = array();
+ $result = [];
foreach ( $reqs as $key => $req ) {
$parts = explode( '/', $req['url'] );
continue;
}
if ( $targetWiki !== 'local' ) {
-
throw new Exception( "Only 'local' target wiki is currently supported" );
}
if ( $reqType !== 'page' && $reqType !== 'transform' ) {
* API. We now translate these to the "real" Parsoid v3 API.
*/
public function onParsoid1Request( array $req, Closure $idGeneratorFunc ) {
-
$parts = explode( '/', $req['url'] );
list(
$targetWiki, // 'local'
throw new Exception( "You must set a 'wikitext' body key for this request" );
}
if ( isset( $req['body']['body'] ) ) {
- $req['body']['bodyOnly'] = $req['body']['body'];
+ $req['body']['body_only'] = $req['body']['body'];
unset( $req['body']['body'] );
}
} else {
}
return $req;
-
}
}