The Serendipity Handbook

You can now read the (german) handbook here: PDF - https://github.com/s9y/Book (LaTeX source).

Forum-Information

Before posting about errors, make sure that the answer cannot already be found in our FAQ or by searching this forum!
Posting is restricted to registered users (registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.

Board index Plugins understanding spamblock bee plugin...

Creating and modifying plugins.
User avatar
blog.brockha.us
Regular
 
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany

Postby blog.brockha.us » Tue Sep 25, 2012 12:09 pm

Found the problem..

Janek added a constructor to the plugin that is not compatible with the s9y plugin framework :? :

Code: Select all
    function serendipity_event_spamblock_bee() {


Replace this line with these two lines and the plugin will save its configuration correctly again:

Code: Select all
    function serendipity_event_spamblock_bee($instance) {
        $this->instance = $instance;


I will put an update to Spartacus fixing that.

Btw..

I thing, because of changes made for PHP5 it is a very bad idea to add constructors to plugins, as the code for constructor inheritance is not safe over all PHP versions.

At the moment

parent::serendipity_event($instance)

would work, but it the S9Y framework is updated to PHP5 with new constructors, this code would crash.

This is a question for the PHP gurus (I am not! :lol:). How do we assure constructor inheritance working? By always using old style constructors?

The fun part: Even the plugin framework itself is not using constructor inheritance but is reproducing the constructor code instead (as I did for the bee fix).

(OOP in PHP is a complete mess IMHO..)
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

Previous


Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest

cron