Kategorien
Development WWW

Contact Form 7 – Scripts, styles and reCaptcha only on certain pages

Many people are using the WordPress Plugin „Contact Form 7“ for displaying and managing their contact forms. The plugin is definitely a musthave if you have no idea, how to integrate a contact form into your WordPress blog. As a contact form is one of the many used ways to flood your inbox with spam mails, the plugin also integrates the Google reCaptcha Service to prevent you from being bombed by spam mails. The plugin author changed the integration to version 3 some time ago which lead to the problem, that the little reCaptcha overlay is displayed on every page of your blog. Some people will find that okay but in my opinion, this should be fixed. After I did some research in the plugin’s forum on wordpress.org I found some working solutions, but there was always something missing. Either the CSS styles were loaded on every page or you had to define the ids of the pages, on which the assets of the plugin had to be loaded.

Kategorien
Development

[jQuery] Serialize List Plugin

Mike Botsko hat ein nettes Plugin für jQuery geschrieben, mit dem eine unordered list <ul> „serialisiert“ werden kann, um sie dann mit PHP o.ä. weiterverarbeiten zu können.
Der Quelltext des Plugins sieht wie folgt aus:

(function($){
    $.fn.serializelist = function(options) {
        /**
         * jQuery Serialize List
         * Copyright (c) 2009 Mike Botsko, Botsko.net LLC
         * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
         * Copyright notice and license must remain intact for legal use
         * Version 1
         *
         * Serialize an unordered or ordered list item. Optional ability
         * to determine which attributes are included. The serialization
         * will be read by PHP as a multidimensional array which you may
         * use for saving state.
         */

        // Extend the configuration options with user-provided
        var defaults = {
            prepend: 'ul',
            is_child: false,
            attributes: ['id', 'class']
        };
        var opts = $.extend(defaults, options);
        var serialStr     = '';

        if(!opts.is_child){ opts.prepend = '&'+opts.prepend; }

        // Begin the core plugin
        this.each(function() {
            var ul_obj = this;

            var li_count     = 0;
            $(this).children().each(function(){

                for(att in opts.attributes){
                    serialStr += opts.prepend+'['+li_count+']['+opts.attributes[att]+']='+$(this).attr(opts.attributes[att]);
                }

                // append any children elements
                var child_base = opts.prepend+'['+li_count+'][children]';
                $(this).children().each(function(){
                    if(this.tagName == 'UL' || this.tagName == 'OL'){
                        serialStr += $(this).serializelist({'prepend': child_base, 'is_child': true});
                    }
                });
                li_count++;
            });
        });
        return(serialStr);
    };
})(jQuery);

Der Aufruf erfolgt über folgenden Befehl:

$(document).ready(function(){
    $('ul').serializelist();
});
Kategorien
Development

[jQuery] Endlich ein gutes Growl Plugin – Gritter

http://boedesign.com/2009/07/11/growl-for-jquery-gritter/ hat am 11.07.2009 ein richtig schickes und gut funktionierendes Notification-Plugin im Growl-Stil für jQuery veröffentlicht. Es heißt Gritter und der erste Eindruck von der Demo war auf jeden Fall sehr gut.

Ich werde das Plugin definitiv in verschiedenen Projekten einsetzen. Auf sowas habe ich schon seit längerer Zeit gewartet.