I have a value named threadinfo['preview'], it is in vbulletin script I want to make a plugin, php code that : do not allow word starting with http://, so that no url appear in the value threadinfo['preview'] so that for example the value = "http://forums.digitalpoint.com/images/smilies/tongue.gif hi I would like to introduce my self to all, I am new at PHP..." looks like:"hi I would like to introduce my self to all, I am new at PHP..." I am really new at PHP and any help would be appreciated
make it so that the threadinfo preview command is used with javascript attached and ensure that the callback / result given for the command being taken shows only the title of the thread rather than the url and title or something of that area. It's all about getting it to be %threadtitle, for example
ok, but this is not what i am asking about, if I wanted the thread title I ll just use its predefined value, threadinfo['title'] how ever I want the first words of the post, which are found in threadinfo['preview'] BUT skip any URL thanks for the try
Are you absolutely sure that each value will start with a url? value = "http://forums.digitalpoint.com/images/smilies/tongue.gif hi I would like to introduce my self to all, I am new at PHP..." If so you could use a preg query and say the following: capture the following http://[any character except the space] [<- capture here ->] The preg query for such a task is as follows: .*?http://[^ ]*(.*?)" Let me know if that helps.
thanks jeff I think you are so close to the answer I need however, not all threadinfo['preview'] start with url ! as I said I am very new at PHP so if I have a plugin in this value how should it look like?
Try: This **should look for all URLS in a string and get rid of them. $string = preg_replace("/(http:\/\/[^\s]+)/", "", $string); PHP: