installed plugin `FediEmbedi` version 0.11.1

This commit is contained in:
KawaiiPunk 2021-10-15 00:52:04 +00:00 committed by Gitium
parent 373ebbb254
commit ca0d11e8cb
27 changed files with 4547 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://paypal.me/MediaFormat

View File

@ -0,0 +1,7 @@
#ignore system files
.DS_Store
#bootstrap slim
assets/bootstrap/*
!assets/bootstrap/css/bootstrap.min.css
!assets/bootstrap/css/bootstrap.min.css.map

View File

@ -0,0 +1,530 @@
'use strict';
/**
* Copyright Marc J. Schmidt. See the LICENSE file at the top-level
* directory of this distribution and at
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
*/
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(['./ResizeSensor.js'], factory);
} else if (typeof exports === "object") {
module.exports = factory(require('./ResizeSensor.js'));
} else {
root.ElementQueries = factory(root.ResizeSensor);
root.ElementQueries.listen();
}
}(typeof window !== 'undefined' ? window : this, function (ResizeSensor) {
/**
*
* @type {Function}
* @constructor
*/
var ElementQueries = function () {
//<style> element with our dynamically created styles
var cssStyleElement;
//all rules found for element queries
var allQueries = {};
//association map to identify which selector belongs to a element from the animationstart event.
var idToSelectorMapping = [];
/**
*
* @param element
* @returns {Number}
*/
function getEmSize(element) {
if (!element) {
element = document.documentElement;
}
var fontSize = window.getComputedStyle(element, null).fontSize;
return parseFloat(fontSize) || 16;
}
/**
* Get element size
* @param {HTMLElement} element
* @returns {Object} {width, height}
*/
function getElementSize(element) {
if (!element.getBoundingClientRect) {
return {
width: element.offsetWidth,
height: element.offsetHeight
}
}
var rect = element.getBoundingClientRect();
return {
width: Math.round(rect.width),
height: Math.round(rect.height)
}
}
/**
*
* @copyright https://github.com/Mr0grog/element-query/blob/master/LICENSE
*
* @param {HTMLElement} element
* @param {*} value
* @returns {*}
*/
function convertToPx(element, value) {
var numbers = value.split(/\d/);
var units = numbers[numbers.length - 1];
value = parseFloat(value);
switch (units) {
case "px":
return value;
case "em":
return value * getEmSize(element);
case "rem":
return value * getEmSize();
// Viewport units!
// According to http://quirksmode.org/mobile/tableViewport.html
// documentElement.clientWidth/Height gets us the most reliable info
case "vw":
return value * document.documentElement.clientWidth / 100;
case "vh":
return value * document.documentElement.clientHeight / 100;
case "vmin":
case "vmax":
var vw = document.documentElement.clientWidth / 100;
var vh = document.documentElement.clientHeight / 100;
var chooser = Math[units === "vmin" ? "min" : "max"];
return value * chooser(vw, vh);
default:
return value;
// for now, not supporting physical units (since they are just a set number of px)
// or ex/ch (getting accurate measurements is hard)
}
}
/**
*
* @param {HTMLElement} element
* @param {String} id
* @constructor
*/
function SetupInformation(element, id) {
this.element = element;
var key, option, elementSize, value, actualValue, attrValues, attrValue, attrName;
var attributes = ['min-width', 'min-height', 'max-width', 'max-height'];
/**
* Extracts the computed width/height and sets to min/max- attribute.
*/
this.call = function () {
// extract current dimensions
elementSize = getElementSize(this.element);
attrValues = {};
for (key in allQueries[id]) {
if (!allQueries[id].hasOwnProperty(key)) {
continue;
}
option = allQueries[id][key];
value = convertToPx(this.element, option.value);
actualValue = option.property === 'width' ? elementSize.width : elementSize.height;
attrName = option.mode + '-' + option.property;
attrValue = '';
if (option.mode === 'min' && actualValue >= value) {
attrValue += option.value;
}
if (option.mode === 'max' && actualValue <= value) {
attrValue += option.value;
}
if (!attrValues[attrName]) attrValues[attrName] = '';
if (attrValue && -1 === (' ' + attrValues[attrName] + ' ').indexOf(' ' + attrValue + ' ')) {
attrValues[attrName] += ' ' + attrValue;
}
}
for (var k in attributes) {
if (!attributes.hasOwnProperty(k)) continue;
if (attrValues[attributes[k]]) {
this.element.setAttribute(attributes[k], attrValues[attributes[k]].substr(1));
} else {
this.element.removeAttribute(attributes[k]);
}
}
};
}
/**
* @param {HTMLElement} element
* @param {Object} id
*/
function setupElement(element, id) {
if (!element.elementQueriesSetupInformation) {
element.elementQueriesSetupInformation = new SetupInformation(element, id);
}
if (!element.elementQueriesSensor) {
element.elementQueriesSensor = new ResizeSensor(element, function () {
element.elementQueriesSetupInformation.call();
});
}
}
/**
* Stores rules to the selector that should be applied once resized.
*
* @param {String} selector
* @param {String} mode min|max
* @param {String} property width|height
* @param {String} value
*/
function queueQuery(selector, mode, property, value) {
if (typeof(allQueries[selector]) === 'undefined') {
allQueries[selector] = [];
// add animation to trigger animationstart event, so we know exactly when a element appears in the DOM
var id = idToSelectorMapping.length;
cssStyleElement.innerHTML += '\n' + selector + ' {animation: 0.1s element-queries;}';
cssStyleElement.innerHTML += '\n' + selector + ' > .resize-sensor {min-width: '+id+'px;}';
idToSelectorMapping.push(selector);
}
allQueries[selector].push({
mode: mode,
property: property,
value: value
});
}
function getQuery(container) {
var query;
if (document.querySelectorAll) query = (container) ? container.querySelectorAll.bind(container) : document.querySelectorAll.bind(document);
if (!query && 'undefined' !== typeof $$) query = $$;
if (!query && 'undefined' !== typeof jQuery) query = jQuery;
if (!query) {
throw 'No document.querySelectorAll, jQuery or Mootools\'s $$ found.';
}
return query;
}
/**
* If animationStart didn't catch a new element in the DOM, we can manually search for it
*/
function findElementQueriesElements(container) {
var query = getQuery(container);
for (var selector in allQueries) if (allQueries.hasOwnProperty(selector)) {
// find all elements based on the extract query selector from the element query rule
var elements = query(selector, container);
for (var i = 0, j = elements.length; i < j; i++) {
setupElement(elements[i], selector);
}
}
}
/**
*
* @param {HTMLElement} element
*/
function attachResponsiveImage(element) {
var children = [];
var rules = [];
var sources = [];
var defaultImageId = 0;
var lastActiveImage = -1;
var loadedImages = [];
for (var i in element.children) {
if (!element.children.hasOwnProperty(i)) continue;
if (element.children[i].tagName && element.children[i].tagName.toLowerCase() === 'img') {
children.push(element.children[i]);
var minWidth = element.children[i].getAttribute('min-width') || element.children[i].getAttribute('data-min-width');
//var minHeight = element.children[i].getAttribute('min-height') || element.children[i].getAttribute('data-min-height');
var src = element.children[i].getAttribute('data-src') || element.children[i].getAttribute('url');
sources.push(src);
var rule = {
minWidth: minWidth
};
rules.push(rule);
if (!minWidth) {
defaultImageId = children.length - 1;
element.children[i].style.display = 'block';
} else {
element.children[i].style.display = 'none';
}
}
}
lastActiveImage = defaultImageId;
function check() {
var imageToDisplay = false, i;
for (i in children) {
if (!children.hasOwnProperty(i)) continue;
if (rules[i].minWidth) {
if (element.offsetWidth > rules[i].minWidth) {
imageToDisplay = i;
}
}
}
if (!imageToDisplay) {
//no rule matched, show default
imageToDisplay = defaultImageId;
}
if (lastActiveImage !== imageToDisplay) {
//image change
if (!loadedImages[imageToDisplay]) {
//image has not been loaded yet, we need to load the image first in memory to prevent flash of
//no content
var image = new Image();
image.onload = function () {
children[imageToDisplay].src = sources[imageToDisplay];
children[lastActiveImage].style.display = 'none';
children[imageToDisplay].style.display = 'block';
loadedImages[imageToDisplay] = true;
lastActiveImage = imageToDisplay;
};
image.src = sources[imageToDisplay];
} else {
children[lastActiveImage].style.display = 'none';
children[imageToDisplay].style.display = 'block';
lastActiveImage = imageToDisplay;
}
} else {
//make sure for initial check call the .src is set correctly
children[imageToDisplay].src = sources[imageToDisplay];
}
}
element.resizeSensorInstance = new ResizeSensor(element, check);
check();
}
function findResponsiveImages() {
var query = getQuery();
var elements = query('[data-responsive-image],[responsive-image]');
for (var i = 0, j = elements.length; i < j; i++) {
attachResponsiveImage(elements[i]);
}
}
var regex = /,?[\s\t]*([^,\n]*?)((?:\[[\s\t]*?(?:min|max)-(?:width|height)[\s\t]*?[~$\^]?=[\s\t]*?"[^"]*?"[\s\t]*?])+)([^,\n\s\{]*)/mgi;
var attrRegex = /\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]/mgi;
/**
* @param {String} css
*/
function extractQuery(css) {
var match, smatch, attrs, attrMatch;
css = css.replace(/'/g, '"');
while (null !== (match = regex.exec(css))) {
smatch = match[1] + match[3];
attrs = match[2];
while (null !== (attrMatch = attrRegex.exec(attrs))) {
queueQuery(smatch, attrMatch[1], attrMatch[2], attrMatch[3]);
}
}
}
/**
* @param {CssRule[]|String} rules
*/
function readRules(rules) {
var selector = '';
if (!rules) {
return;
}
if ('string' === typeof rules) {
rules = rules.toLowerCase();
if (-1 !== rules.indexOf('min-width') || -1 !== rules.indexOf('max-width')) {
extractQuery(rules);
}
} else {
for (var i = 0, j = rules.length; i < j; i++) {
if (1 === rules[i].type) {
selector = rules[i].selectorText || rules[i].cssText;
if (-1 !== selector.indexOf('min-height') || -1 !== selector.indexOf('max-height')) {
extractQuery(selector);
} else if (-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) {
extractQuery(selector);
}
} else if (4 === rules[i].type) {
readRules(rules[i].cssRules || rules[i].rules);
} else if (3 === rules[i].type) {
if(rules[i].styleSheet.hasOwnProperty("cssRules")) {
readRules(rules[i].styleSheet.cssRules);
}
}
}
}
}
var defaultCssInjected = false;
/**
* Searches all css rules and setups the event listener to all elements with element query rules..
*/
this.init = function () {
var animationStart = 'animationstart';
if (typeof document.documentElement.style['webkitAnimationName'] !== 'undefined') {
animationStart = 'webkitAnimationStart';
} else if (typeof document.documentElement.style['MozAnimationName'] !== 'undefined') {
animationStart = 'mozanimationstart';
} else if (typeof document.documentElement.style['OAnimationName'] !== 'undefined') {
animationStart = 'oanimationstart';
}
document.body.addEventListener(animationStart, function (e) {
var element = e.target;
var styles = element && window.getComputedStyle(element, null);
var animationName = styles && styles.getPropertyValue('animation-name');
var requiresSetup = animationName && (-1 !== animationName.indexOf('element-queries'));
if (requiresSetup) {
element.elementQueriesSensor = new ResizeSensor(element, function () {
if (element.elementQueriesSetupInformation) {
element.elementQueriesSetupInformation.call();
}
});
var sensorStyles = window.getComputedStyle(element.resizeSensor, null);
var id = sensorStyles.getPropertyValue('min-width');
id = parseInt(id.replace('px', ''));
setupElement(e.target, idToSelectorMapping[id]);
}
});
if (!defaultCssInjected) {
cssStyleElement = document.createElement('style');
cssStyleElement.type = 'text/css';
cssStyleElement.innerHTML = '[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img {width: 100%;}';
//safari wants at least one rule in keyframes to start working
cssStyleElement.innerHTML += '\n@keyframes element-queries { 0% { visibility: inherit; } }';
document.getElementsByTagName('head')[0].appendChild(cssStyleElement);
defaultCssInjected = true;
}
for (var i = 0, j = document.styleSheets.length; i < j; i++) {
try {
if (document.styleSheets[i].href && 0 === document.styleSheets[i].href.indexOf('file://')) {
console.warn("CssElementQueries: unable to parse local css files, " + document.styleSheets[i].href);
}
readRules(document.styleSheets[i].cssRules || document.styleSheets[i].rules || document.styleSheets[i].cssText);
} catch (e) {
}
}
findResponsiveImages();
};
/**
* Go through all collected rules (readRules()) and attach the resize-listener.
* Not necessary to call it manually, since we detect automatically when new elements
* are available in the DOM. However, sometimes handy for dirty DOM modifications.
*
* @param {HTMLElement} container only elements of the container are considered (document.body if not set)
*/
this.findElementQueriesElements = function (container) {
findElementQueriesElements(container);
};
this.update = function () {
this.init();
};
};
ElementQueries.update = function () {
ElementQueries.instance.update();
};
/**
* Removes all sensor and elementquery information from the element.
*
* @param {HTMLElement} element
*/
ElementQueries.detach = function (element) {
if (element.elementQueriesSetupInformation) {
//element queries
element.elementQueriesSensor.detach();
delete element.elementQueriesSetupInformation;
delete element.elementQueriesSensor;
} else if (element.resizeSensorInstance) {
//responsive image
element.resizeSensorInstance.detach();
delete element.resizeSensorInstance;
}
};
ElementQueries.init = function () {
if (!ElementQueries.instance) {
ElementQueries.instance = new ElementQueries();
}
ElementQueries.instance.init();
};
var domLoaded = function (callback) {
/* Mozilla, Chrome, Opera */
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', callback, false);
}
/* Safari, iCab, Konqueror */
else if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) {
var DOMLoadTimer = setInterval(function () {
if (/loaded|complete/i.test(document.readyState)) {
callback();
clearInterval(DOMLoadTimer);
}
}, 10);
}
/* Other web browsers */
else window.onload = callback;
};
ElementQueries.findElementQueriesElements = function (container) {
ElementQueries.instance.findElementQueriesElements(container);
};
ElementQueries.listen = function () {
domLoaded(ElementQueries.init);
};
return ElementQueries;
}));

