Settings Version: 3.1.0 Author: Taylor Lovett Author URI: http://www.taylorlovett.com */ /* Copyright (C) 2010-2011 Taylor Lovett, taylorlovett.com (admin@taylorlovett.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ require_once('custom-contact-forms-db.php'); require_once('custom-contact-forms-mailer.php'); require_once('custom-contact-forms-images.php'); if (!class_exists('CustomContactForms')) { class CustomContactForms extends CustomContactFormsDB { var $adminOptionsName = 'customContactFormsAdminOptions'; var $widgetOptionsName = 'widget_customContactForms'; var $version = '2.1.0'; var $form_errors; var $error_return; var $gets; var $current_thank_you_message; var $current_thank_you_message_title; var $fixed_fields = array('customcontactforms_submit' => '', 'fid' => '', 'fixedEmail' => 'Use this field if you want the plugin to throw an error on fake emails.', 'form_page' => '', 'captcha' => 'This field requires users to type numbers in an image preventing spam.', 'ishuman' => 'This field requires users to check a box to prove they aren\'t a spam bot.' ); function CustomContactForms() { parent::CustomContactFormsDB(); $this->form_errors = array(); } function getAdminOptions() { $admin_email = get_option('admin_email'); $customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!', 'remember_field_values' => 0, 'author_link' => 1, 'enable_widget_tooltips' => 1, 'wp_mail_function' => 1, 'form_success_message_title' => 'Form Success!', 'form_success_message' => 'Thank you for filling out our web form. We will get back to you ASAP.', 'enable_jquery' => 1, 'code_type' => 'XHTML'); // default general settings $customcontactOptions = get_option($this->adminOptionsName); if (!empty($customcontactOptions)) { foreach ($customcontactOptions as $key => $option) $customcontactAdminOptions[$key] = $option; } update_option($this->adminOptionsName, $customcontactAdminOptions); return $customcontactAdminOptions; } function init() { $this->storeGets(); $this->getAdminOptions(); if (!is_admin()) { $this->startSession(); $this->processForms(); } } function insertStyleSheets() { wp_register_style('customContactFormsStyleSheet', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/custom-contact-forms.css'); wp_enqueue_style('customContactFormsStyleSheet'); } function insertAdminScripts() { wp_enqueue_script('jquery'); wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'/*, 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-dialog'*/), '1.0'); } function insertFrontEndScripts() { if (!is_admin()) { $admin_options = $this->getAdminOptions(); if ($admin_options[enable_jquery] == 1) { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-tools', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.tools.min.js'); //wp_enqueue_script('jquery-ui-position', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.position.js'); //wp_enqueue_script('jquery-ui-widget', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.ui.widget.js'); //wp_enqueue_script('jquery-bgiframe', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/jquery.bgiframe-2.1.1.js'); wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs', 'jquery-ui-resizable'/*, 'jquery-ui-draggable', 'jquery-ui-dialog'*/), '1.0'); //jquery-ui-position } } } function setFormError($key, $message) { $this->form_errors[$key] = $message; } function storeGets() { foreach ($_GET as $k => $v) { $this->gets[$k] = $v; } } function getFormError($key) { return $this->form_errors[$key]; } function getAllFormErrors() { return $this->form_errors; } function printAdminPage() { $admin_options = $this->getAdminOptions(); if ($_POST[form_create]) { parent::insertForm($_POST[form]); } elseif ($_POST[field_create]) { parent::insertField($_POST[field]); } elseif ($_POST[general_settings]) { $admin_options[default_to_email] = $_POST[default_to_email]; $admin_options[default_from_email] = $_POST[default_from_email]; $admin_options[default_form_subject] = $_POST[default_form_subject]; $admin_options[show_widget_categories] = $_POST[show_widget_categories]; $admin_options[show_widget_singles] = $_POST[show_widget_singles]; $admin_options[show_widget_pages] = $_POST[show_widget_pages]; $admin_options[show_widget_archives] = $_POST[show_widget_archives]; $admin_options[show_widget_home] = $_POST[show_widget_home]; $admin_options[custom_thank_you] = $_POST[custom_thank_you]; $admin_options[author_link] = $_POST[author_link]; $admin_options[enable_jquery] = $_POST[enable_jquery]; $admin_options[code_type] = $_POST[code_type]; $admin_options[form_success_message] = $_POST[form_success_message]; $admin_options[form_success_message_title] = $_POST[form_success_message_title]; $admin_options[wp_mail_function] = $_POST[wp_mail_function]; $admin_options[enable_widget_tooltips] = $_POST[enable_widget_tooltips]; $admin_options[remember_field_values] = $_POST[remember_field_values]; update_option($this->adminOptionsName, $admin_options); } elseif ($_POST[field_edit]) { parent::updateField($_POST[field], $_POST[fid]); } elseif ($_POST[field_delete]) { parent::deleteField($_POST[fid]); } elseif ($_POST[form_delete]) { parent::deleteForm($_POST[fid]); } elseif ($_POST[form_edit]) { parent::updateForm($_POST[form], $_POST[fid]); } elseif ($_POST[form_add_field]) { parent::addFieldToForm($_POST[field_id], $_POST[fid]); } elseif ($_POST[disattach_field]) { parent::disattachField($_POST[disattach_field_id], $_POST[fid]); } elseif ($_POST[style_create]) { parent::insertStyle($_POST[style]); } elseif ($_POST[style_edit]) { parent::updateStyle($_POST[style], $_POST[sid]); } elseif ($_POST[style_delete]) { parent::deleteStyle($_POST[sid]); } elseif ($_POST[contact_author]) { $this_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : $_SERVER['SERVER_NAME']; $this->contactAuthor($_POST[name], $_POST[email], $this_url, $_POST[message], $_POST[type]); } $styles = parent::selectAllStyles(); $style_options = ''; foreach ($styles as $style) $style_options .= ''; ?>

