Results 1 to 8 of 8

Thread: Smiley Parsing

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Location
    ZA ✈ UK
    Posts
    622
    Thanks
    0
    Thanked
    0 times in 0 posts

    Smiley Parsing

    To insert smilies into our posts, we use specific phrases between colons (eek, mad, etc.) to denote the various images. However, when you use these within parenthesis, you may wind up with an unexpected result (This is an example. ). Of course, this can be worked around be putting a space between the end of the smilie and the closing parenthesis, but I'm sure I'm not the first to be tripped up.

    What I suggest is that, instead of first replacing the short colon-parenthesis, et al, smilie strings, the parsing engine be changed to first look for the colon-word-colon smilie types, and then the remaining short ones.

    Thanks for your time. semicolon-parenthesis

  2. #2
    Furry Shorty's Avatar
    Join Date
    Jul 2003
    Location
    Manchester, UK
    Posts
    1,237
    Thanks
    1
    Thanked
    2 times in 2 posts
    Negative. The smilie parse doesn't work like that. Unless you fancy rewriting the way PHP uses perl regular expressions
    "In a world without walls and fences, who needs Windows and Gates?"

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Location
    ZA ✈ UK
    Posts
    622
    Thanks
    0
    Thanked
    0 times in 0 posts
    Ahh. More's the pity, though. Thanks anyway. :>

  4. #4
    Sublime HEXUS.net
    Join Date
    Jul 2003
    Location
    The Void.. Floating
    Posts
    11,819
    Thanks
    213
    Thanked
    233 times in 160 posts
    • Stoo's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2*Xeon 5450 @ 2.8GHz, 12MB Cache
      • Memory:
      • 32GB 1600MHz FBDIMM
      • Storage:
      • ~ 2.5TB + 4TB external array
      • Graphics card(s):
      • ATI Radeon HD 4870
      • Case:
      • Mac Pro
      • Operating System:
      • OS X 10.7
      • Monitor(s):
      • 24" Samsung 244T Black
      • Internet:
      • Zen Max Pro
    We managed to get around it on Tangent21, but we have custom built our forums from the ground up..

    Not sure how much you'd want to hack about with the vBulletin guts, but I could ask our developer guy for the code if you wanted..
    (\__/)
    (='.'=)
    (")_(")

  5. #5
    Furry Shorty's Avatar
    Join Date
    Jul 2003
    Location
    Manchester, UK
    Posts
    1,237
    Thanks
    1
    Thanked
    2 times in 2 posts
    Quote Originally Posted by Stoo
    We managed to get around it on Tangent21, but we have custom built our forums from the ground up..

    Not sure how much you'd want to hack about with the vBulletin guts, but I could ask our developer guy for the code if you wanted..
    Im more than happy to .. it's just the way it's coded (efficently I might add), it's a total hackjob to bascially redo their parse engine and undo some very smart, clean work.
    "In a world without walls and fences, who needs Windows and Gates?"

  6. #6
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    Are the smilies parsed using regular expressions on vBulletin ? Seems like overkill as str_replace is a lot faster and you always know what the full string to replace is going to be. In that instance then it would be relatively easy to do as you would change the order of the parsing so that all smilies with words between the colons are replace first and then the rest would be done.

    The same would be true for regular expressions if there was any way to influence the sequence in which the smilies were added to the patterns which are being replaced. If the smilies are in the databse then a sequence column could be added and the SQL which reads them modified to order by sequence

    Shorty is the expert on vBulletin though

  7. #7
    Furry Shorty's Avatar
    Join Date
    Jul 2003
    Location
    Manchester, UK
    Posts
    1,237
    Thanks
    1
    Thanked
    2 times in 2 posts
    In VB2.x.x, they were parsed using str_replace.. my own smilies engine in my own code uses the same.

    With VB3.x.x, it's been changed. It's now using preg_replace() and preg_quote() to parse, to stop them being parsed in URL's and the such. (according to the comments in the parse functions).

    Right now, there is no order set for how they are pulled from the db. They are just built into arrays and then parsed in a loop.

    Thoughts?
    "In a world without walls and fences, who needs Windows and Gates?"

  8. #8
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    ah, I see the need for preg_replace now. If there's no set order (and realistically vBulletin probably didn't see a need for it) then you'd need to do what I mentioned and add a sequence column.

    It's probably not worth the effort though but if you have access to the bug/feature request people for vBulletin it might be worth suggesting it for the next version.

    Also, looks like I may need to rewrite the Hexus smilie parser now as well

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •