1.9.5
This commit is contained in:
commit
2a04f0ddb1
@ -38,6 +38,7 @@ Place the following shortcode right into the page. Either as shortcode block or
|
|||||||
| onlyMedia | false | onlyMedia="true" | Show only statuses containing media |
|
| onlyMedia | false | onlyMedia="true" | Show only statuses containing media |
|
||||||
| preserveImageAspectRatio | false | preserveImageAspectRatio="true" | Preserve image aspect ratio |
|
| preserveImageAspectRatio | false | preserveImageAspectRatio="true" | Preserve image aspect ratio |
|
||||||
| imageSize | "preview" | imageSize="full" | Load small sized preview images or full size high quality images |
|
| imageSize | "preview" | imageSize="full" | Load small sized preview images or full size high quality images |
|
||||||
|
| imageLink | "status" | imageLink="image" | Link image to status or image |
|
||||||
| tagged | false | tagged="tagname" | Show only statuses that are tagged with given tag name (no #!) |
|
| tagged | false | tagged="tagname" | Show only statuses that are tagged with given tag name (no #!) |
|
||||||
| linkTarget | "_self" | linkTarget="_blank" | Target for all links |
|
| linkTarget | "_self" | linkTarget="_blank" | Target for all links |
|
||||||
| showPreviewCards | true | showPreviewCards="false" | Show preview cards |
|
| showPreviewCards | true | showPreviewCards="false" | Show preview cards |
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
// load small sized preview images or full size high quality images
|
// load small sized preview images or full size high quality images
|
||||||
define( 'INCLUDE_MASTODON_FEED_IMAGE_SIZE', 'preview' );
|
define( 'INCLUDE_MASTODON_FEED_IMAGE_SIZE', 'preview' );
|
||||||
|
|
||||||
|
// link image to status or image
|
||||||
|
define( 'INCLUDE_MASTODON_FEED_IMAGE_LINK', 'status' );
|
||||||
|
|
||||||
// only tagged statuses
|
// only tagged statuses
|
||||||
// tag name without leading #, case insensitive
|
// tag name without leading #, case insensitive
|
||||||
define('INCLUDE_MASTODON_FEED_TAGGED', 'tagname');
|
define('INCLUDE_MASTODON_FEED_TAGGED', 'tagname');
|
||||||
|
19
plugin.php
19
plugin.php
@ -52,6 +52,10 @@ $constants = [
|
|||||||
'key' => 'INCLUDE_MASTODON_FEED_IMAGE_SIZE',
|
'key' => 'INCLUDE_MASTODON_FEED_IMAGE_SIZE',
|
||||||
'value' => 'preview',
|
'value' => 'preview',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'key' => 'INCLUDE_MASTODON_FEED_IMAGE_LINK',
|
||||||
|
'value' => 'status',
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'key' => 'INCLUDE_MASTODON_FEED_TAGGED',
|
'key' => 'INCLUDE_MASTODON_FEED_TAGGED',
|
||||||
'value' => false,
|
'value' => false,
|
||||||
@ -366,18 +370,21 @@ function init_scripts() {
|
|||||||
if('image' == media.type) {
|
if('image' == media.type) {
|
||||||
let mediaElemImgLink = mastodonFeedCreateElement('a');
|
let mediaElemImgLink = mastodonFeedCreateElement('a');
|
||||||
let imageUrl = media.url;
|
let imageUrl = media.url;
|
||||||
if('full' === options.imageSize && null !== media.remote_url) {
|
if('full' === options.images.size && null !== media.remote_url) {
|
||||||
imageUrl = media.remote_url;
|
imageUrl = media.remote_url;
|
||||||
}
|
}
|
||||||
else if(null !== media.preview_url) {
|
else if(null !== media.preview_url) {
|
||||||
imageUrl = media.preview_url;
|
imageUrl = media.preview_url;
|
||||||
}
|
}
|
||||||
mediaElemImgLink.href = status.url;
|
mediaElemImgLink.href = status.url;
|
||||||
|
if('image' === options.images.link) {
|
||||||
|
mediaElemImgLink.href = media.remote_url ?? media.url;
|
||||||
|
}
|
||||||
mediaElemImgLink.style.backgroundImage = 'url("' + imageUrl + '")';
|
mediaElemImgLink.style.backgroundImage = 'url("' + imageUrl + '")';
|
||||||
if(null !== media.description) {
|
if(null !== media.description) {
|
||||||
mediaElem.title = media.description;
|
mediaElem.title = media.description;
|
||||||
}
|
}
|
||||||
if(options.preserveImageAspectRatio) {
|
if(options.images.preserveImageAspectRatio) {
|
||||||
let mediaElemImgImage = mastodonFeedCreateElement('img');
|
let mediaElemImgImage = mastodonFeedCreateElement('img');
|
||||||
mediaElemImgImage.src = imageUrl;
|
mediaElemImgImage.src = imageUrl;
|
||||||
mediaElemImgLink.appendChild(mediaElemImgImage);
|
mediaElemImgLink.appendChild(mediaElemImgImage);
|
||||||
@ -654,6 +661,7 @@ function display_feed($atts) {
|
|||||||
'onlymedia' => filter_var(esc_html(INCLUDE_MASTODON_FEED_ONLY_MEDIA), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
'onlymedia' => filter_var(esc_html(INCLUDE_MASTODON_FEED_ONLY_MEDIA), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||||
'preserveimageaspectratio' => filter_var(esc_html(INCLUDE_MASTODON_FEED_PRESERVE_IMAGE_ASPECT_RATIO), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
'preserveimageaspectratio' => filter_var(esc_html(INCLUDE_MASTODON_FEED_PRESERVE_IMAGE_ASPECT_RATIO), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||||
'imagesize' => INCLUDE_MASTODON_FEED_IMAGE_SIZE,
|
'imagesize' => INCLUDE_MASTODON_FEED_IMAGE_SIZE,
|
||||||
|
'imagelink' => INCLUDE_MASTODON_FEED_IMAGE_LINK,
|
||||||
'tagged' => INCLUDE_MASTODON_FEED_TAGGED,
|
'tagged' => INCLUDE_MASTODON_FEED_TAGGED,
|
||||||
'linktarget' => INCLUDE_MASTODON_FEED_LINKTARGET,
|
'linktarget' => INCLUDE_MASTODON_FEED_LINKTARGET,
|
||||||
'showpreviewcards' => filter_var(esc_html(INCLUDE_MASTODON_FEED_SHOW_PREVIEWCARDS), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
'showpreviewcards' => filter_var(esc_html(INCLUDE_MASTODON_FEED_SHOW_PREVIEWCARDS), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||||
@ -722,12 +730,15 @@ function display_feed($atts) {
|
|||||||
linkTarget: "<?php echo filter_var( $atts['linktarget'], FILTER_UNSAFE_RAW ); ?>",
|
linkTarget: "<?php echo filter_var( $atts['linktarget'], FILTER_UNSAFE_RAW ); ?>",
|
||||||
showPreviewCards: <?php echo (filter_var( $atts['showpreviewcards'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
showPreviewCards: <?php echo (filter_var( $atts['showpreviewcards'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
||||||
excludeConversationStarters: <?php echo (filter_var( $atts['excludeconversationstarters'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
excludeConversationStarters: <?php echo (filter_var( $atts['excludeconversationstarters'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
||||||
preserveImageAspectRatio: <?php echo (filter_var( $atts['preserveimageaspectratio'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
|
||||||
imageSize: "<?php echo ( "full" === $atts['imagesize'] ? "full" : "preview" ); ?>",
|
|
||||||
content: {
|
content: {
|
||||||
hideStatusMeta: <?php echo (filter_var( $atts['hidestatusmeta'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
hideStatusMeta: <?php echo (filter_var( $atts['hidestatusmeta'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
||||||
hideDateTime: <?php echo (filter_var( $atts['hidedatetime'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>
|
hideDateTime: <?php echo (filter_var( $atts['hidedatetime'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>
|
||||||
},
|
},
|
||||||
|
images: {
|
||||||
|
preserveImageAspectRatio: <?php echo (filter_var( $atts['preserveimageaspectratio'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ? "true" : "false"); ?>,
|
||||||
|
size: "<?php echo ( "full" === $atts['imagesize'] ? "full" : "preview" ); ?>",
|
||||||
|
link: "<?php echo ( "image" === $atts['imagelink'] ? "image" : "status" ); ?>",
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
boosted: "<?php echo esc_js( $atts['text-boosted'] ); ?>",
|
boosted: "<?php echo esc_js( $atts['text-boosted'] ); ?>",
|
||||||
noStatuses: "<?php echo esc_html( $atts['text-nostatuses'] ); ?>",
|
noStatuses: "<?php echo esc_html( $atts['text-nostatuses'] ); ?>",
|
||||||
|
@ -59,6 +59,9 @@ Preserve image aspect ratio (Default: false)
|
|||||||
* **imageSize**
|
* **imageSize**
|
||||||
Load small sized preview images or full size high quality images (Default: preview, full)
|
Load small sized preview images or full size high quality images (Default: preview, full)
|
||||||
|
|
||||||
|
* **imageLink**
|
||||||
|
Link image to status or image (Default: status, image)
|
||||||
|
|
||||||
* **tagged**
|
* **tagged**
|
||||||
Show only statuses that are tagged with given tag name (Default: false)
|
Show only statuses that are tagged with given tag name (Default: false)
|
||||||
No leading #, case insensitive, e.g.: tagged="tagname"
|
No leading #, case insensitive, e.g.: tagged="tagname"
|
||||||
@ -152,7 +155,8 @@ Use the following URL to get your ID:
|
|||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
= 1.9.5 =
|
= 1.9.5 =
|
||||||
* added option to load large image versions instead of medea previews (preview still default)
|
* added option to either display smaller image media attachment previews (default) or large image versions
|
||||||
|
* added option to point image media attachment links to either status (default) or image
|
||||||
|
|
||||||
= 1.9.4 =
|
= 1.9.4 =
|
||||||
* added option to hide status meta information and date/time (thank you @PaulKingtiger@dice.camp)
|
* added option to hide status meta information and date/time (thank you @PaulKingtiger@dice.camp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user