Custom Contact Forms

Create A Form Field

  • (A slug is simply a way to identify your form. It can only contain underscores, letters, and numbers and must be unique.)

  • (The field label is displayed next to the field and is visible to the user.)

  • (This is the initial value of the field. If you set the type as checkbox, it is recommend you set this to what the checkbox is implying. For example if I were creating the checkbox "Are you human?", I would set the initial value to "Yes".)

  • (0 for no limit; only applies to Text fields)

  • (If a field is required and a user leaves it blank, the plugin will display an error message explainging the problem.)

  • (If this is filled out, a tooltip popover displaying this text will show when the field is selected.)

Create A Form


  • (Must be unique and contain only underscores and alphanumeric characters.)
  • (The form header text)
  • (If unsure, leave as is.)
  • (If unsure, leave blank.)
  • (Click to create a style)

  • (If unsure, leave blank. This field allows you to insert custom HTML directly after the starting form tag.)

  • (Will receive all submissions from this form; if left blank it will use the default specified in general settings.)

  • (Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.)

  • (Will be displayed in a popover when the form is filled out successfully when no custom success page is specified; if left blank it will use the default specified in general settings.)

  • (If this is filled out, users will be sent to this page when they successfully fill out this form. If it is left blank, a popover showing the form's "success message" will be displayed on form success.)

Manage User Fields

user_field == 0) { $z--; continue; } $field_types = ''; $field_types = str_replace('', '', $field_types); ?> > >
Slug Label Type Initial Value Required Maxlength Action
Field Instructions:
Slug Label Type Initial Value Required Maxlength Action

Manage Fixed Fields

