Skip to content

Commit

Permalink
Merge branch 'pre-develop' into EVF-1189-fix/format-likert-data-in-ex…
Browse files Browse the repository at this point in the history
…port-entry
  • Loading branch information
MILAN88888 committed Sep 13, 2024
2 parents f559cd5 + 02bfa0c commit 1fa3fef
Show file tree
Hide file tree
Showing 24 changed files with 848 additions and 700 deletions.
318 changes: 164 additions & 154 deletions assets/css/admin-rtl.css

Large diffs are not rendered by default.

318 changes: 164 additions & 154 deletions assets/css/admin.css

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions assets/css/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9332,11 +9332,16 @@ img.ui-datepicker-trigger {
gap: 24px;
background: transparent;

@media screen and (max-width: 1180px) {
flex-direction: column;
}

&-wrapper {
box-shadow: 0px 6px 26px 0px rgba(10, 10, 10, 0.08);
background: #ffffff;
flex: 1;
display: flex;
max-width: 100%;
}

&-main {
Expand Down Expand Up @@ -10168,6 +10173,10 @@ body {
.everest-forms-settings-premium-sidebar {
margin-right: -885px;
display: unset;

@media screen and (max-width: 1180px) {
display: none;
}
}
}

Expand All @@ -10178,6 +10187,10 @@ body {
max-width: 100%;
padding: 18px 10px 26px 10px;
transition: all 0.3s;

@media screen and (max-width: 1180px) {
width: 100%;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/admin/chart.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/admin/evf-admin-email.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/admin/form-builder.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/admin/progressbar.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
== Changelog ==

= 3.0.3 - xx-xx-2024
= 3.0.3 - 12-09-2024
* Feature - Add new templates.
* Feature - Entry submission RestApi.
* Enhancement - Send file directly as an attachment.
* Fix - Premium sidebar design issue.
* Fix - Escaping issue in Yes/No field.
* Dev - Calculation module.
* Tweak - Hidden field editable compatibility.
* Tweak - Catch mail send error.
Expand Down
1 change: 1 addition & 0 deletions dist/blocks.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/dashboard.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/reactPlayerPreview.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/templates.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/templates.min.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ public static function bulk_install_addons( $addon_data ) {
$slug = isset( $addon['slug'] ) ? sanitize_key( wp_unslash( $addon['slug'] ) ) : '';
$name = isset( $addon['name'] ) ? sanitize_text_field( $addon['name'] ) : '';
$plugin = plugin_basename( WP_PLUGIN_DIR . '/' . $slug . '/' . $slug . '.php' );
if ( is_plugin_active( $plugin ) ) {
continue;
}
$status = array(
'install' => 'plugin',
'slug' => $slug,
Expand Down Expand Up @@ -250,7 +253,6 @@ public static function install_individual_addon( $slug, $plugin, $name, $status
require_once ABSPATH . '/wp-admin/includes/file.php';
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';

if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin ) ) {
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$status['plugin'] = $plugin;
Expand Down Expand Up @@ -295,8 +297,6 @@ public static function install_individual_addon( $slug, $plugin, $name, $status
);
$api = plugins_api( 'plugin_information', $args );
} else {
lg( get_option( 'everest-forms-pro_license_key' ) );
lg( $name );
$api = json_decode(
EVF_Updater_Key_API::version(
array(
Expand All @@ -314,7 +314,6 @@ public static function install_individual_addon( $slug, $plugin, $name, $status
}

$status['pluginName'] = $api->name;

$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Plugin_Upgrader( $skin );
$result = $upgrader->install( $api->download_link );
Expand Down
47 changes: 32 additions & 15 deletions includes/RestApi/controllers/version1/class-evf-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function register_routes() {
$this->namespace,
'/' . $this->rest_base,
array(
'methods' => WP_REST_Server::READABLE,
'methods' => 'GET',
'callback' => array( $this, 'get_templates_data' ),
'permission_callback' => array( $this, 'check_admin_permissions' ),
)
Expand Down Expand Up @@ -117,27 +117,43 @@ public function handle_favorite_action( WP_REST_Request $request ) {
*
* @return WP_REST_Response|WP_Error
*/
public function get_templates_data() {
public function get_templates_data( WP_REST_Request $request ) {

$headers = $request->get_headers( 'cookie' );
$url = isset( $headers['referer'][0] ) ? $headers['referer'][0] : '';
$parsed_url = parse_url( $url );
$query_string = isset( $parsed_url['query'] ) ? $parsed_url['query'] : '';
$query_params = array();
parse_str( $query_string, $query_params );
if ( isset( $query_params['refresh'] ) ) {
delete_transient( 'everest_forms_templates_data' );
}
$template_url = 'https://d3m99fsxk070py.cloudfront.net/';
$template_json_url = $template_url . 'templates1.json';
$transient_key = 'everest_forms_templates_data';
$cache_expiration = DAY_IN_SECONDS;

$template_url = 'https://d3m99fsxk070py.cloudfront.net/';
$template_data = get_transient( $transient_key );

$template_json_url = $template_url . 'templates1.json';
if ( false === $template_data ) {
try {
$response = wp_remote_get( $template_json_url );

try {
$response = wp_remote_get( $template_json_url );
if ( is_wp_error( $response ) ) {
return new WP_Error( 'http_request_failed', __( 'Failed to fetch templates.', 'everest-forms' ) );
}

if ( is_wp_error( $response ) ) {
return new WP_Error( 'http_request_failed', __( 'Failed to fetch templates.', 'everest-forms' ) );
}
$content_json = wp_remote_retrieve_body( $response );
$template_data = json_decode( $content_json );

$content_json = wp_remote_retrieve_body( $response );
$template_data = json_decode( $content_json );
if ( empty( $template_data ) ) {
return new WP_Error( 'no_templates', __( 'No templates found.', 'everest-forms' ), array( 'status' => 404 ) );
}

if ( empty( $template_data ) ) {
return new WP_Error( 'no_templates', __( 'No templates found.', 'everest-forms' ), array( 'status' => 404 ) );
set_transient( $transient_key, $template_data, $cache_expiration );
} catch ( Exception $e ) {
return new WP_Error( 'exception_occurred', __( 'An error occurred while fetching templates.', 'everest-forms' ), array( 'status' => 500 ) );
}
} catch ( Exception $e ) {
return new WP_Error( 'exception_occurred', __( 'An error occurred while fetching templates.', 'everest-forms' ), array( 'status' => 500 ) );
}

$folder_path = untrailingslashit( plugin_dir_path( EVF_PLUGIN_FILE ) . '/assets/images/templates' );
Expand Down Expand Up @@ -174,6 +190,7 @@ public function get_templates_data() {




/**
* Get Templates Data List.
*
Expand Down
10 changes: 5 additions & 5 deletions includes/class-evf-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ public static function save_form() {

if ( ! empty( $old_calculation_format ) && ! empty( $new_calculation_format ) ) {
$logger->error(
__( 'Need calculation formula to update.', 'everest-forms' ),
__( 'Formula update error.', 'everest-forms' ),
array( 'source' => 'form-save' )
);
wp_send_json_error(
array(
'errorTitle' => esc_html__( 'Need calculation formula to update.', 'everest-forms' ),
'errorTitle' => esc_html__( 'Heads Up!', 'everest-forms' ),
/* translators: %s: empty meta data */
'errorMessage' => sprintf( esc_html__( 'Please update all formula.', 'everest-forms' ) ),
'errorMessage' => sprintf( esc_html__( 'Seems like your formula is not up to date. We suggest you update your formula.', 'everest-forms' ) ),
)
);
}
Expand All @@ -404,9 +404,9 @@ public static function save_form() {
);
wp_send_json_error(
array(
'errorTitle' => esc_html__( 'Not supported operator.', 'everest-forms' ),
'errorTitle' => esc_html__( 'Heads Up!', 'everest-forms' ),
/* translators: %s: empty meta data */
'errorMessage' => sprintf( esc_html__( '^ operator is not used in latest version. use pow( $FIELD_1, 3 )', 'everest-forms' ) ),
'errorMessage' => sprintf( esc_html__( 'The ^ sign is now replaced with pow(). Please update accordingly. Tip: pow(a,b) = a^b', 'everest-forms' ) ),
)
);
}
Expand Down
78 changes: 39 additions & 39 deletions includes/fields/class-evf-field-yes-no.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,108 +477,108 @@ public function field_display( $field, $field_atts, $form_data ) {
$yes_no = $primary['yes_no'];
$yes_value = esc_attr( $yes_no['yes_value'] );
$no_value = esc_attr( $yes_no['no_value'] );
$yes_icon_color = esc_attr( $yes_no['yes_icon_color'] );
$no_icon_color = esc_attr( $yes_no['no_icon_color'] );
$yes_icon_color = $yes_no['yes_icon_color'];
$no_icon_color = $yes_no['no_icon_color'];
$yes_icon = $this->get_icon_svg( 'yes', $yes_icon_color );
$no_icon = $this->get_icon_svg( 'no', $no_icon_color );
$yes_label = esc_html( $yes_no['yes_label'] );
$no_label = esc_html( $yes_no['no_label'] );
$field_style = esc_attr( $yes_no['field_style'] );
$yes_label = $yes_no['yes_label'];
$no_label = $yes_no['no_label'];
$field_style = $yes_no['field_style'];

echo '<div id="evf-' . absint( $form_data['id'] ) . '-field_' . esc_attr( $field['id'] ) . '" class="everest-forms-field-yes-no-container">';

printf(
'<label class="everest-forms-field-yes-no yes" for="everest-forms-%d-field_%s_1">',
absint( $form_data['id'] ),
esc_attr( $field['id'] )
);
printf(
'<label class="everest-forms-field-yes-no yes" for="everest-forms-%d-field_%s_1">',
absint( $form_data['id'] ),
esc_attr( $field['id'] )
);

// Primary field.
$primary['id'] = sprintf(
'everest-forms-%d-field_%s_1',
absint( $form_data['id'] ),
esc_attr( $field['id'] )
);
// Primary field.
$primary['id'] = sprintf(
'everest-forms-%d-field_%s_1',
absint( $form_data['id'] ),
$field['id']
);

$primary['attr']['value'] = esc_attr( $yes_value );
$primary['attr']['aria-label'] = esc_attr( $yes_value );
$primary['attr']['value'] = esc_attr( $yes_value );

if ( 'with_icon' === $field_style ) {
printf(
'<input type="radio" %s %s>',
evf_html_attributes( esc_attr( $primary['id'] ), esc_attr( $primary['class'] ), esc_attr( $primary['data'] ), esc_attr( $primary['attr'] ) ),
evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
esc_attr( $primary['required'] )
);

echo $yes_icon; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( 'with_text' === $field_style ) {
printf(
'<input type="radio" %s %s>',
evf_html_attributes( esc_attr( $primary['id'] ), esc_attr( $primary['class'] ), esc_attr( $primary['data'] ), esc_attr( $primary['attr'] ) ),
evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
esc_attr( $primary['required'] )
);
printf( '<label for="%s">%s</label>', esc_attr( $primary['id'] ), esc_html( $yes_label ) );
} elseif ( 'with_icon_text' === $field_style ) {
printf(
'<input type="radio" %s %s>',
evf_html_attributes( esc_attr( $primary['id'] ), esc_attr( $primary['class'] ), esc_attr( $primary['data'] ), esc_attr( $primary['attr'] ) ),
evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
esc_attr( $primary['required'] )
);

echo $yes_icon; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<label for="%s">%s</label>', esc_attr( $primary['id'] ), esc_html( $yes_label ) );
}

echo '</label>';
echo '</label>';

printf(
'<label class="everest-forms-field-yes-no no" for="everest-forms-%d-field_%s_0">',
absint( $form_data['id'] ),
esc_attr( $field['id'] )
);
printf(
'<label class="everest-forms-field-yes-no no" for="everest-forms-%d-field_%s_0">',
absint( $form_data['id'] ),
esc_attr( $field['id'] )
);

// Secondary field.
$primary['id'] = sprintf(
'everest-forms-%d-field_%s_0',
absint( $form_data['id'] ),
esc_attr( $field['id'] )
);
// Primary field.
$primary['id'] = sprintf(
'everest-forms-%d-field_%s_0',
absint( $form_data['id'] ),
$field['id']
);

$primary['attr']['value'] = esc_js( $no_value );

$primary['attr']['value'] = esc_js( $no_value );
$primary['attr']['aria-label'] = esc_js( $no_value );

if ( 'with_icon' === $field_style ) {
printf(
'<input type="radio" %s %s>',
evf_html_attributes( esc_attr( $primary['id'] ), esc_attr( $primary['class'] ), esc_attr( $primary['data'] ), esc_attr( $primary['attr'] ) ),
evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
esc_attr( $primary['required'] )
);

echo $no_icon; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif ( 'with_text' === $field_style ) {
printf(
'<input type="radio" %s %s>',
evf_html_attributes( esc_attr( $primary['id'] ), esc_attr( $primary['class'] ), esc_attr( $primary['data'] ), esc_attr( $primary['attr'] ) ),
evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
esc_attr( $primary['required'] )
);
printf( '<label for="%s">%s</label>', esc_attr( $primary['id'] ), esc_html( $no_label ) );
} elseif ( 'with_icon_text' === $field_style ) {
printf(
'<input type="radio" %s %s>',
evf_html_attributes( esc_attr( $primary['id'] ), esc_attr( $primary['class'] ), esc_attr( $primary['data'] ), esc_attr( $primary['attr'] ) ),
evf_html_attributes( $primary['id'], $primary['class'], $primary['data'], $primary['attr'] ),
esc_attr( $primary['required'] )
);

echo $no_icon; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<label for="%s">%s</label>', esc_attr( $primary['id'] ), esc_html( $no_label ) );
}

echo '</label>';
echo '</label>';
echo '</div>';
}




/**
* Validates field on form submit.
*
Expand Down
Loading

0 comments on commit 1fa3fef

Please sign in to comment.