Need help: convert plugin (WordMatch) from WCF 1 to WCF 2.1.x

  • At Andoca Haustier-WG UG GitHub account: https://github.com/andoca I had found very useful plugin - WordMatch with open source GPL license ( https://github.com/andoca/WCF1-Wordmatch ).

    This plugin could be very useful for me, but it is dedicated for WBB 3.1.x. So I started to convert it for WCF 2.1.x/WBB 4.1.x, and made some progress (package is fixed and can be installed correctly into WBB 4.1.6, options are in ACP --> Options --> Messages), but plugin still does not work.

    I need some help to find and fix the problem. I'm almost sure that problem lies in WordMatchListener.class.php

    I had added namespace, switched to IParameterizedEventListener, but still nothing.

    Maybe I should add something more to "use" section? Or $classNames are wrong?

    Attached my version that is installable in WBB 4.1.6, but absolutely do not try this at live enviroment as it is installing, but failing to do its work and remember that code is on GPL license.

    de.0xdefec.wordmatch-1.3.1.beta.1.tar

    2 Mal editiert, zuletzt von PolUser (2. August 2015 um 10:22)

  • @Throwholics - @whitedragon got this plugin working in WCF2?

    @Zumarta - no errors, but You gave me an idea - somewhere in WBB is some debug option, maybe when I activate it, I will got some error so I will know what to fix, I will give this a try later :)
    EDIT: With debugging turned on still no errors and log is empty. Options are saved, but words are not replaced without any error message or warning :/

    @Morik - I know that, I'm trying to rewrite this plugin to make it compatible with WCF2 ;)

    Einmal editiert, zuletzt von PolUser (2. August 2015 um 20:31)

  • @Throwholics - @whitedragon got this plugin working in WCF2?

    @Zumarta - no errors, but You gave me an idea - somewhere in WBB is some debug option, maybe when I activate it, I will got some error so I will know what to fix, I will give this a try later :)
    EDIT: With debugging turned on still no errors and log is empty. Options are saved, but words are not replaced without any error message or warning :/

    @Morik - I know that, I'm trying to rewrite this plugin to make it compatible with WCF2 ;)


    I would wait until @whitedragon replies ;)
    Might be waste of time

  • In some free time I had tried to look at this, but without success :(
    Looks like WordMatchListener class is not even loaded at all, nothing is executed there, no PHP error, tried to trigger some error on my own, just nothing. Like WBB not seeing WordMatchListener.class.php at all :(

  • Thanks, I made some progress :)

    1) Changes in eventListener.xml
    - throw out <listenerclassfile> - looks like not needed anymore
    - throw out CDATA from <listenerclassname>, only clean path
    - <eventclassname> need to have now wcf\page\xxx, not only xxx, but I cannot find some pages. For example I know that PMViewPage is now wcf\page\ConversationPage, but what is ThreadPage current name?

    2) Changes in option.xml
    - throw out <options> inside <option>, because this lead to situation where some options are missing in plugin configuration

    3) Additional fixes in WordMatchListener.class.php
    - missing use wcf\util\ArrayUtil;
    - fix $className (working only for wcf\page\ConversationPage)
    - missing colon in one place (oops)

    Final results - this time plugin is registered - I'm able to throw PHP error in Conversation page. Anyway - still nothing is replaced

    Current problems (searching for solutions):
    - eventclassname values are different, to correctly register this plugin on all pages need to find out current page names
    - in Conversation: original call $eventObj->pmList->getObjects(); doesn't work now, I'm trying to find some replacement for it, tried:

    foreach ($eventObj->objectList as $conversation) {
    $this->replaceBBCodeString($conversation->message);
    }

    but not working

    - in replaceString function plugin is trying to call DOMDocument - this is failing

    Attached current version after changes if anybody would like to look at this ;) I'm going back to search here and at WCF on github...

    de.0xdefec.wordmatch-1.3.1.beta.1.tar

  • Hello again.

    Unfortunately I had completely failed with this and I got no idea how to push it further to fix this plugin. Looks like changes between WCF1 and WCF2 especially with eventlistener are too big for me :(

    Any help appreciated, maybe some advanced programmer from here would like to look at this (willing to pay - if anybody interested - please send PM with Your offer).

    My needs are replacing words (also with wildcards) in:
    - posts,
    - private messages,
    - eventually also in signatures
    All these including URL's (to replace "bad"/spam URL's)

  • Thanks for this suggestion, Your plugin is very nice and it is partial solution ;)

    URL's unfortunately are not primary need - I'm looking for something like it was in phpBB: if plugin will find prohibited word - replace it with defined replacement. Also in URL's but not only.

    Also as far as I see Your plugin is replacing domains when new post is created. I'm looking for something which would replace words on display so it would deal with old posts that are already got prohibited words inside. That's because phpBB did not replaced words in database, but only when displaying. When I did conversion from phpBB to WBB - all these bad words from old posts are uncensored and I'm not able to hide them in easy way.

    Wordmatch plugin was (probably - as far as I understand its code) doing exactly what I need (but not sure if it was dealing BBCodes also). Changes in eventlistener are so big, that after few months of trying to blindly fix this code I give up, I need help with this :(

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!