'fixedUrl' => false,
], $params );
// Ensure that the url parameter has a trailing slash.
- $mparams['url'] = preg_replace(
- '#/?$#',
- '/',
- $mparams['url']
- );
+ if ( substr( $mparams['url'], -1 ) !== '/' ) {
+ $mparams['url'] .= '/';
+ }
// Ensure the correct domain format: strip protocol, port,
// and trailing slash if present. This lets us use
// $wgCanonicalServer as a default value, which is very convenient.
/**
* Remaps Parsoid v1/v3 requests to RESTBase v1 requests.
+ * @param array $reqs
+ * @param Closure $idGeneratorFunc
+ * @return array
+ * @throws Exception
*/
public function onParsoidRequests( array $reqs, Closure $idGeneratorFunc ) {
$result = [];
* NOTE: the POST APIs aren't "real" Parsoid v1 APIs, they are just what
* Visual Editor "pretends" the V1 API is like. (See
* ParsoidVirtualRESTService.)
+ * @param array $req
+ * @param Closure $idGeneratorFunc
+ * @return array
+ * @throws Exception
*/
public function onParsoid1Request( array $req, Closure $idGeneratorFunc ) {
$parts = explode( '/', $req['url'] );
* * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body_only' => true/false )
* * $title is optional
* * $revision is optional
+ * @param array $req
+ * @param Closure $idGeneratorFunc
+ * @return array
+ * @throws Exception
*/
public function onParsoid3Request( array $req, Closure $idGeneratorFunc ) {
$parts = explode( '/', $req['url'] );