Skip to content

Commit a0bff1d

Browse files
committed
Merge branch 'master' of github.com:oscarotero/Embed
2 parents 7c8d189 + e02f6f2 commit a0bff1d

18 files changed

+94
-26
lines changed

src/Http/Response.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,15 @@ public function getHtmlContent()
6262

6363
$this->htmlContent = new DOMDocument();
6464

65-
if (mb_detect_encoding($content) === 'UTF-8') {
65+
if (mb_detect_encoding($content, 'UTF-8', true) === 'UTF-8') {
6666
$content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');
67+
$content = preg_replace(
68+
'/<head[^>]*>/',
69+
'<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">',
70+
$content
71+
);
72+
} elseif (mb_detect_encoding($content, 'ISO-8859-1', true) === 'ISO-8859-1') {
73+
$content = mb_convert_encoding($content, 'HTML-ENTITIES', 'ISO-8859-1');
6774
$content = preg_replace('/<head[^>]*>/', '<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">', $content);
6875
}
6976

src/Providers/Api/Facebook.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public function __construct(Adapter $adapter)
1919
parent::__construct($adapter);
2020

2121
if (($endPoint = $this->getEndPoint())) {
22-
echo $endPoint;
2322
$response = $adapter->getDispatcher()->dispatch($endPoint);
2423

2524
if ($json = $response->getJsonContent()) {

src/Providers/OEmbed/Infogram.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Embed\Providers\OEmbed;
4+
5+
use Embed\Http\Url;
6+
7+
class Infogram extends EndPoint implements EndPointInterface
8+
{
9+
protected static $pattern = [
10+
'infogr.am/*',
11+
'www.infogr.am/*',
12+
];
13+
protected static $endPoint = 'https://infogr.am/oembed';
14+
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public function getEndPoint()
19+
{
20+
$url = $this->response->getUrl()->withScheme('https');
21+
22+
return Url::create(static::$endPoint)
23+
->withQueryParameters([
24+
'url' => (string) $url,
25+
]);
26+
}
27+
}

src/Providers/OEmbed/Twitter.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Embed\Providers\OEmbed;
4+
5+
class Twitter extends EndPoint implements EndPointInterface
6+
{
7+
protected static $pattern = ['*.twitter.com/*', 'twitter.com/*'];
8+
protected static $endPoint = 'https://publish.twitter.com/oembed';
9+
}

tests/AolTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function testOne()
1212
'title' => 'Pile of Recovering Foster Kittens Is Purrfect',
1313
'description' => "Holly Brookhouser has been fostering animals for two years. During that time, she’s been able to take care of 32 kittens. And, they just love being together!",
1414
'type' => 'link',
15-
'providerName' => 'AOL.com',
15+
'providerName' => 'aol',
1616
]
1717
);
1818
}

tests/BambuserTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ class BambuserTest extends AbstractTestCase
77
public function testOne()
88
{
99
$this->assertEmbed(
10-
'http://bambuser.com/v/4740575',
10+
'https://bambuser.com/v/7088053',
1111
[
12-
'title' => '#OccupyWestminster #SaveILF #London #olsx #ONN',
13-
'description' => 'Broadcast by dancole on Bambuser.com',
12+
'title' => 'EASY LISTENING',
13+
'description' => 'Broadcast by WRNU on Bambuser.com',
1414
'type' => 'video',
15-
'code' => '<object id="bplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240"><embed allowfullscreen="true" allowscriptaccess="always" wmode="transparent" type="application/x-shockwave-flash" name="bplayer" src="https://static.bambuser.com/r/player.swf?context=oembed&amp;vid=4740575" width="320" height="240" /><param name="movie" value="https://static.bambuser.com/r/player.swf?context=oembed&amp;vid=4740575" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /></object>',
15+
'code' => '<object id="bplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="320" height="240"><embed allowfullscreen="true" allowscriptaccess="always" wmode="transparent" type="application/x-shockwave-flash" name="bplayer" src="https://static.bambuser.com/r/player.swf?context=oembed&amp;vid=7088053" width="320" height="240" /><param name="movie" value="https://static.bambuser.com/r/player.swf?context=oembed&amp;vid=7088053" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /></object>',
1616
'width' => 320,
1717
'height' => 240,
18-
'authorName' => 'dancole',
18+
'authorName' => 'WRNU',
1919
'providerName' => 'Bambuser.com',
2020
]
2121
);

tests/CadenaserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ public function testOne()
99
$this->assertEmbed(
1010
'http://play.cadenaser.com/audio/001RD010000004275766/',
1111
[
12-
'title' => "Debate electoral gallego, en 'Hoy por Hoy' | Hoy por hoy | Audio | Cadena SER",
12+
'title' => "Debate electoral gallego, en 'Hoy por Hoy' | Hoy por Hoy | Audio | Cadena SER",
1313
'width' => 620,
1414
'height' => 100,
1515
'type' => 'rich',
1616
'code' => '<iframe src="http://play.cadenaser.com/widget/audio/001RD010000004275766/" frameborder="0" allowTransparency="true" style="border:none;overflow:hidden;width:620px;height:100px;"></iframe>',
17-
'providerName' => 'Hoy por hoy',
17+
'providerName' => 'Cadena SER',
1818
]
1919
);
2020
}

tests/DailyMotionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testOne()
1717
'imageHeight' => 240,
1818
'providerName' => 'Dailymotion',
1919
'providerUrl' => 'http://www.dailymotion.com',
20-
'code' => '<iframe frameborder="0" width="480" height="360" src="http://www.dailymotion.com/embed/video/xy0wd" allowfullscreen></iframe>'
20+
'code' => '<iframe frameborder="0" width="480" height="360" src="http://www.dailymotion.com/embed/video/xy0wd" allowfullscreen allow="autoplay"></iframe>'
2121
]
2222
);
2323
}

tests/FacebookTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class FacebookTest extends AbstractTestCase
77
public function testPermalink()
88
{
99
$this->assertEmbed(
10-
'https://www.facebook.co/permalink.php?story_fbid=827163017327807&id=149460691764713',
10+
'https://www.facebook.com/permalink.php?story_fbid=827163017327807&id=149460691764713',
1111
[
1212
'width' => 552,
1313
'code' => true,

tests/HookemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function testOne()
1313
'http://www.hookem.com/story/texas-shortstop-joe-baker-arrested-public-intoxication/',
1414
[
1515
'title' => 'Texas shortstop Joe Baker was arrested for public intoxication',
16-
'image' => 'https://www.hookemplus.com/wp-content/uploads/2016/04/SSS-TexasBaseball-12.jpg',
16+
'image' => 'https://www.hookem.com/wp-content/uploads/2016/04/SSS-TexasBaseball-12.jpg',
1717
]
1818
);
1919
}

0 commit comments

Comments
 (0)