Fix errors in Content namespace

This commit is contained in:
Art4 2024-12-01 22:53:53 +00:00
parent f628c540a4
commit fb3a3ea7e6
8 changed files with 17 additions and 26 deletions

View file

@ -106,10 +106,9 @@ class ContactSelector
* Determines network name
*
* @param string $network network of the contact
* @param string $profile optional, default empty
* @param string $protocol (Optional) Protocol that is used for the transmission
* @param int $gsid Server id
* @return string
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function networkToName(string $network, string $protocol = '', int $gsid = null): string

View file

@ -41,6 +41,7 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
use ImagickException;
use Psr\Log\LoggerInterface;
class Conversation
@ -112,7 +113,7 @@ class Conversation
* @param array &$conv_responses (already created with builtin activity structure)
* @return void
* @throws ImagickException
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws InternalServerErrorException
*/
public function builtinActivityPuller(array $activity, array &$conv_responses)
{
@ -598,7 +599,7 @@ class Conversation
* @param string $formSecurityToken A 'contact_action' form security token
* @return array
* @throws InternalServerErrorException
* @throws \ImagickException
* @throws ImagickException
*/
public function getThreadList(array $items, string $mode, bool $preview, bool $pagedrop, string $formSecurityToken): array
{

View file

@ -11,6 +11,7 @@ use Friendica\Content\Image\Collection\MasonryImageRow;
use Friendica\Content\Image\Entity\MasonryImage;
use Friendica\Content\Post\Collection\PostMedias;
use Friendica\Core\Renderer;
use Friendica\Network\HTTPException\ServiceUnavailableException;
class Image
{
@ -42,9 +43,7 @@ class Image
}
/**
* @param PostMedias $images
* @return string
* @throws \Friendica\Network\HTTPException\ServiceUnavailableException
* @throws ServiceUnavailableException
*/
private static function getImageGridHtml(PostMedias $images): string
{
@ -70,9 +69,7 @@ class Image
* For each row, we calculate how much of the total width each picture will take depending on their aspect ratio
* and how much relative height it needs to accomodate all pictures next to each other with their height normalized.
*
* @param array $images
* @return string
* @throws \Friendica\Network\HTTPException\ServiceUnavailableException
* @throws ServiceUnavailableException
*/
private static function getHorizontalMasonryHtml(PostMedias $images): string
{

View file

@ -32,6 +32,7 @@ use Friendica\Model\Post;
use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Network\HTTPException;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Object\EMail\ItemCCEMail;
use Friendica\Protocol\Activity;
use Friendica\Util\ACLFormatter;
@ -42,6 +43,7 @@ use Friendica\Util\Profiler;
use Friendica\Util\Proxy;
use Friendica\Util\XML;
use GuzzleHttp\Psr7\Uri;
use ImagickException;
/**
* A content helper class for displaying items
@ -174,8 +176,8 @@ class Item
* @param string $network The network of the post
*
* @return array|bool ['replaced' => $replaced, 'contact' => $contact] or "false" on if already replaced
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
* @throws InternalServerErrorException
* @throws ImagickException
*/
public static function replaceTag(string &$body, int $profile_uid, string $tag, string $network = '')
{
@ -275,7 +277,7 @@ class Item
* @param array $item
* @return void
* @throws ImagickException
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws InternalServerErrorException
*/
public function localize(array &$item)
{
@ -645,11 +647,6 @@ class Item
/**
* Add a share block for the given guid
*
* @param string $guid
* @param integer $uid
* @param bool $add_media
* @return string
*/
private function createSharedPostByGuid(string $guid, bool $add_media): string
{

View file

@ -8,6 +8,7 @@
namespace Friendica\Content;
use DOMDocument;
use DOMElement;
use DOMXPath;
use Exception;
use Friendica\Content\Text\BBCode;
@ -83,6 +84,7 @@ class OEmbed
$xpath->query("//link[@type='application/json+oembed'] | //link[@type='text/json+oembed']")
as $link)
{
/** @var DOMElement $link */
$href = $link->getAttributeNode('href')->nodeValue;
// Both Youtube and Vimeo output OEmbed endpoint URL with HTTP
// but their OEmbed endpoint is only accessible by HTTPS ¯\_(ツ)_/¯

View file

@ -165,7 +165,7 @@ class PostMedia extends BaseEntity
* Get preview path for given media id relative to the base URL
*
* @param string $size One of the Proxy::SIZE_* constants
* @param bool $vlurred If "true", the preview will be blurred
* @param bool $blurred If "true", the preview will be blurred
* @return string preview link
*/
public function getPreviewPath(string $size = '', bool $blurred = false): string

View file

@ -824,11 +824,6 @@ class BBCode
/**
* Convert complex IMG and ZMG elements
*
* @param [type] $text
* @param integer $simplehtml
* @param integer $uriid
* @return string
*/
private static function convertImages(string $text, int $simplehtml, int $uriid = 0): string
{
@ -1113,7 +1108,7 @@ class BBCode
/**
* Removes links
*
* @param string $text HTML/BBCode string
* @param string $bbcode HTML/BBCode string
* @return string Cleaned HTML/BBCode
*/
public static function removeLinks(string $bbcode): string

View file

@ -966,7 +966,7 @@ class HTML
$text = $HTMLPurifier->purify($text);
/** @var \HTMLPurifier_ErrorCollector $errorCollector */
///** @var \HTMLPurifier_ErrorCollector $errorCollector */
// Uncomment to debug HTML Purifier behavior
//$errorCollector = $HTMLPurifier->context->get('ErrorCollector');
//var_dump($errorCollector->getRaw());