Ich habe auf dieser Seite: http://blog.ben-inside.de/kontakt/ das Problem, dass drei Linien auftauchen, ich aber nicht weiss woher. Kann mir bitte jemand helfen?
Hier der Code
PHP
<?php
/*
Plugin Name: Custom Contact
Plugin URI: http://rane.hasitsown.com
Description: Allow Custom/Extended Contact Us Page
Date: 2006, February, 9
Author: VaamYob
Author URI: http://rane.hasitsown.com
Version: 0.1e
*/
require_once(ABSPATH . '/wp-content/plugins/rane/wp.php');
define('CC_TEXT_FIELD',0);
define('CC_TEXTAREA_FIELD',1);
define('CC_SELECT_FIELD',2);
define('CC_CHECKBOX_FIELD',3);
add_action('wp_head', 'custom_contact_wp_head');
add_action('admin_menu', 'custom_contact_admin_pages');
add_filter('the_content', 'custom_contact_content');
function custom_contact_wp_head($content_stuff) {
rane_meta_version('custom-contact', '0', '1e');
$fields = custom_contact_get_field_defs();
$tx_id = rane_create_tx_id();
?>
<script type="text/javascript">
var txID = '<?php echo $tx_id ?>';
function customContactEmail() {
var errMsg = "";
<?php
foreach ($fields as $field) {
if ($field->required == 1) {
?>
var field = document.getElementById('field_<?php echo $field->id; ?>');
if (field.value == null || field.value == '') {
errMsg += "\n<?php echo $field->label ?>";
}
<?php
}
}
?>
if (errMsg == "") {
var url = '<?php echo rane_get_plugins_url(); ?>/custom-contact/custom-contact-email.php';
var parms = new Array();
parms[0] = new Array('rane_tx_id',txID);
<?php
$index = 1;
foreach ($fields as $field) {
$field_id = 'field_' . $field->id;
if ($field->input_type == CC_CHECKBOX_FIELD) {
echo "if ( document.getElementById('$field_id').checked ) {
parms[$index] = new Array('$field_id', document.getElementById('$field_id').value);
} else {
parms[$index] = new Array('$field_id', '');
}";
} else {
echo "parms[$index] = new Array('$field_id', document.getElementById('$field_id').value);\n";
}
$index++;
}
?>
AJAXPost(url, parms, handleContactEmail);
} else {
alert("<?php echo get_option('custom_contact_required_msg'); ?>" + errMsg);
return false;
}
}
function handleContactEmail(code, message, data) {
if (code == 3) {
location.href=rane_get_data_string(data);
} else {
//alert(message);
if (code == 0) {
txID = rane_get_data_string(data);
document.getElementById('custom_contact_form').innerHTML = '<h2>' + message + '</h2>';
<?php
foreach ($fields as $field) {
$field_id = $field->id;
echo "//document.getElementById('field_$field_id').value = '';\n";
}
?>
}
}
}
</script>
<?php
}
function custom_contact_admin_pages() {
add_options_page('Custom Contact', 'Custom Contact', 8, 'custom-contact/custom-contact-options.php');
}
// Initialize all variables
custom_contact_init();
$custom_contact_tbl_fields="";
function custom_contact_init(){
global $table_prefix, $wpdb, $custom_contact_tbl_fields;
$custom_contact_tbl_fields = $table_prefix.'custom_contact_fields';
$option = get_option('custom_contact_success_msg');
if ($option == null) {
add_option('custom_contact_success_msg', 'Danke für deine Nachricht.');
}
$option = get_option('custom_contact_required_msg');
if ($option == null) {
add_option('custom_contact_required_msg', 'Ein benötigtes Feld ist leer:');
}
$option = get_option('custom_contact_email_subject');
if ($option == null) {
add_option('custom_contact_email_subject', 'Eine Nachricht vom Blog');
}
$option = get_option('custom_contact_delay');
if ($option == null) {
add_option('custom_contact_delay', '90');
}
$option = get_option('custom_contact_delay_msg');
if ($option == null) {
add_option('custom_contact_delay_msg', 'Willst du mich etwa nerven ?');
}
$option = get_option('custom_contact_redirect');
if ($option == null) {
add_option('custom_contact_redirect', '');
}
$option = get_option('custom_contact_show_ip');
if ($option == null) {
add_option('custom_contact_show_ip', 'true');
}
$option = get_option('custom_contact_email_address');
if ($option == null) {
add_option('custom_contact_email_address', get_settings('admin_email'));
}
if($wpdb->get_var("show tables like '$custom_contact_tbl_fields'") != $custom_contact_tbl_fields) {
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
$sql = "CREATE TABLE ".$custom_contact_tbl_fields."(
`id` int(5) NOT NULL auto_increment,
`label` text default '',
`required` tinyint(1) NOT NULL default '0',
`input_type` tinyint(1) NOT NULL default '0',
`text_max_chars` int(9) NOT NULL default '4096',
`form_position` int(9) NOT NULL default '0',
`options` text default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;";
dbDelta($sql);
$wpdb->query("INSERT INTO `$custom_contact_tbl_fields` (`label`, `required`, `input_type`, `form_position`, `text_max_chars`) VALUES ('Dein Name', 1, " . CC_TEXT_FIELD . ", 0, 0)");
$wpdb->query("INSERT INTO `$custom_contact_tbl_fields` (`label`, `required`, `input_type`, `form_position`, `text_max_chars`) VALUES ('Deine Email', 1, " . CC_TEXT_FIELD . ", 1, 0)");
$wpdb->query("INSERT INTO `$custom_contact_tbl_fields` (`label`, `required`, `input_type`, `form_position`, `text_max_chars`) VALUES ('Deine Webseite', 0, " . CC_TEXT_FIELD . ", 2, 0)");
$wpdb->query("INSERT INTO `$custom_contact_tbl_fields` (`label`, `required`, `input_type`, `form_position`, `text_max_chars`) VALUES ('Deine Nachricht', 1, " . CC_TEXTAREA_FIELD . ", 3, 0)");
}
}
function custom_contact_content($content) {
if(stristr($content, '<!--custom-contact-form-->') === FALSE) {
return $content;
} else {
$search_for = array('<!--custom-contact-form-->');
$replace_with = array(custom_contact_get_form());
$retVal = str_replace($search_for,$replace_with, $content);
return $retVal;
}
}
function custom_contact_get_form() {
$fields = custom_contact_get_field_defs();
$html = '<div id="custom_contact_form" class="custom_contact_form">'."\n";
if ( get_option('custom_contact_show_ip') == 'true' ) {
$html .='<div class="custom_contact_row">'."\n";
$html .='<div class="custom_contact_label">Deine Nachricht:</div>'."\n";
$html .='<div class="custom_contact_data">'. gethostbyname($_SERVER['REMOTE_ADDR']). '</div>';
$html .='</div>';
}
foreach ($fields as $field) {
if ($field->required == 1) {
$required_subclass = '_required';
} else {
$required_subclass = '';
}
$html .='<div class="custom_contact_row">'."\n";
if ($field->input_type != CC_CHECKBOX_FIELD) {
$html .='<div class="custom_contact_label' . $required_subclass . '">';
$html .= rane_unesc_quote($field->label);
$html .='</div><!-- label -->';
}
$html .='<div class="custom_contact_data">';
if ($field->input_type == CC_TEXT_FIELD) {
$html .= '<input type="text" id="field_' . $field->id . '" name="field_' . $field->id . '" />';
} else if ($field->input_type == CC_TEXTAREA_FIELD) {
$html .= '<textarea id="field_' . $field->id . '" name="field_' . $field->id . '" rows="3" cols="50"></textarea>';
} else if ($field->input_type == CC_CHECKBOX_FIELD) {
//if (rane_is_empty($field->options)) {
$html .= '<input type="checkbox" value="Yes" id="field_' . $field->id . '" name="field_' . $field->id . '" />';
//} else {
// $options = explode(',', rane_unesc_quote($field->options));
// $index = 1;
// foreach ($options as $option) {
// $html .= '<input type="checkbox" value="' . $option . '" id="field_' . $field->id . '_' . $index++ . '" name="field_' . $field->id . '[]" />' . $option;
// }
//}
} else if ($field->input_type == CC_SELECT_FIELD) {
$html .= '<select id="field_' . $field->id . '" name="field_' . $field->id . '" >';
$options = explode(',', rane_unesc_quote($field->options));
foreach ($options as $option) {
$html .= '<option value="' . $option . '">' . $option . '</option>';
}
$html .= '</select>';
}
$html .='</div><!-- data -->';
if ($field->input_type == CC_CHECKBOX_FIELD) {
$html .='<div class="custom_contact_label' . $required_subclass . '">';
$html .= rane_unesc_quote($field->label);
$html .='</div><!-- label -->';
}
//$html .="\n</div><!-- row --><br/>\n";
}
$html .='<div align="right"><div class="custom_contact_buttons"><input type="button" value="Senden" onclick="customContactEmail(); return false;"/></div></div>'."\n";
$html .='</div><!-- form -->';
return $html;
}
function custom_contact_get_field_defs() {
global $custom_contact_tbl_fields, $wpdb, $user_level;
custom_contact_init();
$fields = null;
return $wpdb->get_results("SELECT * FROM $custom_contact_tbl_fields ORDER BY form_position");
}
?>
Alles anzeigen