diff options
author | 2023-09-24 23:07:43 +0200 | |
---|---|---|
committer | 2023-09-24 23:07:43 +0200 | |
commit | e1b911fc1f3416d49c5ad5cc68587f64ab8890eb (patch) | |
tree | 89523756f3e7e72510ca5102f79c18b90e763594 /lib/php8backports.php | |
parent | 09f3c1532adc20c5850e3f0751c24d2b402386d0 (diff) | |
download | rss-bridge-e1b911fc1f3416d49c5ad5cc68587f64ab8890eb.tar.gz rss-bridge-e1b911fc1f3416d49c5ad5cc68587f64ab8890eb.tar.zst rss-bridge-e1b911fc1f3416d49c5ad5cc68587f64ab8890eb.zip |
[CssSelectorBridge] Retrieve metadata for social media embeds (#3602, #3687) (#3706)
* [CssSelectorBridge] Metadata from social embed (#3602, #3687)
Implement the following metadata sources:
- Facebook Open Graph
- Twitter <meta> tags
- Standard <meta> tags
- JSON linked data (ld+json)
The following metadata is supported:
- Canonical URL (may help removing garbage from URLs)
- Article title
- Truncated summary
- Published/Updated timestamp
- Enclosure/Thumbnail image
- Author Name or Twitter handle
SitemapBridge will also automatically benefit from this commit.
* [php8backports] Add array_is_list()
Needed this function for ld+json implementation in CssSelectorBridge.
* [SitemapBridge] Add option to discard thumbnail
* [CssSelectorBridge] Fix linting issues
Diffstat (limited to 'lib/php8backports.php')
-rw-r--r-- | lib/php8backports.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/php8backports.php b/lib/php8backports.php index 30dfdbd9..5b103e3d 100644 --- a/lib/php8backports.php +++ b/lib/php8backports.php @@ -54,3 +54,13 @@ if (!function_exists('str_contains')) { return $needle !== '' && mb_strpos($haystack, $needle) !== false; } } + +if (!function_exists('array_is_list')) { + function array_is_list(array $arr) + { + if ($arr === []) { + return true; + } + return array_keys($arr) === range(0, count($arr) - 1); + } +} |