X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom-plugins.git;a=blobdiff_plain;f=general%2Ffile;fp=general%2Ffile;h=79dea6a3082bf513ae817a5aceed896bd637221e;hp=0000000000000000000000000000000000000000;hb=60d851246984d97032170f60ad109d34053bb8f9;hpb=ca8061e7280bc0e69a1b4ec97928df7d3981113a diff --git a/general/file b/general/file new file mode 100644 index 0000000..79dea6a --- /dev/null +++ b/general/file @@ -0,0 +1,32 @@ +# Blosxom Plugin: file +# Author: Nelson Minar +# Version: 20030223 +# http://www.nelson.monkey.org/~nelson/weblog/ +# License: Public Domain + +# The file plugin loads files from a directory and defines them as +# variables for use in your stories. Ie: if you have a file named +# "foo", then the variable $file::foo will be set to the contents +# of the file "foo" and will be substituted in your stories and such. +# Files are loaded from $plugin_dir/filedata + +package file; + +my $datadir; + +# Startup - scan filedata dir, read files into variables +sub start { + $datadir = $blosxom::datadir . "/filedata"; + + if ( $datadir and opendir D, $datadir ) { + foreach my $f (readdir D) { + next unless -f "$datadir/$f"; + open F, "$datadir/$f"; + $$f = join('', ); + close F; + } + } + 1; +} + +1;