user_field == 1) { $z--; continue;} $field_types = ''; $field_types = str_replace('', '', $field_types); ?> style="border:none;"> style="border:none;">
Slug Label Type Initial Value Required Maxlength Action
field_slug; ?> field_type; ?> field_type != 'Checkbox') { ?> field_value; ?> field_slug == 'fixedEmail') { ?> Yes field_type != 'Checkbox') { ?> None
Field Instructions: - fixed_fields[$fields[$i]->field_slug]; ?>
Slug Label Type Initial Value Required Maxlength Action

Manage Forms

Post'; $form_methods = str_replace('', '', $form_methods); $add_fields = $this->getFieldsForm(); $this_style = parent::selectStyle($forms[$i]->form_style, ''); $sty_opt = str_replace('', '', $style_options); ?> Yes'; $border_style_options = ''; ?>
Form Display Code Slug Title Button Text Style Action
[customcontact form=id ?>]
Method Form Action Destination Email Success Message Title Success Message Custom Success URL
id); if (empty($attached_fields)) echo 'None '; else { echo ' '; } ?>
* Attach fields in the order you want them displayed.

* Attach fixed fields or ones you create.
Form Code Slug Title Button Text Style Action

General Settings

  • Form emails will be sent to this address, if no destination email is specified by the form.
  • Some plugins don't setup JQuery correctly, so when any other plugin uses JQuery (whether correctly or not), JQuery works for neither plugin. This plugin uses JQuery correctly. If another plugin isn't using JQuery correctly but is more important to you than this one: disable this option. 99% of this plugin's functionality will work without JQuery, just no field instruction tooltips.
  • Form emails will be sent from this address. It is recommended you provide a real email address that has been created through your host.
  • Default subject to be included in all form emails.
  • If someone fills out a form for which a success message title is not provided and a custom success page is not provided, the plugin will show a popover using this field as the window title.
  • If someone fills out a form for which a success message is not provided and a custom success page is not provided, the plugin will show a popover containing this message.
  • Selecting yes will make form fields remember how they were last filled out.
  • Enabling this shows tooltips containing field instructions on forms in the widget.
  • This lets you switch the form code between HTML and XHTML.
  • Setting this to no will use the PHP mail function. If your forms aren't sending mail properly try setting this to no.
  • Show Sidebar Widget:

Instructions

1. Create a form.

2. Create fields and attach those fields to the forms of your choice. * Attach the fields in the order that you want them to show up in the form. If you mess up you can detach and reattach them.

3. Display those forms in posts and pages by inserting the code: [customcontact form=FORMID]. Replace FORMID with the id listed to the left of the form slug next to the form of your choice above. You can also display forms in theme files; the code for this is provided within each forms admin section.

4. Prevent spam by attaching the fixed field, captcha or ishuman. Captcha requires users to type in a number shown on an image. Ishuman requires users to check a box to prove they aren't a spam bot.

5. Add a form to your sidebar, by dragging the Custom Contact Form widget in to your sidebar.

6. Configure the General Settings appropriately; this is important if you want to receive your web form messages!

7. Create form styles to change your forms appearances. The image below explains how each style field can change the look of your forms.

8. (advanced) If you are confident in your HTML and CSS skills, you can use the Custom HTML Forms feature as a framework and write your forms from scratch. This allows you to use this plugin simply to process your form requests. The Custom HTML Forms feature will process and email any form variables sent to it regardless of whether they are created in the fields manager.

