Changeset 8385
- Timestamp:
- 07/21/2008 01:15:49 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/wp-includes/kses.php
r8383 r8385 538 538 * or apostrophes around them, to make it easier to produce HTML code that will 539 539 * conform to W3C's HTML specification. It will also remove bad URL protocols 540 * 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'). 541 542 * 542 543 * @since 1.0.0 … … 581 582 $working = 1; 582 583 $mode = 0; 583 $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 } 584 587 $attr = preg_replace('/^\s+/', '', $attr); 585 588 } … … 594 597 $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); 595 598 596 $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 } 597 602 $working = 1; 598 603 $mode = 0; … … 606 611 $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); 607 612 608 $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 } 609 616 $working = 1; 610 617 $mode = 0; … … 618 625 $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols); 619 626 620 $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 } 621 630 # We add quotes to conform to W3C's HTML spec. 622 631 $working = 1; … … 635 644 } # while 636 645 637 if ($mode == 1 )646 if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr)) 638 647 # special case, for when the attribute list ends with a valueless 639 648 # attribute like "selected" 640 $attrarr[ ] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');649 $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y'); 641 650 642 651 return $attrarr;
Note: See TracChangeset
for help on using the changeset viewer.