1Wiki::Toolkit::Plugin(3U)ser Contributed Perl DocumentatiWoinki::Toolkit::Plugin(3)
2
3
4

NAME

6       Wiki::Toolkit::Plugin - A base class for Wiki::Toolkit plugins.
7

DESCRIPTION

9       Provides methods for accessing the backend store, search and formatter
10       objects of the Wiki::Toolkit object that a plugin instance is
11       registered with.
12

SYNOPSIS

14         package Wiki::Toolkit::Plugin::Foo;
15         use base qw( Wiki::Toolkit::Plugin);
16
17         # And then in your script:
18         my $wiki = Wiki::Toolkit->new( ... );
19         my $plugin = Wiki::Toolkit::Plugin::Foo->new;
20         $wiki->register_plugin( plugin => $plugin );
21         my $node = $plugin->datastore->retrieve_node( "Home" );
22

POSSIBLE METHODS

24       pre_moderate
25             Called before moderation is performed.
26             Allows changes to the parameters used in moderation.
27
28             my %args = @_;
29             my ($name_ref,$version_ref) = @args{ qw( node version ) };
30             $$name_ref =~ s/\s/_/g;
31             return 0;
32
33       post_moderate
34             Called after moderation has been performed.
35             Allows additional actions to occur after node moderation.
36
37             my %args = @_;
38             my ($node,$node_id,$version) =
39                @args{ qw( node node_id version ) };
40             &update_pending_list($node,$version);
41
42       pre_rename
43             Called before a rename is performed.
44             Allows changes to the parameters used by rename.
45
46             my %args = @_;
47             my ($old_name_ref,$new_name_ref,$create_new_versions_ref) =
48                @args{ qw( old_name new_name create_new_versions ) };
49             $$old_name_ref =~ s/\s/_/g;
50             $$new_name_ref =~ s/\s/_/g;
51             return 0;
52
53       post_rename
54             Called after a rename has been performed.
55             Allows additional actions to occur after node renames.
56
57             my %args = @_;
58             my ($old_name,$new_name,$node_id) =
59                @args{ qw( old_name new_name node_id ) };
60             &recalculate_category_listings();
61
62       pre_retrieve
63             Called before a retrieve is performed.
64             Allows changes to the parameters used by retrieve.
65
66             my %args = @_;
67             my ($name_ref,$version_ref) = @args{ qw( node version ) };
68             return &check_retrive_allowed($$name_ref);
69
70             TODO: Allow declining of the read.
71
72       pre_write
73             Called before a write is performed.
74             Allows changes to the parameters used by the write;
75
76             my %args = @_;
77             my ($node_ref,$content_ref,$metadata_ref) =
78                 @args{ qw( node content metadata ) };
79             $$content_ref =~ s/\bpub\b/Pub/g;
80             return 1;
81
82       post_write
83             Called after a write has been performed.
84             Allows additional actions to occur after node writes.
85
86             my %args = @_;
87             my ($node,$node_id,$version,$content,$metadata) =
88                @args{ qw( node node_id version content metadata ) };
89             &log_node_write($node,gmtime);
90
91       post_delete
92             Called after a delete has been performed.
93             Allows additional actions to occur after node deletions.
94
95             my %args = @_;
96             my ($node,$node_id,$version) =
97                @args{ qw( node node_id version ) };
98             &log_node_delete($node,gmtime);
99

DECLINING ACTIONS FROM PRE_ METHODS

101         Note: This functionality is missing for pre_retrieve
102
103         It is possible for the pre_ methods (eg C<pre_write>) to
104         decline the action. This could be due to an authentication
105         check done by the plugin, due to the content, or whatever else
106         the plugin fancies. There are three possible return values from
107         a pre_ plugin:
108
109         C<-1> - Deny this action
110         C<0> or C<undef> - I have no opinion
111         C<1> - Allow this action
112
113         If you have only zeros, the action will be allowed. If you have ones
114         and zeros, it will also be allowed.
115
116         If you have minus ones and zeros, it will be denied. If you have minus
117         ones, ones and zeros, the sum will be used to decide.
118
119         For default deny, have one plugin return -1, and another only return 1
120         if the action is explicity allowed)
121

METHODS

123       new
124             sub new {
125                 my $class = shift;
126                 my $self = bless {}, $class;
127                 $self->_init if $self->can("_init");
128                 return $self;
129             }
130
131           Generic contructor, just returns a blessed object.
132
133       wiki
134           Returns the Wiki::Toolkit object, or "undef" if the
135           "register_plugin" method hasn't been called on a Wiki::Toolkit
136           object yet.
137
138       datastore
139           Returns the backend store object, or "undef" if the
140           "register_plugin" method hasn't been called on a Wiki::Toolkit
141           object yet.
142
143       indexer
144           Returns the backend search object, or "undef" if the
145           "register_plugin" method hasn't been called on a Wiki::Toolkit
146           object yet, or if the wiki object had no search object defined.
147
148       formatter
149           Returns the backend formatter object, or "undef" if the
150           "register_plugin" method hasn't been called on a Wiki::Toolkit
151           object yet.
152

SEE ALSO

154       Wiki::Toolkit
155

AUTHOR

157       Kake Pugh (kake@earth.li).
158
160            Copyright (C) 2003-4 Kake Pugh.  All Rights Reserved.
161            Copyright (C) 2006 the Wiki::Toolkit team. All Rights Reserved.
162
163       This module is free software; you can redistribute it and/or modify it
164       under the same terms as Perl itself.
165
166
167
168perl v5.32.1                      2021-01-27          Wiki::Toolkit::Plugin(3)
Impressum