Version Description
Download this release
Release Info
Developer | 123contactform |
Plugin | Forms by CaptainForm – Form Builder for WordPress |
Version | 1.7.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.1 to 1.7.1.1
- captainform.php +1 -1
- includes/display-functions.php +222 -181
- includes/form-resources/global-vars.php +10 -9
- includes/form-resources/normal-embedding.php +22 -20
- includes/integrations/forge-element.php +8 -14
- includes/settings.php +1 -1
- includes/shortcodes.php +28 -23
- readme.txt +18 -11
captainform.php
CHANGED
@@ -6,7 +6,7 @@ defined('ABSPATH') or die('No direct access!');
|
|
6 |
Description: CaptainForm is a fully-featured WordPress form plugin created for web designers, developers, and also for non-tech savvy users.
|
7 |
Author: CaptainForm
|
8 |
Author URI: https://profiles.wordpress.org/captainform
|
9 |
-
Version: 1.7.1
|
10 |
*/
|
11 |
|
12 |
/* * ****************************
|
6 |
Description: CaptainForm is a fully-featured WordPress form plugin created for web designers, developers, and also for non-tech savvy users.
|
7 |
Author: CaptainForm
|
8 |
Author URI: https://profiles.wordpress.org/captainform
|
9 |
+
Version: 1.7.2.1
|
10 |
*/
|
11 |
|
12 |
/* * ****************************
|
includes/display-functions.php
CHANGED
@@ -4,170 +4,211 @@ defined('ABSPATH') or die('No direct access!');
|
|
4 |
$custom_vars = null;
|
5 |
function captainform_add_content($content)
|
6 |
{
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
function captainform_filter_summary($content)
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
}
|
16 |
|
17 |
add_filter('the_content', 'captainform_add_content');
|
18 |
add_filter('post_content', 'captainform_add_content');
|
19 |
add_filter('the_excerpt', 'captainform_filter_summary');
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
function captainform_replace_pattern($matches)
|
23 |
{
|
24 |
-
|
25 |
$shortcode = $matches[1];
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
$content_regex =
|
41 |
-
|
42 |
-
|
43 |
$url_regex = '/\[[^\[]*captain-?form.*url=[\',"]{1}([a-zA-Z0-9\/\-_\.\s\:\?\=]+)[\',"]{1}[^\]]*\]/';
|
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 |
$form_id = 0;
|
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 |
$content = $shortcode_option_text_content;
|
|
|
|
|
112 |
}
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
$miliseconds = intval($shortcode_option_miliseconds);
|
146 |
-
}
|
147 |
-
if(isset($GLOBALS['captainform_formcode_pattern_lightbox_auto']))
|
148 |
$pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox_auto'];
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
}
|
167 |
|
168 |
function captainform_remove_pattern()
|
169 |
{
|
170 |
-
|
171 |
}
|
172 |
|
173 |
/**
|
@@ -175,15 +216,15 @@ function captainform_remove_pattern()
|
|
175 |
* @param string
|
176 |
* @return string
|
177 |
**/
|
178 |
-
function captainform_text_filter($content, $
|
179 |
{
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
}
|
188 |
|
189 |
/**
|
@@ -191,50 +232,50 @@ function captainform_text_filter($content, $customVars2 = "", $custom_options =
|
|
191 |
* */
|
192 |
// Makes sure the plugin is defined before trying to use it
|
193 |
if (!function_exists('is_plugin_active_for_network')) {
|
194 |
-
|
195 |
}
|
196 |
|
197 |
//show editor toolbar icon only if plugin is active
|
198 |
if (in_array($captainform_plugin_name . '/' . $captainform_plugin_name . '.php', get_option('active_plugins')) || is_plugin_active_for_network($captainform_plugin_name . '/' . $captainform_plugin_name . '.php'))
|
199 |
-
|
200 |
|
201 |
function captainform_add_button($buttons)
|
202 |
{
|
203 |
-
|
204 |
-
|
205 |
}
|
206 |
|
207 |
|
208 |
if (!function_exists('captain_form')) {
|
209 |
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
}
|
4 |
$custom_vars = null;
|
5 |
function captainform_add_content($content)
|
6 |
{
|
7 |
+
$content = captainform_text_filter($content);
|
8 |
+
return $content;
|
9 |
}
|
10 |
|
11 |
function captainform_filter_summary($content)
|
12 |
{
|
13 |
+
$content = captainform_text_filter($content, NULL, NULL, true);
|
14 |
+
return $content;
|
15 |
}
|
16 |
|
17 |
add_filter('the_content', 'captainform_add_content');
|
18 |
add_filter('post_content', 'captainform_add_content');
|
19 |
add_filter('the_excerpt', 'captainform_filter_summary');
|
20 |
|
21 |
+
function captainform_get_custom_vars_from_shortcode($shortcode)
|
22 |
+
{
|
23 |
+
$custom_vars_string = '';
|
24 |
+
|
25 |
+
preg_replace_callback('/cf_custom_var([\\d-]+)=(\'[^\']+\'|"[^"]+")/', function ($matches) use (&$custom_vars_string) {
|
26 |
+
$custom_vars_string .= '&control' . $matches[1] . '=' . urlencode(substr($matches[2], 1, -1));
|
27 |
+
}, $shortcode);
|
28 |
+
|
29 |
+
return $custom_vars_string;
|
30 |
+
}
|
31 |
+
|
32 |
+
function captainform_get_custom_vars_from_url()
|
33 |
+
{
|
34 |
+
$custom_vars_string = '';
|
35 |
+
|
36 |
+
foreach ($_GET as $key => $value) {
|
37 |
+
if (strpos($key, 'control') !== false) {
|
38 |
+
$custom_vars_string .= '&' . $key . '=' . $value;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
return $custom_vars_string;
|
43 |
+
}
|
44 |
+
|
45 |
+
function captainform_get_custom_vars($shortcode, $extra_vars)
|
46 |
+
{
|
47 |
+
$custom_vars_string = '';
|
48 |
+
$custom_vars_string .= captainform_get_custom_vars_from_shortcode($shortcode);
|
49 |
+
$custom_vars_string .= captainform_get_custom_vars_from_url();
|
50 |
+
if (gettype($extra_vars) == "array" && count($extra_vars)) {
|
51 |
+
foreach ($extra_vars as $key => $value)
|
52 |
+
$custom_vars_string .= '&' . $key . '=' . $value;
|
53 |
+
} elseif (strlen($extra_vars))
|
54 |
+
$custom_vars_string .= $extra_vars;
|
55 |
+
|
56 |
+
if(strlen($custom_vars_string))
|
57 |
+
$custom_vars_string .= '&embeddingCustomVars=true';
|
58 |
+
|
59 |
+
return $custom_vars_string;
|
60 |
+
}
|
61 |
|
62 |
function captainform_replace_pattern($matches)
|
63 |
{
|
64 |
+
global $custom_vars;
|
65 |
$shortcode = $matches[1];
|
66 |
+
|
67 |
+
$captainform_theme_style = '';
|
68 |
+
if (isset($_GET['captainform_theme_style'])) {
|
69 |
+
wp_register_script('captainform_iframe_resizer_win', plugins_url('/includes/js/iframeResizer.contentWindow.min.js', __DIR__), array(), '3.5', false);
|
70 |
+
wp_enqueue_script('captainform_iframe_resizer_win');
|
71 |
+
wp_register_script('nolink', plugins_url('/includes/js/nolink.js', __DIR__), array(), uniqid(), false);
|
72 |
+
wp_enqueue_script('nolink');
|
73 |
+
//wp_enqueue_style('hide_adminbar', plugins_url('/includes/css/hide_adminbar.css', __DIR__), false, uniqid());
|
74 |
+
$captainform_theme_style = '&style=' . $_GET['captainform_theme_style'];
|
75 |
+
}
|
76 |
+
|
77 |
+
$type_regex = '/\[[^\[]*captain-?form*.*type=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
78 |
+
$lightbox_regex = '/\[[^\[]*captain-?form.*lightbox=[\',"]{1}([a-zA-Z0-9\/\-_\.\s]+)[\',"]{1}[^\]]*\]/';
|
79 |
+
|
80 |
+
$content_regex = "/\\[[^\\[]*captain-?form.*content=[\\',\"]{1}([^'\"]+)[\\'\"]{1}[^\\]]*\\]/i";
|
81 |
+
$text_content_regex = '/\[[^\[]*captain-?form.*text_content=[\',"]{1}([^\'"]+)[\'"]{1}[^\]]*\]/';
|
82 |
+
|
83 |
$url_regex = '/\[[^\[]*captain-?form.*url=[\',"]{1}([a-zA-Z0-9\/\-_\.\s\:\?\=]+)[\',"]{1}[^\]]*\]/';
|
84 |
+
$miliseconds_regex = '/\[[^\[]*captain-?form.*miliseconds=[\',"]{1}([0-9]+)[\',"]{1}[^\]]*\]/';
|
85 |
+
$text_color_regex = '/\[[^\[]*captain-?form.*text_color=[\',"]{1}([a-zA-Z0-9]+)[\',"]{1}[^\]]*\]/';
|
86 |
+
$bg_color_regex = '/\[[^\[]*captain-?form.*bg_color=[\',"]{1}([a-zA-Z0-9]+)[\',"]{1}[^\]]*\]/';
|
87 |
+
$position_regex = '/\[[^\[]*captain-?form.*position=[\',"]{1}([a-zA-Z]+)[\',"]{1}[^\]]*\]/';
|
88 |
+
|
89 |
+
preg_match($type_regex, $shortcode, $matches_type);
|
90 |
+
preg_match($lightbox_regex, $shortcode, $matches_lightbox);
|
91 |
+
preg_match($content_regex, $shortcode, $matches_content);
|
92 |
+
preg_match($text_content_regex, $shortcode, $matches_text_content);
|
93 |
+
preg_match($url_regex, $shortcode, $matches_url);
|
94 |
+
preg_match($miliseconds_regex, $shortcode, $matches_miliseconds);
|
95 |
+
preg_match($text_color_regex, $shortcode, $matches_text_color);
|
96 |
+
preg_match($bg_color_regex, $shortcode, $matches_bg_color);
|
97 |
+
preg_match($position_regex, $shortcode, $matches_position);
|
98 |
+
|
99 |
+
$shortcode_option_type = isset($matches_type[1]) ? $matches_type[1] : null;
|
100 |
+
$shortcode_option_lightbox = isset($matches_lightbox[1]) ? $matches_lightbox[1] : null;
|
101 |
+
$shortcode_option_content = isset($matches_content[1]) ? urldecode($matches_content[1]) : null;
|
102 |
+
$shortcode_option_text_content = isset($matches_text_content[1]) ? urldecode($matches_text_content[1]) : null;
|
103 |
+
$shortcode_option_url = isset($matches_url[1]) ? $matches_url[1] : null;
|
104 |
+
$shortcode_option_miliseconds = isset($matches_miliseconds[1]) ? $matches_miliseconds[1] : null;
|
105 |
+
$shortcode_option_text_color = isset($matches_text_color[1]) ? $matches_text_color[1] : '';
|
106 |
+
$shortcode_option_bg_color = isset($matches_bg_color[1]) ? $matches_bg_color[1] : '';
|
107 |
+
$shortcode_option_position = isset($matches_position[1]) ? $matches_position[1] : '';
|
108 |
+
|
109 |
+
if (isset($_GET['cf_form_id']) && isset($_GET['captainform_theme_style'])) {
|
110 |
+
if (intval($_GET['cf_form_id']) && is_numeric($matches[4]) && $_GET['cf_form_id'] !== intval($matches[4])) {
|
111 |
+
echo 'Form hidden in preview mode.';
|
112 |
+
return '';
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
$custom_vars_string = captainform_get_custom_vars($shortcode, $custom_vars);
|
117 |
|
118 |
$form_id = 0;
|
119 |
+
if (is_numeric($matches[4]))
|
120 |
+
$form_id = intval($matches[4]);
|
121 |
+
elseif ($matches[4] == '{cf_form_id}') {
|
122 |
+
if (isset($_GET['cf_form_id']) && intval($_GET['cf_form_id'])) {
|
123 |
+
$form_id = intval($_GET['cf_form_id']);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
if (!$form_id)
|
128 |
+
return '';
|
129 |
+
|
130 |
+
$button_style = '';
|
131 |
+
$content = 'Contact Us';
|
132 |
+
|
133 |
+
$options = array(
|
134 |
+
'id' => $form_id,
|
135 |
+
'style' => $captainform_theme_style,
|
136 |
+
'customVars' => isset($custom_vars_string) ? $custom_vars_string : "",
|
137 |
+
);
|
138 |
+
|
139 |
+
$pattern_type = $GLOBALS['captainform_formcode_pattern'];
|
140 |
+
|
141 |
+
if ($shortcode_option_lightbox == 1 || isset($_GET['captainform_preview_as_lightbox'])) {
|
142 |
+
$miliseconds = 3000;
|
143 |
+
|
144 |
+
if (isset($_GET['captainform_preview_as_lightbox'])) {
|
145 |
+
$shortcode_option_type = 'auto-popup';
|
146 |
+
$miliseconds = 1000;
|
147 |
+
}
|
148 |
+
|
149 |
+
if (isset($GLOBALS['captainform_formcode_pattern_lightbox']))
|
150 |
+
$pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox'];
|
151 |
+
|
152 |
+
if (strlen(trim($shortcode_option_text_content))) {
|
153 |
$content = $shortcode_option_text_content;
|
154 |
+
} else if (strlen(trim($shortcode_option_content))) {
|
155 |
+
$content = $shortcode_option_content;
|
156 |
}
|
157 |
+
|
158 |
+
switch ($shortcode_option_type) {
|
159 |
+
case 'text':
|
160 |
+
break;
|
161 |
+
case 'image':
|
162 |
+
if (strlen(trim($shortcode_option_url))) {
|
163 |
+
$content = '<img border="0" src="' . $shortcode_option_url . '" />';
|
164 |
+
}
|
165 |
+
break;
|
166 |
+
case 'floating-button':
|
167 |
+
if ($shortcode_option_position == 'right') {
|
168 |
+
$pos = 2;
|
169 |
+
$extra_style = 'right: 0; top: 40%;';
|
170 |
+
} elseif ($shortcode_option_position == 'left') {
|
171 |
+
$pos = 1;
|
172 |
+
$extra_style = 'left: 0; top: 40%;';
|
173 |
+
} elseif ($shortcode_option_position == 'bottom') {
|
174 |
+
$pos = 3;
|
175 |
+
$extra_style = 'right: 20%; bottom: 0;';
|
176 |
+
} else {
|
177 |
+
$pos = 1;
|
178 |
+
$extra_style = 'left: 0; top: 0; bottom: 0;';
|
179 |
+
}
|
180 |
+
|
181 |
+
$button_style = 'style="outline:0; text-decoration:none; color:transparent; display:scroll ;z-index:10; border: none; position:fixed; ' . $extra_style . '"';
|
182 |
+
$content = '<img style="box-shadow: none;" border="0" src="https://' . $GLOBALS['captainform_servicedomain'] . '/verticalbutton2.php?bg=' . $shortcode_option_bg_color . '&fnt=' . $shortcode_option_text_color . '&pos=' . $pos . '&text=' . $content . '&font=arialblk" />';
|
183 |
+
break;
|
184 |
+
case 'auto-popup':
|
185 |
+
if (strlen(trim($shortcode_option_miliseconds))) {
|
186 |
+
$miliseconds = intval($shortcode_option_miliseconds);
|
187 |
+
}
|
188 |
+
if (isset($GLOBALS['captainform_formcode_pattern_lightbox_auto']))
|
|
|
|
|
|
|
189 |
$pattern_type = $GLOBALS['captainform_formcode_pattern_lightbox_auto'];
|
190 |
+
break;
|
191 |
+
default:
|
192 |
+
break;
|
193 |
+
}
|
194 |
+
|
195 |
+
$options = array(
|
196 |
+
'id' => $form_id,
|
197 |
+
'button_style' => $button_style,
|
198 |
+
'content' => $content,
|
199 |
+
'miliseconds' => $miliseconds,
|
200 |
+
'customVars' => isset($custom_vars_string) ? $custom_vars_string : "",
|
201 |
+
'style' => $captainform_theme_style
|
202 |
+
);
|
203 |
+
}
|
204 |
+
|
205 |
+
$formcode = captainform_replace_patterns($pattern_type, $options);
|
206 |
+
return $formcode;
|
207 |
}
|
208 |
|
209 |
function captainform_remove_pattern()
|
210 |
{
|
211 |
+
return '';
|
212 |
}
|
213 |
|
214 |
/**
|
216 |
* @param string
|
217 |
* @return string
|
218 |
**/
|
219 |
+
function captainform_text_filter($content, $custom_vars = "", $custom_options = array(), $summary = false)
|
220 |
{
|
221 |
+
$GLOBALS['custom_vars'] = $custom_vars;
|
222 |
+
|
223 |
+
$pattern = '/(\[[^\[]*(captain-?form).*(id?|i)=?"?([0-9]+|{cf_form_id})"?[^\]]*\])/';
|
224 |
+
if ($summary === true)
|
225 |
+
return preg_replace_callback($pattern, 'captainform_remove_pattern', $content);
|
226 |
+
else
|
227 |
+
return preg_replace_callback($pattern, 'captainform_replace_pattern', $content);
|
228 |
}
|
229 |
|
230 |
/**
|
232 |
* */
|
233 |
// Makes sure the plugin is defined before trying to use it
|
234 |
if (!function_exists('is_plugin_active_for_network')) {
|
235 |
+
require_once(ABSPATH . '/wp-admin/includes/plugin.php');
|
236 |
}
|
237 |
|
238 |
//show editor toolbar icon only if plugin is active
|
239 |
if (in_array($captainform_plugin_name . '/' . $captainform_plugin_name . '.php', get_option('active_plugins')) || is_plugin_active_for_network($captainform_plugin_name . '/' . $captainform_plugin_name . '.php'))
|
240 |
+
add_filter('mce_buttons', 'captainform_add_button', 0);
|
241 |
|
242 |
function captainform_add_button($buttons)
|
243 |
{
|
244 |
+
array_push($buttons, 'separator', 'captainform');
|
245 |
+
return $buttons;
|
246 |
}
|
247 |
|
248 |
|
249 |
if (!function_exists('captain_form')) {
|
250 |
|
251 |
|
252 |
+
function captain_form($id, $custom_options = array())
|
253 |
+
{
|
254 |
+
$custom_vars = isset($custom_options['custom_vars']) ? $custom_options['custom_vars'] : '';
|
255 |
+
|
256 |
+
$shortcode_final = '[captainform id="' . $id . '" ';
|
257 |
+
$shortcode_final .= (isset($custom_options['lightbox'])) ? "lightbox='{$custom_options['lightbox']}'" : '';
|
258 |
+
$shortcode_final .= (isset($custom_options['type'])) ? "type='{$custom_options['type']}'" : '';
|
259 |
+
$shortcode_final .= (isset($custom_options['url'])) ? "url='{$custom_options['url']}'" : '';
|
260 |
+
if (isset($custom_options['text_content']))
|
261 |
+
$shortcode_final .= "text_content='" . $custom_options['text_content'] . "'";
|
262 |
+
else
|
263 |
+
$shortcode_final .= (isset($custom_options['content'])) ? "content='{$custom_options['content']}'" : '';
|
264 |
+
$shortcode_final .= (isset($custom_options['miliseconds'])) ? "miliseconds='{$custom_options['miliseconds']}'" : '';
|
265 |
+
$shortcode_final .= (isset($custom_options['text_color'])) ? "text_color='{$custom_options['text_color']}'" : '';
|
266 |
+
$shortcode_final .= (isset($custom_options['bg_color'])) ? "bg_color='{$custom_options['bg_color']}'" : '';
|
267 |
+
$shortcode_final .= (isset($custom_options['position'])) ? "position='{$custom_options['position']}'" : '';
|
268 |
+
|
269 |
+
$shortcode_final .= ']';
|
270 |
+
|
271 |
+
if ($custom_vars != "") {
|
272 |
+
if (gettype($custom_vars) == "array") {
|
273 |
+
$custom_vars = http_build_query($custom_vars);
|
274 |
+
}
|
275 |
+
}
|
276 |
+
return captainform_widget_text_filter($shortcode_final, $custom_vars);
|
277 |
+
}
|
278 |
+
|
279 |
+
//Allow captain_form() function to be called from any file
|
280 |
+
register_activation_hook(__FILE__, 'captain_form');
|
281 |
}
|
includes/form-resources/global-vars.php
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
<script type="text/javascript">
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
11 |
</script>
|
1 |
<script type="text/javascript">
|
2 |
+
jQuery(document).ready(function() {
|
3 |
+
if (document.getElementById('captainform_js_global_vars') == null) {
|
4 |
+
append_element({
|
5 |
+
elementType: "script",
|
6 |
+
type: "text/javascript",
|
7 |
+
id: "captainform_js_global_vars",
|
8 |
+
textContent: 'var frmRef=""; try { frmRef=window.top.location.href; } catch(err) {}; var captainform_servicedomain="<?php echo $captainform_servicedomain;?>";var cfJsHost = "https://";',
|
9 |
+
});
|
10 |
+
}
|
11 |
+
});
|
12 |
</script>
|
includes/form-resources/normal-embedding.php
CHANGED
@@ -1,29 +1,31 @@
|
|
1 |
<script id="{{ID}}" type="text/javascript">
|
2 |
var customVarsMF = '{{CUSTOMVARS}}';
|
3 |
var captainform_theme_style = '{{STYLE}}';
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
append_element({
|
7 |
elementType: "script",
|
8 |
type: "text/javascript",
|
9 |
-
id: "
|
10 |
-
src: cfJsHost + captainform_servicedomain + "/
|
|
|
11 |
});
|
12 |
-
}
|
13 |
-
if(document.getElementById('iframeresizer_embedding_system') == null)
|
14 |
-
{
|
15 |
-
append_element({
|
16 |
-
elementType: "script",
|
17 |
-
type: "text/javascript",
|
18 |
-
id: "iframeresizer_embedding_system",
|
19 |
-
src: cfJsHost + captainform_servicedomain + "/modules/captainform/js/iframe_resizer/3.5/iframeResizer.min.js",
|
20 |
-
});
|
21 |
-
}
|
22 |
-
append_element({
|
23 |
-
elementType: "script",
|
24 |
-
type: "text/javascript",
|
25 |
-
id: "jsform-{{ID}}",
|
26 |
-
src: cfJsHost + captainform_servicedomain + "/jsform-{{ID}}.js?" + customVarsMF + captainform_theme_style,
|
27 |
-
replacing: document.getElementById("{{ID}}"),
|
28 |
});
|
29 |
</script>
|
1 |
<script id="{{ID}}" type="text/javascript">
|
2 |
var customVarsMF = '{{CUSTOMVARS}}';
|
3 |
var captainform_theme_style = '{{STYLE}}';
|
4 |
+
jQuery(document).ready(function(){
|
5 |
+
if(document.getElementById('captainform_easyxdmjs') == null)
|
6 |
+
{
|
7 |
+
append_element({
|
8 |
+
elementType: "script",
|
9 |
+
type: "text/javascript",
|
10 |
+
id: "captainform_easyxdmjs",
|
11 |
+
src: cfJsHost + captainform_servicedomain + "/includes/easyXDM.min.js",
|
12 |
+
});
|
13 |
+
}
|
14 |
+
if(document.getElementById('iframeresizer_embedding_system') == null)
|
15 |
+
{
|
16 |
+
append_element({
|
17 |
+
elementType: "script",
|
18 |
+
type: "text/javascript",
|
19 |
+
id: "iframeresizer_embedding_system",
|
20 |
+
src: cfJsHost + captainform_servicedomain + "/modules/captainform/js/iframe_resizer/3.5/iframeResizer.min.js",
|
21 |
+
});
|
22 |
+
}
|
23 |
append_element({
|
24 |
elementType: "script",
|
25 |
type: "text/javascript",
|
26 |
+
id: "jsform-{{ID}}",
|
27 |
+
src: cfJsHost + captainform_servicedomain + "/jsform-{{ID}}.js?" + customVarsMF + captainform_theme_style,
|
28 |
+
replacing: document.getElementById("{{ID}}"),
|
29 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
});
|
31 |
</script>
|
includes/integrations/forge-element.php
CHANGED
@@ -1,20 +1,18 @@
|
|
1 |
<?php
|
2 |
define('FORGE_ELEMENT_DOMAIN', 'captainform');
|
3 |
|
4 |
-
function adding_captainform_forge_element_css()
|
|
|
5 |
wp_enqueue_style('forge_element_css', plugins_url('css/forge_element.css', __DIR__), false, uniqid());
|
6 |
}
|
7 |
|
8 |
function forge_element_captainform($atts, $content)
|
9 |
{
|
10 |
-
if($atts['form_id'] != "none")
|
11 |
-
{
|
12 |
$container_id = md5($atts['form_id'] + time());
|
13 |
$container = "<div id=\"{$container_id}\">%s</div>";
|
14 |
return sprintf($container, captain_form($atts['form_id']));
|
15 |
-
}
|
16 |
-
else
|
17 |
-
{
|
18 |
return '<div class="forge-captainform-form-placeholder"></div>';
|
19 |
}
|
20 |
}
|
@@ -36,16 +34,12 @@ function forge_element_captainform_metadata($data)
|
|
36 |
$fields['select'] = $selectField;
|
37 |
|
38 |
$response = captainform_get_forms('page_or_post');
|
39 |
-
if($response->status == "ok")
|
40 |
-
|
41 |
-
foreach($response->forms as $form)
|
42 |
-
{
|
43 |
$fields['select']['choices'][$form->f_id] = $form->f_name;
|
44 |
}
|
45 |
$fields['my_forms'] = get_forge_captainform_button("My Forms", admin_url("admin.php?page=CaptainForm"), "_captainFormTab");
|
46 |
-
}
|
47 |
-
else
|
48 |
-
{
|
49 |
$fields['select']['choices']['none'] = __('No forms available', FORGE_ELEMENT_DOMAIN);
|
50 |
$fields['select']['description'] = __('There are no forms available, please create one by clicking the button below.', FORGE_ELEMENT_DOMAIN);
|
51 |
$fields['create'] = get_forge_captainform_button("New Form", admin_url("admin.php?page=CaptainForm-NewForm"), "_captainFormTab");
|
@@ -65,7 +59,7 @@ function forge_element_captainform_metadata($data)
|
|
65 |
|
66 |
function forge_field_captainform_button($args, $value = '')
|
67 |
{
|
68 |
-
if(!isset($args['target']) || empty($args['target']))
|
69 |
$args['target'] = "_blank";
|
70 |
|
71 |
$fieldContainer = '<div class="forge-captainform-field">%s</div>';
|
1 |
<?php
|
2 |
define('FORGE_ELEMENT_DOMAIN', 'captainform');
|
3 |
|
4 |
+
function adding_captainform_forge_element_css()
|
5 |
+
{
|
6 |
wp_enqueue_style('forge_element_css', plugins_url('css/forge_element.css', __DIR__), false, uniqid());
|
7 |
}
|
8 |
|
9 |
function forge_element_captainform($atts, $content)
|
10 |
{
|
11 |
+
if ($atts['form_id'] != "none") {
|
|
|
12 |
$container_id = md5($atts['form_id'] + time());
|
13 |
$container = "<div id=\"{$container_id}\">%s</div>";
|
14 |
return sprintf($container, captain_form($atts['form_id']));
|
15 |
+
} else {
|
|
|
|
|
16 |
return '<div class="forge-captainform-form-placeholder"></div>';
|
17 |
}
|
18 |
}
|
34 |
$fields['select'] = $selectField;
|
35 |
|
36 |
$response = captainform_get_forms('page_or_post');
|
37 |
+
if ($response->status == "ok") {
|
38 |
+
foreach ($response->forms as $form) {
|
|
|
|
|
39 |
$fields['select']['choices'][$form->f_id] = $form->f_name;
|
40 |
}
|
41 |
$fields['my_forms'] = get_forge_captainform_button("My Forms", admin_url("admin.php?page=CaptainForm"), "_captainFormTab");
|
42 |
+
} else {
|
|
|
|
|
43 |
$fields['select']['choices']['none'] = __('No forms available', FORGE_ELEMENT_DOMAIN);
|
44 |
$fields['select']['description'] = __('There are no forms available, please create one by clicking the button below.', FORGE_ELEMENT_DOMAIN);
|
45 |
$fields['create'] = get_forge_captainform_button("New Form", admin_url("admin.php?page=CaptainForm-NewForm"), "_captainFormTab");
|
59 |
|
60 |
function forge_field_captainform_button($args, $value = '')
|
61 |
{
|
62 |
+
if (!isset($args['target']) || empty($args['target']))
|
63 |
$args['target'] = "_blank";
|
64 |
|
65 |
$fieldContainer = '<div class="forge-captainform-field">%s</div>';
|
includes/settings.php
CHANGED
@@ -11,7 +11,7 @@ global $captainform_plugin_name,
|
|
11 |
$captainform_widget_text_filter;
|
12 |
|
13 |
$captainform_plugin_name = 'captainform';
|
14 |
-
$captainform_plugin_version = "1.7.1";
|
15 |
|
16 |
//plugin options key name
|
17 |
$captainform_option1 = $captainform_plugin_name . '_installation_id';
|
11 |
$captainform_widget_text_filter;
|
12 |
|
13 |
$captainform_plugin_name = 'captainform';
|
14 |
+
$captainform_plugin_version = "1.7.2.1";
|
15 |
|
16 |
//plugin options key name
|
17 |
$captainform_option1 = $captainform_plugin_name . '_installation_id';
|
includes/shortcodes.php
CHANGED
@@ -2,32 +2,37 @@
|
|
2 |
|
3 |
function captainform_shortcode_handler($shortcode)
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
'content' => (isset($shortcode['content'])) ? $shortcode['content'] : null,
|
10 |
-
'url' => (isset($shortcode['url'])) ? $shortcode['url'] : null,
|
11 |
-
'miliseconds' => (isset($shortcode['miliseconds'])) ? $shortcode['miliseconds'] : null,
|
12 |
-
'text_color' => (isset($shortcode['text_color'])) ? $shortcode['text_color'] : null,
|
13 |
-
'bg_color' => (isset($shortcode['bg_color'])) ? $shortcode['bg_color'] : null,
|
14 |
-
'position' => (isset($shortcode['position'])) ? $shortcode['position'] : null,
|
15 |
-
);
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
|
33 |
add_shortcode('captainform', 'captainform_shortcode_handler');
|
2 |
|
3 |
function captainform_shortcode_handler($shortcode)
|
4 |
{
|
5 |
+
if (isset($shortcode[0]))
|
6 |
+
$form_id = $shortcode[0];
|
7 |
+
if (isset($shortcode['id']))
|
8 |
+
$form_id = $shortcode['id'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
$custom_options = array(
|
11 |
+
'form_id' => $form_id,
|
12 |
+
'lightbox' => (isset($shortcode['lightbox'])) ? $shortcode['lightbox'] : false,
|
13 |
+
'type' => (isset($shortcode['type'])) ? $shortcode['type'] : null,
|
14 |
+
'content' => (isset($shortcode['text_content'])) ? $shortcode['text_content'] : (isset($shortcode['content']) ? $shortcode['content'] : null),
|
15 |
+
'url' => (isset($shortcode['url'])) ? $shortcode['url'] : null,
|
16 |
+
'miliseconds' => (isset($shortcode['miliseconds'])) ? $shortcode['miliseconds'] : null,
|
17 |
+
'text_color' => (isset($shortcode['text_color'])) ? $shortcode['text_color'] : null,
|
18 |
+
'bg_color' => (isset($shortcode['bg_color'])) ? $shortcode['bg_color'] : null,
|
19 |
+
'position' => (isset($shortcode['position'])) ? $shortcode['position'] : null,
|
20 |
+
);
|
21 |
|
22 |
+
$shortcode_final = '[captainform id="' . $form_id . '" ';
|
23 |
+
$shortcode_final .= (isset($shortcode['lightbox'])) ? " lightbox='{$shortcode['lightbox']}'" : '';
|
24 |
+
$shortcode_final .= (isset($shortcode['type'])) ? " type='{$shortcode['type']}'" : '';
|
25 |
+
$shortcode_final .= (isset($shortcode['url'])) ? " url='{$shortcode['url']}'" : '';
|
26 |
+
$shortcode_final .= (isset($shortcode['text_content'])) ? ' text_content="' . $shortcode['text_content'] . '"' : (isset($shortcode['content']) ? ' content="' . $shortcode['content'] . '"' : '');
|
27 |
+
$shortcode_final .= (isset($shortcode['miliseconds'])) ? " miliseconds='{$shortcode['miliseconds']}'" : '';
|
28 |
+
$shortcode_final .= (isset($shortcode['text_color'])) ? " text_color='{$shortcode['text_color']}'" : '';
|
29 |
+
$shortcode_final .= (isset($shortcode['bg_color'])) ? " bg_color='{$shortcode['bg_color']}'" : '';
|
30 |
+
$shortcode_final .= (isset($shortcode['position'])) ? " position='{$shortcode['position']}'" : '';
|
31 |
|
32 |
+
$shortcode_final .= ']';
|
33 |
+
|
34 |
+
$content = captainform_widget_text_filter($shortcode_final, NULL, $custom_options);
|
35 |
+
return $content;
|
36 |
}
|
37 |
|
38 |
add_shortcode('captainform', 'captainform_shortcode_handler');
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Form Builder by CaptainForm ===
|
2 |
|
3 |
-
Contributors: captainform
|
4 |
Tags: CaptainForm, form builder plugin, drag-and-drop, event registration form, order form, paypal form, quiz, survey, popup form, newsletter subscription, contact form, secured forms
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.6
|
7 |
-
Stable tag: 1.7.1
|
8 |
|
9 |
User-friendly form builder with advanced features. Build any type of form or survey with drag & drop ease and no add-ons required.
|
10 |
|
@@ -14,22 +14,22 @@ User-friendly form builder with advanced features. Build any type of form or sur
|
|
14 |
|
15 |
**Some of CaptainForm's superpowers:**
|
16 |
|
17 |
-
* Build fully customizable forms using our drag & drop form editor with more than 30 field types.
|
18 |
* Depending on your data collection needs you can adapt your form by using simple fields (name, email, checkboxes, radio buttons, phone numbers, etc.) and advanced fields (multiple file upload, digital signature, Google maps, social buttons, terms of service, Likert Scale, password, page break, etc.).
|
19 |
* Start with a blank form or import one of our 30 form templates, including contact form, order form, feedback form, event registration form, donation form and many more.
|
20 |
-
* With our form builder, there are no more addons required, all 3rd party apps and payment integrations are already built in.
|
21 |
* Collect payments with popular payment gateways like PayPal, PayPal Pro, PayPal Payflow, Authorize.net, Stripe, Braintree, Sage Pay, PayU.ro, Sisow, PayFast, FreshBooks.
|
22 |
* Our form builder allows you to send collected data automatically to a wide range of 3rd party integrations used for different purposes: MailChimp, SalesForce, Zendesk, Google Drive, WebHook, Evernote, Google Calendar, Google Drive, ExactTarget and many more.
|
23 |
* Advanced security is a top priority for our web form builder, with CAPTCHA and SSL Encryption available on all plans.
|
24 |
* Multiple form publishing options are available: publish your forms as posts or pages, publish in a lightbox or add them as a widget.
|
25 |
-
* Send form entries to multiple recipients at once and setup custom notifications depending on form data.
|
26 |
-
* Setup your web forms to deliver collected data as PDF matching the form layout.
|
27 |
* Your customers can save the forms as drafts and continue them at a later date.
|
28 |
-
* Create complex calculation forms that include mathematical operations and link them to payment gateways with just a few clicks.
|
29 |
* With our web form builder you have the possibility to create autoresponders and redirect the form user to a custom "Thank you" page after submission.
|
30 |
* All collected data is available to sort, filter, analyze or export as CSV or PDF.
|
31 |
* CaptainForm supports Wordpress Multisite.
|
32 |
-
* Customer support is free of charge regardless of your plan and available by email and live chat.
|
33 |
|
34 |
**There are 4 different service plans available: a free plan and 3 paid plans, working on an annual subscription basis.**
|
35 |
|
@@ -38,9 +38,9 @@ User-friendly form builder with advanced features. Build any type of form or sur
|
|
38 |
* Master ($95/year): use on 3 sites, unlimited forms and fields, 20K submissions/month, 2GB storage space, 14 native apps
|
39 |
* Hero ($195/year): use on unlimited sites, unlimited forms and fields, 100K submissions/month, 10GB storage space, 24 native apps, multisite support, payment integration
|
40 |
|
41 |
-
All service plans (including the free one) come with SSL encryption and support by email and chat. View our complete [Features Matrix](http://www.captainform.com/features-matrix/).
|
42 |
|
43 |
-
For more information about our
|
44 |
|
45 |
[youtube https://www.youtube.com/watch?v=FQ043Wq8Vi8]
|
46 |
|
@@ -62,7 +62,7 @@ For more information about our web form builder, visit the Captain at [captainfo
|
|
62 |
3. Building a "Contact & Lead Form".
|
63 |
4. The CaptainForm collection of 3rd party applications.
|
64 |
5. A part of the publishing screen, highlighting the popup method of posting a form on your website.
|
65 |
-
6. An example of how the "Event Registration Form" looks inside a web page.
|
66 |
7. An example of how the "Newsletter Subscription Form" looks on a website's sidebar menu.
|
67 |
|
68 |
== Frequently Asked Questions ==
|
@@ -92,6 +92,13 @@ We support MasterCard, Visa, PayPal, American Express, JCB, Discover/Novus and D
|
|
92 |
To downgrade the plugin, click on the Downgrade button under our Pioneer plan and fill out the cancellation form. All premium features will be deactivated, but you can upgrade again at any time by purchasing a new license key.
|
93 |
|
94 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
= 1.7.1 (20 September 2016) =
|
96 |
* Fix for older PHP versions
|
97 |
|
1 |
=== Form Builder by CaptainForm ===
|
2 |
|
3 |
+
Contributors: captainform, 123contactform
|
4 |
Tags: CaptainForm, form builder plugin, drag-and-drop, event registration form, order form, paypal form, quiz, survey, popup form, newsletter subscription, contact form, secured forms
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 1.7.2.1
|
8 |
|
9 |
User-friendly form builder with advanced features. Build any type of form or survey with drag & drop ease and no add-ons required.
|
10 |
|
14 |
|
15 |
**Some of CaptainForm's superpowers:**
|
16 |
|
17 |
+
* Build fully customizable forms using our drag & drop form editor with more than 30 field types.
|
18 |
* Depending on your data collection needs you can adapt your form by using simple fields (name, email, checkboxes, radio buttons, phone numbers, etc.) and advanced fields (multiple file upload, digital signature, Google maps, social buttons, terms of service, Likert Scale, password, page break, etc.).
|
19 |
* Start with a blank form or import one of our 30 form templates, including contact form, order form, feedback form, event registration form, donation form and many more.
|
20 |
+
* With our form builder, there are no more addons required, all 3rd party apps and payment integrations are already built in.
|
21 |
* Collect payments with popular payment gateways like PayPal, PayPal Pro, PayPal Payflow, Authorize.net, Stripe, Braintree, Sage Pay, PayU.ro, Sisow, PayFast, FreshBooks.
|
22 |
* Our form builder allows you to send collected data automatically to a wide range of 3rd party integrations used for different purposes: MailChimp, SalesForce, Zendesk, Google Drive, WebHook, Evernote, Google Calendar, Google Drive, ExactTarget and many more.
|
23 |
* Advanced security is a top priority for our web form builder, with CAPTCHA and SSL Encryption available on all plans.
|
24 |
* Multiple form publishing options are available: publish your forms as posts or pages, publish in a lightbox or add them as a widget.
|
25 |
+
* Send form entries to multiple recipients at once and setup custom notifications depending on form data.
|
26 |
+
* Setup your web forms to deliver collected data as PDF matching the form layout.
|
27 |
* Your customers can save the forms as drafts and continue them at a later date.
|
28 |
+
* Create complex calculation forms that include mathematical operations and link them to payment gateways with just a few clicks.
|
29 |
* With our web form builder you have the possibility to create autoresponders and redirect the form user to a custom "Thank you" page after submission.
|
30 |
* All collected data is available to sort, filter, analyze or export as CSV or PDF.
|
31 |
* CaptainForm supports Wordpress Multisite.
|
32 |
+
* Customer support is free of charge regardless of your plan and available by email and live chat.
|
33 |
|
34 |
**There are 4 different service plans available: a free plan and 3 paid plans, working on an annual subscription basis.**
|
35 |
|
38 |
* Master ($95/year): use on 3 sites, unlimited forms and fields, 20K submissions/month, 2GB storage space, 14 native apps
|
39 |
* Hero ($195/year): use on unlimited sites, unlimited forms and fields, 100K submissions/month, 10GB storage space, 24 native apps, multisite support, payment integration
|
40 |
|
41 |
+
All service plans (including the free one) come with SSL encryption, data encryption and support by email and chat. View our complete [Features Matrix](http://www.captainform.com/features-matrix/).
|
42 |
|
43 |
+
For more information about our form builder, please visit [captainform.com](http://www.captainform.com/?utm_source=WPDirectory&utm_medium=WP&utm_campaign=SubmitWPDirectory&x-channel=media&x-subchannel=partner&x-source=WPDirectory)
|
44 |
|
45 |
[youtube https://www.youtube.com/watch?v=FQ043Wq8Vi8]
|
46 |
|
62 |
3. Building a "Contact & Lead Form".
|
63 |
4. The CaptainForm collection of 3rd party applications.
|
64 |
5. A part of the publishing screen, highlighting the popup method of posting a form on your website.
|
65 |
+
6. An example of how the "Event Registration Form" looks inside a web page.
|
66 |
7. An example of how the "Newsletter Subscription Form" looks on a website's sidebar menu.
|
67 |
|
68 |
== Frequently Asked Questions ==
|
92 |
To downgrade the plugin, click on the Downgrade button under our Pioneer plan and fill out the cancellation form. All premium features will be deactivated, but you can upgrade again at any time by purchasing a new license key.
|
93 |
|
94 |
== Changelog ==
|
95 |
+
= 1.7.2.1 (22 September 2016) =
|
96 |
+
* Fix for cached JavaScript
|
97 |
+
|
98 |
+
= 1.7.2 (21 September 2016) =
|
99 |
+
* New functionality: prefill fields in embedded forms
|
100 |
+
* Fix for shortcode compatibility with different themes
|
101 |
+
|
102 |
= 1.7.1 (20 September 2016) =
|
103 |
* Fix for older PHP versions
|
104 |
|