Changeset 14239 for trunk/wp-includes
- Timestamp:
- 04/26/2010 02:10:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/bookmark.php
r14131 r14239 310 310 */ 311 311 function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { 312 $int_fields = array('link_id', 'link_rating'); 313 if ( in_array($field, $int_fields) ) 312 switch ( $field ) { 313 case 'link_id' : // ints 314 case 'link_rating' : 314 315 $value = (int) $value; 315 316 // Fields which contain arrays of ints.317 $array_int_fields = array( 'link_category');318 if ( in_array($field, $array_int_fields) ) {319 $value = array_map( 'absint', $value);316 break; 317 case 'link_category' : // array( ints ) 318 $value = array_map('absint', (array) $value); 319 // We return here so that the categories aren't filtered. 320 // The 'link_category' filter is for the name of a link category, not an array of a link's link categories 320 321 return $value; 321 } 322 323 $yesno = array('link_visible'); 324 if ( in_array($field, $yesno) ) 322 break; 323 case 'link_visible' : // bool stored as Y|N 325 324 $value = preg_replace('/[^YNyn]/', '', $value); 326 327 if ( 'link_target' == $field ) {325 break; 326 case 'link_target' : // "enum" 328 327 $targets = array('_top', '_blank'); 329 328 if ( ! in_array($value, $targets) ) 330 329 $value = ''; 330 break; 331 331 } 332 332 … … 348 348 // Use display filters by default. 349 349 $value = apply_filters($field, $value, $bookmark_id, $context); 350 } 351 352 if ( 'attribute' == $context )353 $value = esc_attr($value);354 else if ( 'js' == $context )355 $value = esc_js($value);350 351 if ( 'attribute' == $context ) 352 $value = esc_attr($value); 353 else if ( 'js' == $context ) 354 $value = esc_js($value); 355 } 356 356 357 357 return $value;
Note: See TracChangeset
for help on using the changeset viewer.