diff --git a/includes/Fields/Form_Field_Post_Content.php b/includes/Fields/Form_Field_Post_Content.php index 06f2d8de3..0e7928ecc 100755 --- a/includes/Fields/Form_Field_Post_Content.php +++ b/includes/Fields/Form_Field_Post_Content.php @@ -11,6 +11,27 @@ public function __construct() { $this->name = __( 'Post Content', 'wp-user-frontend' ); $this->input_type = 'post_content'; $this->icon = 'text-width'; + + // check if block theme is active + if ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) { + add_filter( 'format_for_editor', [ $this, 'format_for_editor' ], 10, 2 ); + } + } + + /** + * Format the content for editor. Need to do this for block theme support + * + * @param string $content + * @param string $default_editor + * + * @return string + */ + public function format_for_editor( $content, $default_editor ) { + if ( 'tinymce' !== $default_editor ) { + return $content; + } + + return htmlspecialchars_decode( $content, ENT_NOQUOTES ); } /** diff --git a/includes/Frontend/Frontend_Form.php b/includes/Frontend/Frontend_Form.php index 92e59a8ad..5524cde56 100755 --- a/includes/Frontend/Frontend_Form.php +++ b/includes/Frontend/Frontend_Form.php @@ -33,8 +33,8 @@ public function __construct() { * * @param array $atts * - * @return - **/ + * @return false|string + */ public function edit_post_shortcode( $atts ) { add_filter( 'wpuf_form_fields', [ $this, 'add_field_settings' ] ); // @codingStandardsIgnoreStart @@ -52,7 +52,13 @@ public function edit_post_shortcode( $atts ) { wp_login_form(); - return; + return ''; + } + + $nonce = isset( $_GET['_wpnonce'] ) ? sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ) : ''; + + if ( ! wp_verify_nonce( $nonce, 'wpuf_edit' ) ) { + return '
' . __( 'Please re-open the post', 'wp-user-frontend' ) . '
'; } $post_id = isset( $_GET['pid'] ) ? intval( wp_unslash( $_GET['pid'] ) ) : 0; @@ -110,7 +116,6 @@ public function edit_post_shortcode( $atts ) { $form = new Form( $form_id ); $this->form_fields = $form->get_fields(); - // $form_settings = wpuf_get_form_settings( $form_id ); $this->form_settings = $form->get_settings(); $disable_pending_edit = wpuf_get_option( 'disable_pending_edit', 'wpuf_dashboard', 'on' ); diff --git a/includes/Frontend_Render_Form.php b/includes/Frontend_Render_Form.php index 12407ac1a..963504091 100644 --- a/includes/Frontend_Render_Form.php +++ b/includes/Frontend_Render_Form.php @@ -183,7 +183,7 @@ public function render_form( $form_id, $post_id = null, $atts = [], $form = null return; } - if ( $form_status != 'publish' ) { + if ( 'publish' !== $form_status ) { echo wp_kses_post( '
' . __( "Please make sure you've published your form.", 'wp-user-frontend' ) . '
' ); return; @@ -222,9 +222,9 @@ public function render_form( $form_id, $post_id = null, $atts = [], $form = null if ( $this->form_fields ) { ?> -
+ -