diff options
author | 2018-11-24 19:23:34 -0500 | |
---|---|---|
committer | 2018-11-24 19:23:34 -0500 | |
commit | 42dfb20576daa988d21719abe836a2a806d01d87 (patch) | |
tree | fab5cb70fd1eba49a701971ed8eadf54df2a472c /LinkAttributes | |
parent | LinkAttributes: One further syntax error (diff) | |
download | extensions-42dfb20576daa988d21719abe836a2a806d01d87.tar.gz extensions-42dfb20576daa988d21719abe836a2a806d01d87.tar.bz2 extensions-42dfb20576daa988d21719abe836a2a806d01d87.zip |
LinkAttributes: Add class as valid, replace deprecated LinkBegin
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'LinkAttributes')
-rw-r--r-- | LinkAttributes/LinkAttributes.body.php | 15 | ||||
-rw-r--r-- | LinkAttributes/extension.json | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/LinkAttributes/LinkAttributes.body.php b/LinkAttributes/LinkAttributes.body.php index e0c112c3..a0955370 100644 --- a/LinkAttributes/LinkAttributes.body.php +++ b/LinkAttributes/LinkAttributes.body.php @@ -1,9 +1,9 @@ <?php class LinkAttributes { - private static $attrsAllowed=array( 'rel', 'rev', 'charset ', 'type', 'hreflang', 'itemprop', 'media', 'title', 'accesskey', 'target' ); + private static $attrsAllowed=[ 'rel', 'rev', 'charset ', 'type', 'hreflang', 'itemprop', 'media', 'title', 'accesskey', 'target' ]; - private function doExtractAttributes ( &$text, &$attribs ) { + private static function doExtractAttributes ( &$text, &$attribs ) { global $wgRequest; if ( $wgRequest->getText( 'action' ) == 'edit' ) { @@ -39,18 +39,25 @@ class LinkAttributes { } - public function ExternalLink ( &$url, &$text, &$link, &$attribs ) { + public static function ExternalLink ( &$url, &$text, &$link, &$attribs ) { self::doExtractAttributes ( $text, $attribs ); return true; } - public function InternalLink ( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) { + public static function InternalLink ( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) { self::doExtractAttributes ( $text, $customAttribs ); return true; } + public static function onHtmlPageLinkRendererBegin( + LinkRenderer $linkRenderer, LinkTarget $target, &$text, &$extraAttribs, &$query, &$ret ) { + + self::doExtractAttributes ( $text, $extraAttribs ); + return true; + + } } diff --git a/LinkAttributes/extension.json b/LinkAttributes/extension.json index dd6a25dc..5aa7f8bf 100644 --- a/LinkAttributes/extension.json +++ b/LinkAttributes/extension.json @@ -21,7 +21,7 @@ }, "Hooks": { "LinkerMakeExternalLink": "LinkAttributes::ExternalLink", - "LinkBegin": "LinkAttributes::InternalLink" + "HtmlPageLinkRendererBegin": "LinkAttributes::onHtmlPageLinkRendererBegin" }, "manifest_version": 1 } |