Esempio n. 1
0
 /** @todo document */
 function plain_parse(&$text, $inline = false, $templateOptions = array())
 {
     $this->runXMLparser($text);
     $nowikicount = 0;
     $w = new xml2php();
     $result = $w->scanString($text);
     $oldTemplateOptions = $this->mCurrentTemplateOptions;
     $this->mCurrentTemplateOptions = $templateOptions;
     if ($inline) {
         # Inline rendering off for templates
         if (count($result->children) == 1) {
             $result->children[0]->name = 'IGNORE';
         }
     }
     if (1) {
         $text = $result->makeXHTML($this);
     } else {
         $text = $result->makeXHTML($this) . '<hr>' . $text . '<hr>' . $result->myPrint();
     }
     $this->mCurrentTemplateOptions = $oldTemplateOptions;
 }
Esempio n. 2
0
 /**
  * Converts XML to DocBook XML
  */
 function articles2docbook_xml(&$xml, $params = array(), $use_gfdl = false)
 {
     global $wiki2xml_authors;
     require_once "xml2docbook_xml.php";
     $wiki2xml_authors = array();
     $x2t = new xml2php();
     $tree = $x2t->scanString($xml);
     # Chosing DTD; parameter-given or default
     $dtd = "";
     if (isset($params['docbook']['dtd'])) {
         $dtd = $params['docbook']['dtd'];
     }
     if ($dtd == "") {
         $dtd = 'http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd';
     }
     $out = "<?xml version='1.0' encoding='UTF-8' ?>\n";
     $out .= '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "' . $dtd . '"';
     if ($use_gfdl) {
         $out .= "\n[<!ENTITY gfdl SYSTEM \"gfdl.xml\">]\n";
     }
     $out .= ">\n\n<book>\n";
     $out2 = trim($tree->parse($tree));
     $out .= "<bookinfo>";
     $out .= "<title>" . $params['book_title'] . "</title>";
     if (count($wiki2xml_authors) > 0) {
         asort($wiki2xml_authors);
         $out .= "<authorgroup>";
         foreach ($wiki2xml_authors as $author) {
             $out .= "<author><othername>{$author}</othername></author>";
         }
         $out .= "</authorgroup>";
     }
     $out .= "<legalnotice><para>";
     $out .= "Permission to use, copy, modify and distribute this document under the GNU Free Documentation License (GFDL).";
     $out .= "</para></legalnotice>";
     $out .= "</bookinfo>";
     $out .= $out2;
     /*		
     		if ( count ( $wiki2xml_authors ) > 0 ) {
     			asort ( $wiki2xml_authors ) ;
     			$out .= "<appendix>" ;
     			$out .= "<title>List of contributors</title>" ;
     			$out .= "<para>All text in this document is licensed under the GFDL. The following is a list of contributors (anonymous editors are not listed).</para>" ;
     			$out .= "<para>" ;
     			$out .= implode ( ", " , $wiki2xml_authors ) ;
     			$out .= "</para>" ;
     			$out .= "</appendix>" ;
     		}
     */
     if ($use_gfdl) {
         $out .= "\n&gfdl;\n";
     }
     $out .= "\n</book>\n";
     return $out;
 }