Starting version 3.0.0 we have published documentation for developer’s APIs and built in functionalities that you can use directly. These APIs come handy in case you want to extend eForm and/or develop your own addon to incorporate newer functionality. Please browse all the available APIs below.
[notification type=”alert-info” close=”false” ]This tutorial assumes that you have profound knowledge of WordPress Plugin API. eForm API is built on top of WordPress Plugin API and uses the same functionalities to provide extensibility.[/notification]
Before you start:
Here are a few things to consider.
- We endorse and encourage WordPress Coding Standard.
- All eForm functions, classes are prefixed with
ipt_fsqm
.
Plugin main classes
Form element classes and functionalities are widely categorized into five sections.
- Basic Structural class –
classes/class-ipt-fsqm-form-elements-base.php::IPT_FSQM_Form_Elements_Base
- Administrative Form Builder –
classes/class-ipt-fsqm-form-elements-admin.php::IPT_FSQM_Form_Elements_Admin
- Data Processing and validation –
classes/class-ipt-fsqm-form-elements-data.php::IPT_FSQM_Form_Elements_Data
- Frontend Form Output –
classes/class-ipt-fsqm-form-elements-front.php::IPT_FSQM_Form_Elements_Front
- Report and Data Analysis –
classes/class-ipt-fsqm-form-elements-utilities.php::IPT_FSQM_Form_Elements_Utilities
Apart from these, there are three different classes that you need to look into.
- UI element abstraction class –
lib/classes/class-ipt-plugin-uif-base.php::IPT_Plugin_UIF_Base
- Admin side UI class –
lib/classes/class-ipt-plugin-uif-admin.php::IPT_Plugin_UIF_Admin
- Front side UI class –
lib/classes/class-ipt-plugin-uif-front.php::IPT_Plugin_UIF_Front
Plugin Directory Structure
[text]wp-fsqm-pro = [ROOT DIRECTORY]
├───classes = [ALL eForm RELATED PHP CLASSES]
├───integrations = [THIRD PARTY INTEGRATION LIBRARIES]
├───lib = [INTERNAL AND THIRD PARTY LIBRARIES]
│ ├───classes = [PHP CLASSES]
│ ├───css = [CSS FILES]
│ ├───fonts = [WEB FONT FILES]
│ ├───images = [IMAGE FILES]
│ │ └───icomoon = [ICOMOON FONT IMAGE FILES]
│ ├───img = [IMAGE FILES]
│ └───js = [JAVASCRIPT FILES]
├───static = [STATIC eForm FILES]
│ ├───admin = [FOR ADMINISTRATOR AREA]
│ │ ├───css
│ │ ├───images
│ │ └───js
│ ├───common = [FOR ADMINISTRATOR AND FRONTEND]
│ │ ├───css
│ │ └───js
│ └───front = [FOR FRONTEND AREA]
│ ├───css
│ │ └───ui-themes = [CSS FILES FOR FORM THEMES]
│ ├───images
│ └───js
└───translations = [TRANSLATIONS]
[/text]
Global Variables
There are two global variables that eForm registers and uses throughout the execution.
$ipt_fsqm_settings
Holds basic settings of eForm. It is an associative array which looks like this.
[text]Array
(
[email] => [email protected] // Global Email Notification
[track_page] => 11 // ID of trackback page
[utrack_page] => 13 // ID of user portal page
[backward_shortcode] => // Bool – Whether or not to have backward compatible shortcode (prior version 2 shortcodes were different)
[delete_uninstall] => // Bool – Whether or not to delete all settings and clear database during plugin uninstallation
[standalone] => Array // Settings for standalone forms
(
[base] => eforms // Permalink base
[before] => // Before form HTML
[after] => // After form HTML
[head] => // Head section HTML
)
)[/text]
$ipt_fsqm_info
Holds basic information of eForm. This is modified only during plugin installation and updation. You should not change or fiddle with this, unless you know what you are doing. The data structure is an associative array.
[text]
Array
(
[version] => // Current version
[form_table] => // Name of form table
[data_table] => // Name of data table
[file_table] => // Name of file table
[category_table] => // Name of category table
)
[/text]
Database Structure
There are five database tables that eForm makes during its installation. The $charset_collate
global WP variable sets the charterset and collate. All of the are created using dbDelta
method.
Form Table
By default named {prefix}fsq_form
. The schema is as follows.
[sql]
CREATE TABLE {$prefix}fsq_form (
id BIGINT(20) UNSIGNED NOT NULL auto_increment,
name VARCHAR(255) NOT NULL default ”,
settings LONGTEXT NOT NULL,
layout LONGTEXT NOT NULL,
design LONGTEXT NOT NULL,
mcq LONGTEXT NOT NULL,
freetype LONGTEXT NOT NULL,
pinfo LONGTEXT NOT NULL,
type TINYINT(1) NOT NULL default 1,
updated DATETIME NOT NULL default ‘0000-00-00 00:00:00’,
category BIGINT(20) UNSIGNED NOT NULL default 0,
PRIMARY KEY (id)
)
[/sql]
Data Table
By default named {prefix}fsq_data
. The schema is as follows.
[sql]
CREATE TABLE {$prefix}fsq_data (
id BIGINT(20) UNSIGNED NOT NULL auto_increment,
form_id BIGINT(20) UNSIGNED NOT NULL default 0,
f_name VARCHAR(255) NOT NULL default ”,
l_name VARCHAR(255) NOT NULL default ”,
email VARCHAR(255) NOT NULL default ”,
phone VARCHAR(20) NOT NULL default ”,
mcq LONGTEXT NOT NULL,
freetype LONGTEXT NOT NULL,
pinfo LONGTEXT NOT NULL,
ip VARCHAR(50) NOT NULL default ‘0.0.0.0’,
star TINYINT(1) NOT NULL default 0,
score INT(10) NOT NULL default 0,
max_score INT(10) NOT NULL default 0,
url_track VARCHAR(255) NOT NULL default ”,
date DATETIME NOT NULL default ‘0000-00-00 00:00:00’,
comment LONGTEXT NOT NULL,
user_id BIGINT(20) UNSIGNED NOT NULL default 0,
referer TEXT NOT NULL,
PRIMARY KEY (id)
)
[/sql]
Files Table
By default named {prefix}fsq_files
. The schema is as follows.
[sql]
CREATE TABLE {$prefix}fsq_files (
id BIGINT(20) UNSIGNED NOT NULL auto_increment,
form_id BIGINT(20) UNSIGNED NOT NULL default 0,
data_id BIGINT(20) UNSIGNED NOT NULL default 0,
element_id BIGINT(20) UNSIGNED NOT NULL default 0,
media_id BIGINT(20) UNSIGNED NOT NULL default 0,
name VARCHAR(255) NOT NULL default ”,
filename VARCHAR(255) NOT NULL default ”,
mime_type VARCHAR(255) NOT NULL default ”,
size BIGINT(20) UNSIGNED NOT NULL default 0,
guid VARCHAR(255) NOT NULL default ”,
path VARCHAR(255) NOT NULL default ”,
thumb_url VARCHAR(255) NOT NULL default ”,
date DATETIME NOT NULL default ‘0000-00-00 00:00:00’,
PRIMARY KEY (id)
)
[/sql]
Category Table
By default named {prefix}fsq_category
. The schema is as follows.
[sql]
CREATE TABLE {$prefix}fsq_category (
id BIGINT(20) UNSIGNED NOT NULL auto_increment,
name VARCHAR(255) NOT NULL default ”,
description LONGTEXT NOT NULL,
PRIMARY KEY (id)
)
[/sql]
Payment Table
By default named {prefix}fsq_payment
. The schema is as follows.
[sql]
CREATE TABLE {$prefix}fsq_payment (
id bigint(20) NOT NULL AUTO_INCREMENT,
txn varchar(30) DEFAULT NULL,
form_id bigint(20) UNSIGNED NOT NULL DEFAULT ‘0’,
data_id bigint(20) UNSIGNED NOT NULL DEFAULT ‘0’,
user_id bigint(20) UNSIGNED NOT NULL DEFAULT ‘0’,
amount decimal(12,2) DEFAULT NULL,
mode varchar(255) NOT NULL,
status tinyint(1) NOT NULL DEFAULT ‘0’,
meta longtext NOT NULL,
currency varchar(10) NOT NULL DEFAULT ‘USD’,
date datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
type tinyint(1) UNSIGNED NOT NULL DEFAULT ‘0’,
rplan varchar(255) NOT NULL DEFAULT ”,
rinterval tinyint(1) UNSIGNED NOT NULL DEFAULT ‘0’,
rfrequency smallint(5) UNSIGNED NOT NULL DEFAULT ‘0’,
PRIMARY KEY (id),
UNIQUE KEY data_id (data_id),
UNIQUE KEY txn (txn)
);
[/sql]
List of Plugin APIs
eForm uses WP’s own filter and hook system to provide extensibility. For your ease, we have categorized the available hooks and filters into following sections.
Category | Hooks | Filters |
---|---|---|
Form builder & plugin menu modification | ipt_fsqm_admin_tab_settings | |
ipt_fsqm_admin_menus | ||
ipt_fsqm_integration_settings_tabs | ||
Basic form & submission administrative actions | ipt_fsqm_forms_deleted | |
ipt_fsqm_submissions_deleted | ||
ipt_fsqm_form_updated | ||
ipt_fsqm_form_created | ||
ipt_fsqm_hook_form_doing_admin_before | ||
ipt_fsqm_submissions_starred | ||
ipt_fsqm_submissions_unstarred | ||
ipt_fsqm_form_copied | ||
ipt_fsqm_form_category_created | ||
ipt_fsqm_form_category_updated | ||
ipt_fsqm_form_category_deleted | ||
Form variables and data structure | ipt_fsqm_filter_valid_elements | |
ipt_fsqm_form_element_structure | ||
ipt_fsqm_filter_form_data_structure | ||
ipt_fsqm_filter_default_settings | ||
ipt_fsqm_filter_available_themes | ||
ipt_fsqm_filter_available_webfonts | ||
Shortcode generator (will be deprecated soon) | ipt_fsqm_shortcode_wizard | ipt_fsqm_filter_data_errors |
Form submission handling | ipt_fsqm_hook_save_insert | ipt_fsqm_filter_save_error |
ipt_fsqm_hook_save_update | ipt_fsqm_user_email | |
ipt_fsqm_hook_save_success | ipt_fsqm_admin_email | |
ipt_fsqm_hook_save_error | ipt_fsqm_filter_save_success | |
ipt_fsqm_form_elements_quick_preview_email_style | ||
ipt_fsqm_filter_social_buttons | ||
ipt_fsqm_form_progress_buttons | ||
File upload handling | ipt_fsqm_hook_save_fileupload | ipt_fsqm_files_blacklist |
ipt_fsqm_files_error_messages | ||
Third-party integration | ipt_fsqm_hook_integration | ipt_fsqm_integration_settings_tabs |
Label and Richtext output handling | ipt_uif_richtext | |
ipt_uif_label | ||
Form output control | ipt_fsqm_hook_form_before | |
ipt_fsqm_hook_form_after | ||
ipt_fsqm_hook_form_fullview_before | ||
Standalone permalink | ipt_fsqm_standalone_base | |
ipt_fsqm_standalone_permalink | ||
Enqueue & Library | ipt_fsqm_form_elements_front_enqueue | ipt_fsqm_report_js |
ipt_fsqm_form_elements_up_enqueue | ipt_fsqm_filter_utilities_report_print | |
ipt_fsqm_report_enqueue | ipt_uif_valid_icons_image | |
ipt_plugin_ui_enqueue | ipt_uif_valid_icons_hex | |
User Portal & Trackback | ipt_fsqm_up_filter_action_button | |
ipt_fsqm_filter_static_report_print |
Third party script
eForm uses some third party scripts for it’s functionality. The scripts are enqueued through WP API wp_enqueue_script and CSS are enqueued through WP API wp_enqueue_style. All of them are documented here.
[button style=”btn-default btn-lg btn-block” type=”link” target=”true” title=”eForm CSS and JS enqueue” link=”http://wpquark.com/kb/fsqm/fsqm-api/fsqm-css-js-enqueue/” linkrel=””]