Added 2 hooks. One in Parser to allow custom handling of namespace links, and one...
authorJason Richey <jasonr@users.mediawiki.org>
Wed, 15 Oct 2008 19:32:59 +0000 (19:32 +0000)
committerJason Richey <jasonr@users.mediawiki.org>
Wed, 15 Oct 2008 19:32:59 +0000 (19:32 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/EditPage.php
includes/parser/Parser.php

index bac626d..5634216 100644 (file)
@@ -163,7 +163,12 @@ The following extensions are migrated into MediaWiki 1.14:
   several uses of the same image.
 * (bug 1250) Users can still use "show preview" and "show changes" even if the 
   wiki is set to read-only mode.
-
+* Added 'ParserLinkNSCheck' hook in the parser, allowing extensions to catch and handle 
+  links based on namespace (for instance, to add code to handle [[Tag: Foo]] similarly 
+  to how [[Category: Foo]] is handled.
+* Added 'EditPageNoPermission' hook to allow special handling/output when a non-editor 
+  views an edit page.
+  
 === Bug fixes in 1.14 ===
 
 * (bug 14907) DatabasePostgres::fieldType now defined.
index 7cab756..5209796 100644 (file)
@@ -492,6 +492,15 @@ rendered inline in wiki pages or galleries in category pages.
 &$skip: skip this template and link it?
 &$id: the id of the revision being parsed
 
+'ParserLinkNSCheck': after Image and Category links are handled, before general link processing
+Allows an extension to catch arbitrary namespaces and hande their links differently
+&$parser: the parser instance
+&$title: The title instance
+&$s: The current value of s, as used in replaceInternalLinks2
+&$text: The text of the link
+&$prefix:The bit of text just before the link begins, depending on language settings
+&$trail: The bit of text after the link ends, depending on language settings
+
 'BeforeParserMakeImageLinkObj': before an image is rendered by Parser
 &$parser: Parser object
 &$nt: the image title
@@ -587,6 +596,10 @@ $text: content of the edit box
 $error: error message to return
 $summary: Edit summary for page
 
+'EditPageNoPermission': allows modification of permission Errors before the readonly page is loaded
+&$editpage: The editpage instance 
+&$permErrors: the permission Errors from editpage->getEditPermissionErrors()
+
 'EditFormPreloadText': Allows population of the edit form when creating new pages
 &$text: Text to preload with
 &$title: Title object representing the page being created
index be4dee1..9639697 100644 (file)
@@ -385,6 +385,7 @@ class EditPage {
                $permErrors = $this->getEditPermissionErrors();
                if ( $permErrors ) {
                        wfDebug( __METHOD__.": User can't edit\n" );
+                       wfRunHooks( 'EditPageNoPermission', array( &$this, &$permErrors ) );
                        $this->readOnlyPage( $this->getContent(), true, $permErrors, 'edit' );
                        wfProfileOut( __METHOD__ );
                        return;
index 0021e98..7070be6 100644 (file)
@@ -1801,6 +1801,10 @@ class Parser
                                        wfProfileOut( __METHOD__."-category" );
                                        continue;
                                }
+                               # Give extensions a chance to catch other namespace links
+                               if ( !wfRunHooks( 'ParserLinkNSCheck', array( &$this, &$nt, &$s, &$text, &$prefix, &$trail ) ) ) {
+                                 continue;
+                               }
                        }
 
                        # Self-link checking