/** * Example requests: * GET /local/v1/page/{title}/html{/revision} * POST /local/v1/transform/html/to/wikitext{/title}{/revision} * * body: array( 'html' => ... ) * POST /local/v1/transform/wikitext/to/html{/title}{/revision} * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'bodyOnly' => true/false ) * * @param array $params Key/value map * - url : Restbase server URL * - domain : Wiki domain to use * - timeout : request timeout in seconds (optional) * - forwardCookies : cookies to forward to Restbase/Parsoid (as a Cookie * header string) or false (optional) * Note: forwardCookies will in the future be a boolean * only, signifing request cookies should be forwarded * to the service; the current state is due to the way * VE handles this particular parameter * - HTTPProxy : HTTP proxy to use (optional) * - parsoidCompat : whether to parse URL as if they were meant for Parsoid * boolean (optional) */ public function __construct(array $params) { // set up defaults and merge them with the given params $mparams = array_merge(array('url' => 'http://localhost:7231', 'domain' => 'localhost', 'timeout' => 100, 'forwardCookies' => false, 'HTTPProxy' => null, 'parsoidCompat' => false), $params); // ensure the correct domain format $mparams['domain'] = preg_replace('/^(https?:\\/\\/)?([^\\/:]+?)(\\/|:\\d+\\/?)?$/', '$2', $mparams['domain']); parent::__construct($mparams); }
/** * Example requests: * GET /local/v1/page/$title/html/$oldid * * $oldid is optional * POST /local/v1/transform/html/to/wikitext/$title/$oldid * * body: array( 'html' => ... ) * * $title and $oldid are optional * POST /local/v1/transform/wikitext/to/html/$title * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body' => true/false ) * * $title is optional * @param array $params Key/value map * - url : Parsoid server URL * - prefix : Parsoid prefix for this wiki * - timeout : Parsoid timeout (optional) * - forwardCookies : Cookies to forward to Parsoid, or false. (optional) * - HTTPProxy : Parsoid HTTP proxy (optional) */ public function __construct(array $params) { // for backwards compatibility: if (isset($params['URL'])) { $params['url'] = $params['URL']; unset($params['URL']); } parent::__construct($params); }
/** * Example RESTBase v1 requests: * GET /local/v1/page/html/{title}{/revision} * POST /local/v1/transform/html/to/wikitext{/title}{/revision} * * body: array( 'html' => ... ) * POST /local/v1/transform/wikitext/to/html{/title}{/revision} * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'bodyOnly' => true/false ) * * @param array $params Key/value map * - url : RESTBase server URL * - domain : Wiki domain to use * - timeout : request timeout in seconds (optional) * - forwardCookies : cookies to forward to RESTBase/Parsoid (as a Cookie * header string) or false (optional) * Note: forwardCookies will in the future be a boolean * only, signifing request cookies should be forwarded * to the service; the current state is due to the way * VE handles this particular parameter * - HTTPProxy : HTTP proxy to use (optional) * - parsoidCompat : whether to parse URL as if they were meant for Parsoid * boolean (optional) */ public function __construct(array $params) { // set up defaults and merge them with the given params $mparams = array_merge(array('url' => 'http://localhost:7231/', 'domain' => 'localhost', 'timeout' => 100, 'forwardCookies' => false, 'HTTPProxy' => null, 'parsoidCompat' => false), $params); // Ensure that the url parameter has a trailing slash. $mparams['url'] = preg_replace('#/?$#', '/', $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. $mparams['domain'] = preg_replace('/^(https?:\\/\\/)?([^\\/:]+?)(:\\d+)?\\/?$/', '$2', $mparams['domain']); parent::__construct($mparams); }
/** * Example Parsoid v3 requests: * GET /local/v3/page/html/$title/{$revision} * * $revision is optional * POST /local/v3/transform/html/to/wikitext/{$title}{/$revision} * * body: array( 'html' => ... ) * * $title and $revision are optional * POST /local/v3/transform/wikitext/to/html/{$title}{/$revision} * * body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body_only' => true/false ) * * $title is optional * * $revision is optional * * There are also deprecated "v1" requests; see onParsoid1Request * for details. * @param array $params Key/value map * - url : Parsoid server URL * - domain : Wiki domain to use * - timeout : Parsoid timeout (optional) * - forwardCookies : Cookies to forward to Parsoid, or false. (optional) * - HTTPProxy : Parsoid HTTP proxy (optional) * - restbaseCompat : whether to parse URL as if they were meant for RESTBase * boolean (optional) */ public function __construct(array $params) { // for backwards compatibility: if (isset($params['URL'])) { $params['url'] = $params['URL']; unset($params['URL']); } // set up defaults and merge them with the given params $mparams = array_merge(['name' => 'parsoid', 'url' => 'http://localhost:8000/', 'prefix' => 'localhost', 'domain' => 'localhost', 'forwardCookies' => false, 'HTTPProxy' => null], $params); // Ensure that the url parameter has a trailing slash. $mparams['url'] = preg_replace('#/?$#', '/', $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. $mparams['domain'] = preg_replace('/^(https?:\\/\\/)?([^\\/:]+?)(:\\d+)?\\/?$/', '$2', $mparams['domain']); parent::__construct($mparams); }
/** * @param array $params Key/value map * - swiftAuthUrl : Swift authentication server URL * - swiftUser : Swift user used by MediaWiki (account:username) * - swiftKey : Swift authentication key for the above user * - swiftAuthTTL : Swift authentication TTL (seconds) */ public function __construct(array $params) { parent::__construct($params); }
/** * @param array $params Key/value map * - swiftAuthUrl : Swift authentication server URL * - swiftUser : Swift user used by MediaWiki (account:username) * - swiftKey : Swift authentication key for the above user * - swiftAuthTTL : Swift authentication TTL (seconds) */ public function __construct(array $params) { // set up defaults and merge them with the given params $mparams = array_merge(array('name' => 'swift'), $params); parent::__construct($mparams); }