3 class Text_Wiki_Render_Xhtml_Interwiki
extends Text_Wiki_Render
{
7 'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
8 'Advogato' => 'http://advogato.org/%s',
9 'Wiki' => 'http://c2.com/cgi/wiki?%s'
18 * Renders a token into text matching the requested format.
22 * @param array $options The "options" portion of the token (second
25 * @return string The text rendered from the token options.
29 function token($options)
31 $site = $options['site'];
32 $page = $options['page'];
33 $text = $options['text'];
34 $css = $this->formatConf(' class="%s"', 'css');
36 if (isset($this->conf
['sites'][$site])) {
37 $href = $this->conf
['sites'][$site];
42 // old form where page is at end,
43 // or new form with %s placeholder for sprintf()?
44 if (strpos($href, '%s') === false
) {
46 $href = $href . $page;
49 $href = sprintf($href, $page);
52 // allow for alternative targets
53 $target = $this->getConf('target');
56 $text = htmlspecialchars($text);
57 $output = "<a$css href=\"$href\"";
59 // are we targeting a specific window?
61 // this is XHTML compliant, suggested by Aaron Kalin.
62 // code tip is actually from youngpup.net, and it
63 // uses the $target as the new window name.
64 $target = htmlspecialchars($target);
65 $output .= " onClick=\"window.open(this.href, '$target');";
66 $output .= " return false;\"";
69 $output .= ">$text</a>";