From: garvinhicking Date: Tue, 25 Apr 2006 07:26:44 +0000 (+0000) Subject: fix from brian: Wrong radio button evaluation X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e1e53e3820c63e34391aa32c5f5ed2a6b2cdf7e9;p=s9y.git fix from brian: Wrong radio button evaluation --- diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php index cfe8703..756310a 100644 --- a/include/functions_plugins_admin.inc.php +++ b/include/functions_plugins_admin.inc.php @@ -1,565 +1,565 @@ - -
- - - - - - - - - - -introspect($bag); - - $name = htmlspecialchars($bag->get('name')); - $desc = htmlspecialchars($bag->get('description')); - $desc .= '
' . VERSION . ': ' . $bag->get('version') . ''; - - $title = serendipity_plugin_api::get_plugin_title($plugin, '[' . $name . ']'); - - if ($bag->is_set('configuration') && ($plugin->protected === FALSE || $plugin_data['authorid'] == '0' || $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) { - $can_configure = true; - } else { - $can_configure = false; - } - } - - if ($event_only) { - $place = ''; - $event_only_uri = '&serendipity[event_plugin]=true'; - } else { - $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable); - $event_only_uri = ''; - } - - /* Only display UP/DOWN links if there's somewhere for the plugin to go */ - if ($sort_idx == 0) { - $moveup = ' '; - } else { - $moveup = '' . UP . ''; - } - - if ($sort_idx == (count($plugins)-1)) { - $movedown = ' '; - } else { - $movedown = ($moveup != '' ? ' ' : '') . ''. DOWN .''; - } -?> - - - - - - - - - - - - - - - -
   - -