View File

@ -0,0 +1,354 @@
'use strict';
/**
* Copyright Marc J. Schmidt. See the LICENSE file at the top-level
* directory of this distribution and at
* https://github.com/marcj/css-element-queries/blob/master/LICENSE.
*/
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(factory);
} else if (typeof exports === "object") {
module.exports = factory();
} else {
root.ResizeSensor = factory();
}
}(typeof window !== 'undefined' ? window : this, function () {
// Make sure it does not throw in a SSR (Server Side Rendering) situation
if (typeof window === "undefined") {
return null;
}
// https://github.com/Semantic-Org/Semantic-UI/issues/3855
// https://github.com/marcj/css-element-queries/issues/257
var globalWindow = typeof window != 'undefined' && window.Math == Math
? window
: typeof self != 'undefined' && self.Math == Math
? self
: Function('return this')();
// Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
// In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
// would generate too many unnecessary events.
var requestAnimationFrame = globalWindow.requestAnimationFrame ||
globalWindow.mozRequestAnimationFrame ||
globalWindow.webkitRequestAnimationFrame ||
function (fn) {
return globalWindow.setTimeout(fn, 20);
};
/**
* Iterate over each of the provided element(s).
*
* @param {HTMLElement|HTMLElement[]} elements
* @param {Function} callback
*/
function forEachElement(elements, callback){
var elementsType = Object.prototype.toString.call(elements);
var isCollectionTyped = ('[object Array]' === elementsType
|| ('[object NodeList]' === elementsType)
|| ('[object HTMLCollection]' === elementsType)
|| ('[object Object]' === elementsType)
|| ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery
|| ('undefined' !== typeof Elements && elements instanceof Elements) //mootools
);
var i = 0, j = elements.length;
if (isCollectionTyped) {
for (; i < j; i++) {
callback(elements[i]);
}
} else {
callback(elements);
}
}
/**
* Get element size
* @param {HTMLElement} element
* @returns {Object} {width, height}
*/
function getElementSize(element) {
if (!element.getBoundingClientRect) {
return {
width: element.offsetWidth,
height: element.offsetHeight
}
}
var rect = element.getBoundingClientRect();
return {
width: Math.round(rect.width),
height: Math.round(rect.height)
}
}
/**
* Apply CSS styles to element.
*
* @param {HTMLElement} element
* @param {Object} style
*/
function setStyle(element, style) {
Object.keys(style).forEach(function(key) {
element.style[key] = style[key];
});
}
/**
* Class for dimension change detection.
*
* @param {Element|Element[]|Elements|jQuery} element
* @param {Function} callback
*
* @constructor
*/
var ResizeSensor = function(element, callback) {
var lastAnimationFrame = 0;
/**
*
* @constructor
*/
function EventQueue() {
var q = [];
this.add = function(ev) {
q.push(ev);
};
var i, j;
this.call = function(sizeInfo) {
for (i = 0, j = q.length; i < j; i++) {
q[i].call(this, sizeInfo);
}
};
this.remove = function(ev) {
var newQueue = [];
for(i = 0, j = q.length; i < j; i++) {
if(q[i] !== ev) newQueue.push(q[i]);
}
q = newQueue;
};
this.length = function() {
return q.length;
}
}
/**
*
* @param {HTMLElement} element
* @param {Function} resized
*/
function attachResizeEvent(element, resized) {
if (!element) return;
if (element.resizedAttached) {
element.resizedAttached.add(resized);
return;
}
element.resizedAttached = new EventQueue();
element.resizedAttached.add(resized);
element.resizeSensor = document.createElement('div');
element.resizeSensor.dir = 'ltr';
element.resizeSensor.className = 'resize-sensor';
var style = {
pointerEvents: 'none',
position: 'absolute',
left: '0px',
top: '0px',
right: '0px',
bottom: '0px',
overflow: 'hidden',
zIndex: '-1',
visibility: 'hidden',
maxWidth: '100%'
};
var styleChild = {
position: 'absolute',
left: '0px',
top: '0px',
transition: '0s',
};
setStyle(element.resizeSensor, style);
var expand = document.createElement('div');
expand.className = 'resize-sensor-expand';
setStyle(expand, style);
var expandChild = document.createElement('div');
setStyle(expandChild, styleChild);
expand.appendChild(expandChild);
var shrink = document.createElement('div');
shrink.className = 'resize-sensor-shrink';
setStyle(shrink, style);
var shrinkChild = document.createElement('div');
setStyle(shrinkChild, styleChild);
setStyle(shrinkChild, { width: '200%', height: '200%' });
shrink.appendChild(shrinkChild);
element.resizeSensor.appendChild(expand);
element.resizeSensor.appendChild(shrink);
element.appendChild(element.resizeSensor);
var computedStyle = window.getComputedStyle(element);
var position = computedStyle ? computedStyle.getPropertyValue('position') : null;
if ('absolute' !== position && 'relative' !== position && 'fixed' !== position && 'sticky' !== position) {
element.style.position = 'relative';
}
var dirty, rafId;
var size = getElementSize(element);
var lastWidth = 0;
var lastHeight = 0;
var initialHiddenCheck = true;
lastAnimationFrame = 0;
var resetExpandShrink = function () {
var width = element.offsetWidth;
var height = element.offsetHeight;
expandChild.style.width = (width + 10) + 'px';
expandChild.style.height = (height + 10) + 'px';
expand.scrollLeft = width + 10;
expand.scrollTop = height + 10;
shrink.scrollLeft = width + 10;
shrink.scrollTop = height + 10;
};
var reset = function() {
// Check if element is hidden
if (initialHiddenCheck) {
var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;
if (invisible) {
// Check in next frame
if (!lastAnimationFrame){
lastAnimationFrame = requestAnimationFrame(function(){
lastAnimationFrame = 0;
reset();
});
}
return;
} else {
// Stop checking
initialHiddenCheck = false;
}
}
resetExpandShrink();
};
element.resizeSensor.resetSensor = reset;
var onResized = function() {
rafId = 0;
if (!dirty) return;
lastWidth = size.width;
lastHeight = size.height;
if (element.resizedAttached) {
element.resizedAttached.call(size);
}
};
var onScroll = function() {
size = getElementSize(element);
dirty = size.width !== lastWidth || size.height !== lastHeight;
if (dirty && !rafId) {
rafId = requestAnimationFrame(onResized);
}
reset();
};
var addEvent = function(el, name, cb) {
if (el.attachEvent) {
el.attachEvent('on' + name, cb);
} else {
el.addEventListener(name, cb);
}
};
addEvent(expand, 'scroll', onScroll);
addEvent(shrink, 'scroll', onScroll);
// Fix for custom Elements
lastAnimationFrame = requestAnimationFrame(reset);
}
forEachElement(element, function(elem){
attachResizeEvent(elem, callback);
});
this.detach = function(ev) {
// clean up the unfinished animation frame to prevent a potential endless requestAnimationFrame of reset
if (!lastAnimationFrame) {
window.cancelAnimationFrame(lastAnimationFrame);
lastAnimationFrame = 0;
}
ResizeSensor.detach(element, ev);
};
this.reset = function() {
element.resizeSensor.resetSensor();
};
};
ResizeSensor.reset = function(element) {
forEachElement(element, function(elem){
elem.resizeSensor.resetSensor();
});
};
ResizeSensor.detach = function(element, ev) {
forEachElement(element, function(elem){
if (!elem) return;
if(elem.resizedAttached && typeof ev === "function"){
elem.resizedAttached.remove(ev);
if(elem.resizedAttached.length()) return;
}
if (elem.resizeSensor) {
if (elem.contains(elem.resizeSensor)) {
elem.removeChild(elem.resizeSensor);
}
delete elem.resizeSensor;
delete elem.resizedAttached;
}
});
};
if (typeof MutationObserver !== "undefined") {
var observer = new MutationObserver(function (mutations) {
for (var i in mutations) {
if (mutations.hasOwnProperty(i)) {
var items = mutations[i].addedNodes;
for (var j = 0; j < items.length; j++) {
if (items[j].resizeSensor) {
ResizeSensor.reset(items[j]);
}
}
}
}
});
document.addEventListener("DOMContentLoaded", function (event) {
observer.observe(document.body, {
childList: true,
subtree: true,
});
});
}
return ResizeSensor;
}));

View File

