• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

[Already There] Minor limiting DataWriter Issue (related to spaces)

Jeremy

Well-known member
#1
As I am writing BB code manager, I noticed a small error that I find could be limiting (especially in my add-on). For example I have defined a replacement code as such:

"King Kovifor has posted " && " on his blog."

Notice the space at the end, and the space at the beginning. The idea is to allow this:
[kk]a new article[/kk] and get the following:
"King Kovifor has posted a new article on his blog."

However, the actual output is:
"King Kovifor has posteda new articleon his blog."

DataWriters strip any spaces from the beginning and end of an item. I think the solution would be to have a $dw->_stripSpaces = true; variable and a global $dw->setStripSpaces(boolean strip); function to set it. That way if you want to trim them from items such as forum titles, but I want to keep them, I can. Just a small thought.
 

Mike

XenForo developer
Staff member
#2
If you set 'noTrim' => true as one of the "options" for the field you don't want to trim (ie, array('type' => self::TYPE_STRING, 'noTrim' => true)), that should do what you want.

The code is there, though I haven't tested this.