1<?php 2 3use ComboStrap\AdsUtility; 4use ComboStrap\BreadcrumbHierarchical; 5use ComboStrap\FsWikiUtility; 6use ComboStrap\XhtmlUtility; 7use ComboStrap\PluginUtility; 8use ComboStrap\TableUtility; 9use ComboStrap\TocUtility; 10 11 12require_once(__DIR__ . '/../ComboStrap/FsWikiUtility.php'); 13require_once(__DIR__ . '/../ComboStrap/TableUtility.php'); 14require_once(__DIR__ . '/../ComboStrap/TocUtility.php'); 15require_once(__DIR__ . '/../ComboStrap/AdsUtility.php'); 16require_once(__DIR__ . '/../ComboStrap/XhtmlUtility.php'); 17require_once(__DIR__ . '/../ComboStrap/BreadcrumbHierarchical.php'); 18 19/** 20 * A rendering in XML 21 */ 22class renderer_plugin_combo_xml extends Doku_Renderer_xhtml 23{ 24 25 const FORMAT = "xml"; 26 27 /** 28 * The last two words of the class 29 */ 30 const MODE = 'combo_'.self::FORMAT; 31 32 33 function getFormat(): string 34 { 35 return self::FORMAT; 36 } 37 38 /* 39 * Function that enable to list the plugin in the options for config:renderer_xhtml 40 * http://www.dokuwiki.org/config:renderer_xhtml 41 * setting in its Configuration Manager. 42 */ 43 public function canRender($format) 44 { 45 return ($format == 'xml'); 46 } 47 48 49 /** 50 * Render a heading 51 * 52 * 53 * @param string $text the text to display 54 * @param int $level header level 55 * @param int $pos byte position in the original source 56 */ 57 function header($text, $level, $pos) 58 { 59 60 $this->doc .= "<h$level>$text</h$level>"; 61 62 } 63 64 /** 65 * This are edit zone section (not HTML/Outline Section) 66 * @param int $level 67 */ 68 public function section_open($level) 69 { 70 $this->doc .= ""; 71 } 72 73 public function section_close() 74 { 75 $this->doc .= ""; 76 } 77 78 79 public function document_start() 80 { 81 $this->doc .= '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>'; 82 $this->doc .= "<document>"; 83 } 84 85 public function multiplyentity($x, $y): string 86 { 87 return "$x x $y"; 88 } 89 90 91 function document_end() 92 { 93 94 $this->doc .= "</document>"; 95 96 /** 97 * The result can be seen with 98 * doku.php?id=somepage&do=export_combo_xml 99 * 100 * Set the header temporarily for the export.php file 101 * 102 * The mode in the export is 103 */ 104 $mode = "combo_" . $this->getPluginComponent(); 105 global $ID; 106 p_set_metadata( 107 $ID, 108 array("format" => array($mode => array("Content-Type" => 'application/xml'))), 109 false, 110 true // Persistence is needed because there is a cache 111 ); 112 113 } 114 115 116 /** 117 * https://getbootstrap.com/docs/4.4/content/typography/#inline-text-elements 118 */ 119 public 120 function monospace_open() 121 { 122 $this->doc .= '<mark>'; 123 } 124 125 public 126 function monospace_close() 127 { 128 $this->doc .= '</mark>'; 129 } 130 131 132} 133