1
0
mirror of https://git.feneas.org/mediaformat/fediembedi synced 2024-12-21 17:53:56 +01:00

Merge branch 'hotfix/v0.11.1'

This commit is contained in:
Django Doucet 2021-01-14 23:09:59 -05:00
commit 4fc8038a57
10 changed files with 42 additions and 29 deletions

View File

@ -17,13 +17,13 @@ class FediEmbedi_Mastodon extends WP_Widget {
}
/**
* Outputs the content for the current Search widget instance.
* Outputs the content for the current Mastodon widget instance.
*
* @since 2.8.0
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current Search widget instance.
* @param array $instance Settings for the current Mastodon widget instance.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
@ -40,7 +40,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : '';
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : '';
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : '';
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$limit = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
echo $args['before_widget'];
@ -49,7 +49,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
};
//getStatus from remote instance
$status = $client->getStatus($only_media, $pinned, $exclude_replies, null, null, null, $number, $exclude_reblogs);
$status = $client->getStatus($only_media, $pinned, $exclude_replies, null, null, null, $limit, $exclude_reblogs);
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>Mastodon</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
$account = $status[0]->account;
include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' );
@ -58,7 +58,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
}
/**
* Outputs the settings form for the Search widget.
* Outputs the settings form for the Mastodon widget.
*
* @since 2.8.0
*
@ -72,7 +72,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : NULL;
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : NULL;
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : NULL;
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$limit = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
?>
@ -138,7 +138,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
</p>
<p>
<label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to display:' ); ?><br>
<input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" />
<input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $limit; ?>" size="3" />
<small>Max: 20</small>
</label>
</p>
@ -152,7 +152,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
}
/**
* Handles updating settings for the current Search widget instance.
* Handles updating settings for the current Mastodon widget instance.
*
* @since 2.8.0
*
@ -174,5 +174,4 @@ class FediEmbedi_Mastodon extends WP_Widget {
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -17,13 +17,13 @@ class FediEmbedi_PeerTube extends WP_Widget {
}
/**
* Outputs the content for the current Search widget instance.
* Outputs the content for the current PeerTube widget instance.
*
* @since 2.8.0
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current Search widget instance.
* @param array $instance Settings for the current PeerTube widget instance.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
@ -48,7 +48,7 @@ class FediEmbedi_PeerTube extends WP_Widget {
//getVideos from remote instance
$status = $client->getVideos($actor, $is_channel, $count, $nsfw);
if(WP_DEBUG_DISPLAY === true): echo '<details><summary>PeerTube</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>PeerTube</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
if(!is_null($is_channel)){
$account = $status->data[0]->channel;
} else {
@ -61,7 +61,7 @@ class FediEmbedi_PeerTube extends WP_Widget {
}
/**
* Outputs the settings form for the Search widget.
* Outputs the settings form for the PeerTube widget.
*
* @since 2.8.0
*
@ -149,7 +149,7 @@ class FediEmbedi_PeerTube extends WP_Widget {
}
/**
* Handles updating settings for the current Search widget instance.
* Handles updating settings for the current PeerTube widget instance.
*
* @since 2.8.0
*
@ -175,5 +175,4 @@ class FediEmbedi_PeerTube extends WP_Widget {
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -17,13 +17,13 @@ class FediEmbedi_Pixelfed extends WP_Widget {
}
/**
* Outputs the content for the current Search widget instance.
* Outputs the content for the current Pixelfed widget instance.
*
* @since 2.8.0
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current Search widget instance.
* @param array $instance Settings for the current Pixelfed widget instance.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
@ -61,7 +61,7 @@ class FediEmbedi_Pixelfed extends WP_Widget {
}
/**
* Outputs the settings form for the Search widget.
* Outputs the settings form for the Pixelfed widget.
*
* @since 2.8.0
*
@ -155,7 +155,7 @@ class FediEmbedi_Pixelfed extends WP_Widget {
}
/**
* Handles updating settings for the current Search widget instance.
* Handles updating settings for the current Pixelfed widget instance.
*
* @since 2.8.0
*
@ -177,5 +177,4 @@ class FediEmbedi_Pixelfed extends WP_Widget {
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -68,7 +68,7 @@ class WP_Widget_fediembedi extends WP_Widget {
case 'PeerTube':
//getVideos from remote instance
$status = $client->getVideos();
if(WP_DEBUG_DISPLAY === true): echo '<details><summary>'. $instance_type .'</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>'. $instance_type .'</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
break;
default:

View File

@ -4,7 +4,7 @@
* Plugin URI: https://git.feneas.org/mediaformat/fediembedi
* GitLab Plugin URI: https://git.feneas.org/mediaformat/fediembedi
* Description: Widgets and shortcodes to show your Fediverse profile timeline
* Version: 0.11.0
* Version: 0.11.1
* Author: mediaformat
* Author URI: https://mediaformat.org
* License: GPLv3
@ -170,6 +170,7 @@ class FediConfig
'limit' => 5,
'exclude_reblogs' => false,
'show_header' => true,
'height' => '100%',
), $atts, 'mastodon' );
//getStatus from remote instance
@ -199,11 +200,12 @@ class FediConfig
'limit' => 9,
'exclude_reblogs' => false,
'show_header' => true,
'height' => '100%',
), $atts, 'pixelfed' );
//getStatus from remote instance
$status = $client->getStatus($atts['only_media'], $atts['pinned'], $atts['exclude_replies'], null, null, null, $atts['limit'], $atts['exclude_reblogs']);
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>Mastodon</summary><pre>'; var_dump($client->getStatus($atts)); echo '</pre></details>'; endif;
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>Pixelfed</summary><pre>'; var_dump($client->getStatus($atts)); echo '</pre></details>'; endif;
$show_header = $atts['show_header'];
if($account = $status[0]->account){
ob_start();
@ -221,9 +223,14 @@ class FediConfig
'actor' => null,
'is_channel' => null,
'limit' => 9,
'nsfw' => null,
'show_header' => true,
'height' => '100%',
), $atts, 'peertube' );
$atts['instance'] = \esc_attr( $atts['instance'], 'https' );
$client = new \FediClient($atts['instance']);
//getVideos from remote instance
@ -234,10 +241,11 @@ class FediConfig
$account = $status->data[0]->account;
}
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>PeerTube</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
if(WP_DEBUG_DISPLAY === true): echo '<details><summary>PeerTube</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
$show_header = $atts['show_header'];
$height = $atts['height'];
ob_start();
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
include( plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
return ob_get_clean();
}

View File

@ -53,6 +53,10 @@ and redirected to your site with a secure token. Similar to how you would connec
## Changelog
### 0.11.1
* Bug fix: Shortcode limit attribute.
* Document: Shortcodes on options page.
### 0.11.0
* Feature: PeerTube widget NSFW option.
* Fix: PeerTube number of posts to display.

View File

@ -64,6 +64,10 @@ and redirected to your site with a secure token. Similar to how you would connec
== Changelog ==
= 0.11.1 =
* Bug fix: Shortcode limit attribute.
* Document: Shortcodes on options page.
= 0.11.0 =
* Feature: PeerTube widget NSFW option.
* Fix: PeerTube number of posts to display.

View File

@ -1,5 +1,5 @@
<!-- mastodon -->
<div class="scrollable fediembedi-mastodon" <?php if (!empty($height)) : echo 'style="height: $height;"'; endif; ?>>
<div class="fediembedi fediembedi-mastodon scrollable" <?php if (!empty($height)) : echo "style='height: $height;'"; endif; ?>>
<div role="feed">
<?php if($show_header): ?>
<div class="account-timeline__header">
@ -112,4 +112,4 @@
<?php } ?>
</div>
</div>
<?php
<?php

View File

@ -1,5 +1,5 @@
<!-- peertube -->
<div class="scrollable fediembedi-peertube" <?php if (!empty($height)) : echo 'style="height: $height;"'; endif; ?>>
<div class="fediembedi fediembedi-peertube scrollable" <?php if (!empty($height)) : echo "style='height: $height;'"; endif; ?>>
<div role="feed">
<?php if($show_header): ?>
<div class="peertube-timeline__header">

View File

@ -1,5 +1,5 @@
<!-- pixelfed -->
<div class="scrollable fediembedi-pixelfed" <?php if (!empty($height)) : echo 'style="height: $height;"'; endif; ?>>
<div class="fediembedi fediembedi-pixelfed scrollable" <?php if (!empty($height)) : echo "style='height: $height;'"; endif; ?>>
<div role="feed" class="embed-card pixelfed">
<div class="pixelfed-inner card status-card-embed card-md-rounded-0 border">
<?php if($show_header): ?>