mirror of
https://github.com/friendica/friendica
synced 2025-04-26 00:30:12 +00:00
Move ACCEPT constants to own "enum" class
This commit is contained in:
parent
c700645385
commit
73c3b21665
35 changed files with 144 additions and 138 deletions
|
@ -38,7 +38,7 @@ use Friendica\Model\ItemURI;
|
|||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClient;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -732,7 +732,7 @@ class OStatus
|
|||
|
||||
self::$conv_list[$conversation] = true;
|
||||
|
||||
$curlResult = DI::httpClient()->get($conversation, [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$curlResult = DI::httpClient()->get($conversation, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
|
||||
return;
|
||||
|
@ -762,7 +762,7 @@ class OStatus
|
|||
}
|
||||
}
|
||||
if ($file != '') {
|
||||
$conversation_atom = DI::httpClient()->get($attribute['href'], [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$conversation_atom = DI::httpClient()->get($attribute['href'], [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if ($conversation_atom->isSuccess()) {
|
||||
$xml = $conversation_atom->getBody();
|
||||
|
@ -876,7 +876,7 @@ class OStatus
|
|||
return;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpClient()->get($self, [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$curlResult = DI::httpClient()->get($self, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
return;
|
||||
|
@ -926,7 +926,7 @@ class OStatus
|
|||
}
|
||||
|
||||
$stored = false;
|
||||
$curlResult = DI::httpClient()->get($related, [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$curlResult = DI::httpClient()->get($related, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
|
||||
return;
|
||||
|
@ -958,7 +958,7 @@ class OStatus
|
|||
}
|
||||
}
|
||||
if ($atom_file != '') {
|
||||
$curlResult = DI::httpClient()->get($atom_file, [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$curlResult = DI::httpClient()->get($atom_file, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::info('Fetched XML for URI ' . $related_uri);
|
||||
|
@ -970,7 +970,7 @@ class OStatus
|
|||
|
||||
// Workaround for older GNU Social servers
|
||||
if (($xml == '') && strstr($related, '/notice/')) {
|
||||
$curlResult = DI::httpClient()->get(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom', [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$curlResult = DI::httpClient()->get(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom', [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::info('GNU Social workaround to fetch XML for URI ' . $related_uri);
|
||||
|
@ -981,7 +981,7 @@ class OStatus
|
|||
// Even more worse workaround for GNU Social ;-)
|
||||
if ($xml == '') {
|
||||
$related_guess = self::convertHref($related_uri);
|
||||
$curlResult = DI::httpClient()->get(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom', [HttpClientOptions::ACCEPT_CONTENT => HttpClient::ACCEPT_ATOM_XML]);
|
||||
$curlResult = DI::httpClient()->get(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom', [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::ATOM_XML]);
|
||||
|
||||
if ($curlResult->isSuccess()) {
|
||||
Logger::info('GNU Social workaround 2 to fetch XML for URI ' . $related_uri);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue