Changeset 13548 for sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-blocks.php
- Timestamp:
- 04/17/2024 06:10:21 AM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-blocks.php
r12569 r13548 277 277 278 278 if ( $use_it ) { 279 $reply_id = bbp_is_reply_edit() ? bbp_get_reply_id() : ( ( bbp_is_post_request() && ! empty( $_POST['action'] ) && 'bbp-edit-reply' === $_POST['action'] ) ? $_POST['bbp_reply_id'] : 0 ); 280 $topic_id = bbp_is_topic_edit() ? bbp_get_topic_id() : ( ( bbp_is_post_request() && ! empty( $_POST['action'] ) && 'bbp-edit-topic' === $_POST['action'] ) ? $_POST['bbp_topic_id'] : 0 ); 281 282 // If we're editing a post made without the editor, let's respect that. 283 if ( $reply_id ) { 284 $reply = bbp_get_reply( $reply_id ); 285 286 if ( $reply && ! has_blocks( $reply->post_content ) ) { 287 $use_it = false; 288 } 289 } elseif ( $topic_id ) { 290 if ( ! has_blocks( get_post_field( 'post_content', $topic_id ) ) ) { 279 $content = false; 280 281 if ( bbp_is_reply_edit() ) { 282 $content = bbp_get_reply( bbp_get_reply_id() )->post_content; 283 } elseif ( bbp_is_topic_edit() ) { 284 $content = get_post_field( 'post_content', bbp_get_topic_id() ); 285 } elseif ( 'bbp-edit-reply' === $_POST['action'] ?? '' ) { 286 $content = wp_unslash( $_POST['bbp_reply_content'] ?? '' ) ?: bbp_get_reply( $_POST['bbp_reply_id'] ?? 0 )->post_content; 287 } elseif ( 'bbp-edit-topic' === $_POST['action'] ?? '' ) { 288 $content = wp_unslash( $_POST['bbp_topic_content'] ?? '' ) ?: get_post_field( 'post_content', $_POST['bbp_topic_id'] ); 289 } 290 291 if ( $content ) { 292 // Similar to has_blocks(), but optimized for forum use. 293 $content = trim( $content ); 294 if ( ! str_starts_with( $content, '<!-- wp:' ) || ! str_ends_with( $content, '-->' ) ) { 291 295 $use_it = false; 292 296 }
Note: See TracChangeset
for help on using the changeset viewer.