http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84663
Revision: 84663
Author: bawolff
Date: 2011-03-24 03:43:27 +0000 (Thu, 24 Mar 2011)
Log Message:
-----------
(follow-up 79778; continuation r84660) Change truncate to count the ellipsis in
length. Update extensions that seem to be
expecting the other behaviour. Didn't update extensions that seem to be
expecting the behaviour i changed it to.
Modified Paths:
--------------
trunk/extensions/ImageTagging/ImageTagging.php
trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php
trunk/extensions/ReplaceText/SpecialReplaceText.php
Modified: trunk/extensions/ImageTagging/ImageTagging.php
===================================================================
--- trunk/extensions/ImageTagging/ImageTagging.php 2011-03-24 03:39:21 UTC
(rev 84662)
+++ trunk/extensions/ImageTagging/ImageTagging.php 2011-03-24 03:43:27 UTC
(rev 84663)
@@ -319,12 +319,12 @@
continue;
}
$contextlines--;
- $pre = $wgContLang->truncate( $m[1], -$contextchars );
+ $pre = $wgContLang->truncate( $m[1], -$contextchars, '...',
false );
if ( count( $m ) < 3 ) {
$post = '';
} else {
- $post = $wgContLang->truncate( $m[3], $contextchars );
+ $post = $wgContLang->truncate( $m[3], $contextchars,
'...', false );
}
$found = $m[2];
@@ -434,4 +434,4 @@
wfProfileOut( __METHOD__ );
return true;
-}
\ No newline at end of file
+}
Modified:
trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php
===================================================================
--- trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php
2011-03-24 03:39:21 UTC (rev 84662)
+++ trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php
2011-03-24 03:43:27 UTC (rev 84663)
@@ -675,12 +675,12 @@
continue;
}
-- $contextlines;
- $pre = $wgContLang->truncate( $m[1], - $contextchars );
+ $pre = $wgContLang->truncate( $m[1], - $contextchars,
'...', false );
if ( count( $m ) < 3 ) {
$post = '';
} else {
- $post = $wgContLang->truncate( $m[3],
$contextchars );
+ $post = $wgContLang->truncate( $m[3],
$contextchars, '...', false );
}
$found = $m[2];
@@ -694,7 +694,7 @@
}
// if we found no matches just return the first line:
if ( $extract == '' )
- return ' ' . $wgContLang->truncate( $text, (
$contextchars * 2 ) ) . '';
+ return ' ' . $wgContLang->truncate( $text, (
$contextchars * 2 ), '...', false ) . '';
// wfProfileOut( "$fname-extract" );
// wfProfileOut( $fname );
// return "<li>{$link} ({$size}){$extract}</li>\n";
@@ -1160,4 +1160,4 @@
$start_day
), 'ed' => date( 'm/d/Y', $end_day ), 'sdays' => $sDays ),
$obj_name );
}
-}
\ No newline at end of file
+}
Modified: trunk/extensions/ReplaceText/SpecialReplaceText.php
===================================================================
--- trunk/extensions/ReplaceText/SpecialReplaceText.php 2011-03-24 03:39:21 UTC
(rev 84662)
+++ trunk/extensions/ReplaceText/SpecialReplaceText.php 2011-03-24 03:43:27 UTC
(rev 84663)
@@ -485,7 +485,9 @@
$context = '';
foreach ( $cuts as $_ ) {
list( $index, $len, ) = $_;
- $context .= self::convertWhiteSpaceToHTML(
$wgLang->truncate( substr( $text, 0, $index ), - $cw ) );
+ $context .= self::convertWhiteSpaceToHTML(
+ $wgLang->truncate( substr( $text, 0, $index ),
- $cw, '...', false )
+ );
$snippet = self::convertWhiteSpaceToHTML( substr(
$text, $index, $len ) );
if ( $use_regex ) {
$targetStr = "/$target/U";
@@ -495,7 +497,9 @@
}
$context .= preg_replace( $targetStr, '<span
class="searchmatch">\0</span>', $snippet );
- $context .= self::convertWhiteSpaceToHTML(
$wgLang->truncate( substr( $text, $index + $len ), $cw ) );
+ $context .= self::convertWhiteSpaceToHTML(
+ $wgLang->truncate( substr( $text, $index + $len
), $cw, '...', false )
+ );
}
return $context;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs