Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [37741] trunk/phase3

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


david at svn

Jul 16, 2008, 12:22 AM

Post #1 of 1 (136 views)
Permalink
SVN: [37741] trunk/phase3

Revision: 37741
Author: david
Date: 2008-07-16 07:22:21 +0000 (Wed, 16 Jul 2008)

Log Message:
-----------
Changed getInternalLinkAttributesInternal parameters: now accepts Title object if available, passes to hook. Also reordered some code in makeKnownLinkObj so that said hook can mangle the Title object. Reordering should have no other side-effects.

Modified Paths:
--------------
trunk/phase3/docs/hooks.txt
trunk/phase3/includes/Linker.php

Modified: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt 2008-07-16 06:59:11 UTC (rev 37740)
+++ trunk/phase3/docs/hooks.txt 2008-07-16 07:22:21 UTC (rev 37741)
@@ -753,6 +753,13 @@
$specialPageAliases: associative array of magic words synonyms
$lang: laguage code (string)

+'LinkerLinkAttributes': At the end of Linker::getLinkAttributesInternal() just before the return
+&$this: Linker object
+&$nt: Title object of link target, or null
+$title: 'title' attribute string
+$class: 'class' attribute string
+&$result: Final attribute string
+
'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just before the return
&$url: the image url
&$alt: the image's alt text

Modified: trunk/phase3/includes/Linker.php
===================================================================
--- trunk/phase3/includes/Linker.php 2008-07-16 06:59:11 UTC (rev 37740)
+++ trunk/phase3/includes/Linker.php 2008-07-16 07:22:21 UTC (rev 37741)
@@ -34,7 +34,7 @@
* string is passed, which is the default value, defaults to 'external'.
*/
function getExternalLinkAttributes( $title, $unused = null, $class='' ) {
- return $this->getLinkAttributesInternal( $title, $class, 'external' );
+ return $this->getLinkAttributesInternal( null, $title, $class, 'external' );
}

/**
@@ -56,7 +56,7 @@
$title = $wgContLang->checkTitleEncoding( $title );
$title = preg_replace( '/[\\x00-\\x1f]/', ' ', $title );

- return $this->getLinkAttributesInternal( $title, $class, 'external' );
+ return $this->getLinkAttributesInternal( null, $title, $class, 'external' );
}

/**
@@ -71,7 +71,7 @@
function getInternalLinkAttributes( $title, $unused = null, $class='' ) {
$title = urldecode( $title );
$title = str_replace( '_', ' ', $title );
- return $this->getLinkAttributesInternal( $title, $class );
+ return $this->getLinkAttributesInternal( null, $title, $class );
}

/**
@@ -88,13 +88,13 @@
if( $title === false ) {
$title = $nt->getPrefixedText();
}
- return $this->getLinkAttributesInternal( $title, $class );
+ return $this->getLinkAttributesInternal( $nt, $title, $class );
}

/**
* Common code for getLinkAttributesX functions
*/
- private function getLinkAttributesInternal( $title, $class, $classDefault = false ) {
+ private function getLinkAttributesInternal( $nt, $title, $class, $classDefault = false ) {
$title = htmlspecialchars( $title );
if( $class === '' and $classDefault !== false ) {
# FIXME: Parameter defaults the hard way! We should just have
@@ -108,6 +108,7 @@
$r .= " class=\"$class\"";
}
$r .= " title=\"$title\"";
+ wfRunHooks( 'LinkerLinkAttributes', array( &$this, &$nt, $title, $class, &$r ) );
return $r;
}

@@ -323,6 +324,12 @@

$nt = $this->normaliseSpecialPage( $title );

+ if ( $text == '' ) {
+ $text = htmlspecialchars( $nt->getPrefixedText() );
+ }
+ if ( $style == '' ) {
+ $style = $this->getInternalLinkAttributesObj( $nt, $text );
+ }
$u = $nt->escapeLocalURL( $query );
if ( $nt->getFragment() != '' ) {
if( $nt->getPrefixedDbkey() == '' ) {
@@ -333,12 +340,6 @@
}
$u .= $nt->getFragmentForURL();
}
- if ( $text == '' ) {
- $text = htmlspecialchars( $nt->getPrefixedText() );
- }
- if ( $style == '' ) {
- $style = $this->getInternalLinkAttributesObj( $nt, $text );
- }

if ( $aprops !== '' ) $aprops = ' ' . $aprops;




_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.