Added new hook, 'BrokenLink'
authorYaron Koren <yaron@users.mediawiki.org>
Thu, 6 Mar 2008 18:23:30 +0000 (18:23 +0000)
committerYaron Koren <yaron@users.mediawiki.org>
Thu, 6 Mar 2008 18:23:30 +0000 (18:23 +0000)
docs/hooks.txt
includes/Linker.php

index a6f381b..4fe5326 100644 (file)
@@ -462,6 +462,18 @@ $user: the user who did the block (not the one being blocked)
 $isbn: ISBN to show information for
 $output: OutputPage object in use
 
+'BrokenLink': Before the HTML is created for a broken (i.e. red) link
+&$this: Linker instance
+$nt: the page title
+$query: the URL query string passed in
+&$u: the URL of this link
+&$style: the inline CSS style
+&$prefix: a prefix prepended to the linked text
+&$text: the text placed by the user in the wiki-link
+&$inside: any additional alphanumeric characters placed after the wiki-link,
+that are made part of the link text
+&$trail: text placed immediately after the HTML link
+
 'CategoryPageView': before viewing a categorypage in CategoryPage::view
 $catpage: CategoryPage instance
 
index 105e24b..91b6430 100644 (file)
@@ -356,8 +356,9 @@ class Linker {
                }
                $titleAttr = wfMsg( 'red-link-title', $titleText );
                $style = $this->getInternalLinkAttributesObj( $nt, $text, 'new', $titleAttr );
-
                list( $inside, $trail ) = Linker::splitTrail( $trail );
+
+               wfRunHooks( 'BrokenLink', array( &$this, $nt, $query, &$u, &$style, &$prefix, &$text, &$inside, &$trail ) );
                $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
 
                wfProfileOut( __METHOD__ );