src/Forms/HTMLEditor/HTMLEditorSanitiser.php
protected function attributeMatchesRule($attr, $rule = null)
    {
        // If the rule doesn't exist at all, the attribute isn't allowed
        if (!$rule) {
            return false;
        }

        // If the rule has a set of valid values, check them to see if this attribute is one
        if (isset($rule->validValues) && !in_array($attr->value, $rule->validValues)) {
            return false;
        }

        // No further tests required, attribute passes
        return true;
    }
protected function attributeMatchesRule($attr, $rule = null)
    {
        // If the rule doesn't exist at all, the attribute isn't allowed
        if (!$rule) {
            return false;
        }

        // If the rule has a set of valid values, check them to see if this attribute is one
        if (isset($rule->validValues) && !in_array($attr->value, $rule->validValues)) {
            return false;
        }

        // No further tests required, attribute passes
        return true;
    }
protected function attributeMatchesRule ( $ attr , $ rule = null ) { // If the rule doesn't exist at all, the attribute isn't allowed if ( ! $ rule ) { return false ; } // If the rule has a set of valid values, check them to see if this attribute is one if ( isset ( $ rule -> validValues ) && ! in_array ( $ attr -> value , $ rule -> validValues ) ) { return false ; } // No further tests required, attribute passes return true ; }
Given a DOMAttr and an attribute rule, check if that attribute passes the rule
@param DOMAttr $attr - the attribute to check
@param stdClass $rule - the rule to check against
@return bool - true if the attribute passes (and so can be kept), false if it fails (and so needs stripping)
Given a DOMAttr and an attribute rule check if that attribute passes the rule