updated plgntls options to improve default with new options
This commit is contained in:
@@ -1092,13 +1092,18 @@ class Plgntls {
|
||||
*
|
||||
*/
|
||||
$option_data = get_option($option_name);
|
||||
$false_serialized = serialize(false);
|
||||
$option_unserialized = @unserialize($option_data);
|
||||
if ($option_unserialized === false && $option_data != $false_serialized) {
|
||||
if (!is_string($option_data)) {
|
||||
$ret_option = $option_data;
|
||||
}
|
||||
else {
|
||||
$ret_option = $option_unserialized;
|
||||
$false_serialized = serialize(false);
|
||||
$option_unserialized = @unserialize($option_data);
|
||||
if ($option_unserialized === false && $option_data != $false_serialized) {
|
||||
$ret_option = $option_data;
|
||||
}
|
||||
else {
|
||||
$ret_option = $option_unserialized;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1211,9 +1216,6 @@ class Plgntls {
|
||||
if (!isset($option['_default'])) {
|
||||
return false;
|
||||
}
|
||||
if (isset($option['_db'])) {
|
||||
return $option['_name'];
|
||||
}
|
||||
|
||||
/*
|
||||
* if wp option does not already exists, just add it
|
||||
@@ -1222,7 +1224,8 @@ class Plgntls {
|
||||
*/
|
||||
$name = $option['_name'];
|
||||
if (false === get_option($name)) {
|
||||
add_option($name, $option['_default'], '', 'no');
|
||||
add_option($name, '', '', 'no');
|
||||
self::update_option_safe($name, $option['_default']);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1258,7 +1261,6 @@ class Plgntls {
|
||||
*/
|
||||
$options_serialized = get_option(self::$_options_list);
|
||||
$options_unserialized = unserialize($options_serialized);
|
||||
$option['_db'] = null;
|
||||
$options_unserialized[$name] = $option;
|
||||
update_option(self::$_options_list, serialize($options_unserialized), '', 'no');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user