Update flavourpathinfo to use Blosxom::Debug.
[blosxom-plugins.git] / general / zlocaldepth
blob156819495b5ebb9e2a46b3d51309c2c68e47fca2
1 # Blosxom Plugin: zlocaldepth
2 # Author: Fletcher T. Penney
3 # Version: 0.3
5 package zlocaldepth;
7 $localdepth = 0;
9 sub start {
10         1;
13 sub filter {
14         my ($pkg, $files) = @_;
16         if ($localdepth ne 0) {
17                 @files_list = sort keys %$files;
19                 $myroot = $blosxom::datadir ."/" . $blosxom::path_info;
20                 $myroot =~ s/\/$//;
21                 $myroot =~ s/\/[^\/]+\.[^\/]+$//;
22                 
23                 foreach (@files_list) {
24                         if ($_ !~ /$myroot([^\/]*\/[^\/]*){0,$localdepth}$/) {
25                                 delete $files->{$_};
26                         }
27                 }
28         }
29         
37 __END__
39 =head1 NAME
41 Blosxom Plug-in: zlocaldepth
43 =head1 DESCRIPTION
45 This plugin restricts entries to those within the $zlocaldepth::localdepth variable, which works just like blosxom's $depth variable.  Except that it is always calculated relative to the current directory.  This is useful, because unlike the built-in depth variable, it can be appropriately set from a config file via the config plugin to easily allow different depths in different parts of your site.
48 BTW, the name starts with a z so that it will follow other plugins that affect 
49 filters and abide by their settings.
51 =head1 BUGS
53 None known; please send bug reports and feedback to the Blosxom
54 development mailing list <blosxom-devel@lists.sourceforge.net>.
56 =head1 AUTHOR
58 Fletcher T. Penney - http://fletcher.freeshell.org
60 This plugin is now maintained by the Blosxom Sourceforge Team,
61 <blosxom-devel@lists.sourceforge.net>.
63 =head1 VERSION HISTORY
65 =item 0.2
67 Corrected an issue with a depth of 1 and the root directory.
69 =head1 LICENSE
71 This source is submitted to the public domain.  Feel free to use and modify  
72 it.  If you like, a comment in your modified source attributing credit to 
73 myself for my work would be appreciated.
75 THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND.  USE AT 
76 YOUR OWN RISK!