Documentation

<< SimpleContactForm.configuration.php

SimpleContactForm.php

This file holds the entire SimpleContactForm class.

Properties

Property Attributes Description
ROOT private static Defines the relative path from the base HTML file to PHPMailer. This value is read from the global configuration file during initialization.
PHPMAILER_ROOT private static Defines the location of the PHPMailer library. This value is read from the global configuration file during initialization.
defaultConfig private static Stores the configuration loaded from the global configuration file during initialization.
forms private static A list of all forms created on this page.
supportsGD private static Does the server that this script is running on support the GD image library?
useExternalFiles private static If true the CSS and Javascript files provided with this script will not be loaded during initialization. This value is read from the global configuration file during initialization.
name private The name identifying this form.
id private This form's id.
path private The path to this forms files.
name private The name identifying this form.
config private The configuration specific to this form.
strings private Stores the strings loaded from the configuration file. See SimpleContactForm.configuration.php for details.
pending private Set to true once this form has been displayed.
fields private An array of field definitions for this form loaded from the configuration files. See SimpleContactForm.configuration.php for details.
data private Stores field data as it is processed when a form is submitted.
validation private Stores validation messages that need to be passed back to Javascript.
valid private Is the submitted form valid?
error private Stores any errors that occurs when a form is submitted.

Functions

Function Attributes Description
getData public static Utility function that returns and cleans a single field's submitted data.
  • name : The name of the field to get the data from
getJavascriptArray public static Returns a string representing the given array as valid Javascript code.
  • array : The array to convert to Javascript.
  • keys : If true the output will use the array keys instaead of its values.
includeHeadHTML public static Includes any necessary files (CSS and javascript) needed for displaying a form. This function should be called inside of the head tag of a page.
initialize public static This function loads the default configuration. It should be called once at the very top of the page and before any forms are created or used.
SimpleContactForm public Creates a new form and loads its configuration. If the form has been submitted teh submit function is called to start validation.
  • name : The name of the newly created form
__clone public Prevent users from cloning an instance of this object.
getString public Returns a string defined in the configuration file.
  • name : The name of the message string to return.
  • ... : Any other arguments passed to this function will be substituted in the returned message string.
HTMLCheckField public Checks if this field has passed validation. If this field failed validation then the function will output invalid.
  • fieldName : The name of the field to be checked.
HTMLCheckOption public Used by radio buttons and checkboxes to check if this option was selected when the form was submitted last. If it was HTML code to mark this input as selected is sent out.
  • fieldName : The name of the field to check.
  • option : The value of the current option to check.
  • default : Is this option also the default option? Options marked as default will be selected when no other selection is made.
HTMLFormHeader public Outputs an anchor for this form and displays any messages generated when this form was submitted.
HTMLFormVerification public Outputs this form's verification/captcha field. If useTextCaptcha is set then a simple security question is display, otherwise a captcha image is shown.
  • fieldName : The name if the verification field.
  • className : The name of a CSS class to assign to the HTML element generated by this function.
HTMLGetCheckedState public Used to select checkboxes that were checked when the form was submitted.
  • fieldName : The name of the field to check.
  • value : The value of the field.
HTMLGetSelectedState public Used to a combo boxes selection after a form is submitted.
  • fieldName : The name of the field to check.
  • value : The value of the current option to check.
HTMLGetValue public Outputs the value of a field.
  • fieldName : The name of the field to output.
  • rawValue : If true the fields value is output normally. If false, the value is wrapped in a value attribute so that it can be used inside of an HTML input tag : (value="VALUE")
includeFormHTML public Directly outputs this form loaded from this form's form file..
submit private Data submitted by the form will first be validated. If validation is a succes the the email will be created and sent

<< SimpleContactForm.configuration.php