PluginProbe
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.0.12
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.0.12
4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 All 189 releases
embedpress / vendor / wpdevelopers / embera / src / Embera / Provider / Ludus.php
Ludus.php
81 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Ludus.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 * Ludus Provider
19 * @link https://app.ludus.one
20 */
21 class Ludus extends ProviderAdapter implements ProviderInterface
22 {
23 /** inline {@inheritdoc} */
24 protected $endpoint = 'https://app.ludus.one/oembed?format=json';
25
26 /** inline {@inheritdoc} */
27 protected static $hosts = [
28 'app.ludus.one'
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 // a4465cd5-ee82-4534-9755-5e658a7cb198
44 return (bool) (preg_match('~\.ludus\.one/(\w{8})-((\w{4}-){3})(\w{12})$~i', (string) $url));
45 }
46
47 /** inline {@inheritdoc} */
48 public function normalizeUrl(Url $url)
49 {
50 $url->convertToHttps();
51 $url->removeQueryString();
52 $url->removeLastSlash();
53
54 return $url;
55 }
56
57
58 /** inline {@inheritdoc} */
59 public function getFakeResponse()
60 {
61 // <iframe width="960" height="540" src="https://app.ludus.one/fd01598e-5ed7-4edb-8d0e-cf75a36e0a07/full" frameborder="0" allowfullscreen></iframe>
62 $embedUrl = $this->url . '/full';
63
64 $attr = [];
65 $attr[] = 'width="{width}"';
66 $attr[] = 'height="{height}"';
67 $attr[] = 'src="' . $embedUrl . '"';
68 $attr[] = 'frameborder="0"';
69 $attr[] = 'allowfullscreen';
70
71 return [
72 'type' => 'rich',
73 'provider_name' => 'Ludus',
74 'provider_url' => 'https://app.ludus.one',
75 'title' => 'Unknown title',
76 'html' => '<iframe ' . implode(' ', $attr). '></iframe>',
77 ];
78 }
79
80 }
81