[wp-cvs] wordpress/wp-includes functions.php,1.131,1.132
Matthew Mullenweg
saxmatt at users.sourceforge.net
Fri Jul 23 09:14:33 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3788/wp-includes
Modified Files:
functions.php
Log Message:
Options system can now transparently handle arrays and objects.
Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** functions.php 15 Jul 2004 23:29:41 -0000 1.131
--- functions.php 23 Jul 2004 09:14:30 -0000 1.132
***************
*** 300,304 ****
return $cache_settings->$setting;
else
! return $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
}
--- 300,304 ----
return $cache_settings->$setting;
else
! return @ unserialize( $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'") );
}
***************
*** 312,316 ****
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
! $all_options->{$option->option_name} = $option->option_value;
}
}
--- 312,316 ----
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
! @$all_options->{$option->option_name} = unserialize($option->option_value);
}
}
***************
*** 320,324 ****
function update_option($option_name, $newvalue) {
global $wpdb, $cache_settings;
! $newvalue = $newvalue;
$newvalue = trim($newvalue); // I can't think of any situation we wouldn't want to trim
--- 320,326 ----
function update_option($option_name, $newvalue) {
global $wpdb, $cache_settings;
! if ( is_array($newvalue) || is_object($value) )
! $newvalue = serialize($newvalue);
!
$newvalue = trim($newvalue); // I can't think of any situation we wouldn't want to trim
***************
*** 336,342 ****
// thx Alex Stapleton, http://alex.vort-x.net/blog/
! function add_option($name, $value='') {
// Adds an option if it doesn't already exist
global $wpdb;
if(!get_settings($name)) {
$name = $wpdb->escape($name);
--- 338,347 ----
// thx Alex Stapleton, http://alex.vort-x.net/blog/
! function add_option($name, $value = '') {
// Adds an option if it doesn't already exist
global $wpdb;
+ if ( is_array($value) || is_object($value) )
+ $value = serialize($value);
+
if(!get_settings($name)) {
$name = $wpdb->escape($name);
More information about the cvs
mailing list