1*661701eeSAndreas Gohr<?php 2*661701eeSAndreas Gohr 3*661701eeSAndreas Gohruse dokuwiki\File\PageResolver; 4*661701eeSAndreas Gohr 5*661701eeSAndreas Gohr/** 6*661701eeSAndreas Gohr * Renderer for preparing data for embedding 7*661701eeSAndreas Gohr * 8*661701eeSAndreas Gohr * BAsed on the text and markdown renderers 9*661701eeSAndreas Gohr * 10*661701eeSAndreas Gohr * @author Michael Hamann <michael@content-space.de> 11*661701eeSAndreas Gohr * @author Todd Augsburger <todd@rollerorgans.com> 12*661701eeSAndreas Gohr * @author i-net software <tools@inetsoftware.de> 13*661701eeSAndreas Gohr * @link https://www.dokuwiki.org/plugin:text 14*661701eeSAndreas Gohr * @link https://www.dokuwiki.org/plugin:dw2markdown 15*661701eeSAndreas Gohr */ 16*661701eeSAndreas Gohrclass renderer_plugin_aichat extends Doku_Renderer_xhtml 17*661701eeSAndreas Gohr{ 18*661701eeSAndreas Gohr 19*661701eeSAndreas Gohr 20*661701eeSAndreas Gohr /** @inheritdoc */ 21*661701eeSAndreas Gohr function getFormat() 22*661701eeSAndreas Gohr { 23*661701eeSAndreas Gohr return 'aichat'; 24*661701eeSAndreas Gohr } 25*661701eeSAndreas Gohr 26*661701eeSAndreas Gohr /** @inheritdoc */ 27*661701eeSAndreas Gohr public function startSectionEdit($start, $data, $title = null) 28*661701eeSAndreas Gohr { 29*661701eeSAndreas Gohr } 30*661701eeSAndreas Gohr 31*661701eeSAndreas Gohr /** @inheritdoc */ 32*661701eeSAndreas Gohr public function finishSectionEdit($end = null, $hid = null) 33*661701eeSAndreas Gohr { 34*661701eeSAndreas Gohr } 35*661701eeSAndreas Gohr 36*661701eeSAndreas Gohr /** 37*661701eeSAndreas Gohr * @inheritdoc 38*661701eeSAndreas Gohr * Use specific text support if available, otherwise use xhtml renderer and strip tags 39*661701eeSAndreas Gohr */ 40*661701eeSAndreas Gohr public function plugin($name, $data, $state = '', $match = '') 41*661701eeSAndreas Gohr { 42*661701eeSAndreas Gohr /** @var DokuWiki_Syntax_Plugin $plugin */ 43*661701eeSAndreas Gohr $plugin = plugin_load('syntax', $name); 44*661701eeSAndreas Gohr if ($plugin === null) return; 45*661701eeSAndreas Gohr 46*661701eeSAndreas Gohr if ( 47*661701eeSAndreas Gohr !$plugin->render($this->getFormat(), $this, $data) && 48*661701eeSAndreas Gohr !$plugin->render('text', $this, $data) && 49*661701eeSAndreas Gohr !$plugin->render('markdown', $this, $data) 50*661701eeSAndreas Gohr ) { 51*661701eeSAndreas Gohr // plugin does not support any of the text formats, so use stripped-down xhtml 52*661701eeSAndreas Gohr $tmpData = $this->doc; 53*661701eeSAndreas Gohr $this->doc = ''; 54*661701eeSAndreas Gohr if ($plugin->render('xhtml', $this, $data) && ($this->doc != '')) { 55*661701eeSAndreas Gohr $pluginoutput = $this->doc; 56*661701eeSAndreas Gohr $this->doc = $tmpData . DOKU_LF . trim(strip_tags($pluginoutput)) . DOKU_LF; 57*661701eeSAndreas Gohr } else { 58*661701eeSAndreas Gohr $this->doc = $tmpData; 59*661701eeSAndreas Gohr } 60*661701eeSAndreas Gohr } 61*661701eeSAndreas Gohr } 62*661701eeSAndreas Gohr 63*661701eeSAndreas Gohr 64*661701eeSAndreas Gohr /** @inheritdoc */ 65*661701eeSAndreas Gohr public function document_start() 66*661701eeSAndreas Gohr { 67*661701eeSAndreas Gohr global $ID; 68*661701eeSAndreas Gohr 69*661701eeSAndreas Gohr 70*661701eeSAndreas Gohr $this->doc = ''; 71*661701eeSAndreas Gohr $metaheader = array(); 72*661701eeSAndreas Gohr $metaheader['Content-Type'] = 'text/plain; charset=utf-8'; 73*661701eeSAndreas Gohr $meta = array(); 74*661701eeSAndreas Gohr $meta['format']['aichat'] = $metaheader; 75*661701eeSAndreas Gohr p_set_metadata($ID, $meta); 76*661701eeSAndreas Gohr } 77*661701eeSAndreas Gohr 78*661701eeSAndreas Gohr /** @inheritdoc */ 79*661701eeSAndreas Gohr public function document_end() 80*661701eeSAndreas Gohr { 81*661701eeSAndreas Gohr $this->doc = preg_replace("/(\r?\n){3,}/", "\n\n", $this->doc); 82*661701eeSAndreas Gohr $this->doc = ltrim($this->doc); // remove leading space and empty lines 83*661701eeSAndreas Gohr } 84*661701eeSAndreas Gohr 85*661701eeSAndreas Gohr /** @inheritdoc */ 86*661701eeSAndreas Gohr public function header($text, $level, $pos, $returnonly = false) 87*661701eeSAndreas Gohr { 88*661701eeSAndreas Gohr $this->doc .= str_repeat("#", $level) . ' ' . $text . DOKU_LF; 89*661701eeSAndreas Gohr } 90*661701eeSAndreas Gohr 91*661701eeSAndreas Gohr /** @inheritdoc */ 92*661701eeSAndreas Gohr public function section_open($level) 93*661701eeSAndreas Gohr { 94*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 95*661701eeSAndreas Gohr } 96*661701eeSAndreas Gohr 97*661701eeSAndreas Gohr /** @inheritdoc */ 98*661701eeSAndreas Gohr public function section_close() 99*661701eeSAndreas Gohr { 100*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 101*661701eeSAndreas Gohr } 102*661701eeSAndreas Gohr 103*661701eeSAndreas Gohr /** @inheritdoc */ 104*661701eeSAndreas Gohr public function cdata($text) 105*661701eeSAndreas Gohr { 106*661701eeSAndreas Gohr $this->doc .= $text; 107*661701eeSAndreas Gohr } 108*661701eeSAndreas Gohr 109*661701eeSAndreas Gohr /** @inheritdoc */ 110*661701eeSAndreas Gohr public function p_open() 111*661701eeSAndreas Gohr { 112*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 113*661701eeSAndreas Gohr } 114*661701eeSAndreas Gohr 115*661701eeSAndreas Gohr /** @inheritdoc */ 116*661701eeSAndreas Gohr public function p_close() 117*661701eeSAndreas Gohr { 118*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 119*661701eeSAndreas Gohr } 120*661701eeSAndreas Gohr 121*661701eeSAndreas Gohr /** @inheritdoc */ 122*661701eeSAndreas Gohr public function linebreak() 123*661701eeSAndreas Gohr { 124*661701eeSAndreas Gohr $this->doc .= DOKU_LF . DOKU_LF; 125*661701eeSAndreas Gohr } 126*661701eeSAndreas Gohr 127*661701eeSAndreas Gohr /** @inheritdoc */ 128*661701eeSAndreas Gohr public function hr() 129*661701eeSAndreas Gohr { 130*661701eeSAndreas Gohr $this->doc .= '----' . DOKU_LF; 131*661701eeSAndreas Gohr } 132*661701eeSAndreas Gohr 133*661701eeSAndreas Gohr /** @inheritdoc */ 134*661701eeSAndreas Gohr public function strong_open() 135*661701eeSAndreas Gohr { 136*661701eeSAndreas Gohr } 137*661701eeSAndreas Gohr 138*661701eeSAndreas Gohr /** @inheritdoc */ 139*661701eeSAndreas Gohr public function strong_close() 140*661701eeSAndreas Gohr { 141*661701eeSAndreas Gohr } 142*661701eeSAndreas Gohr 143*661701eeSAndreas Gohr /** @inheritdoc */ 144*661701eeSAndreas Gohr public function emphasis_open() 145*661701eeSAndreas Gohr { 146*661701eeSAndreas Gohr } 147*661701eeSAndreas Gohr 148*661701eeSAndreas Gohr /** @inheritdoc */ 149*661701eeSAndreas Gohr public function emphasis_close() 150*661701eeSAndreas Gohr { 151*661701eeSAndreas Gohr } 152*661701eeSAndreas Gohr 153*661701eeSAndreas Gohr /** @inheritdoc */ 154*661701eeSAndreas Gohr public function underline_open() 155*661701eeSAndreas Gohr { 156*661701eeSAndreas Gohr } 157*661701eeSAndreas Gohr 158*661701eeSAndreas Gohr /** @inheritdoc */ 159*661701eeSAndreas Gohr public function underline_close() 160*661701eeSAndreas Gohr { 161*661701eeSAndreas Gohr } 162*661701eeSAndreas Gohr 163*661701eeSAndreas Gohr /** @inheritdoc */ 164*661701eeSAndreas Gohr public function monospace_open() 165*661701eeSAndreas Gohr { 166*661701eeSAndreas Gohr } 167*661701eeSAndreas Gohr 168*661701eeSAndreas Gohr /** @inheritdoc */ 169*661701eeSAndreas Gohr public function monospace_close() 170*661701eeSAndreas Gohr { 171*661701eeSAndreas Gohr } 172*661701eeSAndreas Gohr 173*661701eeSAndreas Gohr /** @inheritdoc */ 174*661701eeSAndreas Gohr public function subscript_open() 175*661701eeSAndreas Gohr { 176*661701eeSAndreas Gohr } 177*661701eeSAndreas Gohr 178*661701eeSAndreas Gohr /** @inheritdoc */ 179*661701eeSAndreas Gohr public function subscript_close() 180*661701eeSAndreas Gohr { 181*661701eeSAndreas Gohr } 182*661701eeSAndreas Gohr 183*661701eeSAndreas Gohr /** @inheritdoc */ 184*661701eeSAndreas Gohr public function superscript_open() 185*661701eeSAndreas Gohr { 186*661701eeSAndreas Gohr } 187*661701eeSAndreas Gohr 188*661701eeSAndreas Gohr /** @inheritdoc */ 189*661701eeSAndreas Gohr public function superscript_close() 190*661701eeSAndreas Gohr { 191*661701eeSAndreas Gohr } 192*661701eeSAndreas Gohr 193*661701eeSAndreas Gohr /** @inheritdoc */ 194*661701eeSAndreas Gohr public function deleted_open() 195*661701eeSAndreas Gohr { 196*661701eeSAndreas Gohr } 197*661701eeSAndreas Gohr 198*661701eeSAndreas Gohr /** @inheritdoc */ 199*661701eeSAndreas Gohr public function deleted_close() 200*661701eeSAndreas Gohr { 201*661701eeSAndreas Gohr } 202*661701eeSAndreas Gohr 203*661701eeSAndreas Gohr /** @inheritdoc */ 204*661701eeSAndreas Gohr public function footnote_open() 205*661701eeSAndreas Gohr { 206*661701eeSAndreas Gohr $this->doc .= ' (('; 207*661701eeSAndreas Gohr } 208*661701eeSAndreas Gohr 209*661701eeSAndreas Gohr /** @inheritdoc */ 210*661701eeSAndreas Gohr public function footnote_close() 211*661701eeSAndreas Gohr { 212*661701eeSAndreas Gohr $this->doc .= '))'; 213*661701eeSAndreas Gohr } 214*661701eeSAndreas Gohr 215*661701eeSAndreas Gohr private $listMode = []; 216*661701eeSAndreas Gohr 217*661701eeSAndreas Gohr /** 218*661701eeSAndreas Gohr * Open an unordered list 219*661701eeSAndreas Gohr */ 220*661701eeSAndreas Gohr function listu_open($classes = null) 221*661701eeSAndreas Gohr { 222*661701eeSAndreas Gohr if (empty($this->listMode)) { 223*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 224*661701eeSAndreas Gohr } 225*661701eeSAndreas Gohr $this->listMode[] = '*'; 226*661701eeSAndreas Gohr } 227*661701eeSAndreas Gohr 228*661701eeSAndreas Gohr /** 229*661701eeSAndreas Gohr * Close an unordered list 230*661701eeSAndreas Gohr */ 231*661701eeSAndreas Gohr function listu_close() 232*661701eeSAndreas Gohr { 233*661701eeSAndreas Gohr array_pop($this->listMode); 234*661701eeSAndreas Gohr if (empty($this->listMode)) { 235*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 236*661701eeSAndreas Gohr } 237*661701eeSAndreas Gohr } 238*661701eeSAndreas Gohr 239*661701eeSAndreas Gohr /** 240*661701eeSAndreas Gohr * Open an ordered list 241*661701eeSAndreas Gohr */ 242*661701eeSAndreas Gohr function listo_open($classes = null) 243*661701eeSAndreas Gohr { 244*661701eeSAndreas Gohr if (empty($this->listMode)) { 245*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 246*661701eeSAndreas Gohr } 247*661701eeSAndreas Gohr $this->listMode[] = '1.'; 248*661701eeSAndreas Gohr } 249*661701eeSAndreas Gohr 250*661701eeSAndreas Gohr /** 251*661701eeSAndreas Gohr * Close an ordered list 252*661701eeSAndreas Gohr */ 253*661701eeSAndreas Gohr function listo_close() 254*661701eeSAndreas Gohr { 255*661701eeSAndreas Gohr array_pop($this->listMode); 256*661701eeSAndreas Gohr if (empty($this->listMode)) { 257*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 258*661701eeSAndreas Gohr } 259*661701eeSAndreas Gohr } 260*661701eeSAndreas Gohr 261*661701eeSAndreas Gohr /** 262*661701eeSAndreas Gohr * Open a list item 263*661701eeSAndreas Gohr * 264*661701eeSAndreas Gohr * @param int $level the nesting level 265*661701eeSAndreas Gohr * @param bool $node true when a node; false when a leaf 266*661701eeSAndreas Gohr */ 267*661701eeSAndreas Gohr function listitem_open($level, $node = false) 268*661701eeSAndreas Gohr { 269*661701eeSAndreas Gohr $this->doc .= str_repeat(' ', $level * 2) . $this->listMode[count($this->listMode) - 1]; 270*661701eeSAndreas Gohr } 271*661701eeSAndreas Gohr 272*661701eeSAndreas Gohr /** 273*661701eeSAndreas Gohr * Close a list item 274*661701eeSAndreas Gohr */ 275*661701eeSAndreas Gohr function listitem_close() 276*661701eeSAndreas Gohr { 277*661701eeSAndreas Gohr } 278*661701eeSAndreas Gohr 279*661701eeSAndreas Gohr 280*661701eeSAndreas Gohr /** @inheritdoc */ 281*661701eeSAndreas Gohr public function listcontent_open() 282*661701eeSAndreas Gohr { 283*661701eeSAndreas Gohr } 284*661701eeSAndreas Gohr 285*661701eeSAndreas Gohr /** @inheritdoc */ 286*661701eeSAndreas Gohr public function listcontent_close() 287*661701eeSAndreas Gohr { 288*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 289*661701eeSAndreas Gohr } 290*661701eeSAndreas Gohr 291*661701eeSAndreas Gohr /** @inheritdoc */ 292*661701eeSAndreas Gohr public function unformatted($text) 293*661701eeSAndreas Gohr { 294*661701eeSAndreas Gohr $this->doc .= $text; 295*661701eeSAndreas Gohr } 296*661701eeSAndreas Gohr 297*661701eeSAndreas Gohr /** @inheritdoc */ 298*661701eeSAndreas Gohr public function quote_open() 299*661701eeSAndreas Gohr { 300*661701eeSAndreas Gohr $this->doc .= '>>>'; 301*661701eeSAndreas Gohr } 302*661701eeSAndreas Gohr 303*661701eeSAndreas Gohr /** @inheritdoc */ 304*661701eeSAndreas Gohr public function quote_close() 305*661701eeSAndreas Gohr { 306*661701eeSAndreas Gohr $this->doc .= '<<<' . DOKU_LF; 307*661701eeSAndreas Gohr } 308*661701eeSAndreas Gohr 309*661701eeSAndreas Gohr /** @inheritdoc */ 310*661701eeSAndreas Gohr public function preformatted($text) 311*661701eeSAndreas Gohr { 312*661701eeSAndreas Gohr $this->code($text); 313*661701eeSAndreas Gohr } 314*661701eeSAndreas Gohr 315*661701eeSAndreas Gohr /** @inheritdoc */ 316*661701eeSAndreas Gohr public function file($text, $language = null, $filename = null, $options = null) 317*661701eeSAndreas Gohr { 318*661701eeSAndreas Gohr $this->code($text, $language, $filename, $options); 319*661701eeSAndreas Gohr } 320*661701eeSAndreas Gohr 321*661701eeSAndreas Gohr /** @inheritdoc */ 322*661701eeSAndreas Gohr public function code($text, $language = null, $filename = null, $options = null) 323*661701eeSAndreas Gohr { 324*661701eeSAndreas Gohr $this->doc .= DOKU_LF . '```' . ($language ?? '') . DOKU_LF . trim($text) . DOKU_LF . '```' . DOKU_LF; 325*661701eeSAndreas Gohr } 326*661701eeSAndreas Gohr 327*661701eeSAndreas Gohr /** @inheritdoc */ 328*661701eeSAndreas Gohr public function acronym($acronym) 329*661701eeSAndreas Gohr { 330*661701eeSAndreas Gohr if (array_key_exists($acronym, $this->acronyms)) { 331*661701eeSAndreas Gohr $title = $this->acronyms[$acronym]; 332*661701eeSAndreas Gohr $this->doc .= $acronym . ' (' . $title . ')'; 333*661701eeSAndreas Gohr } else { 334*661701eeSAndreas Gohr $this->doc .= $acronym; 335*661701eeSAndreas Gohr } 336*661701eeSAndreas Gohr } 337*661701eeSAndreas Gohr 338*661701eeSAndreas Gohr /** @inheritdoc */ 339*661701eeSAndreas Gohr public function smiley($smiley) 340*661701eeSAndreas Gohr { 341*661701eeSAndreas Gohr $this->doc .= $smiley; 342*661701eeSAndreas Gohr } 343*661701eeSAndreas Gohr 344*661701eeSAndreas Gohr /** @inheritdoc */ 345*661701eeSAndreas Gohr public function entity($entity) 346*661701eeSAndreas Gohr { 347*661701eeSAndreas Gohr if (array_key_exists($entity, $this->entities)) { 348*661701eeSAndreas Gohr $this->doc .= $this->entities[$entity]; 349*661701eeSAndreas Gohr } else { 350*661701eeSAndreas Gohr $this->doc .= $entity; 351*661701eeSAndreas Gohr } 352*661701eeSAndreas Gohr } 353*661701eeSAndreas Gohr 354*661701eeSAndreas Gohr /** @inheritdoc */ 355*661701eeSAndreas Gohr public function multiplyentity($x, $y) 356*661701eeSAndreas Gohr { 357*661701eeSAndreas Gohr $this->doc .= $x . 'x' . $y; 358*661701eeSAndreas Gohr } 359*661701eeSAndreas Gohr 360*661701eeSAndreas Gohr /** @inheritdoc */ 361*661701eeSAndreas Gohr public function singlequoteopening() 362*661701eeSAndreas Gohr { 363*661701eeSAndreas Gohr global $lang; 364*661701eeSAndreas Gohr $this->doc .= $lang['singlequoteopening']; 365*661701eeSAndreas Gohr } 366*661701eeSAndreas Gohr 367*661701eeSAndreas Gohr /** @inheritdoc */ 368*661701eeSAndreas Gohr public function singlequoteclosing() 369*661701eeSAndreas Gohr { 370*661701eeSAndreas Gohr global $lang; 371*661701eeSAndreas Gohr $this->doc .= $lang['singlequoteclosing']; 372*661701eeSAndreas Gohr } 373*661701eeSAndreas Gohr 374*661701eeSAndreas Gohr /** @inheritdoc */ 375*661701eeSAndreas Gohr public function apostrophe() 376*661701eeSAndreas Gohr { 377*661701eeSAndreas Gohr global $lang; 378*661701eeSAndreas Gohr $this->doc .= $lang['apostrophe']; 379*661701eeSAndreas Gohr } 380*661701eeSAndreas Gohr 381*661701eeSAndreas Gohr /** @inheritdoc */ 382*661701eeSAndreas Gohr public function doublequoteopening() 383*661701eeSAndreas Gohr { 384*661701eeSAndreas Gohr global $lang; 385*661701eeSAndreas Gohr $this->doc .= $lang['doublequoteopening']; 386*661701eeSAndreas Gohr } 387*661701eeSAndreas Gohr 388*661701eeSAndreas Gohr /** @inheritdoc */ 389*661701eeSAndreas Gohr public function doublequoteclosing() 390*661701eeSAndreas Gohr { 391*661701eeSAndreas Gohr global $lang; 392*661701eeSAndreas Gohr $this->doc .= $lang['doublequoteclosing']; 393*661701eeSAndreas Gohr } 394*661701eeSAndreas Gohr 395*661701eeSAndreas Gohr /** @inheritdoc */ 396*661701eeSAndreas Gohr public function camelcaselink($link, $returnonly = false) 397*661701eeSAndreas Gohr { 398*661701eeSAndreas Gohr $this->internallink($link, $link); 399*661701eeSAndreas Gohr } 400*661701eeSAndreas Gohr 401*661701eeSAndreas Gohr /** @inheritdoc */ 402*661701eeSAndreas Gohr public function locallink($hash, $name = null, $returnonly = false) 403*661701eeSAndreas Gohr { 404*661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, $hash, $isImage); 405*661701eeSAndreas Gohr $this->doc .= $name; 406*661701eeSAndreas Gohr } 407*661701eeSAndreas Gohr 408*661701eeSAndreas Gohr /** @inheritdoc */ 409*661701eeSAndreas Gohr public function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') 410*661701eeSAndreas Gohr { 411*661701eeSAndreas Gohr global $ID; 412*661701eeSAndreas Gohr // default name is based on $id as given 413*661701eeSAndreas Gohr $default = $this->_simpleTitle($id); 414*661701eeSAndreas Gohr $resolver = new PageResolver($ID); 415*661701eeSAndreas Gohr $id = $resolver->resolveId($id); 416*661701eeSAndreas Gohr 417*661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); 418*661701eeSAndreas Gohr if ($returnonly) { 419*661701eeSAndreas Gohr return $name; 420*661701eeSAndreas Gohr } 421*661701eeSAndreas Gohr $this->doc .= $name; 422*661701eeSAndreas Gohr return null; 423*661701eeSAndreas Gohr } 424*661701eeSAndreas Gohr 425*661701eeSAndreas Gohr /** @inheritdoc */ 426*661701eeSAndreas Gohr public function externallink($url, $name = null, $returnonly = false) 427*661701eeSAndreas Gohr { 428*661701eeSAndreas Gohr $title = $this->_getLinkTitle($name, $url, $isImage); 429*661701eeSAndreas Gohr if ($title != $url) { 430*661701eeSAndreas Gohr $this->doc .= "[$title]($url)"; 431*661701eeSAndreas Gohr } else { 432*661701eeSAndreas Gohr $this->doc .= $title; 433*661701eeSAndreas Gohr } 434*661701eeSAndreas Gohr } 435*661701eeSAndreas Gohr 436*661701eeSAndreas Gohr /** @inheritdoc */ 437*661701eeSAndreas Gohr public function interwikilink($match, $name, $wikiName, $wikiUri, $returnonly = false) 438*661701eeSAndreas Gohr { 439*661701eeSAndreas Gohr $this->doc .= $this->_getLinkTitle($name, $wikiUri, $isImage); 440*661701eeSAndreas Gohr } 441*661701eeSAndreas Gohr 442*661701eeSAndreas Gohr /** @inheritdoc */ 443*661701eeSAndreas Gohr public function windowssharelink($url, $name = null, $returnonly = false) 444*661701eeSAndreas Gohr { 445*661701eeSAndreas Gohr $this->doc .= $this->_getLinkTitle($name, $url, $isImage); 446*661701eeSAndreas Gohr } 447*661701eeSAndreas Gohr 448*661701eeSAndreas Gohr /** @inheritdoc */ 449*661701eeSAndreas Gohr public function emaillink($address, $name = null, $returnonly = false) 450*661701eeSAndreas Gohr { 451*661701eeSAndreas Gohr $name = $this->_getLinkTitle($name, '', $isImage); 452*661701eeSAndreas Gohr $address = html_entity_decode(obfuscate($address), ENT_QUOTES, 'UTF-8'); 453*661701eeSAndreas Gohr if (empty($name)) { 454*661701eeSAndreas Gohr $name = $address; 455*661701eeSAndreas Gohr } 456*661701eeSAndreas Gohr $this->doc .= $name; 457*661701eeSAndreas Gohr } 458*661701eeSAndreas Gohr 459*661701eeSAndreas Gohr /** @inheritdoc */ 460*661701eeSAndreas Gohr public function internalmedia($src, $title = null, $align = null, $width = null, 461*661701eeSAndreas Gohr $height = null, $cache = null, $linking = null, $return = false) 462*661701eeSAndreas Gohr { 463*661701eeSAndreas Gohr $this->doc .= $title; 464*661701eeSAndreas Gohr } 465*661701eeSAndreas Gohr 466*661701eeSAndreas Gohr /** @inheritdoc */ 467*661701eeSAndreas Gohr public function externalmedia($src, $title = null, $align = null, $width = null, 468*661701eeSAndreas Gohr $height = null, $cache = null, $linking = null, $return = false) 469*661701eeSAndreas Gohr { 470*661701eeSAndreas Gohr $this->doc .= $title; 471*661701eeSAndreas Gohr } 472*661701eeSAndreas Gohr 473*661701eeSAndreas Gohr /** @inheritdoc */ 474*661701eeSAndreas Gohr public function rss($url, $params) 475*661701eeSAndreas Gohr { 476*661701eeSAndreas Gohr } 477*661701eeSAndreas Gohr 478*661701eeSAndreas Gohr /** @inheritdoc */ 479*661701eeSAndreas Gohr public function table_open($maxcols = null, $numrows = null, $pos = null, $classes = null) 480*661701eeSAndreas Gohr { 481*661701eeSAndreas Gohr } 482*661701eeSAndreas Gohr 483*661701eeSAndreas Gohr /** @inheritdoc */ 484*661701eeSAndreas Gohr public function table_close($pos = null) 485*661701eeSAndreas Gohr { 486*661701eeSAndreas Gohr $this->doc .= DOKU_LF; 487*661701eeSAndreas Gohr } 488*661701eeSAndreas Gohr 489*661701eeSAndreas Gohr private $tableColumns = 0; 490*661701eeSAndreas Gohr 491*661701eeSAndreas Gohr /** 492*661701eeSAndreas Gohr * Open a table header 493*661701eeSAndreas Gohr */ 494*661701eeSAndreas Gohr function tablethead_open() 495*661701eeSAndreas Gohr { 496*661701eeSAndreas Gohr $this->tableColumns = 0; 497*661701eeSAndreas Gohr $this->doc .= DOKU_LF; // . '|'; 498*661701eeSAndreas Gohr } 499*661701eeSAndreas Gohr 500*661701eeSAndreas Gohr /** 501*661701eeSAndreas Gohr * Close a table header 502*661701eeSAndreas Gohr */ 503*661701eeSAndreas Gohr function tablethead_close() 504*661701eeSAndreas Gohr { 505*661701eeSAndreas Gohr $this->doc .= '|' . str_repeat('---|', $this->tableColumns) . DOKU_LF; 506*661701eeSAndreas Gohr } 507*661701eeSAndreas Gohr 508*661701eeSAndreas Gohr /** 509*661701eeSAndreas Gohr * Open a table body 510*661701eeSAndreas Gohr */ 511*661701eeSAndreas Gohr function tabletbody_open() 512*661701eeSAndreas Gohr { 513*661701eeSAndreas Gohr } 514*661701eeSAndreas Gohr 515*661701eeSAndreas Gohr /** 516*661701eeSAndreas Gohr * Close a table body 517*661701eeSAndreas Gohr */ 518*661701eeSAndreas Gohr function tabletbody_close() 519*661701eeSAndreas Gohr { 520*661701eeSAndreas Gohr } 521*661701eeSAndreas Gohr 522*661701eeSAndreas Gohr /** 523*661701eeSAndreas Gohr * Open a table row 524*661701eeSAndreas Gohr */ 525*661701eeSAndreas Gohr function tablerow_open($classes = null) 526*661701eeSAndreas Gohr { 527*661701eeSAndreas Gohr } 528*661701eeSAndreas Gohr 529*661701eeSAndreas Gohr /** 530*661701eeSAndreas Gohr * Close a table row 531*661701eeSAndreas Gohr */ 532*661701eeSAndreas Gohr function tablerow_close() 533*661701eeSAndreas Gohr { 534*661701eeSAndreas Gohr $this->doc .= '|' . DOKU_LF; 535*661701eeSAndreas Gohr } 536*661701eeSAndreas Gohr 537*661701eeSAndreas Gohr /** 538*661701eeSAndreas Gohr * Open a table header cell 539*661701eeSAndreas Gohr * 540*661701eeSAndreas Gohr * @param int $colspan 541*661701eeSAndreas Gohr * @param string $align left|center|right 542*661701eeSAndreas Gohr * @param int $rowspan 543*661701eeSAndreas Gohr */ 544*661701eeSAndreas Gohr function tableheader_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) 545*661701eeSAndreas Gohr { 546*661701eeSAndreas Gohr $this->doc .= str_repeat('|', $colspan); 547*661701eeSAndreas Gohr $this->tableColumns += $colspan; 548*661701eeSAndreas Gohr } 549*661701eeSAndreas Gohr 550*661701eeSAndreas Gohr /** 551*661701eeSAndreas Gohr * Close a table header cell 552*661701eeSAndreas Gohr */ 553*661701eeSAndreas Gohr function tableheader_close() 554*661701eeSAndreas Gohr { 555*661701eeSAndreas Gohr } 556*661701eeSAndreas Gohr 557*661701eeSAndreas Gohr /** 558*661701eeSAndreas Gohr * Open a table cell 559*661701eeSAndreas Gohr * 560*661701eeSAndreas Gohr * @param int $colspan 561*661701eeSAndreas Gohr * @param string $align left|center|right 562*661701eeSAndreas Gohr * @param int $rowspan 563*661701eeSAndreas Gohr */ 564*661701eeSAndreas Gohr function tablecell_open($colspan = 1, $align = null, $rowspan = 1, $classes = null) 565*661701eeSAndreas Gohr { 566*661701eeSAndreas Gohr $this->doc .= str_repeat('|', $colspan); 567*661701eeSAndreas Gohr } 568*661701eeSAndreas Gohr 569*661701eeSAndreas Gohr /** 570*661701eeSAndreas Gohr * Close a table cell 571*661701eeSAndreas Gohr */ 572*661701eeSAndreas Gohr function tablecell_close() 573*661701eeSAndreas Gohr { 574*661701eeSAndreas Gohr } 575*661701eeSAndreas Gohr 576*661701eeSAndreas Gohr /** @inheritdoc */ 577*661701eeSAndreas Gohr public function _getLinkTitle($title, $default, &$isImage, $id = null, $linktype = 'content') 578*661701eeSAndreas Gohr { 579*661701eeSAndreas Gohr $isImage = false; 580*661701eeSAndreas Gohr if (is_array($title)) { 581*661701eeSAndreas Gohr $isImage = true; 582*661701eeSAndreas Gohr if (!is_null($default) && ($default != $title['title'])) 583*661701eeSAndreas Gohr return $default . " " . $title['title']; 584*661701eeSAndreas Gohr else 585*661701eeSAndreas Gohr return $title['title']; 586*661701eeSAndreas Gohr } elseif (is_null($title) || trim($title) == '') { 587*661701eeSAndreas Gohr if (useHeading($linktype) && $id) { 588*661701eeSAndreas Gohr $heading = p_get_first_heading($id); 589*661701eeSAndreas Gohr if ($heading) { 590*661701eeSAndreas Gohr return $this->_xmlEntities($heading); 591*661701eeSAndreas Gohr } 592*661701eeSAndreas Gohr } 593*661701eeSAndreas Gohr return $this->_xmlEntities($default); 594*661701eeSAndreas Gohr } else { 595*661701eeSAndreas Gohr return $this->_xmlEntities($title); 596*661701eeSAndreas Gohr } 597*661701eeSAndreas Gohr } 598*661701eeSAndreas Gohr 599*661701eeSAndreas Gohr /** @inheritdoc */ 600*661701eeSAndreas Gohr public function _xmlEntities($string) 601*661701eeSAndreas Gohr { 602*661701eeSAndreas Gohr return $string; // nothing to do for text 603*661701eeSAndreas Gohr } 604*661701eeSAndreas Gohr 605*661701eeSAndreas Gohr /** @inheritdoc */ 606*661701eeSAndreas Gohr public function _formatLink($link) 607*661701eeSAndreas Gohr { 608*661701eeSAndreas Gohr if (!empty($link['name'])) { 609*661701eeSAndreas Gohr return $link['name']; 610*661701eeSAndreas Gohr } elseif (!empty($link['title'])) { 611*661701eeSAndreas Gohr return $link['title']; 612*661701eeSAndreas Gohr } 613*661701eeSAndreas Gohr return $link['url']; 614*661701eeSAndreas Gohr } 615*661701eeSAndreas Gohr} 616