humanmade / clean-html

45 stars 1 forks source link

WPCS config #2

Closed GaryJones closed 1 year ago

GaryJones commented 8 years ago

Suggestion for the README - add a section on how devs can amend their phpcs.xml (or ruleset.xml) file to allow whitelist_html() as a valid escaping function when checking PHP_CodeSniffer + WordPress Coding Standards sniffs.

I'm sure @JDGrimes can give you the correct few lines it would need, but I vaguely think it would be something like:

<rule ref="WordPress.XSS.EscapeOutput">
    <properties>
        <property type="array" name="customEscapingFunctions" value="whitelist_html"/>
        <property type="array" name="customPrintingFunctions" value="print_whitelist_html"/>
    </properties>
</rule>

Otherwise, WPCS is going to be complaining every time whitelist_html() and print_whitelist_html() are used.

JDGrimes commented 8 years ago

Yes, that looks right. Although I think maybe that print_whitelist_html() doesn't need to be added to the printing function list, since it automatically escapes its output.