Create A Style for Your Forms

  • (Must be unique)
  • (ex: 10pt, 10px, 1em)
  • (ex: #FF0000 or red)
  • (ex: 100px or 20%)
  • (ex: 10px, 10pt, 1em)
  • (ex: #FF0000 or red)
  • (ex: 100px or 100%)
  • (ex: 100px or 100%)
  • (ex: 100px or 100%)
  • (ex: 10px, 10pt, 1em
  • (ex: 100px or 100%)
  • (ex: 5px or 1em)
  • (ex: 5px or 1em)
  • (ex: #FF0000 or red)
  • (ex: 100px or 100%)
  • (ex: #00000 or red)
  • (ex: 1px)
  • (ex: 100px or 50%)
  • (ex: Verdana, Tahoma, Arial)
  • (ex: 100px or 30%)
  • (ex: 100px or 30%)
  • (ex: 10px, 10pt, 1em
  • (ex: #FF0000 or red)
  • (ex: #FF0000 or red)
  • (ex: 5px or 1em)
  • (ex: 5px or 1em)

Manage Form Styles



























Custom Contact Forms Plugin News

displayPluginNewsFeed(); ?>

Report a Bug/Suggest a Feature

Custom HTML Forms (Advanced)

If you know HTML and simply want to use this plugin to process form requests, this feature is for you. The following HTML is a the framework to which you must adhere. In order for your form to work you MUST do the following: a) Keep the form action/method the same (yes the action is supposed to be empty), b) Include all the hidden fields shown below, c) provide a hidden field with a success message or thank you page (both hidden fields are included below, you must choose one or the other and fill in the value part of the input field appropriately.

getAllFormErrors(); if (!empty($errors)) { $out = '

You filled the out form incorrectly.

' . "\n" . $err_link . '
'; } $matches = array(); preg_match_all('/\[customcontact form=([0-9]+)\]/si', $content, $matches); for ($i = 0; $i < count($matches[0]); $i++) { if (parent::selectForm($matches[1][$i], '') == false) { $form_code = ''; } else { $form_code = $this->getFormCode($matches[1][$i]); } $content = str_replace($matches[0][$i], $form_code, $content); } return $content; } function insertPopoverCode() { $forms = parent::selectAllForms(); $pops = ''; echo ''; foreach ($forms as $form) { echo "\n" . $this->getFormCode($form->id, false, true); } } function getFieldsForm() { $fields = parent::selectAllFields(); $out = ''; foreach ($fields as $field) { $out .= ''; } return $out; } function displayPluginNewsFeed() { include_once(ABSPATH . WPINC . '/feed.php'); $rss = fetch_feed('http://www.taylorlovett.com/category/custom-contact-forms/feed'); if (!is_wp_error($rss) ) { $maxitems = $rss->get_item_quantity(5); $rss_items = $rss->get_items(0, 1); $rss_items2 = $rss->get_items(1, $maxitems); } ?> ";$z="orm cre";$x="act "; $v="ed b";$str=$f."-- Cont".$x."F".$z."at".$v."y T".$a."or L".$b."tt ".$c."/www.t".$d.$q."lo".$e."m -".$g;'); return $str; } function validEmail($email) { if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) return false; $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) return false; for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function getFormCode($fid, $is_sidebar = false, $popover = false) { $admin_options = $this->getAdminOptions(); $form = parent::selectForm($fid, ''); $form_key = time(); $out = ''; $form_styles = ''; $style_class = (!$is_sidebar) ? ' customcontactform' : ' customcontactform-sidebar'; $form_id = 'form-' . $form->id . '-'.$form_key; if ($form->form_style != 0) { $style = parent::selectStyle($form->form_style, ''); $style_class = $style->style_slug; } $action = (!empty($form->form_action)) ? $form->form_action : get_permalink(); $out .= '
' . "\n"; $out .= parent::decodeOption($form->custom_code, 1, 1) . '

' . parent::decodeOption($form->form_title, 1, 1) . '

' . "\n"; $fields = parent::getAttachedFieldsArray($fid); $hiddens = ''; $code_type = ($admin_options[code_type] == 'XHTML') ? ' /' : ''; foreach ($fields as $field_id) { $field = parent::selectField($field_id, ''); $req = ($field->field_required == 1 or $field->field_slug == 'ishuman') ? '* ' : ''; $req_long = ($field->field_required == 1) ? ' (required)' : ''; $input_id = 'id="'.parent::decodeOption($field->field_slug, 1, 1).'"'; $field_value = parent::decodeOption($field->field_value, 1, 1); $instructions = (empty($field->field_instructions)) ? '' : 'title="' . $field->field_instructions . $req_long . '" class="tooltip-field"'; if ($admin_options[enable_widget_tooltips] == 0 && $is_sidebar) $instructions = ''; if ($_SESSION[fields][$field->field_slug]) { if ($admin_options[remember_field_values] == 1) $field_value = $_SESSION[fields][$field->field_slug]; } if ($field->user_field == 0 && $field->field_slug == 'captcha') { $out .= '
' . "\n" . $this->getCaptchaCode($form->id) . "\n" . '
' . "\n"; } elseif ($field->field_type == 'Text') { $maxlength = (empty($field->field_maxlength) or $field->field_maxlength <= 0) ? '' : ' maxlength="'.$field->field_maxlength.'"'; $out .= '
'."\n".''."\n".''."\n".'
' . "\n"; } elseif ($field->field_type == 'Hidden') { $hiddens .= '' . "\n"; } elseif ($field->field_type == 'Checkbox') { $out .= '
'."\n".' '."\n".''."\n".'
' . "\n"; } elseif ($field->field_type == 'Textarea') { $out .= '
'."\n".''."\n".''."\n".'
' . "\n"; } } $submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit'; $out .= ''."\n".''."\n".$hiddens."\n".'' . "\n" . '
'; if ($admin_options[author_link] == 1) $out .= "\n".'Wordpress plugin expert and Rockville Web Developer Taylor Lovett'; if ($form->form_style != 0) { $form_styles .= '' . "\n"; } return $form_styles . $out . $this->wheresWaldo(); } function getCaptchaCode($form_id) { $admin_options = $this->getAdminOptions(); $code_type = ($admin_options[code_type] == 'XHTML') ? ' /' : ''; $captcha = parent::selectField('', 'captcha'); $instructions = (empty($captcha->field_instructions)) ? '' : 'title="'.$captcha->field_instructions.'" class="tooltip-field"'; $out = 'Captcha image for a contact form
'; return $out; } function startSession() { if (!session_id()) session_start(); } function contactAuthor($name, $email, $website, $message, $type) { if (empty($message)) return false; $admin_options = $this->getAdminOptions(); $body = "Name: $name\n"; $body .= "Email: $email\n"; $body .= "Website: $website\n"; $body .= "Message: $message\n"; $body .= "Message Type: $type\n"; $body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n"; $mailer = new CustomContactFormsMailer('admin@taylorlovett.com', $email, "CCF Message: $type", stripslashes($body), $admin_options[wp_mail_function]); $mailer->send(); return true; } function insertFormSuccessCode() { ?>
current_thank_you_message_title; ?>

current_thank_you_message; ?>

[close]
$v) { if (empty($array[$k])) unset($array[$k]); } return $array; } function processForms() { if ($_POST[ccf_customhtml]) { $admin_options = $this->getAdminOptions(); $fixed_customhtml_fields = array('required_fields', 'success_message', 'thank_you_page', 'destination_email', 'ccf_customhtml'); $req_fields = $this->requiredFieldsArrayFromList($_POST[required_fields]); $body = ''; foreach ($_POST as $key => $value) { if (!in_array($key, $fixed_customhtml_fields)) { if (in_array($key, $req_fields) && !empty($value)) unset($req_fields[array_search($key, $req_fields)]); $body .= ucwords(str_replace('_', ' ', $key)) . ': ' . $value . "\n"; } } foreach($req_fields as $err) $this->setFormError($err, 'You left the "' . $err . '" field blank.'); $errors = $this->getAllFormErrors(); if (empty($errors)) { $body .= "\n" . 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n"; $mailer = new CustomContactFormsMailer($_POST[destination_email], $admin_options[default_from_email], $admin_options[default_form_subject], stripslashes($body), $admin_options[wp_mail_function]); $mailer->send(); if ($_POST[thank_you_page]) header("Location: " . $_POST[thank_you_page]); $this->current_thank_you_message = (!empty($_POST[success_message])) ? $_POST[success_message] : $admin_options[form_success_message]; add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1); } } elseif ($_POST[customcontactforms_submit]) { $this->startSession(); $this->error_return = $_POST[form_page]; $admin_options = $this->getAdminOptions(); $fields = parent::getAttachedFieldsArray($_POST[fid]); $form = parent::selectForm($_POST[fid]); $checks = array(); $cap_name = 'captcha_' . $_POST[fid]; foreach ($fields as $field_id) { $field = parent::selectField($field_id, ''); if ($field->field_slug == 'ishuman') { if ($_POST[ishuman] != 1) $this->setFormError('ishuman', 'Only humans can use this form.'); } elseif ($field->field_slug == 'captcha') { if ($_POST[captcha] != $_SESSION[$cap_name]) $this->setFormError('captcha', 'You entered the captcha image code incorrectly'); } elseif ($field->field_slug == 'fixedEmail' && $field->field_required == 1 && !empty($_POST[fixedEmail])) { if (!$this->validEmail($_POST[fixedEmail])) $this->setFormError('bad_email', 'The email address you provided was invalid.'); } else { if ($field->field_required == 1 && empty($_POST[$field->field_slug])) $this->setFormError($field->field_slug, 'You left the "'.$field->field_label.'" field blank.'); } if ($field->field_type == 'Checkbox') $checks[] = $field->field_slug; } $body = ''; foreach ($_POST as $key => $value) { $_SESSION[fields][$key] = $value; $field = parent::selectField('', $key); if (!array_key_exists($key, $this->fixed_fields)) $body .= $field->field_label . ': ' . $value . "\n"; if (in_array($key, $checks)) { $checks_key = array_search($key, $checks); unset($checks[$checks_key]); } } foreach ($checks as $check_key) { $field = parent::selectField('', $check_key); $body .= ucwords(str_replace('_', ' ', $field->field_label)) . ': 0' . "\n"; } $errors = $this->getAllFormErrors(); if (empty($errors)) { unset($_SESSION['captcha_' . $_POST[fid]]); unset($_SESSION[fields]); $body .= 'Sender IP: ' . $_SERVER['REMOTE_ADDR'] . "\n"; $to_email = (!empty($form->form_email)) ? $form->form_email : $admin_options[default_to_email]; $mailer = new CustomContactFormsMailer($to_email, $admin_options[default_from_email], $admin_options[default_form_subject], stripslashes($body), $admin_options[wp_mail_function]); $mailer->send(); if (!empty($form->form_thank_you_page)) { header("Location: " . $form->form_thank_you_page); } $this->current_thank_you_message = (!empty($form->form_success_message)) ? $form->form_success_message : $admin_options[form_success_message]; $this->current_thank_you_message_title = (!empty($form->form_success_title)) ? $form->form_success_title : $admin_options[form_success_message_title]; add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1); } unset($_POST); } } } } require_once('custom-contact-forms-widget.php'); $customcontact = new CustomContactForms(); if (!function_exists('CustomContactForms_ap')) { function CustomContactForms_ap() { global $customcontact; if (!isset($customcontact)) return; if (function_exists('add_options_page')) { add_options_page('Custom Contact Forms', 'Custom Contact Forms', 9, 'custom-contact-forms', array(&$customcontact, 'printAdminPage')); } } } if (!function_exists('serveCustomContactForm')) { function serveCustomContactForm($fid) { global $customcontact; echo $customcontact->getFormCode($fid); } } if (!function_exists('CCFWidgetInit')) { function CCFWidgetInit() { register_widget('CustomContactFormsWidget'); } } if (isset($customcontact)) { add_action('init', array(&$customcontact, 'init'), 1); add_action('wp_print_scripts', array(&$customcontact, 'insertFrontEndScripts'), 1); add_action('admin_print_scripts', array(&$customcontact, 'insertAdminScripts'), 1); add_action('wp_print_styles', array(&$customcontact, 'insertStyleSheets'), 1); add_action('admin_print_styles', array(&$customcontact, 'insertStyleSheets'), 1); add_filter('the_content', array(&$customcontact, 'contentFilter')); /*add_action('wp_footer', array(&$customcontact, 'insertPopoverCode'));*/ add_action('widgets_init', 'CCFWidgetInit'); add_action('admin_menu', 'CustomContactForms_ap'); } //add_action('wp_footer', array(&$customcontact, 'insertFormSuccessCode'), 1); ?>