Deko Boko 1.3 Now Available

Update 6/26: Please download version 1.3.1, as it contains an important bug fix. Also, for GitHub fans, I now also have Deko Boko on GitHub.


It’s been almost two years since I last updated my Deko Boko contact form plugin. The new version is now available at wordpress.org. It started as a fix to a minor bug that was recently reported, and grew into a significant overhaul. This version updates the reCAPTCHA library code, as the reCAPTCHA project is now managed through Google. It includes several other minor enhancements and bug fixes (see the change log if you’re really curious). Note you will need to install Toppa Plugin Libraries for WordPress to use it.

This is the first round of refactoring Deko Boko. It has exactly one unit test now! Hey, it’s a start. I’ll turn my attention back to finishing work on Shashin before I do more with it (Deko Boko is much less complex than Shashin, so updating it was not nearly as involved).

47 Comments

  1. Reply
    Robert Heller June 24, 2011

    When I updated FDeko Boko (after installing and activating Toppa Plugin Libraries for WordPress) I get this error message: “Fatal error: Class ‘DekoBoko’ not found in /var/www/deepsoft/WWW/wp-content/plug”. I backed out of the update by restoring the previous version.

  2. Reply
    Mike June 24, 2011

    Hi Robert – it looks like you pasted only the half of the error message (the rest of the file path is missing, and the line number of the error). If possible, please provide the whole message so I can have a better sense of what is going wrong for you.

  3. Reply
    Robert Heller June 25, 2011

    The complete error message is:

    Fatal error: Class ‘DekoBoko’ not found in /var/www/deepsoft/WWW/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/start.php on line 19

  4. Reply
    Mike June 25, 2011

    I just uploaded a new version, but I don’t think it will fix the problem you’re having. Please update to 1.3.1 to make sure.

    If it is still broken, and you’re comfortable editing code, please open ToppaAutoLoaderWp.php in the toppa libraries plugin, and look for the following (line 33)

    public function includeClass() {

    Add a new line after that, with this code:

    var_dump($this->className); var_dump($this->fullPath);

    Then go to your page displaying the contact form. There should be a bunch of output, which will be easier to read if you go to “view source” in your browser. What I’m looking for is something similar to:

    string(8) "DekoBoko"
    string(101) "/opt/lampp/htdocs/wordpress/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/DekoBoko.php"

    What’s peculiar about the error you’re having is that the line before your reported error is loading a different class, which apparently is working fine, so that tells me the class autoloader is working in general, but for some reason isn’t working for the Deko Boko class.

    If you’re not comfortable editing code, send me message through my contact form (mine is working!). Then I’ll have your email and can send you a file to test with.

    • Reply
      Robert Heller June 26, 2011

      New error message upon activation (after editing ToppaFunctionsFacadeWp.php).

      string(22) “ToppaFunctionsFacadeWp” string(104) “/var/www/deepsoft/WWW/wp-content/plugins/toppa-plugin-libraries-for-wordpress/ToppaFunctionsFacadeWp.php” string(8) “DekoBoko” string(90) “/var/www/deepsoft/WWW/wp-content/plugins/toppa-plugin-libraries-for-wordpress/DekoBoko.php”
      Fatal error: Class ‘DekoBoko’ not found in /var/www/deepsoft/WWW/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/start.php on line 19

      And oh, yes, I am *very* comfortable editing code — been doing that for like 40 years…

      And from the above, it looks like somehow, the Toppa library is getting the full path to DekoBoko.php wrong — it is trying to load it from the toppa-plugin-libraries-for-wordpress directory and NOT from the deko-boko-a-recaptcha-contact-form-plugin directory…

      • Reply
        Mike June 26, 2011

        Hi Robert – was that all of the output? There are two base directories that get registered with the autoloader in Deko Boko’s start.php file. One is the toppa plugins directory, and the other is the Deko Boko directory. So it’s actually ok if it’s looking in the toppa plugins directory, but it should also look in the Deko Boko directory. For some reason, on your server, the registration of the Deko Boko directory with the autoloader does not seem to be working.

        A few things:

        1. Please try switching the order of lines 16 and 17 (registering deko boko with the autoloader before toppa plugins). I’m curious if that will make a difference.

        2. What version of PHP are you using?

        3. Did you change the name of the Deko Boko plugin directory? That would break it.

  5. Reply
    Robert Heller June 26, 2011

    1)

    After swaping the autoloader lines I am getting:

    string(22) “ToppaFunctionsFacadeWp” string(109) “/var/www/deepsoft/WWW/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/ToppaFunctionsFacadeWp.php”
    Fatal error: Class ‘ToppaFunctionsFacadeWp’ not found in /var/www/deepsoft/WWW/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/start.php on line 18

    I changed the code back to what it was.

    2) On my test server (also my desktop): php-5.1.6-27.el5_5.3 (I run CentOS 5.6)
    On my production server: php-5.1.6-3.el4s1.10 (I run CentOS 4.9, using PHP from the CentOSPlus repo).

    3) No, I did not change the name. The protection is different: I changed the *group* and *group* mode (group write, group sticky on directories), to make it easier to make modifications (test server) and perform backups (production server).

  6. Reply
    Robert Heller June 26, 2011

    As an additional test I added additional var_dump lines:

    public function __construct($relativePath = null) {
    var_dump(‘ToppaAutoLoaderWp::__construct(‘.$relativePath.’)’);

    public function loader($className) {
    var_dump(‘ToppaAutoLoaderWp::loader(‘.$className.’)’);

    and

    public function setClassName($className) {
    var_dump(‘ToppaAutoLoaderWp::setClassName(‘.$className.’)’);

    and get this when I attempt to activate DekoBoko:

    tring(69) “ToppaAutoLoaderWp::__construct(/toppa-plugin-libraries-for-wordpress)” string(74) “ToppaAutoLoaderWp::__construct(/deko-boko-a-recaptcha-contact-form-plugin)” string(49) “ToppaAutoLoaderWp::loader(ToppaFunctionsFacadeWp)” string(55) “ToppaAutoLoaderWp::setClassName(ToppaFunctionsFacadeWp)” string(22) “ToppaFunctionsFacadeWp” string(104) “/var/www/deepsoft/WWW/wp-content/plugins/toppa-plugin-libraries-for-wordpress/ToppaFunctionsFacadeWp.php” string(35) “ToppaAutoLoaderWp::loader(DekoBoko)” string(41) “ToppaAutoLoaderWp::setClassName(DekoBoko)” string(8) “DekoBoko” string(90) “/var/www/deepsoft/WWW/wp-content/plugins/toppa-plugin-libraries-for-wordpress/DekoBoko.php”
    Fatal error: Class ‘DekoBoko’ not found in /var/www/deepsoft/WWW/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/start.php on line 19

    Wondering: is this code in includeClass() correct:

    else {
    return @include($this->fullPath);
    }

    in that does it *properly* handle the case where the file in question does NOT exist? Would it make sense to change it to:

    else if (file_exists($this->fullPath)) {
    return @include($this->fullPath);
    } else {
    return false;
    }

    ??

    • Reply
      Mike June 27, 2011

      Thanks for the detailed feedback Robert. The include statement itself will return false (the @ suppresses the additional warning that is also normally thrown). I’ve been researching this and I cannot say for sure what the problem is. I strongly suspect that it’s a difference between PHP 5.1.x and 5.2.x (I’m running 5.2). php.net does not mention any changes in spl_autoload_register between these versions, but my hunch is that there must be some difference in behavior. Unfortunately I do not have a server with PHP 5.1 to experiment with.

      As a temporary solution, please go back to the original version of start.php and comment out lines 16 and 46 (the lines that define $toppaAutoLoader). Then right after each of those lines add

      require_once dirname(__FILE__) . '/../toppa-plugin-libraries-for-wordpress/ToppaFunctionsFacadeWp.php';

      Since your version of PHP only seems to like having one autoloader defined, this will replace the autoloader used for getting the ToppaFunctionsFacade class file with a direct require_once statement. That should get you up and running while I figure this out.

  7. Reply
    Robert Heller June 30, 2011

    At this point I think I will just stick with the older version of Deko Boko (1.2.2) on my production server, at least until it is determined what the autoloader deal is with PHP 5.1.x or until such time as I upgrade to CentOS 6 (which is not happening anytime soon). I’ll probably end up reverting my test system back to Deko Boko 1.2.2 (this will happen the next time I sync things, probably this weekend).

    • Reply
      Mike July 2, 2011

      Hi Robert – thanks for taking the time to help debug it. Since I’m guessing at the cause of why this is happening on your site, I don’t want to guess at putting a fix in the source code. If I get a report from someone else having the same problem, I’ll dig deeper.

  8. Reply
    Brett Cashman July 2, 2011

    Running into problems with this since upgrading as well: when I go to the config page I see only the first reCAPTCHA public key text field, plus the following: “f you are already using the WP-reCAPTCHA plugin for comments, Deko Boko will use the API key you’ve already set. If you are not using the WP-reCAPTCHA plugin, then you need to get a”

    The config page is otherwise blank. There’s no error message anywhere that I can ascertain.

  9. Reply
    Mike July 2, 2011

    Hi Brett – I found the bug that was causing this under certain circumstances. Thanks for reporting it. I just uploaded a fix: http://wordpress.org/extend/plugins/deko-boko-a-recaptcha-contact-form-plugin/

  10. Reply
    Brett Cashman July 2, 2011

    Mike — Thanks, it seems to work fine, now. Appreciate the quick fix.

  11. Reply
    ccalp July 3, 2011

    please change the version number 1.3.1 >> 1.3.2

    • Reply
      Mike July 3, 2011

      I did, but something is wrong in the wordpress repository. I’ve already submitted a notification. You will actually get 1.3.2. if you download it. For some reason 1.3.2 is listed under “other versions” in the “compatibility” widget.

  12. Reply
    ccalp July 4, 2011

    Fatal error: You must install the plugin “Toppa Plugin Libraries for WordPress” to use Deko Boko (this is not actually a PHP error) in D:inetpub……comwwwwp-contentpluginsdeko-boko-a-recaptcha-contact-form-pluginstart.php on line 41

    sorry.. not worl 🙁

  13. Reply
    ccalp July 4, 2011

    ok fixed 🙂

  14. Reply
    Eric July 8, 2011

    1.3.2 install did not work. I get “Plugin could not be activated because it triggered a fatal error.” I tried deleting the pluging and installing it again and got the same error.

    Is there a fix for this?

    thanks!

    • Reply
      Mike July 8, 2011

      Hi Eric – yours is the first report of an error like this. So I can narrow down the possibilities, please let me know:

      1. if you installed the Toppa Plugin Libraries for WordPress first (you probably did, as you should have gotten an error message specifically about it if you didn’t)
      2, your version of PHP (if you’re not sure, your hosting provider can tell you)
      3. if you had a previous version of Deko Boko installed
      4. if you also have the Wp-recaptcha plugin (for comments) installed

  15. Reply
    Eric July 8, 2011

    Wow. Thanks for the amazingly fast response! It was my own stupid fault for not installing Toppa Plugin Libraries, though I did not receive an error message about it. So it is now working fine.

    Thanks!

    p.s.
    Shashin and Deko Boko are fantastic. I’m looking forward to Shashin 3. Thanks for all your hard work. Did there used to be a “buy me a coffee” link on your blog? I’d happily chip in a few bucks.

    • Reply
      Eric July 8, 2011

      Found the donate link. Just sent you some love.

      🙂

  16. Reply
    James July 18, 2011

    Hey Mike,

    I am using the plugin on my site, it works fine in Google Chrome, and Firefox (though in chrome it gives me this error log:

    “Uncaught TypeError: Cannot set property ‘innerHTML’ of null
    Recaptcha._init_builtin_themerecaptcha.js:15
    Recaptcha._finish_widgetrecaptcha.js:19
    Recaptcha.challenge_callbackrecaptcha.js:13
    (anonymous function)jiaranai.com:1
    d.d.extend.globalEvaljquery.min.js:16
    bajquery.min.js:16
    d.d.extend.eachjquery.min.js:16
    d.fn.extend.domManipjquery.min.js:16
    d.fn.extend.appendjquery.min.js:16
    atjquery.jscrollpane.min.js:8
    djquery.jscrollpane.min.js:11
    b.fn.jScrollPanejquery.jscrollpane.min.js:11
    d.d.extend.eachjquery.min.js:16
    d.d.fn.d.eachjquery.min.js:16
    b.fn.jScrollPanejquery.jscrollpane.min.js:11
    (anonymous function)jiaranai.com:29
    d.d.extend._Deferred.f.resolveWithjquery.min.js:16
    d.d.extend.readyjquery.min.js:16
    d.c.addEventListener.Ajquery.min.js:16”

    but the webpage is still able to run fine. However, in Internet explorer 8 it will crash…

    I have tested using a clean install and the default contact form.

    Sometimes it just crash right away, sometime it gives me this error log

    “Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
    Timestamp: Mon, 18 Jul 2011 12:35:21 UTC

    Message: ‘Recaptcha.widget’ is null or not an object
    Line: 15
    Char: 281
    Code: 0
    URI: http://www.google.com/recaptcha/api/js/recaptcha.js

    Message: ‘Recaptcha’ is undefined
    Line: 1
    Char: 1
    Code: 0

    Any ideas why?

    Thanks : )

  17. Reply
    Mike July 18, 2011

    Thanks *very* much for the detailed error logging. I will see if I can figure it out.

  18. Reply
    James July 18, 2011

    Hey Mike,

    I found out that the problem occurs when the contact form is inside a scroll area with JScrollPane (http://jscrollpane.kelvinluck.com/) activated, not exactly sure why though.

    Also, as an aside, I noticed that the form retains previous values for the text field if some required fields were not entered correctly, how do I do this for drop down list? Additionally, how can I customize the form so that the email sent will not include fields which are not required and are empty?

    Thanks again ! : )

  19. Reply
    Mike July 18, 2011

    Thanks for the followup. Just to make sure I understand – you’re seeing these errors in IE8 or Chrome only when using JScrollPane?

    Your other two requests are not features currently available. But they’re both good ideas. I’ll plan to add them.

  20. Reply
    Pratik Sinha July 18, 2011

    Getting the below error in the “Page Slugs/IDs” text box on the settings page. What could be the reason?

    Warning:
    implode()
    [function.implode]:
    Invalid
    arguments
    passed
    in
    /home/humbug/humbug.in/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/display/settings.php
    on
    line
    73

    • Reply
      Pratik Sinha July 18, 2011

      I also still get this error, which used to be the problem with deko boko earlier and which is why I had to look for a different contact form plugin.

      ReCAPTCHA error: your captcha response was incorrect – please try again

      • Reply
        Mike July 19, 2011

        I generate the captcha error message based on the response from recaptcha that your response was incorrect – it’s recaptcha’s analysis of your input. Do you get this error every time?

        • Reply
          Pratik Sinha July 19, 2011

          Yes I do get the error every single time. Infact the email goes through, and I get the email, but it shows the error on the frontend.

    • Reply
      Mike July 19, 2011

      Hi Pratik – can you let me know what you are typing into the Page Slugs box?

      • Reply
        Mike July 19, 2011

        I see it – it happens when you leave the box blank. I’ll post a fix,

  21. Reply
    James July 19, 2011

    Hi Mike,

    Yep that’s right, it happens when I use the form inside the JScrollpane. Every browser will complain that something is wrong, but in Internet explorer 8, it will crash.

    • Reply
      Mike July 20, 2011

      Hi James- I’m using recaptcha in its recommended fashion. It looks to me like JSCrollPane is tweaking browser behavior. Since recaptcha works fine otherwise, I’d say this is something to take up with the JScrollPane author.

  22. Reply
    James July 21, 2011

    Hi Mike,

    Yep, I’ll notify the JScrollPane author. Thanks a lot for looking into the problem. Really appreciate it, great work on the plugin : D

    Have a nice day.

    Cheers,

    James

  23. Reply
    Andreas November 4, 2011

    Hi there,

    after installing Toppa Plugins Libraries for WordPress
    my whole page turned blank! Help me! I cant login or anything. It is a site for a primary school. Now it is gone!
    What went wrong?
    I’m hoping for a quick response!

    greetings,

    Andreas

  24. Reply
    Robert Heller November 4, 2011

    Help! I am having a problem with Deko Boko (V 1.3.5). I am getting the message “ReCAPTCHA error: your captcha response was incorrect – please try again”. The contact form is in fact sending the message. This is on http://www.deepsoft.com/ (specific page: http://www.deepsoft.com/freeconsultation/). I updated my ReCAPTCHA keys. I also have WP-ReCAPTCHA installed and it works just fine. I have another site (http://www.wendellfullmoon.org/mission-statement/beneficiary-policies/), using the same keys (I have a ‘global’ key), also with a custom Deko Boko contact form and it works just fine.

    What is going on here?

    • Reply
      Mike November 4, 2011

      Hi Robert – is the problem 1. that the captcha response was incorrect, and then the email is being sent anyway or, 2. that the captcha response was correct, and the email was sent correctly, but the error message should not display?

      Also, does the problem happen every time, or just in some cases?

  25. Reply
    Robert Heller November 4, 2011

    Case 2: that the captcha response was correct, and the email was sent correctly, but the error message should not display.

    I am pretty sure the captcha response was correct. The mail is being sent, but it is displaying the error message for no good reason.

    I double checked to be sure the keys are correct.

  26. Reply
    Robert Heller November 4, 2011

    Interestingly, if I leave the recaptcha response *blank* I get the error message *twice* (and the message is NOT sent).

  27. Reply
    Mike November 4, 2011

    Hi Robert – I was noticing the messages we exchanged back in June. Is the site having the problem now the same one that was having problems then? If so, I’m wondering if it’s some variation on the server environment problem we ran into before. I haven’t had another report like this, and you said your other site is ok, so that’s what’s got me wondering….

  28. Reply
    Robert Heller November 4, 2011

    The working site is on the *same* server, so it probably isn’t a server environment issue. The themes are different and there is a different collection of plugins though. Same (up-to-date) version of WordPress.

    • Reply
      Robert Heller November 4, 2011

      I put in some debugging code and it appears that the shortcode function is being evaluated *twice*. This is strange…

  29. Reply
    Robert Heller November 4, 2011

    OK, the problem is the HeadSpace2 plugin, which seems to invoke the Deko Boko shortcode *twice*, which seems to be problematical.

    I’m going to file a bug report on HeadSpace2, unless there is some reason Deko Boko should tolerate double invokation…

    • Reply
      Mike November 6, 2011

      Hi Robert – thanks *very* much for tracking that down. If the Headspace2 folks get back to you, let me know what you find out. Thanks again!

Leave a Reply to MikeCancel reply