Changeset 3054 for trunk/wp-admin/options.php
- Timestamp:
- 11/12/2005 09:36:20 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/options.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options.php
r3023 r3054 34 34 if (!$_POST['page_options']) { 35 35 foreach ($_POST as $key => $value) { 36 $option _names[] = "'$key'";36 $options[] = "'$key'"; 37 37 } 38 $option_names = implode(',', $option_names);39 38 } else { 40 $option _names = stripslashes($_POST['page_options']);39 $options = explode(',', stripslashes($_POST['page_options'])); 41 40 } 42 43 $options = $wpdb->get_results("SELECT $wpdb->options.option_id, option_name, option_type, option_value, option_admin_level FROM $wpdb->options WHERE option_name IN ($option_names)");44 41 45 42 // Save for later. … … 47 44 $old_home = get_settings('home'); 48 45 49 // HACK 50 // Options that if not there have 0 value but need to be something like "closed" 51 $nonbools = array('default_ping_status', 'default_comment_status'); 52 if ($options) { 53 $options = apply_filters( 'options_to_update' , $options ); 54 foreach ($options as $option) { 55 $old_val = $option->option_value; 56 $new_val = trim($_POST[$option->option_name]); 57 if( in_array($option->option_name, $nonbools) && ( $new_val == '0' || $new_val == '') ) 58 $new_val = 'closed'; 59 if ($new_val !== $old_val) { 60 $result = $wpdb->query("UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"); 61 wp_cache_set($option->option_name, $new_val, 'options'); 62 $any_changed++; 63 } 46 // HACK 47 // Options that if not there have 0 value but need to be something like "closed" 48 $nonbools = array('default_ping_status', 'default_comment_status'); 49 if ($options) { 50 foreach ($options as $option) { 51 $option = trim($option); 52 $value = trim(stripslashes($_POST[$option])); 53 if( in_array($option, $nonbools) && ( $value == '0' || $value == '') ) 54 $value = 'closed'; 55 56 if ( update_option($option, $value) ) 57 $any_changed++; 58 } 64 59 } 65 unset($cache_settings); // so they will be re-read66 get_settings('siteurl'); // make it happen now67 } // end if options68 60 69 if ($any_changed) {61 if ($any_changed) { 70 62 // If siteurl or home changed, reset cookies. 71 63 if ( get_settings('siteurl') != $old_siteurl || get_settings('home') != $old_home ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)