Fixing PHP warnings #7225

1.9.x
Julio Montoya 11 years ago
parent 228a8c60a7
commit 136f1f4da9
  1. 22
      main/inc/lib/plugin.class.php

@ -86,7 +86,7 @@ class Plugin
$value = $type['options']; $value = $type['options'];
} }
$result[$name] = $value; $result[$name] = $value;
} }
} }
return $result; return $result;
} }
@ -170,7 +170,7 @@ class Plugin
$checkboxGroup = array(); $checkboxGroup = array();
$checkboxCollection = array(); $checkboxCollection = array();
if ($checkboxNames = array_keys($this->fields, 'checkbox')) { if ($checkboxNames = array_keys($this->fields, 'checkbox')) {
$pluginInfoCollection = api_get_settings('Plugins'); $pluginInfoCollection = api_get_settings('Plugins');
foreach ($pluginInfoCollection as $pluginInfo) { foreach ($pluginInfoCollection as $pluginInfo) {
if (array_search($pluginInfo['title'], $checkboxNames) !== false) { if (array_search($pluginInfo['title'], $checkboxNames) !== false) {
@ -178,8 +178,8 @@ class Plugin
} }
} }
} }
foreach ($this->fields as $name => $type) { foreach ($this->fields as $name => $type) {
$value = $this->get($name); $value = $this->get($name);
@ -208,19 +208,25 @@ class Plugin
$result->addGroup($group, null, array($this->get_lang($name), $help)); $result->addGroup($group, null, array($this->get_lang($name), $help));
break; break;
case 'checkbox': case 'checkbox':
$selectedValue = null;
if (isset($checkboxCollection[$name])) {
if ($checkboxCollection[$name]['selected_value'] === 'true') {
$selectedValue = 'checked';
}
}
$element = $result->createElement( $element = $result->createElement(
$type, $type,
$name, $name,
'', '',
$this->get_lang($name), $this->get_lang($name),
$checkboxCollection[$name]['selected_value'] === 'true' ? 'checked' : '' $selectedValue
); );
$element->_attributes['value'] = 'true'; $element->_attributes['value'] = 'true';
$checkboxGroup[] = $element; $checkboxGroup[] = $element;
break; break;
} }
} }
if (!empty($checkboxGroup)) { if (!empty($checkboxGroup)) {
$result->addGroup($checkboxGroup, null, array($this->get_lang('sms_types'), $help)); $result->addGroup($checkboxGroup, null, array($this->get_lang('sms_types'), $help));
} }

Loading…
Cancel
Save