Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions admin/form-builder/views/post-form-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ function wpuf_render_settings_field( $field_key, $field, $form_settings, $post_t
if ( $is_pro_preview && strpos( $field_key, 'notification_' ) === 0 ) {
$toggle_value = 'off';
}
// Convert various "on" values to 'on' for the toggle
if ( wpuf_is_checkbox_or_toggle_on( $toggle_value ) ) {
$toggle_value = 'on';
}
?>
<label
for="<?php echo $field_key; ?>"
Expand Down
3 changes: 0 additions & 3 deletions includes/Fields/Form_Field_Textarea.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace WeDevs\Wpuf\Fields;

Check failure on line 3 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

There must be one blank line after the namespace declaration


/**
* Textarea Field Class

Check warning on line 7 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
*/

Check warning on line 8 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
class Form_Field_Textarea extends Field_Contract {

public function __construct() {
Expand All @@ -14,14 +14,14 @@
$this->icon = 'menu-alt-2';
}

/**

Check warning on line 17 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
* Render the Textarea field

Check warning on line 18 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
*

Check warning on line 19 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
* @param array $field_settings

Check warning on line 20 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
* @param int $form_id

Check warning on line 21 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
* @param string $type

Check warning on line 22 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
* @param int $post_id

Check warning on line 23 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
*

Check warning on line 24 in includes/Fields/Form_Field_Textarea.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Found precision alignment of 1 spaces.
* @return void
*/
public function render( $field_settings, $form_id, $type = 'post', $post_id = null ) {
Expand Down Expand Up @@ -172,9 +172,6 @@
* @return string
*/
public function render_field_data( $data, $field ) {
if ( ! is_string( $data ) ) {
return '';
}

$data = implode( ',', $data );
$hide_label = isset( $field['hide_field_label'] )
Expand Down
8 changes: 1 addition & 7 deletions wpuf-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@
* @param <type> $post_id
*/
function wpuf_upload_attachment( $post_id ) {
if ( ! isset( $_FILES['wpuf_post_attachments'] ) ) {

Check failure on line 87 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
return false;
}

$fields = (int) wpuf_get_option( 'attachment_num' );

$wpuf_post_attachments = isset( $_FILES['wpuf_post_attachments'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_FILES['wpuf_post_attachments'] ) ) : [];

Check failure on line 93 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.

Check failure on line 93 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.

for ( $i = 0; $i < $fields; $i++ ) {
$file_name = basename( $wpuf_post_attachments['name'][ $i ] );
Expand Down Expand Up @@ -274,7 +274,7 @@
*
* @uses Walker
*/
class WPUF_Walker_Category_Multi extends Walker {

Check failure on line 277 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

A file should either contain function declarations or OO structure declarations, but not both. Found 137 function declaration(s) and 2 OO structure declaration(s). The first function declaration was found on line 15; the first OO declaration was found on line 277

/**
* @see Walker::$tree_type
Expand Down Expand Up @@ -327,7 +327,7 @@
*
* @since 0.8
*/
class WPUF_Walker_Category_Checklist extends Walker {

Check failure on line 330 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Only one object structure is allowed in a file
public $tree_type = 'category';

public $db_fields = [
Expand Down Expand Up @@ -479,7 +479,7 @@

if ( ! empty( $attributes ) ) {
foreach ( $attributes as $attr ) {
$terms = get_terms(

Check failure on line 482 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

The parameter "array( 'hide_empty' => false, 'parent' => $attr, )" at position #2 of get_terms() has been deprecated since WordPress version 4.5.0. Instead do not pass the parameter.
$field_settings['name'],
array(
'hide_empty' => false,
Expand Down Expand Up @@ -977,7 +977,7 @@
if ( isset( $attr['wpuf_cond']['cond_option'][ $field_key ] ) ) {
if ( is_array( $cond_field_value ) ) {
continue;
} else {

Check failure on line 980 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

If control structure block found as the only statement within an "else" block. Use elseif instead.
if ( (string) $attr['wpuf_cond']['cond_option'][ $field_key ] !== (string) $cond_field_value ) {
$return_for_no_cond = 1;
} else {
Expand Down Expand Up @@ -1170,12 +1170,6 @@
$repeat_data = maybe_unserialize( $repeat_data );
}

foreach ( $value as $i => $str ) {
if ( is_string( $str ) && preg_match( '/[^\|\s]/', $str ) ) {
$newvalue[] = $str;
}
}

if ( ! is_array( $repeat_data ) ) {
break;
}
Expand All @@ -1186,7 +1180,7 @@
$repeat_html .= '<label>' . $attr['label'] . ':</label>';
}

$repeat_html .= '<ul class="wpuf-repeat-field-data">';
$repeat_html .= '<ul class="wpuf-repeat-field-data">';

foreach ( $repeat_data as $repeat_entry ) {
$repeat_html .= '<li class="wpuf-repeat-entry">';
Expand Down
Loading