Beispiel #1
0
 /**
  * Perform wikitext parsing to HTML
  */
 public static function wiki2html()
 {
     wfProfileIn(__METHOD__);
     global $wgRequest;
     $wikitext = $wgRequest->getVal('wikitext', '');
     RTE::log(__METHOD__, $wikitext);
     $ret = array('html' => RTE::WikitextToHtml($wikitext), 'instanceId' => RTE::getInstanceId());
     if (RTE::edgeCasesFound()) {
         $ret = array('edgecase' => array('type' => RTE::getEdgeCaseType(), 'info' => array('title' => wfMsg('rte-edgecase-info-title'), 'content' => wfMsg('rte-edgecase-info'))));
     }
     wfProfileOut(__METHOD__);
     return $ret;
 }
Beispiel #2
0
 /**
  * Parse wikitext of edited article, so CK can be provided with HTML
  */
 public static function init2(&$form, OutputPage &$out)
 {
     wfProfileIn(__METHOD__);
     // add hidden edit form field
     $out->addHTML("\n" . Xml::element('input', array('type' => 'hidden', 'value' => '', 'name' => 'RTEMode', 'id' => 'RTEMode')));
     // add fields to perform temporary save
     self::addTemporarySaveFields($out);
     // let's parse wikitext (only for wysiwyg mode)
     if (self::$initMode == 'wysiwyg') {
         $html = RTE::WikitextToHtml($form->textbox1);
     }
     // check for edgecases (found during parsing done above)
     if (RTE::edgeCasesFound()) {
         self::setInitMode('source');
         // get edgecase type and add it to JS variables
         $edgeCaseType = Xml::encodeJsVar(self::getEdgeCaseType());
         $out->addInlineScript("var RTEEdgeCase = {$edgeCaseType}");
     }
     // parse wikitext using RTEParser (only for wysiwyg mode)
     if (self::$initMode == 'wysiwyg') {
         // set editor textarea content
         $form->textbox1 = $html;
     }
     // allow other extensions to add extra HTML to edit form
     wfRunHooks('RTEAddToEditForm', array(&$form, &$out));
     wfProfileOut(__METHOD__);
     return true;
 }