- public function parse() {
- $string = $this->parseAsBlock( $string );
- $m = array();
- if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
- $string = $m[1];
+ public function toString() {
+ $string = $this->getMessageText();
+
+ # Replace parameters before text parsing
+ $string = $this->replaceParameters( $string, 'before' );
+
+ # Maybe transform using the full parser
+ if( $this->options['parse'] ){
+ $string = $this->parseText( $string );
+ } else {
+
+ # Transform {{ constructs
+ if( $this->options['transform'] ){
+ $string = $this->transformText( $string );
+ }
+
+ # Sanitise
+ if( $this->options['escape'] ){
+ # FIXME: Sanitizer method here?
+ $string = htmlspecialchars( $string );
+ }