1661701eeSAndreas Gohr<?php 2661701eeSAndreas Gohr 3f93272b9SAndreas Gohr// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps 4f93272b9SAndreas Gohr// phpcs:disable PSR2.Methods.MethodDeclaration.Underscore 5f93272b9SAndreas Gohr 6f93272b9SAndreas Gohruse dokuwiki\Extension\SyntaxPlugin; 7661701eeSAndreas Gohruse dokuwiki\File\PageResolver; 8661701eeSAndreas Gohr 9661701eeSAndreas Gohr/** 10661701eeSAndreas Gohr * Renderer for preparing data for embedding 11661701eeSAndreas Gohr * 12f93272b9SAndreas Gohr * Based on the text and markdown renderers 13661701eeSAndreas Gohr * 14f93272b9SAndreas Gohr * @todo table handling is not perfect 15661701eeSAndreas Gohr * @author Michael Hamann <michael@content-space.de> 16661701eeSAndreas Gohr * @author Todd Augsburger <todd@rollerorgans.com> 17661701eeSAndreas Gohr * @author i-net software <tools@inetsoftware.de> 18661701eeSAndreas Gohr * @link https://www.dokuwiki.org/plugin:text 19661701eeSAndreas Gohr * @link https://www.dokuwiki.org/plugin:dw2markdown 20661701eeSAndreas Gohr */ 21661701eeSAndreas Gohrclass renderer_plugin_aichat extends Doku_Renderer_xhtml 22661701eeSAndreas Gohr{ 23f93272b9SAndreas Gohr /** @var array The stack of list types */ 24f93272b9SAndreas Gohr private $listMode = []; 25661701eeSAndreas Gohr 26f93272b9SAndreas Gohr /** @var int Number of table columns */ 27f93272b9SAndreas Gohr private $tableColumns = 0; 28661701eeSAndreas Gohr 29661701eeSAndreas Gohr /** @inheritdoc */ 30f93272b9SAndreas Gohr public function getFormat() 31661701eeSAndreas Gohr { 32661701eeSAndreas Gohr return 'aichat'; 33661701eeSAndreas Gohr } 34661701eeSAndreas Gohr 35661701eeSAndreas Gohr /** @inheritdoc */ 36661701eeSAndreas Gohr public function startSectionEdit($start, $data, $title = null) 37661701eeSAndreas Gohr { 38661701eeSAndreas Gohr } 39661701eeSAndreas Gohr 40661701eeSAndreas Gohr /** @inheritdoc */ 41661701eeSAndreas Gohr public function finishSectionEdit($end = null, $hid = null) 42661701eeSAndreas Gohr { 43661701eeSAndreas Gohr } 44661701eeSAndreas Gohr 45661701eeSAndreas Gohr /** 46661701eeSAndreas Gohr * @inheritdoc 47661701eeSAndreas Gohr * Use specific text support if available, otherwise use xhtml renderer and strip tags 48661701eeSAndreas Gohr */ 49661701eeSAndreas Gohr public function plugin($name, $data, $state = '', $match = '') 50661701eeSAndreas Gohr { 51f93272b9SAndreas Gohr /** @var SyntaxPlugin $plugin */ 52661701eeSAndreas Gohr $plugin = plugin_load('syntax', $name); 53661701eeSAndreas Gohr if ($plugin === null) return; 54661701eeSAndreas Gohr 55661701eeSAndreas Gohr if ( 56661701eeSAndreas Gohr !$plugin->render($this->getFormat(), $this, $data) && 57661701eeSAndreas Gohr !$plugin->render('text', $this, $data) && 58661701eeSAndreas Gohr !$plugin->render('markdown', $this, $data) 59661701eeSAndreas Gohr ) { 60661701eeSAndreas Gohr // plugin does not support any of the text formats, so use stripped-down xhtml 61661701eeSAndreas Gohr $tmpData = $this->doc; 62661701eeSAndreas Gohr $this->doc = ''; 63f93272b9SAndreas Gohr if ($plugin->render('xhtml', $this, $data) && ($this->doc !== '')) { 64661701eeSAndreas Gohr $pluginoutput = $this->doc; 65661701eeSAndreas Gohr $this->doc = $tmpData . DOKU_LF . trim(strip_tags($pluginoutput)) . DOKU_LF; 66661701eeSAndreas Gohr } else { 67661701eeSAndreas Gohr $this->doc = $tmpData; 68661701eeSAndreas Gohr } 69661701eeSAndreas Gohr } 70661701eeSAndreas Gohr } 71661701eeSAndreas Gohr 72661701eeSAndreas Gohr /** @inheritdoc */ 73661701eeSAndreas Gohr public function document_start() 74661701eeSAndreas Gohr { 75661701eeSAndreas Gohr global $ID; 76661701eeSAndreas Gohr 77661701eeSAndreas Gohr $this->doc = ''; 78f93272b9SAndreas Gohr $metaheader = []; 79661701eeSAndreas Gohr $metaheader['Content-Type'] = 'text/plain; charset=utf-8'; 80f93272b9SAndreas Gohr $meta = []; 81661701eeSAndreas Gohr $meta['format']['aichat'] = $metaheader; 82661701eeSAndreas Gohr p_set_metadata($ID, $meta); 83661701eeSAndreas Gohr } 84661701eeSAndreas Gohr 85661701eeSAndreas Gohr /** @inheritdoc */ 86661701eeSAndreas Gohr public function document_end() 87661701eeSAndreas Gohr { 88661701eeSAndreas Gohr $this->doc = preg_replace("/(\r?\n){3,}/", "\n\n", $this->doc); 89661701eeSAndreas Gohr $this->doc = ltrim($this->doc); // remove leading space and empty lines 90*10ce0ca9SAndreas Gohr 91*10ce0ca9SAndreas Gohr // remove ignored parts 92*10ce0ca9SAndreas Gohr $regex = $this->getConf('ignoreRegex'); 93*10ce0ca9SAndreas Gohr if($regex) { 94*10ce0ca9SAndreas Gohr $this->doc = preg_replace('/' . $regex . '/i', '', $this->doc); 95*10ce0ca9SAndreas Gohr } 96661701eeSAndreas Gohr } 97661701eeSAndreas Gohr 98661701eeSAndreas Gohr /** @inheritdoc */ 99661701eeSAndreas Gohr public function header($text, $level, $pos, $returnonly = false) 100661701eeSAndreas Gohr { 101661701eeSAndreas Gohr $this->doc .= str_repeat("#", $level) . ' ' . $text . DOKU_LF; 102661701eeSAndreas Gohr } 103661701eeSAndreas Gohr 104661701eeSAndreas Gohr /** @inheritdoc */ 105661701eeSAndreas Gohr public function section_open($level) 106661701eeSAndreas Gohr { 107661701eeSAndreas Gohr $this->doc .= DOKU_LF; 108661701eeSAndreas Gohr } 109661701eeSAndreas Gohr 110661701eeSAndreas Gohr /** @inheritdoc */ 111661701eeSAndreas Gohr public function section_close() 112661701eeSAndreas Gohr { 113661701eeSAndreas Gohr $this->doc .= DOKU_LF; 114661701eeSAndreas Gohr } 115661701eeSAndreas Gohr 116661701eeSAndreas Gohr /** @inheritdoc */ 117661701eeSAndreas Gohr public function cdata($text) 118661701eeSAndreas Gohr { 119661701eeSAndreas Gohr $this->doc .= $text; 120661701eeSAndreas Gohr } 121661701eeSAndreas Gohr 122661701eeSAndreas Gohr /** @inheritdoc */ 123661701eeSAndreas Gohr public function p_open() 124661701eeSAndreas Gohr { 125661701eeSAndreas Gohr $this->doc .= DOKU_LF; 126661701eeSAndreas Gohr } 127661701eeSAndreas Gohr 128661701eeSAndreas Gohr /** @inheritdoc */ 129661701eeSAndreas Gohr public function p_close() 130661701eeSAndreas Gohr { 131661701eeSAndreas Gohr $this->doc .= DOKU_LF; 132661701eeSAndreas Gohr } 133661701eeSAndreas Gohr 134661701eeSAndreas Gohr /** @inheritdoc */ 135661701eeSAndreas Gohr public function linebreak() 136661701eeSAndreas Gohr { 137661701eeSAndreas Gohr $this->doc .= DOKU_LF . DOKU_LF; 138661701eeSAndreas Gohr } 139661701eeSAndreas Gohr 140661701eeSAndreas Gohr /** @inheritdoc */ 141661701eeSAndreas Gohr public function hr() 142661701eeSAndreas Gohr { 143661701eeSAndreas Gohr $this->doc .= '----' . DOKU_LF; 144661701eeSAndreas Gohr } 145661701eeSAndreas Gohr 146661701eeSAndreas Gohr /** @inheritdoc */ 147661701eeSAndreas Gohr public function strong_open() 148661701eeSAndreas Gohr { 149661701eeSAndreas Gohr } 150661701eeSAndreas Gohr 151661701eeSAndreas Gohr /** @inheritdoc */ 152661701eeSAndreas Gohr public function strong_close() 153661701eeSAndreas Gohr { 154661701eeSAndreas Gohr } 155661701eeSAndreas Gohr 156661701eeSAndreas Gohr /** @inheritdoc */ 157661701eeSAndreas Gohr public function emphasis_open() 158661701eeSAndreas Gohr { 159661701eeSAndreas Gohr } 160661701eeSAndreas Gohr 161661701eeSAndreas Gohr /** @inheritdoc */ 162661701eeSAndreas Gohr public function emphasis_close() 163661701eeSAndreas Gohr { 164661701eeSAndreas Gohr } 165661701eeSAndreas Gohr 166661701eeSAndreas Gohr /** @inheritdoc */ 167661701eeSAndreas Gohr public function underline_open() 168661701eeSAndreas Gohr { 169661701eeSAndreas Gohr } 170661701eeSAndreas Gohr 171661701eeSAndreas Gohr /** @inheritdoc */ 172661701eeSAndreas Gohr public function underline_close() 173661701eeSAndreas Gohr { 174661701eeSAndreas Gohr } 175661701eeSAndreas Gohr 176661701eeSAndreas Gohr /** @inheritdoc */ 177661701eeSAndreas Gohr public function monospace_open() 178661701eeSAndreas Gohr { 179661701eeSAndreas Gohr } 180661701eeSAndreas Gohr 181661701eeSAndreas Gohr /** @inheritdoc */ 182661701eeSAndreas Gohr public function monospace_close() 183661701eeSAndreas Gohr { 184661701eeSAndreas Gohr } 185661701eeSAndreas Gohr 186661701eeSAndreas Gohr /** @inheritdoc */ 187661701eeSAndreas Gohr public function subscript_open() 188661701eeSAndreas Gohr { 189661701eeSAndreas Gohr } 190661701eeSAndreas Gohr 191661701eeSAndreas Gohr /** @inheritdoc */ 192661701eeSAndreas Gohr public function subscript_close() 193661701eeSAndreas Gohr { 194661701eeSAndreas Gohr } 195661701eeSAndreas Gohr 196661701eeSAndreas Gohr /** @inheritdoc */ 197661701eeSAndreas Gohr public function superscript_open() 198661701eeSAndreas Gohr { 199661701eeSAndreas Gohr } 200661701eeSAndreas Gohr 201661701eeSAndreas Gohr /** @inheritdoc */ 202661701eeSAndreas Gohr public function superscript_close() 203661701eeSAndreas Gohr { 204661701eeSAndreas Gohr } 205661701eeSAndreas Gohr 206661701eeSAndreas Gohr /** @inheritdoc */ 207661701eeSAndreas Gohr public function deleted_open() 208661701eeSAndreas Gohr { 209661701eeSAndreas Gohr } 210661701eeSAndreas Gohr 211661701eeSAndreas Gohr /** @inheritdoc */ 212661701eeSAndreas Gohr public function deleted_close() 213661701eeSAndreas Gohr { 214661701eeSAndreas Gohr } 215661701eeSAndreas Gohr 216661701eeSAndreas Gohr /** @inheritdoc */ 217661701eeSAndreas Gohr public function footnote_open() 218661701eeSAndreas Gohr { 219661701eeSAndreas Gohr $this->doc .= ' (('; 220661701eeSAndreas Gohr } 221661701eeSAndreas Gohr 222661701eeSAndreas Gohr /** @inheritdoc */ 223661701eeSAndreas Gohr public function footnote_close() 224661701eeSAndreas Gohr { 225661701eeSAndreas Gohr $this->doc .= '))'; 226661701eeSAndreas Gohr } 227661701eeSAndreas Gohr 228f93272b9SAndreas Gohr /** @inheritdoc */ 229f93272b9SAndreas Gohr public function listu_open($classes = null) 230661701eeSAndreas Gohr { 231f93272b9SAndreas Gohr if ($this->listMode === []) { 232661701eeSAndreas Gohr $this->doc .= DOKU_LF; 233661701eeSAndreas Gohr } 234661701eeSAndreas Gohr $this->listMode[] = '*'; 235661701eeSAndreas Gohr } 236661701eeSAndreas Gohr 237f93272b9SAndreas Gohr /** @inheritdoc */ 238f93272b9SAndreas Gohr public function listu_close() 239661701eeSAndreas Gohr { 240661701eeSAndreas Gohr array_pop($this->listMode); 241f93272b9SAndreas Gohr if ($this->listMode === []) { 242661701eeSAndreas Gohr $this->doc .= DOKU_LF; 243661701eeSAndreas Gohr } 244661701eeSAndreas Gohr } 245661701eeSAndreas Gohr 246f93272b9SAndreas Gohr /** @inheritdoc */ 247f93272b9SAndreas Gohr public function listo_open($classes = null) 248661701eeSAndreas Gohr { 249f93272b9SAndreas Gohr if ($this->listMode === []) { 250661701eeSAndreas Gohr $this->doc .= DOKU_LF; 251661701eeSAndreas Gohr } 252661701eeSAndreas Gohr $this->listMode[] = '1.'; 253661701eeSAndreas Gohr } 254661701eeSAndreas Gohr 255f93272b9SAndreas Gohr /** @inheritdoc */ 256f93272b9SAndreas Gohr public function listo_close() 257661701eeSAndreas Gohr { 258661701eeSAndreas Gohr array_pop($this->listMode); 259f93272b9SAndreas Gohr if ($this->listMode === []) { 260661701eeSAndreas Gohr $this->doc .= DOKU_LF; 261661701eeSAndreas Gohr } 262661701eeSAndreas Gohr } 263661701eeSAndreas Gohr 264f93272b9SAndreas Gohr /** @inheritdoc */ 265f93272b9SAndreas Gohr public function listitem_open($level, $node = false) 266661701eeSAndreas Gohr { 267661701eeSAndreas Gohr $this->doc .= str_repeat(' ', $level * 2) . $this->listMode[count($this->listMode) - 1]; 268661701eeSAndreas Gohr } 269661701eeSAndreas Gohr 270f93272b9SAndreas Gohr /** @inheritdoc */ 271f93272b9SAndreas Gohr public function listitem_close() 272661701eeSAndreas Gohr { 273661701eeSAndreas Gohr } 274661701eeSAndreas Gohr 275661701eeSAndreas Gohr 276661701eeSAndreas Gohr /** @inheritdoc */ 277661701eeSAndreas Gohr public function listcontent_open() 278661701eeSAndreas Gohr { 279661701eeSAndreas Gohr } 280661701eeSAndreas Gohr 281661701eeSAndreas Gohr /** @inheritdoc */ 282661701eeSAndreas Gohr public function listcontent_close() 283661701eeSAndreas Gohr { 284661701eeSAndreas Gohr $this->doc .= DOKU_LF; 285661701eeSAndreas Gohr } 286661701eeSAndreas Gohr 287661701eeSAndreas Gohr /** @inheritdoc */ 288661701eeSAndreas Gohr public function unformatted($text) 289661701eeSAndreas Gohr { 290661701eeSAndreas Gohr $this->doc .= $text; 291661701eeSAndreas Gohr } 292661701eeSAndreas Gohr 293661701eeSAndreas Gohr /** @inheritdoc */ 294661701eeSAndreas Gohr public function quote_open() 295661701eeSAndreas Gohr { 296661701eeSAndreas Gohr $this->doc .= '>>>'; 297661701eeSAndreas Gohr } 298661701eeSAndreas Gohr 299661701eeSAndreas Gohr /** @inheritdoc */ 300661701eeSAndreas Gohr public function quote_close() 301661701eeSAndreas Gohr { 302661701eeSAndreas Gohr $this->doc .= '<<<' . DOKU_LF; 303661701eeSAndreas Gohr } 304661701eeSAndreas Gohr 305661701eeSAndreas Gohr /** @inheritdoc */ 306661701eeSAndreas Gohr public function preformatted($text) 307661701eeSAndreas Gohr { 308661701eeSAndreas Gohr $this->code($text); 309661701eeSAndreas Gohr } 310661701eeSAndreas Gohr 311661701eeSAndreas Gohr /** @inheritdoc */ 312661701eeSAndreas Gohr public function file($text, $language = null, $filename = null, $options = null) 313661701eeSAndreas Gohr { 314661701eeSAndreas Gohr $this->code($text, $language, $filename, $options); 315661701eeSAndreas Gohr } 316661701eeSAndreas Gohr 317661701eeSAndreas Gohr /** @inheritdoc */ 318661701eeSAndreas Gohr public function code($text, $language = null, $filename = null, $options = null) 319661701eeSAndreas Gohr { 320661701eeSAndreas Gohr $this->doc .= DOKU_LF . '```' . ($language ?? '') . DOKU_LF . trim($text) . DOKU_LF . '```' . DOKU_LF; 321661701eeSAndreas Gohr } 322661701eeSAndreas Gohr 323661701eeSAndreas Gohr /** @inheritdoc */ 324661701eeSAndreas Gohr public function acronym($acronym) 325661701eeSAndreas Gohr { 326661701eeSAndreas Gohr if (array_key_exists($acronym, $this->acronyms)) { 327661701eeSAndreas Gohr $title = $this->acronyms[$acronym]; 328661701eeSAndreas Gohr $this->doc .= $acronym . ' (' . $title . ')'; 329661701eeSAndreas Gohr } else { 330661701eeSAndreas Gohr $this->doc .= $acronym; 331661701eeSAndreas Gohr } 332661701eeSAndreas Gohr } 333661701eeSAndreas Gohr 334661701eeSAndreas Gohr /** @inheritdoc */ 335661701eeSAndreas Gohr public function smiley($smiley) 336661701eeSAndreas Gohr { 337661701eeSAndreas Gohr $this->doc .= $smiley; 338661701eeSAndreas Gohr } 339661701eeSAndreas Gohr 340661701eeSAndreas Gohr /** @inheritdoc */ 341661701eeSAndreas Gohr public function entity($entity) 342661701eeSAndreas Gohr { 343661701eeSAndreas Gohr if (array_key_exists($entity, $this->entities)) { 344661701eeSAndreas Gohr $this->doc .= $this->entities[$entity]; 345661701eeSAndreas Gohr } else { 346661701eeSAndreas Gohr $this->doc .= $entity; 347661701eeSAndreas Gohr } 348661701eeSAndreas Gohr } 349661701eeSAndreas Gohr 350661701eeSAndreas Gohr /** @inheritdoc */ 351661701eeSAndreas Gohr public function multiplyentity($x, $y) 352661701eeSAndreas Gohr { 353661701eeSAndreas Gohr $this->doc .= $x . 'x' . $y; 354661701eeSAndreas Gohr } 355661701eeSAndreas Gohr 356661701eeSAndreas Gohr /** @inheritdoc */ 357661701eeSAndreas Gohr public function singlequoteopening() 358661701eeSAndreas Gohr { 359661701eeSAndreas Gohr global $lang; 360661701eeSAndreas Gohr $this->doc .= $lang['singlequoteopening']; 361661701eeSAndreas Gohr } 362661701eeSAndreas Gohr 363661701eeSAndreas Gohr /** @inheritdoc */ 364661701eeSAndreas Gohr public function singlequoteclosing() 365661701eeSAndreas Gohr { 366661701eeSAndreas Gohr global $lang; 367661701eeSAndreas Gohr $this->doc .= $lang['singlequoteclosing']; 368661701eeSAndreas Gohr } 369661701eeSAndreas Gohr 370661701eeSAndreas Gohr /** @inheritdoc */ 371661701eeSAndreas Gohr public function apostrophe() 372661701eeSAndreas Gohr { 373661701eeSAndreas Gohr global $lang; 374661701eeSAndreas Gohr $this->doc .= $lang['apostrophe']; 375661701eeSAndreas Gohr } 376661701eeSAndreas Gohr 377661701eeSAndreas Gohr /** @inheritdoc */ 378661701eeSAndreas Gohr public function doublequoteopening() 379661701eeSAndreas Gohr { 380661701eeSAndreas Gohr global $lang; 381661701eeSAndreas Gohr $this->doc .= $lang['doublequoteopening']; 382661701eeSAndreas Gohr } 383661701eeSAndreas Gohr 384661701eeSAndreas Gohr /** @inheritdoc */ 385661701eeSAndreas Gohr public function doublequoteclosing() 386661701eeSAndreas Gohr { 387661701eeSAndreas Gohr global $lang; 388661701eeSAndreas Gohr $this->doc .= $lang['doublequoteclosing']; 389661701eeSAndreas Gohr } 390661701eeSAndreas Gohr 391661701eeSAndreas Gohr /** @inheritdoc */ 392661701eeSAndreas Gohr public function camelcaselink($link, $returnonly = false) 393661701eeSAndreas Gohr { 394661701eeSAndreas Gohr $this->internallink($link, $link); 395661701eeSAndreas Gohr } 396661701eeSAndreas Gohr 397661701eeSAndreas Gohr /** @inheritdoc */ 398661701eeSAndreas Gohr public function locallink($hash, $name = null, $returnonly = false) 399661701eeSAndreas Gohr { 400661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, $hash, $isImage); 401661701eeSAndreas Gohr $this->doc .= $name; 402661701eeSAndreas Gohr } 403661701eeSAndreas Gohr 404661701eeSAndreas Gohr /** @inheritdoc */ 405661701eeSAndreas Gohr public function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') 406661701eeSAndreas Gohr { 407661701eeSAndreas Gohr global $ID; 408661701eeSAndreas Gohr // default name is based on $id as given 409661701eeSAndreas Gohr $default = $this->_simpleTitle($id); 410661701eeSAndreas Gohr $resolver = new PageResolver($ID); 411661701eeSAndreas Gohr $id = $resolver->resolveId($id); 412661701eeSAndreas Gohr 413661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); 414661701eeSAndreas Gohr if ($returnonly) { 415661701eeSAndreas Gohr return $name; 416661701eeSAndreas Gohr } 417661701eeSAndreas Gohr $this->doc .= $name; 418661701eeSAndreas Gohr return null; 419661701eeSAndreas Gohr } 420661701eeSAndreas Gohr 421661701eeSAndreas Gohr /** @inheritdoc */ 422661701eeSAndreas Gohr public function externallink($url, $name = null, $returnonly = false) 423661701eeSAndreas Gohr { 424661701eeSAndreas Gohr $title = $this->_getLinkTitle($name, $url, $isImage); 425661701eeSAndreas Gohr if ($title != $url) { 426661701eeSAndreas Gohr $this->doc .= "[$title]($url)"; 427661701eeSAndreas Gohr } else { 428661701eeSAndreas Gohr $this->doc .= $title; 429661701eeSAndreas Gohr } 430661701eeSAndreas Gohr } 431661701eeSAndreas Gohr 432661701eeSAndreas Gohr /** @inheritdoc */ 433661701eeSAndreas Gohr public function interwikilink($match, $name, $wikiName, $wikiUri, $returnonly = false) 434661701eeSAndreas Gohr { 435661701eeSAndreas Gohr $this->doc .= $this->_getLinkTitle($name, $wikiUri, $isImage); 436661701eeSAndreas Gohr } 437661701eeSAndreas Gohr 438661701eeSAndreas Gohr /** @inheritdoc */ 439661701eeSAndreas Gohr public function windowssharelink($url, $name = null, $returnonly = false) 440661701eeSAndreas Gohr { 441661701eeSAndreas Gohr $this->doc .= $this->_getLinkTitle($name, $url, $isImage); 442661701eeSAndreas Gohr } 443661701eeSAndreas Gohr 444661701eeSAndreas Gohr /** @inheritdoc */ 445661701eeSAndreas Gohr public function emaillink($address, $name = null, $returnonly = false) 446661701eeSAndreas Gohr { 447661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, '', $isImage); 448661701eeSAndreas Gohr $address = html_entity_decode(obfuscate($address), ENT_QUOTES, 'UTF-8'); 449661701eeSAndreas Gohr if (empty($name)) { 450661701eeSAndreas Gohr $name = $address; 451661701eeSAndreas Gohr } 452661701eeSAndreas Gohr $this->doc .= $name; 453661701eeSAndreas Gohr } 454661701eeSAndreas Gohr 455661701eeSAndreas Gohr /** @inheritdoc */ 456f93272b9SAndreas Gohr public function internalmedia( 457f93272b9SAndreas Gohr $src, 458f93272b9SAndreas Gohr $title = null, 459f93272b9SAndreas Gohr $align = null, 460f93272b9SAndreas Gohr $width = null, 461f93272b9SAndreas Gohr $height = null, 462f93272b9SAndreas Gohr $cache = null, 463f93272b9SAndreas Gohr $linking = null, 464f93272b9SAndreas Gohr $return = false 465f93272b9SAndreas Gohr ) { 466661701eeSAndreas Gohr $this->doc .= $title; 467661701eeSAndreas Gohr } 468661701eeSAndreas Gohr 469661701eeSAndreas Gohr /** @inheritdoc */ 470f93272b9SAndreas Gohr public function externalmedia( 471f93272b9SAndreas Gohr $src, 472f93272b9SAndreas Gohr $title = null, 473f93272b9SAndreas Gohr $align = null, 474f93272b9SAndreas Gohr $width = null, 475f93272b9SAndreas Gohr $height = null, 476f93272b9SAndreas Gohr $cache = null, 477f93272b9SAndreas Gohr $linking = null, 478f93272b9SAndreas Gohr $return = false 479f93272b9SAndreas Gohr ) { 480661701eeSAndreas Gohr $this->doc .= $title; 481661701eeSAndreas Gohr } 482661701eeSAndreas Gohr 483661701eeSAndreas Gohr /** @inheritdoc */ 484661701eeSAndreas Gohr public function rss($url, $params) 485661701eeSAndreas Gohr { 486661701eeSAndreas Gohr } 487661701eeSAndreas Gohr 488661701eeSAndreas Gohr /** @inheritdoc */ 489661701eeSAndreas Gohr public function table_open($maxcols = null, $numrows = null, $pos = null, $classes = null) 490661701eeSAndreas Gohr { 491661701eeSAndreas Gohr } 492661701eeSAndreas Gohr 493661701eeSAndreas Gohr /** @inheritdoc */ 494661701eeSAndreas Gohr public function table_close($pos = null) 495661701eeSAndreas Gohr { 496661701eeSAndreas Gohr $this->doc .= DOKU_LF; 497661701eeSAndreas Gohr } 498661701eeSAndreas Gohr 499f93272b9SAndreas Gohr /** @inheritdoc */ 500f93272b9SAndreas Gohr public function tablethead_open() 501661701eeSAndreas Gohr { 502661701eeSAndreas Gohr $this->tableColumns = 0; 503661701eeSAndreas Gohr $this->doc .= DOKU_LF; // . '|'; 504661701eeSAndreas Gohr } 505661701eeSAndreas Gohr 506f93272b9SAndreas Gohr /** @inheritdoc */ 507f93272b9SAndreas Gohr public function tablethead_close() 508661701eeSAndreas Gohr { 509661701eeSAndreas Gohr $this->doc .= '|' . str_repeat('---|', $this->tableColumns) . DOKU_LF; 510661701eeSAndreas Gohr } 511661701eeSAndreas Gohr 512f93272b9SAndreas Gohr /** @inheritdoc */ 513f93272b9SAndreas Gohr public function tabletbody_open() 514661701eeSAndreas Gohr { 515661701eeSAndreas Gohr } 516661701eeSAndreas Gohr 517f93272b9SAndreas Gohr /** @inheritdoc */ 518f93272b9SAndreas Gohr public function tabletbody_close() 519661701eeSAndreas Gohr { 520661701eeSAndreas Gohr } 521661701eeSAndreas Gohr 522f93272b9SAndreas Gohr /** @inheritdoc */ 523f93272b9SAndreas Gohr public function tabletfoot_open() 524661701eeSAndreas Gohr { 525661701eeSAndreas Gohr } 526661701eeSAndreas Gohr 527f93272b9SAndreas Gohr /** @inheritdoc */ 528f93272b9SAndreas Gohr public function tabletfoot_close() 529f93272b9SAndreas Gohr { 530f93272b9SAndreas Gohr } 531f93272b9SAndreas Gohr 532f93272b9SAndreas Gohr /** @inheritdoc */ 533f93272b9SAndreas Gohr public function tablerow_open($classes = null) 534f93272b9SAndreas Gohr { 535f93272b9SAndreas Gohr } 536f93272b9SAndreas Gohr 537f93272b9SAndreas Gohr /** @inheritdoc */ 538f93272b9SAndreas Gohr public function tablerow_close() 539661701eeSAndreas Gohr { 540661701eeSAndreas Gohr $this->doc .= '|' . DOKU_LF; 541661701eeSAndreas Gohr } 542661701eeSAndreas Gohr 543f93272b9SAndreas Gohr /** @inheritdoc */ 544f93272b9SAndreas Gohr public function tableheader_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) 545661701eeSAndreas Gohr { 546661701eeSAndreas Gohr $this->doc .= str_repeat('|', $colspan); 547661701eeSAndreas Gohr $this->tableColumns += $colspan; 548661701eeSAndreas Gohr } 549661701eeSAndreas Gohr 550f93272b9SAndreas Gohr /** @inheritdoc */ 551f93272b9SAndreas Gohr public function tableheader_close() 552661701eeSAndreas Gohr { 553661701eeSAndreas Gohr } 554661701eeSAndreas Gohr 555f93272b9SAndreas Gohr /** @inheritdoc */ 556f93272b9SAndreas Gohr public function tablecell_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) 557661701eeSAndreas Gohr { 558661701eeSAndreas Gohr $this->doc .= str_repeat('|', $colspan); 559661701eeSAndreas Gohr } 560661701eeSAndreas Gohr 561f93272b9SAndreas Gohr /** @inheritdoc */ 562f93272b9SAndreas Gohr public function tablecell_close() 563661701eeSAndreas Gohr { 564661701eeSAndreas Gohr } 565661701eeSAndreas Gohr 566661701eeSAndreas Gohr /** @inheritdoc */ 567661701eeSAndreas Gohr public function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') 568661701eeSAndreas Gohr { 569661701eeSAndreas Gohr $isImage = false; 570661701eeSAndreas Gohr if (is_array($title)) { 571661701eeSAndreas Gohr $isImage = true; 572661701eeSAndreas Gohr if (!is_null($default) && ($default != $title['title'])) 573661701eeSAndreas Gohr return $default . " " . $title['title']; 574f93272b9SAndreas Gohr else return $title['title']; 575661701eeSAndreas Gohr } elseif (is_null($title) || trim($title) == '') { 576661701eeSAndreas Gohr if (useHeading($linktype) && $id) { 577661701eeSAndreas Gohr $heading = p_get_first_heading($id); 578661701eeSAndreas Gohr if ($heading) { 579661701eeSAndreas Gohr return $this->_xmlEntities($heading); 580661701eeSAndreas Gohr } 581661701eeSAndreas Gohr } 582661701eeSAndreas Gohr return $this->_xmlEntities($default); 583661701eeSAndreas Gohr } else { 584661701eeSAndreas Gohr return $this->_xmlEntities($title); 585661701eeSAndreas Gohr } 586661701eeSAndreas Gohr } 587661701eeSAndreas Gohr 588661701eeSAndreas Gohr /** @inheritdoc */ 589661701eeSAndreas Gohr public function _xmlEntities($string) 590661701eeSAndreas Gohr { 591661701eeSAndreas Gohr return $string; // nothing to do for text 592661701eeSAndreas Gohr } 593661701eeSAndreas Gohr 594661701eeSAndreas Gohr /** @inheritdoc */ 595661701eeSAndreas Gohr public function _formatLink($link) 596661701eeSAndreas Gohr { 597661701eeSAndreas Gohr if (!empty($link['name'])) { 598661701eeSAndreas Gohr return $link['name']; 599661701eeSAndreas Gohr } elseif (!empty($link['title'])) { 600661701eeSAndreas Gohr return $link['title']; 601661701eeSAndreas Gohr } 602661701eeSAndreas Gohr return $link['url']; 603661701eeSAndreas Gohr } 604661701eeSAndreas Gohr} 605