Fixed extraneous <updated>...</updated> tags for feed date/time in static rendering
[matthijs/upstream/blosxom-plugins.git] / general / zlocaldepth
1 # Blosxom Plugin: zlocaldepth
2 # Author: Fletcher T. Penney
3 # Version: 0.3
4
5 package zlocaldepth;
6
7 $localdepth = 0;
8
9 sub start {
10         1;
11 }
12
13 sub filter {
14         my ($pkg, $files) = @_;
15
16         if ($localdepth ne 0) {
17                 @files_list = sort keys %$files;
18
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         
30 1;
31 }
32
33
34 1;
35
36
37 __END__
38
39 =head1 NAME
40
41 Blosxom Plug-in: zlocaldepth
42
43 =head1 DESCRIPTION
44
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.
46
47
48 BTW, the name starts with a z so that it will follow other plugins that affect 
49 filters and abide by their settings.
50
51 =head1 BUGS
52
53 None known; please send bug reports and feedback to the Blosxom
54 development mailing list <blosxom-devel@lists.sourceforge.net>.
55
56 =head1 AUTHOR
57
58 Fletcher T. Penney - http://fletcher.freeshell.org
59
60 This plugin is now maintained by the Blosxom Sourceforge Team,
61 <blosxom-devel@lists.sourceforge.net>.
62
63 =head1 VERSION HISTORY
64
65 =item 0.2
66
67 Corrected an issue with a depth of 1 and the root directory.
68
69 =head1 LICENSE
70
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.
74
75 THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND.  USE AT 
76 YOUR OWN RISK!