Changeset 553350
- Timestamp:
- 06/05/2012 10:26:49 AM (14 years ago)
- Location:
- autofill-cf7-bb
- Files:
-
- 10 added
- 4 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/autofill-CF7-BB.php (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/script (added)
-
tags/1.0.1/script/AFCFBB_class.php (added)
-
tags/1.0.1/script/AFCFBB_js.js (added)
-
tags/1.0.1/script/AFCFBB_option_class.php (added)
-
tags/1.0.1/script/AFCFBB_shotcodefunction.php (added)
-
tags/1.0.1/script/AFCFBB_style.css (added)
-
tags/1.0.1/script/simple_html_dom.php (added)
-
trunk/autofill-CF7-BB.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/script/AFCFBB_class.php (modified) (4 diffs)
-
trunk/script/AFCFBB_option_class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
autofill-cf7-bb/trunk/autofill-CF7-BB.php
r552780 r553350 5 5 Description: 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. 6 6 Author: Billyben 7 Version: 1.0. 07 Version: 1.0.1 8 8 Author URI: http://asblog.etherocliquecite.eu 9 9 */ -
autofill-cf7-bb/trunk/readme.txt
r552780 r553350 5 5 Requires at least: 2.8.1 6 6 Tested up to: 3.3.2 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 9 9 Add shortcode for fields autofill of Contact Form 7 plugin by URL get variable, by Id or by value, or add new value(s). 10 10 11 11 12 == Description == a12 == Description == 13 13 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.14 autofill-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. 15 15 For 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. 16 16 … … 47 47 will select id 2 for the select field so "Steve" (numbering start by 0 (not 1)). 48 48 49 Other 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 54 For "add" and "rep" you could preselect values by adding "*" before values, eg : 55 56 http://mysite.com/?page_id=1&addval=*Steeve$Rebecca$*julie 57 49 58 For 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). 50 59 for any question, please contact me at http://asblog.etherocliquecite.eu … … 52 61 == Changelog == 53 62 63 = 1.0.1 = 64 * add textarea support 65 * add preselected value by "*" character 66 54 67 = 1.0.0 = Public release -
autofill-cf7-bb/trunk/script/AFCFBB_class.php
r552780 r553350 2 2 /* 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) 3 3 4 to do : possibilité d'ajouter une entrée dans les champs selectionnables.5 4 -------------------------------------------------------------------------------- */ 6 5 include_once('simple_html_dom.php'); 7 6 class AFCFBB_class{ 8 7 // 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' ); 10 9 public function __construct() { 11 10 } … … 28 27 return $this->getRadioModification($atts, $html); 29 28 break; 29 case 'textarea' : 30 return $this->getTextareaModification($atts, $html); 31 break; 32 30 33 default : 31 34 return $html; … … 73 76 $html->find('input', 0)->autocomplete="off"; 74 77 $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; 75 90 return $html; 76 91 } … … 169 184 return $parent; 170 185 } 186 187 171 188 private function addElement($meth, $parent, $str, $values, $name=NULL){ 172 189 if($meth=='rep')$parent->innertext=""; 173 190 foreach($values as $val){ 174 191 $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); 176 195 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 } 178 201 $parent->innertext =$parent->innertext.$newchild->outertext; 179 202 } -
autofill-cf7-bb/trunk/script/AFCFBB_option_class.php
r552780 r553350 240 240 public function display_shortcode_section($args){ 241 241 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> 243 243 244 244 the shortcode looks like :</p> … … 256 256 <pre>[AFCF_BB getvar="myId" <b>meth="value"</b>][field][/AFCF_BB]</pre> 257 257 <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>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> 259 259 http://mysite.com/?page_id=1&<b>myId=2$4$3</b> 260 260 </p> … … 282 282 283 283 <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> 287 will add (or replace) values with Steeve, Rebecca and Julie with Steeve and Julie selected. 288 </p> 284 289 285 290 <h4>'.__('Field Type detection',BBSWF_TEXT_DOMAIN).':</h4> … … 298 303 <h4>'.__('Tips',BBSWF_TEXT_DOMAIN).':</h4> 299 304 <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 det cting 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> 301 306 To prevent it, you could either : 302 307 <ol>
Note: See TracChangeset
for help on using the changeset viewer.