mirror of
https://github.com/friendica/friendica
synced 2025-02-03 16:18:51 +00:00
Fix code style Media.php
This commit is contained in:
parent
503e33a683
commit
8d1971e0b2
1 changed files with 96 additions and 85 deletions
|
@ -90,6 +90,7 @@ class Media
|
|||
}
|
||||
|
||||
$media['url'] = Network::sanitizeUrl($media['url']);
|
||||
|
||||
$media = self::unsetEmptyFields($media);
|
||||
$media = DI::dbaDefinition()->truncateFieldsForTable('post-media', $media);
|
||||
|
||||
|
@ -614,6 +615,7 @@ class Media
|
|||
if (self::isLinkToImagePage($picture[1], $picture[2])) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
$image = str_replace(['-1.', '-2.'], '-0.', $picture[2]);
|
||||
|
||||
$attachments[$image] = [
|
||||
'uri-id' => $uriid,
|
||||
'type' => self::IMAGE,
|
||||
|
@ -623,6 +625,7 @@ class Media
|
|||
];
|
||||
} elseif (self::isLinkToPhoto($picture[1], $picture[2])) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
|
||||
$attachments[$picture[1]] = [
|
||||
'uri-id' => $uriid,
|
||||
'type' => self::IMAGE,
|
||||
|
@ -632,6 +635,7 @@ class Media
|
|||
];
|
||||
} elseif ($removepicturelinks) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
|
||||
$attachments[$picture[1]] = [
|
||||
'uri-id' => $uriid,
|
||||
'type' => self::UNKNOWN,
|
||||
|
@ -646,6 +650,7 @@ class Media
|
|||
if (preg_match_all("/\[img=([^\[\]]*)\]([^\[\]]*)\[\/img\]$endmatchpattern/Usi", $body, $pictures, PREG_SET_ORDER)) {
|
||||
foreach ($pictures as $picture) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
|
||||
$attachments[$picture[1]] = ['uri-id' => $uriid, 'type' => self::IMAGE, 'url' => $picture[1], 'description' => $picture[2]];
|
||||
}
|
||||
}
|
||||
|
@ -655,6 +660,7 @@ class Media
|
|||
if (self::isLinkToImagePage($picture[1], $picture[2])) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
$image = str_replace(['-1.', '-2.'], '-0.', $picture[2]);
|
||||
|
||||
$attachments[$image] = [
|
||||
'uri-id' => $uriid,
|
||||
'type' => self::IMAGE,
|
||||
|
@ -664,6 +670,7 @@ class Media
|
|||
];
|
||||
} elseif (self::isLinkToPhoto($picture[1], $picture[2])) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
|
||||
$attachments[$picture[1]] = [
|
||||
'uri-id' => $uriid,
|
||||
'type' => self::IMAGE,
|
||||
|
@ -673,6 +680,7 @@ class Media
|
|||
];
|
||||
} elseif ($removepicturelinks) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
|
||||
$attachments[$picture[1]] = [
|
||||
'uri-id' => $uriid,
|
||||
'type' => self::UNKNOWN,
|
||||
|
@ -687,6 +695,7 @@ class Media
|
|||
if (preg_match_all("/\[img\]([^\[\]]*)\[\/img\]$endmatchpattern/ism", $body, $pictures, PREG_SET_ORDER)) {
|
||||
foreach ($pictures as $picture) {
|
||||
$body = str_replace($picture[0], '', $body);
|
||||
|
||||
$attachments[$picture[1]] = ['uri-id' => $uriid, 'type' => self::IMAGE, 'url' => $picture[1]];
|
||||
}
|
||||
}
|
||||
|
@ -694,6 +703,7 @@ class Media
|
|||
if (preg_match_all("/\[audio\]([^\[\]]*)\[\/audio\]$endmatchpattern/ism", $body, $audios, PREG_SET_ORDER)) {
|
||||
foreach ($audios as $audio) {
|
||||
$body = str_replace($audio[0], '', $body);
|
||||
|
||||
$attachments[$audio[1]] = ['uri-id' => $uriid, 'type' => self::AUDIO, 'url' => $audio[1]];
|
||||
}
|
||||
}
|
||||
|
@ -701,6 +711,7 @@ class Media
|
|||
if (preg_match_all("/\[video\]([^\[\]]*)\[\/video\]$endmatchpattern/ism", $body, $videos, PREG_SET_ORDER)) {
|
||||
foreach ($videos as $video) {
|
||||
$body = str_replace($video[0], '', $body);
|
||||
|
||||
$attachments[$video[1]] = ['uri-id' => $uriid, 'type' => self::VIDEO, 'url' => $video[1]];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue