Version Description
- Unhack API
- Use site_url() for API endpoints
Download this release
Release Info
Developer | tlovett1 |
Plugin | Custom Contact Forms |
Version | 7.0.3 |
Comparing to | |
See all releases |
Code changes from version 7.0.2 to 7.0.3
- build/js/form-manager.js +10 -8
- classes/class-ccf-ads.php +11 -3
- classes/class-ccf-custom-contact-forms.php +1 -3
- classes/class-ccf-form-manager.php +10 -7
- custom-contact-forms.php +2 -2
- js/manager/collections.js +4 -4
- js/manager/models.js +5 -5
- readme.txt +5 -1
- wp-api/core/wp-includes/rest-api/class-wp-rest-server.php +1 -1
build/js/form-manager.js
CHANGED
@@ -258,7 +258,7 @@
|
|
258 |
}
|
259 |
};
|
260 |
})( jQuery, Backbone, _, ccfSettings );
|
261 |
-
( function( $, Backbone, _, ccfSettings
|
262 |
'use strict';
|
263 |
|
264 |
wp.ccf.models = wp.ccf.models || {};
|
@@ -336,12 +336,12 @@
|
|
336 |
wp.ccf.models.Form = wp.ccf.models.Form || wp.api.models.Post.extend(
|
337 |
{
|
338 |
|
339 |
-
urlRoot:
|
340 |
|
341 |
set: _modelSet,
|
342 |
|
343 |
sync: _sync,
|
344 |
-
|
345 |
idAttribute: 'id',
|
346 |
|
347 |
initialize: function() {
|
@@ -480,7 +480,7 @@
|
|
480 |
|
481 |
sync: _sync,
|
482 |
|
483 |
-
urlRoot:
|
484 |
}
|
485 |
);
|
486 |
|
@@ -805,7 +805,8 @@
|
|
805 |
}
|
806 |
}
|
807 |
);
|
808 |
-
})( jQuery, Backbone, _, ccfSettings
|
|
|
809 |
( function( $, Backbone, _, ccfSettings ) {
|
810 |
'use strict';
|
811 |
|
@@ -826,7 +827,7 @@
|
|
826 |
{
|
827 |
model: wp.ccf.models.Form,
|
828 |
|
829 |
-
url:
|
830 |
|
831 |
formsFetching: {},
|
832 |
|
@@ -863,7 +864,7 @@
|
|
863 |
model: wp.ccf.models.Field,
|
864 |
|
865 |
url: function() {
|
866 |
-
return
|
867 |
},
|
868 |
|
869 |
initialize: function( models, options ) {
|
@@ -881,7 +882,7 @@
|
|
881 |
model: wp.ccf.models.Submission,
|
882 |
|
883 |
url: function() {
|
884 |
-
return
|
885 |
},
|
886 |
|
887 |
initialize: function( models, options ) {
|
@@ -903,6 +904,7 @@
|
|
903 |
);
|
904 |
|
905 |
})( jQuery, Backbone, _, ccfSettings );
|
|
|
906 |
( function( $, Backbone, _, ccfSettings ) {
|
907 |
'use strict';
|
908 |
|
258 |
}
|
259 |
};
|
260 |
})( jQuery, Backbone, _, ccfSettings );
|
261 |
+
( function( $, Backbone, _, ccfSettings ) {
|
262 |
'use strict';
|
263 |
|
264 |
wp.ccf.models = wp.ccf.models || {};
|
336 |
wp.ccf.models.Form = wp.ccf.models.Form || wp.api.models.Post.extend(
|
337 |
{
|
338 |
|
339 |
+
urlRoot: ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/forms',
|
340 |
|
341 |
set: _modelSet,
|
342 |
|
343 |
sync: _sync,
|
344 |
+
|
345 |
idAttribute: 'id',
|
346 |
|
347 |
initialize: function() {
|
480 |
|
481 |
sync: _sync,
|
482 |
|
483 |
+
urlRoot: ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/submissions'
|
484 |
}
|
485 |
);
|
486 |
|
805 |
}
|
806 |
}
|
807 |
);
|
808 |
+
})( jQuery, Backbone, _, ccfSettings );
|
809 |
+
|
810 |
( function( $, Backbone, _, ccfSettings ) {
|
811 |
'use strict';
|
812 |
|
827 |
{
|
828 |
model: wp.ccf.models.Form,
|
829 |
|
830 |
+
url: ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/forms',
|
831 |
|
832 |
formsFetching: {},
|
833 |
|
864 |
model: wp.ccf.models.Field,
|
865 |
|
866 |
url: function() {
|
867 |
+
return ccfSettings.apiRoot + '/ccf/forms/' + this.formId + '/fields';
|
868 |
},
|
869 |
|
870 |
initialize: function( models, options ) {
|
882 |
model: wp.ccf.models.Submission,
|
883 |
|
884 |
url: function() {
|
885 |
+
return ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/forms/' + this.formId + '/submissions';
|
886 |
},
|
887 |
|
888 |
initialize: function( models, options ) {
|
904 |
);
|
905 |
|
906 |
})( jQuery, Backbone, _, ccfSettings );
|
907 |
+
|
908 |
( function( $, Backbone, _, ccfSettings ) {
|
909 |
'use strict';
|
910 |
|
classes/class-ccf-ads.php
CHANGED
@@ -20,6 +20,10 @@ class CCF_Ads {
|
|
20 |
}
|
21 |
|
22 |
public function process_submission() {
|
|
|
|
|
|
|
|
|
23 |
if ( ! empty( $_POST['ccf_subscribe'] ) && ! empty( $_POST['email'] ) ) {
|
24 |
$request = wp_remote_request( 'http://taylorlovett.us8.list-manage.com/subscribe/post?u=66118f9a5b0ab0414e83f043a&id=b4ed816a24', array(
|
25 |
'method' => 'post',
|
@@ -40,6 +44,10 @@ class CCF_Ads {
|
|
40 |
public function show_ad() {
|
41 |
global $pagenow;
|
42 |
|
|
|
|
|
|
|
|
|
43 |
if ( 'edit.php' === $pagenow || 'post-new.php' === $pagenow ) {
|
44 |
if ( empty( $_GET['post_type'] ) || 'ccf_form' !== $_GET['post_type'] ) {
|
45 |
return;
|
@@ -61,13 +69,13 @@ class CCF_Ads {
|
|
61 |
if ( ! empty( $subscribed ) ) {
|
62 |
return;
|
63 |
}
|
64 |
-
|
65 |
?>
|
66 |
<div class="updated update-nag ccf-subscribe">
|
67 |
<form method="post">
|
68 |
<p>
|
69 |
<?php if ( empty( $_POST['ccf_subscribe'] ) || empty( $_POST['email'] ) ) : ?>
|
70 |
-
WordPress exclusive tutorials, blogging tips, plugins, and more.
|
71 |
<input type="email" name="email">
|
72 |
<input type="hidden" name="ccf_subscribe" value="1">
|
73 |
<input type="submit" class="button button-primary" value="Sign Me Up">
|
@@ -96,4 +104,4 @@ class CCF_Ads {
|
|
96 |
|
97 |
return $instance;
|
98 |
}
|
99 |
-
}
|
20 |
}
|
21 |
|
22 |
public function process_submission() {
|
23 |
+
if ( apply_filters( 'ccf_hide_ads', false ) ) {
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
if ( ! empty( $_POST['ccf_subscribe'] ) && ! empty( $_POST['email'] ) ) {
|
28 |
$request = wp_remote_request( 'http://taylorlovett.us8.list-manage.com/subscribe/post?u=66118f9a5b0ab0414e83f043a&id=b4ed816a24', array(
|
29 |
'method' => 'post',
|
44 |
public function show_ad() {
|
45 |
global $pagenow;
|
46 |
|
47 |
+
if ( apply_filters( 'ccf_hide_ads', false ) ) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
if ( 'edit.php' === $pagenow || 'post-new.php' === $pagenow ) {
|
52 |
if ( empty( $_GET['post_type'] ) || 'ccf_form' !== $_GET['post_type'] ) {
|
53 |
return;
|
69 |
if ( ! empty( $subscribed ) ) {
|
70 |
return;
|
71 |
}
|
72 |
+
|
73 |
?>
|
74 |
<div class="updated update-nag ccf-subscribe">
|
75 |
<form method="post">
|
76 |
<p>
|
77 |
<?php if ( empty( $_POST['ccf_subscribe'] ) || empty( $_POST['email'] ) ) : ?>
|
78 |
+
WordPress exclusive tutorials, blogging tips, plugins, and more.
|
79 |
<input type="email" name="email">
|
80 |
<input type="hidden" name="ccf_subscribe" value="1">
|
81 |
<input type="submit" class="button button-primary" value="Sign Me Up">
|
104 |
|
105 |
return $instance;
|
106 |
}
|
107 |
+
}
|
classes/class-ccf-custom-contact-forms.php
CHANGED
@@ -16,7 +16,6 @@ class CCF_Custom_Contact_Forms {
|
|
16 |
*/
|
17 |
public function setup() {
|
18 |
add_action( 'rest_api_init', array( $this, 'api_init' ), 1000 );
|
19 |
-
add_filter( 'json_url', 'set_url_scheme' );
|
20 |
add_action( 'plugins_loaded', array( $this, 'manually_load_api' ), 1000 );
|
21 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
22 |
add_filter( 'plugin_action_links', array( $this, 'filter_plugin_action_links' ), 10, 2 );
|
@@ -26,7 +25,6 @@ class CCF_Custom_Contact_Forms {
|
|
26 |
|
27 |
}
|
28 |
|
29 |
-
|
30 |
/**
|
31 |
* Trick API into thinking non publically queryable post types are queryable
|
32 |
*
|
@@ -167,4 +165,4 @@ class CCF_Custom_Contact_Forms {
|
|
167 |
|
168 |
return $instance;
|
169 |
}
|
170 |
-
}
|
16 |
*/
|
17 |
public function setup() {
|
18 |
add_action( 'rest_api_init', array( $this, 'api_init' ), 1000 );
|
|
|
19 |
add_action( 'plugins_loaded', array( $this, 'manually_load_api' ), 1000 );
|
20 |
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
21 |
add_filter( 'plugin_action_links', array( $this, 'filter_plugin_action_links' ), 10, 2 );
|
25 |
|
26 |
}
|
27 |
|
|
|
28 |
/**
|
29 |
* Trick API into thinking non publically queryable post types are queryable
|
30 |
*
|
165 |
|
166 |
return $instance;
|
167 |
}
|
168 |
+
}
|
classes/class-ccf-form-manager.php
CHANGED
@@ -130,13 +130,15 @@ class CCF_Form_Manager {
|
|
130 |
<div class="right-sidebar ccf-field-sidebar accordion-container"></div>
|
131 |
|
132 |
<div class="bottom">
|
133 |
-
|
134 |
-
<
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
<input type="button" class="button insert-form-button" value="<?php esc_html_e( 'Insert into post', 'custom-contact-forms' ); ?>">
|
141 |
<input type="button" class="button button-primary save-button" value="<?php esc_html_e( 'Save Form', 'custom-contact-forms' ); ?>">
|
142 |
<div class="spinner" style="background: url( '<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>' ) no-repeat;"></div>
|
@@ -1565,6 +1567,7 @@ class CCF_Form_Manager {
|
|
1565 |
|
1566 |
wp_enqueue_script( 'ccf-form-manager', plugins_url( $js_manager_path, dirname( __FILE__ ) ), array( 'json2', 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'underscore', 'backbone', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-api', 'moment' ), $version, true );
|
1567 |
wp_localize_script( 'ccf-form-manager', 'ccfSettings', array(
|
|
|
1568 |
'nonce' => wp_create_nonce( 'ccf_nonce' ),
|
1569 |
'downloadSubmissionsNonce' => wp_create_nonce( 'ccf_download_submissions_nonce' ),
|
1570 |
'adminUrl' => esc_url_raw( admin_url() ),
|
130 |
<div class="right-sidebar ccf-field-sidebar accordion-container"></div>
|
131 |
|
132 |
<div class="bottom">
|
133 |
+
<?php if ( ! apply_filters( 'ccf_hide_ads', false ) ) : ?>
|
134 |
+
<div class="left signup">
|
135 |
+
<strong>Want free WP blogging tips, tutorials, and marketing tricks? </strong>
|
136 |
+
<input type="email" class="email-signup-field" placeholder="Email">
|
137 |
+
<button type="button" class="button signup-button">Sign me up!</button>
|
138 |
+
<span class="signup-check">✓</span>
|
139 |
+
<span class="signup-x">×</span>
|
140 |
+
</div>
|
141 |
+
<?php endif; ?>
|
142 |
<input type="button" class="button insert-form-button" value="<?php esc_html_e( 'Insert into post', 'custom-contact-forms' ); ?>">
|
143 |
<input type="button" class="button button-primary save-button" value="<?php esc_html_e( 'Save Form', 'custom-contact-forms' ); ?>">
|
144 |
<div class="spinner" style="background: url( '<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>' ) no-repeat;"></div>
|
1567 |
|
1568 |
wp_enqueue_script( 'ccf-form-manager', plugins_url( $js_manager_path, dirname( __FILE__ ) ), array( 'json2', 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'underscore', 'backbone', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-api', 'moment' ), $version, true );
|
1569 |
wp_localize_script( 'ccf-form-manager', 'ccfSettings', array(
|
1570 |
+
'apiRoot' => site_url( 'wp-json' ),
|
1571 |
'nonce' => wp_create_nonce( 'ccf_nonce' ),
|
1572 |
'downloadSubmissionsNonce' => wp_create_nonce( 'ccf_download_submissions_nonce' ),
|
1573 |
'adminUrl' => esc_url_raw( admin_url() ),
|
custom-contact-forms.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://www.taylorlovett.com
|
5 |
* Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
6 |
* Author: Taylor Lovett
|
7 |
-
* Version: 7.0.
|
8 |
* Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
|
@@ -61,4 +61,4 @@ function ccf_flush_rewrites() {
|
|
61 |
update_option( 'ccf_flush_rewrites', true );
|
62 |
}
|
63 |
|
64 |
-
register_activation_hook( __FILE__, 'ccf_flush_rewrites' );
|
4 |
* Plugin URI: http://www.taylorlovett.com
|
5 |
* Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
|
6 |
* Author: Taylor Lovett
|
7 |
+
* Version: 7.0.3
|
8 |
* Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
|
61 |
update_option( 'ccf_flush_rewrites', true );
|
62 |
}
|
63 |
|
64 |
+
register_activation_hook( __FILE__, 'ccf_flush_rewrites' );
|
js/manager/collections.js
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
{
|
19 |
model: wp.ccf.models.Form,
|
20 |
|
21 |
-
url:
|
22 |
|
23 |
formsFetching: {},
|
24 |
|
@@ -55,7 +55,7 @@
|
|
55 |
model: wp.ccf.models.Field,
|
56 |
|
57 |
url: function() {
|
58 |
-
return
|
59 |
},
|
60 |
|
61 |
initialize: function( models, options ) {
|
@@ -73,7 +73,7 @@
|
|
73 |
model: wp.ccf.models.Submission,
|
74 |
|
75 |
url: function() {
|
76 |
-
return
|
77 |
},
|
78 |
|
79 |
initialize: function( models, options ) {
|
@@ -94,4 +94,4 @@
|
|
94 |
}
|
95 |
);
|
96 |
|
97 |
-
})( jQuery, Backbone, _, ccfSettings );
|
18 |
{
|
19 |
model: wp.ccf.models.Form,
|
20 |
|
21 |
+
url: ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/forms',
|
22 |
|
23 |
formsFetching: {},
|
24 |
|
55 |
model: wp.ccf.models.Field,
|
56 |
|
57 |
url: function() {
|
58 |
+
return ccfSettings.apiRoot + '/ccf/forms/' + this.formId + '/fields';
|
59 |
},
|
60 |
|
61 |
initialize: function( models, options ) {
|
73 |
model: wp.ccf.models.Submission,
|
74 |
|
75 |
url: function() {
|
76 |
+
return ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/forms/' + this.formId + '/submissions';
|
77 |
},
|
78 |
|
79 |
initialize: function( models, options ) {
|
94 |
}
|
95 |
);
|
96 |
|
97 |
+
})( jQuery, Backbone, _, ccfSettings );
|
js/manager/models.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
( function( $, Backbone, _, ccfSettings
|
2 |
'use strict';
|
3 |
|
4 |
wp.ccf.models = wp.ccf.models || {};
|
@@ -76,12 +76,12 @@
|
|
76 |
wp.ccf.models.Form = wp.ccf.models.Form || wp.api.models.Post.extend(
|
77 |
{
|
78 |
|
79 |
-
urlRoot:
|
80 |
|
81 |
set: _modelSet,
|
82 |
|
83 |
sync: _sync,
|
84 |
-
|
85 |
idAttribute: 'id',
|
86 |
|
87 |
initialize: function() {
|
@@ -220,7 +220,7 @@
|
|
220 |
|
221 |
sync: _sync,
|
222 |
|
223 |
-
urlRoot:
|
224 |
}
|
225 |
);
|
226 |
|
@@ -545,4 +545,4 @@
|
|
545 |
}
|
546 |
}
|
547 |
);
|
548 |
-
})( jQuery, Backbone, _, ccfSettings
|
1 |
+
( function( $, Backbone, _, ccfSettings ) {
|
2 |
'use strict';
|
3 |
|
4 |
wp.ccf.models = wp.ccf.models || {};
|
76 |
wp.ccf.models.Form = wp.ccf.models.Form || wp.api.models.Post.extend(
|
77 |
{
|
78 |
|
79 |
+
urlRoot: ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/forms',
|
80 |
|
81 |
set: _modelSet,
|
82 |
|
83 |
sync: _sync,
|
84 |
+
|
85 |
idAttribute: 'id',
|
86 |
|
87 |
initialize: function() {
|
220 |
|
221 |
sync: _sync,
|
222 |
|
223 |
+
urlRoot: ccfSettings.apiRoot.replace( /\/$/, '' ) + '/ccf/v1/submissions'
|
224 |
}
|
225 |
);
|
226 |
|
545 |
}
|
546 |
}
|
547 |
);
|
548 |
+
})( jQuery, Backbone, _, ccfSettings );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.5
|
7 |
-
Stable tag: 7.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -37,6 +37,10 @@ For questions, feature requests, and support concerning the Custom Contact Forms
|
|
37 |
|
38 |
== Changelog ==
|
39 |
|
|
|
|
|
|
|
|
|
40 |
= 7.0.2 =
|
41 |
* Bust script/style cache
|
42 |
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.5
|
7 |
+
Stable tag: 7.0.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
37 |
|
38 |
== Changelog ==
|
39 |
|
40 |
+
= 7.0.3 =
|
41 |
+
* Unhack API
|
42 |
+
* Use site_url() for API endpoints
|
43 |
+
|
44 |
= 7.0.2 =
|
45 |
* Bust script/style cache
|
46 |
|
wp-api/core/wp-includes/rest-api/class-wp-rest-server.php
CHANGED
@@ -234,7 +234,7 @@ class WP_REST_Server {
|
|
234 |
*/
|
235 |
$this->send_header( 'X-Content-Type-Options', 'nosniff' );
|
236 |
$this->send_header( 'Access-Control-Expose-Headers', 'X-WP-Total, X-WP-TotalPages' );
|
237 |
-
$this->send_header( 'Access-Control-Allow-Headers', 'Authorization
|
238 |
|
239 |
/**
|
240 |
* Filter whether the REST API is enabled.
|
234 |
*/
|
235 |
$this->send_header( 'X-Content-Type-Options', 'nosniff' );
|
236 |
$this->send_header( 'Access-Control-Expose-Headers', 'X-WP-Total, X-WP-TotalPages' );
|
237 |
+
$this->send_header( 'Access-Control-Allow-Headers', 'Authorization' );
|
238 |
|
239 |
/**
|
240 |
* Filter whether the REST API is enabled.
|