function wfTalkHereAjaxEditor( $page, $section, $returnto ) { global $wgRequest, $wgTitle, $wgOut; $title = Title::newFromText( $page ); if ( !$title ) { return false; } //fake editor environment $args = array( 'wpTalkHere' => '1', 'wpReturnTo' => $returnto, 'action' => 'edit', 'section' => $section ); $wgRequest = new FauxRequest( $args ); $wgTitle = $title; $article = Article::newFromTitle( $title, RequestContext::getMain() ); $editor = new TalkHereEditPage( $article ); //generate form $editor->importFormData( $wgRequest ); $editor->showEditForm(); $response = new AjaxResponse(); $response->addText( $wgOut->getHTML() ); $response->setCacheDuration( false ); //don't cache, because of tokens etc return $response; }