Index: trunk/phase3/CREDITS |
— | — | @@ -136,6 +136,7 @@ |
137 | 137 | * PieRRoMaN |
138 | 138 | * quietust |
139 | 139 | * René Kijewski |
| 140 | +* rgcjonas |
140 | 141 | * Robert Treat |
141 | 142 | * RockMFR |
142 | 143 | * Salvatore Ingala |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -1576,7 +1576,7 @@ |
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | $attrs = array(); |
1580 | | - foreach ( array( 'href', 'id', 'class', 'rel', 'type' ) as $attr ) { |
| 1580 | + foreach ( array( 'href', 'id', 'class', 'rel', 'type', 'target') as $attr ) { |
1581 | 1581 | if ( isset( $item[$attr] ) ) { |
1582 | 1582 | $attrs[$attr] = $item[$attr]; |
1583 | 1583 | } |
— | — | @@ -1629,7 +1629,7 @@ |
1630 | 1630 | } |
1631 | 1631 | } else { |
1632 | 1632 | $link = array(); |
1633 | | - foreach ( array( 'text', 'msg', 'href', 'rel', 'type', 'tooltiponly' ) as $k ) { |
| 1633 | + foreach ( array( 'text', 'msg', 'href', 'rel', 'type', 'tooltiponly', 'target' ) as $k ) { |
1634 | 1634 | if ( isset( $item[$k] ) ) { |
1635 | 1635 | $link[$k] = $item[$k]; |
1636 | 1636 | } |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -1253,6 +1253,7 @@ |
1254 | 1254 | if ( strpos( $line, '|' ) !== false ) { // sanity check |
1255 | 1255 | $line = MessageCache::singleton()->transform( $line, false, null, $this->getTitle() ); |
1256 | 1256 | $line = array_map( 'trim', explode( '|', $line, 2 ) ); |
| 1257 | + $extraAttribs = array(); |
1257 | 1258 | |
1258 | 1259 | $msgLink = wfMessage( $line[0] )->inContentLanguage(); |
1259 | 1260 | if ( $msgLink->exists() ) { |
— | — | @@ -1273,6 +1274,28 @@ |
1274 | 1275 | |
1275 | 1276 | if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) { |
1276 | 1277 | $href = $link; |
| 1278 | + //Parser::getExternalLinkAttribs won't work here because of the Namespace things |
| 1279 | + global $wgNoFollowLinks; |
| 1280 | + if ( $wgNoFollowLinks ) { |
| 1281 | + $extraAttribs['rel'] = 'nofollow'; |
| 1282 | + |
| 1283 | + global $wgNoFollowDomainExceptions; |
| 1284 | + if ( $wgNoFollowDomainExceptions ) { |
| 1285 | + $bits = wfParseUrl( $url ); |
| 1286 | + if ( is_array( $bits ) && isset( $bits['host'] ) ) { |
| 1287 | + foreach ( $wgNoFollowDomainExceptions as $domain ) { |
| 1288 | + if ( substr( $bits['host'], -strlen( $domain ) ) == $domain ) { |
| 1289 | + unset( $extraAttribs['rel'] ); |
| 1290 | + break; |
| 1291 | + } |
| 1292 | + } |
| 1293 | + } |
| 1294 | + } |
| 1295 | + } |
| 1296 | + global $wgExternalLinkTarget; |
| 1297 | + if ( $wgExternalLinkTarget) { |
| 1298 | + $extraAttribs['target'] = $wgExternalLinkTarget; |
| 1299 | + } |
1277 | 1300 | } else { |
1278 | 1301 | $title = Title::newFromText( $link ); |
1279 | 1302 | |
— | — | @@ -1284,12 +1307,12 @@ |
1285 | 1308 | } |
1286 | 1309 | } |
1287 | 1310 | |
1288 | | - $bar[$heading][] = array( |
| 1311 | + $bar[$heading][] = array_merge( array( |
1289 | 1312 | 'text' => $text, |
1290 | 1313 | 'href' => $href, |
1291 | 1314 | 'id' => 'n-' . strtr( $line[1], ' ', '-' ), |
1292 | 1315 | 'active' => false |
1293 | | - ); |
| 1316 | + ), $extraAttribs ); |
1294 | 1317 | } elseif ( ( substr( $line, 0, 2 ) == '{{' ) && ( substr( $line, -2 ) == '}}' ) ) { |
1295 | 1318 | global $wgParser; |
1296 | 1319 | |