From bc8cb19c5df1a6092bb5020df6210dbe627d15bf Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 31 Jan 2023 18:43:11 +0100 Subject: [PATCH] add an option to disable content filters --- includes/class-shortcodes.php | 16 +++++++++++++++- includes/help.php | 8 ++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index b7243d5..b6fc4ad 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -191,9 +191,23 @@ class Shortcodes { return ''; } + $atts = shortcode_atts( + array( 'apply_filters' => 'yes' ), + $atts, + $tag + ); + $content = \get_post_field( 'post_content', $post ); - return \apply_filters( 'the_content', $content ); + if ( 'yes' === $atts['apply_filters'] ) { + $content = \apply_filters( 'the_content', $content ); + } else { + $content = do_blocks( $content ); + $content = wptexturize( $content ); + $content = wp_filter_content_tags( $content ); + } + + return $content; } /** diff --git a/includes/help.php b/includes/help.php index 6039b9f..58339fb 100644 --- a/includes/help.php +++ b/includes/help.php @@ -9,14 +9,14 @@ '
' . '
[ap_title]
' . '
' . \wp_kses( __( 'The post\'s title.', 'activitypub' ), 'default' ) . '
' . - '
[ap_content]
' . - '
' . \wp_kses( __( 'The post\'s content.', 'activitypub' ), 'default' ) . '
' . + '
[ap_content apply_filters="yes"]
' . + '
' . \wp_kses( __( 'The post\'s content. With apply_filters you can decide if filters should be applied or not (default is yes). The values can be yes or no. apply_filters attribute is optional.', 'activitypub' ), 'default' ) . '
' . '
[ap_excerpt lenght="400"]
' . '
' . \wp_kses( __( 'The post\'s excerpt (default 400 chars). length attribute is optional.', 'activitypub' ), 'default' ) . '
' . '
[ap_permalink type="url"]
' . - '
' . \wp_kses( __( 'The post\'s permalink. Type can be either: url or html (an <a /> tag). type attribute is optional.', 'activitypub' ), 'default' ) . '
' . + '
' . \wp_kses( __( 'The post\'s permalink. type can be either: url or html (an <a /> tag). type attribute is optional.', 'activitypub' ), 'default' ) . '
' . '
[ap_shortlink type="url"]
' . - '
' . \wp_kses( __( 'The post\'s shortlink. Type can be either url or html (an <a /> tag). I can recommend Hum, to prettify the Shortlinks. type attribute is optional.', 'activitypub' ), 'default' ) . '
' . + '
' . \wp_kses( __( 'The post\'s shortlink. type can be either url or html (an <a /> tag). I can recommend Hum, to prettify the Shortlinks. type attribute is optional.', 'activitypub' ), 'default' ) . '
' . '
[ap_hashtags]
' . '
' . \wp_kses( __( 'The post\'s tags as hashtags.', 'activitypub' ), 'default' ) . '
' . '
[ap_hashcats]
' .