fix POST properties 'disable_markups' check(s)

see guestbook sidebar plugin and plugin_nugget_multilinugual
This commit is contained in:
Ian 2015-12-01 11:35:48 +01:00
parent 751840ba10
commit fe6fc9eb74

View File

@ -14,7 +14,7 @@ class serendipity_event_nl2br extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_NL2BR_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
$propbag->add('version', '2.19');
$propbag->add('version', '2.20');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@ -209,7 +209,7 @@ class serendipity_event_nl2br extends serendipity_event
// check single entry for temporary disabled markups
if ( !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
!in_array($this->instance, (array)$serendipity['POST']['properties']['disable_markups']) &&
(isset($serendipity['POST']['properties']['disable_markups']) && !in_array($this->instance, $serendipity['POST']['properties']['disable_markups'])) &&
!$eventData['properties']['ep_no_textile'] && !isset($serendipity['POST']['properties']['ep_no_textile']) &&
!$eventData['properties']['ep_no_markdown'] && !isset($serendipity['POST']['properties']['ep_no_markdown'])) {
// yes, this markup shall be applied
@ -219,6 +219,9 @@ class serendipity_event_nl2br extends serendipity_event
$serendipity['nl2br']['entry_disabled_markup'] = true;
}
/* PLEASE NOTE:
$serendipity['POST']['properties']['disable_markups'] = array(false); is the only workable solution for (sidebar?) plugins (see sidebar plugins: guestbook, multilingual), to explicitly allow to apply nl2br to markup (if we want to)
*/
// don't run, if the textile, or markdown plugin already took care about markup
if ($markup && $serendipity['nl2br']['entry_disabled_markup'] === false && (class_exists('serendipity_event_textile') || class_exists('serendipity_event_markdown'))) {
return true;
@ -244,7 +247,7 @@ class serendipity_event_nl2br extends serendipity_event
foreach ($this->markup_elements as $temp) {
if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
!$eventData['properties']['ep_disable_markup_' . $this->instance] &&
!in_array($this->instance, (array)$serendipity['POST']['properties']['disable_markups']) &&
(isset($serendipity['POST']['properties']['disable_markups']) && !in_array($this->instance, $serendipity['POST']['properties']['disable_markups'])) &&
!$eventData['properties']['ep_no_nl2br'] &&
!isset($serendipity['POST']['properties']['ep_no_nl2br'])) {
@ -532,7 +535,7 @@ p.break {
}
/**
* Find next newline seperated by text from current position
* Find next newline separated by text from current position
* @param int start
* $param array text
*/