fixed error with automatically adding _name to option
This commit is contained in:
@@ -1066,7 +1066,7 @@ class Plgntls {
|
||||
|
||||
|
||||
|
||||
public static function get_option_safe($option) {
|
||||
public static function get_option_safe($option, $name = false) {
|
||||
/*
|
||||
* first init option, in case it was not already
|
||||
* it will returns the option name or false
|
||||
@@ -1098,11 +1098,20 @@ class Plgntls {
|
||||
}
|
||||
|
||||
/*
|
||||
* if option is an array and _name is not define,
|
||||
* add the _name entry to the output, to facilitate the access to the name
|
||||
* $name is true,
|
||||
* add the _name entry to the output,
|
||||
* it will overwrite any existing _name key
|
||||
* if option is not an array,
|
||||
* make it array and put the value into a '_value' key
|
||||
*
|
||||
*
|
||||
*/
|
||||
if (is_array($ret_option) && !isset($ret_option['_name'])) {
|
||||
if ($name === true) {
|
||||
if (!is_array($ret_option)) {
|
||||
$value = $ret_option;
|
||||
$ret_option = array();
|
||||
$ret_option['_value'] = $value;
|
||||
}
|
||||
$ret_option['_name'] = $option_name;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user