r12931 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12930‎ | r12931 | r12932 >
Date:03:00, 2 February 2006
Author:vibber
Status:old
Tags:
Comment:
strip markup in headers, limit max url length
Modified paths:
  • /trunk/extensions/ActiveAbstract/AbstractFilter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ActiveAbstract/AbstractFilter.php
@@ -184,7 +184,9 @@
185185
186186 $headers = array();
187187 for( $i = 1; $i < count( $secs ); $i += 2 ) {
188 - $header = UtfNormal::cleanUp( preg_replace( '/^=+\s*(.*?)\s*=+/', '$1', $secs[$i] ) );
 188+ $inside = preg_replace( '/^=+\s*(.*?)\s*=+/', '$1', $secs[$i] );
 189+ $stripped = $this->_stripMarkup( $inside ); // strip internal markup and <h[1-6]>
 190+ $header = UtfNormal::cleanUp( $stripped );
189191 $anchor = EditPage::sectionAnchor( $header );
190192 $url = $this->title->getFullUrl() . $anchor;
191193 $headers[$header] = $url;
@@ -230,9 +232,10 @@
231233 * @access private
232234 */
233235 function _formatLink( $url, $anchor, $type ) {
 236+ $maxUrlLength = 1024; // as defined in Yahoo's .xsd
234237 return wfOpenElement( 'sublink', array( 'linktype' => $type ) ) .
235238 wfElement( 'anchor', null, $anchor ) .
236 - wfElement( 'link', null, $url ) .
 239+ wfElement( 'link', null, substr( $url, 0, $maxUrlLength ) ) .
237240 wfCloseElement( 'sublink' ) . "\n";
238241 }
239242

Status & tagging log