X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=debian%2Ftree%2Fpve-docs-mediawiki%2Fpvedocs-include.php;fp=debian%2Ftree%2Fpve-docs-mediawiki%2Fpvedocs-include.php;h=0000000000000000000000000000000000000000;hb=51b093821f3bed5c621c6ac4f4a9d29a4225836b;hp=78a6829ffea7e6279d2136e2a1b77c1718fe33d9;hpb=4622d5b4c5c725b623faf93922b80d90bc337e4f;p=pve-docs.git diff --git a/debian/tree/pve-docs-mediawiki/pvedocs-include.php b/debian/tree/pve-docs-mediawiki/pvedocs-include.php deleted file mode 100644 index 78a6829..0000000 --- a/debian/tree/pve-docs-mediawiki/pvedocs-include.php +++ /dev/null @@ -1,74 +0,0 @@ - "PVE Documentation Pages", - 'description' => "Display PVE Documentation Pages", - 'author' => "Dietmar Maurer", -); - -# Define a setup function -$wgHooks['ParserFirstCallInit'][] = 'efPvedocsParserFunction_Setup'; -$wgHooks['ParserAfterTidy'][] = 'efPvedocsPostProcessFunction'; - -# Add a hook to initialise the magic word -$wgHooks['LanguageGetMagic'][] = 'efPvedocsParserFunction_Magic'; - -function efPvedocsParserFunction_Setup(&$parser) { - # Set a function hook associating the "pvedocs" magic - # word with our function - $parser->setFunctionHook('pvedocs', 'efPvedocsParserFunction_Render'); - - $parser->setHook('pvehide', 'renderTagPveHideContent'); - - return true; -} - -# similar code as in tag... -function efPvedocsPostProcessFunction($parser, &$text) { - $text = preg_replace_callback( - '//sm', - function ($m) { return base64_decode("$m[1]"); }, - $text); - - return true; -} - -// Render -function renderTagPveHideContent($input, array $args, Parser $parser, -PPFrame $frame ) { - // simply return nothing - return ''; -} - - -function efPvedocsParserFunction_Magic(&$magicWords, $langCode) { - # Add the magic word - # The first array element is whether to be case sensitive, - # in this case (0) it is not case sensitive, 1 would be sensitive - # All remaining elements are synonyms for our parser function - $magicWords['pvedocs'] = array( 0, 'pvedocs' ); - - # unless we return true, other parser functions extensions won't get loaded. - return true; -} - -function efPvedocsParserFunction_Render($parser, $param1 = '', $param2 = '') { - - $parser->disableCache(); - - # only allow simply names, so that users can only include - # files from within "/usr/share/pve-docs/" - if (!preg_match("/[a-z0-9.-]+\.html/i", $param1)) { - die("no such manual page"); - } - - $content = file_get_contents("/usr/share/pve-docs/$param1"); - - # from https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/HTMLets/+/11e5ef1ea2820319458dc67174ca76d6e00b10cc/HTMLets.php#140 - $output = ''; - return array($output, 'noparse' => true, 'isHTML' => true); -} - -?>