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
2 changes: 1 addition & 1 deletion assets/js/components/FormsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ onMounted(() => {
'wpuf-bg-gray-100 wpuf-border-gray-200 wpuf-text-gray-800': form.post_status === 'draft'
}"
class="wpuf-inline-flex wpuf-items-center wpuf-py-[2px] wpuf-px-[12px] wpuf-rounded-[5px] wpuf-text-xs wpuf-font-medium wpuf-border">
{{ form.post_status === 'publish' ? 'Published' :
{{ form.post_status === 'publish' ? 'Saved' :
form.post_status === 'pending' ? 'Pending Review' :
form.post_status === 'private' ? 'Private' : 'Draft' }}
</span>
Expand Down
2 changes: 1 addition & 1 deletion wpuf-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@
*
* @param <type> $post_id
*/
function wpuf_upload_attachment( $post_id ) {

Check warning on line 86 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

The method parameter $post_id is never used
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 @@ -149,7 +149,7 @@
*
* @author Tareq Hasan
*/
function wpuf_unset_media_tab( $list ) {

Check warning on line 152 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

It is recommended not to use reserved keyword "list" as function parameter name. Found: $list
if ( ! current_user_can( 'edit_posts' ) ) {
unset( $list['library'] );
unset( $list['gallery'] );
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 @@ -394,7 +394,7 @@
*
* @since 0.8
*/
function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $attr = [], $class = null ) {

Check warning on line 397 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

It is recommended not to use reserved keyword "class" as function parameter name. Found: $class
require_once ABSPATH . '/wp-admin/includes/template.php';

$walker = new WPUF_Walker_Category_Checklist();
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 @@ -716,7 +716,7 @@
*
* @return string image tag of the user avatar
*/
function wpuf_get_avatar( $avatar, $id_or_email, $size, $default, $alt, $args ) {

Check warning on line 719 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

It is recommended not to use reserved keyword "default" as function parameter name. Found: $default

Check warning on line 719 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

The method parameter $args is never used
if ( wpuf_use_default_avatar() ) {
return $avatar;
}
Expand Down Expand Up @@ -823,7 +823,7 @@
$prev_avatar_path = str_replace( $upload_dir['baseurl'], $upload_dir['basedir'], $prev_avatar );

if ( file_exists( $prev_avatar_path ) ) {
unlink( $prev_avatar_path );

Check warning on line 826 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

unlink() is discouraged. Use wp_delete_file() to delete a file.
}
}

Expand Down Expand Up @@ -951,7 +951,7 @@
$attr['name'] = $attr['input_type'];
}

$field_value = get_post_meta( $post->ID, $attr['name'] );

Check warning on line 954 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

When passing the $key parameter to get_post_meta(), it is recommended to also pass the $single parameter to explicitly indicate whether a single value or multiple values are expected to be returned.
$hide_label = isset( $attr['hide_field_label'] ) ? $attr['hide_field_label'] : 'no';

$return_for_no_cond = 0;
Expand All @@ -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 @@ -1033,7 +1033,7 @@
}

$full_size = wp_get_attachment_url( $attachment_id );
$path = parse_url( $full_size, PHP_URL_PATH );

Check warning on line 1036 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

parse_url() is discouraged because of inconsistency in the output across PHP versions; use wp_parse_url() instead.
$extension = pathinfo( $path, PATHINFO_EXTENSION );

if ( $thumb ) {
Expand Down Expand Up @@ -1301,7 +1301,7 @@
break;

default:
$value = get_post_meta( $post->ID, $attr['name'] );

Check warning on line 1304 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

When passing the $key parameter to get_post_meta(), it is recommended to also pass the $single parameter to explicitly indicate whether a single value or multiple values are expected to be returned.
$filter_html = apply_filters( 'wpuf_custom_field_render', '', $value, $attr, $form_settings );
$separator = ' | ';

Expand Down Expand Up @@ -1515,7 +1515,7 @@

return ob_get_clean();
} elseif ( 'repeat' === $type ) {
return implode( '; ', get_post_meta( $post->ID, $name ) );

Check warning on line 1518 in wpuf-functions.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

When passing the $key parameter to get_post_meta(), it is recommended to also pass the $single parameter to explicitly indicate whether a single value or multiple values are expected to be returned.
} elseif ( 'normal' === $type ) {
return implode( ', ', get_post_meta( $post->ID, $name ) );
} else {
Expand Down Expand Up @@ -5606,7 +5606,7 @@

$post_statuses = apply_filters( 'wpuf_post_forms_list_table_post_statuses', [
'all' => __( 'All', 'wp-user-frontend' ),
'publish' => __( 'Published', 'wp-user-frontend' ),
'publish' => __( 'Saved', 'wp-user-frontend' ),
'trash' => __( 'Trash', 'wp-user-frontend' ),
] );

Expand Down
Loading