wiki.techinc.nl/includes/parser/CoreLinkFunctions.php
Daniel Friesen 5a43da4025 Committing today's work the LinkHooks' new parser.
Don't expect this to work completely yet, there is likely going to be a lot of refactoring before a final version is complete.
2008-08-18 14:44:51 +00:00

27 lines
875 B
PHP

<?php
/**
* Various core link functions, registered in Parser::firstCallInit()
* @ingroup Parser
*/
class CoreLinkFunctions {
static static function register( $parser ) {
}
static function defaultLinkHook( $markers, Title $title, $titleText, &$displayText = null, &$leadingColon = false ) {
# Warning: This hook should NEVER return true as it is the fallback
# default for when other hooks return true
if( $markers->findMarker( $displayText ) ) {
# There are links inside of the displayText
# For backwards compatibility the deepest links are dominant so this
# link should not be handled
$displayText = $markers->expand($displayText);
# Return false so that this link is reverted back to WikiText
return false;
}
return $markers->holders()->makeHolder( $title, isset($displayText) ? $displayText : $titleText, '', '', '' );
}
}