Compare commits
28 Commits
Author | SHA1 | Date |
---|---|---|
|
4fc8038a57 | |
|
59ae0f7b76 | |
|
b6fef90e91 | |
|
6be91f1c1c | |
|
86fbfe5457 | |
|
eb8965e25b | |
|
ca8be5e49a | |
|
fe58f3c73f | |
|
db2bb224c1 | |
|
f5b4195489 | |
|
aa239d24bc | |
|
a605a8cc46 | |
|
50fe87fb15 | |
|
9eb8406003 | |
|
c706bd7e25 | |
|
9a770d36b1 | |
|
875c6baba1 | |
|
c385154ff8 | |
|
497c851ee3 | |
|
98d4c111c2 | |
|
a2867570e5 | |
|
7a6c7d479b | |
|
205b6085f0 | |
|
48130f31fe | |
|
201f39ae6f | |
|
2a15545baa | |
|
7f9236f1ab | |
|
66c2d1f249 |
|
@ -20,6 +20,9 @@
|
||||||
-webkit-animation: fade .15s linear;
|
-webkit-animation: fade .15s linear;
|
||||||
animation: fade .15s linear;
|
animation: fade .15s linear;
|
||||||
}
|
}
|
||||||
|
.status .status__content p {
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
.status__prepend {
|
.status__prepend {
|
||||||
margin-left: 68px;
|
margin-left: 68px;
|
||||||
color: #444b5d;
|
color: #444b5d;
|
||||||
|
@ -83,8 +86,9 @@
|
||||||
}
|
}
|
||||||
.account__header__tabs__buttons .button {
|
.account__header__tabs__buttons .button {
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
color: #fff;
|
border: 1px solid;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
color: #fff;
|
||||||
padding: 0px 16px;
|
padding: 0px 16px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
line-height: 36px;
|
line-height: 36px;
|
||||||
|
@ -92,10 +96,11 @@
|
||||||
.account__header__tabs__name {
|
.account__header__tabs__name {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
.account__header__tabs__name h1 {
|
.account__header__bar .account__header__tabs__name h1 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
font-family: inherit;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -121,6 +126,9 @@
|
||||||
padding: 20px 15px 5px;
|
padding: 20px 15px 5px;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
.account__header__bio .account__header__content p {
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
.account__header__content {
|
.account__header__content {
|
||||||
color: #282c37;
|
color: #282c37;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
@ -76,7 +76,7 @@ class FediClient
|
||||||
|
|
||||||
$response = $this->_get('/api/v1/accounts/verify_credentials', null, $headers);
|
$response = $this->_get('/api/v1/accounts/verify_credentials', null, $headers);
|
||||||
|
|
||||||
if(property_exists($response, 'id')){
|
if(isset($response->id)){
|
||||||
$this->setStatic($response->id);
|
$this->setStatic($response->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,19 +133,33 @@ class FediClient
|
||||||
'exclude_reblogs' => $reblogs
|
'exclude_reblogs' => $reblogs
|
||||||
));
|
));
|
||||||
|
|
||||||
$response = $this->_get("/api/v1/accounts/{$account_id}/statuses?{$query}", null, $headers);
|
$response = $this->_get("/api/v1/accounts/{$account_id}/statuses?{$query}", null, null);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVideos($account_id, $is_channel) {
|
public function getVideos($account_id, $is_channel, $count, $nsfw = false) {
|
||||||
|
//https://docs.joinpeertube.org/api-rest-reference.html#tag/Video
|
||||||
$headers = array();
|
$headers = array();
|
||||||
|
|
||||||
|
$query = http_build_query(array(
|
||||||
|
//'categoryOneOf' => $categoryID,
|
||||||
|
'count' => $count,
|
||||||
|
//'filter' => $filter,
|
||||||
|
//'languageOneOf' => $lang,
|
||||||
|
//'licenceOneOf' => $licence,
|
||||||
|
'nsfw' => $nsfw,
|
||||||
|
//'skipCount' => $skipCount,
|
||||||
|
//'sort' => $sort,
|
||||||
|
//'start' => $offset,
|
||||||
|
//'tagsAllOf' => $tagsAllOf,//videos where all tags are present
|
||||||
|
//'tagsOneOf' => $tags
|
||||||
|
));
|
||||||
|
|
||||||
if(!is_null($is_channel)){
|
if(!is_null($is_channel)){
|
||||||
$response = $this->_get("/api/v1/video-channels/{$account_id}/videos", null, $headers);
|
$response = $this->_get("/api/v1/video-channels/{$account_id}/videos?{$query}", null, $headers);
|
||||||
} else {
|
} else {
|
||||||
$response = $this->_get("/api/v1/accounts/{$account_id}/videos", null, $headers);
|
$response = $this->_get("/api/v1/accounts/{$account_id}/videos?{$query}", null, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
@ -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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param array $args Display arguments including 'before_title', 'after_title',
|
* @param array $args Display arguments including 'before_title', 'after_title',
|
||||||
* 'before_widget', and 'after_widget'.
|
* '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 ) {
|
public function widget( $args, $instance ) {
|
||||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
||||||
|
@ -40,7 +40,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
|
||||||
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : '';
|
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : '';
|
||||||
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : '';
|
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : '';
|
||||||
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : '';
|
$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%';
|
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
|
||||||
|
|
||||||
echo $args['before_widget'];
|
echo $args['before_widget'];
|
||||||
|
@ -49,7 +49,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
//getStatus from remote instance
|
//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;
|
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>Mastodon</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
|
||||||
$account = $status[0]->account;
|
$account = $status[0]->account;
|
||||||
include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' );
|
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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
|
@ -72,7 +72,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
|
||||||
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : NULL;
|
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : NULL;
|
||||||
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : NULL;
|
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : NULL;
|
||||||
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : 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'] ) : '';
|
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -138,7 +138,7 @@ class FediEmbedi_Mastodon extends WP_Widget {
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to display:' ); ?><br>
|
<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>
|
<small>Max: 20</small>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
|
@ -174,5 +174,4 @@ class FediEmbedi_Mastodon extends WP_Widget {
|
||||||
$instance['height'] = sanitize_text_field( $new_instance['height'] );
|
$instance['height'] = sanitize_text_field( $new_instance['height'] );
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param array $args Display arguments including 'before_title', 'after_title',
|
* @param array $args Display arguments including 'before_title', 'after_title',
|
||||||
* 'before_widget', and 'after_widget'.
|
* '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 ) {
|
public function widget( $args, $instance ) {
|
||||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
||||||
|
@ -37,7 +37,8 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
|
|
||||||
//widget options
|
//widget options
|
||||||
$show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : null;
|
$show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : null;
|
||||||
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
|
$count = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
|
||||||
|
$nsfw = isset( $instance['nsfw'] ) ? $instance['nsfw'] : null;
|
||||||
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
|
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
|
||||||
|
|
||||||
echo $args['before_widget'];
|
echo $args['before_widget'];
|
||||||
|
@ -46,20 +47,21 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
//getVideos from remote instance
|
//getVideos from remote instance
|
||||||
$status = $client->getVideos($actor, $is_channel);
|
$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(!is_null($is_channel)){
|
if(!is_null($is_channel)){
|
||||||
$account = $status->data[0]->channel;
|
$account = $status->data[0]->channel;
|
||||||
} else {
|
} else {
|
||||||
$account = $status->data[0]->account;
|
$account = $status->data[0]->account;
|
||||||
}
|
}
|
||||||
|
|
||||||
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
|
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
|
||||||
|
|
||||||
echo $args['after_widget'];
|
echo $args['after_widget'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the settings form for the Search widget.
|
* Outputs the settings form for the PeerTube widget.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
|
@ -79,6 +81,7 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : NULL;
|
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : NULL;
|
||||||
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : NULL;
|
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : NULL;
|
||||||
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
|
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
|
||||||
|
$nsfw = isset( $instance['nsfw'] ) ? $instance['nsfw'] : false;
|
||||||
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
|
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -98,6 +101,17 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
<?php checked( $instance[ 'channel' ], '1' ); ?>
|
||||||
|
id="<?php echo $this->get_field_id( 'channel' ); ?>"
|
||||||
|
name="<?php echo $this->get_field_name('channel'); ?>"
|
||||||
|
value="1"
|
||||||
|
/><?php _e( 'This account is a Channel (not a user)', 'fediembedi' ); ?>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
@ -106,17 +120,6 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
name="<?php echo $this->get_field_name('show_header'); ?>"
|
name="<?php echo $this->get_field_name('show_header'); ?>"
|
||||||
value="1"
|
value="1"
|
||||||
/><?php _e( 'Show header', 'fediembedi' ); ?>
|
/><?php _e( 'Show header', 'fediembedi' ); ?>
|
||||||
</label>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
<?php checked( $instance[ 'channel' ], '1' ); ?>
|
|
||||||
id="<?php echo $this->get_field_id( 'channel' ); ?>"
|
|
||||||
name="<?php echo $this->get_field_name('channel'); ?>"
|
|
||||||
value="1"
|
|
||||||
/><?php _e( 'Is this account a Channel?', 'fediembedi' ); ?>
|
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
@ -126,6 +129,17 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
<?php checked( $instance[ 'nsfw' ], '0' ); ?>
|
||||||
|
id="<?php echo $this->get_field_id( 'nsfw' ); ?>"
|
||||||
|
name="<?php echo $this->get_field_name('nsfw'); ?>"
|
||||||
|
value="0"
|
||||||
|
/><?php _e( 'Show NSFW videos?', 'fediembedi' ); ?>
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e( 'Widget height:' ); ?><br>
|
<label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e( 'Widget height:' ); ?><br>
|
||||||
<input class="" id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" type="text" value="<?php echo $height; ?>" placeholder="500px" size="5" />
|
<input class="" id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" type="text" value="<?php echo $height; ?>" placeholder="500px" size="5" />
|
||||||
<small><?php _e( 'Default: 100%', 'fediembedi' ); ?></small>
|
<small><?php _e( 'Default: 100%', 'fediembedi' ); ?></small>
|
||||||
|
@ -135,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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
|
@ -157,8 +171,8 @@ class FediEmbedi_PeerTube extends WP_Widget {
|
||||||
$instance['exclude_replies'] = $new_instance['exclude_replies'];
|
$instance['exclude_replies'] = $new_instance['exclude_replies'];
|
||||||
$instance['exclude_reblogs'] = $new_instance['exclude_reblogs'];
|
$instance['exclude_reblogs'] = $new_instance['exclude_reblogs'];
|
||||||
$instance['number'] = (int) $new_instance['number'];
|
$instance['number'] = (int) $new_instance['number'];
|
||||||
|
$instance['nsfw'] = $new_instance['nsfw'];
|
||||||
$instance['height'] = sanitize_text_field( $new_instance['height'] );
|
$instance['height'] = sanitize_text_field( $new_instance['height'] );
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param array $args Display arguments including 'before_title', 'after_title',
|
* @param array $args Display arguments including 'before_title', 'after_title',
|
||||||
* 'before_widget', and 'after_widget'.
|
* '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 ) {
|
public function widget( $args, $instance ) {
|
||||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
$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
|
* @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
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
|
@ -177,5 +177,4 @@ class FediEmbedi_Pixelfed extends WP_Widget {
|
||||||
$instance['height'] = sanitize_text_field( $new_instance['height'] );
|
$instance['height'] = sanitize_text_field( $new_instance['height'] );
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ class WP_Widget_fediembedi extends WP_Widget {
|
||||||
case 'PeerTube':
|
case 'PeerTube':
|
||||||
//getVideos from remote instance
|
//getVideos from remote instance
|
||||||
$status = $client->getVideos();
|
$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' );
|
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
127
fediembedi.php
127
fediembedi.php
|
@ -2,15 +2,15 @@
|
||||||
/**
|
/**
|
||||||
* Plugin Name: FediEmbedi
|
* Plugin Name: FediEmbedi
|
||||||
* Plugin URI: https://git.feneas.org/mediaformat/fediembedi
|
* Plugin URI: https://git.feneas.org/mediaformat/fediembedi
|
||||||
* Description: A widget to show your Fediverse profile timeline
|
* GitLab Plugin URI: https://git.feneas.org/mediaformat/fediembedi
|
||||||
* Version: 0.9.3
|
* Description: Widgets and shortcodes to show your Fediverse profile timeline
|
||||||
|
* Version: 0.11.1
|
||||||
* Author: mediaformat
|
* Author: mediaformat
|
||||||
* Author URI: https://mediaformat.org
|
* Author URI: https://mediaformat.org
|
||||||
* License: GPLv3
|
* License: GPLv3
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
* Text Domain: fediembedi
|
* Text Domain: fediembedi
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
* Github Plugin URI: https://github.com/mediaformat/fediembedi
|
|
||||||
*/
|
*/
|
||||||
namespace FediEmbedi;
|
namespace FediEmbedi;
|
||||||
require_once 'fediembedi-client.php';
|
require_once 'fediembedi-client.php';
|
||||||
|
@ -21,6 +21,9 @@ class FediConfig
|
||||||
{
|
{
|
||||||
add_action('plugins_loaded', array($this, 'init'));
|
add_action('plugins_loaded', array($this, 'init'));
|
||||||
add_action('widgets_init', array($this, 'fediembedi_widget'));
|
add_action('widgets_init', array($this, 'fediembedi_widget'));
|
||||||
|
add_shortcode('mastodon', array($this, 'mastodon_shortcode'));
|
||||||
|
add_shortcode('pixelfed', array($this, 'pixelfed_shortcode'));
|
||||||
|
add_shortcode('peertube', array($this, 'peertube_shortcode'));
|
||||||
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
|
||||||
add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
|
add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));
|
||||||
add_action('admin_menu', array($this, 'configuration_page'));
|
add_action('admin_menu', array($this, 'configuration_page'));
|
||||||
|
@ -101,13 +104,13 @@ class FediConfig
|
||||||
} else {
|
} else {
|
||||||
switch ($instance_type) {
|
switch ($instance_type) {
|
||||||
case 'mastodon':
|
case 'mastodon':
|
||||||
update_option('fediembedi-mastodon-client-id', '');
|
update_option('fediembedi-mastodon-client-id', $client_id);//
|
||||||
update_option('fediembedi-mastodon-client-secret', '');
|
update_option('fediembedi-mastodon-client-secret', $client_secret);//
|
||||||
update_option('fediembedi-mastodon-token', $token->access_token);
|
update_option('fediembedi-mastodon-token', $token->access_token);
|
||||||
break;
|
break;
|
||||||
case 'pixelfed':
|
case 'pixelfed':
|
||||||
update_option('fediembedi-pixelfed-client-id', '');
|
update_option('fediembedi-pixelfed-client-id', $client_id);//
|
||||||
update_option('fediembedi-pixelfed-client-secret', '');
|
update_option('fediembedi-pixelfed-client-secret', $client_secret);//
|
||||||
update_option('fediembedi-pixelfed-token', $token->access_token);
|
update_option('fediembedi-pixelfed-token', $token->access_token);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +128,6 @@ class FediConfig
|
||||||
|
|
||||||
$mastodon_token = get_option('fediembedi-mastodon-token');
|
$mastodon_token = get_option('fediembedi-mastodon-token');
|
||||||
$pixelfed_token = get_option('fediembedi-pixelfed-token');
|
$pixelfed_token = get_option('fediembedi-pixelfed-token');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -151,6 +153,105 @@ class FediConfig
|
||||||
register_widget( 'FediEmbedi_PeerTube' );
|
register_widget( 'FediEmbedi_PeerTube' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function mastodon_shortcode($atts){
|
||||||
|
//fedi instance
|
||||||
|
$fedi_instance = get_option('fediembedi-mastodon-instance');
|
||||||
|
$access_token = get_option('fediembedi-mastodon-token');
|
||||||
|
$client = new \FediClient($fedi_instance, $access_token);
|
||||||
|
$cred = $client->verify_credentials($access_token);
|
||||||
|
|
||||||
|
$atts = shortcode_atts( array(
|
||||||
|
'only_media' => false,
|
||||||
|
'pinned' => false,
|
||||||
|
'exclude_replies' => false,
|
||||||
|
'max_id' => null,
|
||||||
|
'since_id' => null,
|
||||||
|
'min_id' => null,
|
||||||
|
'limit' => 5,
|
||||||
|
'exclude_reblogs' => false,
|
||||||
|
'show_header' => true,
|
||||||
|
'height' => '100%',
|
||||||
|
), $atts, 'mastodon' );
|
||||||
|
|
||||||
|
//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($status); echo '</pre></details>'; endif;
|
||||||
|
$show_header = $atts['show_header'];
|
||||||
|
$account = $status[0]->account;
|
||||||
|
ob_start();
|
||||||
|
include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' );
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pixelfed_shortcode($atts){
|
||||||
|
//fedi instance
|
||||||
|
$fedi_instance = get_option('fediembedi-pixelfed-instance');
|
||||||
|
$access_token = get_option('fediembedi-pixelfed-token');
|
||||||
|
$client = new \FediClient($fedi_instance, $access_token);
|
||||||
|
$cred = $client->verify_credentials($access_token);
|
||||||
|
|
||||||
|
$atts = shortcode_atts( array(
|
||||||
|
'only_media' => false,
|
||||||
|
'pinned' => false,
|
||||||
|
'exclude_replies' => false,
|
||||||
|
'max_id' => null,
|
||||||
|
'since_id' => null,
|
||||||
|
'min_id' => null,
|
||||||
|
'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>Pixelfed</summary><pre>'; var_dump($client->getStatus($atts)); echo '</pre></details>'; endif;
|
||||||
|
$show_header = $atts['show_header'];
|
||||||
|
if($account = $status[0]->account){
|
||||||
|
ob_start();
|
||||||
|
include(plugin_dir_path(__FILE__) . 'templates/pixelfed.tpl.php' );
|
||||||
|
return ob_get_clean();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function peertube_shortcode($atts){
|
||||||
|
|
||||||
|
$atts = shortcode_atts( array(
|
||||||
|
'instance' => null,
|
||||||
|
'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
|
||||||
|
$status = $client->getVideos($atts['actor'], $atts['is_channel'], $atts['limit'], $atts['nsfw'] );
|
||||||
|
if(!is_null($atts['is_channel'])){
|
||||||
|
$account = $status->data[0]->channel;
|
||||||
|
} else {
|
||||||
|
$account = $status->data[0]->account;
|
||||||
|
}
|
||||||
|
|
||||||
|
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' );
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* convert_emoji
|
||||||
|
*/
|
||||||
public function convert_emoji($string, $emojis){
|
public function convert_emoji($string, $emojis){
|
||||||
if(is_null($emojis) || !is_array($emojis)){
|
if(is_null($emojis) || !is_array($emojis)){
|
||||||
return $string;
|
return $string;
|
||||||
|
@ -164,19 +265,19 @@ class FediConfig
|
||||||
|
|
||||||
public function enqueue_styles($hook)
|
public function enqueue_styles($hook)
|
||||||
{
|
{
|
||||||
if( is_active_widget( false, false, 'mastodon') || is_active_widget( false, false, 'pixelfed') ) {
|
global $post;
|
||||||
|
if( is_active_widget( false, false, 'mastodon') || is_active_widget( false, false, 'pixelfed') || ( is_a( $post, 'WP_Post' ) && ( has_shortcode( $post->post_content, 'mastodon') || has_shortcode( $post->post_content, 'pixelfed') ) ) ) {
|
||||||
wp_enqueue_script( 'resize-sensor', plugin_dir_url( __FILE__ ) . 'assets/ResizeSensor.js', array(), 'css-element-queries-1.2.2' );
|
wp_enqueue_script( 'resize-sensor', plugin_dir_url( __FILE__ ) . 'assets/ResizeSensor.js', array(), 'css-element-queries-1.2.2' );
|
||||||
wp_enqueue_script( 'element-queries', plugin_dir_url( __FILE__ ) . 'assets/ElementQueries.js', array('resize-sensor'), 'css-element-queries-1.2.2' );
|
wp_enqueue_script( 'element-queries', plugin_dir_url( __FILE__ ) . 'assets/ElementQueries.js', array('resize-sensor'), 'css-element-queries-1.2.2' );
|
||||||
|
|
||||||
}
|
}
|
||||||
if( is_active_widget( false, false, 'mastodon') ) {
|
if( is_active_widget( false, false, 'mastodon') || ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'mastodon') ) ) {
|
||||||
wp_enqueue_style( 'mastodon', plugin_dir_url( __FILE__ ) . 'assets/mastodon.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/mastodon.css') );
|
wp_enqueue_style( 'mastodon', plugin_dir_url( __FILE__ ) . 'assets/mastodon.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/mastodon.css') );
|
||||||
}
|
}
|
||||||
if( is_active_widget( false, false, 'pixelfed') ) {
|
if( is_active_widget( false, false, 'pixelfed') || ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'pixelfed') ) ) {
|
||||||
wp_enqueue_style( 'bootstrap', plugin_dir_url( __FILE__ ) . 'assets/bootstrap/css/bootstrap.min.css', array(), '4.4.1' );
|
wp_enqueue_style( 'bootstrap', plugin_dir_url( __FILE__ ) . 'assets/bootstrap/css/bootstrap.min.css', array(), '4.4.1' );
|
||||||
wp_enqueue_style( 'pixelfed', plugin_dir_url( __FILE__ ) . 'assets/pixelfed.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/pixelfed.css') );
|
wp_enqueue_style( 'pixelfed', plugin_dir_url( __FILE__ ) . 'assets/pixelfed.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/pixelfed.css') );
|
||||||
}
|
}
|
||||||
if( is_active_widget( false, false, 'peertube') ) {
|
if( is_active_widget( false, false, 'peertube') || ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'peertube') ) ) {
|
||||||
wp_enqueue_style( 'peertube', plugin_dir_url( __FILE__ ) . 'assets/peertube.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/mastodon.css') );
|
wp_enqueue_style( 'peertube', plugin_dir_url( __FILE__ ) . 'assets/peertube.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/mastodon.css') );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
29
readme.md
29
readme.md
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
>Display your Fediverse timeline in a widget
|
>Display your Fediverse timeline in a widget
|
||||||
|
|
||||||
FediEmbedi will display your Mastodon, Pleroma, or Pixelfed timeline in a widget, with various display options.
|
FediEmbedi will display your Mastodon, Pleroma, Pixelfed, PeerTube timeline with various display options.
|
||||||
|
|
||||||
|
### How to use shortcodes
|
||||||
|
* `[mastodon exclude_reblogs="true"]`
|
||||||
|
* `[pixelfed limit="6"]`
|
||||||
|
* `[peertube instance="https://peertube.social" actor="channel_name" is_channel="true"]`
|
||||||
|
|
||||||
### Currently supported software
|
### Currently supported software
|
||||||
* [Mastodon](http://joinmastodon.org/)
|
* [Mastodon](http://joinmastodon.org/)
|
||||||
|
@ -48,6 +53,28 @@ and redirected to your site with a secure token. Similar to how you would connec
|
||||||
|
|
||||||
## Changelog
|
## 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.
|
||||||
|
* Fix: connection issues.
|
||||||
|
* Fix: Template issues.
|
||||||
|
|
||||||
|
### 0.10.5
|
||||||
|
* Bug fix: Template issues.
|
||||||
|
|
||||||
|
### 0.10.4
|
||||||
|
* Bug fix: Embed included in post edit screen, causing post save issues.
|
||||||
|
|
||||||
|
### 0.10.3
|
||||||
|
* Security fix: statuses with visibility marked unlisted, private, and direct could be displayed publicly
|
||||||
|
|
||||||
|
### 0.10.0
|
||||||
|
* Service shortcodes
|
||||||
|
|
||||||
### 0.9.0
|
### 0.9.0
|
||||||
* Emoji support
|
* Emoji support
|
||||||
|
|
||||||
|
|
31
readme.txt
31
readme.txt
|
@ -1,7 +1,7 @@
|
||||||
=== Plugin Name ===
|
=== Plugin Name ===
|
||||||
Contributors: dj_angola
|
Contributors: dj_angola
|
||||||
Donate link: https://paypal.me/MediaFormat
|
Donate link: https://paypal.me/MediaFormat
|
||||||
Tags: mastodon, pixelfed, fediverse, activitypub, widget
|
Tags: mastodon, pixelfed, fediverse, activitypub, widget, shortcode
|
||||||
Requires at least: 5.1
|
Requires at least: 5.1
|
||||||
Tested up to: 5.3.2
|
Tested up to: 5.3.2
|
||||||
Requires PHP: 7.2
|
Requires PHP: 7.2
|
||||||
|
@ -15,7 +15,12 @@ Display your Fediverse timeline in a widget
|
||||||
|
|
||||||
> FediEmbedi is beta software.
|
> FediEmbedi is beta software.
|
||||||
|
|
||||||
FediEmbedi will display your Mastodon, Pleroma, or Pixelfed timeline in a widget, with various display options.
|
FediEmbedi will display your Mastodon, Pleroma, Pixelfed, PeerTube timeline with various display options.
|
||||||
|
|
||||||
|
= How to use shortcodes =
|
||||||
|
* `[mastodon exclude_reblogs="true"]`
|
||||||
|
* `[pixelfed limit="6"]`
|
||||||
|
* `[peertube instance="https://peertube.social" actor="channel_name" is_channel="true"]`
|
||||||
|
|
||||||
= Currently supported software =
|
= Currently supported software =
|
||||||
* [Mastodon](http://joinmastodon.org/)
|
* [Mastodon](http://joinmastodon.org/)
|
||||||
|
@ -59,6 +64,28 @@ and redirected to your site with a secure token. Similar to how you would connec
|
||||||
|
|
||||||
== Changelog ==
|
== 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.
|
||||||
|
* Fix: connection issues.
|
||||||
|
* Fix: Template issues.
|
||||||
|
|
||||||
|
= 0.10.5 =
|
||||||
|
* Bug fix: Template issues.
|
||||||
|
|
||||||
|
= 0.10.4 =
|
||||||
|
* Bug fix: Embed included in post edit screen, causing post save issues
|
||||||
|
|
||||||
|
= 0.10.3 =
|
||||||
|
* Security fix: statuses with visibility marked unlisted, private, and direct could be displayed publicly
|
||||||
|
|
||||||
|
= 0.10.0 =
|
||||||
|
* Service shortcodes
|
||||||
|
|
||||||
= 0.9.0 =
|
= 0.9.0 =
|
||||||
* Emoji support
|
* Emoji support
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- mastodon -->
|
<!-- mastodon -->
|
||||||
<div class="scrollable" style="height: <?php echo $height; ?>;">
|
<div class="fediembedi fediembedi-mastodon scrollable" <?php if (!empty($height)) : echo "style='height: $height;'"; endif; ?>>
|
||||||
<div role="feed">
|
<div role="feed">
|
||||||
<?php if($show_header): ?>
|
<?php if($show_header): ?>
|
||||||
<div class="account-timeline__header">
|
<div class="account-timeline__header">
|
||||||
|
@ -62,7 +62,16 @@
|
||||||
<div class="status__avatar">
|
<div class="status__avatar">
|
||||||
<div class="account__avatar" style="background-image: url(<?php if(is_null($statut->reblog)): echo $statut->account->avatar; else: echo $statut->reblog->account->avatar; endif; ?>); background-size: 40px; width: 40px; height: 40px;"></div>
|
<div class="account__avatar" style="background-image: url(<?php if(is_null($statut->reblog)): echo $statut->account->avatar; else: echo $statut->reblog->account->avatar; endif; ?>); background-size: 40px; width: 40px; height: 40px;"></div>
|
||||||
</div>
|
</div>
|
||||||
<span class="display-name"><?php if(is_null($statut->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; ?></span>
|
<span class="display-name"><?php
|
||||||
|
if(is_null($statut->reblog)):
|
||||||
|
echo apply_filters('fedi_emoji', $statut->account->display_name, $statut->account->emojis);
|
||||||
|
else:
|
||||||
|
if(empty($statut->reblog->account->display_name)):
|
||||||
|
echo $statut->reblog->account->username;
|
||||||
|
else:
|
||||||
|
echo apply_filters('fedi_emoji', $statut->reblog->account->display_name, $statut->reblog->account->emojis);
|
||||||
|
endif;
|
||||||
|
endif; ?></span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="status__content"><?php
|
<div class="status__content"><?php
|
||||||
|
@ -86,13 +95,13 @@
|
||||||
endif;
|
endif;
|
||||||
if(!empty($statut->media_attachments)):
|
if(!empty($statut->media_attachments)):
|
||||||
foreach ($statut->media_attachments as $attachment) {
|
foreach ($statut->media_attachments as $attachment) {
|
||||||
if (!empty($attachment->preview_url) && $attachment->type === 'image'):
|
if (!empty($attachment->preview_url) && $attachment->type === 'image'): ?>
|
||||||
echo "<img src='" . $attachment->preview_url . "' class='media-gallery__item' alt='" . $attachment->description . "' loading='lazy'>";
|
<img src="<?php echo $attachment->preview_url; ?>" class="media-gallery__item" alt="<?php echo $attachment->description; ?>" loading="lazy">
|
||||||
elseif($attachment->type === 'video'):
|
<?php elseif($attachment->type === 'video'): ?>
|
||||||
echo "<video src=" . $attachment->url . " controls poster='" . $attachment->preview_url . "' class='media-gallery__item' alt=" . $attachment->description . ">";
|
<video src="<?php echo $attachment->url; ?>" controls poster="<?php echo $attachment->preview_url; ?>" class='media-gallery__item' alt="<?php echo $attachment->description; ?>">
|
||||||
elseif($attachment->type === 'audio'):
|
<?php elseif($attachment->type === 'audio'): ?>
|
||||||
echo "<audio src=" . $attachment->url . " controls poster='" . $attachment->preview_url . "' class='media-gallery__item' alt=" . $attachment->description . ">";
|
<audio src="<?php echo $attachment->url; ?>" controls poster="<?php echo $attachment->preview_url; ?>" class='media-gallery__item' alt="<?php echo $attachment->description; ?>">
|
||||||
endif;
|
<?php endif;
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
?></div>
|
?></div>
|
||||||
|
@ -103,3 +112,4 @@
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- peertube -->
|
<!-- peertube -->
|
||||||
<div class="scrollable" style="height: <?php echo $height; ?>;">
|
<div class="fediembedi fediembedi-peertube scrollable" <?php if (!empty($height)) : echo "style='height: $height;'"; endif; ?>>
|
||||||
<div role="feed">
|
<div role="feed">
|
||||||
<?php if($show_header): ?>
|
<?php if($show_header): ?>
|
||||||
<div class="peertube-timeline__header">
|
<div class="peertube-timeline__header">
|
||||||
|
@ -51,3 +51,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- pixelfed -->
|
<!-- pixelfed -->
|
||||||
<div class="scrollable" style="height: <?php echo $height; ?>;">
|
<div class="fediembedi fediembedi-pixelfed scrollable" <?php if (!empty($height)) : echo "style='height: $height;'"; endif; ?>>
|
||||||
<div role="feed" class="embed-card pixelfed">
|
<div role="feed" class="embed-card pixelfed">
|
||||||
<div class="pixelfed-inner card status-card-embed card-md-rounded-0 border">
|
<div class="pixelfed-inner card status-card-embed card-md-rounded-0 border">
|
||||||
<?php if($show_header): ?>
|
<?php if($show_header): ?>
|
||||||
|
@ -17,45 +17,47 @@
|
||||||
<div class="pixelfed-body card-body pb-1">
|
<div class="pixelfed-body card-body pb-1">
|
||||||
<div class="pixelfed-meta d-flex justify-content-between align-items-center">
|
<div class="pixelfed-meta d-flex justify-content-between align-items-center">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="mb-0 font-weight-bold prettyCount"><?php echo $account->statuses_count; ?></p>
|
<div class="mb-0 font-weight-bold prettyCount"><?php echo $account->statuses_count; ?></div>
|
||||||
<p class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Posts', 'fediembedi'); ?></p>
|
<div class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Posts', 'fediembedi'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="mb-0 font-weight-bold prettyCount"><?php echo $account->followers_count; ?></p>
|
<div class="mb-0 font-weight-bold prettyCount"><?php echo $account->followers_count; ?></div>
|
||||||
<p class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Followers', 'fediembedi'); ?></p>
|
<div class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Followers', 'fediembedi'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="mb-0 font-weight-bold prettyCount"><?php echo $account->following_count; ?></p>
|
<div class="mb-0 font-weight-bold prettyCount"><?php echo $account->following_count; ?></div>
|
||||||
<p class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Following', 'fediembedi'); ?></p>
|
<div class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Following', 'fediembedi'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<p class="mb-0">
|
<div class="mb-0">
|
||||||
<a href="<?php echo $instance_url . '/i/intent/follow?user='. $account->acct; ?>" class="pixelfed-follow btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank"><?php _e('Follow', 'fediembedi'); ?></a>
|
<a href="<?php echo $instance_url . '/i/intent/follow?user='. $account->acct; ?>" class="pixelfed-follow btn btn-primary btn-sm py-1 px-4 text-uppercase font-weight-bold" target="_blank"><?php _e('Follow', 'fediembedi'); ?></a>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pixelfed-images row mt-4 mb-1 px-1">
|
<div class="pixelfed-images row mt-4 mb-1 px-1">
|
||||||
<?php foreach ($status as $statut) { ?>
|
<?php foreach ($status as $statut) { ?>
|
||||||
<article class="col-4 mt-2 px-0"><?php
|
<article class="col-4 mt-2 px-0"><?php
|
||||||
if (!empty($statut->media_attachments[0]->preview_url) && $statut->media_attachments[0]->type === 'image'): ?>
|
$attachment = $statut->media_attachments[0];
|
||||||
|
if (!empty($attachment->preview_url) && $attachment->type === 'image'): ?>
|
||||||
<a href="<?php echo $statut->url; ?>" class="card info-overlay card-md-border-0 px-1 shadow-none" target="_blank" rel="noopener">
|
<a href="<?php echo $statut->url; ?>" class="card info-overlay card-md-border-0 px-1 shadow-none" target="_blank" rel="noopener">
|
||||||
<div class="square">
|
<div class="square">
|
||||||
<div style='background-image: url(<?php echo $statut->media_attachments[0]->preview_url; ?>);' class='square-content' alt='<?php $statut->media_attachments[0]->description; ?>'></div>
|
<div style='background-image: url(<?php echo $attachment->preview_url; ?>);' class='square-content' alt='<?php $attachment->description; ?>'></div>
|
||||||
<div class="info-text-overlay"></div>
|
<div class="info-text-overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
</a><?php
|
</a><?php
|
||||||
elseif($statut->media_attachments[0]->type === 'video'):
|
elseif($attachment->type === 'video'): ?>
|
||||||
echo "<video src=" . $attachment->url . " controls poster='" . $statut->media_attachments[0]->preview_url . "' class='media-gallery__item' alt=" . $statut->media_attachments[0]->description . ">";
|
<video src="<?php echo $attachment->url; ?>" controls poster="<?php echo $attachment->preview_url; ?>" class='media-gallery__item' alt="<?php echo $attachment->description; ?>">
|
||||||
endif; ?>
|
<?php endif; ?>
|
||||||
</article>
|
</article>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="pixelfed-footer card-footer bg-white">
|
<div class="pixelfed-footer card-footer bg-white">
|
||||||
<p class="text-center mb-0">
|
<div class="text-center mb-0">
|
||||||
<a href="<?php echo $status[0]->account->url; ?>" class="font-weight-bold" target="_blank" rel="noreferrer noopener"><?php _e('View More Posts', 'fediembedi'); ?></a>
|
<a href="<?php echo $account->url; ?>" class="font-weight-bold" target="_blank" rel="noreferrer noopener"><?php _e('View More Posts', 'fediembedi'); ?></a>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
Loading…
Reference in New Issue