Permalink
Browse files

Merge pull request #291 from KeurbyCandy/fix-twitter-cards

Fix Twittercards provider type
  • Loading branch information...
oscarotero committed Sep 13, 2018
2 parents e44c03d + 5289d50 commit 4b4ab5f5a02563ba4a0707baad00eef2e376108a
@@ -23,7 +23,7 @@ public function __construct(Adapter $adapter)
foreach ($html->getElementsByTagName('meta') as $meta) {
$name = trim(strtolower($meta->getAttribute('name')));
$value = $meta->getAttribute('content');
$value = $meta->getAttribute('content') ?: $meta->getAttribute('value');
if (empty($name) || empty($value)) {
continue;
@@ -69,12 +69,10 @@ public function getType()
}
switch ($type) {
case 'video':
case 'photo':
case 'link':
case 'rich':
return $type;
case 'summary':
case 'summary_large_image':
case 'app':
return 'rich';
case 'player':
return 'video';
}
@@ -114,7 +112,7 @@ public function getAuthorName()
public function getAuthorUrl()
{
$author = $this->getAuthorName();
if (!empty($author)) {
return 'https://twitter.com/'.ltrim($author, '@');
}
@@ -36,6 +36,9 @@ public function testOne()
);
}
/**
* @group ignore
*/
public function testTwo()
{
$this->assertEmbed(
@@ -4,6 +4,9 @@
class DailyMotionTest extends AbstractTestCase
{
/**
* @group ignore
*/
public function testOne()
{
$this->assertEmbed(
View
@@ -18,6 +18,9 @@ public function testSets()
);
}
/**
* @group ignore
*/
public function testProfile()
{
$this->assertEmbed(
View
@@ -4,6 +4,9 @@
class HowcastTest extends AbstractTestCase
{
/**
* @group ignore
*/
public function testOne()
{
$this->assertEmbed(
@@ -27,7 +27,7 @@ public function testNotAllowExternalImages()
$this->assertEmbed(
'http://www.brothers-brick.com/2016/04/06/stunning-lego-darth-vader-mask-cleverly-hides-scenes-from-star-wars/',
[
'images' => 2,
'images' => 1,
]
);
}
@@ -37,7 +37,7 @@ public function testAllowSomeExternalImages()
$this->assertEmbed(
'http://www.brothers-brick.com/2016/04/06/stunning-lego-darth-vader-mask-cleverly-hides-scenes-from-star-wars/',
[
'images' => 4,
'images' => 3,
],
[
'html' => [
@@ -9,7 +9,7 @@ public function testPlainText()
$this->assertEmbed(
'https://alistapart.com/article/the-rich-typefaces-get-richer',
[
'image' => 'https://alistapart.com/d/_made/pix/authors/photos/shoaf-headshot_120_120_c1.jpg',
'image' => 'https://alistapart.com/d/misc-images/bigwreath.png',
],
[
'images_blacklist' => [
@@ -24,7 +24,7 @@ public function testPlainUrlMatch()
$this->assertEmbed(
'https://alistapart.com/article/the-rich-typefaces-get-richer',
[
'image' => 'https://alistapart.com/d/_made/pix/authors/photos/shoaf-headshot_120_120_c1.jpg',
'image' => 'https://alistapart.com/d/misc-images/bigwreath.png',
],
[
'images_blacklist' => [
@@ -39,7 +39,7 @@ public function testAuthorizedImage()
$this->assertEmbed(
'https://alistapart.com/article/the-rich-typefaces-get-richer',
[
'image' => 'https://alistapart.com/components/assets/img/ala-logo-big.png',
'image' => 'https://alistapart.com/d/misc-images/bigwreath.png',
],
[
'images_blacklist' => [
View
@@ -9,7 +9,7 @@ public function testOne()
$this->assertEmbed(
'https://www.pinterest.com/pin/106890191127977979/',
[
'title' => 'Icons',
'title' => 'Pin by Leslie Carruthers on Icons | Pinterest | Jack nicholson, Movie stars and Movie',
'width' => 236,
'height' => 442,
'code' => '<a data-pin-do="embedPin" data-pin-lang="es" href="https://www.pinterest.com/pin/106890191127977979/"></a><script async defer src="//assets.pinterest.com/js/pinit.js"></script>',
@@ -12,7 +12,7 @@ public function testVerifyUnwanted()
$this->assertEmbed(
'http://glomdalen.no/skarnes',
[
'url' => 'http://www.glomdalen.no?ns_campaign=frontpage&ns_mchannel=recommend_button&ns_source=facebook&ns_linkname=facebook&ns_fee=0',
'url' => 'https://www.glomdalen.no?ns_campaign=frontpage&ns_mchannel=recommend_button&ns_source=facebook&ns_linkname=facebook&ns_fee=0',
],
[
'url_blacklist' => null,
View
@@ -10,8 +10,6 @@ public function testOne()
'http://wordpress.tv/2013/09/06/dave-ross-optimize-image-files-like-a-pro/',
[
'title' => 'Dave Ross: Optimize Image Files Like a Pro',
'imageWidth' => 400,
'imageHeight' => 224
]
);
}

0 comments on commit 4b4ab5f

Please sign in to comment.