-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathapi.php
120 lines (96 loc) · 3.55 KB
/
api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* Form Tools API
* --------------
*
* This file is provided for backward compatibility only for users who are using the API 1.x versions and want to
* upgrade to Form Tools 3. It contains wrapper methods with the old function methods that now call the new API class
* methods.
*
* Please don't use this file! It will be dropped at some point. Use the API.class.php methods directly.
*
* Documentation:
* https://docs.formtools.org/api/
*/
require_once("API.class.php");
use FormTools\API;
use FormTools\Core;
// wrapper functions for the new API class methods
function ft_api_get() {
return new API();
}
function ft_api_show_submissions($form_id, $view_id, $export_type_id, $page_num = 1, $options = array()) {
$api = ft_api_get();
return $api->showSubmissions($form_id, $view_id, $export_type_id, $page_num, $options);
}
function ft_api_show_submission($form_id, $view_id, $export_type_id, $submission_id) {
$api = ft_api_get();
$api->showSubmission($form_id, $view_id, $export_type_id, $submission_id);
}
function ft_api_show_submission_count($form_id, $view_id = "") {
$API = ft_api_get();
return $API->showSubmissionCount($form_id, $view_id);
}
function ft_api_create_blank_submission($form_id, $finalized = false, $default_values = array()) {
$api = ft_api_get();
return $api->createSubmission($form_id, $finalized, $default_values);
}
function ft_api_init_form_page($form_id = "", $mode = "live", $namespace = "form_tools_form") {
$api = ft_api_get();
return $api->initFormPage($form_id, $mode, $namespace);
}
function ft_api_clear_form_sessions($namespace = "form_tools_form") {
$api = ft_api_get();
$api->clearFormSessions($namespace);
}
function ft_api_process_form($params) {
$api = ft_api_get();
return $api->processFormSubmission($params);
}
function ft_api_display_image_field($params) {
$api = ft_api_get();
return $api->displayImageField($params);
}
function ft_api_load_field($field_name, $session_name, $default_value) {
$api = ft_api_get();
return $api->loadField($field_name, $session_name, $default_value);
}
function ft_api_login($info) {
$api = new API(array("start_settings" => true));
return $api->login($info);
}
function ft_api_create_client_account($account_info) {
$api = ft_api_get();
return $api->createClientAccount($account_info);
}
function ft_api_update_client_account($account_id, $info) {
$api = ft_api_get();
return $api->updateClientAccount($account_id, $info);
}
function ft_api_delete_client_account($account_id) {
$api = ft_api_get();
return $api->deleteClientAccount($account_id);
}
function ft_api_delete_unfinalized_submissions($form_id, $delete_all = false) {
$api = ft_api_get();
return $api->deleteUnfinalizedSubmissions($form_id, $delete_all);
}
function ft_api_display_captcha() {
$api = ft_api_get();
return $api->displayCaptcha();
}
function ft_api_check_submission_is_unique($form_id, $criteria, $current_submission_id = "") {
$api = ft_api_get();
return $api->checkSubmissionIsUnique($form_id, $criteria, $current_submission_id);
}
function ft_api_start_sessions() {
Core::startSessions();
}
function ft_api_display_post_form_captcha_error($message = "") {
$api = ft_api_get();
$api->displayPostFormCaptchaError($message);
}
function ft_api_get_submission($form_id, $submission_id) {
$api = ft_api_get();
return $api->getSubmission($form_id, $submission_id);
}