lib/mw/ApiRequest.js
function PHPParseRequest(env, title, text, onlypst, queueKey) {
	ApiRequest.call(this, env, title);
	this.text = text;
	this.queueKey = queueKey || text;
	this.reqType = "Extension Parse";

	var apiargs = {
		format: 'json',
		formatversion: 2,
		action: 'parse',
		text: text,
		disablelimitreport: 'true',
		contentmodel: 'wikitext',
		prop: 'text|modules|jsconfigvars|categories',
		wrapoutputclass: '',
	};
	if (onlypst) {
		apiargs.onlypst = 'true';
	}

	// Pass the page title to the API
	if (title) {
		apiargs.title = title;
	}

	if (env.page.meta.revision.revid) {
		apiargs.revid = env.page.meta.revision.revid;
	}

	this.requestOptions = {
		// Use POST since we are passing a bit of source, and GET has a very
		// limited length. You'll be greeted by "HTTP Error 414 Request URI
		// too long" otherwise ;)
		method: 'POST',
		form: apiargs, // The API arguments
		followRedirect: true,
		uri: env.conf.wiki.apiURI,
		timeout: env.conf.parsoid.timeouts.mwApi.extParse,
	};

	this.request(this.requestOptions);
}
function PHPParseRequest(env, title, text, onlypst, queueKey) {
	ApiRequest.call(this, env, title);
	this.text = text;
	this.queueKey = queueKey || text;
	this.reqType = "Extension Parse";

	var apiargs = {
		format: 'json',
		formatversion: 2,
		action: 'parse',
		text: text,
		disablelimitreport: 'true',
		contentmodel: 'wikitext',
		prop: 'text|modules|jsconfigvars|categories',
		wrapoutputclass: '',
	};
	if (onlypst) {
		apiargs.onlypst = 'true';
	}

	// Pass the page title to the API
	if (title) {
		apiargs.title = title;
	}

	if (env.page.meta.revision.revid) {
		apiargs.revid = env.page.meta.revision.revid;
	}

	this.requestOptions = {
		// Use POST since we are passing a bit of source, and GET has a very
		// limited length. You'll be greeted by "HTTP Error 414 Request URI
		// too long" otherwise ;)
		method: 'POST',
		form: apiargs, // The API arguments
		followRedirect: true,
		uri: env.conf.wiki.apiURI,
		timeout: env.conf.parsoid.timeouts.mwApi.extParse,
	};

	this.request(this.requestOptions);
}
function PHPParseRequest ( env , title , text , onlypst , queueKey ) { ApiRequest . call ( this , env , title ) ; this . text = text ; this . queueKey = queueKey || text ; this . reqType = "Extension Parse" ; var apiargs = { format : 'json' , formatversion : 2 , action : 'parse' , text : text , disablelimitreport : 'true' , contentmodel : 'wikitext' , prop : 'text|modules|jsconfigvars|categories' , wrapoutputclass : '' , } ; if ( onlypst ) { apiargs . onlypst = 'true' ; } // Pass the page title to the API if ( title ) { apiargs . title = title ; } if ( env . page . meta . revision . revid ) { apiargs . revid = env . page . meta . revision . revid ; } this . requestOptions = { // Use POST since we are passing a bit of source, and GET has a very // limited length. You'll be greeted by "HTTP Error 414 Request URI // too long" otherwise ;) method : 'POST' , form : apiargs , // The API arguments followRedirect : true , uri : env . conf . wiki . apiURI , timeout : env . conf . parsoid . timeouts . mwApi . extParse , } ; this . request ( this . requestOptions ) ; }
Gets the PHP parser to parse content for us.
Used for handling extension content right now.
And, probably magic words later on.

@class
@extends ~ApiRequest
@param {MWParserEnvironment} env
@param {string} title The title of the page to use as context.
@param {string} text
@param {boolean} [onlypst] Pass onlypst to PHP parser.
@param {string} [queueKey] The queue key.
Gets the PHP parser to parse content for us . Used for handling extension content right now . And probably magic words later on .