Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_entryproperties
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3721/plugins/serendipity_event_entryproperties
Modified Files:
serendipity_event_entryproperties.php
Log Message:
- Added property to disable the nl2br-Plugin for specific entries.
- Fixed properties not being evaluated in preview
Index: serendipity_event_entryproperties.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- serendipity_event_entryproperties.php 4 Jan 2005 15:24:40 -0000 1.9
+++ serendipity_event_entryproperties.php 5 Jan 2005 12:42:38 -0000 1.10
@@ -19,6 +19,7 @@
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_DONE', 'Alle Artikel gecached.');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_ABORTED', 'Caching der Artikel ABGEBROCHEN.');
@define('PLUGIN_EVENT_ENTRYPROPERTIES_CACHE_TOTAL', ' (insgesamt %d Artikel vorhanden)...');
+ @define('PLUGIN_EVENT_ENTRYPROPERTIES_NL2BR', 'Automatischen Zeilenumbruch deaktivieren');
break;
case 'en':
@@ -41,6 +42,7 @@
@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');
break;
}
@@ -57,13 +59,14 @@
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '1.0');
+ $propbag->add('version', '1.1');
$propbag->add('event_hooks', array(
'frontend_fetchentries' => true,
'frontend_fetchentry' => true,
'backend_publish' => true,
'backend_save' => true,
'backend_display' => true,
+ 'entry_display' => true,
'frontend_entryproperties' => true,
'backend_sidebar_entries_event_display_buildcache' => true,
'backend_sidebar_entries' => true,
@@ -109,7 +112,7 @@
}
function getSupportedProperties() {
- static $supported_properties = array('is_sticky', 'access', 'cache_body', 'cache_extended');
+ static $supported_properties = array('is_sticky', 'access', 'cache_body', 'cache_extended', 'no_nl2br');
return $supported_properties;
}
@@ -147,6 +150,11 @@
|| (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"'
+ : '';
+
$access_values = array(
PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_PRIVATE => 'private',
PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS_MEMBER => 'member',
@@ -164,14 +172,19 @@
<fieldset style="margin: 5px">
<legend><?php echo PLUGIN_EVENT_ENTRYPROPERTIES_TITLE; ?></legend>
<input type="checkbox" name="serendipity[properties][is_sticky]" id="properties_is_sticky" value="true" <?php echo $is_sticky; ?> />
- <label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_STICKYPOSTS; ?>" for="serendipity[properties][is_sticky]"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_STICKYPOSTS; ?> </label><br />
+ <label title="<?php echo PLUGIN_EVENT_ENTRYPROPERTIES_STICKYPOSTS; ?>" for="properties_is_sticky"> <?php echo PLUGIN_EVENT_ENTRYPROPERTIES_STICKYPOSTS; ?> </label><br />
+<? 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 echo PLUGIN_EVENT_ENTRYPROPERTIES_ACCESS; ?>:
<?php
foreach($access_values AS $radio_title => $radio_value) {
?>
<input type="radio" name="serendipity[properties][access]" id="properties_access_<?php echo $radio_value; ?>" value="<?php echo $radio_value; ?>" <?php echo $radio_value == $access ? 'checked="checked"' : ''; ?> />
- <label title="<?php echo $radio_title; ?>" for="id_properties_access_<?php echo $radio_value; ?>"> <?php echo $radio_title; ?> </label>
+ <label title="<?php echo $radio_title; ?>" for="properties_access_<?php echo $radio_value; ?>"> <?php echo $radio_title; ?> </label>
<?php
}
?>
@@ -299,6 +312,20 @@
}
return true;
break;
+ case 'entry_display':
+ // PH: This is done after Garvins suggestion to patchup $eventData in case an entry
+ // is in the process of being created. This must be done for the extended properties
+ // to be applied in the preview.
+ if (is_array($serendipity['POST']['properties']) && count($serendipity['POST']['properties']) > 0){
+ $parr = array();
+ $supported_properties = serendipity_event_entryproperties::getSupportedProperties();
+ foreach($supported_properties AS $prop_key) {
+ if (isset($serendipity['POST']['properties'][$prop_key]))
+ $parr['ep_' . $prop_key] = $serendipity['POST']['properties'][$prop_key];
+ }
+ $eventData[0]['properties'] = $parr;
+ }
+ break;
case 'frontend_fetchentries':
case 'frontend_fetchentry':
|