Skip to content
Merged
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ tests/chrome_recordings
*.min.js.*
*.min.css.*
tests/e2e/plugins-page-wpuf-lite-check.png
tests/e2e/screenshots
tests/e2e/screenshots
18 changes: 2 additions & 16 deletions assets/css/admin/form-builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,7 @@ html {
display: inline-flex;
align-items: center;
justify-content: center;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -1096,9 +1094,7 @@ html {
--tw-scale-x: .95;
--tw-scale-y: .95;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -1885,9 +1881,7 @@ html {
--tw-bg-opacity: 1;
background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity)));
padding: 1.5rem;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -2576,9 +2570,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
padding-top: 0.5rem;
padding-bottom: 0.5rem;
text-align: start;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -3030,8 +3022,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
.wpuf-glass,
.wpuf-glass.wpuf-btn-active {
border: none;
-webkit-backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
background-color: transparent;
background-image: linear-gradient(
135deg,
Expand All @@ -3051,8 +3042,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
@media (hover: hover) {
.wpuf-glass.wpuf-btn-active {
border: none;
-webkit-backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
background-color: transparent;
background-image: linear-gradient(
135deg,
Expand Down Expand Up @@ -3457,9 +3447,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
.wpuf-tooltip:before,
.wpuf-tooltip:after {
opacity: 0;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-delay: 100ms;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
Expand Down Expand Up @@ -6604,9 +6592,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
}

.wpuf-transition {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
Expand Down
18 changes: 2 additions & 16 deletions assets/css/ai-form-builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,7 @@ html {
display: inline-flex;
align-items: center;
justify-content: center;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -1096,9 +1094,7 @@ html {
--tw-scale-x: .95;
--tw-scale-y: .95;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -1885,9 +1881,7 @@ html {
--tw-bg-opacity: 1;
background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity)));
padding: 1.5rem;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -2576,9 +2570,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
padding-top: 0.5rem;
padding-bottom: 0.5rem;
text-align: start;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
transition-duration: 200ms;
Expand Down Expand Up @@ -3030,8 +3022,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
.wpuf-glass,
.wpuf-glass.wpuf-btn-active {
border: none;
-webkit-backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
background-color: transparent;
background-image: linear-gradient(
135deg,
Expand All @@ -3051,8 +3042,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
@media (hover: hover) {
.wpuf-glass.wpuf-btn-active {
border: none;
-webkit-backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
backdrop-filter: blur(var(--glass-blur, 40px));
background-color: transparent;
background-image: linear-gradient(
135deg,
Expand Down Expand Up @@ -3457,9 +3447,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
.wpuf-tooltip:before,
.wpuf-tooltip:after {
opacity: 0;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-delay: 100ms;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
Expand Down Expand Up @@ -6471,9 +6459,7 @@ input.wpuf-tab:checked + .wpuf-tab-content,
}

.wpuf-transition {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
Expand Down
19 changes: 18 additions & 1 deletion includes/Fields/Form_Field_MultiDropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
* @return void
*/
public function render( $field_settings, $form_id, $type = 'post', $post_id = null ) {
// Enqueue custom multi-select assets
$this->enqueue_multiselect_assets();

Comment on lines +27 to +29
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Asset enqueue is good; ensure handle exists and admin preview needs

Looks good for frontend. Verify the 'wpuf-custom-multiselect' handle is registered and consider enqueueing on form preview pages in admin if the builder preview relies on it.


🏁 Script executed:

#!/bin/bash
# Find where the script handle is registered and confirm a src is set.
rg -nP "wp_(register|enqueue)_script\(\s*['\"]wpuf-custom-multiselect['\"]" -C3

Length of output: 544


🏁 Script executed:

#!/bin/bash
# Search more broadly for where wpuf-custom-multiselect is registered
rg -nP "wpuf-custom-multiselect" -C5

Length of output: 670


🏁 Script executed:

#!/bin/bash
# Search for all wp_register_script calls to find where wpuf-custom-multiselect might be registered
rg -nP "wp_register_script" -C2 -g '*.php'

Length of output: 1545


🏁 Script executed:

#!/bin/bash
# Check Assets.php to understand the script registration and look for custom-multiselect
cat includes/Assets.php | head -120

Length of output: 3573


🏁 Script executed:

#!/bin/bash
# Find the get_scripts() method in Assets.php
rg -nP "get_scripts\(\)" includes/Assets.php -A 200 | head -300

Length of output: 13540


🏁 Script executed:

#!/bin/bash
# Search specifically for custom-multiselect in Assets.php
rg -n "custom-multiselect" includes/Assets.php

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search entire codebase for custom-multiselect to see if it's registered anywhere
rg -n "custom-multiselect" --type=php

Length of output: 108


Register 'wpuf-custom-multiselect' handle before enqueueing

The script handle 'wpuf-custom-multiselect' is being enqueued at includes/Fields/Form_Field_MultiDropdown.php:187 but is not registered anywhere in the codebase. Register it in Assets.php via the get_scripts() method with the appropriate source file and dependencies, or the asset will fail to load.

Additionally, consider whether this script needs to be enqueued on admin form preview/builder pages if the preview relies on it (currently only enqueued on frontend via if ( ! is_admin() )).

🤖 Prompt for AI Agents
In includes/Fields/Form_Field_MultiDropdown.php around lines 27-29 the call to
enqueue_multiselect_assets() expects a registered script handle
'wpuf-custom-multiselect' but that handle is not registered; open
includes/Assets.php and add the 'wpuf-custom-multiselect' entry in get_scripts()
registering the correct source path (point to the plugin JS file for the
multi-select), set proper dependencies (e.g., ['jquery','select2'] or whatever
the asset needs), a version (use filemtime or plugin version), and in_footer
flag; also adjust the enqueue condition so the script is registered/queued on
admin preview/builder pages if those previews require it (e.g., remove or extend
the current if ( ! is_admin() ) gating to include specific admin pages or use
is_admin() && $pagenow checks).

if ( isset( $post_id ) && $post_id != '0' ) {

Check warning on line 30 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Loose comparisons are not allowed. Expected: "!=="; Found: "!="
$selected = $this->get_meta( $post_id, $field_settings['name'], $type );

if ( is_serialized( $selected ) ) {
Expand All @@ -40,33 +43,33 @@
$selected = is_array( $selected ) ? $selected : (array) $selected;
}

$name = $field_settings['name'] . '[]';

Check warning on line 46 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Equals sign not aligned correctly; expected 1 space but found 5 spaces

$this->field_print_label( $field_settings, $form_id ); ?>

<?php do_action( 'WPUF_multidropdown_field_after_label', $field_settings ); ?>

Check failure on line 50 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Hook names should be lowercase. Expected: 'wpuf_multidropdown_field_after_label', but found: 'WPUF_multidropdown_field_after_label'.

<div class="wpuf-fields">
<select multiple="multiple" class="multiselect <?php echo 'wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" id="<?php echo esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" name="<?php echo esc_attr( $name ); ?>" mulitple="multiple" data-required="<?php echo esc_attr( $field_settings['required'] ); ?>" data-type="multiselect">
<select multiple="multiple" class="multiselect wpuf-multiselect-field <?php echo 'wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" id="<?php echo esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" name="<?php echo esc_attr( $name ); ?>" multiple="multiple" data-required="<?php echo esc_attr( $field_settings['required'] ); ?>" data-type="multiselect" data-placeholder="<?php echo esc_attr( $field_settings['first'] ); ?>">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Duplicate multiple="multiple" attribute

The select includes multiple="multiple" twice. Keep one.

-                <select multiple="multiple" class="multiselect wpuf-multiselect-field <?php echo 'wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" id="<?php echo esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" name="<?php echo esc_attr( $name ); ?>" multiple="multiple" data-required="<?php echo esc_attr( $field_settings['required'] ); ?>" data-type="multiselect" data-placeholder="<?php echo esc_attr( $field_settings['first'] ); ?>">
+                <select multiple="multiple" class="multiselect wpuf-multiselect-field <?php echo 'wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" id="<?php echo esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" name="<?php echo esc_attr( $name ); ?>" data-required="<?php echo esc_attr( $field_settings['required'] ); ?>" data-type="multiselect" data-placeholder="<?php echo esc_attr( $field_settings['first'] ); ?>">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<select multiple="multiple" class="multiselect wpuf-multiselect-field <?php echo 'wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" id="<?php echo esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" name="<?php echo esc_attr( $name ); ?>" multiple="multiple" data-required="<?php echo esc_attr( $field_settings['required'] ); ?>" data-type="multiselect" data-placeholder="<?php echo esc_attr( $field_settings['first'] ); ?>">
<select multiple="multiple" class="multiselect wpuf-multiselect-field <?php echo 'wpuf_' . esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" id="<?php echo esc_attr( $field_settings['name'] ) . '_' . esc_attr( $form_id ); ?>" name="<?php echo esc_attr( $name ); ?>" data-required="<?php echo esc_attr( $field_settings['required'] ); ?>" data-type="multiselect" data-placeholder="<?php echo esc_attr( $field_settings['first'] ); ?>">
🤖 Prompt for AI Agents
In includes/Fields/Form_Field_MultiDropdown.php around line 53, the <select>
element contains the multiple="multiple" attribute twice; remove the duplicate
so the element only includes a single multiple="multiple" attribute, leaving all
other attributes and echo statements unchanged.


<?php if ( !empty( $field_settings['first'] ) ) { ?>

Check failure on line 55 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 space after "!"; 0 found
<option value="-1"><?php echo esc_attr( $field_settings['first'] ); ?></option>
<?php } ?>

<?php
if ( $field_settings['options'] && count( $field_settings['options'] ) > 0 ) {
foreach ( $field_settings['options'] as $value => $option ) {
$current_select = selected( in_array( $value, $selected ), true, false ); ?>

Check failure on line 62 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Closing PHP tag must be on a line by itself

Check failure on line 62 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Not using strict comparison for in_array; supply true for $strict argument.
<option value="<?php echo esc_attr( $value ); ?>"<?php echo esc_attr( $current_select ); ?>><?php echo esc_html( $option ); ?></option>
<?php
}
} ?>

Check failure on line 66 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Closing PHP tag must be on a line by itself
</select>
<?php $this->help_text( $field_settings ); ?>
</div>


<?php $this->after_field_print_label();

Check failure on line 72 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening PHP tag must be on a line by itself
}

/**
Expand Down Expand Up @@ -102,7 +105,7 @@
public function prepare_entry( $field ) {
check_ajax_referer( 'wpuf_form_add' );

$field_name = isset( $_POST[$field['name']] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST[$field['name']] ) ) : [];

Check failure on line 108 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Array keys must be surrounded by spaces unless they contain a string or an integer.

Check failure on line 108 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Array keys must be surrounded by spaces unless they contain a string or an integer.
$field_name = array_map( 'strip_shortcodes', $field_name );
$entry_value = ( is_array( $field_name ) && $field_name ) ? $field_name : [];

Expand All @@ -110,7 +113,7 @@
$new_val = [];

foreach ( $entry_value as $option_key ) {
$new_val[] = isset( $field['options'][$option_key] ) ? $field['options'][$option_key] : '';

Check failure on line 116 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Array keys must be surrounded by spaces unless they contain a string or an integer.

Check failure on line 116 in includes/Fields/Form_Field_MultiDropdown.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Array keys must be surrounded by spaces unless they contain a string or an integer.
}
$entry_value = implode( wpuf()->get_field_seperator(), $new_val );
} else {
Expand Down Expand Up @@ -170,4 +173,18 @@
<?php
return ob_get_clean();
}

/**
* Enqueue custom multi-select assets
*
* @since WPUF_SINCE
*
* @return void
*/
private function enqueue_multiselect_assets() {
// Check if we're in the frontend
if ( ! is_admin() ) {
wp_enqueue_script( 'wpuf-custom-multiselect' );
}
}
}
42 changes: 39 additions & 3 deletions includes/Frontend_Render_Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace WeDevs\Wpuf;

use WeDevs\Wpuf\Admin\Forms\Form;
use WeDevs\Wpuf\Admin\Subscription;

class Frontend_Render_Form {
private static $_instance;

Check warning on line 9 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Property name "$_instance" should not be prefixed with an underscore to indicate visibility

public static $meta_key = 'wpuf_form';

Expand Down Expand Up @@ -123,7 +124,7 @@
wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) );
}

$form_id = isset( $_GET['form_id'] ) ? intval( wp_unslash( $_GET['form_id'] ) ) : 0;

Check warning on line 127 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.

Check warning on line 127 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.

if ( $form_id ) {
wp_enqueue_script( 'jquery' );
Expand Down Expand Up @@ -197,15 +198,50 @@

$label_position = isset( $this->form_settings['label_position'] ) ? $this->form_settings['label_position'] : 'left';

$layout = isset( $this->form_settings['form_layout'] ) ? $this->form_settings['form_layout'] : 'layout1';
$layout = 'layout1';

$theme_css = isset( $this->form_settings['use_theme_css'] ) ? $this->form_settings['use_theme_css'] : 'wpuf-style';
Comment on lines +201 to 203
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

“Use Theme CSS” emits raw setting as a CSS class and is layout-inconsistent.

Currently the class attribute may become “on/off” (or similar), and esc_html is used in a class attribute. Compute a boolean and derive the skin class; use esc_attr.

Apply a minimal fix by computing the class at render-time:

<?php
$skin_class = ( 'layout1' === $layout )
    ? ( isset( $this->form_settings['use_theme_css'] ) && wpuf_is_checkbox_or_toggle_on( $this->form_settings['use_theme_css'] ) ? '' : 'wpuf-style' )
    : 'wpuf-style';
?>
<form class="wpuf-form-add wpuf-form-<?php echo esc_attr( $layout ); ?> <?php echo esc_attr( $skin_class ); ?>" action="" method="post">

Optional cleanup: remove the now-unused $theme_css variable.

Also applies to: 261-263


do_action( 'wpuf_before_form_render', $form_id );

if ( ! empty( $layout ) ) {
wp_enqueue_style( 'wpuf-' . $layout );
$form = new Form($form_id);

// Check if Use Theme CSS is enabled - if so, don't enqueue plugin styles
$use_theme_css = isset( $this->form_settings['use_theme_css'] ) ? $this->form_settings['use_theme_css'] : '';

if ( 'wpuf_profile' === $form->data->post_type && 'on' !== $use_theme_css ) {
$layout = isset( $this->form_settings['profile_form_layout'] ) ? $this->form_settings['profile_form_layout'] : 'layout1';
switch ( $layout ) {
case 'layout2':
wp_enqueue_style( 'wpuf-reg-template-2' );
break;

case 'layout3':
wp_enqueue_style( 'wpuf-reg-template-3' );
break;

case 'layout4':
wp_enqueue_style( 'wpuf-reg-template-4' );
break;

case 'layout5':
wp_enqueue_style( 'wpuf-reg-template-5' );
break;

default:
wp_enqueue_style( 'wpuf-reg-template-1' );
break;
}
} else {
$layout = isset( $this->form_settings['form_layout'] ) ? $this->form_settings['form_layout'] : 'layout1';

if ( ! empty( $layout ) && 'on' !== $use_theme_css ) {
// Always enqueue the base template style
wp_enqueue_style( 'wpuf-reg-template-base' );
wp_enqueue_style( 'wpuf-' . $layout );
}
}

if ( ! is_user_logged_in() && ( ! empty( $this->form_settings['post_permission'] ) && 'guest_post' !== $this->form_settings['post_permission'] ) ) {
$login = wpuf()->frontend->simple_login->get_login_url();
$register = wpuf()->frontend->simple_login->get_registration_url();
Expand Down Expand Up @@ -328,8 +364,8 @@
</div>
<div >
<label >
<input type="checkbox" class="wpuf_is_featured" name="is_featured_item" value="1" <?php echo $is_featured ? 'checked' : ''; ?> >

Check warning on line 367 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
<span class="wpuf-items-table-containermessage-box" id="remaining-feature-item"> <?php echo sprintf(

Check warning on line 368 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
// translators: %1$s is Post type and %2$d is item
wp_kses_post( __( 'Mark the %1$s as featured (remaining %2$d)', 'wp-user-frontend' ) ), esc_html( $post_type ), esc_html( $featured_item ) ); ?></span>
</label>
Expand Down Expand Up @@ -365,7 +401,7 @@

foreach ( $form_vars as $key => $value ) {
// get column field input fields
if ( $value['input_type'] == 'column_field' ) {

Check warning on line 404 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Loose comparisons are not allowed. Expected: "==="; Found: "=="
$inner_fields = $value['inner_fields'];

foreach ( $inner_fields as $column_key => $column_fields ) {
Expand All @@ -377,12 +413,12 @@
}

//separate the post and custom fields
if ( isset( $column_field['is_meta'] ) && $column_field['is_meta'] == 'yes' ) {

Check warning on line 416 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Loose comparisons are not allowed. Expected: "==="; Found: "=="
$meta_vars[] = $column_field;
continue;
}

if ( $column_field['input_type'] == 'taxonomy' ) {

Check warning on line 421 in includes/Frontend_Render_Form.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Loose comparisons are not allowed. Expected: "==="; Found: "=="

// don't add "category"
// if ( $column_field['name'] == 'category' ) {
Expand Down
6 changes: 3 additions & 3 deletions includes/Render_Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function render_form( $form_id, $post_id = null ) {

do_action( 'wpuf_before_form_render', $form_id );

if ( !empty( $layout ) ) {
if ( ! empty( $layout ) && 'on' !== $theme_css ) {
wp_enqueue_style( 'wpuf-' . $layout );
}

Expand Down Expand Up @@ -1334,12 +1334,12 @@ private function is_taxonomy_field_gated( $form_field ) {
if ( $form_field['input_type'] !== 'taxonomy' ) {
return false;
}

// If pro is active, no fields are gated
if ( wpuf_is_pro_active() ) {
return false;
}

// Check if this is a custom taxonomy
$builtin_taxonomies = apply_filters( 'wpuf_builtin_taxonomies_free', array( 'category', 'post_tag' ) );
return ! in_array( $form_field['name'], $builtin_taxonomies, true );
Expand Down
20 changes: 10 additions & 10 deletions languages/wp-user-frontend.pot
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ msgstr ""

#: admin/html/form-settings-post.php:22 class/render-form.php:776
#: includes/Admin/Forms/Admin_Form_Builder.php:83
#: includes/Frontend_Render_Form.php:79 includes/Render_Form.php:638
#: includes/Frontend_Render_Form.php:80 includes/Render_Form.php:638
#: includes/class-frontend-render-form.php:183
msgid "Save Draft"
msgstr ""
Expand Down Expand Up @@ -1207,7 +1207,7 @@ msgstr ""
#: includes/Ajax/Admin_Form_Builder_Ajax.php:138
#: includes/Ajax/Admin_Form_Builder_Ajax.php:142
#: includes/Ajax/Admin_Form_Builder_Ajax.php:218
#: includes/Frontend_Render_Form.php:123
#: includes/Frontend_Render_Form.php:124
#: includes/Integrations/WPUF_ACF_Compatibility.php:76
#: includes/Integrations/WPUF_ACF_Compatibility.php:94
#: includes/Integrations/WPUF_ACF_Compatibility.php:160
Expand Down Expand Up @@ -1255,7 +1255,7 @@ msgstr ""
#: admin/template-post.php:150 includes/Admin/Forms/Template_Post.php:159
#: includes/Fields/Field_Contract.php:494
#: includes/Fields/Form_Field_MultiDropdown.php:11
#: includes/Fields/Form_Field_MultiDropdown.php:81
#: includes/Fields/Form_Field_MultiDropdown.php:84
msgid "Multi Select"
msgstr ""

Expand Down Expand Up @@ -1676,12 +1676,12 @@ msgstr ""
msgid "Invisible reCAPTCHA validation failed"
msgstr ""

#: class/render-form.php:378 includes/Frontend_Render_Form.php:187
#: class/render-form.php:378 includes/Frontend_Render_Form.php:188
#: includes/Render_Form.php:235 includes/class-frontend-render-form.php:289
msgid "Your selected form is no longer available."
msgstr ""

#: class/render-form.php:384 includes/Frontend_Render_Form.php:193
#: class/render-form.php:384 includes/Frontend_Render_Form.php:194
#: includes/Render_Form.php:241 includes/class-frontend-render-form.php:295
msgid "Please make sure you've published your form."
msgstr ""
Expand Down Expand Up @@ -2898,7 +2898,7 @@ msgstr ""
#: includes/Admin/Forms/Post/Templates/Post_Form_Template_Video.php:104
#: includes/Fields/Field_Contract.php:238
#: includes/Fields/Form_Field_Dropdown.php:110
#: includes/Fields/Form_Field_MultiDropdown.php:85
#: includes/Fields/Form_Field_MultiDropdown.php:88
#: includes/Fields/Form_Field_Post_Taxonomy.php:500
msgid "- Select -"
msgstr ""
Expand Down Expand Up @@ -2939,7 +2939,7 @@ msgstr ""
#: includes/Admin/Forms/Admin_Form_Builder.php:336
#: includes/Fields/Form_Field_Checkbox.php:112
#: includes/Fields/Form_Field_Dropdown.php:109
#: includes/Fields/Form_Field_MultiDropdown.php:84
#: includes/Fields/Form_Field_MultiDropdown.php:87
#: includes/Fields/Form_Field_Radio.php:111
msgid "Option"
msgstr ""
Expand Down Expand Up @@ -4731,7 +4731,7 @@ msgid "You already have an account in our site. Please login to continue."
msgstr ""

#: includes/Ajax/Frontend_Form_Ajax.php:752
#: includes/Frontend_Render_Form.php:227
#: includes/Frontend_Render_Form.php:258
#: includes/class-frontend-render-form.php:323
msgid "You do not have sufficient permissions to access this form."
msgstr ""
Expand Down Expand Up @@ -6921,13 +6921,13 @@ msgstr ""
msgid "Please Cancel Your Currently Active Pack first!"
msgstr ""

#: includes/Frontend_Render_Form.php:327
#: includes/Frontend_Render_Form.php:358
#: includes/class-frontend-render-form.php:928
#: templates/dashboard/posts.php:120
msgid "Featured"
msgstr ""

#: includes/Frontend_Render_Form.php:334
#: includes/Frontend_Render_Form.php:365
#: includes/class-frontend-render-form.php:936
#. translators: %1$s is Post type and %2$d is item
#. translators: %1$s is Post type and %2$s is total feature item
Expand Down
Loading
Loading