* it doesn't have to do a database query. It's also valid for interwiki titles and special
* pages.
*
- * @param object Title of target page
- * @param string Text to replace the title
- * @param string Link target
- * @param string Text after link
- * @param string Text before link text
- * @param string Extra attributes to the a-element
+ * @param object $nt Title of target page
+ * @param string $text Text to replace the title
+ * @param string $query Link target
+ * @param string $trail Text after link
+ * @param string $prefix Text before link text
+ * @param string $aprops Extra attributes to the a-element
+ * @param string $style Style to apply - if empty, use getInternalLinkAttributesObj instead
* @return the a-element
*/
- function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '' ) {
+ function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) {
$fname = 'Linker::makeKnownLinkObj';
wfProfileIn( $fname );
}
$u = $nt->escapeLocalURL( $query );
- if ( '' != $nt->getFragment() ) {
+ if ( $nt->getFragment() != '' ) {
if( $nt->getPrefixedDbkey() == '' ) {
$u = '';
if ( '' == $text ) {
);
$u .= '#' . str_replace(array_keys($replacearray),array_values($replacearray),$anchor);
}
- if ( '' == $text ) {
+ if ( $text == '' ) {
$text = htmlspecialchars( $nt->getPrefixedText() );
}
- $style = $this->getInternalLinkAttributesObj( $nt, $text );
+ if ( $style == '' ) {
+ $style = $this->getInternalLinkAttributesObj( $nt, $text );
+ }
if ( $aprops !== '' ) $aprops = ' ' . $aprops;
}
- /** @todo document */
- function editSectionLink( $nt, $section ) {
+ /**
+ * @param Title $title
+ * @param integer $section
+ * @param string $hint Link title, or default if omitted or empty
+ */
+ function editSectionLink( $nt, $section, $hint='' ) {
global $wgContLang;
$editurl = '§ion='.$section;
- $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl );
+ $hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ) . '"';
+ $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint );
if( $wgContLang->isRTL() ) {
$farside = 'left';
# strip out HTML
$canonized_headline = preg_replace( '/<.*?' . '>/','',$canonized_headline );
$tocline = trim( $canonized_headline );
+ # Save headline for section edit hint before it's escaped
+ $headline_hint = trim( $canonized_headline );
$canonized_headline = Sanitizer::escapeId( $tocline );
$refers[$headlineCount] = $canonized_headline;
if( $istemplate )
$head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection);
else
- $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1);
+ $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1, $headline_hint);
}
# give headline the correct <h#> tag