function get_form() { $form = $this->content; //email fields $form = preg_replace('/\\[email( "([^"]+)")?\\]/i', '<input id="sailthru-email-' . $this->id . '" type="text" class="required $2" />', $form); //first name $form = preg_replace('/\\[fname(\\*?)( "([^"]+)")?\\]/i', '<input id="sailthru-fname-' . $this->id . '" type="text" class="$1$3" />', $form); //last name $form = preg_replace('/\\[lname(\\*?)( "([^"]+)")?\\]/i', '<input id="sailthru-lname-' . $this->id . '" type="text" class="$1$3" />', $form); //submit $form = preg_replace('/\\[submit "([^"]+)"( "([^"]+)")?\\]/i', '<input id="sailthru-submit-' . $this->id . '" onclick="return false;" type="submit" class="$3" value="$1" /> <img id="sailthru_loader-' . $this->id . '" src="' . Sailthru::get_plugin_url() . '/loading.gif" style="display: none;"/>', $form); //each list $lists = sailthru_form::get_all_lists(); foreach ($lists as $id => $list) { $form = preg_replace("/\\[optin-{$id}( \"([^\"]+)\")?\\]/i", "<label class=\"\$2\"><input checked=\"checked\" type=\"checkbox\" value=\"true\" id=\"sailthru-optin-{$this->id}-{$id}\" /> {$list}</label>", $form); } //replace the asterisks with "required" //remove empty class="" $form = str_replace(array('class="*', ' class=""'), array('class="required ', ''), $form); $form .= '<input type="hidden" id="sailthru_plugin_url" value="' . Sailthru::get_plugin_path() . '" />'; $form = "<form id=\"sailthru-{$this->id}\" class=\"sailthru-form\">{$form}</form>"; return $form; }
</thead> <tr> <td style="width: 500px;"> <p style="margin-left: 7px;">Form Name: <input type="text" name="form_name" style="width: 300px;" value="<?php echo isset($errors) && count($errors) ? $_POST['form_name'] : $form->name; ?> "> </p> <table border="0"> <tr> <td colspan="4" style="border: 0px;"> Select Lists: </td> </tr> <?php $lists = sailthru_form::get_all_lists(); $i = 0; foreach ($lists as $id => $list) { if ($i % 4 == 0) { echo '<tr>'; } echo '<td style="border: 0px;">'; echo "<input type='checkbox' name='lists[]' value='{$id}' id='list-{$id}'"; if (isset($errors) && count($errors)) { if (@in_array($id, $_POST['lists'])) { echo ' checked="checked"'; } } elseif (@in_array($id, $form->mailing_lists)) { echo ' checked="checked"'; } echo "> <label for='list-{$id}' id='list_label-{$id}'>{$list}</label>";