From a6ac1daff341d57eca52921bce333858d7c49fc9 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 12 Nov 2012 11:58:30 +0100 Subject: [PATCH] fixed last commits array to string --- .../serendipity_event_entryproperties.php | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php index e6b0926e..3882cffe 100644 --- a/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php +++ b/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php @@ -15,7 +15,7 @@ class serendipity_event_entryproperties extends serendipity_event $propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking'); - $propbag->add('version', '1.31'); + $propbag->add('version', '1.32'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -64,7 +64,7 @@ class serendipity_event_entryproperties extends serendipity_event case 'customfields': $propbag->add('type', 'text'); $propbag->add('name', PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS); - $propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC2); + $propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC2 . "\n" . PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS_DESC4); $propbag->add('default', 'CustomField1, CustomField2, CustomField3'); break; @@ -165,12 +165,19 @@ class serendipity_event_entryproperties extends serendipity_event if ($supported_properties === null) { $supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'cache_body', 'cache_extended', 'no_frontpage', 'hiderss', 'entrypassword'); - $fields = explode(',', trim($this->get_config('customfields'))); + // Capture special characters for "," and ":" + $special_from = array('\\,', '\\:'); + $special_to = array(chr(0x01), chr(0x02)); + $string = str_replace($special_from, $special_to, trim($this->get_config('customfields'))); + + $fields = explode(',', $string); if (is_array($fields) && count($fields) > 0) { foreach($fields AS $field) { $field = trim($field); if (!empty($field)) { - $supported_properties[] = $field; + $field = str_replace($special_to, $special_from, $field); + $fieldnames = explode(':', $field); + $supported_properties[] = $fieldnames[0]; } } } @@ -413,6 +420,12 @@ class serendipity_event_entryproperties extends serendipity_event
get_config('customfields')); + // Capture special characters for "," and ":" + $special_from = array('\\,', '\\:'); + $special_to = array(chr(0x01), chr(0x02)); + $special_read = array(',', ':'); + $fields = str_replace($special_from, $special_to, $fields); + if (!empty($fields)) { $fields = explode(',', $fields); } @@ -424,6 +437,8 @@ class serendipity_event_entryproperties extends serendipity_event - - +
+ +