Make WordPress Core

Ticket #35877: 35877.diff

File 35877.diff, 2.9 KB (added by mrahmadawais, 10 years ago)

KSES: Arrange list of allowed CSS attributes alphabatically.

  • wp-includes/kses.php

     
    551551        $allowed_protocols = wp_allowed_protocols();
    552552        $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
    553553        $string = wp_kses_js_entities( $string );
    554        
     554
    555555        // Preserve leading and trailing whitespace.
    556556        $matches = array();
    557557        preg_match('/^\s*/', $string, $matches);
    … …  
    563563        } else {
    564564                $string = substr( $string, strlen( $lead ), -strlen( $trail ) );
    565565        }
    566        
     566
    567567        // Parse attribute name and value from input.
    568568        $split = preg_split( '/\s*=\s*/', $string, 2 );
    569569        $name = $split[0];
    … …  
    600600                $value = '';
    601601                $vless = 'y';
    602602        }
    603        
     603
    604604        // Sanitize attribute by name.
    605605        wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html );
    606606
    … …  
    10631063        } else {
    10641064                $xhtml_slash = '';
    10651065        }
    1066        
     1066
    10671067        // Split it
    10681068        $attrarr = wp_kses_hair_parse( $attr );
    10691069        if ( false === $attrarr ) {
    … …  
    10731073        // Make sure all input is returned by adding front and back matter.
    10741074        array_unshift( $attrarr, $begin . $slash . $elname );
    10751075        array_push( $attrarr, $xhtml_slash . $end );
    1076        
     1076
    10771077        return $attrarr;
    10781078}
    10791079
    … …  
    17161716        $allowed_attr = apply_filters( 'safe_style_css', array(
    17171717                'background',
    17181718                'background-color',
    1719 
    17201719                'border',
    1721                 'border-width',
    1722                 'border-color',
    1723                 'border-style',
    1724                 'border-right',
    1725                 'border-right-color',
    1726                 'border-right-style',
    1727                 'border-right-width',
    17281720                'border-bottom',
    17291721                'border-bottom-color',
    17301722                'border-bottom-style',
    17311723                'border-bottom-width',
     1724                'border-collapse',
     1725                'border-color',
    17321726                'border-left',
    17331727                'border-left-color',
    17341728                'border-left-style',
    17351729                'border-left-width',
     1730                'border-right',
     1731                'border-right-color',
     1732                'border-right-style',
     1733                'border-right-width',
     1734                'border-spacing',
     1735                'border-style',
    17361736                'border-top',
    17371737                'border-top-color',
    17381738                'border-top-style',
    17391739                'border-top-width',
    1740 
    1741                 'border-spacing',
    1742                 'border-collapse',
     1740                'border-width',
    17431741                'caption-side',
    1744 
     1742                'clear',
    17451743                'color',
     1744                'cursor',
     1745                'direction',
     1746                'float',
    17461747                'font',
    17471748                'font-family',
    17481749                'font-size',
    … …  
    17491750                'font-style',
    17501751                'font-variant',
    17511752                'font-weight',
     1753                'height',
    17521754                'letter-spacing',
    17531755                'line-height',
    1754                 'text-decoration',
    1755                 'text-indent',
    1756                 'text-align',
    1757 
    1758                 'height',
    1759                 'min-height',
    1760                 'max-height',
    1761 
    1762                 'width',
    1763                 'min-width',
    1764                 'max-width',
    1765 
     1756                'list-style-type',
    17661757                'margin',
    1767                 'margin-right',
    17681758                'margin-bottom',
    17691759                'margin-left',
     1760                'margin-right',
    17701761                'margin-top',
    1771 
     1762                'max-height',
     1763                'max-width',
     1764                'min-height',
     1765                'min-width',
     1766                'overflow',
    17721767                'padding',
    1773                 'padding-right',
    17741768                'padding-bottom',
    17751769                'padding-left',
     1770                'padding-right',
    17761771                'padding-top',
    1777 
    1778                 'clear',
    1779                 'cursor',
    1780                 'direction',
    1781                 'float',
    1782                 'overflow',
     1772                'text-align',
     1773                'text-decoration',
     1774                'text-indent',
    17831775                'vertical-align',
    1784                 'list-style-type',
     1776                'width',
    17851777        ) );
    17861778
    17871779        if ( empty($allowed_attr) )