Changeset 621656
- Timestamp:
- 11/06/2012 01:10:48 PM (13 years ago)
- Location:
- tailored-tools
- Files:
-
- 48 added
- 5 edited
-
tags/1.3.8 (added)
-
tags/1.3.8/form.contact.php (added)
-
tags/1.3.8/form.sample.php (added)
-
tags/1.3.8/lib (added)
-
tags/1.3.8/lib/class.akismet.php (added)
-
tags/1.3.8/lib/class.ayah.php (added)
-
tags/1.3.8/lib/class.forms.php (added)
-
tags/1.3.8/lib/class.recaptcha.php (added)
-
tags/1.3.8/lib/countries.php (added)
-
tags/1.3.8/lib/json.php (added)
-
tags/1.3.8/lib/lib.ayah.php (added)
-
tags/1.3.8/lib/recaptchalib.php (added)
-
tags/1.3.8/lib/tinymce.php (added)
-
tags/1.3.8/readme.txt (added)
-
tags/1.3.8/resource (added)
-
tags/1.3.8/resource/admin.css (added)
-
tags/1.3.8/resource/custom.css (added)
-
tags/1.3.8/resource/exclaim.gif (added)
-
tags/1.3.8/resource/icons.png (added)
-
tags/1.3.8/resource/loader.js (added)
-
tags/1.3.8/resource/mce-icon.gif (added)
-
tags/1.3.8/resource/tinymce.js.php (added)
-
tags/1.3.8/shortcodes.php (added)
-
tags/1.3.8/tools.php (added)
-
tags/1.3.9 (added)
-
tags/1.3.9/form.contact.php (added)
-
tags/1.3.9/form.sample.php (added)
-
tags/1.3.9/lib (added)
-
tags/1.3.9/lib/class.akismet.php (added)
-
tags/1.3.9/lib/class.ayah.php (added)
-
tags/1.3.9/lib/class.forms.php (added)
-
tags/1.3.9/lib/class.recaptcha.php (added)
-
tags/1.3.9/lib/countries.php (added)
-
tags/1.3.9/lib/json.php (added)
-
tags/1.3.9/lib/lib.ayah.php (added)
-
tags/1.3.9/lib/recaptchalib.php (added)
-
tags/1.3.9/lib/tinymce.php (added)
-
tags/1.3.9/readme.txt (added)
-
tags/1.3.9/resource (added)
-
tags/1.3.9/resource/admin.css (added)
-
tags/1.3.9/resource/custom.css (added)
-
tags/1.3.9/resource/exclaim.gif (added)
-
tags/1.3.9/resource/icons.png (added)
-
tags/1.3.9/resource/loader.js (added)
-
tags/1.3.9/resource/mce-icon.gif (added)
-
tags/1.3.9/resource/tinymce.js.php (added)
-
tags/1.3.9/shortcodes.php (added)
-
tags/1.3.9/tools.php (added)
-
trunk/form.contact.php (modified) (2 diffs)
-
trunk/form.sample.php (modified) (1 diff)
-
trunk/lib/class.forms.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/tools.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tailored-tools/trunk/form.contact.php
r566366 r621656 23 23 public $avail_ayah = true; 24 24 25 25 26 /** 26 27 * Constructor … … 30 31 $this->init(); 31 32 } 33 32 34 33 35 /** -
tailored-tools/trunk/form.sample.php
r566366 r621656 18 18 public $submit_label = 'Submit Form'; 19 19 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; 21 25 22 26 /** -
tailored-tools/trunk/lib/class.forms.php
r583294 r621656 10 10 public $form_action = false; 11 11 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'; 13 13 public $error, $success = false; 14 14 public $debug = false; … … 17 17 public $avail_akismet = false; 18 18 public $avail_ayah = true; 19 public $check_bad_words= false; // Turn this on child-classes to enable check. 19 20 // Customise these in child-class 20 21 public $nonce = 'tailored-tools'; 21 public $admin_menu = 'index.php'; // parent-hook for add_menu_item22 public $admin_menu = 'index.php'; // parent-hook for add_menu_item 22 23 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. 24 25 public $option_key = 'ttools_option_key'; 25 26 public $shortcode = 'FormShortcode'; … … 79 80 // TinyMCE Button 80 81 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 82 86 83 87 … … 270 274 // Filter, so modules can apply validation per-form 271 275 $this->error = apply_filters('ttools_form_filter_validate', $this->error, $this); 276 // Now check for bad words? 277 $this->validate_bad_words(); 272 278 // Return true or false 273 279 return (empty($this->error)) ? true : false; … … 284 290 } 285 291 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; 286 326 } 287 327 -
tailored-tools/trunk/readme.txt
r583294 r621656 4 4 Requires at least: 3.0 5 5 Tested up to: 3.4.1 6 Stable tag: 1.3. 76 Stable tag: 1.3.9 7 7 8 8 Contains some helper classes to help you build custom forms. … … 38 38 == Shortcodes == 39 39 40 This plugin also includes twoshortcodes that we tend to use a lot.40 This plugin also includes some shortcodes that we tend to use a lot. 41 41 42 42 = [tabs] = … … 55 55 == Changelog == 56 56 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 57 65 = 1.3.7 = 58 66 * Add a shortcode for [googlemap] … … 64 72 = 1.3.5 = 65 73 * Fix issue with ui_tabs - JS and shortcode 66 * Added some more filters for better74 * Added some more filters for easier development 67 75 68 76 = 1.3.4 = -
tailored-tools/trunk/tools.php
r583294 r621656 3 3 Plugin Name: Tailored Tools 4 4 Description: Adds some functionality to WordPress that you'll need. 5 Version: 1.3. 75 Version: 1.3.9 6 6 Author: Tailored Web Services 7 7 Author URI: http://www.tailored.com.au
Note: See TracChangeset
for help on using the changeset viewer.