From 040f37cc0c63be86432f32ac28485e7a553e2c79 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 29 Sep 2005 23:35:31 +0000 Subject: [PATCH] * Added EditFilter hook, and output callback on EditPage::showEditForm() for a place to add in captcha-type extensions in the edit flow --- RELEASE-NOTES | 2 ++ includes/EditPage.php | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3ca09e9021..76cad8f3cb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -122,6 +122,8 @@ fully support the editing toolbar, but was found to be too confusing. * Add options to dumpBackup.php for making split/partial dumps by page id * Fix language name for dv * (bug 3503) Update LanguageSq.php from sq.wikipedia.org messages +* Added EditFilter hook, and output callback on EditPage::showEditForm() + for a place to add in captcha-type extensions in the edit flow === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index 3adc22bcb0..a18b06aa20 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -430,6 +430,12 @@ class EditPage { wfProfileOut( "$fname-checks" ); return false; } + if ( !wfRunHooks( 'EditFilter', array( &$this, $this->textbox1, $this->section ) ) ) { + # Error messages or other handling should be performed by the filter function + wfProfileOut( $fname ); + wfProfileOut( "$fname-checks" ); + return false; + } if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) { # Check block state against master, thus 'false'. $this->blockedIPpage(); @@ -593,8 +599,11 @@ class EditPage { /** * Send the edit form and related headers to $wgOut + * @param $formCallback Optional callable that takes an OutputPage + * parameter; will be called during form output + * near the top, for captchas and the like. */ - function showEditForm() { + function showEditForm( $formCallback=null ) { global $wgOut, $wgUser, $wgAllowAnonymousMinor, $wgLang, $wgContLang; $fname = 'EditPage::showEditForm'; @@ -810,6 +819,12 @@ class EditPage { {$toolbar}
+END +); + if( is_callable( $formCallback ) ) { + call_user_func_array( $formCallback, array( &$wgOut ) ); + } + $wgOut->addHTML( <<