1. 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)

Discussion in 'Closed Suggestions' started by Jeremy, Dec 9, 2010.

  1. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     
  2. Mike

    Mike XenForo Developer Staff Member

    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.
     
    Jeremy likes this.
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    Mike, what haven't you guys thought of? These systems are completely and utterly amazing.
     

Share This Page