Honors $conf['mailguard'] setting
public emaillink ( string $address, string | array $name = null, boolean $returnonly = false ) : void | string | ||
$address | string | Email-Address |
$name | string | array | name for the link, array for media file |
$returnonly | boolean | whether to return html or write to doc attribute |
리턴 | void | string | writes to doc attribute or returns html depends on $returnonly |
function test_emaillink_with_media() { global $conf; $conf['mailguard'] = 'visible'; $conf['userewrite'] = 2; $image = array('type' => 'internalmedia', 'src' => 'img.gif', 'title' => 'Some Image', 'align' => NULL, 'width' => 10, 'height' => 20, 'cache' => 'nocache', 'linking' => 'details'); $p = new Doku_Renderer_xhtml(); $p->emaillink('*****@*****.**', $image); $expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media" title="foo [at] example [dot] com"><img src="' . DOKU_BASE . 'lib/exe/fetch.php/img.gif?w=10&h=20&cache=nocache" class="media" title="Some Image" alt="Some Image" width="10" height="20" /></a>'; $this->assertEqual($p->doc, $expect); }
/** * no obfuscation for email addresses */ function emaillink($address, $name = NULL) { global $conf; $old = $conf['mailguard']; $conf['mailguard'] = 'none'; parent::emaillink($address, $name); $conf['mailguard'] = $old; }
/** * list all installed plugins * * uses some of the original renderer methods * * @param string $type * @param Doku_Renderer_xhtml $renderer */ function _plugins_xhtml($type, Doku_Renderer_xhtml $renderer) { global $lang; $renderer->doc .= '<ul>'; $plugins = plugin_list($type); $plginfo = array(); // remove subparts foreach ($plugins as $p) { if (!($po = plugin_load($type, $p))) { continue; } list($name, ) = explode('_', $p, 2); $plginfo[$name] = $po->getInfo(); } // list them foreach ($plginfo as $info) { $renderer->doc .= '<li><div class="li">'; $renderer->externallink($info['url'], $info['name']); $renderer->doc .= ' '; $renderer->doc .= '<em>' . $info['date'] . '</em>'; $renderer->doc .= ' '; $renderer->doc .= $lang['by']; $renderer->doc .= ' '; $renderer->emaillink($info['email'], $info['author']); $renderer->doc .= '<br />'; $renderer->doc .= strtr(hsc($info['desc']), array("\n" => "<br />")); $renderer->doc .= '</div></li>'; unset($po); } $renderer->doc .= '</ul>'; }