Fixed NPF, new OAuth library added

This commit is contained in:
Michael 2023-04-04 22:21:27 +00:00
parent ed875a80f7
commit 88cc788c9b
3 changed files with 69 additions and 16 deletions

View file

@ -35,6 +35,7 @@
"friendica/json-ld": "^1.0",
"geekwright/po": "^2.0",
"guzzlehttp/guzzle": "^6.5",
"guzzlehttp/oauth-subscriber": "^0.6",
"kornrunner/blurhash": "^1.2",
"league/html-to-markdown": "^4.8",
"level-2/dice": "^4",

57
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "456d14e3ad9be265c5c9e6172a0d18d8",
"content-hash": "c208d7f5176358ea157f109c1c7d68dd",
"packages": [
{
"name": "asika/simple-console",
@ -967,6 +967,61 @@
],
"time": "2022-06-20T22:16:07+00:00"
},
{
"name": "guzzlehttp/oauth-subscriber",
"version": "0.6.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/oauth-subscriber.git",
"reference": "8d6cab29f8397e5712d00a383eeead36108a3c1f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/oauth-subscriber/zipball/8d6cab29f8397e5712d00a383eeead36108a3c1f",
"reference": "8d6cab29f8397e5712d00a383eeead36108a3c1f",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^6.5|^7.2",
"guzzlehttp/psr7": "^1.7|^2.0",
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0|^9.3.3"
},
"suggest": {
"ext-openssl": "Required to sign using RSA-SHA1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.6-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Subscriber\\Oauth\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle OAuth 1.0 subscriber",
"homepage": "http://guzzlephp.org/",
"keywords": [
"Guzzle",
"oauth"
],
"time": "2021-07-13T12:01:32+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "1.5.2",

View file

@ -185,9 +185,6 @@ class NPF
static private function getLevelByCallstack($callstack): int
{
// Deactivated, since Tumblr seems to have issues with the indent level
return 0;
$level = 0;
foreach ($callstack as $entry) {
if (in_array($entry, ['ol', 'ul', 'blockquote'])) {
@ -235,7 +232,7 @@ class NPF
break;
case 'blockquote':
$subtype = strlen($text) < 100 ? 'quote' : 'indented';
$subtype = mb_strlen($text) < 100 ? 'quote' : 'indented';
break;
case 'pre':
@ -293,10 +290,9 @@ class NPF
'text' => $text,
];
// Deactivated since Tumblr has got issues with it
//if (!empty($formatting)) {
// $block['formatting'] = $formatting;
//}
if (!empty($formatting)) {
$block['formatting'] = $formatting;
}
$level = self::getLevelByCallstack($callstack);
if ($level > 0) {
@ -491,13 +487,14 @@ class NPF
$block = [
'type' => 'text',
'text' => $element->textContent,
// Deactivated, since Tumblr has got issues with the formatting
//'formatting' => [
// 'start' => 0,
// 'end' => strlen($element->textContent),
// 'type' => 'link',
// 'url' => $attributes['href']
//]
'formatting' => [
[
'start' => 0,
'end' => mb_strlen($element->textContent),
'type' => 'link',
'url' => $attributes['href']
]
]
];
}