Added global plaintext_body property

This commit is contained in:
Matthias Gutjahr 2012-11-07 19:46:24 +01:00
parent 039a2e017d
commit 0dc53e06b6
2 changed files with 21 additions and 1 deletions

View file

@ -125,6 +125,7 @@ class serendipity_event_markdown extends serendipity_event
$eventData[$element] = str_replace('javascript:', '', Markdown($eventData[$element]));
}
}
$this->setPlaintextBody($eventData);
return true;
break;
@ -143,6 +144,21 @@ class serendipity_event_markdown extends serendipity_event
}
}
/**
* Sets a GLOBAL plaintext body by first transforming the body to HTML, then stripping HTML tags from the body
* @see http://board.s9y.org/viewtopic.php?f=11&t=18351 Discussion of this feature in the S9y forum.
*
* @param array $eventData
*/
function setPlaintextBody(array $eventData)
{
if (isset($GLOBALS['entry'][0]['plaintext_body'])) {
$GLOBALS['entry'][0]['plaintext_body'] = strip_tags(str_replace('javascript:', '', Markdown($GLOBALS['entry'][0]['plaintext_body'])));
} else {
$GLOBALS['entry'][0]['plaintext_body'] = strip_tags(str_replace('javascript:', '', Markdown($eventData['body'])));
}
}
/* disabled, probably used in later versions
function _markdown_markup($text) {
return Markdown($text);

View file

@ -171,7 +171,11 @@ class serendipity_event_metadesc extends serendipity_event {
$meta_description = $GLOBALS['entry'][0]['properties']['meta_description'];
if (empty($meta_description)) {
$meta_description = $this->extract_description($GLOBALS['entry'][0]['body']);
$description_body = $GLOBALS['entry'][0]['body'];
if (isset($GLOBALS['entry'][0]['plaintext_body'])) {
$description_body = trim($GLOBALS['entry'][0]['plaintext_body']);
}
$meta_description = $this->extract_description($description_body);
}
$meta_keywords = $GLOBALS['entry'][0]['properties']['meta_keywords'];