Ticket #13098: 13098.diff
File 13098.diff, 1.8 KB (added by , 15 years ago) |
---|
-
wp-includes/bookmark.php
309 309 * @return mixed The filtered value 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 333 333 if ( 'raw' == $context ) … … 347 347 } else { 348 348 // Use display filters by default. 349 349 $value = apply_filters($field, $value, $bookmark_id, $context); 350 351 if ( 'attribute' == $context ) 352 $value = esc_attr($value); 353 else if ( 'js' == $context ) 354 $value = esc_js($value); 350 355 } 351 356 352 if ( 'attribute' == $context )353 $value = esc_attr($value);354 else if ( 'js' == $context )355 $value = esc_js($value);356 357 357 return $value; 358 358 } 359 359