-
- - - -   - -
-
- - - -   - - - - - - -
-
-
-
-
- - -
-
- - - LEFT, - 'right' => RIGHT, - 'hide' => HIDDEN - ); - - $x = "\n\n"; -} - -/** - * Show a placement box on where to move a sidebar plugin to - * - * @access public - * @param object A plugin object - * @param object The plugins property bag object - * @param string The name of the plugin - * @param string The description of the plugin - * @param array The property bag 'configuration' array, holding the array of config items. - * @param boolean Shows the surrounding HTML table? - * @param boolean Shows the FORM submit button? - * @param boolean Shows a plugin's "example" method output? - * @param boolean Spawn a plugins' configuration WYSIWYG items? - * @param string The array index name of POSTed values ($serendipity['POST'][xxx]) - * @return boolean - */ -function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_names, $showTable = true, $showSubmit = true, $showExample = true, $spawnNuggets = true, $postKey = 'plugin') { - global $serendipity; - - if ($showTable) { -?> - -introspect_config_item($config_item, $cbag); - - $cname = htmlspecialchars($cbag->get('name')); - $cdesc = htmlspecialchars($cbag->get('description')); - $value = $plugin->get_config($config_item, 'unset'); - $lang_direction = htmlspecialchars($cbag->get('lang_direction')); - - if (empty($lang_direction)) { - $lang_direction = LANG_DIRECTION; - } - - /* Apparently no value was set for this config item */ - if ($value === 'unset') { - /* Try and the default value for the config item */ - $value = $cbag->get('default'); - - /* Still, we don't have a value, try and get (bool)false - from an old plugin */ - if ($value === '') { - $value = $plugin->get_config($config_item, false, true); - } - } - - if (isset($_POST['serendipity'][$postkey][$config_item])) { - if (is_array($_POST['serendipity'][$postkey][$config_item])) { - $hvalue = $_POST['serendipity'][$postkey][$config_item]; - array_walk($hvalue, 'htmlspecialchars'); - } else { - $hvalue = htmlspecialchars($_POST['serendipity'][$postkey][$config_item]); - } - } else { - $hvalue = htmlspecialchars($value); - } - - $radio = array(); - $select = array(); - $per_row = null; - - $is_multi_select = false; - $ctype = $cbag->get('type'); - switch ($ctype) { - case 'seperator': -?> - - - - $hvalue); - } - - $pre_selected = (array)$cbag->get('select_preselected'); - $select_size = $cbag->get('select_size'); - $select = $cbag->get('select_values'); -?> - - - - - 0) { - $radio = $cbag->get('radio'); - } - - if (empty($per_row)) { - $per_row = $cbag->get('radio_per_row'); - if (empty($per_row)) { - $per_row = 2; - } - } -?> - - - - - - - - - - - - - - - - - -get('type') == 'html') { - $htmlnugget[] = $elcount; - serendipity_emit_htmlarea_code('nuggets', 'nuggets', true); - } - break; - - case 'content': - ?> $config_item, - 'cbag' => $cbag, - 'plugin' => $plugin, - 'value' => $value, - 'bag' => $bag, - 'postKey' => $postKey - ); - serendipity_plugin_api::hook_event('backend_pluginconfig_' . $ctype, $eventData, $addData); - break; - } - } - - if ($showTable) { -?> -

- -
  - -
-
- -
-
- -
  - -
- $radio_value) { - $id = htmlspecialchars($config_item . $radio_value); - $counter++; - $checked = ""; - - if ($radio_value == 'true' && ($hvalue === '1' || $hvalue === 'true')) { - $checked = " checked"; - } elseif ($radio_value == 'false' && ($hvalue === '' || $hvalue === 'false')) { - $checked = " checked"; - } elseif ($radio_value == $hvalue) { - $checked = " checked"; - } - - if ($counter == 1) { -?> -
- - title="" /> - - -
- -
- -
  -
-
- -
-
-    -
-
- -
-
get('default'); ?>
-
- -
- -
- -
- example() ?> -
- 0) { - $ev = array('nuggets' => $htmlnugget, 'skip_nuggets' => false); - serendipity_plugin_api::hook_event('backend_wysiwyg_nuggets', $ev); - - if ($ev['skip_nuggets'] === false) { -?> - - +
+ + + + + + + + + + +introspect($bag); + + $name = htmlspecialchars($bag->get('name')); + $desc = htmlspecialchars($bag->get('description')); + $desc .= '
' . VERSION . ': ' . $bag->get('version') . ''; + + $title = serendipity_plugin_api::get_plugin_title($plugin, '[' . $name . ']'); + + if ($bag->is_set('configuration') && ($plugin->protected === FALSE || $plugin_data['authorid'] == '0' || $plugin_data['authorid'] == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers'))) { + $can_configure = true; + } else { + $can_configure = false; + } + } + + if ($event_only) { + $place = ''; + $event_only_uri = '&serendipity[event_plugin]=true'; + } else { + $place = placement_box('serendipity[placement][' . $plugin_data['name'] . ']', $plugin_data['placement'], $is_plugin_editable); + $event_only_uri = ''; + } + + /* Only display UP/DOWN links if there's somewhere for the plugin to go */ + if ($sort_idx == 0) { + $moveup = ' '; + } else { + $moveup = '' . UP . ''; + } + + if ($sort_idx == (count($plugins)-1)) { + $movedown = ' '; + } else { + $movedown = ($moveup != '' ? ' ' : '') . ''. DOWN .''; + } +?> + + + + + + + + + + + + + + + +
   + +
