1: <?php
2: 3: 4:
5: class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render
6: {
7: public $conf = array(
8: 'sites' => array(
9: 'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
10: 'Advogato' => 'http://advogato.org/%s',
11: 'Wiki' => 'http://c2.com/cgi/wiki?%s',
12: 'Bookshelved' => 'http://bookshelved.org/cgi-bin/wiki.pl?%s'
13: ),
14: 'target' => '_blank'
15: );
16:
17: 18: 19: 20: 21: 22: 23: 24:
25: public function token($options)
26: {
27: $site = $options['site'];
28: $page = $options['page'];
29: $text = $options['text'];
30:
31: if (isset($this->conf['sites'][$site])) {
32: $href = $this->conf['sites'][$site];
33: } else {
34: return $text;
35: }
36:
37:
38:
39: if (strpos($href, '%s') === false) {
40:
41: $href = $href . $page;
42: } else {
43:
44: $href = sprintf($href, $page);
45: }
46:
47:
48: $target = $this->getConf('target', '');
49:
50: if ($target && trim($target) != '') {
51: $target = " target=\"$target\"";
52: }
53:
54: return '<a' . $target . ' href="' . Horde::externalUrl($href) . '">' . $text . '</a>';
55: }
56: }
57: