.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Wiki::Toolkit::Plugin 3pm" .TH Wiki::Toolkit::Plugin 3pm "2016-12-31" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Wiki::Toolkit::Plugin \- A base class for Wiki::Toolkit plugins. .SH "DESCRIPTION" .IX Header "DESCRIPTION" Provides methods for accessing the backend store, search and formatter objects of the Wiki::Toolkit object that a plugin instance is registered with. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& package Wiki::Toolkit::Plugin::Foo; \& use base qw( Wiki::Toolkit::Plugin); \& \& # And then in your script: \& my $wiki = Wiki::Toolkit\->new( ... ); \& my $plugin = Wiki::Toolkit::Plugin::Foo\->new; \& $wiki\->register_plugin( plugin => $plugin ); \& my $node = $plugin\->datastore\->retrieve_node( "Home" ); .Ve .SH "POSSIBLE METHODS" .IX Header "POSSIBLE METHODS" .IP "\fBpre_moderate\fR" 4 .IX Item "pre_moderate" .Vb 2 \& Called before moderation is performed. \& Allows changes to the parameters used in moderation. \& \& my %args = @_; \& my ($name_ref,$version_ref) = @args{ qw( node version ) }; \& $$name_ref =~ s/\es/_/g; \& return 0; .Ve .IP "\fBpost_moderate\fR" 4 .IX Item "post_moderate" .Vb 2 \& Called after moderation has been performed. \& Allows additional actions to occur after node moderation. \& \& my %args = @_; \& my ($node,$node_id,$version) = \& @args{ qw( node node_id version ) }; \& &update_pending_list($node,$version); .Ve .IP "\fBpre_rename\fR" 4 .IX Item "pre_rename" .Vb 2 \& Called before a rename is performed. \& Allows changes to the parameters used by rename. \& \& my %args = @_; \& my ($old_name_ref,$new_name_ref,$create_new_versions_ref) = \& @args{ qw( old_name new_name create_new_versions ) }; \& $$old_name_ref =~ s/\es/_/g; \& $$new_name_ref =~ s/\es/_/g; \& return 0; .Ve .IP "\fBpost_rename\fR" 4 .IX Item "post_rename" .Vb 2 \& Called after a rename has been performed. \& Allows additional actions to occur after node renames. \& \& my %args = @_; \& my ($old_name,$new_name,$node_id) = \& @args{ qw( old_name new_name node_id ) }; \& &recalculate_category_listings(); .Ve .IP "\fBpre_retrieve\fR" 4 .IX Item "pre_retrieve" .Vb 2 \& Called before a retrieve is performed. \& Allows changes to the parameters used by retrieve. \& \& my %args = @_; \& my ($name_ref,$version_ref) = @args{ qw( node version ) }; \& return &check_retrive_allowed($$name_ref); \& \& TODO: Allow declining of the read. .Ve .IP "\fBpre_write\fR" 4 .IX Item "pre_write" .Vb 2 \& Called before a write is performed. \& Allows changes to the parameters used by the write; \& \& my %args = @_; \& my ($node_ref,$content_ref,$metadata_ref) = \& @args{ qw( node content metadata ) }; \& $$content_ref =~ s/\ebpub\eb/Pub/g; \& return 1; .Ve .IP "\fBpost_write\fR" 4 .IX Item "post_write" .Vb 2 \& Called after a write has been performed. \& Allows additional actions to occur after node writes. \& \& my %args = @_; \& my ($node,$node_id,$version,$content,$metadata) = \& @args{ qw( node node_id version content metadata ) }; \& &log_node_write($node,gmtime); .Ve .IP "\fBpost_delete\fR" 4 .IX Item "post_delete" .Vb 2 \& Called after a delete has been performed. \& Allows additional actions to occur after node deletions. \& \& my %args = @_; \& my ($node,$node_id,$version) = \& @args{ qw( node node_id version ) }; \& &log_node_delete($node,gmtime); .Ve .SH "DECLINING ACTIONS FROM PRE_ METHODS" .IX Header "DECLINING ACTIONS FROM PRE_ METHODS" .Vb 1 \& Note: This functionality is missing for pre_retrieve \& \& It is possible for the pre_ methods (eg C) to \& decline the action. This could be due to an authentication \& check done by the plugin, due to the content, or whatever else \& the plugin fancies. There are three possible return values from \& a pre_ plugin: \& \& C<\-1> \- Deny this action \& C<0> or C \- I have no opinion \& C<1> \- Allow this action \& \& If you have only zeros, the action will be allowed. If you have ones \& and zeros, it will also be allowed. \& \& If you have minus ones and zeros, it will be denied. If you have minus \& ones, ones and zeros, the sum will be used to decide. \& \& For default deny, have one plugin return \-1, and another only return 1 \& if the action is explicity allowed) .Ve .SH "METHODS" .IX Header "METHODS" .IP "\fBnew\fR" 4 .IX Item "new" .Vb 6 \& sub new { \& my $class = shift; \& my $self = bless {}, $class; \& $self\->_init if $self\->can("_init"); \& return $self; \& } .Ve .Sp Generic contructor, just returns a blessed object. .IP "\fBwiki\fR" 4 .IX Item "wiki" Returns the Wiki::Toolkit object, or \f(CW\*(C`undef\*(C'\fR if the \f(CW\*(C`register_plugin\*(C'\fR method hasn't been called on a Wiki::Toolkit object yet. .IP "\fBdatastore\fR" 4 .IX Item "datastore" Returns the backend store object, or \f(CW\*(C`undef\*(C'\fR if the \f(CW\*(C`register_plugin\*(C'\fR method hasn't been called on a Wiki::Toolkit object yet. .IP "\fBindexer\fR" 4 .IX Item "indexer" Returns the backend search object, or \f(CW\*(C`undef\*(C'\fR if the \&\f(CW\*(C`register_plugin\*(C'\fR method hasn't been called on a Wiki::Toolkit object yet, or if the wiki object had no search object defined. .IP "\fBformatter\fR" 4 .IX Item "formatter" Returns the backend formatter object, or \f(CW\*(C`undef\*(C'\fR if the \f(CW\*(C`register_plugin\*(C'\fR method hasn't been called on a Wiki::Toolkit object yet. .SH "SEE ALSO" .IX Header "SEE ALSO" Wiki::Toolkit .SH "AUTHOR" .IX Header "AUTHOR" Kake Pugh (kake@earth.li). .SH "COPYRIGHT" .IX Header "COPYRIGHT" .Vb 2 \& Copyright (C) 2003\-4 Kake Pugh. All Rights Reserved. \& Copyright (C) 2006 the Wiki::Toolkit team. All Rights Reserved. .Ve .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.