@ -0,0 +1,339 @@
/* .scrollable {
contain: strict;
} */
.scrollable {
overflow-y: auto;
overflow-x: hidden;
flex: 1 1 auto;
-webkit-overflow-scrolling: touch;
will-change: transform;
background-color: #fff;
}
.status {
padding: 8px 10px 8px 68px;
position: relative;
min-height: 54px;
border-bottom: 1px solid #c0cdd9;
cursor: default;
opacity: 1;
-webkit-animation: fade .15s linear;
animation: fade .15s linear;
}
.status .status__content p {
font-family: inherit;
}
.status__prepend {
margin-left: 68px;
color: #444b5d;
padding: 8px 0 2px;
font-size: 14px;
position: relative;
}
.status__prepend-icon-wrapper {
left: -26px;
position: absolute;
}
.fa-fw {
width: 1.28571429em;
text-align: center;
}
.fa {
display: inline-block;
}
.account__header {
overflow: hidden;
}
.account__header__image {
overflow: hidden;
height: 145px;
position: relative;
background: #e6ebf0;
}
.account__header__info {
position: absolute;
top: 10px;
left: 10px;
}
.account__header__image img {
object-fit: cover;
display: block;
width: 100%;
height: 100%;
margin: 0;
}
.account__header__bar {
position: relative;
background: #fff;
padding: 5px;
border-bottom: 1px solid #b3c3d1;
}
.account__header__tabs {
display: flex;
align-items: flex-start;
padding: 7px 5px;
margin-top: -55px;
}
.account__header__bar .avatar {
display: block;
flex: 0 0 auto;
width: 94px;
margin-left: -2px;
}
.account__header__tabs .spacer {
flex: 1 1 auto;
}
.account__header__tabs__buttons .button {
margin: 0 8px;
border: 1px solid;
border-radius: 4px;
color: #fff;
padding: 0px 16px;
height: 36px;
line-height: 36px;
}
.account__header__tabs__name {
padding: 5px;
}
.account__header__bar .account__header__tabs__name h1 {
font-size: 16px;
line-height: 24px;
color: #000;
font-family: inherit;
font-weight: 500;
margin: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.account__header__tabs__name h1 small {
display: block;
font-size: 14px;
color: #282c37;
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
}
.account__header__extra {
margin-top: 4px;
}
.account__header__bio {
overflow: hidden;
margin: 0 -5px;
}
.account__header__bio .account__header__content {
padding: 20px 15px 5px;
color: #000;
}
.account__header__bio .account__header__content p {
font-family: inherit;
}
.account__header__content {
color: #282c37;
font-size: 14px;
font-weight: 400;
overflow: hidden;
word-break: normal;
word-wrap: break-word;
}
.account__display-name,
.detailed-status__application,
.detailed-status__datetime,
.detailed-status__display-name,
.status__display-name,
.status__relative-time {
text-decoration: none;
}
.status__display-name {
color: #444b5d;
}
.status__expand {
width: 68px;
position: absolute;
left: 0;
top: 0;
height: 100%;
cursor: pointer;
}
.status__info {
font-size: 15px;
}
.status__info .status__display-name {
display: block;
max-width: 100%;
padding-right: 25px;
}
.status__avatar {
height: 48px;
left: 10px;
position: absolute;
top: 10px;
width: 48px;
}
.account__avatar {
border-radius: 4px;
background: transparent no-repeat;
background-position: 50%;
background-clip: padding-box;
position: relative;
}
.account__avatar-overlay {
width: 48px;
height: 48px;
background-size: 48px 48px;
}
.account__avatar-overlay-base {
border-radius: 4px;
background: transparent no-repeat;
background-position: 50%;
background-clip: padding-box;
width: 36px;
height: 36px;
background-size: 36px 36px;
}
.account__avatar-overlay-overlay {
border-radius: 4px;
background: transparent no-repeat;
background-position: 50%;
background-clip: padding-box;
width: 24px;
height: 24px;
background-size: 24px 24px;
position: absolute;
bottom: 0;
right: 0;
z-index: 1;
}
.display-name {
display: block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.display-name__account {
font-size: 14px;
}
.account__display-name strong, .status__display-name strong {
color: #000;
}
.display-name__html {
font-weight: 500;
}
.notification__relative_time, .status__relative-time {
color: #444b5d;
float: right;
font-size: 14px;
}
.status-card.compact {
border-color: #ccd7e0;
}
.status-card {
display: flex;
font-size: 14px;
border: 1px solid #c0cdd9;
border-radius: 4px;
color: #444b5d;
margin-top: 14px;
text-decoration: none;
overflow: hidden;
cursor: pointer;
}
.status-card.compact .status-card__image {
flex: 0 0 60px;
}
.status-card__image {
flex: 0 0 100px;
background: #c0cdd9;
position: relative;
}
.status-card__image-image {
border-radius: 4px 0 0 4px;
display: block;
margin: 0;
width: 100%;
height: 100%;
object-fit: cover;
background-size: cover;
background-position: 50%;
}
.status-card.compact .status-card__content {
padding: 10px 8px 8px;
}
.status-card__content {
flex: 1 1 auto;
overflow: hidden;
padding: 14px 14px 14px 8px;
}
.status-card__title {
display: block;
font-weight: 500;
margin-bottom: 5px;
color: #282c37;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-decoration: none;
}
.status-card__description {
color: #282c37;
}
.status__wrapper[max-width~="350px"] .status-card__description {
display: none;
}
.status-card__host {
display: block;
margin-top: 5px;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status__wrapper[max-width~="350px"] .status.status-public {
padding: 8px 10px 8px 10px;
}
.status__wrapper[max-width~="350px"] .status__info {
font-size: 1.8rem;
margin-left: 60px;
position: initial;
}
.status__wrapper[max-width~="350px"] .status__content {
margin-top: 2rem;
}
.status__content .invisible {
display: none;
}
.status__content .ellipsis:after {
content: '\2026';
}
.status__content summary {
background: #eee;
border-radius: 5px;
padding: 2px 8px;
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;
}
video.media-gallery__item{
max-width: 100%;
}
i.fa-retweet {
background-image: url('../img/retoot.svg');
background-position: 0 0;
height: 19px;
vertical-align: middle;
width: 22px;
color: #ccc;
opacity: .75;
z-index: 10;
position: relative;
}

View File

@ -0,0 +1,157 @@
/* .scrollable {
contain: strict;
} */
.scrollable {
overflow-y: auto;
overflow-x: hidden;
flex: 1 1 auto;
-webkit-overflow-scrolling: touch;
will-change: transform;
background-color: #fff;
}
.peertube-timeline__header {
width: 100vw;
overflow-x: auto;
padding-left: 15px;
padding-right: 15px;
margin-bottom: 10px;
}
.actor,
.actor-info {
width: 100%;
}
.actor {
display: -webkit-box;
display: flex;
margin-top: 20px;
margin-bottom: 20px;
}
.actor img {
-o-object-fit: cover;
object-fit: cover;
border-radius: 50%;
width: 80px;
height: 80px;
min-width: 80px;
margin-right: 20px;
}
.actor .actor-info {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-pack: center;
justify-content: center;
}
.actor .actor-display-link {
text-decoration: none;
}
.actor .actor-info .actor-names .actor-display-name {
font-size: 23px;
font-weight: 700;
}
.actor-info .actor-names .actor-name {
margin-left: 7px;
position: relative;
top: 3px;
font-size: 14px;
color: #777272;
}
.video { margin-bottom: 1.5em; }
.videos .video-miniature {
padding-right: 0;
height: auto;
width: 100%;
margin-bottom: 5px;
}
.video-thumbnail {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
position: relative;
border-radius: 3px;
overflow: hidden;
background-color: #ececec;
-webkit-transition: -webkit-filter .2s;
transition: -webkit-filter .2s ease;
transition: filter .2s ease;
transition: filter .2s ease,-webkit-filter .2s ease;
}
.videos .video-miniature .video-thumbnail {
margin: 0;
width: 100%;
height: auto;
border-radius: 0;
}
.videos .video-miniature .video-thumbnail img {
width: 100%;
height: auto;
}
.video-thumbnail .play-overlay {
position: absolute;
right: 0;
bottom: 0;
width: inherit;
height: inherit;
opacity: 0;
background-color: rgba(0,0,0,.7);
}
.video-thumbnail .play-overlay,
.video-thumbnail .play-overlay .icon {
-webkit-transition: .2s;
transition: all .2s ease;
}
.video-thumbnail .play-overlay .icon {
width: 0;
height: 0;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%,-50%) scale(.5);
transform: translate(-50%,-50%) scale(.5);
border-top: 13px solid transparent;
border-bottom: 13px solid transparent;
border-left: 18px solid rgba(255,255,255,.95);
}
.video-miniature .video-bottom {
display: -webkit-box;
display: flex;
}
.video-thumbnail .video-thumbnail-duration-overlay {
display: inline-block;
background-color: rgba(0,0,0,.7);
color: #fff;
position: absolute;
right: 5px;
bottom: 5px;
padding: 0 5px;
border-radius: 3px;
font-size: 12px;
font-weight: 700;
}
.video-miniature-name{
font-weight: 600;
margin: 0 0 5px;
text-decoration: none;
text-overflow: ellipsis;
}
.video-miniature-created-at-views {
font-size: 0.75em;
}
.video-miniature-created-at-views .views::before {
content: ' - '
}
.video-miniature-account {
hite-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
font-size: 0.75em;
color: #585858;
}

View File

@ -0,0 +1,82 @@
/* .scrollable {
contain: strict;
} */
.scrollable {
overflow-y: auto;
overflow-x: hidden;
flex: 1 1 auto;
-webkit-overflow-scrolling: touch;
will-change: transform;
background-color: #fff;
}
/**
* Pixelfed Styles
*/
.embed-card a {
text-decoration: none;
}
a.card{
border: none;
}
.card img {
max-width: none;
display: inline;
}
.info-overlay {
position: relative;
}
.info-overlay-text {
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.5);
}
.info-overlay .info-overlay-text {
display: none;
position: absolute;
}
.info-overlay:hover .info-overlay-text {
display: -webkit-box;
display: flex;
}
.square {
position: relative;
width: 100%;
}
.square:after {
content: "";
display: block;
padding-bottom: 100%;
}
.square-content {
position: absolute;
width: 100%;
height: 100%;
background-repeat: no-repeat;
background-size: cover;
background-position: 50%;
}
.embed-card .pixelfed-follow {
font-size: 14px;
color: #fff;
}
.pixelfed[max-width~="400px"] .pixelfed-meta .text-center{
display: none;
}
.pixelfed[max-width~="350px"] .pixelfed-header{
display: block!important;
}
.pixelfed[max-width~="350px"] .pixelfed-account{
float: left;
clear: both;
}
.pixelfed[max-width~="350px"] .pixelfed-instance{
float: right;
clear: both;
}

View File

@ -0,0 +1,267 @@
<?php
/**
* The Client class contains all the methods to
* connect to your fediverse instance
*/
class FediClient
{
private $instance_url;
private $access_token;
private $app;
private static $acct_id;
public function __construct($instance_url, $access_token = '') {
$this->instance_url = $instance_url;
$this->access_token = $access_token;
}
public function setStatic($param){
self::$acct_id = $param;
}
public function getStatic(){
return self::$acct_id;
}
public function register_app($redirect_uri, $scopes = 'read') {
$response = $this->_post('/api/v1/apps', array(
'client_name' => 'FediEmbedi for WordPress',
'redirect_uris' => $redirect_uri,
'scopes' => $scopes,
'website' => get_site_url()
));
if (!isset($response->client_id)){
return "ERROR";
}
$this->app = $response;
$params = http_build_query(array(
'response_type' => 'code',
'redirect_uri' => $redirect_uri,
'scope' => $scopes,
'client_id' =>$this->app->client_id
));
return $this->instance_url.'/oauth/authorize?'.$params;
}
// public function register_client($redirect_uri, $scopes = 'read') {
//
// $response = $this->_get('/api/v1/oauth-clients/local');
//
// if (!isset($response->client_id)){
// return "ERROR";
// }
//
// $this->app = $response;
//
// $params = http_build_query(array(
// 'scope' => $scopes,
// 'client_id' =>$this->app->client_id,
// 'client_secret' =>$this->app->client_secret
// ));
//
// $access_token = $this->_post('/api/v1/oauth-clients/local');
// // return $this->instance_url.'/users/token?'.$params;
// }
public function verify_credentials($access_token){
$headers = array(
'Authorization'=>'Bearer '.$access_token
);
$response = $this->_get('/api/v1/accounts/verify_credentials', null, $headers);
if(isset($response->id)){
$this->setStatic($response->id);
}
return $response;
}
public function get_bearer_token($client_id, $client_secret, $code, $redirect_uri) {
$response = $this->_post('/oauth/token',array(
'grant_type' => 'authorization_code',
'redirect_uri' => $redirect_uri,
'client_id' => $client_id,
'client_secret' => $client_secret,
'code' => $code
));
return $response;
}
public function get_user_token($client_id, $client_secret) {
$response = $this->_post('/oauth/token',array(
'client_id' => $client_id,
'client_secret' => $client_secret,
));
return $response;
}
public function get_client_id() {
return $this->app->client_id;
}
public function get_client_secret() {
return $this->app->client_secret;
}
public function getStatus($media = 'false', $pinned = 'false', $replies = 'false', $max_id = null, $since_id = null, $min_id = null, $limit = 10, $reblogs = 'false') {
$headers = array(
'Authorization'=> 'Bearer '.$this->access_token
);
$account_id = self::$acct_id;
$query = http_build_query(array(
'only_media' => $media,
'pinned' => $pinned,
'exclude_replies' => $replies,
'max_id' => $max_id,
'since_id' => $since_id,
'min_id' => $min_id,
'limit' => $limit,
'exclude_reblogs' => $reblogs
));
$response = $this->_get("/api/v1/accounts/{$account_id}/statuses?{$query}", null, null);
return $response;
}
public function getVideos($account_id, $is_channel, $count, $nsfw = false) {
//https://docs.joinpeertube.org/api-rest-reference.html#tag/Video
$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)){
$response = $this->_get("/api/v1/video-channels/{$account_id}/videos?{$query}", null, $headers);
} else {
$response = $this->_get("/api/v1/accounts/{$account_id}/videos?{$query}", null, $headers);
}
return $response;
}
public function getTimelineHome() {
$headers = array(
'Authorization'=> 'Bearer '.$this->access_token
);
$account_id = self::$acct_id;
$response = $this->_get("/api/v1/accounts/{$account_id}/lists", null, $headers);
//$response = $this->_get("/api/v1/timelines/home?limit=20", null, $headers);
return $response;
}
public function getAccount() {
$headers = array(
'Authorization'=> 'Bearer '.$this->access_token
);
$account_id = self::$acct_id;
$response = $this->_get("/api/v1/accounts/{$account_id}", null, $headers);
return $response;
}
public function getInstance() {
$headers = array(
'Authorization'=> 'Bearer '.$this->access_token
);
$account_id = self::$acct_id;
$response = $this->_get("/api/v1/instance", null, $headers);
return $response;
}
private function _post($url, $data = array(), $headers = array()) {
return $this->post($this->instance_url.$url, $data, $headers);
}
public function _get($url, $data = array(), $headers = array()) {
return $this->get($this->instance_url.$url, $data, $headers);
}
private function post($url, $data = array(), $headers = array()) {
$args = array(
'headers' => $headers,
'body'=> $data,
'redirection' => 5
);
$response = wp_remote_post( $this->getValidURL($url), $args );
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
} else {
$responseBody = wp_remote_retrieve_body($response);
return json_decode($responseBody);
}
return $response;
}
public function get($url, $data = array(), $headers = array()) {
$args = array(
'headers' => $headers,
'redirection' => 5
);
$response = wp_remote_get( $this->getValidURL($url), $args );
if ( is_wp_error( $response ) ) {
$error_message = $response->get_error_message();
} else {
$responseBody = wp_remote_retrieve_body($response);
return json_decode($responseBody);
}
return $response;
}
public function dump($value){
echo '<pre>';
print_r($value);
echo '</pre>';
}
private function getValidURL($url){
if ( $ret = parse_url($url) ) {
if ( !isset($ret["scheme"]) ){
$url = "http://{$url}";
}
}
return $url;
}
}

