1 # Blosxom Plugin: exclude
2 # Author(s): Barijaona Ramaholimihaso
4 # Breyten Ernsting author of the original exclude plugin http://www.bje.nu/
5 # Fletcher T. Penney author of the hide plugin http://fletcher.freeshell.org
6 # IMPORTANT : requires a recent version of Blosxom (v2.0.1+ aka CVS revision 1.9)
7 # Version: 2006-01-02blosxom2
11 # --- Configurable variables -----
13 # name of the file where the patterns of the posts to be hidden
14 # are stored ; another popular choice is 'hide'
15 $ign_file = 'exclude';
17 # location of the file : I prefer it in the flavour directory
18 $refdir = "$blosxom::basedir/flavours";
20 $refdir = $blosxom::datadir unless defined $refdir ;
22 # --------------------------------
23 use CGI qw/:standard/;
26 # compatiblily with Fletcher T. Penney find plugin and wikieditish
27 ((param('plugin') eq 'find') || (param('find')) || (param('plugin') eq 'wikieditish')) ? 0 : 1 ;
31 sub read_exclude_file {
32 if (open(EXCLUDE, "< $ign_fn")) {
33 while ($line = <EXCLUDE>) {
37 $exclude_pattern = "$ign_fp2$line";
38 # takes into account patterns corresponding to our directory path,
39 # and patterns from parallel paths which are hidden from upper index views
40 if ( $line && (( $ign_fp2 eq $workingdir2 ) || ($exclude_pattern !~ /$workingdir/ )) ){
41 push(@excludes, $exclude_pattern);
50 my ($pkg, $files_ref) = @_;
53 if (($blosxom::path_info) && ( $blosxom::path_info !~ m#^(\d{4})#)) { $path = "/$blosxom::path_info" ;} else { $path = '';} ;
55 # if the path_info corresponds to a single story, we remember it,
56 # and we refer to the directory where our file is stored,
57 $queried_file = "$blosxom::datadir$path";
58 if ( ! -d "$blosxom::datadir$path" ) {
59 $path =~ s#\/?[^\/]*$## ;
60 $queried_file =~ s/$blosxom::flavour$/$blosxom::file_extension/ ;
63 $workingdir = "$blosxom::datadir$path";
65 $workingdir2 = "$blosxom::datadir$path" ;
68 $ign_fp = "$refdir$path";
69 $ign_fp2 = "$blosxom::datadir$path";
70 $ign_fn = "$ign_fp$ign_file.$blosxom::flavour";
71 if (-e $ign_fn) {read_exclude_file(); };
72 $ign_fn = "$ign_fp$ign_file";
73 if ( -e $ign_fn) {read_exclude_file(); };
74 } while ($path =~ s#([^/]*\/?)$## and $1) ;
78 foreach $exclude (@excludes) {
79 foreach $ign_cf (keys %$files_ref) {
80 if ($ign_cf =~ m#^$exclude# && $ign_cf ne $queried_file){ delete $files_ref->{$ign_cf} ; };
93 Blosxom Plug-in: exclude
97 Purpose: ignores files and directories in entries. Still allow these stories to appear in the results of a search via Fletcher T. Penney's find plugin <http://fletcher.freeshell.org>
99 This file does not make any new variables available for use in template files.
105 Version number is the date on which this version of the plug-in was created.
109 2006-01-02blosxom2 : takes into account the modified call of filter subroutines in recent versions of blosxom.cgi. Tested with Blosxom CVS revision 1.9 (http://cvs.sourceforge.net/viewcvs.py/blosxom/blosxom2/)
111 2004-09-13blosxom2 : First published version. Very hackish, needs a specific version of blosxom.
115 Barijaona Ramaholimihaso http://homepage.mac.com/barijaona/
116 The original exclude plugin was written by Breyten J. Ernsting <bje@dds.nl> http://www.bje.nu/
117 Compatibility with the find plugin provided by Fletcher Penney.
122 IMPORTANT : Needs a recent version of Blosxom2. Tested with Blosxom CVS revision 1.9 (http://cvs.sourceforge.net/viewcvs.py/blosxom/blosxom2/)
126 C<$ign_file> name to use for exclude files. Defaults to C<exclude>.
128 C<$refdir> directory where you put the exclude files. The default is your flavourdir. Some people might prefer the datadir.
132 Your C<exclude> file should look like this:
137 One entry per line. You should be able to use regexes.
141 None known; please send bug reports and feedback to the Blosxom
142 development mailing list <blosxom-devel@lists.sourceforge.net>.
147 Copyright 2003, Breyten Ernsting
148 Copyright 2004-2006, Barijaona Ramaholimihaso
150 (This license is the same as Blosxom's)
152 Permission is hereby granted, free of charge, to any person obtaining a
153 copy of this software and associated documentation files (the "Software"),
154 to deal in the Software without restriction, including without limitation
155 the rights to use, copy, modify, merge, publish, distribute, sublicense,
156 and/or sell copies of the Software, and to permit persons to whom the
157 Software is furnished to do so, subject to the following conditions:
159 The above copyright notice and this permission notice shall be included
160 in all copies or substantial portions of the Software.
162 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
163 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
164 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
165 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
166 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
167 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
168 OTHER DEALINGS IN THE SOFTWARE.