1661701eeSAndreas Gohr<?php 2661701eeSAndreas Gohr 3*f93272b9SAndreas Gohr// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps 4*f93272b9SAndreas Gohr// phpcs:disable PSR2.Methods.MethodDeclaration.Underscore 5*f93272b9SAndreas Gohr 6*f93272b9SAndreas Gohruse dokuwiki\Extension\SyntaxPlugin; 7661701eeSAndreas Gohruse dokuwiki\File\PageResolver; 8661701eeSAndreas Gohr 9661701eeSAndreas Gohr/** 10661701eeSAndreas Gohr * Renderer for preparing data for embedding 11661701eeSAndreas Gohr * 12*f93272b9SAndreas Gohr * Based on the text and markdown renderers 13661701eeSAndreas Gohr * 14*f93272b9SAndreas 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{ 23*f93272b9SAndreas Gohr /** @var array The stack of list types */ 24*f93272b9SAndreas Gohr private $listMode = []; 25661701eeSAndreas Gohr 26*f93272b9SAndreas Gohr /** @var int Number of table columns */ 27*f93272b9SAndreas Gohr private $tableColumns = 0; 28661701eeSAndreas Gohr 29661701eeSAndreas Gohr /** @inheritdoc */ 30*f93272b9SAndreas 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 { 51*f93272b9SAndreas 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 = ''; 63*f93272b9SAndreas 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 = ''; 78*f93272b9SAndreas Gohr $metaheader = []; 79661701eeSAndreas Gohr $metaheader['Content-Type'] = 'text/plain; charset=utf-8'; 80*f93272b9SAndreas 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 90661701eeSAndreas Gohr } 91661701eeSAndreas Gohr 92661701eeSAndreas Gohr /** @inheritdoc */ 93661701eeSAndreas Gohr public function header($text, $level, $pos, $returnonly = false) 94661701eeSAndreas Gohr { 95661701eeSAndreas Gohr $this->doc .= str_repeat("#", $level) . ' ' . $text . DOKU_LF; 96661701eeSAndreas Gohr } 97661701eeSAndreas Gohr 98661701eeSAndreas Gohr /** @inheritdoc */ 99661701eeSAndreas Gohr public function section_open($level) 100661701eeSAndreas Gohr { 101661701eeSAndreas Gohr $this->doc .= DOKU_LF; 102661701eeSAndreas Gohr } 103661701eeSAndreas Gohr 104661701eeSAndreas Gohr /** @inheritdoc */ 105661701eeSAndreas Gohr public function section_close() 106661701eeSAndreas Gohr { 107661701eeSAndreas Gohr $this->doc .= DOKU_LF; 108661701eeSAndreas Gohr } 109661701eeSAndreas Gohr 110661701eeSAndreas Gohr /** @inheritdoc */ 111661701eeSAndreas Gohr public function cdata($text) 112661701eeSAndreas Gohr { 113661701eeSAndreas Gohr $this->doc .= $text; 114661701eeSAndreas Gohr } 115661701eeSAndreas Gohr 116661701eeSAndreas Gohr /** @inheritdoc */ 117661701eeSAndreas Gohr public function p_open() 118661701eeSAndreas Gohr { 119661701eeSAndreas Gohr $this->doc .= DOKU_LF; 120661701eeSAndreas Gohr } 121661701eeSAndreas Gohr 122661701eeSAndreas Gohr /** @inheritdoc */ 123661701eeSAndreas Gohr public function p_close() 124661701eeSAndreas Gohr { 125661701eeSAndreas Gohr $this->doc .= DOKU_LF; 126661701eeSAndreas Gohr } 127661701eeSAndreas Gohr 128661701eeSAndreas Gohr /** @inheritdoc */ 129661701eeSAndreas Gohr public function linebreak() 130661701eeSAndreas Gohr { 131661701eeSAndreas Gohr $this->doc .= DOKU_LF . DOKU_LF; 132661701eeSAndreas Gohr } 133661701eeSAndreas Gohr 134661701eeSAndreas Gohr /** @inheritdoc */ 135661701eeSAndreas Gohr public function hr() 136661701eeSAndreas Gohr { 137661701eeSAndreas Gohr $this->doc .= '----' . DOKU_LF; 138661701eeSAndreas Gohr } 139661701eeSAndreas Gohr 140661701eeSAndreas Gohr /** @inheritdoc */ 141661701eeSAndreas Gohr public function strong_open() 142661701eeSAndreas Gohr { 143661701eeSAndreas Gohr } 144661701eeSAndreas Gohr 145661701eeSAndreas Gohr /** @inheritdoc */ 146661701eeSAndreas Gohr public function strong_close() 147661701eeSAndreas Gohr { 148661701eeSAndreas Gohr } 149661701eeSAndreas Gohr 150661701eeSAndreas Gohr /** @inheritdoc */ 151661701eeSAndreas Gohr public function emphasis_open() 152661701eeSAndreas Gohr { 153661701eeSAndreas Gohr } 154661701eeSAndreas Gohr 155661701eeSAndreas Gohr /** @inheritdoc */ 156661701eeSAndreas Gohr public function emphasis_close() 157661701eeSAndreas Gohr { 158661701eeSAndreas Gohr } 159661701eeSAndreas Gohr 160661701eeSAndreas Gohr /** @inheritdoc */ 161661701eeSAndreas Gohr public function underline_open() 162661701eeSAndreas Gohr { 163661701eeSAndreas Gohr } 164661701eeSAndreas Gohr 165661701eeSAndreas Gohr /** @inheritdoc */ 166661701eeSAndreas Gohr public function underline_close() 167661701eeSAndreas Gohr { 168661701eeSAndreas Gohr } 169661701eeSAndreas Gohr 170661701eeSAndreas Gohr /** @inheritdoc */ 171661701eeSAndreas Gohr public function monospace_open() 172661701eeSAndreas Gohr { 173661701eeSAndreas Gohr } 174661701eeSAndreas Gohr 175661701eeSAndreas Gohr /** @inheritdoc */ 176661701eeSAndreas Gohr public function monospace_close() 177661701eeSAndreas Gohr { 178661701eeSAndreas Gohr } 179661701eeSAndreas Gohr 180661701eeSAndreas Gohr /** @inheritdoc */ 181661701eeSAndreas Gohr public function subscript_open() 182661701eeSAndreas Gohr { 183661701eeSAndreas Gohr } 184661701eeSAndreas Gohr 185661701eeSAndreas Gohr /** @inheritdoc */ 186661701eeSAndreas Gohr public function subscript_close() 187661701eeSAndreas Gohr { 188661701eeSAndreas Gohr } 189661701eeSAndreas Gohr 190661701eeSAndreas Gohr /** @inheritdoc */ 191661701eeSAndreas Gohr public function superscript_open() 192661701eeSAndreas Gohr { 193661701eeSAndreas Gohr } 194661701eeSAndreas Gohr 195661701eeSAndreas Gohr /** @inheritdoc */ 196661701eeSAndreas Gohr public function superscript_close() 197661701eeSAndreas Gohr { 198661701eeSAndreas Gohr } 199661701eeSAndreas Gohr 200661701eeSAndreas Gohr /** @inheritdoc */ 201661701eeSAndreas Gohr public function deleted_open() 202661701eeSAndreas Gohr { 203661701eeSAndreas Gohr } 204661701eeSAndreas Gohr 205661701eeSAndreas Gohr /** @inheritdoc */ 206661701eeSAndreas Gohr public function deleted_close() 207661701eeSAndreas Gohr { 208661701eeSAndreas Gohr } 209661701eeSAndreas Gohr 210661701eeSAndreas Gohr /** @inheritdoc */ 211661701eeSAndreas Gohr public function footnote_open() 212661701eeSAndreas Gohr { 213661701eeSAndreas Gohr $this->doc .= ' (('; 214661701eeSAndreas Gohr } 215661701eeSAndreas Gohr 216661701eeSAndreas Gohr /** @inheritdoc */ 217661701eeSAndreas Gohr public function footnote_close() 218661701eeSAndreas Gohr { 219661701eeSAndreas Gohr $this->doc .= '))'; 220661701eeSAndreas Gohr } 221661701eeSAndreas Gohr 222*f93272b9SAndreas Gohr /** @inheritdoc */ 223*f93272b9SAndreas Gohr public function listu_open($classes = null) 224661701eeSAndreas Gohr { 225*f93272b9SAndreas Gohr if ($this->listMode === []) { 226661701eeSAndreas Gohr $this->doc .= DOKU_LF; 227661701eeSAndreas Gohr } 228661701eeSAndreas Gohr $this->listMode[] = '*'; 229661701eeSAndreas Gohr } 230661701eeSAndreas Gohr 231*f93272b9SAndreas Gohr /** @inheritdoc */ 232*f93272b9SAndreas Gohr public function listu_close() 233661701eeSAndreas Gohr { 234661701eeSAndreas Gohr array_pop($this->listMode); 235*f93272b9SAndreas Gohr if ($this->listMode === []) { 236661701eeSAndreas Gohr $this->doc .= DOKU_LF; 237661701eeSAndreas Gohr } 238661701eeSAndreas Gohr } 239661701eeSAndreas Gohr 240*f93272b9SAndreas Gohr /** @inheritdoc */ 241*f93272b9SAndreas Gohr public function listo_open($classes = null) 242661701eeSAndreas Gohr { 243*f93272b9SAndreas Gohr if ($this->listMode === []) { 244661701eeSAndreas Gohr $this->doc .= DOKU_LF; 245661701eeSAndreas Gohr } 246661701eeSAndreas Gohr $this->listMode[] = '1.'; 247661701eeSAndreas Gohr } 248661701eeSAndreas Gohr 249*f93272b9SAndreas Gohr /** @inheritdoc */ 250*f93272b9SAndreas Gohr public function listo_close() 251661701eeSAndreas Gohr { 252661701eeSAndreas Gohr array_pop($this->listMode); 253*f93272b9SAndreas Gohr if ($this->listMode === []) { 254661701eeSAndreas Gohr $this->doc .= DOKU_LF; 255661701eeSAndreas Gohr } 256661701eeSAndreas Gohr } 257661701eeSAndreas Gohr 258*f93272b9SAndreas Gohr /** @inheritdoc */ 259*f93272b9SAndreas Gohr public function listitem_open($level, $node = false) 260661701eeSAndreas Gohr { 261661701eeSAndreas Gohr $this->doc .= str_repeat(' ', $level * 2) . $this->listMode[count($this->listMode) - 1]; 262661701eeSAndreas Gohr } 263661701eeSAndreas Gohr 264*f93272b9SAndreas Gohr /** @inheritdoc */ 265*f93272b9SAndreas Gohr public function listitem_close() 266661701eeSAndreas Gohr { 267661701eeSAndreas Gohr } 268661701eeSAndreas Gohr 269661701eeSAndreas Gohr 270661701eeSAndreas Gohr /** @inheritdoc */ 271661701eeSAndreas Gohr public function listcontent_open() 272661701eeSAndreas Gohr { 273661701eeSAndreas Gohr } 274661701eeSAndreas Gohr 275661701eeSAndreas Gohr /** @inheritdoc */ 276661701eeSAndreas Gohr public function listcontent_close() 277661701eeSAndreas Gohr { 278661701eeSAndreas Gohr $this->doc .= DOKU_LF; 279661701eeSAndreas Gohr } 280661701eeSAndreas Gohr 281661701eeSAndreas Gohr /** @inheritdoc */ 282661701eeSAndreas Gohr public function unformatted($text) 283661701eeSAndreas Gohr { 284661701eeSAndreas Gohr $this->doc .= $text; 285661701eeSAndreas Gohr } 286661701eeSAndreas Gohr 287661701eeSAndreas Gohr /** @inheritdoc */ 288661701eeSAndreas Gohr public function quote_open() 289661701eeSAndreas Gohr { 290661701eeSAndreas Gohr $this->doc .= '>>>'; 291661701eeSAndreas Gohr } 292661701eeSAndreas Gohr 293661701eeSAndreas Gohr /** @inheritdoc */ 294661701eeSAndreas Gohr public function quote_close() 295661701eeSAndreas Gohr { 296661701eeSAndreas Gohr $this->doc .= '<<<' . DOKU_LF; 297661701eeSAndreas Gohr } 298661701eeSAndreas Gohr 299661701eeSAndreas Gohr /** @inheritdoc */ 300661701eeSAndreas Gohr public function preformatted($text) 301661701eeSAndreas Gohr { 302661701eeSAndreas Gohr $this->code($text); 303661701eeSAndreas Gohr } 304661701eeSAndreas Gohr 305661701eeSAndreas Gohr /** @inheritdoc */ 306661701eeSAndreas Gohr public function file($text, $language = null, $filename = null, $options = null) 307661701eeSAndreas Gohr { 308661701eeSAndreas Gohr $this->code($text, $language, $filename, $options); 309661701eeSAndreas Gohr } 310661701eeSAndreas Gohr 311661701eeSAndreas Gohr /** @inheritdoc */ 312661701eeSAndreas Gohr public function code($text, $language = null, $filename = null, $options = null) 313661701eeSAndreas Gohr { 314661701eeSAndreas Gohr $this->doc .= DOKU_LF . '```' . ($language ?? '') . DOKU_LF . trim($text) . DOKU_LF . '```' . DOKU_LF; 315661701eeSAndreas Gohr } 316661701eeSAndreas Gohr 317661701eeSAndreas Gohr /** @inheritdoc */ 318661701eeSAndreas Gohr public function acronym($acronym) 319661701eeSAndreas Gohr { 320661701eeSAndreas Gohr if (array_key_exists($acronym, $this->acronyms)) { 321661701eeSAndreas Gohr $title = $this->acronyms[$acronym]; 322661701eeSAndreas Gohr $this->doc .= $acronym . ' (' . $title . ')'; 323661701eeSAndreas Gohr } else { 324661701eeSAndreas Gohr $this->doc .= $acronym; 325661701eeSAndreas Gohr } 326661701eeSAndreas Gohr } 327661701eeSAndreas Gohr 328661701eeSAndreas Gohr /** @inheritdoc */ 329661701eeSAndreas Gohr public function smiley($smiley) 330661701eeSAndreas Gohr { 331661701eeSAndreas Gohr $this->doc .= $smiley; 332661701eeSAndreas Gohr } 333661701eeSAndreas Gohr 334661701eeSAndreas Gohr /** @inheritdoc */ 335661701eeSAndreas Gohr public function entity($entity) 336661701eeSAndreas Gohr { 337661701eeSAndreas Gohr if (array_key_exists($entity, $this->entities)) { 338661701eeSAndreas Gohr $this->doc .= $this->entities[$entity]; 339661701eeSAndreas Gohr } else { 340661701eeSAndreas Gohr $this->doc .= $entity; 341661701eeSAndreas Gohr } 342661701eeSAndreas Gohr } 343661701eeSAndreas Gohr 344661701eeSAndreas Gohr /** @inheritdoc */ 345661701eeSAndreas Gohr public function multiplyentity($x, $y) 346661701eeSAndreas Gohr { 347661701eeSAndreas Gohr $this->doc .= $x . 'x' . $y; 348661701eeSAndreas Gohr } 349661701eeSAndreas Gohr 350661701eeSAndreas Gohr /** @inheritdoc */ 351661701eeSAndreas Gohr public function singlequoteopening() 352661701eeSAndreas Gohr { 353661701eeSAndreas Gohr global $lang; 354661701eeSAndreas Gohr $this->doc .= $lang['singlequoteopening']; 355661701eeSAndreas Gohr } 356661701eeSAndreas Gohr 357661701eeSAndreas Gohr /** @inheritdoc */ 358661701eeSAndreas Gohr public function singlequoteclosing() 359661701eeSAndreas Gohr { 360661701eeSAndreas Gohr global $lang; 361661701eeSAndreas Gohr $this->doc .= $lang['singlequoteclosing']; 362661701eeSAndreas Gohr } 363661701eeSAndreas Gohr 364661701eeSAndreas Gohr /** @inheritdoc */ 365661701eeSAndreas Gohr public function apostrophe() 366661701eeSAndreas Gohr { 367661701eeSAndreas Gohr global $lang; 368661701eeSAndreas Gohr $this->doc .= $lang['apostrophe']; 369661701eeSAndreas Gohr } 370661701eeSAndreas Gohr 371661701eeSAndreas Gohr /** @inheritdoc */ 372661701eeSAndreas Gohr public function doublequoteopening() 373661701eeSAndreas Gohr { 374661701eeSAndreas Gohr global $lang; 375661701eeSAndreas Gohr $this->doc .= $lang['doublequoteopening']; 376661701eeSAndreas Gohr } 377661701eeSAndreas Gohr 378661701eeSAndreas Gohr /** @inheritdoc */ 379661701eeSAndreas Gohr public function doublequoteclosing() 380661701eeSAndreas Gohr { 381661701eeSAndreas Gohr global $lang; 382661701eeSAndreas Gohr $this->doc .= $lang['doublequoteclosing']; 383661701eeSAndreas Gohr } 384661701eeSAndreas Gohr 385661701eeSAndreas Gohr /** @inheritdoc */ 386661701eeSAndreas Gohr public function camelcaselink($link, $returnonly = false) 387661701eeSAndreas Gohr { 388661701eeSAndreas Gohr $this->internallink($link, $link); 389661701eeSAndreas Gohr } 390661701eeSAndreas Gohr 391661701eeSAndreas Gohr /** @inheritdoc */ 392661701eeSAndreas Gohr public function locallink($hash, $name = null, $returnonly = false) 393661701eeSAndreas Gohr { 394661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, $hash, $isImage); 395661701eeSAndreas Gohr $this->doc .= $name; 396661701eeSAndreas Gohr } 397661701eeSAndreas Gohr 398661701eeSAndreas Gohr /** @inheritdoc */ 399661701eeSAndreas Gohr public function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') 400661701eeSAndreas Gohr { 401661701eeSAndreas Gohr global $ID; 402661701eeSAndreas Gohr // default name is based on $id as given 403661701eeSAndreas Gohr $default = $this->_simpleTitle($id); 404661701eeSAndreas Gohr $resolver = new PageResolver($ID); 405661701eeSAndreas Gohr $id = $resolver->resolveId($id); 406661701eeSAndreas Gohr 407661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); 408661701eeSAndreas Gohr if ($returnonly) { 409661701eeSAndreas Gohr return $name; 410661701eeSAndreas Gohr } 411661701eeSAndreas Gohr $this->doc .= $name; 412661701eeSAndreas Gohr return null; 413661701eeSAndreas Gohr } 414661701eeSAndreas Gohr 415661701eeSAndreas Gohr /** @inheritdoc */ 416661701eeSAndreas Gohr public function externallink($url, $name = null, $returnonly = false) 417661701eeSAndreas Gohr { 418661701eeSAndreas Gohr $title = $this->_getLinkTitle($name, $url, $isImage); 419661701eeSAndreas Gohr if ($title != $url) { 420661701eeSAndreas Gohr $this->doc .= "[$title]($url)"; 421661701eeSAndreas Gohr } else { 422661701eeSAndreas Gohr $this->doc .= $title; 423661701eeSAndreas Gohr } 424661701eeSAndreas Gohr } 425661701eeSAndreas Gohr 426661701eeSAndreas Gohr /** @inheritdoc */ 427661701eeSAndreas Gohr public function interwikilink($match, $name, $wikiName, $wikiUri, $returnonly = false) 428661701eeSAndreas Gohr { 429661701eeSAndreas Gohr $this->doc .= $this->_getLinkTitle($name, $wikiUri, $isImage); 430661701eeSAndreas Gohr } 431661701eeSAndreas Gohr 432661701eeSAndreas Gohr /** @inheritdoc */ 433661701eeSAndreas Gohr public function windowssharelink($url, $name = null, $returnonly = false) 434661701eeSAndreas Gohr { 435661701eeSAndreas Gohr $this->doc .= $this->_getLinkTitle($name, $url, $isImage); 436661701eeSAndreas Gohr } 437661701eeSAndreas Gohr 438661701eeSAndreas Gohr /** @inheritdoc */ 439661701eeSAndreas Gohr public function emaillink($address, $name = null, $returnonly = false) 440661701eeSAndreas Gohr { 441661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, '', $isImage); 442661701eeSAndreas Gohr $address = html_entity_decode(obfuscate($address), ENT_QUOTES, 'UTF-8'); 443661701eeSAndreas Gohr if (empty($name)) { 444661701eeSAndreas Gohr $name = $address; 445661701eeSAndreas Gohr } 446661701eeSAndreas Gohr $this->doc .= $name; 447661701eeSAndreas Gohr } 448661701eeSAndreas Gohr 449661701eeSAndreas Gohr /** @inheritdoc */ 450*f93272b9SAndreas Gohr public function internalmedia( 451*f93272b9SAndreas Gohr $src, 452*f93272b9SAndreas Gohr $title = null, 453*f93272b9SAndreas Gohr $align = null, 454*f93272b9SAndreas Gohr $width = null, 455*f93272b9SAndreas Gohr $height = null, 456*f93272b9SAndreas Gohr $cache = null, 457*f93272b9SAndreas Gohr $linking = null, 458*f93272b9SAndreas Gohr $return = false 459*f93272b9SAndreas Gohr ) { 460661701eeSAndreas Gohr $this->doc .= $title; 461661701eeSAndreas Gohr } 462661701eeSAndreas Gohr 463661701eeSAndreas Gohr /** @inheritdoc */ 464*f93272b9SAndreas Gohr public function externalmedia( 465*f93272b9SAndreas Gohr $src, 466*f93272b9SAndreas Gohr $title = null, 467*f93272b9SAndreas Gohr $align = null, 468*f93272b9SAndreas Gohr $width = null, 469*f93272b9SAndreas Gohr $height = null, 470*f93272b9SAndreas Gohr $cache = null, 471*f93272b9SAndreas Gohr $linking = null, 472*f93272b9SAndreas Gohr $return = false 473*f93272b9SAndreas Gohr ) { 474661701eeSAndreas Gohr $this->doc .= $title; 475661701eeSAndreas Gohr } 476661701eeSAndreas Gohr 477661701eeSAndreas Gohr /** @inheritdoc */ 478661701eeSAndreas Gohr public function rss($url, $params) 479661701eeSAndreas Gohr { 480661701eeSAndreas Gohr } 481661701eeSAndreas Gohr 482661701eeSAndreas Gohr /** @inheritdoc */ 483661701eeSAndreas Gohr public function table_open($maxcols = null, $numrows = null, $pos = null, $classes = null) 484661701eeSAndreas Gohr { 485661701eeSAndreas Gohr } 486661701eeSAndreas Gohr 487661701eeSAndreas Gohr /** @inheritdoc */ 488661701eeSAndreas Gohr public function table_close($pos = null) 489661701eeSAndreas Gohr { 490661701eeSAndreas Gohr $this->doc .= DOKU_LF; 491661701eeSAndreas Gohr } 492661701eeSAndreas Gohr 493*f93272b9SAndreas Gohr /** @inheritdoc */ 494*f93272b9SAndreas Gohr public function tablethead_open() 495661701eeSAndreas Gohr { 496661701eeSAndreas Gohr $this->tableColumns = 0; 497661701eeSAndreas Gohr $this->doc .= DOKU_LF; // . '|'; 498661701eeSAndreas Gohr } 499661701eeSAndreas Gohr 500*f93272b9SAndreas Gohr /** @inheritdoc */ 501*f93272b9SAndreas Gohr public function tablethead_close() 502661701eeSAndreas Gohr { 503661701eeSAndreas Gohr $this->doc .= '|' . str_repeat('---|', $this->tableColumns) . DOKU_LF; 504661701eeSAndreas Gohr } 505661701eeSAndreas Gohr 506*f93272b9SAndreas Gohr /** @inheritdoc */ 507*f93272b9SAndreas Gohr public function tabletbody_open() 508661701eeSAndreas Gohr { 509661701eeSAndreas Gohr } 510661701eeSAndreas Gohr 511*f93272b9SAndreas Gohr /** @inheritdoc */ 512*f93272b9SAndreas Gohr public function tabletbody_close() 513661701eeSAndreas Gohr { 514661701eeSAndreas Gohr } 515661701eeSAndreas Gohr 516*f93272b9SAndreas Gohr /** @inheritdoc */ 517*f93272b9SAndreas Gohr public function tabletfoot_open() 518661701eeSAndreas Gohr { 519661701eeSAndreas Gohr } 520661701eeSAndreas Gohr 521*f93272b9SAndreas Gohr /** @inheritdoc */ 522*f93272b9SAndreas Gohr public function tabletfoot_close() 523*f93272b9SAndreas Gohr { 524*f93272b9SAndreas Gohr } 525*f93272b9SAndreas Gohr 526*f93272b9SAndreas Gohr /** @inheritdoc */ 527*f93272b9SAndreas Gohr public function tablerow_open($classes = null) 528*f93272b9SAndreas Gohr { 529*f93272b9SAndreas Gohr } 530*f93272b9SAndreas Gohr 531*f93272b9SAndreas Gohr /** @inheritdoc */ 532*f93272b9SAndreas Gohr public function tablerow_close() 533661701eeSAndreas Gohr { 534661701eeSAndreas Gohr $this->doc .= '|' . DOKU_LF; 535661701eeSAndreas Gohr } 536661701eeSAndreas Gohr 537*f93272b9SAndreas Gohr /** @inheritdoc */ 538*f93272b9SAndreas Gohr public function tableheader_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) 539661701eeSAndreas Gohr { 540661701eeSAndreas Gohr $this->doc .= str_repeat('|', $colspan); 541661701eeSAndreas Gohr $this->tableColumns += $colspan; 542661701eeSAndreas Gohr } 543661701eeSAndreas Gohr 544*f93272b9SAndreas Gohr /** @inheritdoc */ 545*f93272b9SAndreas Gohr public function tableheader_close() 546661701eeSAndreas Gohr { 547661701eeSAndreas Gohr } 548661701eeSAndreas Gohr 549*f93272b9SAndreas Gohr /** @inheritdoc */ 550*f93272b9SAndreas Gohr public function tablecell_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) 551661701eeSAndreas Gohr { 552661701eeSAndreas Gohr $this->doc .= str_repeat('|', $colspan); 553661701eeSAndreas Gohr } 554661701eeSAndreas Gohr 555*f93272b9SAndreas Gohr /** @inheritdoc */ 556*f93272b9SAndreas Gohr public function tablecell_close() 557661701eeSAndreas Gohr { 558661701eeSAndreas Gohr } 559661701eeSAndreas Gohr 560661701eeSAndreas Gohr /** @inheritdoc */ 561661701eeSAndreas Gohr public function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') 562661701eeSAndreas Gohr { 563661701eeSAndreas Gohr $isImage = false; 564661701eeSAndreas Gohr if (is_array($title)) { 565661701eeSAndreas Gohr $isImage = true; 566661701eeSAndreas Gohr if (!is_null($default) && ($default != $title['title'])) 567661701eeSAndreas Gohr return $default . " " . $title['title']; 568*f93272b9SAndreas Gohr else return $title['title']; 569661701eeSAndreas Gohr } elseif (is_null($title) || trim($title) == '') { 570661701eeSAndreas Gohr if (useHeading($linktype) && $id) { 571661701eeSAndreas Gohr $heading = p_get_first_heading($id); 572661701eeSAndreas Gohr if ($heading) { 573661701eeSAndreas Gohr return $this->_xmlEntities($heading); 574661701eeSAndreas Gohr } 575661701eeSAndreas Gohr } 576661701eeSAndreas Gohr return $this->_xmlEntities($default); 577661701eeSAndreas Gohr } else { 578661701eeSAndreas Gohr return $this->_xmlEntities($title); 579661701eeSAndreas Gohr } 580661701eeSAndreas Gohr } 581661701eeSAndreas Gohr 582661701eeSAndreas Gohr /** @inheritdoc */ 583661701eeSAndreas Gohr public function _xmlEntities($string) 584661701eeSAndreas Gohr { 585661701eeSAndreas Gohr return $string; // nothing to do for text 586661701eeSAndreas Gohr } 587661701eeSAndreas Gohr 588661701eeSAndreas Gohr /** @inheritdoc */ 589661701eeSAndreas Gohr public function _formatLink($link) 590661701eeSAndreas Gohr { 591661701eeSAndreas Gohr if (!empty($link['name'])) { 592661701eeSAndreas Gohr return $link['name']; 593661701eeSAndreas Gohr } elseif (!empty($link['title'])) { 594661701eeSAndreas Gohr return $link['title']; 595661701eeSAndreas Gohr } 596661701eeSAndreas Gohr return $link['url']; 597661701eeSAndreas Gohr } 598661701eeSAndreas Gohr} 599