Version 1.1-alpha1()
------------------------------------------------------------------------
+ * Allow entryproperties plugin to define which markup plugins are
+ applied per-entry (garvinhicking)
+
* Added links to view an entry in reasonable places (comments / entry
overview) (garvinhicking)
$propbag->add('description', PLUGIN_EVENT_BBCODE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Jez Hancock, Garvin Hicking');
- $propbag->add('version', '2.01');
+ $propbag->add('version', '2.02');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
case 'frontend_display':
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = $this->bbcode($eventData[$element]);
}
$propbag->add('description', PLUGIN_EVENT_CONTENTREWRITE_DESCRIPTION);
$propbag->add('stackable', true);
$propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '1.1');
+ $propbag->add('version', '1.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
// \1 and \3 are the prepend/append strings (usually whitespaces) and $new containing the new value
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = preg_replace($regex, '\1' . $new . '\3', $eventData[$element]);
}
$propbag->add('description', PLUGIN_EVENT_EMOTICATE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.2');
+ $propbag->add('version', '1.3');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
case 'frontend_display':
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = &$eventData[$temp['element']];
foreach ($this->getEmoticons() as $key => $value) {
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_DONE', 'Entry caching completed.');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_ABORTED', 'Entry caching ABORTED.');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_TOTAL', ' (totalling %d entries)...');
-@define('PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR', 'Disable nl2br');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_NO_FRONTPAGE', 'Hide from article overview / frontpage');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_GROUPS', 'Use group-based restrictions');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_GROUPS_DESC', 'If enabled, you can define which users of a usergroup may be able to read entries. This option has a large impact on the performance of your article overview. Only enable this if you are really going to use this feature.');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC2', 'Here you can enter a list of commaseparated field names that you can use to enter for every entry - do not use special characters or spaces for those fieldnames. Example: "Customfield1, Customfield2". ' . PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC1);
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC3', 'The list of available custom fields can be changed in the <a href="%s" target="_blank" title="' . PLUGIN_EVENT_ENTRYPROPERTIES_TITLE . '">plugin configuration</a>.');
+@define('PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP', 'Disable Markup plugins for this entry:');
?>
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '1.8');
+ $propbag->add('version', '1.9');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
'backend_cache_purge' => true,
'backend_plugins_new_instance' => true,
'frontend_entryproperties_query' => true,
- 'frontend_entries_rss' => true
+ 'frontend_entries_rss' => true,
+ 'backend_entry_presave' => true
));
$propbag->add('groups', array('BACKEND_EDITOR'));
$propbag->add('configuration', array('cache', 'use_groups', 'use_users', 'default_read', 'customfields'));
static $supported_properties = null;
if ($supported_properties === null) {
- $supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'cache_body', 'cache_extended', 'no_nl2br', 'no_frontpage', 'hiderss');
+ $supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'cache_body', 'cache_extended', 'no_frontpage', 'hiderss');
$fields = explode(',', trim($this->get_config('customfields')));
if (is_array($fields) && count($fields) > 0) {
return $and;
}
+ /*
+ * This function converts specific property fields so that they are
+ * available natively to other plugins/templates.
+ */
+ function applyProperties(&$properties) {
+ global $serendipity;
+
+ if (is_array($properties['disable_markups'])) {
+ foreach($properties['disable_markups'] AS $idx => $instance) {
+ $properties['disable_markup_' . $instance] = $instance;
+ }
+ }
+ }
+
function addProperties(&$properties, &$eventData) {
global $serendipity;
// Get existing data
$property = serendipity_fetchEntryProperties($eventData['id']);
$supported_properties = serendipity_event_entryproperties::getSupportedProperties();
+ // Special case for disable markups.
+ if (is_array($properties['disable_markups'])) {
+ $q = "DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE entryid = " . (int)$eventData['id'] . " AND property LIKE 'ep_disable_markup_%'";
+ serendipity_db_query($q);
+
+ foreach($properties['disable_markups'] AS $idx => $instance) {
+ $supported_properties[] = 'disable_markup_' . $instance;
+ }
+ }
+
foreach($supported_properties AS $prop_key) {
$prop_val = (isset($properties[$prop_key]) ? $properties[$prop_key] : null);
$prop_key = 'ep_' . $prop_key;
|| (isset($serendipity['POST']['properties']['is_sticky']) && serendipity_db_bool($serendipity['POST']['properties']['is_sticky']))
? 'checked="checked"'
: '';
- $nl2br = (isset($eventData['properties']['ep_no_nl2br']) && serendipity_db_bool($eventData['properties']['ep_no_nl2br']))
- || (isset($serendipity['POST']['properties']['no_nl2br']) && serendipity_db_bool($serendipity['POST']['properties']['no_nl2br']))
- ? 'checked="checked"'
- : '';
$no_frontpage = (isset($eventData['properties']['ep_no_frontpage']) && serendipity_db_bool($eventData['properties']['ep_no_frontpage']))
|| (isset($serendipity['POST']['properties']['no_frontpage']) && serendipity_db_bool($serendipity['POST']['properties']['no_frontpage']))
<label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_STICKYPOSTS; ?>" for="properties_is_sticky"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_STICKYPOSTS; ?> </label><br />
<input type="checkbox" name="serendipity[properties][no_frontpage]" id="properties_no_frontpage" value="true" <?php echo $no_frontpage; ?> />
<label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_NO_FRONTPAGE; ?>" for="properties_no_frontpage"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_NO_FRONTPAGE; ?> </label><br />
-<?php if (class_exists('serendipity_event_nl2br')){ ?>
- <input type="checkbox" name="serendipity[properties][no_nl2br]" id="properties_no_nl2br" value="true" <?php echo $nl2br; ?> />
- <label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR; ?>" for="properties_no_nl2br"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR; ?> </label><br />
-
-<?php } ?>
<input type="checkbox" name="serendipity[properties][hiderss]" id="properties_hiderss" value="true" <?php echo $hiderss; ?> />
<label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_HIDERSS_DESC; ?>" for="properties_hiderss"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_HIDERSS; ?> </label><br />
</select>
</div>
+ <br />
+ <div class="entryproperties_markup">
+ <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_DISABLE_MARKUP; ?><br />
+ <div style="margin-left: 10px">
+ <select name="serendipity[properties][disable_markups][]" multiple="multiple" size="4">
+ <?php
+ $plugins = serendipity_plugin_api::get_event_plugins();
+
+ if (is_array($plugins)) {
+ // foreach() operates on copies of values, but we want to operate on references, so we use while()
+ @reset($plugins);
+ while(list($plugin, $plugin_data) = each($plugins)) {
+ if (!is_array($plugin_data['p']->markup_elements)) {
+ continue;
+ }
+
+ if (isset($serendipity['POST']['properties']['disable_markups']) && in_array($plugin_data['p']->instance, $serendipity['POST']['properties']['disable_markups'])) {
+ $selected = true;
+ } elseif (isset($eventData['properties']['ep_disable_markup_' . $plugin_data['p']->instance])) {
+ $selected = true;
+ } else {
+ $selected = false;
+ }
+
+ echo '<option ' . ($selected ? 'selected="selected"' : '') . ' value="' . $plugin_data['p']->instance . '">' . htmlspecialchars($plugin_data['p']->title) . '</option>' . "\n";
+ }
+ }
+ ?>
+ </select>
+ </div>
+ </div>
+
<?php
$fields = trim($this->get_config('customfields'));
if (!empty($fields)) {
}
return true;
break;
+
case 'backend_import_entry':
//TODO: (ph) Maybe handle caching?
if (is_array($addData) && !$addData['nl2br']){
$this->addProperties($props, $eventData);
}
break;
+
case 'backend_sidebar_entries_event_display_buildcache':
if ($is_cache) {
$per_fetch = 25;
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}entryproperties WHERE property LIKE 'ep_cache_%'");
break;
+ case 'backend_entry_presave':
+ if (is_array($serendipity['POST']['properties'])) {
+ $this->applyProperties($serendipity['POST']['properties']);
+ }
+ break;
+
case 'backend_publish':
case 'backend_save':
if (!isset($serendipity['POST']['properties']) || !is_array($serendipity['POST']['properties']) || !isset($eventData['id'])) {
$propbag->add('description', PLUGIN_EVENT_NL2BR_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.3');
+ $propbag->add('version', '1.4');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
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] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance]) &&
!$eventData['properties']['ep_no_nl2br'] &&
- !isset($serendipity['POST']['properties']['no_nl2br'])) {
+ !isset($serendipity['POST']['properties']['ep_no_nl2br'])) {
+
$element = $temp['element'];
$eventData[$element] = nl2br($eventData[$element]);
}
$propbag->add('description', PLUGIN_EVENT_S9YMARKUP_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.1');
+ $propbag->add('version', '1.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
case 'frontend_display':
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = $this->_s9y_markup($eventData[$element]);
}
$propbag->add('description', PLUGIN_EVENT_SEARCHHIGHLIGHT_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Tom Sommer');
- $propbag->add('version', '1.1');
+ $propbag->add('version', '1.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
continue;
}
+ if ($eventData['properties']['ep_disable_markup_' . $this->instance] ||
+ isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
+ continue;
+ }
+
$element = &$eventData[$temp['element']];
foreach ( $queries as $word ) {
$propbag->add('description', PLUGIN_EVENT_TEXTILE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.1');
+ $propbag->add('version', '1.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
foreach ($this->markup_elements as $temp) {
if (serendipity_db_bool($this->get_config($temp['name'], true))) {
+ if ($eventData['properties']['ep_disable_markup_' . $this->instance] ||
+ isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
+ continue;
+ }
$element = $temp['element'];
/* find all the tags and store them in $blocks */
$propbag->add('description', PLUGIN_EVENT_TEXTWIKI_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Tobias Schlitt');
- $propbag->add('version', '1.2');
+ $propbag->add('version', '1.3');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
switch($event) {
case 'frontend_display':
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = $this->wiki->transform($eventData[$element]);
}
$propbag->add('description', PLUGIN_EVENT_TRACKBACK_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
- $propbag->add('version', '1.5');
+ $propbag->add('version', '1.6');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
}
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$eventData[$element] = preg_replace_callback(
$propbag->add('description', PLUGIN_EVENT_XHTMLCLEANUP_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '1.4');
+ $propbag->add('version', '1.5');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
case 'frontend_display':
$this->cleanup_parse = serendipity_db_bool($this->get_config('xhtml_parse'));
foreach ($this->markup_elements as $temp) {
- if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']])) {
+ if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
+ !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
+ !isset($serendipity['POST']['properties']['disable_markup_' . $this->instance])) {
$element = $temp['element'];
$this->cleanup_tag = 'IMG';
$this->cleanup_checkfor = 'ALT';