X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/344ab0a16b749c44d6d19dbe1a179c8e30ceef31..aa603888d221e2e80a95496b902acf4174d8cd88:/IkiWiki/Plugin/pagestats.pm

diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
index 79b3292c6..e20d0dac6 100644
--- a/IkiWiki/Plugin/pagestats.pm
+++ b/IkiWiki/Plugin/pagestats.pm
@@ -12,16 +12,25 @@ package IkiWiki::Plugin::pagestats;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 # Names of the HTML classes to use for the tag cloud
 our @classes = ('smallestPC', 'smallPC', 'normalPC', 'bigPC', 'biggestPC' );
 
-sub import { #{{{
+sub import {
+	hook(type => "getsetup", id => "pagestats", call => \&getsetup);
 	hook(type => "preprocess", id => "pagestats", call => \&preprocess);
-} # }}}
+}
 
-sub preprocess (@) { #{{{
+sub getsetup () {
+	return 
+		plugin => {
+			safe => 1,
+			rebuild => undef,
+		},
+}
+
+sub preprocess (@) {
 	my %params=@_;
 	$params{pages}="*" unless defined $params{pages};
 	my $style = ($params{style} or 'cloud');
@@ -33,10 +42,9 @@ sub preprocess (@) { #{{{
 	my %counts;
 	my $max = 0;
 	foreach my $page (keys %links) {
-		if (pagespec_match($page, $params{pages})) {
+		if (pagespec_match($page, $params{pages}, location => $params{page})) {
 			use IkiWiki::Render;
-			my @bl = IkiWiki::backlinks($page);
-			$counts{$page} = scalar(@bl);
+			$counts{$page} = scalar(IkiWiki::backlinks($page));
 			$max = $counts{$page} if $counts{$page} > $max;
 		}
 	}
@@ -45,12 +53,13 @@ sub preprocess (@) { #{{{
 		return "<table class='pageStats'>\n".
 			join("\n", map {
 				"<tr><td>".
-				htmllink($params{page}, $params{destpage}, $_, 1).
+				htmllink($params{page}, $params{destpage}, $_, noimageinline => 1).
 				"</td><td>".$counts{$_}."</td></tr>"
 			}
 			sort { $counts{$b} <=> $counts{$a} } keys %counts).
 			"\n</table>\n" ;
-	} else {
+	}
+	else {
 		# In case of misspelling, default to a page cloud
 
 		my $res = "<div class='pagecloud'>\n";
@@ -64,6 +73,6 @@ sub preprocess (@) { #{{{
 
 		return $res;
 	}
-} # }}}
+}
 
 1