1 <?php
2 /**
3  * DokuWiki Plugin linksenhanced (Admin Component)
4  *
5  * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6  * @author  Andreas Böhler <dev@aboehler.at>
7  */
8 
9 // must be run within Dokuwiki
10 if (!defined('DOKU_INC')) die();
11 require_once(DOKU_PLUGIN.'admin.php');
12 
13 class admin_plugin_linksenhanced_links extends DokuWiki_Admin_Plugin {
14 
15 
16 
17     function getMenuSort() { return 501; }
18     function forAdminOnly() { return true; }
19 
20     function getMenuText($language) {
21         return "Show external link status";
22     }
23 
24     function handle() {
25         if(!is_array($_REQUEST['d']) || !checkSecurityToken()) return;
26 
27     }
28 
29     function getPagesAndLinks()
30     {
31         global $conf;
32         $opts = array(
33         'depth' => 0,
34         'listfiles' => true,
35         'listdirs'  => false,
36         'pagesonly' => true,
37         'firsthead' => true,
38         'sneakyacl' => $conf['sneaky_index'],
39         );
40 
41         $data = array();
42         $retData = array();
43         search($data, $conf['datadir'],'search_universal',$opts);
44         foreach($data as $k => $pdata)
45         {
46             $meta = p_get_metadata($pdata['id']);
47             if(is_array($meta['plugin_linksenhanced']['links']))
48             {
49                 $retData[$pdata['id']] = $meta['plugin_linksenhanced']['links'];
50             }
51         }
52         return $retData;
53     }
54 
55     function html() {
56         echo '<h1>Link Overview</h1>';
57         echo '<table>';
58         echo '<tr><th width="30\%">Page</th><th width="90\%">Link Status</th></tr>';
59         $linkData = $this->getPagesAndLinks();
60         foreach($linkData as $page => $links)
61         {
62             echo '<td rowspan="'.count($links).'">'.$page.'</td>';
63             $first = true;
64             foreach($links as $link)
65             {
66                 if(!$first)
67                     echo '<tr>';
68                 else
69                     $first = false;
70                 echo '<td><a href="'.$link.'" class="plugin_linksenhanced_pending">'.$link.'</td>';
71                 echo '</tr>';
72             }
73         }
74         echo '</tr>';
75         echo '</table>';
76     }
77 
78 }
79 
80 // vim:ts=4:sw=4:et:enc=utf-8:
81