Changeset 715824
- Timestamp:
- 05/21/2013 02:51:11 AM (13 years ago)
- Location:
- tailored-tools
- Files:
-
- 39 added
- 2 deleted
- 8 edited
-
tags/1.5.0 (added)
-
tags/1.5.0/form.contact.php (added)
-
tags/1.5.0/form.sample.php (added)
-
tags/1.5.0/googlemaps.php (added)
-
tags/1.5.0/js (added)
-
tags/1.5.0/js/chosen.jquery.min.js (added)
-
tags/1.5.0/js/loader.js (added)
-
tags/1.5.0/js/tinymce.js.php (added)
-
tags/1.5.0/lib (added)
-
tags/1.5.0/lib/class.akismet.php (added)
-
tags/1.5.0/lib/class.ayah.php (added)
-
tags/1.5.0/lib/class.forms.php (added)
-
tags/1.5.0/lib/class.recaptcha.php (added)
-
tags/1.5.0/lib/countries.php (added)
-
tags/1.5.0/lib/json.php (added)
-
tags/1.5.0/lib/lib.ayah.php (added)
-
tags/1.5.0/lib/recaptchalib.php (added)
-
tags/1.5.0/lib/tinymce.php (added)
-
tags/1.5.0/readme.txt (added)
-
tags/1.5.0/resource (added)
-
tags/1.5.0/resource/admin.css (added)
-
tags/1.5.0/resource/calendar.png (added)
-
tags/1.5.0/resource/chosen-sprite.png (added)
-
tags/1.5.0/resource/chosen-sprite@2x.png (added)
-
tags/1.5.0/resource/chosen.css (added)
-
tags/1.5.0/resource/custom.css (added)
-
tags/1.5.0/resource/exclaim.gif (added)
-
tags/1.5.0/resource/icons.png (added)
-
tags/1.5.0/resource/mce-icon.gif (added)
-
tags/1.5.0/shortcodes.php (added)
-
tags/1.5.0/tools.php (added)
-
trunk/form.contact.php (modified) (2 diffs)
-
trunk/form.sample.php (modified) (5 diffs)
-
trunk/js (added)
-
trunk/js/chosen.jquery.min.js (added)
-
trunk/js/loader.js (added)
-
trunk/js/tinymce.js.php (added)
-
trunk/lib/class.akismet.php (modified) (2 diffs)
-
trunk/lib/class.forms.php (modified) (5 diffs)
-
trunk/lib/tinymce.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/resource/calendar.png (added)
-
trunk/resource/chosen-sprite.png (added)
-
trunk/resource/chosen-sprite@2x.png (added)
-
trunk/resource/chosen.css (added)
-
trunk/resource/custom.css (modified) (3 diffs)
-
trunk/resource/loader.js (deleted)
-
trunk/resource/tinymce.js.php (deleted)
-
trunk/tools.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tailored-tools/trunk/form.contact.php
r621656 r715824 22 22 public $avail_akismet = true; 23 23 public $avail_ayah = true; 24 public $check_bad_words= true; 24 25 25 26 … … 97 98 'required' => true, 98 99 'error' => 'Please provide your name', 99 'class' => 'testclass',100 100 ), 101 101 'cust_email' => array( -
tailored-tools/trunk/form.sample.php
r621656 r715824 31 31 $this->init(); 32 32 add_action('ttools_form_before_submit_button', array(&$this,'do_before_submit_button')); 33 34 // If using Akismet, map fields to values 35 add_filter('ttools_map_akismet_fields', array(&$this,'map_form_fields'), 10, 2); 33 36 } 34 37 … … 49 52 'to' => get_bloginfo('admin_email'), 50 53 'bcc' => '', 51 'subject' => ' TestForm Submission for '.site_url(),54 'subject' => 'Sample Form Submission for '.site_url(), 52 55 ), 53 56 'success' => array( … … 65 68 * Filter to generate email headers 66 69 */ 67 function filter_headers($headers=false) { 70 function filter_headers($headers=false, $form=false) { 71 // Only if its for THIS form. 72 if ($this->form_name !== $form->form_name) return $headers; 73 // Build headers 68 74 $from_name = $_POST['cust_name']; 69 75 $from_email = $_POST['cust_email']; … … 78 84 79 85 /** 86 * Map form fields to Akismet array for anti-spam check 87 */ 88 function map_form_fields($fields=false, $form=false) { 89 if ($this->form_name !== $form->form_name) return $fields; 90 $fields = array( 91 'name' => $_POST['cust_name'], 92 'email' => $_POST['cust_email'], 93 'message' => $_POST['cust_message'], 94 ); 95 return $fields; 96 } 97 98 99 /** 80 100 * Questions to show in form 81 101 */ … … 87 107 'required' => true, 88 108 'error' => 'Please provide your name', 89 'class' => 'testclass',90 109 ), 91 110 'cust_note' => array( -
tailored-tools/trunk/lib/class.akismet.php
r664154 r715824 20 20 $this->user_agent = 'WordPress/'.$wp_version.' | Akismet/'.$this->class-version; 21 21 22 add_filter('ttools_map_akismet_fields', array(&$this,'map_form_fields'), 9, 1);22 add_filter('ttools_map_akismet_fields', array(&$this,'map_form_fields'), 9, 2); 23 23 add_filter('ttools_form_filter_validate', array(&$this,'filter_form_validate_error'), 10, 2); 24 24 } … … 42 42 if (!$this->check_in_use($form->opts)) return $errors; 43 43 // Expecting array of (name=>, email=>, message=>) back. 44 $values = apply_filters( 'ttools_map_akismet_fields', array() );44 $values = apply_filters( 'ttools_map_akismet_fields', array(), $form ); 45 45 46 46 $is_spam = $this->check_form( $form->opts['akismet']['api_key'], $values['name'], $values['email'], $values['message'] ); -
tailored-tools/trunk/lib/class.forms.php
r664154 r715824 14 14 public $debug = false; 15 15 // Which anti-spam modules are available? 16 public $avail_recaptcha= true;16 public $avail_recaptcha= false; 17 17 public $avail_akismet = false; 18 public $avail_ayah = true;19 public $check_bad_words= false;// Turn this on child-classes to enable check.18 public $avail_ayah = false; 19 public $check_bad_words= true; // Turn this on child-classes to enable check. 20 20 // Customise these in child-class 21 21 public $nonce = 'tailored-tools'; … … 93 93 */ 94 94 function enqueue_scripts() { 95 $jvalidate = ((!is_ssl()) ? 'http://' : 'https://') . 'ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js'; 96 wp_deregister_script('jquery-validate'); // Do this, assuming our CDN version is better & more up-to-date than others. 97 wp_enqueue_script('jquery-validate', $jvalidate, array('jquery'), '1.9.0', true); 98 wp_enqueue_script('ttools-loader', plugins_url('resource/loader.js', dirname(__FILE__)), array('jquery-validate','jquery-ui-datepicker'), false, true); 99 wp_enqueue_style('ttools', plugins_url('resource/custom.css', dirname(__FILE__))); 95 wp_enqueue_script('ttools-loader'); 96 wp_enqueue_style('jquery-chosen'); 97 wp_enqueue_style('ttools'); 100 98 } 101 99 … … 492 490 493 491 function draw_datepicker($key, $q) { 494 wp_enqueue_script('jquery-ui-datepicker');495 492 echo '<p'.$q['class'].'><label><span>'.$q['label'].'</span>'."\n"; 496 493 echo "\t".'<input type="text" name="'.$key.'" id="'.$key.'" class="txt datepicker" value="'.esc_attr($_POST[$key]).'" /></label></p>'."\n"; … … 501 498 // Draw Element 502 499 echo '<p'.$q['class'].'><label><span>'.$q['label'].'</span>'."\n"; 503 echo "\t".'<select name="'.$key.'" id="'.$key.'" class="txt ">'."\n";500 echo "\t".'<select name="'.$key.'" id="'.$key.'" class="txt countries">'."\n"; 504 501 // Prepend some custom options for easier forms 505 502 $q['options'] = array( … … 616 613 </div><!-- left column --> 617 614 <div class="column column_right"> 618 <p><strong>Anti-Spam Services:</strong> You should only use one of these at a time!</p>615 <p><strong>Anti-Spam Services:</strong></p> 619 616 <?php if ($this->avail_recaptcha) { ?> 620 617 <fieldset class="antispam recaptcha"> -
tailored-tools/trunk/lib/tinymce.php
r566366 r715824 37 37 } 38 38 function filter_mce_external_plugins($plugins) { 39 $plugins['tailored_tools'] = $this->plugin_url.' resource/tinymce.js.php';39 $plugins['tailored_tools'] = $this->plugin_url.'js/tinymce.js.php'; 40 40 return $plugins; 41 41 } -
tailored-tools/trunk/readme.txt
r664154 r715824 4 4 Requires at least: 3.0 5 5 Tested up to: 3.5.1 6 Stable tag: 1. 4.16 Stable tag: 1.5.0 7 7 8 8 Contains some helper classes to help you build custom forms. … … 55 55 == Changelog == 56 56 57 = 1.5.0= 58 * Double-checked some Akismet code 59 * Rewrote style rules for better compatibility with Genesis responsive designs (likely have negative effect on existing sites) 60 * Improvde the Datepicker autloader, and add an icon 61 * Added jQuery Chosen and auto-apply to all select boxes (Yes can use MIT license in plugin) https://twitter.com/markjaquith/status/188108457386311681 62 57 63 = 1.4.0 = 58 64 * Modify the GoogleMaps shortcode for better responsive behavior. Now uses Google Static Maps API to grab a JPG before embedding an iFrame. -
tailored-tools/trunk/resource/custom.css
r566366 r715824 1 1 2 2 /** 3 * Mobile-First Form Rules3 * Form Helpers 4 4 */ 5 5 6 form.tws { } 7 form.tws p, form.tws div.recaptcha, form.tws div.ayah_box { padding:0; margin:0 0 10px 0; clear:left; } 8 form.tws p label { display:block; cursor:pointer; } 9 form.tws p label span { width:30%; display:block; float:left; padding:3px 4% 0 0; text-align:right; } 10 form.tws p .txt { width:60%; border:1px solid #CCC; background-color:#FFF; padding:4px; border-radius:4px; padding:2px 5px; } 11 form.tws p textarea.txt { height:5em; } 12 form.tws p input.datepicker { width:9em; } 6 form.tws { max-width:95%; margin:0 auto 2rem; } 7 form.tws p { margin:0; padding:0 0 1rem; clear:both; } 13 8 14 form.tws p .txt:focus { border-color:#AAA; box-shadow:2px 2px 4px #CCC; } 9 form.tws p label { margin:0; display:block; cursor:pointer; } 10 form.tws p label span { width:25%; float:left; display:block; padding-top:0.1em; } 11 form.tws p label .txt { width:75%; padding:0.3rem 0.5rem; border:1px solid #DDD; color:#555; background-color:#FFF; 12 box-shadow:inset 0 0 5px #DDD; border-radius:3px; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; } 13 form.tws p textarea.txt { height:6em; } 14 form.tws p .txt:focus { box-shadow:2px 2px 4px #CCC; border-color:#CCC; } 15 15 16 form.tws p.sep { font-size:0.7em; line-height:1em; } 17 form.tws p.radio label { padding:0.3em 0.2em 0; } 18 form.tws p.radio label input { width:auto; border:0; background:none; margin:0 0.5em 0 1em; } 16 form.tws p label select { cursor:pointer; } 17 form.tws .chzn-container-single .chzn-single { border-color:#CCC; } 18 form.tws .chzn-container .chzn-drop { border-color:#CCC; } 19 form.tws .chzn-container { width:75% !important; } 19 20 20 form.tws p.block label { margin-bottom:0.9em; } 21 form.tws p.block label span { float:none; width:auto; padding:0; } 22 form.tws p.block label .txt { width:90%; margin:0 auto; } 21 form.tws p.sep { line-height:0.5; } 23 22 24 form.tws fieldset { margin:1em 0 1.5em; padding:0; border:0; clear:both; } 25 form.tws fieldset legend { margin:1em 0 0.5em; padding:0; font-weight:bold; display:block; width:90%; white-space:normal; } 23 form.tws p.wide label span { width:45%; } 24 form.tws p.wide label .txt { width:55%; } 25 form.tws p.wide .chzn-container { width:55% !important; } 26 26 27 form.tws p.submit { padding:5px; text-align:center;} 28 form.tws p.submit input { margin:0; width:auto; padding:0.4em 1.2em; cursor:pointer; border-radius:0.4em; } 27 form.tws p.block label span { width:auto; float:none; } 28 form.tws p.block label .txt { width:100%; } 29 form.tws p.block .chzn-container { width:100% !important; } 29 30 30 p.error, p.success { padding:0.8em 1.1em; border-radius:0.3em; } 31 p.error { border:1px solid #900; background:#fdfafa url(exclaim.gif) top right no-repeat;; } 32 p.success { border:1px solid #060; background:#f2f7f2; } 31 form.tws p.radio span { display:block; } 32 form.tws p.radio label { padding:0.2em 0 0.2em 25%; } 33 form.tws p.radio label input { width:auto; padding:0; background:none; border:none; box-shadow:none; margin-right:1em; } 34 35 form.tws p label input.datepicker { } 36 form.tws p label input.hasDatepicker { background-image:url(calendar.png); background-position:right 5px center; background-repeat:no-repeat; 37 cursor:pointer; max-width:10em; } 38 form.tws fieldset { border:0; margin:0 0 1rem 0; padding:0; } 39 form.tws fieldset legend { font-weight:bold; margin:0; padding:0 0 1rem; } 40 41 form.tws p.submit { padding-left:25%; } 42 form.tws p.submit input { background:#1E1E1E; border-radius:3px; padding:0.7rem 2rem; font-size:1rem; cursor:pointer; } 43 form.tws p.submit input:hover { background:#373737; box-shadow:inset 0 0 1.5rem #000; } 44 45 /** 46 * Form Validation 47 */ 48 p.error, p.success { padding:0.8em 1.1em; border-radius:0.3em; } 49 p.error { border:1px solid #900; background:#fdfafa url(exclaim.gif) top right no-repeat;; } 50 p.success { border:1px solid #060; background:#f2f7f2; } 33 51 34 52 form.tws label.error { display:none !important; } 35 53 form.tws p .error, form.tws p .error:focus, 54 form.tws p label .error, form.tws p label .error:focus, 36 55 form.tws .error, form.tws .error:focus { border-color:#900; background-color:#FDFAFA; } 37 56 38 39 57 /** 40 * Responsive Form Rules - for larger screens58 * Responsive for smaller screens 41 59 */ 42 @media only screen and (min-width: 700px) { 43 form.tws p label span { width:8em; padding:3px 0 0 0; text-align:inherit; } 44 form.tws p .txt { width:25em; } 45 form.tws p textarea.txt { height:7em; } 46 form.tws p select.txt { width:25.7em; } 47 form.tws p input.datepicker { width:9em; } 48 form.tws p.submit { padding-left:8em; text-align:left; } 49 form.tws div.recaptcha, form.tws div.ayah_box { margin-left:8em; } 60 @media only screen and (max-width: 600px) { 61 form.tws p label span, form.tws p.wide label span { width:auto; float:none; } 62 form.tws p label .txt, form.tws p.wide label .txt { width:100%; } 63 form.tws .chzn-container { width:100% !important; } 64 form.tws p.radio label { padding-left:2rem; } 65 form.tws p.submit { padding-left:0; padding-right:0; text-align:center; } 50 66 } 51 52 67 53 68 … … 55 70 * jQuery UI Datepicker 56 71 */ 57 .ui-datepicker { background:#FFF; border:1px solid #CCC; padding:0.5em; box-shadow:2px 2px 4px #CCC; border-radius:0.3em; font-size:1 .3em; }72 .ui-datepicker { background:#FFF; border:1px solid #CCC; padding:0.5em; box-shadow:2px 2px 4px #CCC; border-radius:0.3em; font-size:1rem; } 58 73 .ui-datepicker .ui-datepicker-header a { float:left; display:block; width:16px; height:16px; background:url(icons.png) top right no-repeat; text-decoration:none; cursor:pointer; } 59 74 .ui-datepicker .ui-datepicker-header a.ui-datepicker-next { float:right; background-position:top left; } … … 61 76 .ui-datepicker .ui-datepicker-header .ui-datepicker-title { text-align:center; } 62 77 78 .ui-datepicker .ui-datepicker-header select { width:auto; padding:0; box-shadow:none; border:1px solid #DDD; color:#333; cursor:pointer; } 79 63 80 .ui-datepicker .ui-datepicker-calendar { } 64 81 .ui-datepicker .ui-datepicker-calendar th, .ui-datepicker .ui-datepicker-calendar td { text-align:center; } 65 82 .ui-datepicker .ui-datepicker-calendar th { padding:0.2em; } 66 83 .ui-datepicker .ui-datepicker-calendar td { } 67 .ui-datepicker .ui-datepicker-calendar a { display:block; padding:0.2em; }84 .ui-datepicker .ui-datepicker-calendar a { display:block; padding:0.2em; text-decoration:none; } 68 85 .ui-datepicker .ui-datepicker-calendar a:hover { background:#c7dfef; } 69 86 .ui-datepicker .ui-datepicker-calendar a.ui-state-active { background:#c7efeb; } -
tailored-tools/trunk/tools.php
r664154 r715824 2 2 /* 3 3 Plugin Name: Tailored Tools 4 Description: Adds some functionality to WordPress that you'll need. 5 Version: 1. 4.14 Description: Adds some functionality to WordPress that you'll need. (Version 1.5+ has different style rules. Do not upgrade without checking these.) 5 Version: 1.5.0 6 6 Author: Tailored Web Services 7 7 Author URI: http://www.tailored.com.au … … 10 10 11 11 12 // Register our scripts & styles for later enqueuing 13 add_action('init', 'tailored_tools_register_scripts'); 14 function tailored_tools_register_scripts() { 15 // Stylesheets 16 wp_register_style('ttools', plugins_url('resource/custom.css', __FILE__)); 17 wp_register_style('jquery-chosen', plugins_url('resource/chosen.css', __FILE__)); 18 19 // Javascript 20 wp_deregister_script('jquery-validate'); // Assume this plugin is more up-to-date than other sources. Might be bad mannered. 21 // wp_register_script('jquery-validate', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array('jquery'), '1.9.0', true); 22 wp_register_script('jquery-validate', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js', array('jquery'), '1.11.1', true); 23 wp_register_script('jquery-chosen', plugins_url('js/chosen.jquery.min.js', __FILE__), array('jquery'), false, true); 24 wp_register_script('ttools-loader', plugins_url('js/loader.js', __FILE__), array('jquery-validate','jquery-ui-datepicker', 'jquery-chosen'), false, true); 25 } 12 26 13 27 // Include Helper Classes
Note: See TracChangeset
for help on using the changeset viewer.