2 // PukiWiki - Yet another WikiWikiWeb clone
3 // $Id: related.inc.php,v 1.1 2005/01/12 14:02:05 henoheno Exp $
5 // Related plugin: Show Backlinks for the page
7 // TODO: move '#related' here
8 //function plugin_related_convert()
10 // global $related_link;
15 // Show Backlinks: via related caches for the page
16 function plugin_related_action()
18 global $vars, $script, $non_list, $defaultpage, $whatsnew;
20 $_page = isset($vars['page']) ? $vars['page'] : '';
21 if ($_page == '') $_page = $defaultpage;
23 // Get related from cache
24 $data = links_get_related_db($_page);
25 $non_list_pattern = '/' . $non_list . '/';
26 foreach(array_keys($data) as $page)
27 if ($page == $whatsnew || preg_match($non_list_pattern, $page))
31 $s_word = htmlspecialchars($_page);
32 $msg = '<a href="' . $script . '?' . $s_word . '">' .
33 'Backlinks for: ' . $s_word . '</a>';
36 return array('msg'=>$msg, 'body'=>'No related pages found.');
40 $retval = '<ul>' . "\n";
41 foreach ($data as $page=>$time) {
42 $r_page = rawurlencode($page);
43 $s_page = htmlspecialchars($page);
44 $passage = get_passage($time);
45 $retval .= ' <li><a href="' . $script . '?' . $r_page . '">' . $s_page .
46 '</a> ' . $passage . '</li>' . "\n";
48 $retval .= '</ul>' . "\n";
49 return array('msg'=>$msg, 'body'=>$retval);