# Blosxom
# Author: Rael Dornfest <rael@oreilly.com>
# Version: 2.0.2
-# Home/Docs/Licensing: http://www.blosxom.com/
+# Home/Docs/Licensing: http://blosxom.sourceforge.net/
# Development/Downloads: http://sourceforge.net/projects/blosxom
package blosxom;
# --------------------------------
-use vars qw! $version $blog_title $blog_description $blog_language $datadir $url %template $template $depth $num_entries $file_extension $default_flavour $static_or_dynamic $plugin_dir $plugin_state_dir @plugins %plugins $static_dir $static_password @static_flavours $static_entries $path_info $path_info_yr $path_info_mo $path_info_da $path_info_mo_num $flavour $static_or_dynamic %month2num @num2month $interpolate $entries $output $header $show_future_entries %files %indexes %others !;
+use vars qw! $version $blog_title $blog_description $blog_language $datadir $url %template $template $depth $num_entries $file_extension $default_flavour $static_or_dynamic $config_dir $plugin_dir $plugin_state_dir @plugins %plugins $static_dir $static_password @static_flavours $static_entries $path_info $path_info_yr $path_info_mo $path_info_da $path_info_mo_num $flavour $static_or_dynamic %month2num @num2month $interpolate $entries $output $header $show_future_entries %files %indexes %others !;
use strict;
use FileHandle;
$version = "2.0.2";
+# Load configuration from $ENV{BLOSXOM_CONFIG_DIR}/blosxom.conf, if it exists
+my $blosxom_config;
+if ($ENV{BLOSXOM_CONFIG_FILE} && -r $ENV{BLOSXOM_CONFIG_FILE}) {
+ $blosxom_config = $ENV{BLOSXOM_CONFIG_FILE};
+ ($config_dir = $blosxom_config) =~ s! / [^/]* $ !!x;
+}
+else {
+ for my $blosxom_config_dir ($ENV{BLOSXOM_CONFIG_DIR}, '/etc/blosxom', '/etc') {
+ if (-r "$blosxom_config_dir/blosxom.conf") {
+ $config_dir = $blosxom_config_dir;
+ $blosxom_config = "$blosxom_config_dir/blosxom.conf";
+ last;
+ }
+ }
+}
+# Load $blosxom_config
+if ($blosxom_config) {
+ if (-r $blosxom_config) {
+ eval { require $blosxom_config } or
+ warn "Error reading blosxom config file '$blosxom_config'" . ($@ ? ": $@" : '');
+ }
+ else {
+ warn "Cannot find or read blosxom config file '$blosxom_config'";
+ }
+}
+
my $fh = new FileHandle;
%month2num = (nil=>'00', Jan=>'01', Feb=>'02', Mar=>'03', Apr=>'04', May=>'05', Jun=>'06', Jul=>'07', Aug=>'08', Sep=>'09', Oct=>'10', Nov=>'11', Dec=>'12');
# Plugins: Start
if ( $plugin_dir and opendir PLUGINS, $plugin_dir ) {
- foreach my $plugin ( grep { /^\w+$/ && -f "$plugin_dir/$_" } sort readdir(PLUGINS) ) {
+ unshift @INC, $plugin_dir;
+ foreach my $plugin ( grep { /^[\w:]+$/ && -f "$plugin_dir/$_" } sort readdir(PLUGINS) ) {
next if ($plugin =~ /~$/); # Ignore emacs backups
- my($plugin_name, $off) = $plugin =~ /^\d*(\w+?)(_?)$/;
+ my($plugin_name, $off) = $plugin =~ /^\d*([\w:]+?)(_?)$/;
my $on_off = $off eq '_' ? -1 : 1;
- require "$plugin_dir/$plugin";
+ # Allow perl module plugins
+ if ($plugin =~ m/::/ && -z "$plugin_dir/$plugin") {
+ # For Blosxom::Plugin::Foo style plugins, we need to use a string require
+ eval "require $plugin_name";
+ }
+ else {
+ eval { require $plugin };
+ }
+ $@ and warn "error finding or loading blosxom plugin $plugin_name - skipping\n" and next;
$plugin_name->start() and ( $plugins{$plugin_name} = $on_off ) and push @plugins, $plugin_name;
}
+ shift @INC;
closedir PLUGINS;
}
html foot
html foot <p />
html foot <center>
-html foot <a href="http://www.blosxom.com/"><img src="http://www.blosxom.com/images/pb_blosxom.gif" border="0" /></a>
+html foot <a href="http://blosxom.sourceforge.net/"><img src="http://blosxom.sourceforge.net/images/pb_blosxom.gif" border="0" /></a>
html foot </center>
html foot </body>
html foot </html>