[geeklog-cvs] geeklog: Updated feeds to use COM_truncateHTML when truncating t...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Mar 20 12:39:24 EDT 2010
changeset 7814:adfac39c2a97
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/adfac39c2a97
user: Tom <websitemaster at cogeco.net>
date: Sat Mar 20 12:37:59 2010 -0400
description:
Updated feeds to use COM_truncateHTML when truncating text.
Updated SYND_truncateSummary to use COM_truncateHTML
diffstat:
system/lib-syndication.php | 31 ++++++++-----------------------
1 files changed, 8 insertions(+), 23 deletions(-)
diffs (65 lines):
diff -r 859fad6a5f34 -r adfac39c2a97 system/lib-syndication.php
--- a/system/lib-syndication.php Sat Mar 20 12:36:31 2010 -0400
+++ b/system/lib-syndication.php Sat Mar 20 12:37:59 2010 -0400
@@ -268,7 +268,7 @@
$storytitle = stripslashes( $row['title'] );
$fulltext = stripslashes( $row['introtext']."\n".$row['bodytext'] );
$fulltext = PLG_replaceTags( $fulltext );
- $storytext = SYND_truncateSummary( $fulltext, $contentLength );
+ $storytext = COM_truncateHTML ( $fulltext, $contentLength, ' ...' );
$fulltext = trim( $fulltext );
$fulltext = str_replace(array("\015\012", "\015"), "\012", $fulltext);
@@ -402,7 +402,7 @@
$fulltext = stripslashes( $row['introtext']."\n".$row['bodytext'] );
$fulltext = PLG_replaceTags( $fulltext );
- $storytext = SYND_truncateSummary( $fulltext, $contentLength );
+ $storytext = COM_truncateHTML ( $fulltext, $contentLength, ' ...' );
$fulltext = trim( $fulltext );
$fulltext = str_replace(array("\015\012", "\015"), "\012", $fulltext);
@@ -505,8 +505,9 @@
if ($A['content_length'] != 1) {
$count = count($content);
for ($i = 0; $i < $count; $i++ ) {
- $content[$i]['summary'] = SYND_truncateSummary(
- $content[$i]['text'], $A['content_length']);
+ $content[$i]['summary'] = COM_truncateHTML(
+ $content[$i]['text'], $A['content_length'], ' ...');
+
}
}
}
@@ -621,28 +622,12 @@
* @param int $length max. length
* @return string truncated text
*
+* Note: Use COM_truncateHTML from now on.
+*
*/
function SYND_truncateSummary($text, $length)
{
- if ($length == 0) {
- return '';
- } else {
- $text = stripslashes($text);
- $text = trim($text);
- $text = str_replace(array("\015\012", "\015"), "\012", $text);
- if (($length > 3) && (MBYTE_strlen($text) > $length)) {
- $text = MBYTE_substr($text, 0, $length - 3) . '...';
- }
-
- // Check if we broke an html tag and storytext is now something
- // like "blah blah <a href= ...". Delete "<*" if so.
- if (MBYTE_strrpos($text, '<' ) > MBYTE_strrpos($text, '>')) {
- $text = MBYTE_substr($text, 0, MBYTE_strrpos($text, '<'))
- . ' ...';
- }
-
- return $text;
- }
+ return COM_truncateHTML ($text, $length, ' ...');
}
More information about the geeklog-cvs
mailing list