Add entries_cache_meta to general.
[blosxom-plugins.git] / general / iconset
blob3a5fb704b12634781b8693b36656224f5eee8552
1 # Bloxsom Plugin:IconSet
2 # Author: Fletcher T. Penney
3 # Version: 0.2
5 package iconset;
7 # --- Configurable variables ----
9 # Where are your icon image files?
10 $logos_url = "/images";
12 # Where is the icon definition page
13 # Note that this is optional
14 $icon_file = "$blosxom::datadir/iconlist";
16 # Is the icons plugin enabled
17 $use_icons_plugin = 1;
19 # -------------------------------
21 $iconset="";
23 sub start {
24         open (ICONS, $icon_file);
25         @iconslist = <ICONS>;
26         close ICONS;
30 sub story {
31         my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
33         $iconset = "";
34         foreach $iconpair (@iconslist) {
35                 if ($iconpair =~ /(.*)=(.*)/) {
36                         $categ=$1;
37                         $icon=$2;
38                 $iconset= qq!<img src="$logos_url/$icon" alt="logo">! if ($path =~ /^$categ/i);
39                 }
40         }
42         if ($$body_ref =~ /<!-- iconset\s*(\S*)\s*-->/i) {
43                 $iconset= qq!<img src="$logos_url/$1" alt="logo">! if $1 ne"";
44         }
46         if ($use_icons_plugin eq 1) {
47                 $icons::icons = $iconset if ($iconset ne "");
48         }
50         1;
56 __END__
58 =head1 NAME
60 Blosxom Plug-in: iconset
62 =head1 DESCRIPTION
64 IconSet allows you to set an icon to be used within a particular story.  Set the $logos_url to the url for your icons.  You then use the <!-- iconset ### --> directive within a story to set an icon to be displayed for that story.  If a default icon is set by the icons plug-in, it will be overridden.
66 If the icons plugin is present, then you may continue to use the $icons::icons variable.  Otherwise, you can use the $iconset::iconset variable.
68 The $icon_file allows you to set an icon for any story in a category by using a definitions file.  This allows you to set an icon for any category, whether it is top level or not, without having a world readable datadir.  (The original icons plugin cannot do this.)
70 The format for iconfile is:
71 path=iconfile
73 and uses regexp's for either expression. So, 
74 /computers/blosxom=blosxom.gif will set the icon to blosxom.gif for any file in the computers/blosxom directory, or any of its subdirectories.
76 If you later defined:
77 /computers/blosxom/newstuff=cool.png, then anything in this one subdirectory will have a different icon.  The line that matches last is the one that "sticks."
79 By using this technique, you can replace the icons plugin altogether by replacing $iconset::iconset in your templates wherever you used to use $icons::icons.  If you do this, then change the $use_icons_plugin variable.
81 =head1 BUGS
83 None known; please send bug reports and feedback to the Blosxom
84 development mailing list <blosxom-devel@lists.sourceforge.net>.
86 =head1 AUTHOR
88 Fletcher T. Penney - http://fletcher.freeshell.org
90 This plugin is now maintained by the Blosxom Sourceforge Team,
91 <blosxom-devel@lists.sourceforge.net>.
93 =head1 LICENSE
95 This source is submitted to the public domain.  Feel free to use and modify it.  If you like, a comment in your modified source attributing credit to myself and Gregory Bair for his original work would be appreciated.
97 THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND.  USE AT YOUR OWN RISK!