diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index f1dd53d..ea803f8 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -214,17 +214,13 @@ class Shortcodes { $atts = shortcode_atts( array( - 'type' => 'html', + 'type' => 'url', ), $atts, $tag ); - if ( 'raw' === $atts['type'] ) { - return \get_permalink( $post->ID ); - } - - if ( 'esc' === $atts['type'] ) { + if ( 'url' === $atts['type'] ) { return \esc_url( \get_permalink( $post->ID ) ); } @@ -249,17 +245,13 @@ class Shortcodes { $atts = shortcode_atts( array( - 'type' => 'html', + 'type' => 'url', ), $atts, $tag ); - if ( 'raw' === $atts['type'] ) { - return \wp_get_shortlink( $post->ID ); - } - - if ( 'esc' === $atts['type'] ) { + if ( 'url' === $atts['type'] ) { return \esc_url( \wp_get_shortlink( $post->ID ) ); } @@ -306,7 +298,7 @@ class Shortcodes { return ''; } - return $image; + return \esc_url( $image ); } /** @@ -387,7 +379,7 @@ class Shortcodes { return ''; } - return $url; + return \esc_url( $url ); } /** @@ -400,7 +392,7 @@ class Shortcodes { * @return string */ public static function blogurl( $atts, $content, $tag ) { - return \get_bloginfo( 'url' ); + return \esc_url( \get_bloginfo( 'url' ) ); } /** diff --git a/includes/model/class-post.php b/includes/model/class-post.php index 1eccf4d..cdf5d51 100644 --- a/includes/model/class-post.php +++ b/includes/model/class-post.php @@ -306,8 +306,8 @@ class Post { $content = \str_replace( '%title%', '[ap_title]', $content ); $content = \str_replace( '%excerpt%', '[ap_excerpt]', $content ); $content = \str_replace( '%content%', '[ap_content]', $content ); - $content = \str_replace( '%permalink%', '[ap_permalink]', $content ); - $content = \str_replace( '%shortlink%', '[ap_shortlink]', $content ); + $content = \str_replace( '%permalink%', '[ap_permalink type="html"]', $content ); + $content = \str_replace( '%shortlink%', '[ap_shortlink type="html"]', $content ); $content = \str_replace( '%hashtags%', '[ap_hashtags]', $content ); $content = \str_replace( '%tags%', '[ap_hashtags]', $content ); diff --git a/readme.txt b/readme.txt index 7ef54de..bf786ca 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,7 @@ Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github = v.next = * Add configuration item for number of images to attach. props [@mexon](https://github.com/mexon) +* Use shortcodes instead of custom templates, to setup the Activity Post-Content. props [@toolstack](https://github.com/toolstack) = 0.15.0 = diff --git a/templates/settings.php b/templates/settings.php index 8761179..d50a68a 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -64,9 +64,9 @@
  • [ap_title] -
  • [ap_content] -
  • [ap_excerpt lenght=400] -
  • -
  • [ap_permalink type=xxx] -
  • +
  • [ap_permalink type=url] -
  • -
  • [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_shortlink type=url] - Hum, to prettify the Shortlinks. Type can be either: url (default, the escaped url), html (an a tag to the url).', 'activitypub' ), 'default' ); ?>
  • [ap_hashtags] -
  • [ap_hashcats] -
  • [ap_image type=full] -