public static function parseWikiLinks( $text, $articlePath ) {
		self::$articlePath = $articlePath;

		return preg_replace_callback(
			'/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/',
			function ( array $bits ) {
				if ( !isset( $bits[2] ) || $bits[2] == '' ) {
					$bits[2] = strtr( $bits[1], '_', ' ' );
				}

				$article = html_entity_decode( $bits[1], ENT_QUOTES, 'UTF-8' );

				return '<a href="' . htmlspecialchars(
					self::prettyEncodedWikiUrl( self::$articlePath, $article ), ENT_COMPAT, 'UTF-8'
				) . '">' . $bits[2] . "</a>";
			},
			$text
		);
	}
public static function parseWikiLinks( $text, $articlePath ) {
		self::$articlePath = $articlePath;

		return preg_replace_callback(
			'/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/',
			function ( array $bits ) {
				if ( !isset( $bits[2] ) || $bits[2] == '' ) {
					$bits[2] = strtr( $bits[1], '_', ' ' );
				}

				$article = html_entity_decode( $bits[1], ENT_QUOTES, 'UTF-8' );

				return '<a href="' . htmlspecialchars(
					self::prettyEncodedWikiUrl( self::$articlePath, $article ), ENT_COMPAT, 'UTF-8'
				) . '">' . $bits[2] . "</a>";
			},
			$text
		);
	}
public static function parseWikiLinks ( $ text , $ articlePath ) { self :: $ articlePath = $ articlePath ; return preg_replace_callback ( '/\[\[:?([^]|]+)(?:\|([^]]*))?\]\]/' , function ( array $ bits ) { if ( ! isset ( $ bits [ 2 ] ) || $ bits [ 2 ] == '' ) { $ bits [ 2 ] = strtr ( $ bits [ 1 ] , '_' , ' ' ) ; } $ article = html_entity_decode ( $ bits [ 1 ] , ENT_QUOTES , 'UTF-8' ) ; return '<a href="' . htmlspecialchars ( self :: prettyEncodedWikiUrl ( self :: $ articlePath , $ article ) , ENT_COMPAT , 'UTF-8' ) . '">' . $ bits [ 2 ] . "</a>" ; } , $ text ) ; }
Given a text already html-escaped which contains wiki links, convert them to html.

@param string $text
@param string $articlePath
@return string
Given a text already html - escaped which contains wiki links convert them to html .