View File

@ -0,0 +1,177 @@
<?php
class FediEmbedi_Mastodon extends WP_Widget {
/**
* Sets up a new FediEmbedi widget instance.
*
* @since 2.8.0
*/
public function __construct() {
$widget_ops = array(
'classname' => 'mastodon_widget',
'description' => __( 'Display a profile timeline', 'fediembedi' ),
'customize_selective_refresh' => true,
);
parent::__construct( 'mastodon', _x( 'Mastodon', 'fediembedi' ), $widget_ops );
}
/**
* 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 Mastodon widget instance.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
//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);
//widget options
$show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : '';
$only_media = (!empty($instance['only_media'])) ? $instance['only_media'] : '';
$pinned = (!empty($instance['pinned'])) ? $instance['pinned'] : '';
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : '';
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : '';
$limit = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
echo $args['before_widget'];
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
};
//getStatus from remote instance
$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' );
echo $args['after_widget'];
}
/**
* Outputs the settings form for the Mastodon widget.
*
* @since 2.8.0
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
//Radio inputs : https://wordpress.stackexchange.com/a/276659/87622
$show_header = (!empty( $instance['show_header'])) ? $instance['show_header'] : NULL;
$only_media = (!empty( $instance['only_media'])) ? $instance['only_media'] : NULL;
$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;
$limit = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'fediembedi'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'show_header' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('show_header'); ?>"
value="1"
/><?php _e( 'Show header', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'only_media' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('only_media'); ?>"
value="1"
/><?php _e( 'Only show media', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'pinned' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('pinned'); ?>"
value="1"
/><?php _e( 'Only show pinned statuses', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'exclude_replies' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('exclude_replies'); ?>"
value="1"
/><?php _e( 'Hide replies', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'exclude_reblogs' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('exclude_reblogs'); ?>"
value="1"
/><?php _e( 'Hide reblogs', 'fediembedi' ); ?>
</label>
</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 $limit; ?>" size="3" />
<small>Max: 20</small>
</label>
</p>
<p>
<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" />
<small><?php _e( 'Default: 100%', 'fediembedi' ); ?></small>
</label>
</p>
<?php
}
/**
* Handles updating settings for the current Mastodon widget instance.
*
* @since 2.8.0
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Updated settings.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['show_header'] = $new_instance['show_header'];
$instance['only_media'] = $new_instance['only_media'];
$instance['pinned'] = $new_instance['pinned'];
$instance['exclude_replies'] = $new_instance['exclude_replies'];
$instance['exclude_reblogs'] = $new_instance['exclude_reblogs'];
$instance['number'] = (int) $new_instance['number'];
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -0,0 +1,178 @@
<?php
class FediEmbedi_PeerTube extends WP_Widget {
/**
* Sets up a new FediEmbedi widget instance.
*
* @since 2.8.0
*/
public function __construct() {
$widget_ops = array(
'classname' => 'peertube_widget',
'description' => __( 'Display a profile timeline', 'fediembedi' ),
'customize_selective_refresh' => true,
);
parent::__construct( 'peertube', _x( 'PeerTube', 'fediembedi' ), $widget_ops );
}
/**
* 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 PeerTube widget instance.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
//fedi instance
$fedi_instance = (!empty($instance['peertube'])) ? $instance['peertube'] : '';
$actor = (!empty($instance['actor'])) ? $instance['actor'] : '';
$is_channel = (!empty($instance['channel'])) ? $instance['channel'] : null;//radio channel or account
$client = new \FediClient($fedi_instance);
//widget options
$show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : null;
$count = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
$nsfw = isset( $instance['nsfw'] ) ? $instance['nsfw'] : null;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
echo $args['before_widget'];
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
};
//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(!is_null($is_channel)){
$account = $status->data[0]->channel;
} else {
$account = $status->data[0]->account;
}
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
echo $args['after_widget'];
}
/**
* Outputs the settings form for the PeerTube widget.
*
* @since 2.8.0
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
//Radio inputs : https://wordpress.stackexchange.com/a/276659/87622
$peertube = (!empty($instance['peertube'])) ? $instance['peertube'] : NULL;
$actor = (!empty($instance['actor'])) ? $instance['actor'] : NULL;
$is_channel = (!empty($instance['channel'])) ? $instance['channel'] : NULL;
$show_header = (!empty( $instance['show_header'])) ? $instance['show_header'] : NULL;
$only_media = (!empty( $instance['only_media'])) ? $instance['only_media'] : NULL;
$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;
$nsfw = isset( $instance['nsfw'] ) ? $instance['nsfw'] : false;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'fediembedi'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('peertube'); ?>"><?php _e('PeerTube instance:', 'fediembedi'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('peertube'); ?>" name="<?php echo $this->get_field_name('peertube'); ?>" type="text" value="<?php echo esc_url($peertube, 'https'); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('actor'); ?>"><?php _e('User or Channel name:', 'fediembedi'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('actor'); ?>" name="<?php echo $this->get_field_name('actor'); ?>" type="text" value="<?php echo $actor; ?>" />
</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( 'This account is a Channel (not a user)', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'show_header' ], '1' ); ?>
id="<?php echo $this->get_field_id( 'show_header' ); ?>"
name="<?php echo $this->get_field_name('show_header'); ?>"
value="1"
/><?php _e( 'Show header', 'fediembedi' ); ?>
</label>
</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" />
<small>Max: 20</small>
</label>
</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>
<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>
</label>
</p>
<?php
}
/**
* Handles updating settings for the current PeerTube widget instance.
*
* @since 2.8.0
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Updated settings.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['peertube'] = esc_url($new_instance['peertube']);
$instance['actor'] = sanitize_key($new_instance['actor']);
$instance['channel'] = $new_instance['channel'];
$instance['show_header'] = $new_instance['show_header'];
$instance['only_media'] = $new_instance['only_media'];
$instance['pinned'] = $new_instance['pinned'];
$instance['exclude_replies'] = $new_instance['exclude_replies'];
$instance['exclude_reblogs'] = $new_instance['exclude_reblogs'];
$instance['number'] = (int) $new_instance['number'];
$instance['nsfw'] = $new_instance['nsfw'];
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -0,0 +1,180 @@
<?php
class FediEmbedi_Pixelfed extends WP_Widget {
/**
* Sets up a new FediEmbedi widget instance.
*
* @since 2.8.0
*/
public function __construct() {
$widget_ops = array(
'classname' => 'pixelfed_widget',
'description' => __( 'Display a profile timeline', 'fediembedi' ),
'customize_selective_refresh' => true,
);
parent::__construct( 'pixelfed', _x( 'Pixelfed', 'fediembedi' ), $widget_ops );
}
/**
* 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 Pixelfed widget instance.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
//fedi instance
$instance_url = get_option('fediembedi-pixelfed-instance');
$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'] : '';
$only_media = (!empty($instance['only_media'])) ? $instance['only_media'] : '';
$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;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>'. $instance_type .'</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
echo $args['before_widget'];
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
};
$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'];
}
/**
* Outputs the settings form for the Pixelfed widget.
*
* @since 2.8.0
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
//Radio inputs : https://wordpress.stackexchange.com/a/276659/87622
$show_header = (!empty( $instance['show_header'])) ? $instance['show_header'] : NULL;
$only_media = (!empty( $instance['only_media'])) ? $instance['only_media'] : NULL;
$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;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'fediembedi'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'show_header' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('show_header'); ?>"
value="1"
/><?php _e( 'Show header', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'only_media' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('only_media'); ?>"
value="1"
/><?php _e( 'Only show media', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'pinned' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('pinned'); ?>"
value="1"
/><?php _e( 'Only show pinned statuses', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'exclude_replies' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('exclude_replies'); ?>"
value="1"
/><?php _e( 'Hide replies', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'exclude_reblogs' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('exclude_reblogs'); ?>"
value="1"
/><?php _e( 'Hide reblogs', 'fediembedi' ); ?>
</label>
</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" />
<small>Max: 20</small>
</label>
</p>
<p>
<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" />
<small><?php _e( 'Default: 100%', 'fediembedi' ); ?></small>
</label>
</p>
<?php
}
/**
* Handles updating settings for the current Pixelfed widget instance.
*
* @since 2.8.0
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Updated settings.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['show_header'] = $new_instance['show_header'];
$instance['only_media'] = $new_instance['only_media'];
$instance['pinned'] = $new_instance['pinned'];
$instance['exclude_replies'] = $new_instance['exclude_replies'];
$instance['exclude_reblogs'] = $new_instance['exclude_reblogs'];
$instance['number'] = (int) $new_instance['number'];
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -0,0 +1,72 @@
<?php
define("FEDI_CONNECTED",isset($account) && $account !== null);
define("FEDI_MSTDN_CONNECTED",isset($mastodon_account) && $mastodon_account !== null);
define("FEDI_PXLFD_CONNECTED",isset($pixelfed_account) && $pixelfed_account !== null);
?>
<div class="wrap">
<h1><?php esc_html_e( 'FediEmbedi Configuration', 'fediembedi' ); ?></h1>
<p><?php _e( 'The currently supported software are Mastodon, Pleroma, Pixelfed, PeerTube.', 'fediembedi' ); ?></p>
<form method="POST">
<?php wp_nonce_field( 'fediembedi-configuration' ); ?>
<div style="display:<?php echo !FEDI_MSTDN_CONNECTED ? "block":"none"?>">
<p><span class="mastodon"></span>
<input type="hidden" name="instance_type" value="mastodon">
<input type="text" class="widefat instance_url" id="mastodon_instance" name="instance" size="60" value="<?php !isset($mastodon_instance)?: esc_url_raw( $mastodon_instance, 'https' ); ?>">
<input class="button button-primary" type="submit" value="<?php _e( 'Connect to your instance to enable the widget', 'fediembedi' ); ?>" name="save" id="save_mastodon"><br></p>
<p><?php _e( "Don't have an account?", 'fediembedi' ); ?> Visit <a href="https://joinmastodon.org/" rel="noreferrer noopener" target="_blank" class="">joinmastodon.org</a> to find an instance.</p>
</div>
<div style="display:<?php echo FEDI_MSTDN_CONNECTED ? "block" : "none"?>">
<div class="account">
<a href="<?php echo $mastodon_account->url ?>" target="_blank"><img class="m-avatar" src="<?php echo $mastodon_account->avatar ?>"><span class="mastodon"></span></a>
<div class="details">
<?php if(FEDI_MSTDN_CONNECTED): ?>
<div class="connected"><?php echo $mastodon_account->username ?></div>
<a class="link" href="<?php echo $mastodon_account->url ?>" target="_blank"><?php echo $mastodon_account->url ?></a>
<p><a href="<?php echo $_SERVER['REQUEST_URI'] . '&fediembedi-disconnect=mastodon' ?>" class="button"><?php esc_html_e( 'Disconnect', 'fediembedi' ); ?></a>
<?php else: ?>
<div class="disconnected"><?php esc_html_e( 'Disconnected', 'fediembedi' ); ?></div>
<?php endif ?>
</div>
<div class="separator"></div>
</div><div class="clear"></div>
</div>
</form>
<form method="POST">
<?php wp_nonce_field( 'fediembedi-configuration' ); ?>
<div style="display:<?php echo !FEDI_PXLFD_CONNECTED ? "block":"none"?>">
<p><span class="pixelfed"></span>
<input type="hidden" name="instance_type" value="pixelfed">
<input type="text" class="widefat instance_url" id="pixlefed_instance" name="instance" size="60" value="<?php !isset($pixlefed_instance)?: esc_url_raw( $pixlefed_instance, 'https' ); ?>">
<input class="button button-primary" type="submit" value="<?php _e( 'Connect to your instance to enable the widget', 'fediembedi' ); ?>" name="save" id="save_pixelfed"></p>
<p><?php _e( "Don't have an account?", 'fediembedi' ); ?> Visit <a href="https://pixelfed.org/join" rel="noreferrer noopener" target="_blank" class="">pixelfed.org/join</a> to find an instance.</p>
</div>
<div style="display:<?php echo FEDI_PXLFD_CONNECTED ? "block" : "none"?>">
<div class="account">
<a href="<?php echo $pixelfed_account->url ?>" target="_blank"><img class="m-avatar" src="<?php echo $pixelfed_account->avatar ?>"><span class="pixelfed"></span></a>
<div class="details">
<?php if(FEDI_PXLFD_CONNECTED): ?>
<div class="connected"><?php echo $pixelfed_account->username ?></div>
<a class="link" href="<?php echo $pixelfed_account->url ?>" target="_blank"><?php echo $pixelfed_account->url ?></a>
<p><a href="<?php echo $_SERVER['REQUEST_URI'] . '&fediembedi-disconnect=pixelfed' ?>" class="button"><?php esc_html_e( 'Disconnect', 'fediembedi' ); ?></a>
<?php else: ?>
<div class="disconnected"><?php esc_html_e( 'Disconnected', 'fediembedi' ); ?></div>
<?php endif ?>
</div>
<div class="separator"></div>
</div><div class="clear"></div>
</div>
<div>
<p><span class="peertube"></span> Widget ready!
Visit <a href="https://joinpeertube.org" rel="noreferrer noopener" target="_blank" class="">joinpeertube.org</a> to find an instance.</p>
</div>
<div class="clear"></div>
</form>
<div>
<p>For news and updates follow <a href="https://mastodon.social/@MediaFormat" target="_blank">@MediaFormat</a>.</p>
</div>
</div>

View File

@ -0,0 +1,201 @@
<?php
class WP_Widget_fediembedi extends WP_Widget {
/**
* Sets up a new FediEmbedi widget instance.
*
* @since 2.8.0
*/
public function __construct() {
$widget_ops = array(
'classname' => 'widget_fediembedi',
'description' => __( 'Display a profile timeline', 'fediembedi' ),
'customize_selective_refresh' => true,
);
parent::__construct( 'fediembedi', _x( 'FediEmbedi', 'fediembedi' ), $widget_ops );
}
/**
* Outputs the content for the current Search 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.
*/
public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
//fedi instance
$fedi_instance = get_option('fediembedi-instance');
$access_token = get_option('fediembedi-token');
$client = new \FediClient($fedi_instance, $access_token);
$cred = $client->verify_credentials($access_token);
//$profile = $client->getAccount();
//widget options
$show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : '';
$only_media = (!empty($instance['only_media'])) ? $instance['only_media'] : '';
$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;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
//Instance type (Matodon / Pixelfed / PeerTube)
$instance_type = get_option('fediembedi-instance-type');
//if(WP_DEBUG_DISPLAY === true): echo '<details><summary>'. $instance_type .'</summary><pre>'; var_dump($status); echo '</pre></details>'; endif;
echo $args['before_widget'];
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
};
switch ($instance_type) {
case 'Mastodon':
//getStatus from remote instance
$status = $client->getStatus($only_media, $pinned, $exclude_replies, null, null, null, $number, $exclude_reblogs);
include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' );
break;
case 'Pixelfed':
//getStatus from remote instance
$status = $client->getStatus($only_media, $pinned, $exclude_replies, null, null, null, $number, $exclude_reblogs);
//$status = $client->getTimelineHome();
include(plugin_dir_path(__FILE__) . 'templates/pixelfed.tpl.php' );
break;
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;
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
break;
default:
include(plugin_dir_path(__FILE__) . 'templates/mastodon.tpl.php' );
break;
}
echo $args['after_widget'];
}
/**
* Outputs the settings form for the Search widget.
*
* @since 2.8.0
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
//Radio inputs : https://wordpress.stackexchange.com/a/276659/87622
$show_header = (!empty( $instance['show_header'])) ? $instance['show_header'] : NULL;
$only_media = (!empty( $instance['only_media'])) ? $instance['only_media'] : NULL;
$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;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
$instance_type = get_option('fediembedi-instance-type');
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'fediembedi'); ?>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'show_header' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('show_header'); ?>"
value="1"
/><?php _e( 'Show header', 'fediembedi' ); ?>
</label>
</p>
<p style="<?php if($instance_type === 'Pixelfed'){ echo 'display: none;'; } ?>">
<label>
<input
type="checkbox"
<?php checked( $instance[ 'only_media' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('only_media'); ?>"
value="1"
/><?php _e( 'Only show media', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'pinned' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('pinned'); ?>"
value="1"
/><?php _e( 'Only show pinned statuses', 'fediembedi' ); ?>
</label>
</p>
<p>
<label>
<input
type="checkbox"
<?php checked( $instance[ 'exclude_replies' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('exclude_replies'); ?>"
value="1"
/><?php _e( 'Hide replies', 'fediembedi' ); ?>
</label>
</p>
<p style="<?php if($instance_type === 'Pixelfed'){ echo 'display: none;'; } ?>">
<label>
<input
type="checkbox"
<?php checked( $instance[ 'exclude_reblogs' ], '1' ); ?>
id="<?php echo $this->get_field_id( '1' ); ?>"
name="<?php echo $this->get_field_name('exclude_reblogs'); ?>"
value="1"
/><?php _e( 'Hide reblogs', 'fediembedi' ); ?>
</label>
</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" />
<small>Max: 20</small>
</label>
</p>
<p>
<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" />
<small><?php _e( 'Default: 100%', 'fediembedi' ); ?></small>
</label>
</p>
<?php
}
/**
* Handles updating settings for the current Search widget instance.
*
* @since 2.8.0
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Updated settings.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['show_header'] = $new_instance['show_header'];
$instance['only_media'] = $new_instance['only_media'];
$instance['pinned'] = $new_instance['pinned'];
$instance['exclude_replies'] = $new_instance['exclude_replies'];
$instance['exclude_reblogs'] = $new_instance['exclude_reblogs'];
$instance['number'] = (int) $new_instance['number'];
$instance['height'] = sanitize_text_field( $new_instance['height'] );
return $instance;
}
}

View File

@ -0,0 +1,468 @@
<?php
/**
* Plugin Name: FediEmbedi
* 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.1
* Author: mediaformat
* Author URI: https://mediaformat.org
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
* Text Domain: fediembedi
* Domain Path: /languages
*/
namespace FediEmbedi;
require_once 'fediembedi-client.php';
class FediConfig
{
public function __construct()
{
add_action('plugins_loaded', array($this, 'init'));
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('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'));
}
/**
* Init
*
* Plugin initialization
*
* @return void
*/
public function init()
{
$plugin_dir = basename(dirname(__FILE__));
//load_plugin_textdomain('fediembedi', false, $plugin_dir . '/languages');
if (isset($_GET['code'])) {
//if (isset($_GET['code']) && isset($GET['instance_type'])) {
$instance_type = $_REQUEST['instance_type'];
$code = $_GET['code'];
switch ($instance_type) {
case 'mastodon':
$client_id = get_option('fediembedi-mastodon-client-id');
$client_secret = get_option('fediembedi-mastodon-client-secret');
break;
case 'pixelfed':
$client_id = get_option('fediembedi-pixelfed-client-id');
$client_secret = get_option('fediembedi-pixelfed-client-secret');
break;
}
if (!empty($code) && !empty($client_id) && !empty($client_secret)) {
//echo __('Authentification, please wait', 'fediembedi') . '...';
switch ($instance_type) {
case 'mastodon':
update_option('fediembedi-mastodon-token', 'nada');
$instance = get_option('fediembedi-mastodon-instance');
$client = new \FediClient($instance);
$token = $client->get_bearer_token($client_id, $client_secret, $code, get_admin_url() . '?instance_type=' . $instance_type);
break;
case 'pixelfed':
update_option('fediembedi-pixelfed-token', 'nada');
$instance = get_option('fediembedi-pixelfed-instance');
$client = new \FediClient($instance);
$token = $client->get_bearer_token($client_id, $client_secret, $code, get_admin_url() . '?instance_type=' . $instance_type);
break;
}
if (isset($token->error)) {
//TODO: Proper error message
update_option(
'fediembedi-notice',
serialize(
array(
'message' => '<strong>FediEmbedi</strong> : ' . __("Can't log you in.", 'fediembedi') .
'<p><strong>' . __('Instance message', 'fediembedi') . '</strong> : ' . $token->error_description . '</p>',
'class' => 'error',
)
)
);
unset($token);
switch ($instance_type) {
case 'mastodon':
update_option('fediembedi-mastodon-token', '');
break;
case 'pixelfed':
update_option('fediembedi-pixelfed-token', '');
break;
}
} else {
switch ($instance_type) {
case 'mastodon':
update_option('fediembedi-mastodon-client-id', $client_id);//
update_option('fediembedi-mastodon-client-secret', $client_secret);//
update_option('fediembedi-mastodon-token', $token->access_token);
break;
case 'pixelfed':
update_option('fediembedi-pixelfed-client-id', $client_id);//
update_option('fediembedi-pixelfed-client-secret', $client_secret);//
update_option('fediembedi-pixelfed-token', $token->access_token);
break;
}
}
$redirect_url = get_admin_url() . 'options-general.php?page=fediembedi';
} else {
//Probably hack or bad refresh, redirect to homepage
$redirect_url = home_url();
}
wp_redirect($redirect_url);
exit;
}
$mastodon_token = get_option('fediembedi-mastodon-token');
$pixelfed_token = get_option('fediembedi-pixelfed-token');
}
/*
* Widget
*/
public function fediembedi_widget() {
//Mastodon
include(plugin_dir_path(__FILE__) . 'fediembedi-mastodon-widget.php' );
register_widget( 'FediEmbedi_Mastodon' );
if(empty(get_option('fediembedi-mastodon-token'))){
unregister_widget( 'FediEmbedi_Mastodon' );
}
//Pixelfed
include(plugin_dir_path(__FILE__) . 'fediembedi-pixelfed-widget.php' );
register_widget( 'FediEmbedi_Pixelfed' );
if(empty(get_option('fediembedi-pixelfed-token'))){
unregister_widget( 'FediEmbedi_Pixelfed' );
}
//PeerTube
include(plugin_dir_path(__FILE__) . 'fediembedi-peertube-widget.php' );
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){
if(is_null($emojis) || !is_array($emojis)){
return $string;
}
foreach($emojis as $emoji){
$match = '/:' . $emoji->shortcode .':/';
$string = preg_replace($match, "<img draggable=\"false\" role=\"img\" class=\"emoji\" src=\"{$emoji->static_url}\">", $string);
}
return $string;
}
public function enqueue_styles($hook)
{
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( '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') || ( 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') );
}
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( 'pixelfed', plugin_dir_url( __FILE__ ) . 'assets/pixelfed.css', array(), filemtime(plugin_dir_path( __FILE__ ) . 'assets/pixelfed.css') );
}
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') );
}
}
public function enqueue_scripts($hook)
{
global $pagenow;
$infos = get_plugin_data(__FILE__);
if ($pagenow == "options-general.php") {
//We might be on settings page <-- Do you know a bette solution to get if we are in our own settings page?
$plugin_url = plugin_dir_url(__FILE__);
//wp_enqueue_script('settings_page', $plugin_url . 'assets/settings_page.js', array('jquery'), $infos['Version'], true);
}
}
/**
* Configuration_page
*
* Add the configuration page menu
*
* @return void
*/
public function configuration_page()
{
add_options_page(
'FediEmbedi',
'FediEmbedi',
'manage_options',
'fediembedi',
array($this, 'show_configuration_page')
);
}
/**
* Show_configuration_page
*
* Content of the configuration page
*
* @throws Exception The exception.
* @return void
*/
public function show_configuration_page()
{
wp_enqueue_style('fediembedi-configuration', plugin_dir_url(__FILE__) . 'style.css');
if (isset($_GET['fediembedi-disconnect'])) {
switch ($_GET['fediembedi-disconnect']) {
case 'mastodon':
update_option('fediembedi-mastodon-token', '');
break;
case 'pixelfed':
update_option('fediembedi-pixelfed-token', '');
break;
}
}
$mastodon_instance = null;
$mastodon_token = get_option('fediembedi-mastodon-token');
$pixelfed_instance = null;
$pixelfed_token = get_option('fediembedi-pixelfed-token');
if (isset($_POST['save'])) {
$is_valid_nonce = wp_verify_nonce($_POST['_wpnonce'], 'fediembedi-configuration');
if ($is_valid_nonce) {
$instance = esc_url($_POST['instance']);
$instance_type = esc_attr($_POST['instance_type']);
$client = new \FediClient($instance);
$redirect_url = get_admin_url() . '?instance_type=' . $instance_type;
$auth_url = $client->register_app($redirect_url);
if ($auth_url == "ERROR") {
update_option(
'fediembedi-notice',
serialize(
array(
'message' => '<strong>FediEmbedi</strong> : ' . __('The given instance url belongs to an unrecognized service!', 'fediembedi'),
'class' => 'error',
)
)
);
} else {
if (empty($instance)) {
update_option(
'fediembedi-notice',
serialize(
array(
'message' => '<strong>FediEmbedi</strong> : ' . __('Please set your instance before you connect !', 'fediembedi'),
'class' => 'error',
)
)
);
} else {
switch ($instance_type) {
case 'mastodon':
update_option('fediembedi-mastodon-client-id', $client->get_client_id());
update_option('fediembedi-mastodon-client-secret', $client->get_client_secret());
update_option('fediembedi-mastodon-instance', $instance);
$mastodon_account = $client->verify_credentials($mastodon_token);
$account = $mastodon_account;
break;
case 'pixelfed':
update_option('fediembedi-pixelfed-client-id', $client->get_client_id());
update_option('fediembedi-pixelfed-client-secret', $client->get_client_secret());
update_option('fediembedi-pixelfed-instance', $instance);
$pixelfed_account = $client->verify_credentials($pixelfed_token);
$account = $pixelfed_account;
break;
}
//$account = $client->verify_credentials($token);
if (is_null($account) || isset($account->error)) {
echo '<meta http-equiv="refresh" content="0; url=' . $auth_url . '" />';
echo __('Redirect to ', 'fediembedi') . $instance;
exit;
}
//Inform user that save was successfull
update_option(
'fediembedi-notice',
serialize(
array(
'message' => '<strong>FediEmbedi</strong> : ' . __('Configuration successfully saved!', 'fediembedi'),
'class' => 'success',
)
)
);
}
}
$this->admin_notices();
}
}
if (!empty($mastodon_token)) {
$mastodon_instance = get_option('fediembedi-mastodon-instance');
$client = new \FediClient($mastodon_instance);
$mastodon_account = $client->verify_credentials($mastodon_token);
}
if (!empty($pixelfed_token)) {
$pixelfed_instance = get_option('fediembedi-pixelfed-instance');
$client = new \FediClient($pixelfed_instance);
$pixelfed_account = $client->verify_credentials($pixelfed_token);
}
include 'fediembedi-settings-form.tpl.php';
}
/**
* Admin_notices
* Show the notice (error or info)
*
* @return void
*/
public function admin_notices()
{
$notice = unserialize(get_option('fediembedi-notice'));
if (is_array($notice)) {
echo '<div class="notice notice-' . sanitize_html_class($notice['class']) . ' is-dismissible"><p>' . $notice['message'] . '</p></div>';
update_option('fediembedi-notice', null);
}
}
/**
* @param $links
*
* @return array
*/
function fediembedi_add_plugin_page_settings_link( $links ) {
$links[] = '<a href="' . admin_url( 'options-general.php?page=fediembedi' ) . '">' . __('Configuration', 'fediembedi') . '</a>';
$links[] = '<a href="https://git.feneas.org/mediaformat/fediembedi/issues" target="_blank">' . __('Support', 'fediembedi') . '</a>';
return $links;
}
}
$fediconfig = new FediConfig();

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216.4144 232.00976"><path d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915" fill="#3088d4"/><path d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg height="682.68799" viewBox="2799 -911 512 682.688" width="512" xmlns="http://www.w3.org/2000/svg"><g stroke-width="32"><path d="m2799-911v341.344l256-170.656" fill="#211f20"/><path d="m2799-569.656v341.344l256-170.656" fill="#737373"/><path d="m3055-740.344v341.344l256-170.656" fill="#f1680d"/></g></svg>

