Wikia code/includes/Linker.php

" +			/* Wikia change begin - @author: macbre, Marooned */ +			/* Fixes for #2643 and #3730 - macbre */ +			/* Fixes for rt#18733 (do not wait for ads to run this script) - Marooned */ 		 . Html::inlineScript( -			'if (window.showTocToggle) {' -			. ' var tocShowText = "' . Xml::escapeJsString( wfMsg('showtoc') ) . '";' -			. ' var tocHideText = "' . Xml::escapeJsString( wfMsg('hidetoc') ) . '";' +				'wgAfterContentAndJS.push(function {' +				. 'if (window.showTocToggle) {' +				. ' window.tocShowText = "'. Xml::escapeJsString( wfMsg('showtoc') ). '";' +				. ' window.tocHideText = "'. Xml::escapeJsString( wfMsg('hidetoc') ). '";' 			. ' showTocToggle;' -			. ' } ' ) +				. ' } });' ) 		. "\n"; 	} @@ -1364,6 +1438,13 @@ 		// HTML generated here should probably have userlangattributes 		// added to it for LTR text on RTL pages 		$attribs = array; +		global $wgWikiaUseNoFollow; +		if( !empty( $wgWikiaUseNoFollow ) ) { +			/* Wikia change begin - @author: uknkown */ +			/* Ad rel="nofollow" attribute to edit section links */ +			$attribs['rel'] = 'nofollow'; +			/* Wikia change end */ +		} 		if( !is_null( $tooltip ) ) { 			$attribs['title'] = wfMsg( 'editsectionhint', $tooltip ); 		} @@ -1415,12 +1496,17 @@ 	 * @return string HTML headline 	 */ 	public function makeHeadline( $level, $attribs, $anchor, $text, $link, $legacyAnchor = false ) { +		$nofollow = ''; +		global $wgWikiaUseNoFollow; +		if( !empty( $wgWikiaUseNoFollow ) ) { +			$nofollow = ' rel="nofollow"'; +		} 		$ret = "$text " . ""; if ( $legacyAnchor !== false ) { -			$ret = "$ret"; +			$ret = "$ret"; } 		return $ret; } @@ -1552,6 +1638,12 @@ 			} 			$outText .= ''; } + +		/* Wikia change begin - @author: Macnre */ +		/* #22760: Shorten edit page 'transcluded pages' list using JS */ +		wfRunHooks('LinkerFormatTemplates', array(&$this, &$templates, &$outText)); +		/* Wikia change end */ + 		wfProfileOut( __METHOD__ ); return $outText; } @@ -1825,7 +1917,26 @@ 			$text = $this->linkText( $nt ); } -		$ret = $this->link( $nt, "$prefix$text$inside", array, $query ). $trail; +		/* Wikia change begin - @author: unknown, Inez */ +		$attribs = array; +		if( $nt && $nt->isExternal) { +			$iwclass = strtolower($nt->getInterwiki); +			if(in_array($iwclass, array('w', 'wikia', 'wikicities'))) { +				$iwclass = 'w'; +				$iw_temp = explode(':', strtolower($nt->getText)); +				if(!empty($iw_temp[0])) { +					if ('c' == $iw_temp[0]) { +						if (!empty($iw_temp[1])) { +							$iwclass .= " wikia-{$iw_temp[1]}"; +						} +					} +				} +			} +			$attribs['class'] = "interwiki-{$iwclass}"; +		} +		/* Wikia change end */ + +		$ret = $this->link( $nt, "$prefix$text$inside", $attribs, $query ). $trail; wfProfileOut( __METHOD__ ); return $ret; @@ -1882,13 +1993,34 @@ 	function makeBrokenLinkObj( $title, $text = , $query = , $trail = , $prefix =  ) { wfProfileIn( __METHOD__ ); +		// wikia change begin +		global $wgWikiaEnableSharedHelpExt; +		if ( $wgWikiaEnableSharedHelpExt +			&& ( NS_HELP == $title->getNamespace ) +			&& SharedHelpArticleExists($title) ) +		{ +			return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); +		} +		// wikia change end + 		list( $inside, $trail ) = Linker::splitTrail( $trail ); if( $text === '' ) { $text = $this->linkText( $title ); } 		$nt = $this->normaliseSpecialPage( $title ); -		$ret = $this->link( $title, "$prefix$text$inside", array, +		// wikia change begin +		$attribs = array; +		global $wgWikiaUseNoFollow, $wgWikiaEnableAutoPageCreateExt; +		if( !empty( $wgWikiaUseNoFollow ) +			&& ( ( empty( $wgWikiaEnableAutoPageCreateExt ) && !empty( $wgWikiaUseNoFollowForContent ) ) +			|| ( !$title->isContentPage ) ) ) +		{ +			$attribs['rel'] = 'nofollow'; +		} +		// wikia change end + +		$ret = $this->link( $title, "$prefix$text$inside", $attribs, wfCgiToArray( $query ), 'broken' ) . $trail; 		wfProfileOut( __METHOD__ );