1 # Blosxom Plugin: prefs
2 # Author(s): Barijaona Ramaholimihaso <prefs@barijaona.com>
3 # based on config plugin authored by Rael Dornfest <rael@oreilly.com>
5 # Documentation: See the bottom of this file or type: perldoc prefs
7 # WARNING: DO NOT PUT PREFERENCE FILES IN WORLD-READABLE PLACES SUCH AS WITHIN
8 # YOUR DOCUMENT ROOT. IF YOUR $DATADIR IS LOCATED WITHIN YOUR DOCUMENT ROOT,
9 # I HEARTILY ADVISE THAT YOU MOVE IT. WHILE MOST OF THE CONFIGURATION
10 # DIRECTIVES ARE INNOCUOUS ENOUGH, IT'S A SLIPPERY SLOPE AND YOU MIGHT WELL
11 # FIND YOU'VE EXPOSED YOUR STATIC PASSWORD OR INTERNAL DIRECTORY STRUCTURE
12 # TO ANYONE WITH A WEB BROWSER!
16 # --- Configurable variables -----
17 # where are located the preference files
19 # I prefer to have mines in my flavour directory
20 # $basepath = "/Users/barijaon/blosxom/flavours";
22 $basepath = $blosxom::datadir unless defined $basepath ;
23 # --------------------------------
32 $path_find = $blosxom::path_info ;
34 $file = "$basepath$path"."pageprefs";
35 if (-r $file) { unless ($return = do $file) {
36 warn "Couldn't parse $file: $@" if $@;
40 $file .= ".$blosxom::flavour";
41 if (-r $file) { unless ($return = do $file) {
42 warn "Couldn't parse $file: $@" if $@;
45 while ($path_find =~ s#/?([^/]*)##) and $1 and ($path .= $1."/" );
51 my ($pkg, $path_find, $filename, $story_ref, $title_ref, $body_ref)= @_;
54 $file = "$basepath$path"."storyprefs";
55 if (-r $file) { unless ($return = do $file) {
56 warn "Couldn't parse $file: $@" if $@;
60 $file .= ".$blosxom::flavour";
61 if (-r $file) { unless ($return = do $file) {
62 warn "Couldn't parse $file: $@" if $@;
65 while ($path_find =~ s#/?([^/]*)##) and $1 and ($path .= $1."/" );
75 Blosxom Plug-in: prefs
79 Override Blosxom's inline configuration settings on a per-directory, per-flavour, and per-directory-per-flavour basis.
81 For each generated page, looks for B<pageprefs> and B<pageprefs.flavour> files which should contain valid Perl instructions.
83 For each story, looks for B<storyprefs> and B<storyprefs.flavour> files which should contain valid Perl instructions.
85 Prefs has a purpose very similar to Rael Dornfest's B<config> plugin, but was written because in static rendering, B<config> uses the same config file for all pages.
87 When Blosxom process a page or a story, all prefs files (pageprefs, pageprefs.flavour, storyprefs, storyprefs.flavour) in the directory tree for this page or story are executed. Prefs files for a specific flavour override prefs files applying to all flavours, and prefs files in subdirectories override prefs files in their parents.
89 pageprefs are executed once per page (when the head of the page is generated), and storyprefs are executed once per story (allowing a per story tuning inside a page).
91 It is recommanded that you prefix the name of the plugin with a number (for instance, naming it 10prefs) so that it loads before other Blosxom plugins (but after the B<meta> plugin if you use it).
97 Version number is the date on which this version of the plug-in was created.
101 Barijaona Ramaholimihaso <prefs@barijaona.com>
103 Prefs is based on the config plugin written by Rael Dornfest <rael@oreilly.com>, http://www.raelity.org/
108 Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
110 Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
114 Address bug reports and comments to <prefs@barijaona.com> or to the Blosxom mailing list
115 [http://www.yahoogroups.com/group/blosxom].
120 Copyright 2003-2005, Barijaona Ramaholimihaso
122 Blosxom and config Plug-in
123 Copyright 2003, Rael Dornfest
125 Permission is hereby granted, free of charge, to any person obtaining a
126 copy of this software and associated documentation files (the "Software"),
127 to deal in the Software without restriction, including without limitation
128 the rights to use, copy, modify, merge, publish, distribute, sublicense,
129 and/or sell copies of the Software, and to permit persons to whom the
130 Software is furnished to do so, subject to the following conditions:
132 The above copyright notice and this permission notice shall be included
133 in all copies or substantial portions of the Software.
135 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
136 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
137 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
138 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
139 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
140 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
141 OTHER DEALINGS IN THE SOFTWARE.