Skip to content

Commit 3c62f28

Browse files
committed
Added Slides adapter. fixes #36
1 parent 5dd17fe commit 3c62f28

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

src/Adapters/Slides.php

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Adapter to get the embed code from slides.com
4+
*/
5+
namespace Embed\Adapters;
6+
7+
use Embed\Viewers;
8+
use Embed\Request;
9+
10+
class Slides extends Webpage implements AdapterInterface
11+
{
12+
/**
13+
* {@inheritDoc}
14+
*/
15+
public static function check(Request $request)
16+
{
17+
return $request->match(array(
18+
'https?://slides.com/*',
19+
));
20+
}
21+
22+
/**
23+
* {@inheritDoc}
24+
*/
25+
public function getCode()
26+
{
27+
return Viewers::iframe($this->request->url->getUrl().'/embed', $this->width, $this->height);
28+
}
29+
30+
/**
31+
* {@inheritDoc}
32+
*/
33+
public function getWidth()
34+
{
35+
return 576;
36+
}
37+
38+
/**
39+
* {@inheritDoc}
40+
*/
41+
public function getHeight()
42+
{
43+
return 420;
44+
}
45+
}

tests/SlidesTest.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
include_once dirname(__DIR__).'/src/autoloader.php';
3+
4+
class SoundcloudTest extends PHPUnit_Framework_TestCase
5+
{
6+
public function testOne()
7+
{
8+
$info = Embed\Embed::create('http://slides.com/alexwalker/responsive-svg/');
9+
10+
$this->assertEquals($info->title, 'responsive-svg by Alex Walker');
11+
$this->assertEquals($info->type, 'rich');
12+
$this->assertEquals($info->code, '<iframe src="http://slides.com/alexwalker/responsive-svg/embed" frameborder="0" allowTransparency="true" style="border:none;overflow:hidden;width:576px;height:420px;"></iframe>');
13+
$this->assertEquals($info->width, 576);
14+
$this->assertEquals($info->height, 420);
15+
$this->assertEquals($info->providerName, 'Slides');
16+
$this->assertEquals($info->providerUrl, 'http://slides.com');
17+
}
18+
}

0 commit comments

Comments
 (0)