Skip to content

Commit ef09691

Browse files
committed
Added support for GetShow
1 parent dd98c9c commit ef09691

File tree

4 files changed

+104
-0
lines changed

4 files changed

+104
-0
lines changed

doc/02-providers.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,15 @@ I try to support the provider list in [oembed.com](https://oembed.com).
524524
- Notes:
525525
- Auto generated Html for single pictures.
526526

527+
## [GetShow](https://getshow.io)
528+
529+
- Provider Name: GetShow
530+
- Documentation: [YES](https://getshow.io/support/oembed)
531+
- HTTPS support: NO
532+
- Fake Response: NO
533+
- Additional Parameters: Unknown
534+
- Notes: NONE
535+
527536
## [GettyImages](https://gettyimages.com)
528537

529538
- Provider Name: GettyImages

src/Embera/Provider/GetShow.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* GetShow.php
4+
*
5+
* @package Embera
6+
* @author Michael Pratt <yo@michael-pratt.com>
7+
* @link http://www.michael-pratt.com/
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
namespace Embera\Provider;
14+
15+
use Embera\Url;
16+
17+
/**
18+
* GetShow Provider
19+
* @link https://*.getshow.io
20+
*/
21+
class GetShow extends ProviderAdapter implements ProviderInterface
22+
{
23+
/** inline {@inheritdoc} */
24+
protected $endpoint = 'https://api.getshow.io/oembed.json';
25+
26+
/** inline {@inheritdoc} */
27+
protected static $hosts = [
28+
'*.getshow.io'
29+
];
30+
31+
/** inline {@inheritdoc} */
32+
protected $allowedParams = [ 'maxwidth', 'maxheight' ];
33+
34+
/** inline {@inheritdoc} */
35+
protected $httpsSupport = true;
36+
37+
/** inline {@inheritdoc} */
38+
protected $responsiveSupport = false;
39+
40+
/** inline {@inheritdoc} */
41+
public function validateUrl(Url $url)
42+
{
43+
return (bool) (
44+
preg_match('~getshow\.io/share/([^/]+)~i', (string) $url) ||
45+
preg_match('~getshow\.io/embed/iframe/~i', (string) $url)
46+
);
47+
}
48+
49+
/** inline {@inheritdoc} */
50+
public function normalizeUrl(Url $url)
51+
{
52+
$url->convertToHttps();
53+
$url->removeLastSlash();
54+
55+
return $url;
56+
}
57+
58+
}

src/Embera/ProviderCollection/DefaultProviderCollection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public function __construct(array $config = [])
7777
'GeographUk',
7878
'GeographCI',
7979
'GeographDE',
80+
'GetShow',
8081
'GettyImages',
8182
'Gfycat',
8283
'Giphy',
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* GetShowTest.php
4+
*
5+
* @package Embera
6+
* @author Michael Pratt <yo@michael-pratt.com>
7+
* @link http://www.michael-pratt.com/
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
namespace Embera\Provider;
14+
15+
use Embera\ProviderTester;
16+
17+
/**
18+
* Test the GetShow Provider
19+
*/
20+
final class GetShowTest extends ProviderTester
21+
{
22+
protected $tasks = [
23+
'valid_urls' => [
24+
'https://present.getshow.io/share/Mcm3a3YBgj8xrtrWURYz',
25+
//'https://app.getshow.io/embed/iframe/?media=Mcm3a3YBgj8xrtrWURYz',
26+
],
27+
'invalid_urls' => [
28+
'https://app.getshow.io',
29+
],
30+
];
31+
32+
public function testProvider()
33+
{
34+
$this->validateProvider('GetShow', [ 'width' => 480, 'height' => 270]);
35+
}
36+
}

0 commit comments

Comments
 (0)