[PLUGIN] Change base class from Module to Plugin for all plugins
This commit is contained in:
parent
a66118aee7
commit
aeabf64051
|
@ -22,7 +22,7 @@ namespace Plugin\Cover;
|
|||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Util\Common;
|
||||
|
||||
|
@ -36,7 +36,7 @@ use App\Util\Common;
|
|||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Cover extends Module
|
||||
class Cover extends Plugin
|
||||
{
|
||||
/**
|
||||
* Map URLs to actions
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
namespace Plugin\Directory;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
|
||||
class Directory extends Module
|
||||
class Directory extends Plugin
|
||||
{
|
||||
/**
|
||||
* Map URLs to Controllers
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
namespace Plugin\EmailNotifications;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
|
||||
class EmailNotifications extends Module
|
||||
class EmailNotifications extends Plugin
|
||||
{
|
||||
public function onAddNotificationTransport(&$form_defs): bool
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
|
@ -13,6 +15,7 @@
|
|||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
/**
|
||||
* OEmbed and OpenGraph implementation for GNU social
|
||||
|
@ -23,16 +26,17 @@
|
|||
* @author Stephen Paul Weber
|
||||
* @author hannes
|
||||
* @author Mikael Nordfeldth
|
||||
* @author Diogo Peralta Cordeiro
|
||||
* @author Miguel Dantas
|
||||
* @author Diogo Peralta Cordeiro
|
||||
* @author Diogo Peralta Cordeiro <mail@diogo.site>
|
||||
* @authir Hugo Sales <hugo@hsal.es>
|
||||
*
|
||||
* @copyright 2014-2021 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Plugin\Embed;
|
||||
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
|
||||
/**
|
||||
* Base class for the Embed plugin that does most of the heavy lifting to get
|
||||
|
@ -41,7 +45,7 @@ use App\Core\Modules\Module;
|
|||
* @copyright 2014-2021 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Embed extends Module
|
||||
class Embed extends Plugin
|
||||
{
|
||||
const PLUGIN_VERSION = '2.1.0';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Plugin\Favourite;
|
|||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
|
@ -32,7 +32,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class Favourite extends Module
|
||||
class Favourite extends Plugin
|
||||
{
|
||||
/**
|
||||
* HTML rendering event that adds the favourite form as a note
|
||||
|
|
|
@ -1,227 +0,0 @@
|
|||
<?php
|
||||
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace Plugin\Media\Controller;
|
||||
|
||||
use App\Core\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Show note attachments
|
||||
*
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Hugo Sales <hugo@hsal.es>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
*
|
||||
* @see http://status.net/
|
||||
*/
|
||||
class Attachment extends Controller
|
||||
{
|
||||
public function handle(Request $request)
|
||||
{
|
||||
return [
|
||||
'_template' => 'doc/tos.html.twig',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Attachment File object to show
|
||||
*/
|
||||
public $attachment;
|
||||
|
||||
public $filehash;
|
||||
public $filepath;
|
||||
public $filesize;
|
||||
public $mimetype;
|
||||
public $filename;
|
||||
|
||||
/**
|
||||
* Load attributes based on database arguments
|
||||
*
|
||||
* Loads all the DB stuff
|
||||
*
|
||||
* @param array $args $_REQUEST array
|
||||
*
|
||||
* @throws ClientException
|
||||
* @throws FileNotFoundException
|
||||
* @throws FileNotStoredLocallyException
|
||||
* @throws InvalidFilenameException
|
||||
* @throws ServerException
|
||||
*
|
||||
* @return bool flag
|
||||
*/
|
||||
protected function prepare(array $args = [])
|
||||
{
|
||||
// parent::prepare($args);
|
||||
|
||||
try {
|
||||
if (!empty($id = $this->trimmed('attachment'))) {
|
||||
$this->attachment = File::getByID((int) $id);
|
||||
} elseif (!empty($this->filehash = $this->trimmed('filehash'))) {
|
||||
$file = File::getByHash($this->filehash);
|
||||
$file->fetch();
|
||||
$this->attachment = $file;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Not found
|
||||
}
|
||||
if (!$this->attachment instanceof File) {
|
||||
// TRANS: Client error displayed trying to get a non-existing attachment.
|
||||
$this->clientError(_m('No such attachment.'), 404);
|
||||
}
|
||||
|
||||
$this->filesize = $this->attachment->size;
|
||||
$this->mimetype = $this->attachment->mimetype;
|
||||
$this->filename = $this->attachment->filename;
|
||||
|
||||
if ($this->attachment->isLocal() || $this->attachment->isFetchedRemoteFile()) {
|
||||
$this->filesize = $this->attachment->getFileOrThumbnailSize();
|
||||
$this->mimetype = $this->attachment->getFileOrThumbnailMimetype();
|
||||
$this->filename = MediaFile::getDisplayName($this->attachment);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this action read-only?
|
||||
*
|
||||
* @param mixed $args
|
||||
*
|
||||
* @return bool true
|
||||
*/
|
||||
public function isReadOnly($args): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string title of the page
|
||||
*/
|
||||
public function title(): string
|
||||
{
|
||||
$a = new self($this->attachment);
|
||||
return $a->title();
|
||||
}
|
||||
|
||||
public function showPage(): void
|
||||
{
|
||||
if (empty($this->filepath)) {
|
||||
// if it's not a local file, gtfo
|
||||
common_redirect($this->attachment->getUrl(), 303);
|
||||
}
|
||||
|
||||
// parent::showPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the content area of the page
|
||||
*
|
||||
* Shows a single notice list item.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showContent(): void
|
||||
{
|
||||
$ali = new self($this->attachment, $this);
|
||||
$ali->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't show page notice
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showPageNoticeBlock(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show aside: this attachments appears in what notices
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showSections(): void
|
||||
{
|
||||
$ns = new AttachmentNoticeSection($this);
|
||||
$ns->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Last-modified date for file
|
||||
*
|
||||
* @throws ServerException
|
||||
*
|
||||
* @return int last-modified date as unix timestamp
|
||||
*/
|
||||
public function lastModified(): ?int
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
return null;
|
||||
}
|
||||
$path = $this->filepath;
|
||||
if (!empty($path)) {
|
||||
return filemtime($path);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* etag header for file
|
||||
*
|
||||
* This returns the same data (inode, size, mtime) as Apache would,
|
||||
* but in decimal instead of hex.
|
||||
*
|
||||
* @throws ServerException
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
public function etag(): ?string
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$path = $this->filepath;
|
||||
|
||||
$cache = Cache::instance();
|
||||
if ($cache) {
|
||||
if (empty($path)) {
|
||||
return null;
|
||||
}
|
||||
$key = Cache::key('attachments:etag:' . $path);
|
||||
$etag = $cache->get($key);
|
||||
if ($etag === false) {
|
||||
$etag = crc32(file_get_contents($path));
|
||||
$cache->set($key, $etag);
|
||||
}
|
||||
return $etag;
|
||||
}
|
||||
|
||||
if (!empty($path)) {
|
||||
$stat = stat($path);
|
||||
return '"' . $stat['ino'] . '-' . $stat['size'] . '-' . $stat['mtime'] . '"';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,291 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* widget for displaying a list of notice attachments
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category UI
|
||||
* @package StatusNet
|
||||
*
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @copyright 2008 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
*
|
||||
* @see http://status.net/
|
||||
*/
|
||||
|
||||
namespace Plugin\Media\media;
|
||||
|
||||
/**
|
||||
* widget for displaying a single notice
|
||||
*
|
||||
* This widget has the core smarts for showing a single notice: what to display,
|
||||
* where, and under which circumstances. Its key method is show(); this is a recipe
|
||||
* that calls all the other show*() methods to build up a single notice. The
|
||||
* ProfileNoticeListItem subclass, for example, overrides showAuthor() to skip
|
||||
* author info (since that's implicit by the data in the page).
|
||||
*
|
||||
* @category UI
|
||||
* @package StatusNet
|
||||
*
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
*
|
||||
* @see http://status.net/
|
||||
* @see NoticeList
|
||||
* @see ProfileNoticeListItem
|
||||
*/
|
||||
class AttachmentListItem
|
||||
{
|
||||
/** The attachment this item will show. */
|
||||
public $attachment;
|
||||
|
||||
/**
|
||||
* @param File $attachment the attachment we will display
|
||||
*/
|
||||
// function __construct(File $attachment, $out=null)
|
||||
// {
|
||||
// // parent::__construct($out);
|
||||
// $this->attachment = $attachment;
|
||||
// }
|
||||
|
||||
public function title()
|
||||
{
|
||||
return $this->attachment->getTitle() ?: MediaFile::getDisplayName($this->attachment);
|
||||
}
|
||||
|
||||
public function linkTitle()
|
||||
{
|
||||
return $this->title();
|
||||
}
|
||||
|
||||
/**
|
||||
* recipe function for displaying a single notice.
|
||||
*
|
||||
* This uses all the other methods to correctly display a notice. Override
|
||||
* it or one of the others to fine-tune the output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
$this->showStart();
|
||||
try {
|
||||
$this->showNoticeAttachment();
|
||||
} catch (Exception $e) {
|
||||
$this->element('div', ['class' => 'error'], $e->getMessage());
|
||||
common_debug($e->getMessage());
|
||||
}
|
||||
$this->showEnd();
|
||||
}
|
||||
|
||||
public function linkAttr()
|
||||
{
|
||||
return [
|
||||
'class' => 'u-url',
|
||||
'href' => $this->attachment->getAttachmentDownloadUrl(),
|
||||
'title' => $this->linkTitle(),
|
||||
];
|
||||
}
|
||||
|
||||
public function showNoticeAttachment()
|
||||
{
|
||||
$this->showRepresentation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show in HTML
|
||||
*/
|
||||
public function showRepresentation()
|
||||
{
|
||||
$enclosure = $this->attachment->getEnclosure();
|
||||
|
||||
if (Event::handle('StartShowAttachmentRepresentation', [$this->out, $this->attachment])) {
|
||||
$this->out->elementStart('label');
|
||||
$this->out->element('a', ['rel' => 'external', 'href' => $this->attachment->getAttachmentUrl()], $this->title());
|
||||
$this->out->elementEnd('label');
|
||||
|
||||
$this->out->element('br');
|
||||
|
||||
try {
|
||||
if (!empty($enclosure->mimetype)) {
|
||||
// First, prepare a thumbnail if it exists.
|
||||
try {
|
||||
// Tell getThumbnail that we can show an animated image if it has one (4th arg, "force_still")
|
||||
$thumb = File_thumbnail::fromFileObject($this->attachment, null, null, false, false);
|
||||
} catch (UseFileAsThumbnailException | UnsupportedMediaException | FileNotFoundException | ServerException $e) {
|
||||
common_debug("AttachmentListItem couldn't find a thumbnail for {$this->attachment->getID()} because {$e->getMessage()}");
|
||||
// This remote file has no local thumbnail.
|
||||
$thumb = null;
|
||||
}
|
||||
|
||||
// Then get the kind of mediatype we're dealing with
|
||||
$mediatype = common_get_mime_media($enclosure->mimetype);
|
||||
|
||||
// FIXME: Get proper mime recognition of Ogg files! If system has 'mediainfo', this should do it:
|
||||
// $ mediainfo --inform='General;%InternetMediaType%'
|
||||
if ($this->attachment->mimetype === 'application/ogg') {
|
||||
$mediatype = 'video'; // because this element can handle Ogg/Vorbis etc. on its own
|
||||
}
|
||||
|
||||
// Ugly hack to show text/html links which have a thumbnail (such as from oEmbed/OpenGraph image URLs)
|
||||
if (!in_array($mediatype, ['image', 'audio', 'video']) && $thumb instanceof File_thumbnail) {
|
||||
$mediatype = 'image';
|
||||
}
|
||||
|
||||
switch ($mediatype) {
|
||||
// Anything we understand as an image, if we need special treatment, do it in StartShowAttachmentRepresentation
|
||||
case 'image':
|
||||
if ($thumb instanceof File_thumbnail) {
|
||||
$this->out->element('img', $thumb->getHtmlAttrs(['class' => 'u-photo', 'alt' => '']));
|
||||
} else {
|
||||
try {
|
||||
// getUrl(true) because we don't want to hotlink, could be made configurable
|
||||
$this->out->element('img', ['class' => 'u-photo',
|
||||
'src' => $this->attachment->getUrl(true),
|
||||
'alt' => $this->attachment->getTitle(), ]);
|
||||
} catch (FileNotStoredLocallyException $e) {
|
||||
//$url = $e->file->getUrl(false);
|
||||
$this->out->element('a', ['href' => $url, 'rel' => 'external'], $url);
|
||||
}
|
||||
}
|
||||
unset($thumb); // there's no need carrying this along after this
|
||||
break;
|
||||
|
||||
// HTML5 media elements
|
||||
case 'audio':
|
||||
case 'video':
|
||||
if ($thumb instanceof File_thumbnail) {
|
||||
$poster = $thumb->getUrl();
|
||||
unset($thumb); // there's no need carrying this along after this
|
||||
} else {
|
||||
$poster = null;
|
||||
}
|
||||
|
||||
$this->out->elementStart($mediatype,
|
||||
['class' => "attachment_player u-{$mediatype}",
|
||||
'poster' => $poster,
|
||||
'controls' => 'controls', ]);
|
||||
$this->out->element('source',
|
||||
['src' => $this->attachment->getUrl(),
|
||||
'type' => $this->attachment->mimetype, ]);
|
||||
$this->out->elementEnd($mediatype);
|
||||
break;
|
||||
|
||||
default:
|
||||
unset($thumb); // there's no need carrying this along
|
||||
switch (common_bare_mime($this->attachment->mimetype)) {
|
||||
case 'text/plain':
|
||||
$this->element('div', ['class' => 'e-content plaintext'],
|
||||
file_get_contents($this->attachment->getPath()));
|
||||
break;
|
||||
case 'text/html':
|
||||
if (!empty($this->attachment->filename)
|
||||
&& (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
|
||||
// Locally-uploaded HTML. Scrub and display inline.
|
||||
$this->showHtmlFile($this->attachment);
|
||||
break;
|
||||
}
|
||||
// Fall through to default if it wasn't a _local_ text/html File object
|
||||
// no break
|
||||
default:
|
||||
Event::handle('ShowUnsupportedAttachmentRepresentation', [$this->out, $this->attachment]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Event::handle('ShowUnsupportedAttachmentRepresentation', [$this->out, $this->attachment]);
|
||||
}
|
||||
} catch (FileNotFoundException $e) {
|
||||
if (!$this->attachment->isLocal()) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::handle('EndShowAttachmentRepresentation', [$this->out, $this->attachment]);
|
||||
}
|
||||
|
||||
protected function showHtmlFile(File $attachment)
|
||||
{
|
||||
$body = $this->scrubHtmlFile($attachment);
|
||||
if ($body) {
|
||||
$this->out->raw($body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed false on failure, HTML fragment string on success
|
||||
*/
|
||||
protected function scrubHtmlFile(File $attachment)
|
||||
{
|
||||
$path = $attachment->getPath();
|
||||
$raw = file_get_contents($path);
|
||||
|
||||
// Normalize...
|
||||
$dom = new DOMDocument();
|
||||
if (!$dom->loadHTML($raw)) {
|
||||
common_log(LOG_ERR, "Bad HTML in local HTML attachment {$path}");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove <script>s or htmlawed will dump their contents into output!
|
||||
// Note: removing child nodes while iterating seems to mess things up,
|
||||
// hence the double loop.
|
||||
$scripts = [];
|
||||
foreach ($dom->getElementsByTagName('script') as $script) {
|
||||
$scripts[] = $script;
|
||||
}
|
||||
foreach ($scripts as $script) {
|
||||
common_log(LOG_DEBUG, $script->textContent);
|
||||
$script->parentNode->removeChild($script);
|
||||
}
|
||||
|
||||
// Trim out everything outside the body...
|
||||
$body = $dom->saveHTML();
|
||||
$body = preg_replace('/^.*<body[^>]*>/is', '', $body);
|
||||
$body = preg_replace('/<\/body[^>]*>.*$/is', '', $body);
|
||||
|
||||
require_once INSTALLDIR . '/extlib/HTMLPurifier/HTMLPurifier.auto.php';
|
||||
$purifier = new HTMLPurifier();
|
||||
return $purifier->purify($body);
|
||||
}
|
||||
|
||||
/**
|
||||
* start a single notice.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showStart()
|
||||
{
|
||||
// XXX: RDFa
|
||||
// TODO: add notice_type class e.g., notice_video, notice_image
|
||||
$this->out->elementStart('li');
|
||||
}
|
||||
|
||||
/**
|
||||
* finish the notice
|
||||
*
|
||||
* Close the last elements in the notice list item
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function showEnd()
|
||||
{
|
||||
$this->out->elementEnd('li');
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// GNU social 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* FIXME
|
||||
*
|
||||
* @category Widget
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Plugin\Media\media;
|
||||
|
||||
/**
|
||||
* FIXME
|
||||
*
|
||||
* These are the widgets that show interesting data about a person * group, or site.
|
||||
*
|
||||
* @category Widget
|
||||
* @package GNUsocial
|
||||
*
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class AttachmentNoticeSection // extends NoticeSection
|
||||
{
|
||||
public function showContent()
|
||||
{
|
||||
// parent::showContent();
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getNotices()
|
||||
{
|
||||
$notice = new Notice;
|
||||
|
||||
$notice->joinAdd(['id', 'file_to_post:post_id']);
|
||||
$notice->whereAdd(sprintf('file_to_post.file_id = %d', $this->out->attachment->id));
|
||||
|
||||
$notice->selectAdd('notice.id');
|
||||
$notice->orderBy('notice.created DESC, notice.id DESC');
|
||||
$notice->find();
|
||||
return $notice;
|
||||
}
|
||||
|
||||
public function title()
|
||||
{
|
||||
// TRANS: Title.
|
||||
return _('Notices where this attachment appears');
|
||||
}
|
||||
|
||||
public function divId()
|
||||
{
|
||||
return 'attachment_section';
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ use App\Core\DB\DB;
|
|||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Entity\Note;
|
||||
use App\Entity\PollResponse;
|
||||
|
@ -48,7 +48,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class Poll extends Module
|
||||
class Poll extends Plugin
|
||||
{
|
||||
/**
|
||||
* Map URLs to actions
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Plugin\ProfileColor;
|
|||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Core\Router\RouteLoader;
|
||||
use App\Util\Common;
|
||||
|
||||
|
@ -36,7 +36,7 @@ use App\Util\Common;
|
|||
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ProfileColor extends Module
|
||||
class ProfileColor extends Plugin
|
||||
{
|
||||
/**
|
||||
* Map URLs to actions
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Plugin\Repeat;
|
|||
use App\Core\DB\DB;
|
||||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\NotFoundException;
|
||||
|
@ -30,7 +30,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class Repeat extends Module
|
||||
class Repeat extends Plugin
|
||||
{
|
||||
/**
|
||||
* HTML rendering event that adds the repeat form as a note
|
||||
|
|
|
@ -25,7 +25,7 @@ use App\Core\DB\DB;
|
|||
use App\Core\Event;
|
||||
use App\Core\Form;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exceptiion\InvalidFormException;
|
||||
|
@ -37,7 +37,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class Reply extends Module
|
||||
class Reply extends Plugin
|
||||
{
|
||||
public function onAddRoute($r)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
// {{{ License
|
||||
// This file is part of GNU social - https://www.gnu.org/software/social
|
||||
//
|
||||
// GNU social is free software: you can redistribute it and/or modify
|
||||
|
@ -13,10 +14,11 @@
|
|||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
||||
// }}}
|
||||
|
||||
namespace Plugin\StoreRemoteMedia;
|
||||
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
|
||||
/**
|
||||
* The StoreRemoteMedia plugin downloads remotely attached files to local server.
|
||||
|
@ -31,7 +33,7 @@ use App\Core\Modules\Module;
|
|||
* @copyright 2015-2016, 2019-2021 Free Software Foundation, Inc http://www.fsf.org
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class StoreRemoteMedia extends Module
|
||||
class StoreRemoteMedia extends Plugin
|
||||
{
|
||||
const PLUGIN_VERSION = '3.0.0';
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
namespace Plugin\TreeNotes;
|
||||
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
use App\Entity\Note;
|
||||
|
||||
class TreeNotes extends Module
|
||||
class TreeNotes extends Plugin
|
||||
{
|
||||
/**
|
||||
* Format the given $notes_in_trees_out in a list of reply trees
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
namespace Plugin\XMPPNotifications;
|
||||
|
||||
use App\Core\Event;
|
||||
use App\Core\Modules\Module;
|
||||
use App\Core\Modules\Plugin;
|
||||
|
||||
class XMPPNotifications extends Module
|
||||
class XMPPNotifications extends Plugin
|
||||
{
|
||||
public function onAddNotificationTransport(&$form_defs): bool
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user