summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/editpage.pm28
-rw-r--r--IkiWiki/Plugin/po.pm10
-rw-r--r--IkiWiki/Plugin/skeleton.pm.example10
3 files changed, 5 insertions, 43 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index 4540b55d0..cfed51afd 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -117,33 +117,6 @@ sub check_content (@) {
return defined $ok ? $ok : 1;
}
-sub check_cansave ($$$$) {
- my $page=shift;
- my $content=shift;
- my $q=shift;
- my $session=shift;
-
- my $cansave;
- run_hooks(cansave => sub {
- return if defined $cansave;
- my $ret=shift->($page, $content, $q, $session);
- if (defined $ret) {
- if ($ret eq "") {
- $cansave=1;
- }
- elsif (ref $ret eq 'CODE') {
- $ret->();
- $cansave=0;
- }
- else {
- error($ret);
- $cansave=0;
- }
- }
- });
- return $cansave;
-}
-
sub cgi_editpage ($$) {
my $q=shift;
my $session=shift;
@@ -439,7 +412,6 @@ sub cgi_editpage ($$) {
}
my $content=$form->field('editcontent');
- check_cansave($page, $content, $q, $session);
check_content(content => $content, page => $page,
cgi => $q, session => $session,
subject => $message);
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 0a970284c..daac95eb1 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -49,7 +49,7 @@ sub import {
hook(type => "rename", id => "po", call => \&renamepages, first => 1);
hook(type => "delete", id => "po", call => \&mydelete);
hook(type => "change", id => "po", call => \&change);
- hook(type => "cansave", id => "po", call => \&cansave);
+ hook(type => "checkcontent", id => "po", call => \&checkcontent);
hook(type => "canremove", id => "po", call => \&canremove);
hook(type => "canrename", id => "po", call => \&canrename);
hook(type => "editcontent", id => "po", call => \&editcontent);
@@ -436,11 +436,11 @@ sub change(@) {
}
}
-sub cansave ($$$$) {
- my ($page, $content, $cgi, $session) = (shift, shift, shift, shift);
+sub checkcontent (@) {
+ my %params=@_;
- if (istranslation($page)) {
- my $res = isvalidpo($content);
+ if (istranslation($params{page})) {
+ my $res = isvalidpo($params{content});
if ($res) {
return undef;
}
diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example
index 7506816f1..59503a462 100644
--- a/IkiWiki/Plugin/skeleton.pm.example
+++ b/IkiWiki/Plugin/skeleton.pm.example
@@ -30,7 +30,6 @@ sub import {
hook(type => "auth", id => "skeleton", call => \&auth);
hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
hook(type => "canedit", id => "skeleton", call => \&canedit);
- hook(type => "cansave", id => "skeleton", call => \&cansave);
hook(type => "checkcontent", id => "skeleton", call => \&checkcontent);
hook(type => "editcontent", id => "skeleton", call => \&editcontent);
hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup);
@@ -182,15 +181,6 @@ sub canedit ($$$) {
debug("skeleton plugin running in canedit");
}
-sub cansave ($$$$) {
- my $page=shift;
- my $content=shift;
- my $cgi=shift;
- my $session=shift;
-
- debug("skeleton plugin running in cansave");
-}
-
sub canremove ($$$) {
my $page=shift;
my $cgi=shift;