From 37347986cea434d33428e799eb2e5f9f3a87657a Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 29 Jul 2008 00:35:43 +0000 Subject: [PATCH] Partially revert r38162. Caused bugs due to incredibly incomprehensible parameter list for makeKnownLinkObj. (Hint: $aprops and $style do virtually the same thing, except that the latter has a completely misleading name and documentation.) There is no salvation possible for this method. It must die. --- includes/Linker.php | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/includes/Linker.php b/includes/Linker.php index eaa56f3f95..e5efba0417 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -302,10 +302,7 @@ class Linker { * @param $query String: link target * @param $trail String: text after link * @param $prefix String: text before link text - * @param $aprops Mixed: extra attributes to the a-element. If a string, - * inserted literally into the HTML, with a space prepended. It can also - * be an associative array. In this case the keys are attributes, and - * values are *unescaped* attribute values. + * @param $aprops String: extra attributes to the a-element * @param $style String: style to apply - if empty, use getInternalLinkAttributesObj instead * @return the a-element */ @@ -331,16 +328,7 @@ class Linker { $style = $this->getInternalLinkAttributesObj( $nt, $text ); } - if( is_string( $aprops ) && $aprops != '' ) { - $aprops = " $aprops"; - } elseif( is_array( $aprops ) ) { - $attributes = $aprops; - $aprops = ''; - foreach( $attributes as $key => $value ) { - $value = htmlspecialchars( $value ); - $aprops .= " $key=\"$value\""; - } - } + if ( $aprops !== '' ) $aprops = " $aprops"; list( $inside, $trail ) = Linker::splitTrail( $trail ); $r = "{$prefix}{$text}{$inside}{$trail}"; @@ -1298,22 +1286,23 @@ class Linker { * @return string HTML to use for edit link */ public function doEditSectionLink( Title $nt, $section, $tooltip='' ) { + $attribs = ''; + if( $tooltip ) { + $attribs = wfMsgHtml( 'editsectionhint', htmlspecialchar +s( $tooltip ) ); + $attribs = " title=\"$attribs\""; + } + $url = $this->makeKnownLinkObj( $nt, htmlspecialchars(wfMsg('editsection')), "action=edit§ion=$section", - '', '', '', - array( 'title' => wfMsg( 'editsectionhint', $tooltip ) ) + '', '', '', $attribs ); - # Run the old hook. This takes up most of the function . . . hopefully + # Run the old hook. This takes up half of the function . . . hopefully # we can rid of it someday. $result = null; - $attribs = ''; - if( $tooltip ) { - $attribs = wfMsgHtml( 'editsectionhint', htmlspecialchars( $tooltip ) ); - $attribs = " title=\"$attribs\""; - } wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $attribs, $url, &$result ) ); if( !is_null( $result ) ) { # For reverse compatibility, add the brackets *after* the hook is -- 2.20.1