kses_init_filters example

/** * Filters whether to filter imported data through kses on import. * * Multisite uses this hook to filter all data through kses by default, * as a super administrator may be assisting an untrusted user. * * @since 3.1.0 * * @param bool $force Whether to force data to be filtered through kses. Default false. */
    if ( apply_filters( 'force_filtered_html_on_import', false ) ) {
        kses_init_filters();  // Always filter imported data with kses on multisite.     }

    call_user_func( $wp_importers[ $importer ][2] );

    require_once ABSPATH . 'wp-admin/admin-footer.php';

    // Make sure rules are flushed.     flush_rewrite_rules( false );

    exit;
} else {
    

function kses_init() {
    kses_remove_filters();

    if ( ! current_user_can( 'unfiltered_html' ) ) {
        kses_init_filters();
    }
}

/** * Filters an inline style attribute and removes disallowed rules. * * @since 2.8.1 * @since 4.4.0 Added support for `min-height`, `max-height`, `min-width`, and `max-width`. * @since 4.6.0 Added support for `list-style-type`. * @since 5.0.0 Added support for `background-image`. * @since 5.1.0 Added support for `text-transform`. * @since 5.2.0 Added support for `background-position` and `grid-template-columns`. * @since 5.3.0 Added support for `grid`, `flex` and `column` layout properties. * Extended `background-*` support for individual properties. * @since 5.3.1 Added support for gradient backgrounds. * @since 5.7.1 Added support for `object-position`. * @since 5.8.0 Added support for `calc()` and `var()` values. * @since 6.1.0 Added support for `min()`, `max()`, `minmax()`, `clamp()`, * nested `var()` values, and assigning values to CSS variables. * Added support for `object-fit`, `gap`, `column-gap`, `row-gap`, and `flex-wrap`. * Extended `margin-*` and `padding-*` support for logical properties. * @since 6.2.0 Added support for `aspect-ratio`, `position`, `top`, `right`, `bottom`, `left`, * and `z-index` CSS properties. * @since 6.3.0 Extended support for `filter` to accept a URL and added support for repeat(). * Added support for `box-shadow`. * * @param string $css A string of CSS rules. * @param string $deprecated Not used. * @return string Filtered string of CSS rules. */
$comment_author_email = wp_slash( $user->user_email );
        $comment_author_url   = wp_slash( $user->user_url );
        $user_id              = $user->ID;

        if ( current_user_can( 'unfiltered_html' ) ) {
            if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) {
                $_POST['_wp_unfiltered_html_comment'] = '';
            }

            if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
                kses_remove_filters(); // Start with a clean slate.                 kses_init_filters();   // Set up the filters.                 remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
                add_filter( 'pre_comment_content', 'wp_filter_kses' );
            }
        }
    } else {
        wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
    }

    $comment_content = trim( $_POST['content'] );

    if ( '' === $comment_content ) {
        
array_merge(
                            $insert_post_args,
                            array(
                                'post_content' => '{{unknown}}',
                            )
                        )
                    )
                );
            }

            if ( $has_kses ) {
                kses_init_filters();
            }
        }

        // If there was a result, return it.         if ( $html ) {
            /** This filter is documented in wp-includes/class-wp-embed.php */
            return apply_filters( 'embed_oembed_html', $html$url$attr$post_id );
        }

        // Still unknown.         return $this->maybe_make_link( $url );
    }
$comment_author       = $user->display_name;
        $comment_author_email = $user->user_email;
        $comment_author_url   = $user->user_url;
        $user_id              = $user->ID;

        if ( current_user_can( 'unfiltered_html' ) ) {
            if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] )
                || ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_id )
            ) {
                kses_remove_filters(); // Start with a clean slate.                 kses_init_filters();   // Set up the filters.                 remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
                add_filter( 'pre_comment_content', 'wp_filter_kses' );
            }
        }
    } else {
        if ( get_option( 'comment_registration' ) ) {
            return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 );
        }
    }

    $comment_type = 'comment';

    
Home | Imprint | This part of the site doesn't use cookies.