".$d['field_name'];
}
}else{
$where['snip_id'] = $this->snip_id;
$wpdb->update( SUPPLESNIPSTABLE, $d, $where);
$this->message = "Snip updated: ".$d['snip_name']."";
}
}
function checkName($text)
{
$regex = "/^([A-Za-z0-9_]+)$/";
if (preg_match($regex, $text)) {
return TRUE;
}
else {
return FALSE;
}
}
/**
* Displays the Add/Edit form for HTML Snips
*
* Snips let you build complex HTML templates for
* displaying your field data within a post
*
*/
function showSnipsForm(){
global $wpdb;
$snipsDDL = $this->getSnipsDDL($this->snip_id);
if($this->snip_id){
$snipOptions = $wpdb->get_row($wpdb->prepare('SELECT * FROM '.SUPPLESNIPSTABLE.' WHERE snip_id = %d',$this->snip_id), ARRAY_A);
if($snipOptions){
if(get_magic_quotes_gpc()){
$snipOptions['snip'] = stripslashes($snipOptions['snip']);
$snipOptions['css'] = stripslashes($snipOptions['css']);
$snipOptions['lists'] = stripslashes($snipOptions['lists']);
}
}
}
?>
<new>";
$query = $wpdb->get_results("SELECT snip_id, snip_name FROM "
.SUPPLESNIPSTABLE." ORDER BY snip_name;");
if($query){
foreach($query as $row){
if($selected_snip == $row->snip_id){$sel = "selected='selected'";}else{$sel = "";}
$ret .= "";
}
}
$ret ="";
return $ret;
}
function showFieldsTable(){
$fldTable = $this->getTableOfFields();
echo "
Table of your fields for reference:
Field values can be inserted into your snippet with a short code like [field_name]. Example:
<div>I live in [my_city].</div>
Renders: I live in St. Louis.";
echo $fldTable;
}
//Get a table of the created fields
function getTableOfFields()
{
global $wpdb;
$sql = "SELECT * FROM ".SUPPLEFIELDSTABLE." ORDER BY form_id, seq";
$query = $wpdb->get_results($wpdb->prepare($sql, $form_id));
if($this->options['use_custom_fields'] == 0 ){
$ct = '