FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » FUDforum 3.0+ » preg_replace question
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
preg_replace question [message #159427] Tue, 02 June 2009 22:09 Go to next message
nozafc is currently offline  nozafc   United Kingdom
Messages: 75
Registered: April 2009
Karma: 0
Member
Hi I'm pretty new to regular expressions etc but I'm in the middle of trying to convert some add-ons I created for my 2.8.0 forum to plugins on the new 2.8.1 software. They basically just allow embedding video files from different sites. I could never quite get it 100% on the old software (they embedded you just couldn't quote/edited them without it turning into plain html)

I understood the issue was with the regex but never got round to fixing it as my users were happy enough. The new plugin system has got me back to wanting to fix the issue.

I've attached the code as I'm unable to include links

I'm pretty sure that the issue is with the regex part in the convert back to Fudcode section but I'll be damned if I can work it out!!

Any help would be appreciated.

Thanks.
  • Attachment: megavideo.zip
    (Size: 0.83KB, Downloaded 1001 times)
Re: preg_replace question [message #159428 is a reply to message #159427] Tue, 02 June 2009 23:23 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
You need to escape the two question marks in the last preg_replace.
Re: preg_replace question [message #159429 is a reply to message #159428] Wed, 03 June 2009 01:28 Go to previous messageGo to next message
nozafc is currently offline  nozafc   United Kingdom
Messages: 75
Registered: April 2009
Karma: 0
Member
naudefj wrote on Wed, 03 June 2009 00:23
You need to escape the two question marks in the last preg_replace.


Legend mate!!

Can't believe it was that simple, I assumed it was a Regex problem. Embarassed Surprised
Re: preg_replace question [message #159432 is a reply to message #159429] Wed, 03 June 2009 08:18 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Great pluging by the way. Hope you don't mind, but I've added it to the wiki at http://cvs.prohost.org/index.php/Megavideo.plugin

Best regards.

Frank
Re: preg_replace question [message #159433 is a reply to message #159427] Wed, 03 June 2009 09:43 Go to previous messageGo to next message
nozafc is currently offline  nozafc   United Kingdom
Messages: 75
Registered: April 2009
Karma: 0
Member
No problems at all

I made a small change to the wiki

In order to create embeddable code I had to use their preview player which displays a thumbnail image of the video before it loads. Because this couldn't be created dynamically (as there was no way to tell what the image file name would be) I simply substituted the image=http:\\.... to a hard-coded one which displays an image that is relevant to my site

The image bit isn't required so I just took it out from the wiki page.
Re: preg_replace question [message #159470 is a reply to message #159427] Thu, 04 June 2009 21:52 Go to previous messageGo to next message
nozafc is currently offline  nozafc   United Kingdom
Messages: 75
Registered: April 2009
Karma: 0
Member
I have another question similar to the one in the OP

I've created another plugin that allows the embedding of JustinTV videos. Once again I've got the embedding working but not the reverse html to bbcode.

What are the characters that need to be escaped , obviously I know that ? has to be escaped but I can't seem to find a definitive list online (my google kung-fu has failed me)
Re: preg_replace question [message #159477 is a reply to message #159470] Fri, 05 June 2009 05:40 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
This should help: http://www.php.net/manual/en/regexp.reference.php

When done, please share you plugin with the community by posting it on the wiki.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Obfuscating mailaddress when syncing with mailinglist?
Next Topic: Thanks!
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Dec 21 12:09:15 GMT 2024

Total time taken to generate the page: 0.02490 seconds