Part of a healthy balanced breakfast - fixes #1980

git-svn-id: http://svn.automattic.com/wordpress/trunk@3234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-11-29 07:58:50 +00:00
parent f57362c61c
commit 0ff8f49cd5
1 changed files with 13 additions and 15 deletions

View File

@ -257,6 +257,13 @@ function url_to_postid($url) {
}
function maybe_unserialize($original) {
if ( $gm = @ unserialize($original) )
return $gm;
else
return $original;
}
/* Options functions */
function get_settings($setting) {
@ -286,11 +293,7 @@ function get_settings($setting) {
if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
$value = preg_replace('|/+$|', '', $value);
@ $kellogs = unserialize($value);
if ( $kellogs !== FALSE )
return apply_filters('option_' . $setting, $kellogs);
else
return apply_filters('option_' . $setting, $value);
return apply_filters( 'option_' . $setting, maybe_unserialize($value) );
}
function get_option($option) {
@ -328,9 +331,7 @@ function get_alloptions() {
$option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ( 'category_base' == $option->option_name )
$option->option_value = preg_replace('|/+$|', '', $option->option_value);
@ $value = unserialize($option->option_value);
if ( $value === FALSE )
$value = $option->option_value;
$value = maybe_unserialize($option->option_value);
$all_options->{$option->option_name} = apply_filters('pre_option_' . $option->option_name, $value);
}
return apply_filters('all_options', $all_options);
@ -459,9 +460,9 @@ function get_post_meta($post_id, $key, $single = false) {
if ( isset($post_meta_cache[$post_id][$key]) ) {
if ( $single ) {
return $post_meta_cache[$post_id][$key][0];
return maybe_unserialize( $post_meta_cache[$post_id][$key][0] );
} else {
return $post_meta_cache[$post_id][$key];
return maybe_unserialize( $post_meta_cache[$post_id][$key][0] );
}
}
@ -476,7 +477,7 @@ function get_post_meta($post_id, $key, $single = false) {
if ( $single ) {
if ( count($values) ) {
$return = $values[0];
$return = maybe_unserialize( $values[0] );
} else {
return '';
}
@ -484,10 +485,7 @@ function get_post_meta($post_id, $key, $single = false) {
$return = $values;
}
@ $kellogs = unserialize($return);
if ( $kellogs !== FALSE )
return $kellogs;
else return $return;
return maybe_unserialize($return);
}
function update_post_meta($post_id, $key, $value, $prev_value = '') {