The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
Strange. The above works for me, so I'm not sure what to try.
|
#12
|
|||
|
|||
Yes, it is very strange.
I deleted the plugin, created another one, copied the same code above, and tested. Doesn't work at all. EDIT: Changed the preg_replace to str_replace, and it worked (however, without the boundaries). preg_replace is indeed returning null here, and I can't understand why. --------------- Added [DATE]1328410811[/DATE] at [TIME]1328410811[/TIME] --------------- Ok, here we have some news: I was wondering why preg_replace remains returning NULL, even with silly/obvious examples. I changed it to str_replace and it worked. However, I need to manipulate strings in such a way that str_replace can't. I've searched for the preg_replace returning NULL issue, and found this link: http://www.pelagodesign.com/blog/200...-returns-null/ Quote:
After that, in the admincp->maintenance-> PHP Info, I've found this: Directive Local Value Master Value pcre.backtrack_limit -1 20000000 pcre.recursion_limit 20000000 20000000 So, what I need now is to change the local value to the master value, which I don't know how to :S Any ideas? Thanks in advance! |
#13
|
|||
|
|||
Update: it's ok now, I've solved it and it works perfectly.
The problem was indeed that variable, pcre.backtrack_limit. I changed my php.ini file to raise its value, but its local value was still at -1. Then I've found that there's a config file in the vbulletin installation called init.php, which has this line: @ini_set('pcre.backtrack_limit', -1); That was keeping the variable so low, and this is why code was always returning NULL. I commented this line, and it began to work. Well, guess that's it, hope I'm also able to help someone with this. Cya! |
Благодарность от: | ||
kh99 |
#14
|
|||
|
|||
I guess it worked for me because I don't have 5.3.
Anyway, thanks for posting that. |
#15
|
||||
|
||||
Uhm... which hook should I chose to limit it to things in postbit?
|
#16
|
|||
|
|||
The above uses hook postbit_display_complete. I should probably have directed you to the thread mentioned in the first post, which is here: https://vborg.vbsupport.ru/showthread.php?t=219968
|
#17
|
||||
|
||||
HTML Code:
$censoredword = array( 'word1', 'word2' ); $changedword = array( 'word3', 'word4' ); $this->post['message'] = str_ireplace($censoredword, $changedword, $this->post['message']); PHP Code:
PHP Code:
|
#18
|
|||
|
|||
You can have either one replacement for all words or a separate replacement for each word. But if you only want one replacement I think it might have to be a string instead of an array, like:
PHP Code:
|
#19
|
||||
|
||||
None of the two seemed to work >.<
|
#20
|
|||
|
|||
Well, I tried it with exactly the code above and it works, so maybe you have a typo somewhere? I'd suggest you post your code but I suppose it contains bad language.
ETA: or maybe it's just not working like you expected? Like Lynne mentioned in the other thread, this only changes it just before a post is displayed, so there are probably some situations where the swear word would be seen (like an RSS feed maybe?). If you want to change it permanently when the post is saved (which is the way the build-in censoring works), I think you could use hook newpost_process and code like this: PHP Code:
I suppose a disadvantage to this way is that it won't change any existing swear words. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|