Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
BBCode Sanitizer
Just so everyone knows, this is about the engine which will drive my BBCode extension (Sorry if the formatting gets messed up too...), any feedback would be useful.
1. Features:
To me this all makes sense, probably because this is the second time I've written something using the same methods, anyhow, to customize the input you have to be familiar with Matches and Elements:
2.A. Matches:
To put it in simple terms, a match is a regular expression that lets you check against data, in this case, either the BBCode elements attribute, or its text.
You add Matches like so:
Elements describe two things, what elements are allowed, weather line breaks can be used, and how to format the element. The format consists of the output you want, Conditionals (which rely on Matches) and Values.
Conditionals look like:
You can view it here, or look at the source here.
1. Features:
- Completely customizable output.
- Nesting correction, never have a validation error due to user input.
- What other features can a BBCode parser have!?
To me this all makes sense, probably because this is the second time I've written something using the same methods, anyhow, to customize the input you have to be familiar with Matches and Elements:
2.A. Matches:
To put it in simple terms, a match is a regular expression that lets you check against data, in this case, either the BBCode elements attribute, or its text.
You add Matches like so:
BBCodeSanitizer::AddMatches(Array(2.B. Elements:
"uri" => '~^(http|http|ftp|mailto)(://|:)\S+$~i'
));
Elements describe two things, what elements are allowed, weather line breaks can be used, and how to format the element. The format consists of the output you want, Conditionals (which rely on Matches) and Values.
Conditionals look like:
!target{matches}{output}Values look like:
#target
- Target: Because BBCode is simple, there are only two, 'attribute' and 'text'.
- Matches: Any number of matches prefixed with 'is' or 'not' for positive and negative matching joined together with either '&' for 'and' and '|' for 'or'.
- Whatever you want, but it cannot be another Conditional.
BBCodeSanitizer::AddElements(Array(3. Code
"url" => Array(
"Format" => '!attribute{isuri¬goatse}{#text}!attribute{noturi|isgoatse}{#text}',
"LineBreaks" => False
)
));
You can view it here, or look at the source here.
0
This discussion has been closed.
Comments
Alternately you could put them in xmp tags, and let the browser ignore the tags :-P