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:
parent
f57362c61c
commit
0ff8f49cd5
|
@ -257,6 +257,13 @@ function url_to_postid($url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function maybe_unserialize($original) {
|
||||||
|
if ( $gm = @ unserialize($original) )
|
||||||
|
return $gm;
|
||||||
|
else
|
||||||
|
return $original;
|
||||||
|
}
|
||||||
|
|
||||||
/* Options functions */
|
/* Options functions */
|
||||||
|
|
||||||
function get_settings($setting) {
|
function get_settings($setting) {
|
||||||
|
@ -286,11 +293,7 @@ function get_settings($setting) {
|
||||||
if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
|
if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
|
||||||
$value = preg_replace('|/+$|', '', $value);
|
$value = preg_replace('|/+$|', '', $value);
|
||||||
|
|
||||||
@ $kellogs = unserialize($value);
|
return apply_filters( 'option_' . $setting, maybe_unserialize($value) );
|
||||||
if ( $kellogs !== FALSE )
|
|
||||||
return apply_filters('option_' . $setting, $kellogs);
|
|
||||||
else
|
|
||||||
return apply_filters('option_' . $setting, $value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_option($option) {
|
function get_option($option) {
|
||||||
|
@ -328,9 +331,7 @@ function get_alloptions() {
|
||||||
$option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
$option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||||
if ( 'category_base' == $option->option_name )
|
if ( 'category_base' == $option->option_name )
|
||||||
$option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
$option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||||
@ $value = unserialize($option->option_value);
|
$value = maybe_unserialize($option->option_value);
|
||||||
if ( $value === FALSE )
|
|
||||||
$value = $option->option_value;
|
|
||||||
$all_options->{$option->option_name} = apply_filters('pre_option_' . $option->option_name, $value);
|
$all_options->{$option->option_name} = apply_filters('pre_option_' . $option->option_name, $value);
|
||||||
}
|
}
|
||||||
return apply_filters('all_options', $all_options);
|
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 ( isset($post_meta_cache[$post_id][$key]) ) {
|
||||||
if ( $single ) {
|
if ( $single ) {
|
||||||
return $post_meta_cache[$post_id][$key][0];
|
return maybe_unserialize( $post_meta_cache[$post_id][$key][0] );
|
||||||
} else {
|
} 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 ( $single ) {
|
||||||
if ( count($values) ) {
|
if ( count($values) ) {
|
||||||
$return = $values[0];
|
$return = maybe_unserialize( $values[0] );
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -484,10 +485,7 @@ function get_post_meta($post_id, $key, $single = false) {
|
||||||
$return = $values;
|
$return = $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ $kellogs = unserialize($return);
|
return maybe_unserialize($return);
|
||||||
if ( $kellogs !== FALSE )
|
|
||||||
return $kellogs;
|
|
||||||
else return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_post_meta($post_id, $key, $value, $prev_value = '') {
|
function update_post_meta($post_id, $key, $value, $prev_value = '') {
|
||||||
|
|
Loading…
Reference in New Issue