mirror of
https://github.com/friendica/friendica
synced 2025-05-02 05:04:24 +02:00
Merge branch '2021.03-rc' into copyright-2021
This commit is contained in:
commit
befc2af504
22 changed files with 41829 additions and 40547 deletions
|
@ -103,6 +103,28 @@ abstract class AbstractLogger implements LoggerInterface
|
|||
return strtr($message, $replace);
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON Encodes an complete array including objects with "__toString()" methods
|
||||
*
|
||||
* @param array $input an Input Array to encode
|
||||
*
|
||||
* @return false|string The json encoded output of the array
|
||||
*/
|
||||
protected function jsonEncodeArray(array $input)
|
||||
{
|
||||
$output = [];
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
if (method_exists($value, '__toString')) {
|
||||
$output[$key] = $value->__toString();
|
||||
} else {
|
||||
$output[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return @json_encode($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -161,8 +161,8 @@ class StreamLogger extends AbstractLogger
|
|||
$logMessage .= $this->channel . ' ';
|
||||
$logMessage .= '[' . strtoupper($level) . ']: ';
|
||||
$logMessage .= $this->psrInterpolate($message, $context) . ' ';
|
||||
$logMessage .= @json_encode($context) . ' - ';
|
||||
$logMessage .= @json_encode($record);
|
||||
$logMessage .= $this->jsonEncodeArray($context) . ' - ';
|
||||
$logMessage .= $this->jsonEncodeArray($record);
|
||||
$logMessage .= PHP_EOL;
|
||||
|
||||
return $logMessage;
|
||||
|
|
|
@ -195,8 +195,8 @@ class SyslogLogger extends AbstractLogger
|
|||
$logMessage .= $this->channel . ' ';
|
||||
$logMessage .= '[' . $this->logToString[$level] . ']: ';
|
||||
$logMessage .= $this->psrInterpolate($message, $context) . ' ';
|
||||
$logMessage .= @json_encode($context) . ' - ';
|
||||
$logMessage .= @json_encode($record);
|
||||
$logMessage .= $this->jsonEncodeArray($context) . ' - ';
|
||||
$logMessage .= $this->jsonEncodeArray($record);
|
||||
|
||||
return $logMessage;
|
||||
}
|
||||
|
|
|
@ -512,7 +512,6 @@ class ParseUrl
|
|||
{
|
||||
if (!empty($siteinfo['images'])) {
|
||||
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
||||
$image = [];
|
||||
// According to the specifications someone could place a picture url into the content field as well.
|
||||
// But this doesn't seem to happen in the wild, so we don't cover it here.
|
||||
if (!empty($image['url'])) {
|
||||
|
@ -525,7 +524,11 @@ class ParseUrl
|
|||
$image['contenttype'] = $photodata['mime'];
|
||||
unset($image['url']);
|
||||
ksort($image);
|
||||
} else {
|
||||
$image = [];
|
||||
}
|
||||
} else {
|
||||
$image = [];
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -711,7 +714,7 @@ class ParseUrl
|
|||
|
||||
array_walk_recursive($siteinfo, function (&$element) {
|
||||
if (is_string($element)) {
|
||||
$element = html_entity_decode($element, ENT_COMPAT, 'UTF-8');
|
||||
$element = trim(strip_tags(html_entity_decode($element, ENT_COMPAT, 'UTF-8')));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue