aboutsummaryrefslogtreecommitdiff
path: root/lib/php8backports.php
diff options
context:
space:
mode:
authorGravatar ORelio <ORelio@users.noreply.github.com> 2023-09-24 23:07:43 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-24 23:07:43 +0200
commite1b911fc1f3416d49c5ad5cc68587f64ab8890eb (patch)
tree89523756f3e7e72510ca5102f79c18b90e763594 /lib/php8backports.php
parent09f3c1532adc20c5850e3f0751c24d2b402386d0 (diff)
downloadrss-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.php10
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);
+ }
+}