PluginProbe
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 2.7.1
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v2.7.1
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 / Zoomable.php
Zoomable.php
68 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Zoomable.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 * Zoomable Provider
19 * @link https://*.zoomable.ca
20 */
21 class Zoomable extends ProviderAdapter implements ProviderInterface
22 {
23 /** inline {@inheritdoc} */
24 protected $endpoint = 'https://srv2.zoomable.ca/oembed/?format=json';
25
26 /** inline {@inheritdoc} */
27 protected static $hosts = [
28 '*.zoomable.ca'
29 ];
30
31 /** inline {@inheritdoc} */
32 protected $httpsSupport = true;
33
34 /** inline {@inheritdoc} */
35 public function validateUrl(Url $url)
36 {
37 return (bool) (preg_match('~zoomable\.ca/viewer\.php\?i=(.+)~i', (string) $url));
38 }
39
40 /** inline {@inheritdoc} */
41 public function normalizeUrl(Url $url)
42 {
43 $url->convertToHttps();
44 return $url;
45 }
46
47 /** inline {@inheritdoc} */
48 public function getFakeResponse()
49 {
50 preg_match('~(\?|&)i=(.+)~i', (string) $this->url, $matches);
51 $embedUrl = 'http://srv2.zoomable.ca/viewer.php?i=' . $matches['2'];
52
53 $attr = [];
54 $attr[] = 'width="{width}"';
55 $attr[] = 'height="{height}"';
56 $attr[] = 'src="' . $embedUrl . '"';
57
58 return [
59 'type' => 'rich',
60 'provider_name' => 'Zoomable',
61 'provider_url' => 'https://zoomable.ca',
62 'title' => 'Unknown title',
63 'html' => '<iframe ' . implode(' ', $attr). '></iframe>',
64 ];
65 }
66
67 }
68