diff --git a/assets/mastodon.css b/assets/mastodon.css index 342b2ee..1c3c81a 100644 --- a/assets/mastodon.css +++ b/assets/mastodon.css @@ -306,6 +306,12 @@ cursor: pointer; display: inline-block; } +.status__content span.invisible{ + display: none; +} +.status__content span.ellipsis:after{ + content: '\2026'; +} .status__content .media-gallery__item{ margin: 1em 0; } diff --git a/fediembedi-mastodon-widget.php b/fediembedi-mastodon-widget.php index 2770a0c..92ca0d0 100644 --- a/fediembedi-mastodon-widget.php +++ b/fediembedi-mastodon-widget.php @@ -43,8 +43,6 @@ class FediEmbedi_Mastodon extends WP_Widget { $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; $height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%'; - //if(WP_DEBUG_DISPLAY === true): echo '
'. $instance_type .'
'; var_dump($status); echo '
'; endif; - echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; @@ -52,8 +50,9 @@ class FediEmbedi_Mastodon extends WP_Widget { //getStatus from remote instance $status = $client->getStatus($only_media, $pinned, $exclude_replies, null, null, null, $number, $exclude_reblogs); + //if(WP_DEBUG_DISPLAY === true): echo '
Mastodon
'; var_dump($status); echo '
'; endif; $account = $status[0]->account; - include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' ); + include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' ); echo $args['after_widget']; } diff --git a/fediembedi-pixelfed-widget.php b/fediembedi-pixelfed-widget.php index 7ee8037..be88df9 100644 --- a/fediembedi-pixelfed-widget.php +++ b/fediembedi-pixelfed-widget.php @@ -33,6 +33,9 @@ class FediEmbedi_Pixelfed extends WP_Widget { $access_token = get_option('fediembedi-pixelfed-token'); $client = new \FediClient($instance_url, $access_token); $cred = $client->verify_credentials($access_token); + if (!$cred){ + return; + } //widget options $show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : ''; @@ -51,6 +54,7 @@ class FediEmbedi_Pixelfed extends WP_Widget { }; $status = $client->getStatus($only_media, $pinned, $exclude_replies, null, null, null, $number, $exclude_reblogs); + $account = $status[0]->account; include(plugin_dir_path(__FILE__) . 'templates/pixelfed.tpl.php' ); echo $args['after_widget']; diff --git a/fediembedi-settings-form.tpl.php b/fediembedi-settings-form.tpl.php index 9adac99..d232f64 100644 --- a/fediembedi-settings-form.tpl.php +++ b/fediembedi-settings-form.tpl.php @@ -12,7 +12,7 @@ define("FEDI_PXLFD_CONNECTED",isset($pixelfed_account) && $pixelfed_account !==
">

- +

Visit joinmastodon.org to find an instance.

@@ -39,7 +39,7 @@ define("FEDI_PXLFD_CONNECTED",isset($pixelfed_account) && $pixelfed_account !==
">

- +

Visit pixelfed.org/join to find an instance.

diff --git a/fediembedi.php b/fediembedi.php index 62d5f0b..6779b67 100644 --- a/fediembedi.php +++ b/fediembedi.php @@ -25,6 +25,7 @@ class FediConfig add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); add_action('admin_menu', array($this, 'configuration_page')); add_action('admin_notices', array($this, 'admin_notices')); + add_filter('fedi_emoji', array($this, 'convert_emoji'), 10, 2); add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'fediembedi_add_plugin_page_settings_link')); } @@ -150,6 +151,17 @@ class FediConfig register_widget( 'FediEmbedi_PeerTube' ); } + public function convert_emoji($string, $emojis){ + if(is_null($emojis) || !is_array($emojis)){ + return $string; + } + foreach($emojis as $emoji){ + $match = '/:' . $emoji->shortcode .':/'; + $string = preg_replace($match, "static_url}\">", $string); + } + return $string; + } + public function enqueue_styles($hook) { if( is_active_widget( false, false, 'mastodon') || is_active_widget( false, false, 'pixelfed') ) { diff --git a/templates/mastodon.tpl.php b/templates/mastodon.tpl.php index 2303b6d..630dd72 100644 --- a/templates/mastodon.tpl.php +++ b/templates/mastodon.tpl.php @@ -20,14 +20,14 @@

- display_name; ?> - url; ?> + display_name, $account->emojis); ?> + url; ?>

@@ -62,7 +62,7 @@
- reblog)): echo $statut->account->display_name; else: echo $statut->reblog->account->display_name; endif; ?> + reblog)): echo apply_filters('fedi_emoji', $statut->account->display_name, $statut->account->emojis); else: echo apply_filters('fedi_emoji', $statut->reblog->account->display_name, $statut->reblog->account->emojis); endif; ?>
reblog; endif; if(empty($statut->spoiler_text)): - echo $statut->content; + echo apply_filters('fedi_emoji', $statut->content, $statut->emojis); if(!is_null($statut->card)): ?>
@@ -82,7 +82,7 @@
' . $statut->spoiler_text . ''. $statut->content . ''; + else: echo '
' . apply_filters('fedi_emoji', $statut->spoiler_text, $statut->emojis) . ''. apply_filters('fedi_emoji', $statut->content, $statut->emojis) . '
'; endif; if(!empty($statut->media_attachments)): foreach ($statut->media_attachments as $attachment) { diff --git a/templates/pixelfed.tpl.php b/templates/pixelfed.tpl.php index 685cfb8..e278b40 100644 --- a/templates/pixelfed.tpl.php +++ b/templates/pixelfed.tpl.php @@ -4,9 +4,9 @@
-