PluginProbe
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.4.2
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.4.2
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 / Zingsoft.php
Zingsoft.php
83 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 * Zingsoft.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 * Zingsoft Provider
19 * Log in or Sign up to receive access to purchasing, custom web IDE, premium demos and support fo...
20 *
21 * @link https://app.zingsoft.com
22 *
23 */
24 class Zingsoft extends ProviderAdapter implements ProviderInterface
25 {
26 /** inline {@inheritdoc} */
27 protected $endpoint = 'https://app.zingsoft.com/oembed?format=json';
28
29 /** inline {@inheritdoc} */
30 protected static $hosts = [
31 '*.zingsoft.com'
32 ];
33
34 /** inline {@inheritdoc} */
35 protected $httpsSupport = true;
36
37 /** inline {@inheritdoc} */
38 public function validateUrl(Url $url)
39 {
40 return (bool) (preg_match('~zingsoft\.com/([^/]+)/(embed|view)/([^/]+)~i', (string) $url));
41 }
42
43 /** inline {@inheritdoc} */
44 public function normalizeUrl(Url $url)
45 {
46 $url->convertToHttps();
47 $url->removeQueryString();
48 $url->removeLastSlash();
49
50 return $url;
51 }
52
53 /** inline {@inheritdoc} */
54 public function modifyResponse(array $response = [])
55 {
56 if (!empty($response['html'])) {
57 $response['html'] = trim(preg_replace('~\s+~', ' ', preg_replace('~\n~i', ' ', $response['html'])));
58 }
59
60 return $response;
61 }
62
63 /** inline {@inheritdoc} */
64 public function getFakeResponse()
65 {
66 $attr = [];
67 $attr[] = 'allowtransparency="true"';
68 $attr[] = 'frameborder="0"';
69 $attr[] = 'width="{width}"';
70 $attr[] = 'height="{height}"';
71 $attr[] = 'src="' . $this->url . '"';
72
73 return [
74 'type' => 'rich',
75 'provider_name' => 'Zingsoft',
76 'provider_url' => 'https://*.zingsoft',
77 'title' => 'Unknown title',
78 'html' => '<iframe ' . implode(' ', $attr). '></iframe>',
79 ];
80 }
81
82 }
83