Skip to content

Commit

Permalink
Merge branch 'develop' into feature/3425-3
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
#	ui/panels/conditions.php
#	yarn.lock
  • Loading branch information
New0 committed Jun 11, 2020
2 parents 47dc8bf + 12282c9 commit be93a84
Show file tree
Hide file tree
Showing 26 changed files with 1,130 additions and 16,286 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ wp-content
cypress/screenshots
cypress/videos
build
vendor

wp-test-case

Expand Down
2 changes: 1 addition & 1 deletion assets/build/css/caldera-forms-front.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/caldera-forms-front.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/caldera-forms-front.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-05-29 */var resBaldrickTriggers;
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-06-11 */var resBaldrickTriggers;

jQuery(function($){
function fieldErrors(fields, $form, $notice) {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/entry-viewer-2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-05-29 *//**
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-06-11 *//**
* API Client for Caldera Forms API for a single form
*
* @since 1.5.0
Expand Down
2 changes: 1 addition & 1 deletion assets/js/parsley.min.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-05-29 *//*!
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-06-11 *//*!
* Parsley.js
* Version 2.8.1 - built Sat, Feb 3rd 2018, 2:27 pm
* http://parsleyjs.org
Expand Down
2 changes: 1 addition & 1 deletion assets/js/vue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-05-29 *//*!
/*! GENERATED SOURCE FILE caldera-forms - v1.9.0-b.1 - 2020-06-11 *//*!
* Vue.js v2.1.6
* (c) 2014-2016 Evan You
* Released under the MIT License.
Expand Down
5 changes: 3 additions & 2 deletions caldera-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Author URI: https://CalderaForms.com
Text Domain: caldera-forms
GitHub Plugin URI: https://github.com/CalderaWP/caldera-forms
Release Asset: true
*/

// If this file is called directly, abort.
Expand All @@ -23,7 +24,7 @@ function caldera_forms_php_version_nag()
?>
<div class="notice notice-error">
<p>
<?php _e('Your version of PHP is incompatible with Caldera Forms and can not be used.',
<?php esc_html_e('Your version of PHP is incompatible with Caldera Forms and can not be used.',
'caldera-forms'); ?>
<?php printf(' <a href="https://calderaforms.com/php?utm_source=wp-admin&utm_campaign=php_deprecated&utm_source=admin-nag" target="__blank">%s</a>',
esc_html__('Learn More', 'caldera-forms')
Expand All @@ -40,7 +41,7 @@ function caldera_forms_wp_version_nag(){
?>
<div class="notice notice-error">
<p>
<?php _e('Your version of WordPress is incompatible with Caldera Forms and can not be used.', 'caldera-forms'); ?>
<?php esc_html_e('Your version of WordPress is incompatible with Caldera Forms and can not be used.', 'caldera-forms'); ?>
</p>
</div>
<?php
Expand Down
11 changes: 6 additions & 5 deletions classes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ public static function do_redirect($referrer, $form, $processid)

// Re urlencode query vars after they were parsed in this function
foreach($query_vars as $var_names => $var_values){
$query_vars[$var_names] = urlencode($var_values);
$query_vars[$var_names] = rawurlencode($var_values);
}
$redirect = add_query_arg($query_vars, $base_redirect);

Expand Down Expand Up @@ -2369,10 +2369,11 @@ static public function get_field_data($field_id, $form, $entry_id = false, $chec
global $processed_data;

if (is_string($form)) {
$form = Caldera_Forms_Forms::get_form($form);
if (!isset($form['ID']) || $form['ID'] !== $form) {
$form_obj = Caldera_Forms_Forms::get_form($form);
if (!isset($form_obj['ID']) || $form_obj['ID'] !== $form) {
return null;
}
$form = $form_obj;
}

if (!is_array($form)) {
Expand Down Expand Up @@ -3729,8 +3730,8 @@ public function api_handler()
if (!empty($form[ 'ID' ])) {

if ($form[ 'ID' ] === $form_id) {
$entry_id = !empty($wp_query->query_vars[ 'cf_entry' ]) ? $wp_query->query_vars[ 'cf_entry' ]
: isset($_GET, $_GET[ 'entry' ]) && absint($_GET[ 'entry' ]) ? $_GET[ 'entry' ] : null;
$entry_id = ( !empty($wp_query->query_vars[ 'cf_entry' ]) ? $wp_query->query_vars[ 'cf_entry' ]
: isset($_GET, $_GET[ 'entry' ]) ) && absint($_GET[ 'entry' ]) ? $_GET[ 'entry' ] : null;
if ($entry_id) {
$atts[ 'entry' ] = (int)$entry_id;
}
Expand Down
1 change: 0 additions & 1 deletion classes/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@ public static function create_form( $newform ){
public static function delete_form( $id ){
$forms = self::get_forms();
if( ! isset( $forms[ $id ] ) ){
var_dump(false);
return false;
}

Expand Down
1 change: 0 additions & 1 deletion classes/render/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,6 @@ public static function maybe_redirect_to_dist(){
if( file_exists($path)){
cf_redirect(untrailingslashit(CFCORE_URL) . $uri);exit;
}
var_dump($path);
}


Expand Down
8 changes: 4 additions & 4 deletions clients/admin/build/index.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clients/blocks/build/index.min.asset.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dependencies":["react","wp-components","wp-data","wp-i18n","wp-polyfill"],"version":"87b7320767eafc2ea8901f5feca919ad"}
{"dependencies":["react","wp-components","wp-data","wp-i18n","wp-polyfill"],"version":"7a733f695791b7449165b4112bd0365f"}
4 changes: 2 additions & 2 deletions clients/blocks/build/index.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions clients/privacy/build/index.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clients/render/build/index.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions fields/select2/field/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
data: function (term, page) {
return {
action : 'cf_filter_populate',
q: $('<?php echo $bound; ?>').val(), // search term
<?php if( !empty( $field['config']['easy_pod'] ) ){?>easy_pod : '<?php echo $field['config']['easy_pod']; ?>'<?php } ?>
q: $('<?php echo esc_html( $bound ); ?>').val(), // search term
<?php if( !empty( $field['config']['easy_pod'] ) ){?>easy_pod : '<?php echo esc_html( $field['config']['easy_pod'] ); ?>'<?php } ?>
};
},
results: function (data, page) {
Expand All @@ -136,7 +136,7 @@
var opts = {};
<?php } ?>

$(document).on('cf.bind', '#<?php echo $field_id; ?>', function() {
$(document).on('cf.bind', '#<?php echo esc_html( $field_id ); ?>', function() {
$(this).select2( opts );
});
});
Expand Down
22 changes: 11 additions & 11 deletions fields/text/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@
</div>

<div class="caldera-config-group">
<label><?php _e('Masked Input', 'caldera-forms'); ?></label>
<label><?php esc_html_e('Masked Input', 'caldera-forms'); ?></label>
<div class="caldera-config-field">
<label><input type="checkbox" class="field-config {{_id}}_masked" name="{{_name}}[masked]" value="1" {{#if masked}}checked="checked"{{/if}}> <?php _e('Enable input mask', 'caldera-forms'); ?></label>
</div>
</div>
<div id="{{_id}}_maskwrap">
<div class="caldera-config-group">
<label><?php _e('Mask', 'caldera-forms'); ?></label>
<label><?php esc_html_e('Mask', 'caldera-forms'); ?></label>
<div class="caldera-config-field">
<input type="text" id="{{_id}}_mask" class="block-input field-config" name="{{_name}}[mask]" value="{{mask}}">
</div>
</div>
<div class="caldera-config-group">
<p class="description"><?php _e('e.g.', 'caldera-forms' ); ?>: aaa-99-999-a9-9*</p>
<p class="description"><?php esc_html_e('e.g.', 'caldera-forms' ); ?>: aaa-99-999-a9-9*</p>
<ul>
<li>9 : <?php _e('numeric', 'caldera-forms'); ?></li>
<li>a : <?php _e('alphabetical', 'caldera-forms'); ?></li>
<li>* : <?php _e('alphanumeric', 'caldera-forms'); ?></li>
<li>[9 | a | *] : <?php _e('optional', 'caldera-forms'); ?></li>
<li>{int | * | +} : <?php _e('length', 'caldera-forms'); ?></li>
<li>9 : <?php esc_html_e('numeric', 'caldera-forms'); ?></li>
<li>a : <?php esc_html_e('alphabetical', 'caldera-forms'); ?></li>
<li>* : <?php esc_html_e('alphanumeric', 'caldera-forms'); ?></li>
<li>[9 | a | *] : <?php esc_html_e('optional', 'caldera-forms'); ?></li>
<li>{int | * | +} : <?php esc_html_e('length', 'caldera-forms'); ?></li>
</ul>
<p class="description"><?php _e('Any length character only', 'caldera-forms'); ?>: [a{*}]</p>
<p class="description"><?php _e('Any length number only', 'caldera-forms'); ?>: [9{*}]</p>
<p class="description"><?php _e('email', 'caldera-forms'); ?>: *{+}@*{2,}.*{2,}[.[a{2,}][.[a{2,}]]]</p>
<p class="description"><?php esc_html_e('Any length character only', 'caldera-forms'); ?>: [a{*}]</p>
<p class="description"><?php esc_html_e('Any length number only', 'caldera-forms'); ?>: [9{*}]</p>
<p class="description"><?php esc_html_e('email', 'caldera-forms'); ?>: *{+}@*{2,}.*{2,}[.[a{2,}][.[a{2,}]]]</p>

</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"scripts": {
"build": "yarn build:legacy && yarn build:new",
"build:legacy": "grunt",
"build:new": "yarn build:clients:pre && yarn build:clients && yarn build:blocks",
"start": "yarn build:clients:pre && yarn start:clients",
"start:clients": " cross-env BABEL_ENV=development NODE_ENV=development webpack-dev-server --config webpack.clients.js",
"build:new": "yarn build:clients && yarn build:blocks",
"start": "yarn start:clients",
"start:clients": "cross-env BABEL_ENV=development NODE_ENV=development webpack-dev-server --config webpack.clients.js",
"start:blocks": "wp-scripts start --config webpack.blocks.js ",
"build:blocks": "wp-scripts build --config webpack.blocks.js ",
"build:clients": "yarn build:clients:pre && cross-env BABEL_ENV=default NODE_ENV=production webpack --config webpack.clients.js",
"build:clients": "cross-env BABEL_ENV=default NODE_ENV=production webpack --config webpack.clients.js",
"build:clients:pre": "node clients/deleteBuilds.js",
"build:webpack": "cross-env BABEL_ENV=default NODE_ENV=production webpack --config webpack.clients.js",
"build:grunt": "grunt",
Expand Down
15 changes: 12 additions & 3 deletions sendwp/handler.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

add_action( 'wp_ajax_caldera_forms_sendwp_remote_install', 'wp_ajax_caldera_forms_sendwp_remote_install_handler' );
function wp_ajax_caldera_forms_sendwp_remote_install_handler () {
add_action( 'wp_ajax_caldera_forms_sendwp_remote_install', 'caldera_forms_sendwp_remote_install_handler' );
function caldera_forms_sendwp_remote_install_handler () {

//Security check via senwp_install_nonce
$security = check_ajax_referer('sendwp_install_nonce', 'sendwp_nonce', false);
Expand All @@ -24,6 +24,14 @@ function wp_ajax_caldera_forms_sendwp_remote_install_handler () {
break;
}

//Display an error message if a connection is activated on the website
if( $is_sendwp_installed && sendwp_client_connected() ){
ob_end_clean();
echo json_encode( array( 'error' => true, 'debug' => 'sendwp_connected' ) );
exit;
}


if( ! $is_sendwp_installed ) {

$plugin_slug = 'sendwp';
Expand Down Expand Up @@ -78,9 +86,10 @@ function wp_ajax_caldera_forms_sendwp_remote_install_handler () {
echo json_encode( array(
'partner_id' => 2400,
'register_url' => esc_url( sendwp_get_server_url() . '_/signup' ),
'client_name' => esc_url( sendwp_get_client_name() ),
'client_name' => esc_attr( sendwp_get_client_name() ),
'client_secret' => esc_attr( sendwp_get_client_secret() ),
'client_redirect' => esc_url( sendwp_get_client_redirect() ),
'client_url' => esc_url( sendwp_get_client_url() )
) );
exit;
}
1 change: 1 addition & 0 deletions sendwp/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function caldera_forms_admin_enqueue_sendwp_installer() {
'nonce' => wp_create_nonce( 'sendwp_install_nonce' ),
'security_failed_message' => esc_html__( 'Security failed to check sendwp_install_nonce', 'caldera-forms'),
'user_capability_message' => esc_html__( 'Ask an administrator for install_plugins capability', 'caldera-forms'),
'sendwp_connected_message' => esc_html__( 'SendWP is already connected.', 'caldera-forms'),
]);
}
add_action('caldera_forms_admin_main_enqueue', 'caldera_forms_admin_enqueue_sendwp_installer');
40 changes: 27 additions & 13 deletions sendwp/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,37 @@ function caldera_forms_sendwp_remote_install() {
'action': 'caldera_forms_sendwp_remote_install',
'sendwp_nonce': sendwp_vars.nonce
};

// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
jQuery.post(ajaxurl, data, function(response) {
var data = JSON.parse(response);
//Check for errors before calling caldera_forms_sendwp_register_client()
if(data.error === true ){

if( data.error ){

var element = jQuery("#cf-email-settings-ui"),
inner = '<div class="notice error"></div>',
message;

if( data.debug === '!security'){
jQuery("#cf-email-settings-ui").prepend('<div class="notice error"><p>' + sendwp_vars.security_failed_message + '</p></div>');
message = sendwp_vars.security_failed_message;
} else if( data.debug === '!user_capablity'){
jQuery("#cf-email-settings-ui").prepend('<div class="notice error"><p>' + sendwp_vars.user_capability_message + '</p></div>');
message = sendwp_vars.user_capability_message;
} else if( data.debug === 'sendwp_connected'){
message = sendwp_vars.sendwp_connected_message;
}

jQuery(element).prepend( jQuery( inner ).text(message) );

} else {
caldera_forms_sendwp_register_client(data.register_url, data.client_name, data.client_secret, data.client_redirect, data.partner_id);

caldera_forms_sendwp_register_client(data.register_url, data.client_name, data.client_secret, data.client_redirect, data.partner_id, data.client_url);

}

});
}

function caldera_forms_sendwp_register_client(register_url, client_name, client_secret, client_redirect, partner_id) {
function caldera_forms_sendwp_register_client(register_url, client_name, client_secret, client_redirect, partner_id, client_url) {

var form = document.createElement("form");
form.setAttribute("method", 'POST');
Expand All @@ -34,11 +47,12 @@ function caldera_forms_sendwp_register_client(register_url, client_name, client_
form.appendChild(input);
}

caldera_forms_sendwp_append_form_input('client_name', client_name);
caldera_forms_sendwp_append_form_input('client_secret', client_secret);
caldera_forms_sendwp_append_form_input('client_redirect', client_redirect);
caldera_forms_sendwp_append_form_input('partner_id', partner_id);

caldera_forms_sendwp_append_form_input('client_name', client_name);
caldera_forms_sendwp_append_form_input('client_secret', client_secret);
caldera_forms_sendwp_append_form_input('partner_id', partner_id);
caldera_forms_sendwp_append_form_input('client_redirect', client_redirect);
caldera_forms_sendwp_append_form_input('client_url', client_url);

document.body.appendChild(form);
form.submit();
}
}
2 changes: 1 addition & 1 deletion ui/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<li class="caldera-forms-toolbar-item">
<button class="button button-primary ajax-trigger cf-new-form-button"
data-request="start_new_form"
data-modal-no-buttons='<?php echo $modal_new_form; ?>'
data-modal-no-buttons='<?php echo esc_attr( $modal_new_form ); ?>'
data-modal-width="70%"
data-modal-height="80%"
data-load-class="none" data-modal="new_form"
Expand Down
2 changes: 1 addition & 1 deletion ui/panels/processors.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function build_processor_types($default = null){
if(isset($config['template'])){
include $config['template'];
}elseif( isset($config['html'])){
echo $config['html'];
echo esc_html( $config['html'] );
}else{
echo '<p>' . esc_html__('This processor has no configurable options.', 'caldera-forms') . '</p>';
}
Expand Down
Loading

0 comments on commit be93a84

Please sign in to comment.