mastodon sadly does not support target on links
See https://github.com/mastodon/mastodon/blob/main/lib/sanitize_ext/sanitize_config.rb#L77
This commit is contained in:
parent
b458cc6b88
commit
d4b88f228d
2 changed files with 14 additions and 13 deletions
|
@ -40,7 +40,11 @@ class Shortcodes {
|
||||||
$hash_tags = array();
|
$hash_tags = array();
|
||||||
|
|
||||||
foreach ( $tags as $tag ) {
|
foreach ( $tags as $tag ) {
|
||||||
$hash_tags[] = \sprintf( '<a rel="tag" class="u-tag u-category" href="%s">#%s</a>', \get_tag_link( $tag ), $tag->slug );
|
$hash_tags[] = \sprintf(
|
||||||
|
'<a rel="tag" class="u-tag u-category" href="%s">#%s</a>',
|
||||||
|
\get_tag_link( $tag ),
|
||||||
|
$tag->slug
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return \implode( ' ', $hash_tags );
|
return \implode( ' ', $hash_tags );
|
||||||
|
@ -82,12 +86,17 @@ class Shortcodes {
|
||||||
return '';
|
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'] );
|
$length = intval( $atts['length'] );
|
||||||
|
|
||||||
if ( 0 === $length ) {
|
if ( 0 === $length ) {
|
||||||
$length = ACTIVITYPUB_EXCERPT_LENGTH; }
|
$length = ACTIVITYPUB_EXCERPT_LENGTH;
|
||||||
|
}
|
||||||
|
|
||||||
$excerpt = \get_post_field( 'post_excerpt', $post );
|
$excerpt = \get_post_field( 'post_excerpt', $post );
|
||||||
|
|
||||||
|
@ -219,10 +228,6 @@ class Shortcodes {
|
||||||
return \esc_url( \get_permalink( $post->ID ) );
|
return \esc_url( \get_permalink( $post->ID ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'blank' === $atts['type'] ) {
|
|
||||||
return \sprintf( '<a href="%1$s" target="_blank">%1$s</a>', \esc_url( \get_permalink( $post->ID ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return \sprintf( '<a href="%1$s">%1$s</a>', \esc_url( \get_permalink( $post->ID ) ) );
|
return \sprintf( '<a href="%1$s">%1$s</a>', \esc_url( \get_permalink( $post->ID ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,10 +263,6 @@ class Shortcodes {
|
||||||
return \esc_url( \wp_get_shortlink( $post->ID ) );
|
return \esc_url( \wp_get_shortlink( $post->ID ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'blank' === $atts['type'] ) {
|
|
||||||
return \sprintf( '<a href="%1$s" target="_blank">%1$s</a>', \esc_url( \wp_get_shortlink( $post->ID ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return \sprintf( '<a href="%1$s">%1$s</a>', \esc_url( \wp_get_shortlink( $post->ID ) ) );
|
return \sprintf( '<a href="%1$s">%1$s</a>', \esc_url( \wp_get_shortlink( $post->ID ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@ $registered_sizes .= '.';
|
||||||
<li><code>[ap_title]</code> - <?php \esc_html_e( 'The post\'s title.', 'activitypub' ); ?></li>
|
<li><code>[ap_title]</code> - <?php \esc_html_e( 'The post\'s title.', 'activitypub' ); ?></li>
|
||||||
<li><code>[ap_content]</code> - <?php \esc_html_e( 'The post\'s content.', 'activitypub' ); ?></li>
|
<li><code>[ap_content]</code> - <?php \esc_html_e( 'The post\'s content.', 'activitypub' ); ?></li>
|
||||||
<li><code>[ap_excerpt <i>lenght=nnn</i>]</code> - <?php \esc_html_e( 'The post\'s excerpt (default 400 chars). length parameter is optional.', 'activitypub' ); ?></li>
|
<li><code>[ap_excerpt <i>lenght=nnn</i>]</code> - <?php \esc_html_e( 'The post\'s excerpt (default 400 chars). length parameter is optional.', 'activitypub' ); ?></li>
|
||||||
<li><code>[ap_permalink <i>type=xxx</i>]</code> - <?php \esc_html_e( 'The post\'s permalink. 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' ); ?></li>
|
<li><code>[ap_permalink <i>type=xxx</i>]</code> - <?php \esc_html_e( 'The post\'s permalink. Type can be either: raw (the raw url, no escaping), esc (the html escaped url), html (default, an a tag to the url).', 'activitypub' ); ?></li>
|
||||||
<?php // translators: ?>
|
<?php // translators: ?>
|
||||||
<li><code>[ap_shortlink <i>type=xxx</i>]</code> - <?php echo \wp_kses( \__( 'The post\'s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>, 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' ); ?></li>
|
<li><code>[ap_shortlink <i>type=xxx</i>]</code> - <?php echo \wp_kses( \__( 'The post\'s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>, 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' ); ?></li>
|
||||||
<li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post\'s tags as hashtags.', 'activitypub' ); ?></li>
|
<li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post\'s tags as hashtags.', 'activitypub' ); ?></li>
|
||||||
<li><code>[ap_hashcats]</code> - <?php \esc_html_e( 'The post\'s categories as hashtags.', 'activitypub' ); ?></li>
|
<li><code>[ap_hashcats]</code> - <?php \esc_html_e( 'The post\'s categories as hashtags.', 'activitypub' ); ?></li>
|
||||||
<li><code>[ap_image <i>size=xxx</i>]</code> - <?php \esc_html_e( 'The URL for the post\'s featured image, defaults to full size. The size attribute can be any of the following: ', 'activitypub' ); echo esc_html( $registered_sizes ); ?></li>
|
<li><code>[ap_image <i>size=xxx</i>]</code> - <?php \esc_html_e( 'The URL for the post\'s featured image, defaults to full size. The size attribute can be any of the following: ', 'activitypub' ); echo esc_html( $registered_sizes ); ?></li>
|
||||||
|
|
Loading…
Reference in a new issue