コード例 #1
0
ファイル: Body.php プロジェクト: Tjorriemorrie/app
 /**
  * Get the wikitext output from a form.
  * @param $form Mixed: Title object of the form to use, or a String form definition.
  * @param $data Array: Associative array as would be POSTed to the form.
  * @return Wikitext
  */
 public static function getWikitext($form, $data = array())
 {
     $printer = new SFFormPrinter();
     if ($form instanceof Title) {
         $article = new Article($form);
         $form = $article->getContent();
     }
     global $wgRequest;
     // Process into arrays and what not
     $data = self::convertFlatToArray($data);
     $oldRequest = $wgRequest;
     $wgRequest = new FauxRequest($data);
     $output = $printer->formHTML($form, count($data) > 0, false);
     list($form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name) = $output;
     $wgRequest = $oldRequest;
     return $data_text;
 }