After

Width:  |  Height:  |  Size: 364 B

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="50px" height="50px" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.3 (57544) - http://www.bohemiancoding.com/sketch -->
<title>icon/color/svg/pixelfed-icon-color</title>
<desc>Created with Sketch.</desc>
<defs>
<rect id="path-1" x="0" y="0.112107623" width="50" height="49.7757848"></rect>
<linearGradient x1="100%" y1="55.8067876%" x2="0%" y2="60.1177402%" id="linearGradient-3">
<stop stop-color="#FF5C34" offset="0%"></stop>
<stop stop-color="#EB0256" offset="100%"></stop>
</linearGradient>
<linearGradient x1="33.0892153%" y1="100%" x2="68.9900955%" y2="15.3101693%" id="linearGradient-4">
<stop stop-color="#A63FDB" offset="0%"></stop>
<stop stop-color="#FF257E" offset="100%"></stop>
</linearGradient>
<linearGradient x1="14.7223019%" y1="50%" x2="94.315299%" y2="67.5256558%" id="linearGradient-5">
<stop stop-color="#00FFF0" offset="0%"></stop>
<stop stop-color="#0087FF" offset="100%"></stop>
</linearGradient>
<linearGradient x1="81.2260936%" y1="10.0128769%" x2="20.8151903%" y2="74.4920673%" id="linearGradient-6">
<stop stop-color="#17C934" offset="0%"></stop>
<stop stop-color="#03FF6E" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="111.913008%" x2="30.5601577%" y2="0%" id="linearGradient-7">
<stop stop-color="#FFB000" offset="0%"></stop>
<stop stop-color="#FF7725" offset="100%"></stop>
</linearGradient>
<path d="M25.8796198,24.6636771 C25.5187511,17.8623246 19.644178,12.6376937 12.7583935,12.9941375 C5.87260905,13.3505813 0.583119676,19.1531217 0.94398835,25.9544743 L0.954359402,26.1499392 C0.924772259,25.6582574 0.909768036,25.162698 0.909768036,24.6636771 C0.909768036,14.5077362 7.12441451,5.78550566 16.0023658,2.00478143 L16.5257487,1.7959139 C22.9188985,-0.755414121 30.1955057,2.29544903 32.7785059,8.61020748 C35.3615061,14.9249659 32.2727696,22.1123491 25.8796198,24.6636771 Z" id="path-8"></path>
<path d="M16.3387661,1.87053346 L16.5257487,1.7959139 C22.9188985,-0.755414121 30.1955057,2.29544903 32.7785059,8.61020748 C35.3615061,14.9249659 32.2727696,22.1123491 25.8796198,24.6636771 C25.8261894,23.6566658 25.6518881,22.6842191 25.3713301,21.7593344 C28.8012958,19.9026454 31.1268503,16.3032843 31.1268503,12.167421 C31.1268503,6.13067623 26.1723508,1.23692769 20.060666,1.23692769 C18.7548626,1.23692769 17.5018839,1.46032366 16.3387661,1.87053346 Z" id="path-9"></path>
<linearGradient x1="-81.3646199%" y1="59.6233723%" x2="121.418067%" y2="72.057922%" id="linearGradient-10">
<stop stop-color="#9EE85D" offset="0%"></stop>
<stop stop-color="#0ED061" offset="100%"></stop>
</linearGradient>
<path d="M28.3794511,9.27014825 L28.5664337,9.1955287 C34.9595835,6.64420067 42.2361907,9.69506383 44.8191909,16.0098223 C47.4021911,22.3245807 44.3134546,29.5119639 37.9203048,32.0632919 C37.8668744,31.0562806 37.6925731,30.0838339 37.4120151,29.1589492 C40.8419808,27.3022602 43.1675353,23.7028991 43.1675353,19.5670358 C43.1675353,13.530291 38.2130358,8.63654249 32.101351,8.63654249 C30.7955476,8.63654249 29.5425689,8.85993845 28.3794511,9.27014825 Z" id="path-11"></path>
<linearGradient x1="45.510285%" y1="116.818646%" x2="0%" y2="-4.0376427%" id="linearGradient-12">
<stop stop-color="#21EFE3" offset="0%"></stop>
<stop stop-color="#2598FF" offset="100%"></stop>
</linearGradient>
<path d="M25.1352415,22.7323503 L25.3222242,22.6577307 C31.7153739,20.1064027 38.9919812,23.1572658 41.5749814,29.4720243 C44.1579816,35.7867827 41.069245,42.9741659 34.6760953,45.5254939 C34.6226649,44.5184826 34.4483636,43.5460359 34.1678055,42.6211512 C37.5977712,40.7644622 39.9233257,37.1651011 39.9233257,33.0292378 C39.9233257,26.992493 34.9688263,22.0987445 28.8571415,22.0987445 C27.5513381,22.0987445 26.2983594,22.3221405 25.1352415,22.7323503 Z" id="path-13"></path>
<linearGradient x1="100%" y1="58.2065614%" x2="-89.649052%" y2="74.3165445%" id="linearGradient-14">
<stop stop-color="#A63FDB" offset="0%"></stop>
<stop stop-color="#FF257E" offset="100%"></stop>
</linearGradient>
<path d="M10.6540931,23.7648224 L10.8410757,23.6902028 C17.2342255,21.1388748 24.5108328,24.1897379 27.093833,30.5044964 C29.6768331,36.8192548 26.5880966,44.006638 20.1949468,46.557966 C20.1415164,45.5509547 19.9672152,44.578508 19.6866571,43.6536233 C23.1166228,41.7969343 25.4421773,38.1975732 25.4421773,34.0617099 C25.4421773,28.0249651 20.4876778,23.1312166 14.375993,23.1312166 C13.0701896,23.1312166 11.8172109,23.3546126 10.6540931,23.7648224 Z" id="path-15"></path>
<path d="M5.54585436,10.6972047 L5.73283698,10.6225852 C12.1259868,8.07125717 19.402594,11.1221203 21.9855942,17.4368788 C24.5685944,23.7516372 21.4798579,30.9390204 15.0867081,33.4903484 C15.0332777,32.483337 14.8589764,31.5108904 14.5784184,30.5860057 C18.0083841,28.7293167 20.3339386,25.1299556 20.3339386,20.9940923 C20.3339386,14.9573475 15.3794391,10.063599 9.26775427,10.063599 C7.9619509,10.063599 6.70897218,10.2869949 5.54585436,10.6972047 Z" id="path-16"></path>
<path d="M35.631732,42.3730981 L40.1765635,42.3730981 C44.4579764,42.3730981 47.9287473,39.0094481 47.9287473,34.8601757 C47.9287473,30.7109033 44.4579764,27.3472534 40.1765635,27.3472534 L33.6170234,27.3472534 C31.1469775,27.3472534 29.1446097,29.2878206 29.1446097,31.6816316 L29.1446097,48.5516086 L35.631732,42.3730981 Z" id="path-17"></path>
<filter x="-26.6%" y="-18.9%" width="153.2%" height="147.2%" filterUnits="objectBoundingBox" id="filter-18">
<feOffset dx="0" dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="1.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.298686594 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icon-copy-9">
<g id="Group">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="Rectangle"></g>
<g id="Group-12" mask="url(#mask-2)">
<g transform="translate(-12.598536, -12.100617)">
<g id="Group-5" stroke-width="1" fill-rule="evenodd" transform="translate(37.298810, 37.253293) rotate(40.000000) translate(-37.298810, -37.253293) translate(11.517560, 12.253293)">
<path d="M25.8796198,24.6636771 C19.1892035,23.016023 12.4132807,27.0374857 10.7451726,33.6458656 C9.07706451,40.2542455 13.1484497,46.9470835 19.8388659,48.5947376 L20.3450373,48.7193929 C9.69088103,46.3380067 1.6209996,37.2282295 0.954359365,26.1499385 L0.94398835,25.9544743 C0.583119676,19.1531217 5.87260905,13.3505813 12.7583935,12.9941375 C19.644178,12.6376937 25.5187511,17.8623246 25.8796198,24.6636771 Z" id="Combined-Shape" fill="url(#linearGradient-3)"></path>
<path d="M25.8796198,24.6636771 C22.3283116,30.5015748 24.2407085,38.0777295 30.1510778,41.5854923 C36.0614471,45.0932551 43.7316521,43.2043076 47.2829602,37.3664099 L47.5182297,36.9796568 C43.2031146,44.3603916 35.1286161,49.3273543 25.8796198,49.3273543 C23.9775953,49.3273543 22.125241,49.1172988 20.3450373,48.7193929 L19.8388659,48.5947376 C13.1484497,46.9470835 9.07706451,40.2542455 10.7451726,33.6458656 C12.4132807,27.0374857 19.1892035,23.016023 25.8796198,24.6636771 Z" id="Combined-Shape-Copy-6" fill="url(#linearGradient-4)"></path>
<path d="M25.8796198,24.6636771 C30.3117909,29.8809656 38.1867277,30.5614853 43.4687835,26.1836605 C48.7508393,21.8058357 49.439807,14.0274595 45.0076359,8.81017106 L44.9061506,8.69070851 C48.612765,12.9940954 50.8494715,18.5708837 50.8494715,24.6636771 C50.8494715,29.1494627 49.6370515,33.3555446 47.5182297,36.9796568 L47.2829602,37.3664099 C43.7316521,43.2043076 36.0614471,45.0932551 30.1510778,41.5854923 C24.2407085,38.0777295 22.3283116,30.5015748 25.8796198,24.6636771 Z" id="Combined-Shape-Copy-5" fill="url(#linearGradient-5)"></path>
<path d="M25.8796198,24.6636771 C32.2727696,22.1123491 35.3615061,14.9249659 32.7785059,8.61020748 C30.1955057,2.29544903 22.9188985,-0.755414121 16.5257487,1.7959139 L16.0023658,2.00478143 C19.0317193,0.714714639 22.3711681,0 25.8796198,0 C33.5016588,0 40.3260608,3.37321498 44.9061506,8.69070851 L45.0076359,8.81017106 C49.439807,14.0274595 48.7508393,21.8058357 43.4687835,26.1836605 C38.1867277,30.5614853 30.3117909,29.8809656 25.8796198,24.6636771 Z" id="Combined-Shape-Copy-4" fill="url(#linearGradient-6)"></path>
<g id="Combined-Shape-Copy-3" fill="url(#linearGradient-7)">
<use xlink:href="#path-8"></use>
<use fill-opacity="0.1" style="mix-blend-mode: multiply;" xlink:href="#path-8"></use>
</g>
<g id="Combined-Shape" opacity="0.504910714">
<use fill="url(#linearGradient-7)" xlink:href="#path-9"></use>
<use fill-opacity="0.496178668" fill="#000000" style="mix-blend-mode: overlay;" xlink:href="#path-9"></use>
</g>
<g id="Combined-Shape-Copy-7" opacity="0.544252232" transform="translate(37.055527, 20.178799) rotate(72.000000) translate(-37.055527, -20.178799) ">
<use fill="url(#linearGradient-10)" xlink:href="#path-11"></use>
<use fill-opacity="0.499886775" fill="#000000" style="mix-blend-mode: overlay;" xlink:href="#path-11"></use>
</g>
<g id="Combined-Shape-Copy-8" opacity="0.562220982" transform="translate(33.811317, 33.641001) rotate(143.000000) translate(-33.811317, -33.641001) ">
<use fill="url(#linearGradient-12)" xlink:href="#path-13"></use>
<use fill="#000000" style="mix-blend-mode: overlay;" xlink:href="#path-13"></use>
</g>
<g id="Combined-Shape-Copy-9" opacity="0.584151786" transform="translate(19.330169, 34.673473) rotate(217.000000) translate(-19.330169, -34.673473) ">
<use fill="url(#linearGradient-14)" xlink:href="#path-15"></use>
<use fill-opacity="0.503085371" fill="#000000" style="mix-blend-mode: overlay;" xlink:href="#path-15"></use>
</g>
<g id="Combined-Shape-Copy-10" opacity="0.180133929" transform="translate(14.221930, 21.605855) rotate(-71.000000) translate(-14.221930, -21.605855) ">
<use fill="url(#linearGradient-3)" xlink:href="#path-16"></use>
<use fill-opacity="0.772843071" fill="#000000" style="mix-blend-mode: multiply;" xlink:href="#path-16"></use>
</g>
</g>
<g id="Path-6-Copy-2" fill-rule="nonzero">
<use fill="black" fill-opacity="1" filter="url(#filter-18)" xlink:href="#path-17"></use>
<use fill="#FFFFFF" xlink:href="#path-17"></use>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg4485"
width="209.00002"
height="334"
viewBox="0 0 209.00002 334"
sodipodi:docname="pleroma_logo_vector_nobg_nopad.svg"
inkscape:version="0.92.1 r15371">
<metadata
id="metadata4491">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4489" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1387"
id="namedview4487"
showgrid="false"
inkscape:zoom="2"
inkscape:cx="49.747283"
inkscape:cy="227.83408"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4485" />
<g
id="g4612"
transform="translate(-152,-89)">
<path
sodipodi:nodetypes="cccccc"
inkscape:connector-curvature="0"
id="path4495"
d="M 235,89 V 423 H 152 V 115 l 26,-26 z"
style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.17587938" />
<circle
r="26"
cx="178"
cy="115"
id="path4497"
style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.17587938" />
<circle
r="26"
cx="335"
cy="230"
id="path4497-0"
style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.17587938" />
<path
sodipodi:nodetypes="cccccc"
inkscape:connector-curvature="0"
id="path4516"
d="M 277,256 V 89 l 84,3e-6 L 361.00002,230 335,256 Z"
style="fill:#fba457;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
r="26"
cx="335"
cy="397"
id="path4497-0-6"
style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#009bff;stroke-width:0;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.17587938" />
<path
sodipodi:nodetypes="cccccc"
inkscape:connector-curvature="0"
id="path4516-5"
d="m 277,423 v -83 h 84 l 2e-5,57 L 335,423 Z"
style="opacity:1;fill:#fba457;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -0,0 +1,143 @@
# FediEmbedi
>Display your Fediverse timeline in a widget
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
* [Mastodon](http://joinmastodon.org/)
* [Pleroma](https://git.pleroma.social/pleroma)
* [Pixelfed](https://pixelfed.org/)
* [PeerTube](https://joinpeertube.org/)
### Planned supported software
* See the [board](https://git.feneas.org/mediaformat/fediembedi/-/boards)
* [Suggestions](https://git.feneas.org/mediaformat/fediembedi/issues)?
### Development
For the time being development will happen on [git.feneas.org](https://git.feneas.org/mediaformat/fediembedi).
### Updates
The plugin is under active development, to keep FediEmbedi updated install [Github Updater](https://github.com/afragen/github-updater) as a companion plugin, and it will manage updates from within your Wordpress installation.
## Installation
Typical installation procedure
e.g.
1. Upload `fediembedi` to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Connect to your fediverse instance by visiting the configuration page in Settings -> FediEmbedi
## Frequently Asked Questions
### Does this plugin store my login info?
No, this plugin uses [OAuth 2.0](https://oauth.net/). You will be sent to login to your Instance
and redirected to your site with a secure token. Similar to how you would connect a mobile app to your account.
## 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
* Emoji support
### 0.8.5
* CSS for small columns
### 0.8.4
* Fix large video player
### 0.8.3
* version bump
### 0.8.2
* Add Support links
### 0.8.1
* CSS fix
### 0.8.0
* Support PeerTube
* Support separate Mastodon, Pixelfed and PeerTube widgets.
### 0.7.2
* Renamed some classes and constants, and reorganized file structure
### 0.7.1
* Fixed version info preventing auto-updates
### 0.7.0
* Added Pixelfed /embed styles
* Added i18n support to template strings
### 0.6.0
* Updated settings page, with links for finding an instance to join/register
* Clarify widget options
### 0.5.0
* Mirror plugin on Github for use with [Github Updater](https://github.com/afragen/github-updater)
### 0.4.1
* Readme updates
### 0.4.0
* Fix for Github updates
### 0.3.0
* Refactor Instance selection and logic
* Updated readme.txt
* Fixed reame.md formatting
* Cleaned up settings form
### 0.2.0
* Make an actual release.
### 0.1.0
* Initial commit.
## Credits
### Mastodon Autopost
The client connection code is based on [Mastodon Autopost](https://wordpress.org/plugins/autopost-to-mastodon/).
### FediEmbedi
The name FediEmbedi was contributed by [wake.st](https://wake.st/@liaizon)

View File

@ -0,0 +1,149 @@
=== Plugin Name ===
Contributors: dj_angola
Donate link: https://paypal.me/MediaFormat
Tags: mastodon, pixelfed, fediverse, activitypub, widget, shortcode
Requires at least: 5.1
Tested up to: 5.3.2
Requires PHP: 7.2
Stable tag: 4.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Display your Fediverse timeline in a widget
== Description ==
> FediEmbedi is beta software.
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 =
* [Mastodon](http://joinmastodon.org/)
* [Pleroma](https://git.pleroma.social/pleroma)
* [Pixelfed](https://pixelfed.org/)
* [PeerTube](https://joinpeertube.org/)
= Planned supported software =
* See the [board](https://git.feneas.org/mediaformat/fediembedi/-/boards)
* [Suggestions](https://git.feneas.org/mediaformat/fediembedi/issues)?
= Development =
For the time being development will happen on [git.feneas.org](https://git.feneas.org/mediaformat/fediembedi "FediEmbedi").
= Updates =
The plugin is under active development, to keep FediEmbedi updated install [Github Updater](https://github.com/afragen/github-updater)
as a companion plugin, and it will manage updates from within your Wordpress installation.
== Installation ==
Typical installation procedure
e.g.
1. Upload `fediembedi` to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Connect to your fediverse instance by visiting the configuration page in Settings -> FediEmbedi
or using Github Updater
1. Settings -> Github Updater
1. Install plugin tab -> Plugin URI = `https://github.com/mediaformat/fediembedi`
== Frequently Asked Questions ==
= Does this plugin store my login info? =
No, this plugin uses [OAuth 2.0](https://oauth.net/). You will be sent to login to your Instance
and redirected to your site with a secure token. Similar to how you would connect a mobile app to your account.
== 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 =
* Emoji support
= 0.8.5 =
* CSS for small columns
= 0.8.4 =
* Fix large video player
= 0.8.3 =
* version bump
= 0.8.2 =
* Add Support links
= 0.8.1 =
* CSS fix
= 0.8.0 =
* Support PeerTube
* Support separate Mastodon, Pixelfed and PeerTube widgets.
= 0.7.2 =
* Renamed some classes and constants, and reorganized file structure
= 0.7.1 =
* Fix version info
= 0.7.0 =
* Added Pixelfed /embed styles
* Added i18n support to template strings
= 0.6.0 =
* Updated settings page, with links for finding an instance to join/register
* Clarify widget options
= 0.5.0 =
* Mirror plugin on Github for use with [Github Updater](https://github.com/afragen/github-updater)
= 0.4.0 =
* Fix for Github updates
= 0.3.0 =
* Refactor Instance selection and logic
* Updated readme.txt
* Fixed reame.md formatting
* Cleaned up settings form
= 0.2.0 =
* Make an actual release.
= 0.1.0 =
* Initial commit.
== Credits ==
* Mastodon Autopost
The client connection code is based on [Mastodon Autopost](https://wordpress.org/plugins/autopost-to-mastodon/).
* FediEmbedi
The name FediEmbedi was contributed by [wake.st](https://wake.st/).

View File

@ -0,0 +1,100 @@
.spacer{
margin-top: 20px;
}
.m-avatar{
float:left;
border-radius: 100px;
margin-right: 20px;
width: 60px;
}
.details{
float:left;
}
.connected{
color: #000;
font-size: 16px;
font-weight:bold;
margin-bottom: 10px;
}
.disconnected{
color: #FF0000;
font-size: 16px;
text-align: center;
width: 100%;
}
.account{
border: 1px solid #000;
padding: 15px;
border-radius:4px;
float:left;
margin: 0 0 1em;
min-width: 300px;
}
label{
display:inline-block;
vertical-align: bottom;
text-align:center;
}
.pixelfed {
background: url('img/pixelfed.svg') no-repeat 0 0;
background-size: 30px;
border: none;
border-radius: 50%;
color: transparent;
display: inline-block;
height: 32px;
width: 36px;
vertical-align: middle;
}
.account span.pixelfed {
float: left;
margin-left: -41px;
background-size: 30px;
margin-top: 41px;
}
.mastodon {
background: url('img/mastodon.svg') no-repeat 1px 4px;
background-size: 28px;
border: none;
color: transparent;
display: inline-block;
height: 36px;
width: 36px;
vertical-align: middle;
}
.account span.mastodon {
float: left;
margin-left: -41px;
background-size: 30px;
margin-top: 41px;
}
.peertube {
background: url('img/peertube.svg') no-repeat 7px 4px;
background-size: 24px;
border: none;
color: transparent;
display: inline-block;
height: 36px;
width: 36px;
vertical-align: middle;
}
.instance_url {
max-width: 500px;
}
.instance_type.widefat {
max-width: 160px;
vertical-align: baseline;
}

View File

@ -0,0 +1,115 @@
<!-- mastodon -->
<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">
<div class="account__header">
<div class="account__header__image">
<div class="account__header__info"></div>
<?php if ($account->header): echo "<img src=" . $account->header . " loading='lazy'>"; endif; ?>
</div>
<div class="account__header__bar">
<div class="account__header__tabs">
<a href="<?php echo $account->url; ?>" class="avatar" rel="noreferrer noopener" target="_blank">
<div class="account__avatar" style="width:90px; height: 90px; background-image: url('<?php echo $account->avatar; ?>'); background-size: cover;"></div>
</a>
<div class="spacer"></div>
<div class="account__header__tabs__buttons">
<a href="<?php echo $account->url; ?>" rel="noreferrer noopener" class="button logo-button"><?php _e('Follow', 'fediembedi'); ?></a>
</div>
</div>
<div class="account__header__tabs__name">
<h1>
<span><?php echo apply_filters('fedi_emoji', $account->display_name, $account->emojis); ?></span>
<small><a href="<?php echo $account->url; ?>" target="_blank" rel="noreferrer noopener"><?php echo $account->url; ?></a></small>
</h1>
</div>
<div class="account__header__extra">
<div class="account__header__bio">
<div class="account__header__content">
<?php echo apply_filters('fedi_emoji', $account->note, $account->emojis); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php foreach ($status as $statut) { ?>
<article>
<div tabindex="-1">
<div class="status__wrapper status__wrapper-public focusable" tabindex="0">
<div class="status__prepend">
<?php
if(!is_null($statut->reblog)): ?>
<div class="status__prepend-icon-wrapper"><i role="img" class="fa fa-retweet status__prepend-icon fa-fw"></i></div>
</div><?php
else: echo '</div>';
endif; ?>
<div class="status status-public">
<div class="status__info">
<a href="<?php if(is_null($statut->reblog)): echo $statut->url; else: echo $statut->reblog->url; endif; ?>" class="status__relative-time" target="_blank" rel="noopener">
<time datetime="<?php echo $statut->created_at; ?>"><?php
printf( _x( '%1$s ago', '%2$s = human-readable time difference', 'fediembedi' ),
human_time_diff(
wp_date("U", strtotime($statut->created_at))
)
);
?></time>
</a>
<a href="<?php if(is_null($statut->reblog)): echo $statut->account->url; else: echo $statut->reblog->account->url; endif; ?>" class="status__display-name" rel="noopener noreferrer" target="_blank">
<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>
<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>
</div>
<div class="status__content"><?php
if(!is_null($statut->reblog)):
$statut = $statut->reblog;
endif;
if(empty($statut->spoiler_text)):
echo apply_filters('fedi_emoji', $statut->content, $statut->emojis);
if(!is_null($statut->card)): ?>
<a href="<?php echo $statut->card->url; ?>" class="status-card compact" target="_blank" rel="noopener noreferrer">
<div class="status-card__image"><div class="status-card__image-image" style="background-image: url(<?php echo $statut->card->image; ?>);"></div></div>
<div class="status-card__content">
<strong class="status-card__title" title="<?php echo $statut->card->title; ?>"><?php echo htmlentities($statut->card->title); ?></strong>
<p class="status-card__description"><?php echo wp_trim_words(htmlentities($statut->card->description), 10); ?></p>
<span class="status-card__host"><?php echo $statut->card->url; ?></span>
</div>
</a>
<?php
endif;
else: echo '<details><summary>' . apply_filters('fedi_emoji', $statut->spoiler_text, $statut->emojis) . '</summary>'. apply_filters('fedi_emoji', $statut->content, $statut->emojis) . '</details>';
endif;
if(!empty($statut->media_attachments)):
foreach ($statut->media_attachments as $attachment) {
if (!empty($attachment->preview_url) && $attachment->type === 'image'): ?>
<img src="<?php echo $attachment->preview_url; ?>" class="media-gallery__item" alt="<?php echo $attachment->description; ?>" loading="lazy">
<?php elseif($attachment->type === 'video'): ?>
<video src="<?php echo $attachment->url; ?>" controls poster="<?php echo $attachment->preview_url; ?>" class='media-gallery__item' alt="<?php echo $attachment->description; ?>">
<?php elseif($attachment->type === 'audio'): ?>
<audio src="<?php echo $attachment->url; ?>" controls poster="<?php echo $attachment->preview_url; ?>" class='media-gallery__item' alt="<?php echo $attachment->description; ?>">
<?php endif;
}
endif;
?></div>
</div>
</div>
</div>
</article>
<?php } ?>
</div>
</div>
<?php

View File

@ -0,0 +1,54 @@
<!-- peertube -->
<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">
<div class="actor">
<img class="avatar" alt="Avatar" src="<?php echo esc_url($account->host) . $account->avatar->path; ?>" loading='lazy'>
<div class="actor-info">
<div class="actor-names">
<a href="<?php echo $account->url; ?>" class="actor-display-link" rel="noreferrer noopener" target="_blank">
<div class="actor-display-name"><?php echo $account->displayName; ?></div>
</a>
<div class="actor-name"><?php echo $account->name; ?></div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="videos">
<?php foreach ($status->data as $statut) : ?>
<article class="video">
<div class="video-inner">
<div class="video-miniature">
<a href="<?php echo esc_url($account->host) . '/videos/watch/' . $statut->uuid; ?>" title="<?php echo $statut->name; ?>" class="video-thumbnail" target="_blank" rel="noopener">
<img src="<?php echo esc_url($account->host) . $statut->previewPath; ?>">
<div class="video-thumbnail-duration-overlay"><?php echo ($statut->duration > 3600 ? gmdate("g:i:s", $statut->duration) : gmdate("i:s", $statut->duration)); ?></div>
<div class="play-overlay">
<div class="icon"></div>
</div>
</a>
</div>
<div class="video-bottom">
<div class="video-miniature-information">
<a class="video-miniature-name" title="<?php echo $statut->name; ?>" href="<?php echo esc_url($account->host) . '/videos/watch/' . $statut->uuid; ?>"><?php echo $statut->name; ?></a>
<div class="video-miniature-created-at-views">
<time datetime="<?php echo $statut->publishedAt; ?>"><?php
printf( _x( '%1$s ago', '%2$s = human-readable time difference', 'fediembedi' ),
human_time_diff(
wp_date("U", strtotime($statut->publishedAt))
)
);
?></time>
<span class="views"><?php printf( _x( '%1$s views', '%2$s = number of views', 'fediembedi' ), $statut->views); ?></span>
</div>
<!-- <a class="video-miniature-account" href="<?php echo esc_url($account->host) . $account->avatar->path; ?>"><?php echo $statut->account->name; ?></a> -->
</div>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
</div>
</div>
<?php

View File

@ -0,0 +1,63 @@
<!-- pixelfed -->
<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): ?>
<div class="pixelfed-header card-header d-inline-flex align-items-center justify-content-between bg-white">
<div class="pixelfed-account">
<img src="<?php echo $account->avatar; ?>" height="32px" width="32px" style="border-radius: 32px;">
<a href="<?php echo $account->url; ?>" class="username font-weight-bold pl-2 text-dark" rel="noreferrer noopener" target="_blank"><?php echo $account->username; ?></a>
</div>
<div class="pixelfed-instance">
<a class="small font-weight-bold text-muted pr-1" href="<?php echo $instance_url; ?>"><?php echo parse_url($instance_url, PHP_URL_HOST); ?></a>
<img src="<?php echo plugin_dir_url( __FILE__ ) . '../img/pixelfed.svg';?>" width="26px" loading="lazy">
</div>
</div>
<?php endif; ?>
<div class="pixelfed-body card-body pb-1">
<div class="pixelfed-meta d-flex justify-content-between align-items-center">
<div class="text-center">
<div class="mb-0 font-weight-bold prettyCount"><?php echo $account->statuses_count; ?></div>
<div class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Posts', 'fediembedi'); ?></div>
</div>
<div class="text-center">
<div class="mb-0 font-weight-bold prettyCount"><?php echo $account->followers_count; ?></div>
<div class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Followers', 'fediembedi'); ?></div>
</div>
<div class="text-center">
<div class="mb-0 font-weight-bold prettyCount"><?php echo $account->following_count; ?></div>
<div class="mb-0 text-muted text-uppercase small font-weight-bold"><?php _e('Following', 'fediembedi'); ?></div>
</div>
<div class="text-center">
<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>
</div>
</div>
</div>
<div class="pixelfed-images row mt-4 mb-1 px-1">
<?php foreach ($status as $statut) { ?>
<article class="col-4 mt-2 px-0"><?php
$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">
<div class="square">
<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>
</a><?php
elseif($attachment->type === 'video'): ?>
<video src="<?php echo $attachment->url; ?>" controls poster="<?php echo $attachment->preview_url; ?>" class='media-gallery__item' alt="<?php echo $attachment->description; ?>">
<?php endif; ?>
</article>
<?php } ?>
</div>
</div>
<div class="pixelfed-footer card-footer bg-white">
<div class="text-center mb-0">
<a href="<?php echo $account->url; ?>" class="font-weight-bold" target="_blank" rel="noreferrer noopener"><?php _e('View More Posts', 'fediembedi'); ?></a>
</div>
</div>
</div>
</div>
</div>
<?php

View File

@ -0,0 +1,28 @@
<?php
if (!defined('WP_UNINSTALL_PLUGIN')) {
die;
}
delete_option( 'fediembedi-notice' );
//original options < 0.8.0
delete_option( 'fediembedi-client-id' );
delete_option( 'fediembedi-client-secret' );
delete_option( 'fediembedi-token' );
delete_option( 'fediembedi-instance' );
delete_option( 'fediembedi-instance-info' );
delete_option( 'fediembedi-instance-type' );
//pixelfed
delete_option('fediembedi-pixelfed-client-id');
delete_option('fediembedi-pixelfed-client-secret');
delete_option('fediembedi-pixelfed-token');
delete_option('fediembedi-pixelfed-instance');
delete_option('fediembedi-pixelfed-token');
//mastodon
delete_option('fediembedi-mastodon-client-id');
delete_option('fediembedi-mastodon-client-secret');
delete_option('fediembedi-mastodon-token');
delete_option('fediembedi-mastodon-instance');
delete_option('fediembedi-mastodon-token');