Support » Plugin: Antispam Bee » Request for Autoptimize compatibility

  • Hi there,

    I switched to Antispam Bee yesterday and it is an excellent plugin – thanks 🙂

    The only issue I have is that I also run the Autoptimize plugin by @optimizingmatters. This has an option to aggregate inline Javascript. With this option enabled and Antispam Bee installed, the Autoptimize cache fills up very quickly.

    The reason for this as I can see is that the Antispam Bee plugin inserts inline script into each page near the comment area, which seems to change on each post. The code to insert it is as follows (from line 1201 of antispam_bee.php)

    $id_script = '<script type="text/javascript">document.getElementById("comment").setAttribute( "id", "a' . substr( esc_js( md5( time() ) ), 0, 31 ) . '" );document.getElementById("' . esc_js( self::get_secret_id_for_post( self::$_current_post_id ) ) . '").setAttribute( "id", "comment" );</script>';

    Autoptimize recognises a script attribute, “data-noptimize”, which means the inline script won’t be inlined. So if line 1201 could be modified to:

    $id_script = '<script data-noptimize type="text/javascript">document.getElementById("comment").setAttribute( "id", "a' . substr( esc_js( md5( time() ) ), 0, 31 ) . '" );document.getElementById("' . esc_js( self::get_secret_id_for_post( self::$_current_post_id ) ) . '").setAttribute( "id", "comment" );</script>';

    This would definitely help. There’s also an option to exclude a script in Autoptimize by matching a pattern, but this script is fairly generic and doesn’t have a unique attribute I could use.

    Thanks 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • well researched @lozula , great work!

    for the antispam-bee developers; feel free to contact me at frank-at-optimizingmatters-dot-com if you have technical questions about Autoptimize

    frank

    Thanks frank (@optimizingmatters)! I noticed that you have had a few people commenting about growing cache folders recently, and this is a popular anti-spam plugin, so it might be a common thread 🙂

    Laurence

    Plugin Author websupporter

    (@websupporter)

    Hi @lozula,
    thanks for the detailed report! We will have a look into this for the next version and I have created an issue in our Github repository about Autoptimize: https://github.com/pluginkollektiv/antispam-bee/issues/278

    Thanks @optimizingmatters for offering your insights. I will investigate this issue a bit and if I have questions, I will contact you.

    Hello WebSupporter,

    Have you made any changes with respect to this thread? I’m using Autoptimize and would like to move forward with AntiSpam Bee.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.