Skip to content

Commit f1d26f9

Browse files
author
roadiz-ci
committed
Merge tag v2.7.32 into develop
1 parent dd8ae8f commit f1d26f9

14 files changed

Lines changed: 188 additions & 0 deletions

src/MediaFinders/AbstractApplePodcastEmbedFinder.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ public function getSource(array &$options = []): string
107107
return $this->embedId;
108108
}
109109

110+
#[\Override]
111+
public function getPublicUri(): ?string
112+
{
113+
if (1 === preg_match(static::$idPattern, $this->embedId, $matches)) {
114+
return 'https://podcasts.apple.com/'.$matches['path'];
115+
}
116+
117+
return null;
118+
}
119+
110120
#[\Override]
111121
public function getShortType(): string
112122
{

src/MediaFinders/AbstractDailymotionEmbedFinder.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,16 @@ public function getSource(array &$options = []): string
152152

153153
return 'https://geo.dailymotion.com/player.html?'.http_build_query($queryString);
154154
}
155+
156+
#[\Override]
157+
public function getPublicUri(): ?string
158+
{
159+
if (1 === preg_match(static::$idPattern, $this->embedId, $matches)) {
160+
$embedId = $matches['id'];
161+
} else {
162+
$embedId = $this->embedId;
163+
}
164+
165+
return 'https://www.dailymotion.com/video/'.$embedId;
166+
}
155167
}

src/MediaFinders/AbstractDeezerEmbedFinder.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ public function getSource(array &$options = []): string
164164
return $baseUri.'?'.http_build_query($queryString);
165165
}
166166

167+
#[\Override]
168+
public function getPublicUri(): ?string
169+
{
170+
if (preg_match(static::$realIdPattern, $this->embedId, $matches)) {
171+
return 'https://www.deezer.com/'.$this->embedId;
172+
}
173+
if (preg_match(static::$idPattern, $this->embedId, $matches)) {
174+
return 'https://www.deezer.com/'.$matches['type'].'/'.$matches['id'];
175+
}
176+
177+
return null;
178+
}
179+
167180
#[\Override]
168181
protected function areDuplicatesAllowed(): bool
169182
{

src/MediaFinders/AbstractEmbedFinder.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ public function getSource(array &$options = []): string
115115
return '';
116116
}
117117

118+
/**
119+
* Get the original public media URL (permalink), not the iframe/embed source.
120+
*/
121+
#[\Override]
122+
public function getPublicUri(): ?string
123+
{
124+
return null;
125+
}
126+
118127
/**
119128
* Crawl an embed API to get a Json feed.
120129
*/

src/MediaFinders/AbstractMixcloudEmbedFinder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ public function getSource(array &$options = []): string
130130
return 'https://www.mixcloud.com/widget/iframe/?'.http_build_query($queryString);
131131
}
132132

133+
#[\Override]
134+
public function getPublicUri(): ?string
135+
{
136+
return $this->embedId;
137+
}
138+
133139
#[\Override]
134140
protected function areDuplicatesAllowed(): bool
135141
{

src/MediaFinders/AbstractPodEducEmbedFinder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,10 @@ public function getSource(array &$options = []): string
155155

156156
return $this->embedId.'?'.http_build_query($queryString);
157157
}
158+
159+
#[\Override]
160+
public function getPublicUri(): ?string
161+
{
162+
return $this->embedId;
163+
}
158164
}

src/MediaFinders/AbstractSoundcloudEmbedFinder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ public function getSource(array &$options = []): string
149149
return 'https://w.soundcloud.com/player/?'.http_build_query($queryString);
150150
}
151151

152+
#[\Override]
153+
public function getPublicUri(): ?string
154+
{
155+
// getFeed() mutates $embedId to an api.soundcloud.com URL,
156+
// so prefer the original public URL captured in $embedUrl.
157+
return $this->embedUrl ?? $this->embedId;
158+
}
159+
152160
#[\Override]
153161
protected function areDuplicatesAllowed(): bool
154162
{

src/MediaFinders/AbstractSpotifyEmbedFinder.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,19 @@ public function getSource(array &$options = []): string
139139
return $this->embedId;
140140
}
141141

142+
#[\Override]
143+
public function getPublicUri(): ?string
144+
{
145+
if (preg_match(static::$realIdPattern, $this->embedId, $matches)) {
146+
return 'https://open.spotify.com/'.$this->embedId;
147+
}
148+
if (preg_match(static::$idPattern, $this->embedId, $matches)) {
149+
return 'https://open.spotify.com/'.$matches['type'].'/'.$matches['id'];
150+
}
151+
152+
return null;
153+
}
154+
142155
#[\Override]
143156
protected function areDuplicatesAllowed(): bool
144157
{

src/MediaFinders/AbstractTedEmbedFinder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,10 @@ public function getSource(array &$options = []): string
9898

9999
return $this->embedId;
100100
}
101+
102+
#[\Override]
103+
public function getPublicUri(): ?string
104+
{
105+
return $this->embedId;
106+
}
101107
}

src/MediaFinders/AbstractVimeoEmbedFinder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,10 @@ public function getSource(array &$options = []): string
177177

178178
return 'https://player.vimeo.com/video/'.$this->embedId.'?'.http_build_query($queryString);
179179
}
180+
181+
#[\Override]
182+
public function getPublicUri(): ?string
183+
{
184+
return 'https://vimeo.com/'.$this->embedId;
185+
}
180186
}

0 commit comments

Comments
 (0)