public function validateDirective($d)
    {
        $id = $d->id->toString();
        $this->context[] = "directive '$id'";
        $this->validateId($d->id);

        $this->with($d, 'description')
            ->assertNotEmpty();

        // BEGIN - handled by InterchangeBuilder
        $this->with($d, 'type')
            ->assertNotEmpty();
        $this->with($d, 'typeAllowsNull')
            ->assertIsBool();
        try {
            // This also tests validity of $d->type
            $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
        } catch (HTMLPurifier_VarParserException $e) {
            $this->error('default', 'had error: ' . $e->getMessage());
        }
        // END - handled by InterchangeBuilder

        if (!is_null($d->allowed) || !empty($d->valueAliases)) {
            // allowed and valueAliases require that we be dealing with
            // strings, so check for that early.
            $d_int = HTMLPurifier_VarParser::$types[$d->type];
            if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {
                $this->error('type', 'must be a string type when used with allowed or value aliases');
            }
        }

        $this->validateDirectiveAllowed($d);
        $this->validateDirectiveValueAliases($d);
        $this->validateDirectiveAliases($d);

        array_pop($this->context);
    }
public function validateDirective($d)
    {
        $id = $d->id->toString();
        $this->context[] = "directive '$id'";
        $this->validateId($d->id);

        $this->with($d, 'description')
            ->assertNotEmpty();

        // BEGIN - handled by InterchangeBuilder
        $this->with($d, 'type')
            ->assertNotEmpty();
        $this->with($d, 'typeAllowsNull')
            ->assertIsBool();
        try {
            // This also tests validity of $d->type
            $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
        } catch (HTMLPurifier_VarParserException $e) {
            $this->error('default', 'had error: ' . $e->getMessage());
        }
        // END - handled by InterchangeBuilder

        if (!is_null($d->allowed) || !empty($d->valueAliases)) {
            // allowed and valueAliases require that we be dealing with
            // strings, so check for that early.
            $d_int = HTMLPurifier_VarParser::$types[$d->type];
            if (!isset(HTMLPurifier_VarParser::$stringTypes[$d_int])) {
                $this->error('type', 'must be a string type when used with allowed or value aliases');
            }
        }

        $this->validateDirectiveAllowed($d);
        $this->validateDirectiveValueAliases($d);
        $this->validateDirectiveAliases($d);

        array_pop($this->context);
    }
public function validateDirective ( $ d ) { $ id = $ d -> id -> toString ( ) ; $ this -> context [ ] = "directive '$id'" ; $ this -> validateId ( $ d -> id ) ; $ this -> with ( $ d , 'description' ) -> assertNotEmpty ( ) ; // BEGIN - handled by InterchangeBuilder $ this -> with ( $ d , 'type' ) -> assertNotEmpty ( ) ; $ this -> with ( $ d , 'typeAllowsNull' ) -> assertIsBool ( ) ; try { // This also tests validity of $d->type $ this -> parser -> parse ( $ d -> default , $ d -> type , $ d -> typeAllowsNull ) ; } catch ( HTMLPurifier_VarParserException $ e ) { $ this -> error ( 'default' , 'had error: ' . $ e -> getMessage ( ) ) ; } // END - handled by InterchangeBuilder if ( ! is_null ( $ d -> allowed ) || ! empty ( $ d -> valueAliases ) ) { // allowed and valueAliases require that we be dealing with // strings, so check for that early. $ d_int = HTMLPurifier_VarParser :: $ types [ $ d -> type ] ; if ( ! isset ( HTMLPurifier_VarParser :: $ stringTypes [ $ d_int ] ) ) { $ this -> error ( 'type' , 'must be a string type when used with allowed or value aliases' ) ; } } $ this -> validateDirectiveAllowed ( $ d ) ; $ this -> validateDirectiveValueAliases ( $ d ) ; $ this -> validateDirectiveAliases ( $ d ) ; array_pop ( $ this -> context ) ; }
Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
@param HTMLPurifier_ConfigSchema_Interchange_Directive $d
Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object .