Plugin Directory

Changeset 553350


Ignore:
Timestamp:
06/05/2012 10:26:49 AM (14 years ago)
Author:
Billyben
Message:
 
Location:
autofill-cf7-bb
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • autofill-cf7-bb/trunk/autofill-CF7-BB.php

    r552780 r553350  
    55Description: Add shortcode for fields autofill of Contact Form 7 plugin by URL get variable for select, checkboxes, radio buttons, text, by Id or by value.
    66Author: Billyben
    7 Version: 1.0.0
     7Version: 1.0.1
    88Author URI: http://asblog.etherocliquecite.eu
    99*/
  • autofill-cf7-bb/trunk/readme.txt

    r552780 r553350  
    55Requires at least: 2.8.1
    66Tested up to: 3.3.2
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88
    99Add shortcode for fields autofill of Contact Form 7 plugin by URL get variable, by Id or by value, or add new value(s).
    1010
    1111
    12 == Description ==a
     12== Description ==
    1313
    14 autofill-CF7-BB let you autofill contact form 7 fields (input text, radio, select, checkboxes) with url GET variables. It add a shortcode to write in the "contact form 7 template editor" for each field.
     14autofill-CF7-BB let you autofill contact form 7 fields (input text, radio, select, checkboxes, textarea) with url GET variables. It add a shortcode to write in the "contact form 7 template editor" for each field.
    1515For drop down menu fields and radio/checkboxes you can specify wether you would select it by Id (from 0) or by value. You can also populate each field with new values from URL Get var, or replace firstly defined values.
    1616
     
    4747will select id 2 for the select field so "Steve" (numbering start by 0 (not 1)).
    4848
     49Other method :
     50* meth="value" : will selet by value
     51* meth="add" : will add at the bottom new input
     52* meth="rep" : will replace current values
     53
     54For "add" and "rep" you could preselect values by adding "*" before values, eg :
     55
     56http://mysite.com/?page_id=1&addval=*Steeve$Rebecca$*julie
     57
    4958For more detail, consult the <a href="http://asblog.etherocliquecite.eu/?page_id=774&lang=en" target="_blank">plugin page</a> or see it in the plugin option page of wordpress (when installed).
    5059for any question, please contact me at http://asblog.etherocliquecite.eu
     
    5261== Changelog ==
    5362
     63= 1.0.1 =
     64* add textarea support
     65* add preselected value by "*" character
     66
    5467= 1.0.0 = Public release
  • autofill-cf7-bb/trunk/script/AFCFBB_class.php

    r552780 r553350  
    22/* Class pour gestion des modifications de la string html passée va le shortcode. Défini automatiquement la balise du champ selectionné par le tag. Modification ensuite des attribut select (radio, CB, select) ou value (text)
    33
    4 to do : possibilité d'ajouter une entrée dans les champs selectionnables.
    54-------------------------------------------------------------------------------- */
    65include_once('simple_html_dom.php');
    76class AFCFBB_class{
    87    // availbale tag array type=>tag
    9     private $availableTag=array('select'=>'select', 'radio'=>'input', 'checkbox'=>'input', 'text'=>'input');
     8    private $availableTag=array('select'=>'select', 'radio'=>'input', 'checkbox'=>'input', 'textarea'=>'textarea', 'text'=>'input' );
    109    public function __construct() {
    1110    }
     
    2827                return $this->getRadioModification($atts, $html);
    2928            break;
     29            case 'textarea' :
     30                return $this->getTextareaModification($atts, $html);
     31            break;
     32
    3033            default :
    3134            return $html;
     
    7376        $html->find('input', 0)->autocomplete="off";
    7477        $html->find('input', 0)->value=$value;
     78        return $html;
     79    }
     80    /* Fonctions Textarea
     81    ------------------------------------------------ */
     82    private function getTextareaModification($atts, $html){
     83        $getvarName=$atts['getvar'];
     84        $value=isset($_GET[$getvarName])?$_GET[$getvarName]:NULL;
     85        if($value==NULL)return $html;
     86       
     87        //pb autocomplete FF !!
     88        $html->find('textarea', 0)->autocomplete="off";
     89        $html->find('textarea', 0)->innertext=$value;
    7590        return $html;
    7691    }
     
    169184        return $parent;
    170185    }
     186   
     187   
    171188    private function addElement($meth, $parent, $str, $values, $name=NULL){
    172189        if($meth=='rep')$parent->innertext="";
    173190        foreach($values as $val){
    174191                    $newchild=new simple_html_dom();
    175                     $hstr=preg_replace('/\$value\$/',$val,$str);
     192                    $selected=substr($val,0,1)=='*';
     193                    $val=($selected)?substr($val,1):$val;
     194                    $hstr=preg_replace('/\$value\$/',$val,$str);   
    176195                    if($name!=NULL)$hstr=preg_replace('/\$name\$/',$name,$hstr);
    177                     $newchild->load($hstr);
     196                    $newchild->load($hstr);                 
     197                    if($selected){
     198                        $newchild->find('input',0)->checked="checked";
     199                        $newchild->find('option', 0)->selected="selected";
     200                    }
    178201                    $parent->innertext =$parent->innertext.$newchild->outertext;
    179202                }
  • autofill-cf7-bb/trunk/script/AFCFBB_option_class.php

    r552780 r553350  
    240240public function display_shortcode_section($args){
    241241        echo '<div class="afcfbb"><h4>'.__('Selection Use',BBSWF_TEXT_DOMAIN).':</h4>
    242         <P>First of all, go into the template éditor of contact form 7, and choose the template which you want to "autofill".</br>
     242        <P>First of all, go into the template editor of contact form 7, and choose the template which you want to "autofill".</br>
    243243
    244244the shortcode looks like :</p>
     
    256256<pre>[AFCF_BB getvar="myId" <b>meth="value"</b>][field][/AFCF_BB]</pre>
    257257<p>By default it\'s set to id.</br>
    258 For <i><u>checkboxes</u></i>, multiselection is available. You have to pass the different id or value separating them by \'\$\' caracter eg :</br>
     258For <i><u>checkboxes</u></i>, multiselection is available. You have to pass the different id or value separating them by \'$\' caracter eg :</br>
    259259 http://mysite.com/?page_id=1&<b>myId=2$4$3</b>
    260260</p>
     
    282282
    283283<p>will result in : o radio 4 o radio 5</p>
     284<h4>'.__('Preselect Values',BBSWF_TEXT_DOMAIN).':</h4>
     285<p>You can pass values which could be directly selected. You ust have to add "*" character before the value you want to be selected, eg :</br>
     286<pre>http://mysite.com/?page_id=1&<b>addval=*Steeve$Rebecca$*julie</b></pre>
     287will add (or replace) values with Steeve, Rebecca and Julie with Steeve and Julie selected.
     288</p>
    284289
    285290<h4>'.__('Field Type detection',BBSWF_TEXT_DOMAIN).':</h4>
     
    298303<h4>'.__('Tips',BBSWF_TEXT_DOMAIN).':</h4>
    299304<h5> For Adding method (meth="add")</h5>
    300 <p>If you want to <i>fill entirely a field from 0</i>, autofill-CF7-BB would fail in detcting the field type</br>
     305<p>If you want to <i>fill entirely a field from 0</i>, autofill-CF7-BB would fail in detecting the field type</br>
    301306To prevent it, you could either :
    302307<ol>
Note: See TracChangeset for help on using the changeset viewer.