Skip to content

Commit

Permalink
Merge branch 'azeos-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mpratt committed Jun 12, 2024
2 parents b29e872 + d0faeeb commit 9875488
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/02-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ I try to support all the providers listed on [oembed.com](https://oembed.com).
- [FlowHubOrg](providers/FlowHubOrg.md)
- [Framer](providers/Framer.md)
- [Fooday](providers/Fooday.md)
- [Genially](providers/Genially.md)
- [GeographUk](providers/GeographUk.md)
- [GeographCI](providers/GeographCI.md)
- [GeographDE](providers/GeographDE.md)
Expand Down
16 changes: 16 additions & 0 deletions doc/providers/Genially.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [Genially](https://genially.com)

Genially Provider
Engage your audience with clickable, gamified, media-rich experiences.
Create your interactive content now!

## Implementation Details

- Provider Name: Genially
- Documentation: NO
- HTTPS support: YES
- Fake Response: NO
- Oembed Params: NO
- Supported Hosts: view.genially.com, view.genial.ly
- Responsive response: YES
- Collections: DefaultProviderCollection
53 changes: 53 additions & 0 deletions src/Embera/Provider/Genially.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* Genially.php
*
* @package Embera
* @author Matías Minevitz <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Embera\Provider;

use Embera\Url;

/**
* Genially Provider
* Engage your audience with clickable, gamified, media-rich experiences. Create your interactive content now!
*
* @link https://genially.com
*/
class Genially extends ProviderAdapter implements ProviderInterface
{
/** inline {@inheritdoc} */
protected $endpoint = 'https://genially.com/services/oembed?format=json';

/** inline {@inheritdoc} */
protected static $hosts = [
'*.genial.ly',
'*.genially.com',
];

/** inline {@inheritdoc} */
protected $httpsSupport = true;

/** inline {@inheritdoc} */
protected $responsiveSupport = true;

/** inline {@inheritdoc} */
public function validateUrl(Url $url)
{
return (bool) (preg_match('~view\.(?:genial\.ly|genially\.com)/[a-z0-9]{24}(?:$|/)~i', (string) $url));
}

/** inline {@inheritdoc} */
public function normalizeUrl(Url $url)
{
$url->convertToHttps();
$url->removeQueryString();

return $url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function __construct(array $config = [])
'FlowHubOrg',
'Framer',
'Fooday',
'Genially',
'GeographUk',
'GeographCI',
'GeographDE',
Expand Down
44 changes: 44 additions & 0 deletions tests/Embera/Provider/GeniallyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* GeniallyTest.php
*
* @package Embera
* @author Matías Minevitz <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Embera\Provider;

use Embera\ProviderTester;

/**
* Test the Genially Provider
*/
final class GeniallyTest extends ProviderTester
{
protected $tasks = [
'valid_urls' => [
'https://view.genially.com/66560826885e160014487db5',
'https://view.genially.com/66560826885e160014487db5/',
'https://view.genially.com/66560826885e160014487db5/asd',
'https://view.genial.ly/663449c0ebfbaa0014b24cc9',
'https://view.genial.ly/663449c0ebfbaa0014b24cc9/',
'https://view.genial.ly/663449c0ebfbaa0014b24cc9/asd',
],
'invalid_urls' => [
'https://view.genially.com/66560826885e160014487db',
'https://view.genially.com/66560826885e160014487db5a',
'https://view.genially.com/en/66560826885e160014487db5',
'https://view.genial.ly/en/663449c0ebfbaa0014b24cc9',
'https://view.genial.ly/663449c0ebfbaa0014b24cc',
'https://view.genial.ly/663449c0ebfbaa0014b24cc9a',
],
];

public function testProvider()
{
$this->validateProvider('Genially', ['width' => 480, 'height' => 270]);
}
}

0 comments on commit 9875488

Please sign in to comment.