Plugin Directory

Changeset 621656


Ignore:
Timestamp:
11/06/2012 01:10:48 PM (13 years ago)
Author:
tailoredweb
Message:

1.3.9 Update

Location:
tailored-tools
Files:
48 added
5 edited

Legend:

Unmodified
Added
Removed
  • tailored-tools/trunk/form.contact.php

    r566366 r621656  
    2323    public      $avail_ayah     = true;
    2424   
     25   
    2526    /**
    2627     *  Constructor
     
    3031        $this->init();
    3132    }
     33   
    3234   
    3335    /**
  • tailored-tools/trunk/form.sample.php

    r566366 r621656  
    1818    public      $submit_label   = 'Submit Form';
    1919    public      $form_class     = 'test class';
    20 
     20    // Which anti-spam modules are available?
     21    public      $avail_recaptcha= true;
     22    public      $avail_akismet  = false;
     23    public      $avail_ayah     = true;
     24    public      $check_bad_words= false;
    2125   
    2226    /**
  • tailored-tools/trunk/lib/class.forms.php

    r583294 r621656  
    1010    public      $form_action    = false;
    1111    public      $form_class     = false;
    12     public      $form_enctype   = false;    // If uploads: 'multipart/form-data';
     12    public      $form_enctype   = false;            // If uploads, change to: 'multipart/form-data';
    1313    public  $error, $success    = false;
    1414    public      $debug          = false;
     
    1717    public      $avail_akismet  = false;
    1818    public      $avail_ayah     = true;
     19    public      $check_bad_words= false;            // Turn this on child-classes to enable check.
    1920    // Customise these in child-class
    2021    public      $nonce          = 'tailored-tools';
    21     public      $admin_menu     = 'index.php';  // parent-hook for add_menu_item
     22    public      $admin_menu     = 'index.php';      // parent-hook for add_menu_item
    2223    public      $form_name      = false;
    23     public      $questions      = false;    // Will be an array of questions.  See docs for sample.
     24    public      $questions      = false;            // Will be an array of questions.  See docs for sample.
    2425    public      $option_key     = 'ttools_option_key';
    2526    public      $shortcode      = 'FormShortcode';
     
    7980        // TinyMCE Button
    8081        add_filter('tailored_tools_mce_buttons', array(&$this,'add_mce_button'));
    81     }
     82        // Build bad-words array
     83        add_filter('ttools_form_bad_words_to_check', array(&$this,'filter_bad_words_to_check'), 10, 2);
     84    }
     85
    8286   
    8387   
     
    270274        // Filter, so modules can apply validation per-form
    271275        $this->error = apply_filters('ttools_form_filter_validate', $this->error, $this);
     276        // Now check for bad words?
     277        $this->validate_bad_words();
    272278        // Return true or false
    273279        return (empty($this->error)) ? true : false;
     
    284290        }
    285291       
     292    }
     293   
     294    function validate_bad_words() {
     295        // Only run if flag enabled.
     296        if (!$this->check_bad_words)    return;
     297        // Fetch our array of bad words
     298        $bad_words = apply_filters('ttools_form_bad_words_to_check', false, $this);
     299        // Build a string of the entire form contents
     300        $merged = '';    foreach ($_POST as $key => $val)   {   $merged .= $val.' ';    }
     301        // Check each of our bad words against the merged string.
     302        foreach ($bad_words as $badword) {
     303            if (stripos($merged, $badword)) {
     304                $this->error[] = 'Your message has tripped our spam filter.  Please double check your message, and avoid suspect words like "viagra".';
     305                break;
     306            }
     307        }
     308    }
     309   
     310   
     311   
     312    /**
     313     *  Array of bad-words to check for.  If the form contains a bad word, we reject it as spam.
     314     *  Fetch with:     $badwords = apply_filters('ttools_form_bad_words_to_check', false, $this);
     315     */
     316    function filter_bad_words_to_check($badwords=false, $form=false) {
     317        if ($this->form_name != $form->form_name)   return $badwords;
     318        if (!is_array($badwords))                   $badwords = array();
     319        // Add words to existing array
     320        $badwords = array_merge($badwords, array(
     321            'ambien', 'cialis', 'buycialis', 'hydrocodone', 'viagraonline', 'cialisonline', 'phentermine', 'viagrabuy', 'percocet', 'tramadol',
     322            'propecia', 'xenical', 'meridia', 'levitra', 'vicodin', 'viagra', 'valium', 'porno', 'xanax', 'href=', // 'sex', 'soma'
     323        ));
     324        $badwords = array_unique($badwords);
     325        return $badwords;
    286326    }
    287327   
  • tailored-tools/trunk/readme.txt

    r583294 r621656  
    44Requires at least:  3.0
    55Tested up to:       3.4.1
    6 Stable tag:         1.3.7
     6Stable tag:         1.3.9
    77
    88Contains some helper classes to help you build custom forms.
     
    3838== Shortcodes ==
    3939
    40 This plugin also includes two shortcodes that we tend to use a lot.
     40This plugin also includes some shortcodes that we tend to use a lot.
    4141
    4242= [tabs] =
     
    5555== Changelog ==
    5656
     57= 1.3.8 =
     58* Add a filter for ttools_form_bad_words_to_check to build a blacklist of words to ban
     59* If one of those words is in the message, it immediately fails. (Spam check)
     60
     61= 1.3.8 =
     62* Change default message to include the current page URI
     63* Add a filter for ttools_form_filter_email_message
     64
    5765= 1.3.7 =
    5866* Add a shortcode for [googlemap]
     
    6472= 1.3.5 =
    6573* Fix issue with ui_tabs - JS and shortcode
    66 * Added some more filters for better
     74* Added some more filters for easier development
    6775
    6876= 1.3.4 =
  • tailored-tools/trunk/tools.php

    r583294 r621656  
    33Plugin Name:    Tailored Tools
    44Description:    Adds some functionality to WordPress that you'll need.
    5 Version:        1.3.7
     5Version:        1.3.9
    66Author:         Tailored Web Services
    77Author URI:     http://www.tailored.com.au
Note: See TracChangeset for help on using the changeset viewer.