Changeset 5541 for trunk/wp-includes/formatting.php
- Timestamp:
- 05/25/2007 02:22:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r5262 r5541 1119 1119 } 1120 1120 1121 function sanitize_option($option, $value) { // Remember to call stripslashes! 1122 1123 switch ($option) { 1124 case 'admin_email': 1125 $value = sanitize_email($value); 1126 break; 1127 1128 case 'default_post_edit_rows': 1129 case 'mailserver_port': 1130 case 'comment_max_links': 1131 $value = abs((int) $value); 1132 break; 1133 1134 case 'posts_per_page': 1135 case 'posts_per_rss': 1136 $value = (int) $value; 1137 if ( empty($value) ) $value = 1; 1138 if ( $value < -1 ) $value = abs($value); 1139 break; 1140 1141 case 'default_ping_status': 1142 case 'default_comment_status': 1143 // Options that if not there have 0 value but need to be something like "closed" 1144 if ( $value == '0' || $value == '') 1145 $value = 'closed'; 1146 break; 1147 1148 case 'blogdescription': 1149 case 'blogname': 1150 $value = addslashes($value); 1151 $value = wp_filter_post_kses( $value ); // calls stripslashes then addslashes 1152 $value = stripslashes($value); 1153 $value = wp_specialchars( $value ); 1154 break; 1155 1156 case 'blog_charset': 1157 $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); // strips slashes 1158 break; 1159 1160 case 'date_format': 1161 case 'time_format': 1162 case 'mailserver_url': 1163 case 'mailserver_login': 1164 case 'mailserver_pass': 1165 case 'ping_sites': 1166 case 'upload_path': 1167 $value = strip_tags($value); 1168 $value = addslashes($value); 1169 $value = wp_filter_kses($value); // calls stripslashes then addslashes 1170 $value = stripslashes($value); 1171 break; 1172 1173 case 'gmt_offset': 1174 $value = preg_replace('/[^0-9:.-]/', '', $value); // strips slashes 1175 break; 1176 1177 case 'siteurl': 1178 case 'home': 1179 $value = stripslashes($value); 1180 $value = clean_url($value); 1181 break; 1182 default : 1183 break; 1184 } 1185 1186 return $value; 1187 } 1188 1121 1189 ?>
Note: See TracChangeset
for help on using the changeset viewer.