Changes from trunk/wp-includes/kses.php at r7969 to branches/2.6/wp-includes/kses.php at r8385
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/wp-includes/kses.php
r7969 r8385 432 432 if ( $string == '' ) 433 433 return ''; 434 // prevent multiple dashes in comments 435 $string = preg_replace('/--+/', '-', $string); 436 // prevent three dashes closing a comment 437 $string = preg_replace('/-$/', '', $string); 434 438 return "<!--{$string}-->"; 435 439 } … … 534 538 * or apostrophes around them, to make it easier to produce HTML code that will 535 539 * conform to W3C's HTML specification. It will also remove bad URL protocols 536 * from attribute values. 540 * from attribute values. It also reduces duplicate attributes by using the 541 * attribute defined first (foo='bar' foo='baz' will result in foo='bar'). 537 542 * 538 543 * @since 1.0.0 … … 577 582 $working = 1; 578 583 $mode = 0; 579 $attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); 584 if(FALSE === array_key_exists($attrname, $attrarr)) { 585 $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); 586 } 580 587 $attr = preg_replace('/^\s+/', '', $attr); 581 588 } … … 590 597 $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); 591 598 592 $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); 599 if(FALSE === array_key_exists($attrname, $attrarr)) { 600 $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); 601 } 593 602 $working = 1; 594 603 $mode = 0; … … 602 611 $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); 603 612 604 $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); 613 if(FALSE === array_key_exists($attrname, $attrarr)) { 614 $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n'); 615 } 605 616 $working = 1; 606 617 $mode = 0; … … 614 625 $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); 615 626 616 $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); 627 if(FALSE === array_key_exists($attrname, $attrarr)) { 628 $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n'); 629 } 617 630 # We add quotes to conform to W3C's HTML spec. 618 631 $working = 1; … … 631 644 } # while 632 645 633 if ($mode == 1 )646 if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) 634 647 # special case, for when the attribute list ends with a valueless 635 648 # attribute like "selected" 636 $attrarr[ ] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');649 $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); 637 650 638 651 return $attrarr;
Note: See TracChangeset
for help on using the changeset viewer.