- Patch #9497 by gordon: made <!--break--> work even when the teaser length

is set to unlimited and fixed up some code comments.
4.5.x
Dries Buytaert 2004-08-04 21:19:12 +00:00
parent b87b2abe65
commit 07ae0fad65
2 changed files with 10 additions and 8 deletions

View File

@ -160,14 +160,15 @@ function node_teaser($body) {
$size = variable_get('teaser_length', 600);
// If the size is zero, teasers are disabled so we return the entire body.
if ($size == 0) {
// find where the delimiter is in the body
$delimiter = strpos($body, '<!--break-->');
// If the size is zero, and there is no delimiter, we return the entire body.
if ($size == 0 && $delimiter == 0) {
return $body;
}
// If a valid delimiter has been specified, use it to chop of the teaser.
// The delimiter can be outside the allowed range by no more than a factor of two.
$delimiter = strpos($body, '<!--break-->');
if ($delimiter > 0) {
return substr($body, 0, $delimiter);
}

View File

@ -160,14 +160,15 @@ function node_teaser($body) {
$size = variable_get('teaser_length', 600);
// If the size is zero, teasers are disabled so we return the entire body.
if ($size == 0) {
// find where the delimiter is in the body
$delimiter = strpos($body, '<!--break-->');
// If the size is zero, and there is no delimiter, we return the entire body.
if ($size == 0 && $delimiter == 0) {
return $body;
}
// If a valid delimiter has been specified, use it to chop of the teaser.
// The delimiter can be outside the allowed range by no more than a factor of two.
$delimiter = strpos($body, '<!--break-->');
if ($delimiter > 0) {
return substr($body, 0, $delimiter);
}