Пример #1
0
function wfXMLclassSetup()
{
    global $xmlObj;
    global $xmlOldHook;
    global $xslOldHook;
    $GLOBALS['xmlObj'] = XMLclass::singleton();
    // Phase 1 flow
    global $wgParser;
    $xmlOldHook = $wgParser->setHook("xml", array(&$xmlObj, 'xml'));
    $xslOldHook = $wgParser->setHook("xsl", array(&$xmlObj, 'xsl'));
    $wgParser->setFunctionHook('xsl', array(&$xmlObj, 'mg_xsl'));
    // v1.2b
    // Keep old hooks in case we need them (i.e. GeSHi integration)
    $xmlObj->setXmlOldHook($xmlOldHook);
    $xmlObj->setXslOldHook($xslOldHook);
    // Phase 2 flow
    global $wgHooks;
    // From ArticleEx class
    $wgHooks['ArticleViewEx'][] = array($xmlObj, 'hArticleViewEx');
}
Пример #2
0
 public function hArticleViewEx(&$aex, &$type, &$content)
 {
     // FIRST, make sure we are dealing with an XML type !
     // This function is called by the ArticleEx::view() function
     if ($type != 'xml' && $type != 'xsl') {
         return;
     }
     // Set header ContentType
     global $wgMimeType;
     $wgMimeType = "text/xml";
     $this->hInclude($content);
     // Process all the MW references left around.
     XMLclass::processMWreferences($content);
 }