fixed last commits array to string
This commit is contained in:
@ -15,7 +15,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
|
$propbag->add('description', PLUGIN_EVENT_ENTRYPROPERTIES_DESC);
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('author', 'Garvin Hicking');
|
$propbag->add('author', 'Garvin Hicking');
|
||||||
$propbag->add('version', '1.31');
|
$propbag->add('version', '1.32');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'smarty' => '2.6.7',
|
'smarty' => '2.6.7',
|
||||||
@ -64,7 +64,7 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
case 'customfields':
|
case 'customfields':
|
||||||
$propbag->add('type', 'text');
|
$propbag->add('type', 'text');
|
||||||
$propbag->add('name', PLUGIN_EVENT_ENTRYPROPERTIES_CUSTOMFIELDS);
|
$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');
|
$propbag->add('default', 'CustomField1, CustomField2, CustomField3');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -165,12 +165,19 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
if ($supported_properties === null) {
|
if ($supported_properties === null) {
|
||||||
$supported_properties = array('is_sticky', 'access', 'access_groups', 'access_users', 'cache_body', 'cache_extended', 'no_frontpage', 'hiderss', 'entrypassword');
|
$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) {
|
if (is_array($fields) && count($fields) > 0) {
|
||||||
foreach($fields AS $field) {
|
foreach($fields AS $field) {
|
||||||
$field = trim($field);
|
$field = trim($field);
|
||||||
if (!empty($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
|
|||||||
<br /><div class="entryproperties_customfields">
|
<br /><div class="entryproperties_customfields">
|
||||||
<?php
|
<?php
|
||||||
$fields = trim($this->get_config('customfields'));
|
$fields = trim($this->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)) {
|
if (!empty($fields)) {
|
||||||
$fields = explode(',', $fields);
|
$fields = explode(',', $fields);
|
||||||
}
|
}
|
||||||
@ -424,6 +437,8 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
<table id="serendipity_customfields">
|
<table id="serendipity_customfields">
|
||||||
<?php
|
<?php
|
||||||
foreach($fields AS $fieldname) {
|
foreach($fields AS $fieldname) {
|
||||||
|
$fieldparts = explode(':', $fieldname);
|
||||||
|
$fieldname = $fieldparts[0];
|
||||||
$fieldname = htmlspecialchars(trim($fieldname));
|
$fieldname = htmlspecialchars(trim($fieldname));
|
||||||
|
|
||||||
if (isset($serendipity['POST']['properties'][$fieldname])) {
|
if (isset($serendipity['POST']['properties'][$fieldname])) {
|
||||||
@ -431,19 +446,20 @@ class serendipity_event_entryproperties extends serendipity_event
|
|||||||
} elseif (!empty($eventData['properties']['ep_' . $fieldname])) {
|
} elseif (!empty($eventData['properties']['ep_' . $fieldname])) {
|
||||||
$value = $eventData['properties']['ep_' . $fieldname];
|
$value = $eventData['properties']['ep_' . $fieldname];
|
||||||
} else {
|
} else {
|
||||||
$value = '';
|
$value = trim(str_replace($special_to, $special_read, $fieldparts[1]));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="customfield_<?php echo $fieldname; ?> customfield_name"><strong><?php echo $fieldname; ?></strong></td>
|
<td class="customfield_<?php echo $fieldname; ?> customfield_name"><strong><?php echo $fieldname; ?></strong></td>
|
||||||
<td class="customfield_<?php echo $fieldname; ?> customfield_value"><textarea id="prop<?php echo htmlspecialchars($fieldname); ?>" name="serendipity[properties][<?php echo htmlspecialchars($fieldname); ?>]"><?php echo htmlspecialchars($value); ?></textarea></td>
|
<td class="customfield_<?php echo $fieldname; ?> customfield_value"><textarea id="prop<?php echo $fieldname; ?>" name="serendipity[properties][<?php echo $fieldname; ?>]"><?php echo htmlspecialchars($value); ?></textarea></td>
|
||||||
<td valign="top" id="ep_column_<?php echo htmlspecialchars($fieldname); ?>">
|
<td valign="top" id="ep_column_<?php echo $fieldname; ?>">
|
||||||
<script type="text/javascript" language="JavaScript">
|
<script type="text/javascript" language="JavaScript">
|
||||||
var epColumn = document.getElementById('ep_column_<?php echo htmlspecialchars($fieldname); ?>');
|
var epColumn = document.getElementById('ep_column_<?php echo $fieldname; ?>');
|
||||||
var epImgBtn = document.createElement('span');
|
var epImgBtn = document.createElement('span');
|
||||||
epImgBtn.innerHTML = '<input class="serendipityPrettyButton input_button" type="button" name="insImage" value="<?php echo MEDIA ; ?>" onclick="window.open(\'serendipity_admin_image_selector.php?serendipity[htmltarget]=prop<?php echo htmlspecialchars($fieldname); ?>&serendipity[filename_only]=true\', \'ImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');" class="serendipityPrettyButton" />';
|
epImgBtn.innerHTML = '<input class="serendipityPrettyButton input_button" type="button" name="insImage" value="<?php echo MEDIA ; ?>" onclick="window.open(\'serendipity_admin_image_selector.php?serendipity[htmltarget]=prop<?php echo $fieldname; ?>&serendipity[filename_only]=true\', \'ImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');" class="serendipityPrettyButton" />';
|
||||||
epColumn.appendChild(epImgBtn);
|
epColumn.appendChild(epImgBtn);
|
||||||
</script>
|
</script>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user