+
+ + + +   + +
+
+ + + +   + + + + + + +
+
+
+
+
+ + +
+
+ + + LEFT, + 'right' => RIGHT, + 'hide' => HIDDEN + ); + + $x = "\n\n"; +} + +/** + * Show a placement box on where to move a sidebar plugin to + * + * @access public + * @param object A plugin object + * @param object The plugins property bag object + * @param string The name of the plugin + * @param string The description of the plugin + * @param array The property bag 'configuration' array, holding the array of config items. + * @param boolean Shows the surrounding HTML table? + * @param boolean Shows the FORM submit button? + * @param boolean Shows a plugin's "example" method output? + * @param boolean Spawn a plugins' configuration WYSIWYG items? + * @param string The array index name of POSTed values ($serendipity['POST'][xxx]) + * @return boolean + */ +function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_names, $showTable = true, $showSubmit = true, $showExample = true, $spawnNuggets = true, $postKey = 'plugin') { + global $serendipity; + + if ($showTable) { +?> + +introspect_config_item($config_item, $cbag); + + $cname = htmlspecialchars($cbag->get('name')); + $cdesc = htmlspecialchars($cbag->get('description')); + $value = $plugin->get_config($config_item, 'unset'); + $lang_direction = htmlspecialchars($cbag->get('lang_direction')); + + if (empty($lang_direction)) { + $lang_direction = LANG_DIRECTION; + } + + /* Apparently no value was set for this config item */ + if ($value === 'unset') { + /* Try and the default value for the config item */ + $value = $cbag->get('default'); + + /* Still, we don't have a value, try and get (bool)false - from an old plugin */ + if ($value === '') { + $value = $plugin->get_config($config_item, false, true); + } + } + + if (isset($_POST['serendipity'][$postkey][$config_item])) { + if (is_array($_POST['serendipity'][$postkey][$config_item])) { + $hvalue = $_POST['serendipity'][$postkey][$config_item]; + array_walk($hvalue, 'htmlspecialchars'); + } else { + $hvalue = htmlspecialchars($_POST['serendipity'][$postkey][$config_item]); + } + } else { + $hvalue = htmlspecialchars($value); + } + + $radio = array(); + $select = array(); + $per_row = null; + + $is_multi_select = false; + $ctype = $cbag->get('type'); + switch ($ctype) { + case 'seperator': +?> + + + + $hvalue); + } + + $pre_selected = (array)$cbag->get('select_preselected'); + $select_size = $cbag->get('select_size'); + $select = $cbag->get('select_values'); +?> + + + + + 0) { + $radio = $cbag->get('radio'); + } + + if (empty($per_row)) { + $per_row = $cbag->get('radio_per_row'); + if (empty($per_row)) { + $per_row = 2; + } + } +?> + + + + + + + + + + + + + + + + + +get('type') == 'html') { + $htmlnugget[] = $elcount; + serendipity_emit_htmlarea_code('nuggets', 'nuggets', true); + } + break; + + case 'content': + ?> $config_item, + 'cbag' => $cbag, + 'plugin' => $plugin, + 'value' => $value, + 'bag' => $bag, + 'postKey' => $postKey + ); + serendipity_plugin_api::hook_event('backend_pluginconfig_' . $ctype, $eventData, $addData); + break; + } + } + + if ($showTable) { +?> +

+ +
  + +
+
+ +
+
+ +
  + +
+ $radio_value) { + $id = htmlspecialchars($config_item . $radio_value); + $counter++; + $checked = ""; + + if ($radio_value == 'true' && ($hvalue === '1' || $hvalue === 'true')) { + $checked = " checked"; + } elseif ($radio_value == 'false' && ($hvalue === '' || $hvalue === 'false')) { + $checked = " checked"; + } elseif ($radio_value == $hvalue) { + $checked = " checked"; + } + + if ($counter == 1) { +?> +
+ + title="" /> + + +
+ +
+ +
  +
+
+ +
+
+    +
+
+ +
+
get('default'); ?>
+
+ +
+ +
+ +
+ example() ?> +
+ 0) { + $ev = array('nuggets' => $htmlnugget, 'skip_nuggets' => false); + serendipity_plugin_api::hook_event('backend_wysiwyg_nuggets', $ev); + + if ($ev['skip_nuggets'] === false) { +?> + +add('description', ''); $propbag->add('default', false); $propbag->add('radio_per_row', '3'); - $propbag->add('rado', $radio); + $propbag->add('radio', $radio); break; case 'show_0.91':