Skip to content

Commit ea987ab

Browse files
committed
Adding getCode() support for 500px
1 parent e0be0aa commit ea987ab

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Adapters/N500px.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
use Embed\Request;
99
use Embed\Providers;
10+
use Embed\Utils;
1011

1112
class N500px extends Adapter implements AdapterInterface
1213
{
14+
1315
/**
1416
* {@inheritdoc}
1517
*/
@@ -19,6 +21,22 @@ public static function check(Request $request)
1921
'https?://500px.com/photo/*',
2022
]);;
2123
}
24+
25+
26+
/**
27+
* {@inheritdoc}
28+
*/
29+
public function getCode()
30+
{
31+
$url=$this->getUrl();
32+
$matches=array();
33+
preg_match('#(https?://500px.com/photo/\d+)#si',$this->getUrl(),$matches);
34+
if (isset($matches[1]) && $matches[1]) {
35+
return Utils::iframe($matches[1].'/embed.html', $this->getWidth(), $this->getHeight());
36+
}
37+
return '';
38+
}
39+
2240

2341
/**
2442
* {@inheritdoc}
@@ -28,5 +46,6 @@ public function run()
2846
//order is important
2947
$this->addProvider('oembed', new Providers\OEmbed());
3048
$this->addProvider('opengraph', new Providers\OpenGraph());
49+
echo $this->request->getUrl();
3150
}
3251
}

0 commit comments

Comments
 (0)