Plugin Directory

Changeset 715824


Ignore:
Timestamp:
05/21/2013 02:51:11 AM (13 years ago)
Author:
ajferg
Message:

1.5.0 release

Location:
tailored-tools
Files:
39 added
2 deleted
8 edited

Legend:

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

    r621656 r715824  
    2222    public      $avail_akismet  = true;
    2323    public      $avail_ayah     = true;
     24    public      $check_bad_words= true;
    2425   
    2526   
     
    9798                'required'  => true,
    9899                'error'     => 'Please provide your name',
    99                 'class'     => 'testclass',
    100100            ),
    101101            'cust_email'    => array(
  • tailored-tools/trunk/form.sample.php

    r621656 r715824  
    3131        $this->init();
    3232        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);
    3336    }
    3437   
     
    4952                'to'        => get_bloginfo('admin_email'),
    5053                'bcc'       => '',
    51                 'subject'   => 'Test Form Submission for '.site_url(),
     54                'subject'   => 'Sample Form Submission for '.site_url(),
    5255            ),
    5356            'success' => array(
     
    6568     *  Filter to generate email headers
    6669     */
    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
    6874        $from_name = $_POST['cust_name'];
    6975        $from_email = $_POST['cust_email'];
     
    7884   
    7985    /**
     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    /**
    80100     *  Questions to show in form
    81101     */
     
    87107                'required'  => true,
    88108                'error'     => 'Please provide your name',
    89                 'class'     => 'testclass',
    90109            ),
    91110            'cust_note'     => array(
  • tailored-tools/trunk/lib/class.akismet.php

    r664154 r715824  
    2020        $this->user_agent = 'WordPress/'.$wp_version.' | Akismet/'.$this->class-version;
    2121       
    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);
    2323        add_filter('ttools_form_filter_validate', array(&$this,'filter_form_validate_error'), 10, 2);
    2424    }
     
    4242        if (!$this->check_in_use($form->opts))  return $errors;
    4343        // 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 );
    4545       
    4646        $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  
    1414    public      $debug          = false;
    1515    // Which anti-spam modules are available?
    16     public      $avail_recaptcha= true;
     16    public      $avail_recaptcha= false;
    1717    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.
    2020    // Customise these in child-class
    2121    public      $nonce          = 'tailored-tools';
     
    9393     */
    9494    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');
    10098    }
    10199   
     
    492490   
    493491    function draw_datepicker($key, $q) {
    494         wp_enqueue_script('jquery-ui-datepicker');
    495492        echo '<p'.$q['class'].'><label><span>'.$q['label'].'</span>'."\n";
    496493        echo "\t".'<input type="text" name="'.$key.'" id="'.$key.'" class="txt datepicker" value="'.esc_attr($_POST[$key]).'" /></label></p>'."\n";
     
    501498        // Draw Element
    502499        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";
    504501        // Prepend some custom options for easier forms
    505502        $q['options'] = array(
     
    616613        </div><!-- left column -->
    617614        <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>
    619616        <?php   if ($this->avail_recaptcha) {   ?>
    620617        <fieldset class="antispam recaptcha">
  • tailored-tools/trunk/lib/tinymce.php

    r566366 r715824  
    3737    }
    3838    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';
    4040        return $plugins;
    4141    }
  • tailored-tools/trunk/readme.txt

    r664154 r715824  
    44Requires at least:  3.0
    55Tested up to:       3.5.1
    6 Stable tag:         1.4.1
     6Stable tag:         1.5.0
    77
    88Contains some helper classes to help you build custom forms.
     
    5555== Changelog ==
    5656
     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
    5763= 1.4.0 =
    5864* 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  
    11
    22/**
    3  *  Mobile-First Form Rules
     3 *  Form Helpers
    44 */
    55
    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; }
     6form.tws { max-width:95%; margin:0 auto 2rem; }
     7form.tws p { margin:0; padding:0 0 1rem; clear:both; }
    138
    14 form.tws p .txt:focus { border-color:#AAA; box-shadow:2px 2px 4px #CCC; }
     9form.tws p label { margin:0; display:block; cursor:pointer; }
     10form.tws p label span { width:25%; float:left; display:block; padding-top:0.1em; }
     11form.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; }
     13form.tws p textarea.txt { height:6em; }
     14form.tws p .txt:focus { box-shadow:2px 2px 4px #CCC; border-color:#CCC; }
    1515
    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; }
     16form.tws p label select { cursor:pointer; }
     17form.tws .chzn-container-single .chzn-single { border-color:#CCC; }
     18form.tws .chzn-container .chzn-drop { border-color:#CCC; }
     19form.tws .chzn-container { width:75% !important; }
    1920
    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; }
     21form.tws p.sep { line-height:0.5; }
    2322
    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; }
     23form.tws p.wide label span { width:45%; }
     24form.tws p.wide label .txt { width:55%; }
     25form.tws p.wide .chzn-container { width:55% !important; }
    2626
    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; }
     27form.tws p.block label span { width:auto; float:none; }
     28form.tws p.block label .txt { width:100%; }
     29form.tws p.block .chzn-container { width:100% !important; }
    2930
    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; }
     31form.tws p.radio span { display:block; }
     32form.tws p.radio label { padding:0.2em 0 0.2em 25%; }
     33form.tws p.radio label input { width:auto; padding:0; background:none; border:none; box-shadow:none; margin-right:1em; }
     34
     35form.tws p label input.datepicker { }
     36form.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; }
     38form.tws fieldset { border:0; margin:0 0 1rem 0; padding:0; }
     39form.tws fieldset legend { font-weight:bold; margin:0; padding:0 0 1rem; }
     40
     41form.tws p.submit { padding-left:25%; }
     42form.tws p.submit input { background:#1E1E1E; border-radius:3px; padding:0.7rem 2rem; font-size:1rem; cursor:pointer; }
     43form.tws p.submit input:hover { background:#373737; box-shadow:inset 0 0 1.5rem #000; }
     44
     45/**
     46 *  Form Validation
     47 */
     48p.error, p.success  { padding:0.8em 1.1em; border-radius:0.3em; }
     49p.error             { border:1px solid #900; background:#fdfafa url(exclaim.gif) top right no-repeat;; }
     50p.success           { border:1px solid #060; background:#f2f7f2; }
    3351
    3452form.tws label.error { display:none !important; }
    3553form.tws p .error, form.tws p .error:focus,
     54form.tws p label .error, form.tws p label .error:focus,
    3655form.tws .error, form.tws .error:focus { border-color:#900; background-color:#FDFAFA; }
    3756
    38 
    3957/**
    40  *  Responsive Form Rules - for larger screens
     58 *  Responsive for smaller screens
    4159 */
    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; }
    5066}
    51 
    5267
    5368
     
    5570 *  jQuery UI Datepicker
    5671 */
    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; }
    5873.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; }
    5974.ui-datepicker .ui-datepicker-header a.ui-datepicker-next { float:right; background-position:top left; }
     
    6176.ui-datepicker .ui-datepicker-header .ui-datepicker-title { text-align:center; }
    6277
     78.ui-datepicker .ui-datepicker-header select { width:auto; padding:0; box-shadow:none; border:1px solid #DDD; color:#333; cursor:pointer; }
     79
    6380.ui-datepicker .ui-datepicker-calendar { }
    6481.ui-datepicker .ui-datepicker-calendar th, .ui-datepicker .ui-datepicker-calendar td { text-align:center; }
    6582.ui-datepicker .ui-datepicker-calendar th { padding:0.2em; }
    6683.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; }
    6885.ui-datepicker .ui-datepicker-calendar a:hover { background:#c7dfef; }
    6986.ui-datepicker .ui-datepicker-calendar a.ui-state-active { background:#c7efeb; }
  • tailored-tools/trunk/tools.php

    r664154 r715824  
    22/*
    33Plugin Name:    Tailored Tools
    4 Description:    Adds some functionality to WordPress that you'll need.
    5 Version:        1.4.1
     4Description:    Adds some functionality to WordPress that you'll need.  (Version 1.5+ has different style rules. Do not upgrade without checking these.)
     5Version:        1.5.0
    66Author:         Tailored Web Services
    77Author URI:     http://www.tailored.com.au
     
    1010
    1111
     12// Register our scripts & styles for later enqueuing
     13add_action('init', 'tailored_tools_register_scripts');
     14function 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}
    1226
    1327//  Include Helper Classes
Note: See TracChangeset for help on using the changeset viewer.