Plugin Directory

Changeset 500281


Ignore:
Timestamp:
02/04/2012 07:00:09 PM (14 years ago)
Author:
GabSoftware
Message:

fixed javascript issue with ie8

Location:
gab-captcha-2
Files:
1 deleted
2 edited
10 copied

Legend:

Unmodified
Added
Removed
  • gab-captcha-2/tags/1.0.20/gabcaptcha2.php

    r483937 r500281  
    55Description: Simple captcha plugin for Wordpress comments.
    66Author: Gabriel Hautclocq
    7 Version: 1.0.19
     7Version: 1.0.20
    88Author URI: http://www.gabsoftware.com
    99Tags: comments, spam, bot, captcha, turing, test, challenge, protection, antispam
     
    2828$gabcaptcha2_version_maj = 1;
    2929$gabcaptcha2_version_min = 0;
    30 $gabcaptcha2_version_rev = 19;
     30$gabcaptcha2_version_rev = 20;
    3131$gabcaptcha2_version = "{$gabcaptcha2_version_maj}.{$gabcaptcha2_version_min}.{$gabcaptcha2_version_rev}";
    3232
     
    6666         *  Start session
    6767         */
    68         session_start();
     68        if( ! isset( $_SESSION ) )
     69        {
     70            session_start();
     71        }
    6972        if( ! isset( $_SESSION['gabcaptcha2_id'] ) || ! isset( $_SESSION['gabcaptcha2_session'] ) )
    7073        {
     
    915918            }
    916919
     920
     921            // IE HACK: Define _importNode for IE since it doesnt support importNode
     922            if( ! document.importNode )
     923            {
     924                document._importNode = function( oNode, bImportChildren )
     925                {
     926                    var oNew;
     927                    if( oNode.nodeType == 1 )
     928                    {
     929                        oNew = document.createElement( oNode.nodeName );
     930                        for( var i = 0; i < oNode.attributes.length; i++ )
     931                        {
     932                            if( oNode.attributes[i].nodeValue != null && oNode.attributes[i].nodeValue != '' )
     933                            {
     934                                var attrName = oNode.attributes[i].name;
     935                                if( attrName == "class" )
     936                                {
     937                                    oNew.setAttribute( "className", oNode.attributes[i].value );
     938                                }
     939                                //else
     940                                //{
     941                                    oNew.setAttribute( attrName, oNode.attributes[i].value );
     942                                //}
     943                            }
     944                        }
     945                        if( oNode.style != null && oNode.style.cssText != null )
     946                        {
     947                            oNew.style.cssText = oNode.style.cssText;
     948                        }
     949                    }
     950                    else if( oNode.nodeType == 3 )
     951                    {
     952                        oNew = document.createTextNode( oNode.nodeValue );
     953                    }
     954                    else if( oNode.nodeType == 8 )
     955                    {
     956                        oNew = document.createComment( oNode.nodeValue );
     957                    }
     958                    else
     959                    {
     960                        oNew = document.createTextNode(''); // Skip anything else and prepare to return an empty text node
     961                    }
     962                    if( bImportChildren && oNode.hasChildNodes() )
     963                    {
     964                        for( var oChild = oNode.firstChild; oChild; oChild = oChild.nextSibling )
     965                        {
     966                            oNew.appendChild( document._importNode( oChild, true ) );
     967                        }
     968                    }
     969                    return oNew;
     970                }
     971            }
     972            // IE HACK (end)
     973
     974
    917975            var captchatarget = gabcaptcha2_getElementByIdUniversal( '<?php echo $_SESSION['gabcaptcha2_id']; ?>' );
    918976
     
    938996            var xml = loadXMLString( '<root xmlns="http://www.w3.org/1999/xhtml"><?php echo $gc_final_output; ?></root>' );
    939997            var nodes = xml.documentElement.childNodes;
    940             for( i = 0, n = nodes.length; i < n; i++ )
    941             {
    942                 node.appendChild( nodes[i].cloneNode( true ) );
     998            var external_node = null;
     999            var local_node = null;
     1000            for( var i = 0, n = nodes.length; i < n; i++ )
     1001            {
     1002                /* import the node from the xml document */
     1003                external_node = nodes[i].cloneNode( true );
     1004                if( document.importNode )
     1005                {
     1006                    local_node = document.importNode( external_node, true);
     1007                    node.appendChild( local_node );
     1008                }
     1009                else
     1010                {
     1011                    local_node = document._importNode( external_node, true);
     1012                    node.appendChild( local_node );
     1013                    node.innerHTML = node.innerHTML;
     1014                }
    9431015            }
    9441016            captchatarget.appendChild( node );
  • gab-captcha-2/tags/1.0.20/readme.txt

    r483925 r500281  
    55Requires at least: 3.0.0
    66Tested up to: 3.3.0
    7 Stable tag: 1.0.19
     7Stable tag: 1.0.20
    88
    99Gab Captcha 2 is a simple captcha plugin for fighting spam in WordPress comments.
     
    118118== Changelog ==
    119119
     120= 1.0.20 =
     121* Corrected a Javascript issue in IE8
     122
    120123= 1.0.19 =
    121124* Added an option for legacy themes compatibility. Legacy themes often do not use the comment_form() function that brings several actions and filters. Check this option if the captcha doesn't appear since update 1.0.15. The only action used will be "comment_form" and JavaScript will be used compulsory.
  • gab-captcha-2/trunk/gabcaptcha2.php

    r483937 r500281  
    55Description: Simple captcha plugin for Wordpress comments.
    66Author: Gabriel Hautclocq
    7 Version: 1.0.19
     7Version: 1.0.20
    88Author URI: http://www.gabsoftware.com
    99Tags: comments, spam, bot, captcha, turing, test, challenge, protection, antispam
     
    2828$gabcaptcha2_version_maj = 1;
    2929$gabcaptcha2_version_min = 0;
    30 $gabcaptcha2_version_rev = 19;
     30$gabcaptcha2_version_rev = 20;
    3131$gabcaptcha2_version = "{$gabcaptcha2_version_maj}.{$gabcaptcha2_version_min}.{$gabcaptcha2_version_rev}";
    3232
     
    6666         *  Start session
    6767         */
    68         session_start();
     68        if( ! isset( $_SESSION ) )
     69        {
     70            session_start();
     71        }
    6972        if( ! isset( $_SESSION['gabcaptcha2_id'] ) || ! isset( $_SESSION['gabcaptcha2_session'] ) )
    7073        {
     
    915918            }
    916919
     920
     921            // IE HACK: Define _importNode for IE since it doesnt support importNode
     922            if( ! document.importNode )
     923            {
     924                document._importNode = function( oNode, bImportChildren )
     925                {
     926                    var oNew;
     927                    if( oNode.nodeType == 1 )
     928                    {
     929                        oNew = document.createElement( oNode.nodeName );
     930                        for( var i = 0; i < oNode.attributes.length; i++ )
     931                        {
     932                            if( oNode.attributes[i].nodeValue != null && oNode.attributes[i].nodeValue != '' )
     933                            {
     934                                var attrName = oNode.attributes[i].name;
     935                                if( attrName == "class" )
     936                                {
     937                                    oNew.setAttribute( "className", oNode.attributes[i].value );
     938                                }
     939                                //else
     940                                //{
     941                                    oNew.setAttribute( attrName, oNode.attributes[i].value );
     942                                //}
     943                            }
     944                        }
     945                        if( oNode.style != null && oNode.style.cssText != null )
     946                        {
     947                            oNew.style.cssText = oNode.style.cssText;
     948                        }
     949                    }
     950                    else if( oNode.nodeType == 3 )
     951                    {
     952                        oNew = document.createTextNode( oNode.nodeValue );
     953                    }
     954                    else if( oNode.nodeType == 8 )
     955                    {
     956                        oNew = document.createComment( oNode.nodeValue );
     957                    }
     958                    else
     959                    {
     960                        oNew = document.createTextNode(''); // Skip anything else and prepare to return an empty text node
     961                    }
     962                    if( bImportChildren && oNode.hasChildNodes() )
     963                    {
     964                        for( var oChild = oNode.firstChild; oChild; oChild = oChild.nextSibling )
     965                        {
     966                            oNew.appendChild( document._importNode( oChild, true ) );
     967                        }
     968                    }
     969                    return oNew;
     970                }
     971            }
     972            // IE HACK (end)
     973
     974
    917975            var captchatarget = gabcaptcha2_getElementByIdUniversal( '<?php echo $_SESSION['gabcaptcha2_id']; ?>' );
    918976
     
    938996            var xml = loadXMLString( '<root xmlns="http://www.w3.org/1999/xhtml"><?php echo $gc_final_output; ?></root>' );
    939997            var nodes = xml.documentElement.childNodes;
    940             for( i = 0, n = nodes.length; i < n; i++ )
    941             {
    942                 node.appendChild( nodes[i].cloneNode( true ) );
     998            var external_node = null;
     999            var local_node = null;
     1000            for( var i = 0, n = nodes.length; i < n; i++ )
     1001            {
     1002                /* import the node from the xml document */
     1003                external_node = nodes[i].cloneNode( true );
     1004                if( document.importNode )
     1005                {
     1006                    local_node = document.importNode( external_node, true);
     1007                    node.appendChild( local_node );
     1008                }
     1009                else
     1010                {
     1011                    local_node = document._importNode( external_node, true);
     1012                    node.appendChild( local_node );
     1013                    node.innerHTML = node.innerHTML;
     1014                }
    9431015            }
    9441016            captchatarget.appendChild( node );
  • gab-captcha-2/trunk/readme.txt

    r483925 r500281  
    55Requires at least: 3.0.0
    66Tested up to: 3.3.0
    7 Stable tag: 1.0.19
     7Stable tag: 1.0.20
    88
    99Gab Captcha 2 is a simple captcha plugin for fighting spam in WordPress comments.
     
    118118== Changelog ==
    119119
     120= 1.0.20 =
     121* Corrected a Javascript issue in IE8
     122
    120123= 1.0.19 =
    121124* Added an option for legacy themes compatibility. Legacy themes often do not use the comment_form() function that brings several actions and filters. Check this option if the captcha doesn't appear since update 1.0.15. The only action used will be "comment_form" and JavaScript will be used compulsory.
Note: See TracChangeset for help on using the changeset viewer.