From d4b88f228dd8107b5ff3507cd9e62c67337ced44 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Mon, 23 Jan 2023 20:24:03 +0100 Subject: [PATCH] mastodon sadly does not support target on links See https://github.com/mastodon/mastodon/blob/main/lib/sanitize_ext/sanitize_config.rb#L77 --- includes/class-shortcodes.php | 23 ++++++++++++----------- templates/settings.php | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index 8c7377d..280c10a 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -40,7 +40,11 @@ class Shortcodes { $hash_tags = array(); foreach ( $tags as $tag ) { - $hash_tags[] = \sprintf( '', \get_tag_link( $tag ), $tag->slug ); + $hash_tags[] = \sprintf( + '', + \get_tag_link( $tag ), + $tag->slug + ); } return \implode( ' ', $hash_tags ); @@ -82,12 +86,17 @@ class Shortcodes { return ''; } - $atts = shortcode_atts( array( 'length' => ACTIVITYPUB_EXCERPT_LENGTH ), $atts, $tag ); + $atts = shortcode_atts( + array( 'length' => ACTIVITYPUB_EXCERPT_LENGTH ), + $atts, + $tag + ); $length = intval( $atts['length'] ); if ( 0 === $length ) { - $length = ACTIVITYPUB_EXCERPT_LENGTH; } + $length = ACTIVITYPUB_EXCERPT_LENGTH; + } $excerpt = \get_post_field( 'post_excerpt', $post ); @@ -219,10 +228,6 @@ class Shortcodes { return \esc_url( \get_permalink( $post->ID ) ); } - if ( 'blank' === $atts['type'] ) { - return \sprintf( '%1$s', \esc_url( \get_permalink( $post->ID ) ) ); - } - return \sprintf( '%1$s', \esc_url( \get_permalink( $post->ID ) ) ); } @@ -258,10 +263,6 @@ class Shortcodes { return \esc_url( \wp_get_shortlink( $post->ID ) ); } - if ( 'blank' === $atts['type'] ) { - return \sprintf( '%1$s', \esc_url( \wp_get_shortlink( $post->ID ) ) ); - } - return \sprintf( '%1$s', \esc_url( \wp_get_shortlink( $post->ID ) ) ); } diff --git a/templates/settings.php b/templates/settings.php index cebae11..d563cc5 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -76,9 +76,9 @@ $registered_sizes .= '.';
  • [ap_title] -
  • [ap_content] -
  • [ap_excerpt lenght=nnn] -
  • -
  • [ap_permalink type=xxx] -
  • +
  • [ap_permalink type=xxx] -
  • -
  • [ap_shortlink type=xxx] - Hum, to prettify the Shortlinks. Type can be either: raw (the raw url, no escaping), esc (the html escaped url), html (default, an a tag to the url), blank (an a tag to the url that opens in a new window).', 'activitypub' ), 'default' ); ?>
  • +
  • [ap_shortlink type=xxx] - Hum, to prettify the Shortlinks. Type can be either: raw (the raw url, no escaping), esc (the html escaped url), html (default, an a tag to the url).', 'activitypub' ), 'default' ); ?>
  • [ap_hashtags] -
  • [ap_hashcats] -
  • [ap_image size=xxx] -